diff options
Diffstat (limited to 'src')
473 files changed, 82589 insertions, 0 deletions
diff --git a/src/main/webapp/.htaccess b/src/main/webapp/.htaccess new file mode 100644 index 0000000..3d33392 --- /dev/null +++ b/src/main/webapp/.htaccess @@ -0,0 +1,11 @@ +# this file can be deleted if you're not planning on using URL rewriting with Apache. + +# you can add your own files and folders that should be excluded from URL rewriting by adding them to the "RewriteCond" line below. +# please read the online documentation on http://cfwheels.org for more information about URL rewriting. + +# UNCOMMENT ALL LINES BELOW THIS ONE TO TURN ON THE URL REWRITING RULES + +Options +FollowSymLinks +RewriteEngine On +RewriteCond %{REQUEST_URI} !^.*/(flex2gateway|jrunscripts|cfide|cfformgateway|cffileservlet|railo-context|files|images|javascripts_min|javascripts|miscellaneous|stylesheets|resume|robots.txt|sitemap.xml|rewrite.cfm|favicon.ico|index.html)?($|/.*$) [NC] +RewriteRule ^(.*)$ ./rewrite.cfm/$1 [NS,L] diff --git a/src/main/webapp/Application.cfc b/src/main/webapp/Application.cfc new file mode 100644 index 0000000..c2d3690 --- /dev/null +++ b/src/main/webapp/Application.cfc @@ -0,0 +1,3 @@ +<cfcomponent output="false">
+ <cfinclude template="wheels/functions.cfm">
+</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/IsapiRewrite4.ini b/src/main/webapp/IsapiRewrite4.ini new file mode 100644 index 0000000..362837f --- /dev/null +++ b/src/main/webapp/IsapiRewrite4.ini @@ -0,0 +1,8 @@ +# this file can be deleted if you're not planning on using URL rewriting with IIS 6.
+# you can add your own files and folders that should be excluded from URL rewriting by adding them to the first "RewriteRule" line below.
+# please read the online documentation on http://cfwheels.org for more information about URL rewriting.
+
+# UNCOMMENT ALL LINES BELOW THIS ONE TO TURN ON THE URL REWRITING RULES
+
+# RewriteRule (^/(flex2gateway|jrunscripts|cfide|cfformgateway|railo-context|files|images|javascripts|miscellaneous|stylesheets|robots.txt|sitemap.xml|rewrite.cfm)($|/.*$)) $1 [L,I]
+# RewriteRule ^/(.*)$ /rewrite.cfm/$1 [L]
\ No newline at end of file diff --git a/src/main/webapp/README.markdown b/src/main/webapp/README.markdown new file mode 100644 index 0000000..16b7309 --- /dev/null +++ b/src/main/webapp/README.markdown @@ -0,0 +1,63 @@ +#SQL Fiddle + +##About + +See [the SQL Fiddle about page](http://sqlfiddle.com/about.html) page for background on the site. + +## Getting the project up and running + +If you want to get this app running on your environment, here's how you do it. + +1. Download and install the latest stable [Railo Server with Tomcat](http://www.getrailo.org/index.cfm/download/) for your environment + +2. Remove the unneeded default files from the Railo ROOT folder: + + cd [your railo install base]/tomcat/webapps/ROOT + + ls -d * | grep -v WEB-INF | xargs rm -rf + +3. Clone your fork of this repository into some temporary, empty folder + +4. Put this code into the Railo ROOT folder: + + cp -R sqlfiddle/* sqlfiddle/.git* sqlfiddle/.htaccess [your railo install base]/tomcat/webapps/ROOT/ + +5. Copy the file config/environment.cfm.example to config/environment.cfm + +6. Copy the file config/design/settings.cfm.example to config/design/settings.cfm + +7. Edit config/design/settings.cfm and update the CFAdminPassword value to be whatever you used for your Railo admin password (if you aren't using an Admin password, then it shouldn't matter what this is set to) + +8. Download and install the latest [PostgreSQL server](http://www.postgresql.org/download/) for your environment + +9. Create a new PostgreSQL database named sqlfiddle: + + createdb -U postgres -E UTF8 sqlfiddle + +10. Run the database restore scripts db/schema.sql and db/data.sql in your new sqlfiddle database + +11. Create new datasource connections from Railo to postgresql: + + Browse to http://localhost/railo-context/admin/web.cfm, login (if needed) and navigate to Services->Datasource + + Add a datasource named "sqlfiddle" of type "PostgreSQL". Use the credentials you defined for your sqlfiddle database. + + Add another datasource named "sqlfiddle_pg1" of type "PostgreSQL". Use an account with admin privileges (such as "postgres"), connecting to the "postgres" database. + +12. Setup a mail server for Railo: + + Browse to http://localhost/railo-context/admin/web.cfm, login (if needed) and navigate to Services->Mail + + Add an entry under Mail servers for an SMTP server you have access to. Don't worry if it doesn't actually work; it only matters that there is some defined here. + +13. You should now have a minimally-functional copy of the app available at http://localhost/ (or, if you used a different port when you installed Railo/tomcat, then use that) + + *The only database type options that will be functional are PostgreSQL and SQLite; you'll have to install and configure the other backend database servers and add datasource connections (like sqlfiddle_mysql1) for each of those. I suggest just ignoring them unless you really want to work on something relating to them specifically.* + +14. If you want to use the "View Sample Fiddle" option, you'll have to define your own samples. Build them as normal, then when you have it ready copy the URL fragment (everything after the #!) and set it in the database table "sqlfiddle.db_types", under the column "sample_fragment". + + After you set this value, you'll have to reload the app to clear the cache: http://localhost/?reload=true + +This should get you going! Good luck, and feel free to create an issue on my [GitHub repo](https://github.com/jakefeasel/sqlfiddle) if these instructions need work. + +-- Jake Feasel, 07/15/2012
\ No newline at end of file diff --git a/src/main/webapp/WEB-INF/.htaccess b/src/main/webapp/WEB-INF/.htaccess new file mode 100644 index 0000000..e0d9ba6 --- /dev/null +++ b/src/main/webapp/WEB-INF/.htaccess @@ -0,0 +1,6 @@ +AuthName "WebInf Folder" +AuthType Basic +<Limit GET POST> +order deny,allow +deny from all +</Limit>
\ No newline at end of file diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..cd40c16 --- /dev/null +++ b/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="ISO-8859-1"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ version="2.5">
+
+ <!-- =================================================================== -->
+ <!-- Invoke the Railo Servlet -->
+ <!-- =================================================================== -->
+
+<servlet>
+ <servlet-name>GlobalCFMLServlet</servlet-name>
+ <description>CFML runtime Engine</description>
+ <servlet-class>railo.loader.servlet.CFMLServlet</servlet-class>
+ <init-param>
+ <param-name>configuration</param-name>
+ <param-value>/WEB-INF/railo/</param-value>
+ <description>Configuraton directory</description>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+</servlet>
+
+ <servlet-mapping>
+ <servlet-name>default</servlet-name>
+ <url-pattern>/</url-pattern>
+ </servlet-mapping>
+
+
+
+ <!-- The mapping for the Railo servlet -->
+<servlet-mapping>
+ <servlet-name>GlobalCFMLServlet</servlet-name>
+ <url-pattern>*.cfm</url-pattern>
+</servlet-mapping>
+<servlet-mapping>
+ <servlet-name>GlobalCFMLServlet</servlet-name>
+ <url-pattern>/index.cfm/*</url-pattern>
+</servlet-mapping>
+<servlet-mapping>
+ <servlet-name>GlobalCFMLServlet</servlet-name>
+ <url-pattern>*.cfml</url-pattern>
+</servlet-mapping>
+<servlet-mapping>
+ <servlet-name>GlobalCFMLServlet</servlet-name>
+ <url-pattern>*.cfc</url-pattern>
+</servlet-mapping>
+
+
+ <!-- ==================== Default Welcome File List ===================== -->
+ <!-- When a request URI refers to a directory, the default servlet looks -->
+ <!-- for a "welcome file" within that directory and, if present, -->
+ <!-- to the corresponding resource URI for display. If no welcome file -->
+ <!-- is present, the default servlet either serves a directory listing, -->
+ <!-- or returns a 404 status, depending on how it is configured. -->
+ <!-- -->
+ <!-- If you define welcome files in your own application's web.xml -->
+ <!-- deployment descriptor, that list *replaces* the list configured -->
+ <!-- here, so be sure that you include any of the default values that -->
+ <!-- you wish to include. -->
+
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ <welcome-file>index.htm</welcome-file>
+ <welcome-file>index.jsp</welcome-file>
+ <welcome-file>index.cfm</welcome-file>
+ <welcome-file>index.cfml</welcome-file>
+ </welcome-file-list>
+
+</web-app>
diff --git a/src/main/webapp/about.html b/src/main/webapp/about.html new file mode 100644 index 0000000..be0f563 --- /dev/null +++ b/src/main/webapp/about.html @@ -0,0 +1,584 @@ +<!doctype html> +<html> +<head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> + <title>SQL Fiddle</title> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <meta name="description" content="Application for testing and sharing SQL queries."> + <meta name="author" content="Jake Feasel"> + <link rel="icon" href="favicon.ico" type="image/x-icon"> + <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> + <link href="stylesheets_min/bootstrap-2.0.4/bootstrap.css" media="all" rel="stylesheet" type="text/css" /> + <link href="stylesheets_min/bootstrap-2.0.4/responsive.css" media="all" rel="stylesheet" type="text/css" /> + <link href="stylesheets_min/fiddle.css" media="all" rel="stylesheet" type="text/css" /> + <link href="stylesheets/about.css" media="all" rel="stylesheet" type="text/css" /> + + + +<script type="text/javascript"> + + var _gaq = _gaq || []; + _gaq.push(['_setAccount', 'UA-28576776-1']); + _gaq.push(['_setDomainName', 'sqlfiddle.com']); + _gaq.push(['_trackPageview']); + + (function() { + var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; + ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; + var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); + })(); + +</script> + +</head> +<body> + <div class="navbar navbar-fixed-top"> + <div class="navbar-inner"> + <div class="container"> + <a class="brand" href=".">SQL Fiddle<img src="images/fiddle_transparent_small.png" style="height: 20px;margin-top: -10px;"> </a> + <div class="nav-collapse"> + <ul class="nav"> + <li class="dropdown" id="db_type_id"> + <a class="dropdown-toggle" data-toggle="dropdown" href="#"> + Table of Contents <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + <li class=""> + <a href="#whatToDo">What am I supposed to do here?</a> + </li> + <li class=""> + <a href="#howWorks">How does it work?</a> + </li> + <li class=""> + <a href="#dbNotes">What differences are there between the various database options?</a> + </li> + <li> + <a href="#terminators">What's up with that [ ; ] button under each panel?</a> + </li> + <li class=""> + <a href="#sqlite">Why are there two strange-looking options for SQLite?</a> + </li> + <li> + <a href="#contact">Who should I contact for help/feedback?</a> + </li> + <li> + <a href="#whoBuilt">Who built this site, and why?</a> + </li> + <li> + <a href="#gettingPaid">How is the site paid for?</a> + </li> + <li> + <a href="#source">Source Code</a> + </li> + <li> + <a href="#platform">What platform is it running on?</a> + </li> + </ul> + </li> + <li class="divider-vertical"></li> + <li> + <a href="#source"> + Source Code + </a> + </li> + </ul> + <ul class="nav pull-right"> + <li> + <a href="."><i class="icon-info-sign"></i>Home</a> + </li> + </ul> + </div> + <ul class="nav pull-right" id="exit_fullscreen"> + <li class=""> + <a href="#"><span>Exit Fullscreen</span> <i class="icon-resize-small"></i></a> + </li> + </ul> + </div> + </div> + </div> + <div class="container"> + <div class="row"> + <div class="span12" id="content"> + <!-- + <div class="span6 panel pull-left"> + </div> + <div class="span6 panel pull-right"> + </div> + --> + <div class="span12 panel pull-left"> + <div class="hero-unit"> + <img class="pull-left" src="images/fiddle_transparent.png" title="A fiddle-head fern"> + <div class="page-header pull-left"> + <h1 class="">About SQLFiddle.com</h1> + </div> + <p> + A tool for easy online testing and sharing of database problems and their solutions. + </p> + + </div> + </div> + + <a name="whatToDo"></a> + <div class="span12 pull-left hr-bar"> + <hr> + </div> + + <div class="span9 panel pull-left"> + <h2>What am I supposed to do here?</h2> + <p> + If you do not know SQL or basic database + concepts, this site is not going to be very useful to you. However, if you are a database developer, there are a few + different use-cases of SQL Fiddle intended for you: + </p> + + <p> + <span class="use_case">You want help with a tricky query, and you'd like to post a question to a Q/A site like + <a href="http://stackoverflow.com" title="Awesome Q & A site"><span class="label label-info">StackOverflow</span></a>.</span> Build a + representative database (schema and data) and post a link to it in your question. Unique + URLs for each database (and each query) will be generated as you use the site; just copy and paste the + URL that you want to share, and it will be available for anyone who wants to take a look. They will + then be able to use your DDL and your SQL as a starting point for answering your question. When they + have something they'd like to share with you, they can then send you a link back to their query. + </p> + <p> + <span class="use_case">You want to compare and contrast SQL statements in different database back-ends.</span> SQLFiddle easily lets + you switch which database provider (MySQL, PostgreSQL, MS SQL Server, Oracle, and SQLite) your queries run + against. This will allow you to quickly evaluate query porting efforts, or language options available + in each environment. + </p> + <p> + <span class="use_case">You do not have a particular database platform readily available, but you would like to see what a given + query would look like in that environment.</span> Using SQL Fiddle, you don't need to bother spinning up a + whole installation for your evaluation; just create your database and queries here! + </p> + </div> + <div class="span3 panel pull-right"> + <div class="thumbnail"> + <div class="image"> + <a href="http://www.youtube.com/watch?v=ednxTEGyfV8" target="_blank"> + <img src="http://i2.ytimg.com/vi/ednxTEGyfV8/hqdefault.jpg"> + </a> + </div> + <div class="caption"> + <h5>Para falantes do português</h5> + <p> + <a href="https://twitter.com/#!/guediz" target="_blank"><span class="label">Dickson S. Guedes</span></a> fez um vídeo instrutivo + </p> + <p><a href="http://www.youtube.com/watch?v=ednxTEGyfV8" class="btn btn-primary">Ver</a></p> + </div> + </div> + </div> + + <a name="howWorks"></a> + + <div class="span12 pull-left hr-bar"> + <hr> + </div> + <div class="span12 panel"> + <div class="thumbnail pull-left span3" style="margin-right: 30px; margin-left: 0pt;"> + <div class="image"> + <a href="http://www.vincepergolizzi.com/2012/04/how-to-use-sql-fiddle-or-help-us-to-help-you/" target="_blank"> + <img src="images/blog_sample.png"> + </a> + </div> + <div class="caption"> + <h5>How to share on StackOverflow</h5> + <p> + Vince Pergolizzi wrote a great blog post about the site, providing an overview for how to use it when you ask SQL + questions at places like StackOverflow. + </p> + <p> + <a href="http://www.vincepergolizzi.com/2012/04/how-to-use-sql-fiddle-or-help-us-to-help-you/" class="btn btn-primary"> + See it here + </a> + </p> + </div> + </div> + <h2>How does it work?</h2> + <p> + The Schema DDL that is provided is used to generate a private database on the fly. If anything is changed in your + DDL (even a single space!), then you will be prompted to generate a new schema and will be operating in a new database. + + </p> + <p> + All SQL queries are run within a transaction that gets immediately rolled-back after the SQL executes. This is so + that the underlying database structure does not change from query to query, which makes it possible to share anonymously + online with any number of users (each of whom may be writing queries in the same shared database, potentially modifying + the structure and thus -- if not for the rollback -- each other's results). + </p> + <p> + As you create schemas and write queries, unique URLs that refer to your particular schema and query will be + visible in your address bar. You can share these with anyone, and they will be able to see what you've done + so far. You will also be able to use your normal browser functions like 'back', 'forward', and 'reload', and you + will see the various stages of your work, as you would expect. + + </p> + </div> + + <a name="dbNotes"></a> + + <div class="span12 pull-left hr-bar"> + <hr> + </div> + <div class="span12 panel"> + <h2>What differences are there between the various database options?</h2> + <p> + Aside from the differences inherent in the various databases, there are a few things worth pointing out about their implementation on SQL Fiddle. + </p> + + <p> + MySQL only supports queries which read from the schema (selects, basically). This is necessary due to some limitations in MySQL that make it impossible for + me to ensure a consistent schema while various people are fiddling with it. The other database options allow the full range of queries that the back-end supports. + </p> + + <p> + Versions of various databases that are either older or newer than the current stable release for that product are hosted by <a href="http://douglastechnology.co.uk/">Jack Douglas</a> in his server + environment. This means that some of the schema building / query execution actions may be a bit slower for these options, as there is more network latency between + my web server and his VMs. + </p> + + <p> + SQLite runs in the browser; see below for more details. + <p> + + </div> + + <a name="terminators"></a> + + <div class="span12 pull-left hr-bar"> + <hr> + </div> + <div class="span12 panel"> + <h2>What's up with that [ ; ] button under each panel?</h2> + <p> + This obscure little button determines how the queries in each of the panels get broken up before they + are sent off to the database. This button pops open a dropdown that lists different "query terminators." + Query terminators are used as a flag to indicate (when present at the end of a line) that the current statement + has ended. The terminator does not get sent to the database; instead, it merely idicates how I should parse the + text before I execute the query. + </p> + <p> + Oftentimes, you won't need to touch this button; the main value this feature will have is in defining stored procedures. + This is because it is often the case that within a stored procedure's body definition, you might want to end a line with a + semicolon (this is often the case). Since my default query terminator is also a semicolon, there is no obvious way for me to + see that your stored procedure's semicolon isn't actually the end of the query. Left with the semicolon terminator, I would break up your procedure + definition into incorrect parts, and errors would certainly result. Changing the query terminator to something other + than a semicolon avoids this problem. + </p> + </div> + + <a name="sqlite"></a> + + <div class="span12 pull-left hr-bar"> + <hr> + </div> + <div class="span12 panel"> + <h2>Why are there two strange-looking options for SQLite?</h2> + <p> + SQLite is something of a special case amongst the various database types I support. I could have implemented it the same way as + the others, with a backend host doing the query execution, but what fun is that? SQLite's "lite" nature allowed for some + interesting alternatives. + + </p> + <p> + First, I found the very neat project + <a href="https://github.com/kripken/sql.js"><span class="label label-info">SQL.js</span></a>, which is an implementation of the engine translated into javascript. + This means that instead of using my servers (and my limited memory), I could offload the work onto your browser! Great for me, + but unfortunately SQL.js does have a few drawbacks. One is that it taxes the browser a bit when it is first loaded into memory. The + other is that it doesn't work in all browsers (so far I've seen it fail in IE9 and mobile Safari). + </p> + <p> + + The other option is "WebSQL." This option makes use of the SQLite implementation that a few browsers come with built-in (I've seen it work in Chrome and Safari; supposedly Opera supports this too). This feature + was considered part of the <a href="http://www.w3.org/TR/webdatabase/"><span class="label label-info">W3C working draft for HTML5</span></a>, but they depricated it in + favor of <a href="http://www.w3.org/TR/IndexedDB/"><span class="label label-info">IndexedDB</span></a>. Despite this, a few browsers (particularly mobile browsers) still + have it available, so I figured that this would be a useful feature to grab onto. The advantage over SQL.js is that it is quite a bit faster + to load the schema and run the queries. The disadvantage is that it isn't widely supported, and likely not long for this world. + + </p> + <p> + Together, these two options allow SQLite to run within any <i>decent</i> browser *cough*IE*cough*. If someone links you to a SQLite fiddle + that your browser doesn't support, just switch over to the other option and build it using that one. If neither works, then get a better browser. + </p> + </div> + + <a name="contact"></a> + + <div class="span12 pull-left hr-bar"> + <hr> + </div> + <div class="span12 panel pull-right"> + <h2>Who should I contact for help/feedback?</h2> + <p> + There are two ways you can get in contact: + </p> + <ul> + <li>Email : admin<at>sqlfiddle<dot>com</li> + <li>Twitter: <a href="https://twitter.com/#!/sqlfiddle"><span class="label label-info">@sqlfiddle</span></a></li> + </ul> + </div> + + <a name="whoBuilt"></a> + <div class="span12 pull-left hr-bar"> + <hr> + </div> + <div class="span12 panel pull-left"> + + <h2>Who built this site, and why?</h2> + <p> + SQLFiddle.com was built by me, <a href="http://stackoverflow.com/users/808921/jake-feasel"><span class="label">Jake Feasel</span></a>, + a web developer originally from Anchorage, Alaska and now living in Vancouver, WA. I started developing the site around the middle of January, 2012. + </p> + <p> + I had been having fun answering questions on StackOverflow, particularly related to a few main categories: + <a href="http://stackoverflow.com/search?q=user:808921+[coldfusion]"><span class="label label-warning">ColdFusion</span></a>, + <a href="http://stackoverflow.com/search?q=user:808921+[jquery]"><span class="label label-warning">jQuery</span></a>, and + <a href="http://stackoverflow.com/search?q=user:808921+[sql]"><span class="label label-warning">SQL</span></a>. + </p> + <p> + <a href="http://stackoverflow.com/users/808921/jake-feasel"> + <img src="http://stackoverflow.com/users/flair/808921.png" width="208" height="58" alt="profile for Jake Feasel at Stack Overflow, Q&A for professional and enthusiast programmers" title="profile for Jake Feasel at Stack Overflow, Q&A for professional and enthusiast programmers"> + </a> + </p> + <p> + I found <a href="http://jsfiddle.net"><span class="label label-info">JS Fiddle</span></a> to be a great tool for answering javascript / jQuery questions, + but I also found that there was nothing available that offered similar functionality for the SQL questions. So, that + was my inspiration to build this site. Basically, I built this site as a tool for developers like me to be more + effective in assisting other developers. + </p> + <p> + <a href="http://ramonroche.com/"><span class="label label-info">Ramon Roche</span></a> helped me to get the UI moved to Bootstrap, and just generally helped to make it look a lot better. + This has been my first time using Bootstrap, and without his assistance getting started I'm sure it would have been a lot rougher. Thanks Ramon! + </p> + + + + </div> + + + <a name="gettingPaid"></a> + <div class="span12 pull-left hr-bar"> + <hr> + </div> + <div class="span12 panel pull-left"> + + <h2>How is the site paid for?</h2> + <p> + Originally, my costs for operating this site were very low - basically, I had a free ride on the cloud hosting environment purchased by my former employer, <a href="http://www.geonorth.com">GeoNorth</a>. + However, as I moved on to <a href="http://www.forgerock.com">different employment</a>, I knew I would no longer have this luxury. Fortunately, the site has had enough usage since it's initial rollout to + gain a sponsor's interest. So, thanks to the very good folks at <a href="http://www.sqlsentry.com">SQL Sentry</a>, I am able to cover the costs of running this site. + </p> + + <p> + Sponsorship aside, server memory is still tight and I would like to expand. If you would like to help me run this site, then you have several options to do so. + First, you could visit SQL Senty by clicking on the ad on the bottom of the main page, and try out their products. Second, you can click on the <a href="http://flattr.com/thing/679503/SQL-Fiddle">Flattr link</a> + at the top of the page and kick me a little micro-donation. Flattr is a new service so I know a lot of people haven't started using it yet; if you're + more comfortable with PayPal, and would like to help me out with running the site that way, I'd really love to have your support. My <i>admin at sqlfiddle dot com</i> address + is hooked up with PayPal, so please feel free to help me out that way. + </p> + + <p> + One of the biggest contributors I have for the site is <a href="http://douglastechnology.co.uk/">Jack Douglas</a>, from <a href="http://dba.stackexchange.com">dba.stackexchange.com</a>. Jack has provided many of the + VPS instances that I'm using to run the non-primary versions of various databases. Thanks Jack! + </p> + + </div> + + <a name="source"></a> + + <div class="span12 pull-left hr-bar"> + <hr> + </div> + <div class="span12 panel pull-left"> + <h2>Source Code</h2> + <p> + If you are interested in the fine details of the code behind SQL Fiddle, it is all available on <a href="https://github.com/jakefeasel/sqlfiddle"><span class="label label-info">github</span></a> + </p> + </div> + + <a name="platform"></a> + <div class="span12 pull-left hr-bar"> + <hr> + </div> + <div class="span12 panel"> + <h2>What platform is it running on?</h2> + <p> + This site uses many different technologies. The primary ones used to provide the core service, in order from client to server are these: + </p> + <table class="table table-striped table-bordered table-condensed"> + <thead> + <tr> + <th>Title</th> + <th>Description</th> + </tr> + </thead> + <tbody> + <tr> + <th> + <a href="http://requirejs.org/">RequireJS</a> <span class="badge badge-success">js</span> + </th> + <td> + JavaScript module loader and code optimizer. + </td> + </tr> + <tr> + <th> + <a href="http://www.codemirror.net">CodeMirror</a> <span class="badge badge-important">plugin</span> + </th> + <td> + For browser-based SQL editing with text highlighting. + </td> + </tr> + <tr> + <th> + <a href="http://twitter.github.com/bootstrap/">Bootstrap</a> <span class="badge badge-inverse">html / css / js</span> + </th> + <td> + Twitter's CSS framework. + </td> + </tr> + <tr> + <th> + <a href="http://lesscss.org/">LESS</a> <span class="badge badge-inverse">html / css / js</span> + <td> + CSS pre-processor + </td> + </tr> + <tr> + <th> + <a href="http://documentcloud.github.com/backbone/">Backbone.js</a> <span class="badge badge-success">js</span> + </th> + <td> + MVC JavaScript framework. + </td> + </tr> + <tr> + <th> + <a href="http://handlebarsjs.com/">Handlebars.js</a> <span class="badge badge-success">js</span> + </th> + <td> + JavaScript templating engine. + </td> + </tr> + <tr> + <th> + <a href="http://openid.riaforge.org/">OpenID</a> <span class="badge badge-info">cfm</span> + </th> + <td> + ColdFusion library for OpenID integration. + </td> + </tr> + <tr> + <th> + <a href="http://blog.stevenlevithan.com/archives/date-time-format">Date.format.js</a> <span class="badge badge-important">plugin</span> + </th> + <td> + Date formatting JavaScript library. + </td> + </tr> + <tr> + <th> + <a href="http://jquery.com">jQuery</a> <span class="badge badge-success">js</span> + </th> + <td> + AJAX, plus misc JS goodness. (Also jq plugin <a href="http://malsup.com/jquery/block/"><span class="label label-info">Block UI</span></a> and <a href="https://github.com/carhartl/jquery-cookie"><span class="label label-info">Cookie</span></a>). + </td> + </tr> + <tr> + <th> + <a href="http://code.google.com/p/html-query-plan/">html-query-plan</a> <span class="badge badge-important">plugin</span> + </th> + <td> + XSLT for building rich query plans for SQL Server. + </td> + </tr> + <tr> + <th> + <a href="http://sqlformat.appspot.com/">SQLFormat</a> <span class="badge badge-inverse">webservice</span> + </th> + <td> + Online instant SQL statement formatter. + </td> + </tr> + <tr> + <th> + <a href="http://cfwheels.org">ColdFusion on Wheels</a> <span class="badge badge-info">cfm</span> + </th> + <td> + ColdFusion framework modeled after Ruby on Rails. + </td> + </tr> + <tr> + <th> + <a href="http://www.getrailo.org">Railo</a> <span class="badge badge-info">cfm</span> + </th> + <td> + Open Source CFML Application server. + </td> + </tr> + <tr> + <th> + <a href="http://tomcat.apache.org">Tomcat</a> <span class="badge badge-warning">java</span> + </th> + <td> + Open Source Java Servlet Engine. + </td> + </tr> + <tr> + <th> + <a href="http://httpd.apache.org">Apache HTTPD</a> <span class="badge badge">www</span> + </th> + <td> + Open Source HTTP Server. + </td> + </tr> + <tr> + <th> + <a href="http://www.postgresql.org">PostgreSQL</a> <span class="badge badge-inverse">db</span> + </th> + <td> + Among others, of course, but PG is the central database host for this platform. + </td> + </tr> + <tr> + <th> + <a href="http://www.centos.org">RedHat Enterprise Linux</a> <span class="badge badge">os</span> + </th> + <td> + Linux distribution. + </td> + </tr> + <tr> + <th> + <a href="http://aws.amazon.com">Amazon AWS</a> <span class="badge badge-inverse">hosting</span> + </th> + <td> + VPS Cloud Hosting Provider. + </td> + </tr> + <tr> + <th> + <a href="https://github.com">GitHub</a> <span class="badge badge-inverse">hosting</span> + </th> + <td> + Git repository, collaboration enviroment. + </td> + </tr> + </tbody> + </table> + <div class="alert alert-info"> + <p> + <i class="icon-search icon-info-sign"></i> This list doesn't include the stacks used to run the database engines. Those are pretty standard installs of the various products. For example, I'm running a Windows 2008 VPS running SQL Server 2012, 2008 and Oracle, and various CentOS VPS instances running the others. + </p> + </div> + </div> + </div> + </div> + </div> + <script src="javascripts/libs/jquery/jquery.js" type="text/javascript"></script> + <script src="javascripts/libs/bootstrap/bootstrap-collapse.js" type="text/javascript"></script> + <script src="javascripts/libs/bootstrap/bootstrap-dropdown.js" type="text/javascript"></script> + <script src="javascripts/libs/bootstrap/bootstrap-modal.js" type="text/javascript"></script> +</body> +</html> diff --git a/src/main/webapp/config/app.cfm b/src/main/webapp/config/app.cfm new file mode 100644 index 0000000..fbfcabd --- /dev/null +++ b/src/main/webapp/config/app.cfm @@ -0,0 +1,6 @@ +<!---
+ Place settings that should go in the Application.cfc's "this" scope here.
+ <cfset this.name = "MyAppName">
+--->
+
+<cfset this.sessionTimeout = CreateTimeSpan(0,0,5,0)>
\ No newline at end of file diff --git a/src/main/webapp/config/design/.gitignore b/src/main/webapp/config/design/.gitignore new file mode 100644 index 0000000..9c53ff0 --- /dev/null +++ b/src/main/webapp/config/design/.gitignore @@ -0,0 +1 @@ +/settings.cfm diff --git a/src/main/webapp/config/design/settings.cfm.example b/src/main/webapp/config/design/settings.cfm.example new file mode 100644 index 0000000..581ac1c --- /dev/null +++ b/src/main/webapp/config/design/settings.cfm.example @@ -0,0 +1,10 @@ +<!---
+ This file is used to configure specific settings for the "design" environment.
+ A variable set in this file will override the one in "config/settings.cfm".
+ Example: <cfset set(dataSourceName="devDB")>
+--->
+
+
+ <cfset set(CFAdminPassword="admin")>
+ <cfset set(showDebugInformation=false)>
+
\ No newline at end of file diff --git a/src/main/webapp/config/development/settings.cfm b/src/main/webapp/config/development/settings.cfm new file mode 100644 index 0000000..4eec4de --- /dev/null +++ b/src/main/webapp/config/development/settings.cfm @@ -0,0 +1,10 @@ +<!---
+ This file is used to configure specific settings for the "development" environment.
+ A variable set in this file will override the one in "config/settings.cfm".
+ Example: <cfset set(dataSourceName="devDB")>
+--->
+
+
+ <cfset set(CFAdminPassword="admin")>
+
+ <cfset set(showDebugInformation=false)>
\ No newline at end of file diff --git a/src/main/webapp/config/environment.cfm.example b/src/main/webapp/config/environment.cfm.example new file mode 100644 index 0000000..f19006a --- /dev/null +++ b/src/main/webapp/config/environment.cfm.example @@ -0,0 +1,5 @@ +<!---
+ The environment setting can be set to "design", "development", "testing", "maintenance" or "production".
+ For example, set it to "design" or "development" when you are building your application and to "production" when it's running live.
+--->
+<cfset set(environment="design")>
diff --git a/src/main/webapp/config/maintenance/settings.cfm b/src/main/webapp/config/maintenance/settings.cfm new file mode 100644 index 0000000..705f113 --- /dev/null +++ b/src/main/webapp/config/maintenance/settings.cfm @@ -0,0 +1,5 @@ +<!---
+ This file is used to configure specific settings for the "maintenance" environment.
+ A variable set in this file will override the one in "config/settings.cfm".
+ Example: <cfset set(ipExceptions="an.ip.num.ber")>
+--->
\ No newline at end of file diff --git a/src/main/webapp/config/production/settings.cfm.example b/src/main/webapp/config/production/settings.cfm.example new file mode 100644 index 0000000..0758643 --- /dev/null +++ b/src/main/webapp/config/production/settings.cfm.example @@ -0,0 +1,8 @@ +<!---
+ This file is used to configure specific settings for the "production" environment.
+ A variable set in this file will override the one in "config/settings.cfm".
+ Example: <cfset set(errorEmailAddress="someone@somewhere.com")>
+--->
+ <cfset set(CFAdminPassword="")> <!--- your real production cfadmin password goes here --->
+
+<cfset set(URLRewriting="On")>
diff --git a/src/main/webapp/config/routes.cfm b/src/main/webapp/config/routes.cfm new file mode 100644 index 0000000..17054b4 --- /dev/null +++ b/src/main/webapp/config/routes.cfm @@ -0,0 +1,6 @@ +<!---
+ Here you can add routes to your application and edit the default one.
+ The default route is the one that will be called on your application's "home" page.
+--->
+<cfset addRoute(name="home", pattern="", controller="fiddles", action="index")>
+<cfset addRoute(name="about", pattern="/about", controller="meta", action="about")>
\ No newline at end of file diff --git a/src/main/webapp/config/settings.cfm b/src/main/webapp/config/settings.cfm new file mode 100644 index 0000000..d999e5e --- /dev/null +++ b/src/main/webapp/config/settings.cfm @@ -0,0 +1,17 @@ +<!---
+ If you leave these settings commented out, Wheels will set the data source name to the same name as the folder the application resides in.
+ <cfset set(dataSourceName="")>
+ <cfset set(dataSourceUserName="")>
+ <cfset set(dataSourcePassword="")>
+--->
+ <cfset set(dataSourceName="sqlfiddle")>
+
+<!---
+ If you leave this setting commented out, Wheels will try to determine the URL rewrite capabilities automatically.
+ The URLRewriting setting can bet set to "On", "Partial" or "Off".
+ To run with "Partial" rewriting, the "PATH_INFO" variable needs to be supported by the web server.
+ To run with rewriting "On", you need to apply the necessary rewrite rules on the web server first.
+ <cfset set(URLRewriting="Partial")>
+--->
+
+<cfset addFormat(extension="js", mimeType="application/x-javascript")>
diff --git a/src/main/webapp/config/testing/settings.cfm b/src/main/webapp/config/testing/settings.cfm new file mode 100644 index 0000000..e5ed425 --- /dev/null +++ b/src/main/webapp/config/testing/settings.cfm @@ -0,0 +1,5 @@ +<!---
+ This file is used to configure specific settings for the "testing" environment.
+ A variable set in this file will override the one in "config/settings.cfm".
+ Example: <cfset set(cacheQueries=false)>
+--->
\ No newline at end of file diff --git a/src/main/webapp/controllers/Controller.cfc b/src/main/webapp/controllers/Controller.cfc new file mode 100644 index 0000000..cfcb401 --- /dev/null +++ b/src/main/webapp/controllers/Controller.cfc @@ -0,0 +1,37 @@ +<!---
+ This is the parent controller file that all your controllers should extend.
+ You can add functions to this file to make them globally available in all your controllers.
+ Do not delete this file.
+--->
+<cfcomponent extends="Wheels">
+ <cfscript>
+ function init() {
+ filters(through="restoreSession"); + }
+ function restoreSession() {
+ if (StructKeyExists(cookie, "openid") AND StructKeyExists(cookie, "auth_token"))
+ {
+ openid = model("Users").findOne(where="identity='#cookie.openid#' AND auth_token='#cookie.auth_token#'");
+ if (IsObject(openid))
+ {
+ session.user = {};
+ session.user.id = openID.id;
+ session.user.openid_server = openID.openid_server;
+ session.user.identity = openID.identity;
+ session.user.auth_token = openID.auth_token;
+ session.user.email = openid.email;
+ session.user.firstname = openid.firstname;
+ session.user.lastname = openid.lastname;
+ }
+ } + }
+
+ function requireLoggedIn()
+ {
+ if (! StructKeyExists(session, "user"))
+ location(url="..", addToken=false);
+ }
+
+
+ </cfscript>
+</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/controllers/Dashboard.cfc b/src/main/webapp/controllers/Dashboard.cfc new file mode 100644 index 0000000..d48295e --- /dev/null +++ b/src/main/webapp/controllers/Dashboard.cfc @@ -0,0 +1,14 @@ +component extends="Controller" { + function index() { + + } + + function init() + { + super.init(); + filters(through="requireLoggedIn"); + } + + + +}
\ No newline at end of file diff --git a/src/main/webapp/controllers/Fiddles.cfc b/src/main/webapp/controllers/Fiddles.cfc new file mode 100644 index 0000000..83cbf7c --- /dev/null +++ b/src/main/webapp/controllers/Fiddles.cfc @@ -0,0 +1,254 @@ +component extends="Controller" { + + function init() { + super.init(); + provides("json,js"); + caches(actions="index,dbTypes", time=30); + } + + function index() { + contentFor(utilityModals=includePartial('textToDDL')); + contentFor(utilityModals=includePartial('loginModal')); + contentFor(utilityModals=includePartial('myFiddlesModal')); + } + + function dbTypes () { + db_types = model("DB_Type").findAll(select="id,full_name,sample_fragment,simple_name,notes,context,jdbc_class_name", order="simple_name, is_latest_stable desc, full_name desc", cache="true"); + getPageContext().getResponse().addHeader("Cache-Control","max-age=86400"); // one day + renderWith(data="#db_types#", layout=false); + } + + function createSchema () { + + try + { + if (params.statement_separator IS NOT ";") // necessary to preserve older fiddles + var md5 = Lcase(hash(params.statement_separator & params.schema_ddl, "MD5")); + else + var md5 = Lcase(hash(params.schema_ddl, "MD5")); + + var short_code = ""; + + var schema_def = model("Schema_Def").findOne(where="db_type_id=#params.db_type_id# AND md5 = '#md5#'"); + + if (IsObject(schema_def) AND IsNumeric(schema_def.current_host_id)) + { + schema_def.last_used = now(); + schema_def.save(); + + short_code = schema_def.short_code; + } + else + { + if (IsObject(schema_def)) // schema record exists, but without an active database host + { + short_code = schema_def.short_code; + schema_def.initialize(); + } + else // time to create a new schema + { + + if (Len(params.schema_ddl) GT 8000) + throw ("Your schema ddl is too large (more than 8000 characters). Please submit a smaller DDL."); + + short_code = model("Schema_Def").getShortCode(md5, params.db_type_id); + + schema_def = model("Schema_Def").new(); + schema_def.db_type_id = params.db_type_id; + schema_def.statement_separator = params.statement_separator; + schema_def.ddl = params.schema_ddl; + schema_def.short_code = short_code; + schema_def.md5 = md5; + + if (StructKeyExists(session, "user")) + { + schema_def.owner_id = session.user.id; + } + + lock name="#params.db_type_id#_#short_code#" type="exclusive" timeout="60" + { + + try { + schema_def.initialize(); + } + catch (Database dbError) { + schema_def.purgeDatabase(false); + schema_def.delete(); + throw ("Schema Creation Failed: " & dbError.message & ": " & dbError.Detail); + } + catch (Any e) { + throw ("Unknown Error Occurred: " & e.message & ": " & e.Detail); + } + + } + + } + + } + + model("User_Fiddle").logAccess(schema_def_id=schema_def.id); + + renderText(SerializeJSON({ + "short_code" = short_code, + "schema_structure" = schema_def.getSchemaStructure() + })); + + } + catch (Any e) + { + renderText(SerializeJSON({"error" = e.message})); + } + + + + + } + + function runQuery() { + + if (Len(params.sql) GT 8000) + throw ("Your sql is too large (more than 8000 characters). Please submit a smaller SQL statement."); + + var schema_def = model("Schema_Def").findOne(where="db_type_id=#params.db_type_id# AND short_code='#params.schema_short_code#'"); + + if (params.statement_separator IS NOT ";") // necessary to preserve older fiddles + var md5 = Lcase(hash(params.statement_separator & params.sql, "MD5")); + else + var md5 = Lcase(hash(params.sql, "MD5")); + + + if (! IsObject(schema_def)) + { + throw("Schema short code provided was not recognized."); + } + + if (! IsNumeric(schema_def.current_host_id)) + { + schema_def.initialize(); + } + + query = model("Query").findOne(where="md5 = '#md5#' AND schema_def_id = #schema_def.id#", include="Schema_Def"); + + if (! IsObject(query)) + { + nextQueryID = model("Query").findAll(select="count(*) + 1 AS nextID", where="schema_def_id = #schema_def.id#").nextID; + query = model("Query").new(); + query.schema_def_id = schema_def.id; + query.sql = params.sql; + query.statement_separator = params.statement_separator; + query.md5 = md5; + query.id = nextQueryID; + + if (StructKeyExists(session, "user")) + { + query.author_id = session.user.id; + } + + query.save(); + } + + model("User_Fiddle").logAccess(schema_def_id=schema_def.id,query_id=query.id); + + returnVal = {id = query.id}; + StructAppend(returnVal, query.executeSQL()); + + + renderText(SerializeJSON(returnVal)); + + } + + function loadContent() { + + var returnVal = {}; + if (IsDefined("params.fragment") AND Len(params.fragment)) + { + parts = ListToArray(params.fragment, '/'); + if (ArrayLen(parts) >= 1) + { + parts[1] = ReReplace(parts[1], "^!", ""); + if (IsNumeric(parts[1])) + { + returnVal["db_type_id"] = parts[1]; + } + } + + if (ArrayLen(parts) >= 2 AND IsNumeric(parts[1])) + { + schema_def = model("Schema_Def").findOne(where="db_type_id=#parts[1]# AND short_code = '#parts[2]#'"); + + if (IsObject(schema_def)) + { + returnVal["short_code"] = parts[2]; + returnVal["ddl"] = schema_def.ddl; + returnVal["schema_statement_separator"] = schema_def.statement_separator; + if (! IsNumeric(schema_def.current_host_id)) + { + schema_def.initialize(); + } + else + { + schema_def.last_used = now(); + schema_def.save(); + } + + if (NOT (ArrayLen(parts) >= 3 AND IsDefined("schema_def") AND IsObject(schema_def))) + { + model("User_Fiddle").logAccess(schema_def_id=schema_def.id); + } + + + returnVal["schema_structure"] = schema_def.getSchemaStructure(); + } + } + + if (ArrayLen(parts) >= 3 AND IsDefined("schema_def") AND IsObject(schema_def)) + { + if (IsNumeric(parts[3])) + { + myQuery = model("Query").findOne(where="id=#parts[3]# AND schema_def_id=#schema_def.id#", cache="true"); + if (IsObject(myQuery)) + { + returnVal["id"] = myQuery.id; + returnVal["sql"] = myQuery.sql; + returnVal["query_statement_separator"] = myQuery.statement_separator; + + model("User_Fiddle").logAccess(schema_def_id=schema_def.id,query_id=myQuery.id); + + StructAppend(returnVal, myQuery.executeSQL()); + } + } + } + + } + + renderText(SerializeJSON(returnVal)); + + } + + + function getSQLPlan() { + query_set = model("Query_Set").findOne(where="id=#params.id+1# AND query_id = #params.query_id# AND short_code = '#params.short_code#' AND db_type_id = #params.db_type_id#", include="Schema_Def"); + + if (IsObject(query_set) && IsJSON(query_set.execution_plan)) + { + xplan = DeserializeJSON(query_set.execution_plan); + if (ArrayLen(xplan.data)) + { + if (query_set.schema_def.dbSimpleName IS "SQL Server") + { + header name="content-disposition" value="attachment; filename=sqlfiddle_#params.db_type_id#_#params.short_code#_#params.query_id#_#params.id#.sqlplan"; + renderText(xplan.data[1][1]); + } + else + { + renderText("This function is only available for SQL Server"); + } + } + else + renderText("No Execution Plan Found"); + } + else + renderText("No Execution Plan Found"); + } + +} diff --git a/src/main/webapp/controllers/Proxy.cfc b/src/main/webapp/controllers/Proxy.cfc new file mode 100644 index 0000000..d90fc55 --- /dev/null +++ b/src/main/webapp/controllers/Proxy.cfc @@ -0,0 +1,13 @@ +<cfcomponent extends="Controller"> + <cffunction name="formatSQL"> + <cfhttp url="http://sqlformat.appspot.com/format/" method="POST"> + <cfhttpparam type="formfield" name="keyword_case" value="upper"> + <cfhttpparam type="formfield" name="reindent" value="true"> + <cfhttpparam type="formfield" name="data" value="#params.sql#" > + </cfhttp> + + <cfscript> + renderText(cfhttp.filecontent); + </cfscript> + </cffunction> +</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/controllers/Tasks.cfc b/src/main/webapp/controllers/Tasks.cfc new file mode 100644 index 0000000..c7a470f --- /dev/null +++ b/src/main/webapp/controllers/Tasks.cfc @@ -0,0 +1,36 @@ +<cfcomponent extends="Controller"> + + <cffunction name="cleanup"> + <cfscript> + + var stale_schemas = model("Schema_Def").findAll(where="last_used < '#DateAdd('n', -30, Now())#' AND current_host_id IS NOT NULL", returnAs="objects", order="last_used"); + var i = 0; + for (i = 1; i<= ArrayLen(stale_schemas); i++) + { + lock name="#stale_schemas[i].db_type_id#_#stale_schemas[i].short_code#" type="exclusive" timeout="60" + { + stale_schemas[i].purgeDatabase(1); + } + } + + + </cfscript> + + <cfobjectcache + action = "clear" /> + + <cfset renderNothing()> + + + </cffunction> + + <cffunction name="buildMetaData"> + <cfscript> + + schemas = model("Schema_Def").findAll(where="structure_json IS NULL"); + + </cfscript> + </cffunction> + + +</cfcomponent> diff --git a/src/main/webapp/controllers/UserFiddles.cfc b/src/main/webapp/controllers/UserFiddles.cfc new file mode 100644 index 0000000..107540e --- /dev/null +++ b/src/main/webapp/controllers/UserFiddles.cfc @@ -0,0 +1,81 @@ +component extends="Controller" { + + function init() { + super.init(); + filters(through="requireLoggedIn"); + } + + function index() { + fiddles = model("User_Fiddle").findFiddles(session.user.id); + favorites = model("User_Fiddle").findFavorites(session.user.id); + renderPage(layout=false); + } + + function getFavorites() { + favorites = model("User_Fiddle").findFavorites(session.user.id); + renderPartial("favorites"); + } + + function forgetSchema() { + model("User_Fiddle").updateAll(where="user_id=#session.user.id# AND schema_def_id = #params.schema_def_id#", show_in_history = 0); + renderNothing(); + } + + function forgetQuery() { + model("User_Fiddle").updateAll(where="user_id=#session.user.id# AND schema_def_id = #params.schema_def_id# AND query_id = #params.query_id#", show_in_history = 0); + renderNothing(); + } + + function forgetOtherQueries() { + model("User_Fiddle").updateAll(where="user_id=#session.user.id# AND schema_def_id = #params.schema_def_id# AND query_id != #params.query_id#", show_in_history = 0); + renderNothing(); + } + + function setFavorite() { + model("User_Fiddle").updateAll(where="user_id=#session.user.id# AND schema_def_id = #params.schema_def_id# AND query_id = #params.query_id#", favorite = params.favorite); + renderNothing(); + } + + function loadFromLocalStorage() { + + var loadedFiddles = []; + try + { + var localHistory = DeserializeJSON(params.localHistory); + + for (var i = 1; i<= ArrayLen(localHistory); i++) + { + if (ListLen(localHistory[i][1], "/") GTE 2) + { + local.short_code = ListGetAt(localHistory[i][1], 2, "/"); + local.db_type_id = ReReplace(ListGetAt(localHistory[i][1], 1, "/"), "^!", ""); + + local.schema_def = model("Schema_Def").findOne(returnAs="query", where="db_type_id = #local.db_type_id# AND short_code = '#local.short_code#'"); + if (local.schema_def.recordCount IS 1) + { + if (ListLen(localHistory[i][1], "/") GTE 3) + { + local.query_id = ListGetAt(localHistory[i][1], 3, "/"); + local.succeeded = model("User_Fiddle").logAccess(schema_def_id=local.schema_def.id, query_id=local.query_id, last_accessed=localHistory[i][2]); + } + else // must just be a schema-only fragment + { + local.succeeded = model("User_Fiddle").logAccess(schema_def_id=local.schema_def.id, last_accessed=localHistory[i][2]); + } + + if (local.succeeded) + ArrayAppend(loadedFiddles, localHistory[i]); + } + + } + + } + } + catch (Exception e) + { + // something went wrong with the data load! + } + renderText(SerializeJSON(loadedFiddles)); + } + +}
\ No newline at end of file diff --git a/src/main/webapp/controllers/Users.cfc b/src/main/webapp/controllers/Users.cfc new file mode 100644 index 0000000..a650e71 --- /dev/null +++ b/src/main/webapp/controllers/Users.cfc @@ -0,0 +1,113 @@ +component extends="Controller" { + + function info() { + if (StructKeyExists(session, "user")) + renderPartial("info"); + else + renderPartial("login"); + } + + function auth() { + + openIDSession = CreateObject("component", "lib.OpenIDConsumer.SessionScopeOpenIDSession").init(); + oConsumer = CreateObject("component", "lib.OpenIDConsumer.OpenIDConsumer2").init(openIDSession); + + session.remember = StructKeyExists(params, "remember"); + session.prelogin_hash = params.hash; + + authArgs = {}; + authArgs.identifier = params.openid_identity; + authArgs.returnURL = "http#IIF(cgi.https eq 'on',DE('s'),DE(''))#://#cgi.http_host##cgi.script_name#/Users/process"; + authArgs.sregRequired = "nickname"; + authArgs.sregOptional = "email,fullname,dob,country"; + authArgs.axRequired = "nickname,email,fullname,firstname,lastname"; + authArgs.ax.email = "http://axschema.org/contact/email"; + authArgs.ax.nickname = "http://axschema.org/contact/nickname"; + authArgs.ax.fullname = "http://axschema.org/namePerson"; + authArgs.ax.firstname = "http://axschema.org/namePerson/first"; + authArgs.ax.lastname = "http://axschema.org/namePerson/last"; + + if (not oConsumer.authenticate(authArgs)) + { + renderText("Can't find OpenID server"); + } + } + + function process() { + + openIDSession = CreateObject("component", "lib.OpenIDConsumer.SessionScopeOpenIDSession").init(); + oConsumer = CreateObject("component", "lib.OpenIDConsumer.OpenIDConsumer2").init(openIDSession); + + openID = oConsumer.verifyAuthentication(); + + if (openID.result is "success") + { + session.user = {}; + session.user.openid_server = openID.openid_server; + session.user.auth_token = createuuid(); + + if (StructKeyExists(openID, "user_identity")) + session.user.identity = openID.user_identity; + else + session.user.identity = openID.identity; + + if (StructKeyExists(session, "remember") AND session.remember) + { + getPageContext().getResponse().addHeader("Set-Cookie", "openid=#URLEncodedFormat(session.user.identity)#; path=/; Max-Age=31622400" ); + getPageContext().getResponse().addHeader("Set-Cookie", "auth_token=#URLEncodedFormat(session.user.auth_token)#; path=/; Max-Age=31622400" ); + } + else + { + getPageContext().getResponse().addHeader("Set-Cookie", "openid=#URLEncodedFormat(session.user.identity)#; path=/;" ); + getPageContext().getResponse().addHeader("Set-Cookie", "auth_token=#URLEncodedFormat(session.user.auth_token)#; path=/;" ); + } + + if (StructKeyExists(openid, "ax") AND StructKeyExists(openid.ax, "email")) + session.user.email = openid.ax.email; + + if (StructKeyExists(openid, "ax") AND StructKeyExists(openid.ax, "firstname")) + session.user.firstname = openid.ax.firstname; + + if (StructKeyExists(openid, "ax") AND StructKeyExists(openid.ax, "lastname")) + session.user.lastname = openid.ax.lastname; + + userObj = model("User").findOne(where="identity='#session.user.identity#'"); + + if (IsObject(userObj)) + { + userObj.update(session.user); + session.user.id = userObj.id; + } + else + { + userObj = model("User").create(session.user); + userObj.reload(); + session.user.id = userObj.id; + } + + } + else + { + StructClear(session); + //<p class="error">ERROR: <span><cfoutput>#openID.resultMsg#</cfoutput></span></p> + + } + + if (StructKeyExists(session, "prelogin_hash")) + location(url='/#session.prelogin_hash#', addtoken=false); + else + location(url='/', addtoken=false); + } + + function logout() { + getPageContext().getResponse().addHeader("Set-Cookie", "openid=; path=/; Max-Age=0" ); + getPageContext().getResponse().addHeader("Set-Cookie", "auth_token=; path=/; Max-Age=0" ); + + StructClear(session); + if (StructKeyExists(params, "hash")) + location(url='/#params.hash#', addtoken=false); + else + location(url='/', addtoken=false); + } + +}
\ No newline at end of file diff --git a/src/main/webapp/controllers/Wheels.cfc b/src/main/webapp/controllers/Wheels.cfc new file mode 100644 index 0000000..f5e7951 --- /dev/null +++ b/src/main/webapp/controllers/Wheels.cfc @@ -0,0 +1,7 @@ +<!---
+ This is a controller file that Wheels uses internally.
+ Do not delete this file.
+--->
+<cfcomponent output="false" displayName="Controller">
+ <cfinclude template="../wheels/controller.cfm">
+</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/db/01_alter_db_types_add_execution_plans.sql b/src/main/webapp/db/01_alter_db_types_add_execution_plans.sql new file mode 100644 index 0000000..45d3029 --- /dev/null +++ b/src/main/webapp/db/01_alter_db_types_add_execution_plans.sql @@ -0,0 +1,3 @@ +alter table db_types add execution_plan_prefix varchar(500); +alter table db_types add execution_plan_suffix varchar(500); + diff --git a/src/main/webapp/db/02_update_db_types_set_execution_plan_prefix_suffix.sql b/src/main/webapp/db/02_update_db_types_set_execution_plan_prefix_suffix.sql new file mode 100644 index 0000000..7fd9bd7 --- /dev/null +++ b/src/main/webapp/db/02_update_db_types_set_execution_plan_prefix_suffix.sql @@ -0,0 +1,27 @@ + +update db_types set execution_plan_prefix = 'explain ' where simple_name in +('PostgreSQL', 'MySQL'); + +update db_types set + execution_plan_prefix = ' +SET SHOWPLAN_XML ON; +GO +', + execution_plan_suffix = ' +GO +SET SHOWPLAN_XML OFF' +where + simple_name = 'SQL Server'; + +update db_types set + execution_plan_prefix = ' + explain plan set STATEMENT_ID = ''#schema_short_code#/#query_id#'' for +', + execution_plan_suffix = ' + +/ + +select dbms_xplan.build_plan_xml(statement_id => ''#schema_short_code#/#query_id#'').getclobval() AS XPLAN FROM dual +' +where + simple_name = 'Oracle'; diff --git a/src/main/webapp/db/03_alter_db_types_add_execution_plan_xslt.sql b/src/main/webapp/db/03_alter_db_types_add_execution_plan_xslt.sql new file mode 100644 index 0000000..9a2e2e9 --- /dev/null +++ b/src/main/webapp/db/03_alter_db_types_add_execution_plan_xslt.sql @@ -0,0 +1 @@ +alter table db_types add execution_plan_xslt text;
\ No newline at end of file diff --git a/src/main/webapp/db/04_update_db_types_set_execution_plan_xslt.sql b/src/main/webapp/db/04_update_db_types_set_execution_plan_xslt.sql new file mode 100644 index 0000000..c9f1785 --- /dev/null +++ b/src/main/webapp/db/04_update_db_types_set_execution_plan_xslt.sql @@ -0,0 +1,441 @@ +update db_types set execution_plan_xslt = ' +<?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:msxsl="urn:schemas-microsoft-com:xslt" + xmlns:s="http://schemas.microsoft.com/sqlserver/2004/07/showplan" + exclude-result-prefixes="msxsl s xsl"> + <xsl:output method="html" indent="no" omit-xml-declaration="yes" /> + + <!-- Disable built-in recursive processing templates --> + <xsl:template match="*|/|text()|@*" mode="NodeLabel2" /> + <xsl:template match="*|/|text()|@*" mode="ToolTipDescription" /> + <xsl:template match="*|/|text()|@*" mode="ToolTipDetails" /> + + <!-- Default template --> + <xsl:template match="/"> + <xsl:apply-templates select="s:ShowPlanXML" /> + </xsl:template> + + <!-- Outermost div that contains all statement plans. --> + <xsl:template match="s:ShowPlanXML"> + <div class="qp-root"> + <xsl:apply-templates select="s:BatchSequence/s:Batch/s:Statements/s:StmtSimple" /> + </div> + </xsl:template> + + <!-- Matches a branch in the query plan (either an operation or a statement) --> + <xsl:template match="s:RelOp|s:StmtSimple"> + <div class="qp-tr"> + <div> + <div class="qp-node"> + <xsl:apply-templates select="." mode="NodeIcon" /> + <xsl:apply-templates select="." mode="NodeLabel" /> + <xsl:apply-templates select="." mode="NodeLabel2" /> + <xsl:apply-templates select="." mode="NodeCostLabel" /> + <xsl:call-template name="ToolTip" /> + </div> + </div> + <div><xsl:apply-templates select="*/s:RelOp" /></div> + </div> + </xsl:template> + + <!-- Writes the tool tip --> + <xsl:template name="ToolTip"> + <div class="qp-tt"> + <div class="qp-tt-header"><xsl:value-of select="@PhysicalOp | @StatementType" /></div> + <div><xsl:apply-templates select="." mode="ToolTipDescription" /></div> + <xsl:call-template name="ToolTipGrid" /> + <xsl:apply-templates select="* | @* | */* | */@*" mode="ToolTipDetails" /> + </div> + </xsl:template> + + <!-- Writes the grid of node properties to the tool tip --> + <xsl:template name="ToolTipGrid"> + <table> + <xsl:call-template name="ToolTipRow"> + <xsl:with-param name="Condition" select="s:QueryPlan/@CachedPlanSize" /> + <xsl:with-param name="Label">Cached plan size</xsl:with-param> + <xsl:with-param name="Value" select="concat(s:QueryPlan/@CachedPlanSize, '' B'')" /> + </xsl:call-template> + <xsl:call-template name="ToolTipRow"> + <xsl:with-param name="Label">Physical Operation</xsl:with-param> + <xsl:with-param name="Value" select="@PhysicalOp" /> + </xsl:call-template> + <xsl:call-template name="ToolTipRow"> + <xsl:with-param name="Label">Logical Operation</xsl:with-param> + <xsl:with-param name="Value" select="@LogicalOp" /> + </xsl:call-template> + <xsl:call-template name="ToolTipRow"> + <xsl:with-param name="Label">Actual Number of Rows</xsl:with-param> + <xsl:with-param name="Value" select="s:RunTimeInformation/s:RunTimeCountersPerThread/@ActualRows" /> + </xsl:call-template> + <xsl:call-template name="ToolTipRow"> + <xsl:with-param name="Condition" select="@EstimateIO" /> + <xsl:with-param name="Label">Estimated I/O Cost</xsl:with-param> + <xsl:with-param name="Value"> + <xsl:call-template name="round"> + <xsl:with-param name="value" select="@EstimateIO" /> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + <xsl:call-template name="ToolTipRow"> + <xsl:with-param name="Condition" select="@EstimateCPU" /> + <xsl:with-param name="Label">Estimated CPU Cost</xsl:with-param> + <xsl:with-param name="Value"> + <xsl:call-template name="round"> + <xsl:with-param name="value" select="@EstimateCPU" /> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + <!-- TODO: Estimated Number of Executions --> + <xsl:call-template name="ToolTipRow"> + <xsl:with-param name="Label">Number of Executions</xsl:with-param> + <xsl:with-param name="Value" select="s:RunTimeInformation/s:RunTimeCountersPerThread/@ActualExecutions" /> + </xsl:call-template> + <xsl:call-template name="ToolTipRow"> + <xsl:with-param name="Label">Degree of Parallelism</xsl:with-param> + <xsl:with-param name="Value" select="s:QueryPlan/@DegreeOfParallelism" /> + </xsl:call-template> + <xsl:call-template name="ToolTipRow"> + <xsl:with-param name="Label">Memory Grant</xsl:with-param> + <xsl:with-param name="Value" select="s:QueryPlan/@MemoryGrant" /> + </xsl:call-template> + <xsl:call-template name="ToolTipRow"> + <xsl:with-param name="Condition" select="@EstimateIO | @EstimateCPU" /> + <xsl:with-param name="Label">Estimated Operator Cost</xsl:with-param> + <xsl:with-param name="Value"> + <xsl:variable name="EstimatedOperatorCost"> + <xsl:call-template name="EstimatedOperatorCost" /> + </xsl:variable> + <xsl:variable name="TotalCost"> + <xsl:value-of select="ancestor::s:StmtSimple/@StatementSubTreeCost" /> + </xsl:variable> + + <xsl:call-template name="round"> + <xsl:with-param name="value" select="$EstimatedOperatorCost" /> + </xsl:call-template> + (<xsl:value-of select="format-number(number($EstimatedOperatorCost) div number($TotalCost), ''0%'')" />) + </xsl:with-param> + </xsl:call-template> + <xsl:call-template name="ToolTipRow"> + <xsl:with-param name="Condition" select="@StatementSubTreeCost | @EstimatedTotalSubtreeCost" /> + <xsl:with-param name="Label">Estimated Subtree Cost</xsl:with-param> + <xsl:with-param name="Value"> + <xsl:call-template name="round"> + <xsl:with-param name="value" select="@StatementSubTreeCost | @EstimatedTotalSubtreeCost" /> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + <xsl:call-template name="ToolTipRow"> + <xsl:with-param name="Label">Estimated Number of Rows</xsl:with-param> + <xsl:with-param name="Value" select="@StatementEstRows | @EstimateRows" /> + </xsl:call-template> + <xsl:call-template name="ToolTipRow"> + <xsl:with-param name="Condition" select="@AvgRowSize" /> + <xsl:with-param name="Label">Estimated Row Size</xsl:with-param> + <xsl:with-param name="Value" select="concat(@AvgRowSize, '' B'')" /> + </xsl:call-template> + <!-- TODO: Actual Rebinds + TODO: Actual Rewinds --> + <xsl:call-template name="ToolTipRow"> + <xsl:with-param name="Condition" select="s:IndexScan/@Ordered" /> + <xsl:with-param name="Label">Ordered</xsl:with-param> + <xsl:with-param name="Value"> + <xsl:choose> + <xsl:when test="s:IndexScan/@Ordered = 1">True</xsl:when> + <xsl:otherwise>False</xsl:otherwise> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> + <xsl:call-template name="ToolTipRow"> + <xsl:with-param name="Label">Node ID</xsl:with-param> + <xsl:with-param name="Value" select="@NodeId" /> + </xsl:call-template> + </table> + </xsl:template> + + <!-- Calculates the estimated operator cost. --> + <xsl:template name="EstimatedOperatorCost"> + <xsl:variable name="EstimateIO"> + <xsl:call-template name="convertSciToNumString"> + <xsl:with-param name="inputVal" select="@EstimateIO" /> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="EstimateCPU"> + <xsl:call-template name="convertSciToNumString"> + <xsl:with-param name="inputVal" select="@EstimateCPU" /> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="number($EstimateIO) + number($EstimateCPU)" /> + </xsl:template> + + <!-- Renders a row in the tool tip details table. --> + <xsl:template name="ToolTipRow"> + <xsl:param name="Label" /> + <xsl:param name="Value" /> + <xsl:param name="Condition" select="$Value" /> + <xsl:if test="$Condition"> + <tr> + <th><xsl:value-of select="$Label" /></th> + <td><xsl:value-of select="$Value" /></td> + </tr> + </xsl:if> + </xsl:template> + + <!-- Prints the name of an object. --> + <xsl:template match="s:Object | s:ColumnReference" mode="ObjectName"> + <xsl:param name="ExcludeDatabaseName" select="false()" /> + <xsl:choose> + <xsl:when test="$ExcludeDatabaseName"> + <xsl:for-each select="@Table | @Index | @Column | @Alias"> + <xsl:value-of select="." /> + <xsl:if test="position() != last()">.</xsl:if> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:for-each select="@Database | @Schema | @Table | @Index | @Column | @Alias"> + <xsl:value-of select="." /> + <xsl:if test="position() != last()">.</xsl:if> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Displays the node cost label. --> + <xsl:template match="s:RelOp" mode="NodeCostLabel"> + <xsl:variable name="EstimatedOperatorCost"><xsl:call-template name="EstimatedOperatorCost" /></xsl:variable> + <xsl:variable name="TotalCost"><xsl:value-of select="ancestor::s:StmtSimple/@StatementSubTreeCost" /></xsl:variable> + <div>Cost: <xsl:value-of select="format-number(number($EstimatedOperatorCost) div number($TotalCost), ''0%'')" /></div> + </xsl:template> + + <!-- Dont show the node cost for statements. --> + <xsl:template match="s:StmtSimple" mode="NodeCostLabel" /> + + <!-- + ================================ + Tool tip detail sections + ================================ + The following section contains templates used for writing the detail sections at the bottom of the tool tip, + for example listing outputs, or information about the object to which an operator applies. + --> + + <xsl:template match="*/s:Object" mode="ToolTipDetails"> + <!-- TODO: Make sure this works all the time --> + <div class="qp-bold">Object</div> + <div><xsl:apply-templates select="." mode="ObjectName" /></div> + </xsl:template> + + <xsl:template match="s:SetPredicate[s:ScalarOperator/@ScalarString]" mode="ToolTipDetails"> + <div class="qp-bold">Predicate</div> + <div><xsl:value-of select="s:ScalarOperator/@ScalarString" /></div> + </xsl:template> + + <xsl:template match="s:OutputList[count(s:ColumnReference) > 0]" mode="ToolTipDetails"> + <div class="qp-bold">Output List</div> + <xsl:for-each select="s:ColumnReference"> + <div><xsl:apply-templates select="." mode="ObjectName" /></div> + </xsl:for-each> + </xsl:template> + + <xsl:template match="s:NestedLoops/s:OuterReferences[count(s:ColumnReference) > 0]" mode="ToolTipDetails"> + <div class="qp-bold">Outer References</div> + <xsl:for-each select="s:ColumnReference"> + <div><xsl:apply-templates select="." mode="ObjectName" /></div> + </xsl:for-each> + </xsl:template> + + <xsl:template match="@StatementText" mode="ToolTipDetails"> + <div class="qp-bold">Statement</div> + <div><xsl:value-of select="." /></div> + </xsl:template> + + <xsl:template match="s:Sort/s:OrderBy[count(s:OrderByColumn/s:ColumnReference) > 0]" mode="ToolTipDetails"> + <div class="qp-bold">Order By</div> + <xsl:for-each select="s:OrderByColumn"> + <div> + <xsl:apply-templates select="s:ColumnReference" mode="ObjectName" /> + <xsl:choose> + <xsl:when test="@Ascending = 1"> Ascending</xsl:when> + <xsl:otherwise> Descending</xsl:otherwise> + </xsl:choose> + </div> + </xsl:for-each> + </xsl:template> + + <!-- TODO: Seek Predicates --> + + <!-- + ================================ + Node icons + ================================ + The following templates determine what icon should be shown for a given node + --> + + <!-- Use the logical operation to determine the icon for the "Parallelism" operators. --> + <xsl:template match="s:RelOp[@PhysicalOp = ''Parallelism'']" mode="NodeIcon" priority="1"> + <xsl:element name="div"> + <xsl:attribute name="class">qp-icon-<xsl:value-of select="translate(@LogicalOp, '' '', '''')" /></xsl:attribute> + </xsl:element> + </xsl:template> + + <!-- Use the physical operation to determine icon if it is present. --> + <xsl:template match="*[@PhysicalOp]" mode="NodeIcon"> + <xsl:element name="div"> + <xsl:attribute name="class">qp-icon-<xsl:value-of select="translate(@PhysicalOp, '' '', '''')" /></xsl:attribute> + </xsl:element> + </xsl:template> + + <!-- Matches all statements. --> + <xsl:template match="s:StmtSimple" mode="NodeIcon"> + <div class="qp-icon-Statement"></div> + </xsl:template> + + <!-- Fallback template - show the Bitmap icon. --> + <xsl:template match="*" mode="NodeIcon"> + <div class="qp-icon-Catchall"></div> + </xsl:template> + + <!-- + ================================ + Node labels + ================================ + The following section contains templates used to determine the first (main) label for a node. + --> + + <xsl:template match="s:RelOp" mode="NodeLabel"> + <div><xsl:value-of select="@PhysicalOp" /></div> + </xsl:template> + + <xsl:template match="s:StmtSimple" mode="NodeLabel"> + <div><xsl:value-of select="@StatementType" /></div> + </xsl:template> + + <!-- + ================================ + Node alternate labels + ================================ + The following section contains templates used to determine the second label to be displayed for a node. + --> + + <!-- Display the object for any node that has one --> + <xsl:template match="*[*/s:Object]" mode="NodeLabel2"> + <xsl:variable name="ObjectName"> + <xsl:apply-templates select="*/s:Object" mode="ObjectName"> + <xsl:with-param name="ExcludeDatabaseName" select="true()" /> + </xsl:apply-templates> + </xsl:variable> + <div> + <xsl:value-of select="substring($ObjectName, 0, 36)" /> + <xsl:if test="string-length($ObjectName) >= 36">…</xsl:if> + </div> + </xsl:template> + + <!-- Display the logical operation for any node where it is not the same as the physical operation. --> + <xsl:template match="s:RelOp[@LogicalOp != @PhysicalOp]" mode="NodeLabel2"> + <div>(<xsl:value-of select="@LogicalOp" />)</div> + </xsl:template> + + <!-- Disable the default template --> + <xsl:template match="*" mode="NodeLabel2" /> + + <!-- + ================================ + Tool tip descriptions + ================================ + The following section contains templates used for writing the description shown in the tool tip. + --> + + <xsl:template match="*[@PhysicalOp = ''Table Insert'']" mode="ToolTipDescription">Insert input rows into the table specified in Argument field.</xsl:template> + <xsl:template match="*[@PhysicalOp = ''Compute Scalar'']" mode="ToolTipDescription">Compute new values from existing values in a row.</xsl:template> + <xsl:template match="*[@PhysicalOp = ''Sort'']" mode="ToolTipDescription">Sort the input.</xsl:template> + <xsl:template match="*[@PhysicalOp = ''Clustered Index Scan'']" mode="ToolTipDescription">Scanning a clustered index, entirely or only a range.</xsl:template> + <xsl:template match="*[@PhysicalOp = ''Stream Aggregate'']" mode="ToolTipDescription">Compute summary values for groups of rows in a suitably sorted stream.</xsl:template> + <xsl:template match="*[@PhysicalOp = ''Hash Match'']" mode="ToolTipDescription">Use each row from the top input to build a hash table, and each row from the bottom input to probe into the hash table, outputting all matching rows.</xsl:template> + <xsl:template match="*[@PhysicalOp = ''Bitmap'']" mode="ToolTipDescription">Bitmap.</xsl:template> + <xsl:template match="*[@PhysicalOp = ''Clustered Index Seek'']" mode="ToolTipDescription">Scanning a particular range of rows from a clustered index.</xsl:template> + <xsl:template match="*[@PhysicalOp = ''Index Seek'']" mode="ToolTipDescription">Scan a particular range of rows from a nonclustered index.</xsl:template> + + <xsl:template match="*[@PhysicalOp = ''Parallelism'' and @LogicalOp=''Repartition Streams'']" mode="ToolTipDescription">Repartition Streams.</xsl:template> + <xsl:template match="*[@PhysicalOp = ''Parallelism'']" mode="ToolTipDescription">An operation involving parallelism.</xsl:template> + + <xsl:template match="*[s:TableScan]" mode="ToolTipDescription">Scan rows from a table.</xsl:template> + <xsl:template match="*[s:NestedLoops]" mode="ToolTipDescription">For each row in the top (outer) input, scan the bottom (inner) input, and output matching rows.</xsl:template> + <xsl:template match="*[s:Top]" mode="ToolTipDescription">Select the first few rows based on a sort order.</xsl:template> + + <!-- + ================================ + Number handling + ================================ + The following section contains templates used for handling numbers (scientific notation, rounding etc...) + --> + + <!-- Outputs a number rounded to 7 decimal places - to be used for displaying all numbers. + This template accepts numbers in scientific notation. --> + <xsl:template name="round"> + <xsl:param name="value" select="0" /> + <xsl:variable name="number"> + <xsl:call-template name="convertSciToNumString"> + <xsl:with-param name="inputVal" select="$value" /> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="round(number($number) * 10000000) div 10000000" /> + </xsl:template> + + <!-- Template for handling of scientific numbers + See: http://www.orm-designer.com/article/xslt-convert-scientific-notation-to-decimal-number --> + <xsl:variable name="max-exp"> + <xsl:value-of select="''0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000''" /> + </xsl:variable> + + <xsl:template name="convertSciToNumString"> + <xsl:param name="inputVal" select="0" /> + + <xsl:variable name="numInput"> + <xsl:value-of select="translate(string($inputVal),''e'',''E'')" /> + </xsl:variable> + + <xsl:choose> + <xsl:when test="number($numInput) = $numInput"> + <xsl:value-of select="$numInput" /> + </xsl:when> + <xsl:otherwise> + <!-- ==== Mantisa ==== --> + <xsl:variable name="numMantisa"> + <xsl:value-of select="number(substring-before($numInput,''E''))" /> + </xsl:variable> + + <!-- ==== Exponent ==== --> + <xsl:variable name="numExponent"> + <xsl:choose> + <xsl:when test="contains($numInput,''E+'')"> + <xsl:value-of select="substring-after($numInput,''E+'')" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-after($numInput,''E'')" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!-- ==== Coefficient ==== --> + <xsl:variable name="numCoefficient"> + <xsl:choose> + <xsl:when test="$numExponent > 0"> + <xsl:text>1</xsl:text> + <xsl:value-of select="substring($max-exp, 1, number($numExponent))" /> + </xsl:when> + <xsl:when test="$numExponent < 0"> + <xsl:text>0.</xsl:text> + <xsl:value-of select="substring($max-exp, 1, -number($numExponent)-1)" /> + <xsl:text>1</xsl:text> + </xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="number($numCoefficient) * number($numMantisa)" /> + </xsl:otherwise> + </xsl:choose> + </xsl:template> +</xsl:stylesheet> +' +where + simple_name = 'SQL Server';
\ No newline at end of file diff --git a/src/main/webapp/db/05_alter_db_types_add_context.sql b/src/main/webapp/db/05_alter_db_types_add_context.sql new file mode 100644 index 0000000..5680b4e --- /dev/null +++ b/src/main/webapp/db/05_alter_db_types_add_context.sql @@ -0,0 +1 @@ +alter table db_types add context varchar(10); diff --git a/src/main/webapp/db/06_update_db_types_set_context.sql b/src/main/webapp/db/06_update_db_types_set_context.sql new file mode 100644 index 0000000..397836a --- /dev/null +++ b/src/main/webapp/db/06_update_db_types_set_context.sql @@ -0,0 +1,30 @@ +insert into db_types +( + full_name, + simple_name, + context, + jdbc_class_name +) +select + 'SQLite (WebSQL)', + 'SQLite', + 'browser', + 'websql' +where + not exists (select 1 from db_types where full_name = 'SQLite (WebSQL)') +UNION +select + 'SQLite (SQL.js)', + 'SQLite', + 'browser', + 'sqljs' +where + not exists (select 1 from db_types where full_name = 'SQLite (SQL.js)'); + + +update + db_types +set + context = 'host' +where + context IS NULL;
\ No newline at end of file diff --git a/src/main/webapp/db/07_alter_db_types_pg_template.sql b/src/main/webapp/db/07_alter_db_types_pg_template.sql new file mode 100644 index 0000000..33424a2 --- /dev/null +++ b/src/main/webapp/db/07_alter_db_types_pg_template.sql @@ -0,0 +1,6 @@ +update db_types +set setup_script_template =' +CREATE USER user_#databaseName# PASSWORD ''#databaseName#''; +CREATE DATABASE db_#databaseName# OWNER user_#databaseName# ENCODING ''UTF8'' TEMPLATE db_template; +' +where id = 1; diff --git a/src/main/webapp/db/08_alter_db_types_add_execution_plan_check.sql b/src/main/webapp/db/08_alter_db_types_add_execution_plan_check.sql new file mode 100644 index 0000000..6705bed --- /dev/null +++ b/src/main/webapp/db/08_alter_db_types_add_execution_plan_check.sql @@ -0,0 +1,8 @@ + +alter table db_types add execution_plan_check varchar(300); + +--update db_types set execution_plan_check = '//*[@StatementType="COMMIT TRANSACTION"]|//*[@StatementType="EXECUTE STRING"]' +update db_types set execution_plan_check = '//*[@StatementType="COMMIT TRANSACTION"]' +where + simple_name = 'SQL Server'; + diff --git a/src/main/webapp/db/09_alter_queries_add_statement_separator.sql b/src/main/webapp/db/09_alter_queries_add_statement_separator.sql new file mode 100644 index 0000000..577fa88 --- /dev/null +++ b/src/main/webapp/db/09_alter_queries_add_statement_separator.sql @@ -0,0 +1,5 @@ +alter table queries add statement_separator varchar(5) default ';'; +update queries set statement_separator = ';'; + +alter table schema_defs add statement_separator varchar(5) default ';'; +update schema_defs set statement_separator = ';';
\ No newline at end of file diff --git a/src/main/webapp/db/10_create_table_users.sql b/src/main/webapp/db/10_create_table_users.sql new file mode 100644 index 0000000..0f5a75e --- /dev/null +++ b/src/main/webapp/db/10_create_table_users.sql @@ -0,0 +1,12 @@ +CREATE TABLE users +( + id serial primary key, + identity varchar(1000) not null, + openid_server varchar(1000) not null, + auth_token varchar(35) not null, + email varchar(1000), + firstname varchar(200), + lastname varchar(200) +); + +CREATE UNIQUE INDEX user_identities ON users USING btree (identity); diff --git a/src/main/webapp/db/11_alter_schema_defs_add_owner_id.sql b/src/main/webapp/db/11_alter_schema_defs_add_owner_id.sql new file mode 100644 index 0000000..d60ab6f --- /dev/null +++ b/src/main/webapp/db/11_alter_schema_defs_add_owner_id.sql @@ -0,0 +1,7 @@ +alter table schema_defs add owner_id int; + +CREATE INDEX schema_owner ON schema_defs USING btree (owner_id); + +alter table queries add author_id int; + +CREATE INDEX query_author ON queries USING btree (author_id);
\ No newline at end of file diff --git a/src/main/webapp/db/12_create_table_user_fiddles.sql b/src/main/webapp/db/12_create_table_user_fiddles.sql new file mode 100644 index 0000000..a124127 --- /dev/null +++ b/src/main/webapp/db/12_create_table_user_fiddles.sql @@ -0,0 +1,19 @@ +create table user_fiddles +( + id serial primary key, + user_id int not null, + schema_def_id int not null, + query_id int, + last_accessed timestamp without time zone default now(), + num_accesses int default 1, + show_in_history smallint default 1 +); + + +ALTER TABLE ONLY user_fiddles + ADD CONSTRAINT schema_def_ref FOREIGN KEY (schema_def_id) REFERENCES schema_defs(id); + + +CREATE INDEX user_fiddles_user_id ON user_fiddles USING btree (user_id); + +CREATE INDEX user_fiddles_user_schema_query_id ON user_fiddles USING btree (user_id,schema_def_id,query_id);
\ No newline at end of file diff --git a/src/main/webapp/db/13_add_meta_data_structure.sql b/src/main/webapp/db/13_add_meta_data_structure.sql new file mode 100644 index 0000000..e435c1a --- /dev/null +++ b/src/main/webapp/db/13_add_meta_data_structure.sql @@ -0,0 +1,18 @@ +alter table schema_defs add structure_json text; + +create table Query_Sets ( + id int not null, + query_id int not null, + schema_def_id int not null, + row_count int, + execution_time int, + succeeded smallint, + sql text, + execution_plan text, + error_message text, + columns_list varchar(500) +); + + +ALTER TABLE ONLY Query_Sets + ADD CONSTRAINT query_sets_pkey PRIMARY KEY (id, schema_def_id, query_id); diff --git a/src/main/webapp/db/14_alter_user_fiddles_add_favorite.sql b/src/main/webapp/db/14_alter_user_fiddles_add_favorite.sql new file mode 100644 index 0000000..f6fc9db --- /dev/null +++ b/src/main/webapp/db/14_alter_user_fiddles_add_favorite.sql @@ -0,0 +1 @@ +alter table user_fiddles add favorite smallint default 0;
\ No newline at end of file diff --git a/src/main/webapp/db/15_alter_db_types_add_latest_stable.sql b/src/main/webapp/db/15_alter_db_types_add_latest_stable.sql new file mode 100644 index 0000000..6e959c9 --- /dev/null +++ b/src/main/webapp/db/15_alter_db_types_add_latest_stable.sql @@ -0,0 +1,5 @@ +alter table db_types add is_latest_stable smallint default 0; + +update db_types set is_latest_stable = 1; + +update db_types set is_latest_stable = 0 where id = 3; diff --git a/src/main/webapp/db/data.sql b/src/main/webapp/db/data.sql new file mode 100644 index 0000000..329c4f8 --- /dev/null +++ b/src/main/webapp/db/data.sql @@ -0,0 +1,567 @@ +-- +-- PostgreSQL database dump +-- + +SET statement_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SET check_function_bodies = false; +SET client_min_messages = warning; + +SET search_path = public, pg_catalog; + +-- +-- Name: db_types2_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres +-- + +SELECT pg_catalog.setval('db_types2_id_seq', 1, false); + + +-- +-- Name: db_types_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres +-- + +SELECT pg_catalog.setval('db_types_id_seq', 14, true); + + +-- +-- Name: hosts_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres +-- + +SELECT pg_catalog.setval('hosts_id_seq', 12, true); + + +-- +-- Name: schema_defs_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres +-- + +SELECT pg_catalog.setval('schema_defs_id_seq', 55999, true); + + +-- +-- Name: user_fiddles_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres +-- + +SELECT pg_catalog.setval('user_fiddles_id_seq', 29600, true); + + +-- +-- Name: users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres +-- + +SELECT pg_catalog.setval('users_id_seq', 463, true); + + +-- +-- Data for Name: db_types; Type: TABLE DATA; Schema: public; Owner: postgres +-- + +COPY db_types (id, full_name, simple_name, setup_script_template, jdbc_class_name, drop_script_template, custom_jdbc_attributes, batch_separator, notes, sample_fragment, execution_plan_prefix, execution_plan_suffix, execution_plan_xslt, context, execution_plan_check, is_latest_stable) FROM stdin; +4 Oracle 11g R2 Oracle \ncreate user user_#databaseName# identified by "#databaseName#" default tablespace fiddledata profile fiddleusers\n/\ngrant create session, create synonym, create table, create type, create view, create procedure to user_#databaseName#\n/\nalter user user_#databaseName# quota 5M on fiddledata\n oracle.jdbc.OracleDriver DECLARE\n l_cnt integer;\nBEGIN\n EXECUTE IMMEDIATE 'alter user user_#databaseName# account lock';\n FOR x IN (SELECT *\n FROM v$session\n WHERE username = 'USER_#databaseName#')\n LOOP\n EXECUTE IMMEDIATE 'alter system disconnect session ''' || x.sid || ',' || x.serial# || ''' IMMEDIATE';\n END LOOP;\n\n -- Wait for as long as it takes for all the sessions to go away\n LOOP\n SELECT COUNT(*)\n INTO l_cnt\n FROM v$session\n WHERE username = 'USER_#databaseName#';\n EXIT WHEN l_cnt = 0;\n dbms_lock.sleep( 1 );\n END LOOP;\n\n EXECUTE IMMEDIATE 'drop user user_#databaseName# cascade';\nEND;\n \N / Oracle does not support multiple statements in batch. Separate each statement with a line consisting of a single /, and do not terminate statements with semicolons. 4/ee7da/596 \n\texplain plan set STATEMENT_ID = '#schema_short_code#/#query_id#' for \n \n\n\n/\n\nselect dbms_xplan.display_plan(format=>'ALL', type=>'ACTIVE', statement_id => '#schema_short_code#/#query_id#') as XPLAN FROM dual \n<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n<xsl:output method="html" indent="no" omit-xml-declaration="yes" cdata-section-elements="report_id info hint"/>\n\n<xsl:template match="/">\n <script type="text/xml" class="oracle_xplan_xml">\n<xsl:copy-of select="/html/body/script[@type='text/xml']"/>\n </script>\n <div class="oracle_xplan"></div>\n</xsl:template>\n</xsl:stylesheet>\n host \N 1 +7 SQLite (WebSQL) SQLite \N websql \N \N \N \N 7/04eca/1 \N \N \N browser \N 1 +5 SQLite (SQL.js) SQLite \nCREATE USER user_#databaseName# PASSWORD '#databaseName#' sqljs \N \N \N \N 5/781d4/2 \N \N \N browser \N 1 +6 MS SQL Server 2012 SQL Server \nCREATE DATABASE db_#databaseName#;\nGO\n\nUSE db_#databaseName#;\nGO\n\nCREATE LOGIN user_#databaseName#\nWITH PASSWORD = '#databaseName#';\nGO\n\nCREATE USER user_#databaseName#;\nGO\n\nGRANT \nCREATE TABLE,\nCREATE TYPE,\nCREATE VIEW,\nCREATE PROCEDURE,\nCREATE FUNCTION,\nCREATE FULLTEXT CATALOG,\nEXECUTE,\nDELETE,\nINSERT,\nREFERENCES,\nSELECT,\nSHOWPLAN,\nUPDATE\nTO user_#databaseName#;\nGO\n\n\n\nALTER LOGIN user_#databaseName# WITH DEFAULT_DATABASE=db_#databaseName#;\nGO\n\nGRANT ALTER ON SCHEMA::dbo TO user_#databaseName#;\nGO\n\nuse master;\n\n net.sourceforge.jtds.jdbc.Driver exec dbo.clearDBUsers 'db_#databaseName#';\nGO\ndrop database db_#databaseName#;\nGO\ndrop login user_#databaseName#;\n \N GO \N 6/189a3/1 \nSET SHOWPLAN_XML ON;\nGO\n \nGO\nSET SHOWPLAN_XML OFF \n<?xml version="1.0" encoding="utf-8"?>\n<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\n xmlns:msxsl="urn:schemas-microsoft-com:xslt"\n xmlns:s="http://schemas.microsoft.com/sqlserver/2004/07/showplan"\n exclude-result-prefixes="msxsl s xsl">\n <xsl:output method="html" indent="no" omit-xml-declaration="yes" />\n\n <!-- Disable built-in recursive processing templates -->\n <xsl:template match="*|/|text()|@*" mode="NodeLabel2" />\n <xsl:template match="*|/|text()|@*" mode="ToolTipDescription" />\n <xsl:template match="*|/|text()|@*" mode="ToolTipDetails" />\n\n <!-- Default template -->\n <xsl:template match="/">\n <xsl:apply-templates select="s:ShowPlanXML" />\n </xsl:template>\n\n <!-- Outermost div that contains all statement plans. -->\n <xsl:template match="s:ShowPlanXML">\n <div class="qp-root">\n <xsl:apply-templates select="s:BatchSequence/s:Batch/s:Statements/s:StmtSimple" /> \n </div>\n </xsl:template>\n \n <!-- Matches a branch in the query plan (either an operation or a statement) -->\n <xsl:template match="s:RelOp|s:StmtSimple">\n <div class="qp-tr">\n <div>\n <div class="qp-node">\n <xsl:apply-templates select="." mode="NodeIcon" />\n <xsl:apply-templates select="." mode="NodeLabel" />\n <xsl:apply-templates select="." mode="NodeLabel2" />\n <xsl:apply-templates select="." mode="NodeCostLabel" />\n <xsl:call-template name="ToolTip" />\n </div>\n </div>\n <div><xsl:apply-templates select="*/s:RelOp" /></div>\n </div>\n </xsl:template>\n\n <!-- Writes the tool tip -->\n <xsl:template name="ToolTip">\n <div class="qp-tt">\n <div class="qp-tt-header"><xsl:value-of select="@PhysicalOp | @StatementType" /></div>\n <div><xsl:apply-templates select="." mode="ToolTipDescription" /></div>\n <xsl:call-template name="ToolTipGrid" />\n <xsl:apply-templates select="* | @* | */* | */@*" mode="ToolTipDetails" />\n </div>\n </xsl:template>\n\n <!-- Writes the grid of node properties to the tool tip -->\n <xsl:template name="ToolTipGrid">\n <table>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Condition" select="s:QueryPlan/@CachedPlanSize" />\n <xsl:with-param name="Label">Cached plan size</xsl:with-param>\n <xsl:with-param name="Value" select="concat(s:QueryPlan/@CachedPlanSize, ' B')" />\n </xsl:call-template>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Label">Physical Operation</xsl:with-param>\n <xsl:with-param name="Value" select="@PhysicalOp" />\n </xsl:call-template>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Label">Logical Operation</xsl:with-param>\n <xsl:with-param name="Value" select="@LogicalOp" />\n </xsl:call-template>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Label">Actual Number of Rows</xsl:with-param>\n <xsl:with-param name="Value" select="s:RunTimeInformation/s:RunTimeCountersPerThread/@ActualRows" />\n </xsl:call-template>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Condition" select="@EstimateIO" />\n <xsl:with-param name="Label">Estimated I/O Cost</xsl:with-param>\n <xsl:with-param name="Value">\n <xsl:call-template name="round">\n <xsl:with-param name="value" select="@EstimateIO" />\n </xsl:call-template>\n </xsl:with-param>\n </xsl:call-template>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Condition" select="@EstimateCPU" />\n <xsl:with-param name="Label">Estimated CPU Cost</xsl:with-param>\n <xsl:with-param name="Value">\n <xsl:call-template name="round">\n <xsl:with-param name="value" select="@EstimateCPU" />\n </xsl:call-template>\n </xsl:with-param>\n </xsl:call-template>\n <!-- TODO: Estimated Number of Executions -->\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Label">Number of Executions</xsl:with-param>\n <xsl:with-param name="Value" select="s:RunTimeInformation/s:RunTimeCountersPerThread/@ActualExecutions" />\n </xsl:call-template>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Label">Degree of Parallelism</xsl:with-param>\n <xsl:with-param name="Value" select="s:QueryPlan/@DegreeOfParallelism" />\n </xsl:call-template>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Label">Memory Grant</xsl:with-param>\n <xsl:with-param name="Value" select="s:QueryPlan/@MemoryGrant" />\n </xsl:call-template>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Condition" select="@EstimateIO | @EstimateCPU" />\n <xsl:with-param name="Label">Estimated Operator Cost</xsl:with-param>\n <xsl:with-param name="Value">\n <xsl:variable name="EstimatedOperatorCost">\n <xsl:call-template name="EstimatedOperatorCost" />\n </xsl:variable>\n <xsl:variable name="TotalCost">\n <xsl:value-of select="ancestor::s:StmtSimple/@StatementSubTreeCost" />\n </xsl:variable>\n \n <xsl:call-template name="round">\n <xsl:with-param name="value" select="$EstimatedOperatorCost" />\n </xsl:call-template>\n (<xsl:value-of select="format-number(number($EstimatedOperatorCost) div number($TotalCost), '0%')" />)\n </xsl:with-param>\n </xsl:call-template>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Condition" select="@StatementSubTreeCost | @EstimatedTotalSubtreeCost" />\n <xsl:with-param name="Label">Estimated Subtree Cost</xsl:with-param>\n <xsl:with-param name="Value">\n <xsl:call-template name="round">\n <xsl:with-param name="value" select="@StatementSubTreeCost | @EstimatedTotalSubtreeCost" />\n </xsl:call-template>\n </xsl:with-param>\n </xsl:call-template>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Label">Estimated Number of Rows</xsl:with-param>\n <xsl:with-param name="Value" select="@StatementEstRows | @EstimateRows" />\n </xsl:call-template>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Condition" select="@AvgRowSize" />\n <xsl:with-param name="Label">Estimated Row Size</xsl:with-param>\n <xsl:with-param name="Value" select="concat(@AvgRowSize, ' B')" />\n </xsl:call-template>\n <!-- TODO: Actual Rebinds\n TODO: Actual Rewinds -->\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Condition" select="s:IndexScan/@Ordered" />\n <xsl:with-param name="Label">Ordered</xsl:with-param>\n <xsl:with-param name="Value">\n <xsl:choose>\n <xsl:when test="s:IndexScan/@Ordered = 1">True</xsl:when>\n <xsl:otherwise>False</xsl:otherwise>\n </xsl:choose>\n </xsl:with-param>\n </xsl:call-template>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Label">Node ID</xsl:with-param>\n <xsl:with-param name="Value" select="@NodeId" />\n </xsl:call-template>\n </table>\n </xsl:template>\n\n <!-- Calculates the estimated operator cost. -->\n <xsl:template name="EstimatedOperatorCost">\n <xsl:variable name="EstimateIO">\n <xsl:call-template name="convertSciToNumString">\n <xsl:with-param name="inputVal" select="@EstimateIO" />\n </xsl:call-template>\n </xsl:variable>\n <xsl:variable name="EstimateCPU">\n <xsl:call-template name="convertSciToNumString">\n <xsl:with-param name="inputVal" select="@EstimateCPU" />\n </xsl:call-template>\n </xsl:variable>\n <xsl:value-of select="number($EstimateIO) + number($EstimateCPU)" />\n </xsl:template>\n\n <!-- Renders a row in the tool tip details table. -->\n <xsl:template name="ToolTipRow">\n <xsl:param name="Label" />\n <xsl:param name="Value" />\n <xsl:param name="Condition" select="$Value" />\n <xsl:if test="$Condition">\n <tr>\n <th><xsl:value-of select="$Label" /></th>\n <td><xsl:value-of select="$Value" /></td>\n </tr> \n </xsl:if>\n </xsl:template>\n\n <!-- Prints the name of an object. -->\n <xsl:template match="s:Object | s:ColumnReference" mode="ObjectName">\n <xsl:param name="ExcludeDatabaseName" select="false()" />\n <xsl:choose>\n <xsl:when test="$ExcludeDatabaseName">\n <xsl:for-each select="@Table | @Index | @Column | @Alias">\n <xsl:value-of select="." />\n <xsl:if test="position() != last()">.</xsl:if>\n </xsl:for-each>\n </xsl:when>\n <xsl:otherwise>\n <xsl:for-each select="@Database | @Schema | @Table | @Index | @Column | @Alias">\n <xsl:value-of select="." />\n <xsl:if test="position() != last()">.</xsl:if>\n </xsl:for-each>\n </xsl:otherwise>\n </xsl:choose>\n </xsl:template>\n\n <!-- Displays the node cost label. -->\n <xsl:template match="s:RelOp" mode="NodeCostLabel">\n <xsl:variable name="EstimatedOperatorCost"><xsl:call-template name="EstimatedOperatorCost" /></xsl:variable>\n <xsl:variable name="TotalCost"><xsl:value-of select="ancestor::s:StmtSimple/@StatementSubTreeCost" /></xsl:variable>\n <div>Cost: <xsl:value-of select="format-number(number($EstimatedOperatorCost) div number($TotalCost), '0%')" /></div>\n </xsl:template>\n\n <!-- Dont show the node cost for statements. -->\n <xsl:template match="s:StmtSimple" mode="NodeCostLabel" />\n\n <!-- \n ================================\n Tool tip detail sections\n ================================\n The following section contains templates used for writing the detail sections at the bottom of the tool tip,\n for example listing outputs, or information about the object to which an operator applies.\n -->\n\n <xsl:template match="*/s:Object" mode="ToolTipDetails">\n <!-- TODO: Make sure this works all the time -->\n <div class="qp-bold">Object</div>\n <div><xsl:apply-templates select="." mode="ObjectName" /></div>\n </xsl:template>\n\n <xsl:template match="s:SetPredicate[s:ScalarOperator/@ScalarString]" mode="ToolTipDetails">\n <div class="qp-bold">Predicate</div>\n <div><xsl:value-of select="s:ScalarOperator/@ScalarString" /></div>\n </xsl:template>\n\n <xsl:template match="s:OutputList[count(s:ColumnReference) > 0]" mode="ToolTipDetails">\n <div class="qp-bold">Output List</div>\n <xsl:for-each select="s:ColumnReference">\n <div><xsl:apply-templates select="." mode="ObjectName" /></div>\n </xsl:for-each>\n </xsl:template>\n\n <xsl:template match="s:NestedLoops/s:OuterReferences[count(s:ColumnReference) > 0]" mode="ToolTipDetails">\n <div class="qp-bold">Outer References</div>\n <xsl:for-each select="s:ColumnReference">\n <div><xsl:apply-templates select="." mode="ObjectName" /></div>\n </xsl:for-each>\n </xsl:template>\n\n <xsl:template match="@StatementText" mode="ToolTipDetails">\n <div class="qp-bold">Statement</div>\n <div><xsl:value-of select="." /></div>\n </xsl:template>\n\n <xsl:template match="s:Sort/s:OrderBy[count(s:OrderByColumn/s:ColumnReference) > 0]" mode="ToolTipDetails">\n <div class="qp-bold">Order By</div>\n <xsl:for-each select="s:OrderByColumn">\n <div>\n <xsl:apply-templates select="s:ColumnReference" mode="ObjectName" />\n <xsl:choose>\n <xsl:when test="@Ascending = 1"> Ascending</xsl:when>\n <xsl:otherwise> Descending</xsl:otherwise>\n </xsl:choose>\n </div>\n </xsl:for-each>\n </xsl:template>\n\n <!-- TODO: Seek Predicates -->\n\n <!-- \n ================================\n Node icons\n ================================\n The following templates determine what icon should be shown for a given node\n -->\n\n <!-- Use the logical operation to determine the icon for the "Parallelism" operators. -->\n <xsl:template match="s:RelOp[@PhysicalOp = 'Parallelism']" mode="NodeIcon" priority="1">\n <xsl:element name="div">\n <xsl:attribute name="class">qp-icon-<xsl:value-of select="translate(@LogicalOp, ' ', '')" /></xsl:attribute>\n </xsl:element>\n </xsl:template>\n\n <!-- Use the physical operation to determine icon if it is present. -->\n <xsl:template match="*[@PhysicalOp]" mode="NodeIcon">\n <xsl:element name="div">\n <xsl:attribute name="class">qp-icon-<xsl:value-of select="translate(@PhysicalOp, ' ', '')" /></xsl:attribute>\n </xsl:element>\n </xsl:template>\n \n <!-- Matches all statements. -->\n <xsl:template match="s:StmtSimple" mode="NodeIcon">\n <div class="qp-icon-Statement"></div>\n </xsl:template>\n\n <!-- Fallback template - show the Bitmap icon. -->\n <xsl:template match="*" mode="NodeIcon">\n <div class="qp-icon-Catchall"></div>\n </xsl:template>\n\n <!-- \n ================================\n Node labels\n ================================\n The following section contains templates used to determine the first (main) label for a node.\n -->\n\n <xsl:template match="s:RelOp" mode="NodeLabel">\n <div><xsl:value-of select="@PhysicalOp" /></div>\n </xsl:template>\n\n <xsl:template match="s:StmtSimple" mode="NodeLabel">\n <div><xsl:value-of select="@StatementType" /></div>\n </xsl:template>\n\n <!--\n ================================\n Node alternate labels\n ================================\n The following section contains templates used to determine the second label to be displayed for a node.\n -->\n\n <!-- Display the object for any node that has one -->\n <xsl:template match="*[*/s:Object]" mode="NodeLabel2">\n <xsl:variable name="ObjectName">\n <xsl:apply-templates select="*/s:Object" mode="ObjectName">\n <xsl:with-param name="ExcludeDatabaseName" select="true()" />\n </xsl:apply-templates>\n </xsl:variable>\n <div>\n <xsl:value-of select="substring($ObjectName, 0, 36)" />\n <xsl:if test="string-length($ObjectName) >= 36">…</xsl:if>\n </div>\n </xsl:template>\n\n <!-- Display the logical operation for any node where it is not the same as the physical operation. -->\n <xsl:template match="s:RelOp[@LogicalOp != @PhysicalOp]" mode="NodeLabel2">\n <div>(<xsl:value-of select="@LogicalOp" />)</div>\n </xsl:template>\n\n <!-- Disable the default template -->\n <xsl:template match="*" mode="NodeLabel2" />\n\n <!-- \n ================================\n Tool tip descriptions\n ================================\n The following section contains templates used for writing the description shown in the tool tip.\n -->\n\n <xsl:template match="*[@PhysicalOp = 'Table Insert']" mode="ToolTipDescription">Insert input rows into the table specified in Argument field.</xsl:template>\n <xsl:template match="*[@PhysicalOp = 'Compute Scalar']" mode="ToolTipDescription">Compute new values from existing values in a row.</xsl:template>\n <xsl:template match="*[@PhysicalOp = 'Sort']" mode="ToolTipDescription">Sort the input.</xsl:template>\n <xsl:template match="*[@PhysicalOp = 'Clustered Index Scan']" mode="ToolTipDescription">Scanning a clustered index, entirely or only a range.</xsl:template>\n <xsl:template match="*[@PhysicalOp = 'Stream Aggregate']" mode="ToolTipDescription">Compute summary values for groups of rows in a suitably sorted stream.</xsl:template>\n <xsl:template match="*[@PhysicalOp = 'Hash Match']" mode="ToolTipDescription">Use each row from the top input to build a hash table, and each row from the bottom input to probe into the hash table, outputting all matching rows.</xsl:template>\n <xsl:template match="*[@PhysicalOp = 'Bitmap']" mode="ToolTipDescription">Bitmap.</xsl:template>\n <xsl:template match="*[@PhysicalOp = 'Clustered Index Seek']" mode="ToolTipDescription">Scanning a particular range of rows from a clustered index.</xsl:template>\n <xsl:template match="*[@PhysicalOp = 'Index Seek']" mode="ToolTipDescription">Scan a particular range of rows from a nonclustered index.</xsl:template>\n\n <xsl:template match="*[@PhysicalOp = 'Parallelism' and @LogicalOp='Repartition Streams']" mode="ToolTipDescription">Repartition Streams.</xsl:template>\n <xsl:template match="*[@PhysicalOp = 'Parallelism']" mode="ToolTipDescription">An operation involving parallelism.</xsl:template>\n \n <xsl:template match="*[s:TableScan]" mode="ToolTipDescription">Scan rows from a table.</xsl:template>\n <xsl:template match="*[s:NestedLoops]" mode="ToolTipDescription">For each row in the top (outer) input, scan the bottom (inner) input, and output matching rows.</xsl:template>\n <xsl:template match="*[s:Top]" mode="ToolTipDescription">Select the first few rows based on a sort order.</xsl:template>\n\n <!-- \n ================================\n Number handling\n ================================\n The following section contains templates used for handling numbers (scientific notation, rounding etc...)\n -->\n\n <!-- Outputs a number rounded to 7 decimal places - to be used for displaying all numbers.\n This template accepts numbers in scientific notation. -->\n <xsl:template name="round">\n <xsl:param name="value" select="0" />\n <xsl:variable name="number">\n <xsl:call-template name="convertSciToNumString">\n <xsl:with-param name="inputVal" select="$value" />\n </xsl:call-template>\n </xsl:variable>\n <xsl:value-of select="round(number($number) * 10000000) div 10000000" />\n </xsl:template>\n \n <!-- Template for handling of scientific numbers\n See: http://www.orm-designer.com/article/xslt-convert-scientific-notation-to-decimal-number -->\n <xsl:variable name="max-exp">\n <xsl:value-of select="'0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'" />\n </xsl:variable>\n\n <xsl:template name="convertSciToNumString">\n <xsl:param name="inputVal" select="0" />\n\n <xsl:variable name="numInput">\n <xsl:value-of select="translate(string($inputVal),'e','E')" />\n </xsl:variable>\n\n <xsl:choose>\n <xsl:when test="number($numInput) = $numInput">\n <xsl:value-of select="$numInput" />\n </xsl:when> \n <xsl:otherwise>\n <!-- ==== Mantisa ==== -->\n <xsl:variable name="numMantisa">\n <xsl:value-of select="number(substring-before($numInput,'E'))" />\n </xsl:variable>\n\n <!-- ==== Exponent ==== -->\n <xsl:variable name="numExponent">\n <xsl:choose>\n <xsl:when test="contains($numInput,'E+')">\n <xsl:value-of select="substring-after($numInput,'E+')" />\n </xsl:when>\n <xsl:otherwise>\n <xsl:value-of select="substring-after($numInput,'E')" />\n </xsl:otherwise>\n </xsl:choose>\n </xsl:variable>\n\n <!-- ==== Coefficient ==== -->\n <xsl:variable name="numCoefficient">\n <xsl:choose>\n <xsl:when test="$numExponent > 0">\n <xsl:text>1</xsl:text>\n <xsl:value-of select="substring($max-exp, 1, number($numExponent))" />\n </xsl:when>\n <xsl:when test="$numExponent < 0">\n <xsl:text>0.</xsl:text>\n <xsl:value-of select="substring($max-exp, 1, -number($numExponent)-1)" />\n <xsl:text>1</xsl:text>\n </xsl:when>\n <xsl:otherwise>1</xsl:otherwise>\n </xsl:choose>\n </xsl:variable>\n <xsl:value-of select="number($numCoefficient) * number($numMantisa)" />\n </xsl:otherwise>\n </xsl:choose>\n </xsl:template>\n</xsl:stylesheet>\n host //*[@StatementType="COMMIT TRANSACTION"] 1 +2 MySQL 5.5.27 MySQL \nCREATE database db_#databaseName# default CHARACTER SET = utf8 default COLLATE = utf8_general_ci;\nGRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER,INDEX,CREATE TEMPORARY TABLES,CREATE VIEW,SHOW VIEW,ALTER ROUTINE,CREATE ROUTINE,TRIGGER,EXECUTE\n ON db_#databaseName#.* TO user_#databaseName#@'%' IDENTIFIED BY '#databaseName#';\n org.gjt.mm.mysql.Driver \n DROP DATABASE db_#databaseName#; drop user user_#databaseName#@'%';\n allowMultiQueries=true \N Separate multiple statements in MySQL by terminating each one with a semicolon. 2/a2581/1 explain extended \N \N host \N 1 +10 PostgreSQL 8.3.20 PostgreSQL \nCREATE USER user_#databaseName# PASSWORD '#databaseName#';\nCREATE DATABASE db_#databaseName# OWNER user_#databaseName# ENCODING 'UTF8' TEMPLATE db_template;\n org.postgresql.Driver SELECT pg_terminate_backend(pg_stat_activity.procpid) FROM pg_stat_activity WHERE upper(pg_stat_activity.datname) = 'DB_#databaseName#'; DROP DATABASE db_#databaseName#;DROP USER user_#databaseName#; \N \N \N 10/f9585/1 explain \N \N host \N 0 +11 PostgreSQL 8.4.12 PostgreSQL \nCREATE USER user_#databaseName# PASSWORD '#databaseName#';\nCREATE DATABASE db_#databaseName# OWNER user_#databaseName# ENCODING 'UTF8' TEMPLATE db_template;\n org.postgresql.Driver SELECT pg_terminate_backend(pg_stat_activity.procpid) FROM pg_stat_activity WHERE upper(pg_stat_activity.datname) = 'DB_#databaseName#'; DROP DATABASE db_#databaseName#;DROP USER user_#databaseName#; \N \N \N 11/6d80e/1 explain \N \N host \N 0 +3 MS SQL Server 2008 SQL Server \nCREATE DATABASE db_#databaseName#;\nGO\n\nUSE db_#databaseName#;\nGO\n\nCREATE LOGIN user_#databaseName#\nWITH PASSWORD = '#databaseName#';\nGO\n\nCREATE USER user_#databaseName#;\nGO\n\nGRANT \nCREATE TABLE,\nCREATE TYPE,\nCREATE VIEW,\nCREATE PROCEDURE,\nCREATE FUNCTION,\nCREATE FULLTEXT CATALOG,\nEXECUTE,\nDELETE,\nINSERT,\nREFERENCES,\nSELECT,\nSHOWPLAN,\nUPDATE\nTO user_#databaseName#;\nGO\n\n\n\nALTER LOGIN user_#databaseName# WITH DEFAULT_DATABASE=db_#databaseName#;\nGO\n\nGRANT ALTER ON SCHEMA::dbo TO user_#databaseName#;\nGO\n\nuse master;\n\n net.sourceforge.jtds.jdbc.Driver exec dbo.clearDBUsers 'db_#databaseName#';\nGO\ndrop database db_#databaseName#;\nGO\ndrop login user_#databaseName#;\n \N GO SQL Server supports multiple statements in a batch separated by semicolons. Separate statement batches with a line consisting of a single GO command, as needed. 3/1fa93/1 \nSET SHOWPLAN_XML ON;\nGO\n \nGO\nSET SHOWPLAN_XML OFF \n<?xml version="1.0" encoding="utf-8"?>\n<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\n xmlns:msxsl="urn:schemas-microsoft-com:xslt"\n xmlns:s="http://schemas.microsoft.com/sqlserver/2004/07/showplan"\n exclude-result-prefixes="msxsl s xsl">\n <xsl:output method="html" indent="no" omit-xml-declaration="yes" />\n\n <!-- Disable built-in recursive processing templates -->\n <xsl:template match="*|/|text()|@*" mode="NodeLabel2" />\n <xsl:template match="*|/|text()|@*" mode="ToolTipDescription" />\n <xsl:template match="*|/|text()|@*" mode="ToolTipDetails" />\n\n <!-- Default template -->\n <xsl:template match="/">\n <xsl:apply-templates select="s:ShowPlanXML" />\n </xsl:template>\n\n <!-- Outermost div that contains all statement plans. -->\n <xsl:template match="s:ShowPlanXML">\n <div class="qp-root">\n <xsl:apply-templates select="s:BatchSequence/s:Batch/s:Statements/s:StmtSimple" /> \n </div>\n </xsl:template>\n \n <!-- Matches a branch in the query plan (either an operation or a statement) -->\n <xsl:template match="s:RelOp|s:StmtSimple">\n <div class="qp-tr">\n <div>\n <div class="qp-node">\n <xsl:apply-templates select="." mode="NodeIcon" />\n <xsl:apply-templates select="." mode="NodeLabel" />\n <xsl:apply-templates select="." mode="NodeLabel2" />\n <xsl:apply-templates select="." mode="NodeCostLabel" />\n <xsl:call-template name="ToolTip" />\n </div>\n </div>\n <div><xsl:apply-templates select="*/s:RelOp" /></div>\n </div>\n </xsl:template>\n\n <!-- Writes the tool tip -->\n <xsl:template name="ToolTip">\n <div class="qp-tt">\n <div class="qp-tt-header"><xsl:value-of select="@PhysicalOp | @StatementType" /></div>\n <div><xsl:apply-templates select="." mode="ToolTipDescription" /></div>\n <xsl:call-template name="ToolTipGrid" />\n <xsl:apply-templates select="* | @* | */* | */@*" mode="ToolTipDetails" />\n </div>\n </xsl:template>\n\n <!-- Writes the grid of node properties to the tool tip -->\n <xsl:template name="ToolTipGrid">\n <table>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Condition" select="s:QueryPlan/@CachedPlanSize" />\n <xsl:with-param name="Label">Cached plan size</xsl:with-param>\n <xsl:with-param name="Value" select="concat(s:QueryPlan/@CachedPlanSize, ' B')" />\n </xsl:call-template>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Label">Physical Operation</xsl:with-param>\n <xsl:with-param name="Value" select="@PhysicalOp" />\n </xsl:call-template>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Label">Logical Operation</xsl:with-param>\n <xsl:with-param name="Value" select="@LogicalOp" />\n </xsl:call-template>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Label">Actual Number of Rows</xsl:with-param>\n <xsl:with-param name="Value" select="s:RunTimeInformation/s:RunTimeCountersPerThread/@ActualRows" />\n </xsl:call-template>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Condition" select="@EstimateIO" />\n <xsl:with-param name="Label">Estimated I/O Cost</xsl:with-param>\n <xsl:with-param name="Value">\n <xsl:call-template name="round">\n <xsl:with-param name="value" select="@EstimateIO" />\n </xsl:call-template>\n </xsl:with-param>\n </xsl:call-template>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Condition" select="@EstimateCPU" />\n <xsl:with-param name="Label">Estimated CPU Cost</xsl:with-param>\n <xsl:with-param name="Value">\n <xsl:call-template name="round">\n <xsl:with-param name="value" select="@EstimateCPU" />\n </xsl:call-template>\n </xsl:with-param>\n </xsl:call-template>\n <!-- TODO: Estimated Number of Executions -->\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Label">Number of Executions</xsl:with-param>\n <xsl:with-param name="Value" select="s:RunTimeInformation/s:RunTimeCountersPerThread/@ActualExecutions" />\n </xsl:call-template>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Label">Degree of Parallelism</xsl:with-param>\n <xsl:with-param name="Value" select="s:QueryPlan/@DegreeOfParallelism" />\n </xsl:call-template>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Label">Memory Grant</xsl:with-param>\n <xsl:with-param name="Value" select="s:QueryPlan/@MemoryGrant" />\n </xsl:call-template>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Condition" select="@EstimateIO | @EstimateCPU" />\n <xsl:with-param name="Label">Estimated Operator Cost</xsl:with-param>\n <xsl:with-param name="Value">\n <xsl:variable name="EstimatedOperatorCost">\n <xsl:call-template name="EstimatedOperatorCost" />\n </xsl:variable>\n <xsl:variable name="TotalCost">\n <xsl:value-of select="ancestor::s:StmtSimple/@StatementSubTreeCost" />\n </xsl:variable>\n \n <xsl:call-template name="round">\n <xsl:with-param name="value" select="$EstimatedOperatorCost" />\n </xsl:call-template>\n (<xsl:value-of select="format-number(number($EstimatedOperatorCost) div number($TotalCost), '0%')" />)\n </xsl:with-param>\n </xsl:call-template>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Condition" select="@StatementSubTreeCost | @EstimatedTotalSubtreeCost" />\n <xsl:with-param name="Label">Estimated Subtree Cost</xsl:with-param>\n <xsl:with-param name="Value">\n <xsl:call-template name="round">\n <xsl:with-param name="value" select="@StatementSubTreeCost | @EstimatedTotalSubtreeCost" />\n </xsl:call-template>\n </xsl:with-param>\n </xsl:call-template>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Label">Estimated Number of Rows</xsl:with-param>\n <xsl:with-param name="Value" select="@StatementEstRows | @EstimateRows" />\n </xsl:call-template>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Condition" select="@AvgRowSize" />\n <xsl:with-param name="Label">Estimated Row Size</xsl:with-param>\n <xsl:with-param name="Value" select="concat(@AvgRowSize, ' B')" />\n </xsl:call-template>\n <!-- TODO: Actual Rebinds\n TODO: Actual Rewinds -->\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Condition" select="s:IndexScan/@Ordered" />\n <xsl:with-param name="Label">Ordered</xsl:with-param>\n <xsl:with-param name="Value">\n <xsl:choose>\n <xsl:when test="s:IndexScan/@Ordered = 1">True</xsl:when>\n <xsl:otherwise>False</xsl:otherwise>\n </xsl:choose>\n </xsl:with-param>\n </xsl:call-template>\n <xsl:call-template name="ToolTipRow">\n <xsl:with-param name="Label">Node ID</xsl:with-param>\n <xsl:with-param name="Value" select="@NodeId" />\n </xsl:call-template>\n </table>\n </xsl:template>\n\n <!-- Calculates the estimated operator cost. -->\n <xsl:template name="EstimatedOperatorCost">\n <xsl:variable name="EstimateIO">\n <xsl:call-template name="convertSciToNumString">\n <xsl:with-param name="inputVal" select="@EstimateIO" />\n </xsl:call-template>\n </xsl:variable>\n <xsl:variable name="EstimateCPU">\n <xsl:call-template name="convertSciToNumString">\n <xsl:with-param name="inputVal" select="@EstimateCPU" />\n </xsl:call-template>\n </xsl:variable>\n <xsl:value-of select="number($EstimateIO) + number($EstimateCPU)" />\n </xsl:template>\n\n <!-- Renders a row in the tool tip details table. -->\n <xsl:template name="ToolTipRow">\n <xsl:param name="Label" />\n <xsl:param name="Value" />\n <xsl:param name="Condition" select="$Value" />\n <xsl:if test="$Condition">\n <tr>\n <th><xsl:value-of select="$Label" /></th>\n <td><xsl:value-of select="$Value" /></td>\n </tr> \n </xsl:if>\n </xsl:template>\n\n <!-- Prints the name of an object. -->\n <xsl:template match="s:Object | s:ColumnReference" mode="ObjectName">\n <xsl:param name="ExcludeDatabaseName" select="false()" />\n <xsl:choose>\n <xsl:when test="$ExcludeDatabaseName">\n <xsl:for-each select="@Table | @Index | @Column | @Alias">\n <xsl:value-of select="." />\n <xsl:if test="position() != last()">.</xsl:if>\n </xsl:for-each>\n </xsl:when>\n <xsl:otherwise>\n <xsl:for-each select="@Database | @Schema | @Table | @Index | @Column | @Alias">\n <xsl:value-of select="." />\n <xsl:if test="position() != last()">.</xsl:if>\n </xsl:for-each>\n </xsl:otherwise>\n </xsl:choose>\n </xsl:template>\n\n <!-- Displays the node cost label. -->\n <xsl:template match="s:RelOp" mode="NodeCostLabel">\n <xsl:variable name="EstimatedOperatorCost"><xsl:call-template name="EstimatedOperatorCost" /></xsl:variable>\n <xsl:variable name="TotalCost"><xsl:value-of select="ancestor::s:StmtSimple/@StatementSubTreeCost" /></xsl:variable>\n <div>Cost: <xsl:value-of select="format-number(number($EstimatedOperatorCost) div number($TotalCost), '0%')" /></div>\n </xsl:template>\n\n <!-- Dont show the node cost for statements. -->\n <xsl:template match="s:StmtSimple" mode="NodeCostLabel" />\n\n <!-- \n ================================\n Tool tip detail sections\n ================================\n The following section contains templates used for writing the detail sections at the bottom of the tool tip,\n for example listing outputs, or information about the object to which an operator applies.\n -->\n\n <xsl:template match="*/s:Object" mode="ToolTipDetails">\n <!-- TODO: Make sure this works all the time -->\n <div class="qp-bold">Object</div>\n <div><xsl:apply-templates select="." mode="ObjectName" /></div>\n </xsl:template>\n\n <xsl:template match="s:SetPredicate[s:ScalarOperator/@ScalarString]" mode="ToolTipDetails">\n <div class="qp-bold">Predicate</div>\n <div><xsl:value-of select="s:ScalarOperator/@ScalarString" /></div>\n </xsl:template>\n\n <xsl:template match="s:OutputList[count(s:ColumnReference) > 0]" mode="ToolTipDetails">\n <div class="qp-bold">Output List</div>\n <xsl:for-each select="s:ColumnReference">\n <div><xsl:apply-templates select="." mode="ObjectName" /></div>\n </xsl:for-each>\n </xsl:template>\n\n <xsl:template match="s:NestedLoops/s:OuterReferences[count(s:ColumnReference) > 0]" mode="ToolTipDetails">\n <div class="qp-bold">Outer References</div>\n <xsl:for-each select="s:ColumnReference">\n <div><xsl:apply-templates select="." mode="ObjectName" /></div>\n </xsl:for-each>\n </xsl:template>\n\n <xsl:template match="@StatementText" mode="ToolTipDetails">\n <div class="qp-bold">Statement</div>\n <div><xsl:value-of select="." /></div>\n </xsl:template>\n\n <xsl:template match="s:Sort/s:OrderBy[count(s:OrderByColumn/s:ColumnReference) > 0]" mode="ToolTipDetails">\n <div class="qp-bold">Order By</div>\n <xsl:for-each select="s:OrderByColumn">\n <div>\n <xsl:apply-templates select="s:ColumnReference" mode="ObjectName" />\n <xsl:choose>\n <xsl:when test="@Ascending = 1"> Ascending</xsl:when>\n <xsl:otherwise> Descending</xsl:otherwise>\n </xsl:choose>\n </div>\n </xsl:for-each>\n </xsl:template>\n\n <!-- TODO: Seek Predicates -->\n\n <!-- \n ================================\n Node icons\n ================================\n The following templates determine what icon should be shown for a given node\n -->\n\n <!-- Use the logical operation to determine the icon for the "Parallelism" operators. -->\n <xsl:template match="s:RelOp[@PhysicalOp = 'Parallelism']" mode="NodeIcon" priority="1">\n <xsl:element name="div">\n <xsl:attribute name="class">qp-icon-<xsl:value-of select="translate(@LogicalOp, ' ', '')" /></xsl:attribute>\n </xsl:element>\n </xsl:template>\n\n <!-- Use the physical operation to determine icon if it is present. -->\n <xsl:template match="*[@PhysicalOp]" mode="NodeIcon">\n <xsl:element name="div">\n <xsl:attribute name="class">qp-icon-<xsl:value-of select="translate(@PhysicalOp, ' ', '')" /></xsl:attribute>\n </xsl:element>\n </xsl:template>\n \n <!-- Matches all statements. -->\n <xsl:template match="s:StmtSimple" mode="NodeIcon">\n <div class="qp-icon-Statement"></div>\n </xsl:template>\n\n <!-- Fallback template - show the Bitmap icon. -->\n <xsl:template match="*" mode="NodeIcon">\n <div class="qp-icon-Catchall"></div>\n </xsl:template>\n\n <!-- \n ================================\n Node labels\n ================================\n The following section contains templates used to determine the first (main) label for a node.\n -->\n\n <xsl:template match="s:RelOp" mode="NodeLabel">\n <div><xsl:value-of select="@PhysicalOp" /></div>\n </xsl:template>\n\n <xsl:template match="s:StmtSimple" mode="NodeLabel">\n <div><xsl:value-of select="@StatementType" /></div>\n </xsl:template>\n\n <!--\n ================================\n Node alternate labels\n ================================\n The following section contains templates used to determine the second label to be displayed for a node.\n -->\n\n <!-- Display the object for any node that has one -->\n <xsl:template match="*[*/s:Object]" mode="NodeLabel2">\n <xsl:variable name="ObjectName">\n <xsl:apply-templates select="*/s:Object" mode="ObjectName">\n <xsl:with-param name="ExcludeDatabaseName" select="true()" />\n </xsl:apply-templates>\n </xsl:variable>\n <div>\n <xsl:value-of select="substring($ObjectName, 0, 36)" />\n <xsl:if test="string-length($ObjectName) >= 36">…</xsl:if>\n </div>\n </xsl:template>\n\n <!-- Display the logical operation for any node where it is not the same as the physical operation. -->\n <xsl:template match="s:RelOp[@LogicalOp != @PhysicalOp]" mode="NodeLabel2">\n <div>(<xsl:value-of select="@LogicalOp" />)</div>\n </xsl:template>\n\n <!-- Disable the default template -->\n <xsl:template match="*" mode="NodeLabel2" />\n\n <!-- \n ================================\n Tool tip descriptions\n ================================\n The following section contains templates used for writing the description shown in the tool tip.\n -->\n\n <xsl:template match="*[@PhysicalOp = 'Table Insert']" mode="ToolTipDescription">Insert input rows into the table specified in Argument field.</xsl:template>\n <xsl:template match="*[@PhysicalOp = 'Compute Scalar']" mode="ToolTipDescription">Compute new values from existing values in a row.</xsl:template>\n <xsl:template match="*[@PhysicalOp = 'Sort']" mode="ToolTipDescription">Sort the input.</xsl:template>\n <xsl:template match="*[@PhysicalOp = 'Clustered Index Scan']" mode="ToolTipDescription">Scanning a clustered index, entirely or only a range.</xsl:template>\n <xsl:template match="*[@PhysicalOp = 'Stream Aggregate']" mode="ToolTipDescription">Compute summary values for groups of rows in a suitably sorted stream.</xsl:template>\n <xsl:template match="*[@PhysicalOp = 'Hash Match']" mode="ToolTipDescription">Use each row from the top input to build a hash table, and each row from the bottom input to probe into the hash table, outputting all matching rows.</xsl:template>\n <xsl:template match="*[@PhysicalOp = 'Bitmap']" mode="ToolTipDescription">Bitmap.</xsl:template>\n <xsl:template match="*[@PhysicalOp = 'Clustered Index Seek']" mode="ToolTipDescription">Scanning a particular range of rows from a clustered index.</xsl:template>\n <xsl:template match="*[@PhysicalOp = 'Index Seek']" mode="ToolTipDescription">Scan a particular range of rows from a nonclustered index.</xsl:template>\n\n <xsl:template match="*[@PhysicalOp = 'Parallelism' and @LogicalOp='Repartition Streams']" mode="ToolTipDescription">Repartition Streams.</xsl:template>\n <xsl:template match="*[@PhysicalOp = 'Parallelism']" mode="ToolTipDescription">An operation involving parallelism.</xsl:template>\n \n <xsl:template match="*[s:TableScan]" mode="ToolTipDescription">Scan rows from a table.</xsl:template>\n <xsl:template match="*[s:NestedLoops]" mode="ToolTipDescription">For each row in the top (outer) input, scan the bottom (inner) input, and output matching rows.</xsl:template>\n <xsl:template match="*[s:Top]" mode="ToolTipDescription">Select the first few rows based on a sort order.</xsl:template>\n\n <!-- \n ================================\n Number handling\n ================================\n The following section contains templates used for handling numbers (scientific notation, rounding etc...)\n -->\n\n <!-- Outputs a number rounded to 7 decimal places - to be used for displaying all numbers.\n This template accepts numbers in scientific notation. -->\n <xsl:template name="round">\n <xsl:param name="value" select="0" />\n <xsl:variable name="number">\n <xsl:call-template name="convertSciToNumString">\n <xsl:with-param name="inputVal" select="$value" />\n </xsl:call-template>\n </xsl:variable>\n <xsl:value-of select="round(number($number) * 10000000) div 10000000" />\n </xsl:template>\n \n <!-- Template for handling of scientific numbers\n See: http://www.orm-designer.com/article/xslt-convert-scientific-notation-to-decimal-number -->\n <xsl:variable name="max-exp">\n <xsl:value-of select="'0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'" />\n </xsl:variable>\n\n <xsl:template name="convertSciToNumString">\n <xsl:param name="inputVal" select="0" />\n\n <xsl:variable name="numInput">\n <xsl:value-of select="translate(string($inputVal),'e','E')" />\n </xsl:variable>\n\n <xsl:choose>\n <xsl:when test="number($numInput) = $numInput">\n <xsl:value-of select="$numInput" />\n </xsl:when> \n <xsl:otherwise>\n <!-- ==== Mantisa ==== -->\n <xsl:variable name="numMantisa">\n <xsl:value-of select="number(substring-before($numInput,'E'))" />\n </xsl:variable>\n\n <!-- ==== Exponent ==== -->\n <xsl:variable name="numExponent">\n <xsl:choose>\n <xsl:when test="contains($numInput,'E+')">\n <xsl:value-of select="substring-after($numInput,'E+')" />\n </xsl:when>\n <xsl:otherwise>\n <xsl:value-of select="substring-after($numInput,'E')" />\n </xsl:otherwise>\n </xsl:choose>\n </xsl:variable>\n\n <!-- ==== Coefficient ==== -->\n <xsl:variable name="numCoefficient">\n <xsl:choose>\n <xsl:when test="$numExponent > 0">\n <xsl:text>1</xsl:text>\n <xsl:value-of select="substring($max-exp, 1, number($numExponent))" />\n </xsl:when>\n <xsl:when test="$numExponent < 0">\n <xsl:text>0.</xsl:text>\n <xsl:value-of select="substring($max-exp, 1, -number($numExponent)-1)" />\n <xsl:text>1</xsl:text>\n </xsl:when>\n <xsl:otherwise>1</xsl:otherwise>\n </xsl:choose>\n </xsl:variable>\n <xsl:value-of select="number($numCoefficient) * number($numMantisa)" />\n </xsl:otherwise>\n </xsl:choose>\n </xsl:template>\n</xsl:stylesheet>\n host //*[@StatementType="COMMIT TRANSACTION"] 0 +8 MySQL 5.1.61 MySQL \nCREATE database db_#databaseName# default CHARACTER SET = utf8 default COLLATE = utf8_general_ci;\nGRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER,INDEX,CREATE TEMPORARY TABLES,CREATE VIEW,SHOW VIEW,ALTER ROUTINE,CREATE ROUTINE,TRIGGER,EXECUTE\n ON db_#databaseName#.* TO user_#databaseName#@'%' IDENTIFIED BY '#databaseName#';\n org.gjt.mm.mysql.Driver \n DROP DATABASE db_#databaseName#; drop user user_#databaseName#@'%';\n \N \N \N 8/a2581/1 explain extended \N \N host \N 0 +9 MySQL 5.6.6 m9 MySQL \nCREATE database db_#databaseName# default CHARACTER SET = utf8 default COLLATE = utf8_general_ci;\nGRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER,INDEX,CREATE TEMPORARY TABLES,CREATE VIEW,SHOW VIEW,ALTER ROUTINE,CREATE ROUTINE,TRIGGER,EXECUTE\n ON db_#databaseName#.* TO user_#databaseName#@'%' IDENTIFIED BY '#databaseName#';\nGRANT SELECT ON performance_schema.* TO user_#databaseName#@'%';\n org.gjt.mm.mysql.Driver \n DROP DATABASE db_#databaseName#; drop user user_#databaseName#@'%';\n \N \N \N 9/a2581/1 explain extended \N \N host \N 0 +1 PostgreSQL 9.1.6 PostgreSQL \nCREATE USER user_#databaseName# PASSWORD '#databaseName#';\nCREATE DATABASE db_#databaseName# OWNER user_#databaseName# ENCODING 'UTF8' TEMPLATE db_template;\n org.postgresql.Driver SELECT pg_terminate_backend(pg_stat_activity.procpid) FROM pg_stat_activity WHERE upper(pg_stat_activity.datname) = 'DB_#databaseName#'; DROP DATABASE db_#databaseName#;DROP USER user_#databaseName#; \N \N Separate multiple statements in PostgreSQL by terminating each one with a semicolon. 1/6ccc5/2 explain \N \N host \N 1 +12 PostgreSQL 9.2.1 PostgreSQL \nCREATE USER user_#databaseName# PASSWORD '#databaseName#';\nCREATE DATABASE db_#databaseName# OWNER user_#databaseName# ENCODING 'UTF8' TEMPLATE db_template;\n org.postgresql.Driver SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE upper(pg_stat_activity.datname) = 'DB_#databaseName#'; DROP DATABASE db_#databaseName#;DROP USER user_#databaseName#;\n\t \N \N \N 12/6d80e/1 explain \N \N host \N 0 +\. + + +-- +-- Data for Name: hosts; Type: TABLE DATA; Schema: public; Owner: postgres +-- + +COPY hosts (id, db_type_id, jdbc_url_template, cf_dsn) FROM stdin; +1 1 jdbc:postgresql://127.0.0.1:5432/#databaseName# sqlfiddle_pg1 +3 3 jdbc:jtds:sqlserver://sqlfiddlewin:1433/#databaseName# sqlfiddle_mssql1 +4 4 jdbc:oracle:thin:@//sqlfiddlewin:1521/xe sqlfiddle_oracle1 +5 6 jdbc:jtds:sqlserver://sqlfiddlewin:1434/#databaseName# sqlfiddle_mssql2 +2 2 jdbc:mysql://sqlfiddledb1:3306/#databaseName#?allowMultiQueries=true&useLocalTransactionState=true&useUnicode=true&characterEncoding=UTF-8 sqlfiddle_mysql1 +8 10 jdbc:postgresql://pg83:2211/#databaseName# sqlfiddle_pg83 +9 11 jdbc:postgresql://pg84:2201/#databaseName# sqlfiddle_pg84 +10 12 jdbc:postgresql://pg92:2203/#databaseName# sqlfiddle_pg92 +11 9 jdbc:mysql://my56:2207/#databaseName#?allowMultiQueries=true&useLocalTransactionState=true&useUnicode=true&characterEncoding=UTF-8 sqlfiddle_my56 +12 8 jdbc:mysql://my51:2205/#databaseName#?allowMultiQueries=true&useLocalTransactionState=true&useUnicode=true&characterEncoding=UTF-8 sqlfiddle_my51 +\. + + +-- +-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: postgres +-- + +COPY users (id, identity, openid_server, auth_token, email, firstname, lastname) FROM stdin; +2 https://me.yahoo.com/a/FSAdWJwggoi05a4cZYcg.AIBJg--#d5c63 https://open.login.yahooapis.com/openid/op/auth CEF69B05-8D4D-4B77-AB40CE84FC05AAFC asjf11@yahoo.com \N \N +26 https://me.yahoo.com/a/jaoHnVQUjcVYteomn47RAwR5Q5nBmK_ONwaH6bm31WgXUVEn#9b3ce https://open.login.yahooapis.com/openid/op/auth A0FA41AE-55B9-4CCC-AE9CC886C3263F2A kumarc28@rocketmail.com \N \N +27 https://www.google.com/accounts/o8/id?id=AItOawkSxOY6y7g_LeNTM_lQMzzQlVb48uT2Txg https://www.google.com/accounts/o8/ud A41E6E0C-2E0D-4D77-864BA85D27BAC7EF polosate@gmail.com Anastasiya Shaposhnikova +5 https://www.google.com/accounts/o8/id?id=AItOawkkJ8Foq1VAPc4xSt2Rnv6K48I1KZ9RrcY https://www.google.com/accounts/o8/ud 0762902E-C206-44B6-B3DFFA6676F0B230 swasheck@gmail.com Seth Washeck +28 https://www.google.com/accounts/o8/id?id=AItOawnZAYYuOJT0NDvskiTHG4cj2anPgv8abMo https://www.google.com/accounts/o8/ud EF6AA536-D913-46C8-9EACE644F3664529 mrileyaz@gmail.com Matt Riley +20 https://www.google.com/accounts/o8/id?id=AItOawkKIxq1tXM58gIIqj_qshvcXAxzeB74tUs https://www.google.com/accounts/o8/ud 14FC6BB0-03E1-44F9-A310B0B9A9391CBD rohnelasentista@gmail.com rohnel asentista +29 https://www.google.com/accounts/o8/id?id=AItOawmLW-X-yPwBJVyHbBQ6k4j4JpCBCSBJ6nk https://www.google.com/accounts/o8/ud 2C1BFA7E-890B-4591-B646C456D7ED2F2A nordin.rahman@gmail.com Nordin Rahman +36 https://www.google.com/accounts/o8/id?id=AItOawl0MYHrKY6Q2RlCR9UlV6yZKbTiNy8puV8 https://www.google.com/accounts/o8/ud D1F89186-C37D-4FD8-A549299FE0201281 spencerpnhcc-google@yahoo.com Peter Spencer +7 https://www.google.com/accounts/o8/id?id=AItOawnLY2qfqkPh-gR7p_DVa0Y1YqtJaWLBms0 https://www.google.com/accounts/o8/ud 69E39732-8A41-40D0-8DDC78670D1A836A gusdecool@gmail.com Budi Arsana +8 https://www.google.com/accounts/o8/id?id=AItOawn5M-nAeG5hJk9MJIsiJnvx2p-xj0R4Sfw https://www.google.com/accounts/o8/ud DAB5C549-B1DE-462D-9729305E19803216 kevintraver@gmail.com Kevin Traver +9 https://www.google.com/accounts/o8/id?id=AItOawnHYayn-HAswBaAoE3iXr3MA1_pd2ngSX0 https://www.google.com/accounts/o8/ud F0774433-268B-45BC-A3821B97B9872E71 ankitsayss@gmail.com Ankit hates life +10 https://www.google.com/accounts/o8/id?id=AItOawnjYPHqBGuuMTg-JHMv2GPTnx8AoBCNsDk https://www.google.com/accounts/o8/ud 18EAA1B1-61AD-407F-8B4277F6DBBDEC17 cbffr.cheng@gmail.com carlos cheng +12 https://www.google.com/accounts/o8/id?id=AItOawm_CdaiUgkjT4j5qtkIDF6lZEYluctFyt4 https://www.google.com/accounts/o8/ud 8126B4C4-4A21-455F-BE7F34AE03002B1C tanangular@gmail.com Thanathip Tharavanich +13 http://sinepiskai4.myopenid.com/ http://www.myopenid.com/server BA7AEBEB-3FA4-4047-8D283D93F287A844 \N \N \N +14 https://www.google.com/accounts/o8/id?id=AItOawlFAvCKxdWdTr7Hw2yIXSXOutNfsy7peaw https://www.google.com/accounts/o8/ud 4C09D238-51C6-4DC1-ADAB81C979F9F61F bharat.jain@gmail.com Bharat Jain +15 http://williamdurkin.wordpress.com/ http://williamdurkin.wordpress.com/?openidserver=1 21AAE481-654A-49F3-B9A8F650AF40332A \N \N \N +16 https://www.google.com/accounts/o8/id?id=AItOawk7W3zp5eJEucrEuESRPOtlBgdmQ3sv1Uc https://www.google.com/accounts/o8/ud AABCD186-49EA-4B91-AEC624C12DCD18C3 nrpieper@gmail.com Nathan Pieper +3 http://openid.roux.org/cade http://www.myopenid.com/server F3CD37CC-C942-4D34-9EBCED18E7FBC95B \N \N \N +17 https://www.google.com/accounts/o8/id?id=AItOawkKbUMJL0ftAtk8MaWA_7S8_7bXccVLpIw https://www.google.com/accounts/o8/ud 770F1948-8CB2-4D26-9BAA0EBA673F4D96 werm82@gmail.com Craig Wermert +32 https://www.google.com/accounts/o8/id?id=AItOawk4cgULQ0ksHWtBjc8W1vtsvEaJxpdxlwo https://www.google.com/accounts/o8/ud 9B4A5813-E421-4F44-86630F2D7FEDB073 awhisperedlie@gmail.com Mike Grabski +18 https://www.google.com/accounts/o8/id?id=AItOawkpfM6qghDpdo_RoDrXkNExa-FXjgncV0o https://www.google.com/accounts/o8/ud 81C6AD5E-40E7-43A0-9F82D1116564D05D cotter.daniel@gmail.com Daniel Cotter +19 http://claimid.com/isme https://openid.claimid.com/server 83B9EAD2-E482-4C87-851F8D53AD32D669 \N \N \N +22 https://www.google.com/accounts/o8/id?id=AItOawkaYx5OQXvxIefX9x833RSoYDavgtnkRzg https://www.google.com/accounts/o8/ud FC91D93A-0E6D-49E4-A547A7FC694457DA guthrie.m@gmail.com Michael Guthrie +24 https://me.yahoo.com/a/tBr2tMkbv8D4kcYTUXQbzYgqjOZp9w--#73770 https://open.login.yahooapis.com/openid/op/auth 48842410-299B-4100-B00194FDE1553009 mikee2988@yahoo.com \N \N +23 https://www.google.com/accounts/o8/id?id=AItOawnfQkaXlB34KBx4k4WrBDvDwEnxH-L9CQg https://www.google.com/accounts/o8/ud DAD7A596-F8E9-467C-815AAEA5473C728C krishnendu.dey@gmail.com Krish Dey +30 https://www.google.com/accounts/o8/id?id=AItOawmnmwEL-VZZfMCiZ1klud76s3VdbTZLjDU https://www.google.com/accounts/o8/ud 99ED6AB1-DD45-4B6E-883F502CCAFB6A9F mubasshir.don@gmail.com mubasshir pawle +31 https://www.google.com/accounts/o8/id?id=AItOawlxO237BWUxBldo16FpgSaePtU9RWtxHzQ https://www.google.com/accounts/o8/ud 31F0F139-79CF-42D5-AA24172A437A22F9 enamrik@gmail.com Kirmanie Ravariere +37 https://www.google.com/accounts/o8/id?id=AItOawmI_XNgjGDVpL_TqYwX0N1JqBqSs6KZDCM https://www.google.com/accounts/o8/ud CDB2E6CE-AA95-4137-BFAC4C74C986B416 smartin108@gmail.com Andy Holaday +34 https://www.google.com/accounts/o8/id?id=AItOawl5dQXEAcC9qtGpILV9aFbKKy7X9m-3g6Y https://www.google.com/accounts/o8/ud 9293C09D-2735-4519-B0DF86BBF6488FD1 robertfolkerts@gmail.com Robert Folkerts +35 https://www.google.com/accounts/o8/id?id=AItOawk_wDI0qqXLAxRvnOF2EWGrILs9o5g-0nw https://www.google.com/accounts/o8/ud 44E72096-494A-41D5-B812F92FD3B3A6FD kvalero@gmail.com Kamal Valero +25 https://www.google.com/accounts/o8/id?id=AItOawl1UBlcoMegM3M3-JeSMhC7quJs5nJJZm8 https://www.google.com/accounts/o8/ud 2D018CC2-CA21-486C-A1193603660A5F6E satindersinght@gmail.com satinder singh +4 https://www.google.com/accounts/o8/id?id=AItOawnu-LA8ariuQB0Y3ZhX9Fs9NDHrDILAa1o https://www.google.com/accounts/o8/ud 59265BF5-3EFA-4697-9B30E7396C3694C7 blufeet@gmail.com Taryn Regish +33 https://www.google.com/accounts/o8/id?id=AItOawkYOFnX32kSajHUG08RQt_PcEr_rDFmLE0 https://www.google.com/accounts/o8/ud 160C7B9B-3EA7-49C5-819CDAA58084FE5C leniel@gmail.com Leniel Macaferi +38 https://www.google.com/accounts/o8/id?id=AItOawm2ocKAeXZpyhfFrtTgJxB8VKxLpxmN56U https://www.google.com/accounts/o8/ud C40FD3A7-D94F-4C2A-995CD52AE6BAEE3A 1daylife@gmail.com Rinat Borovskikh +11 https://www.google.com/accounts/o8/id?id=AItOawmph1fM_zoPjyauxpqapod_6Q8UpPfm2pw https://www.google.com/accounts/o8/ud BDE14F15-2D9B-4E1E-8DFCFFFEF5FFCCC6 micke314@gmail.com Mikael Eriksson +405 https://me.yahoo.com/a/ywIho216mcaJQRu4Zc5ZE12vHA--#a468f https://open.login.yahooapis.com/openid/op/auth B50AA433-2776-42C8-A438649F8F4E68C9 tonyg3@yahoo.com \N \N +39 https://www.google.com/accounts/o8/id?id=AItOawnG1N1Bvd7_8v7MderX7_TpveGRR7xqP3E https://www.google.com/accounts/o8/ud 51B2C03B-1820-455C-93DE86AF75675EAC jhoguet@gmail.com Jonathan Hoguet +40 https://www.google.com/accounts/o8/id?id=AItOawnpsNXTRoZDJJ7PTA3Ez-gCw2XoOtmtuxA https://www.google.com/accounts/o8/ud 2537EAE0-DD74-4E92-8C8CA6E165E7D42D ivanovsuper@gmail.com Yura Ivanov +41 http://lazy-denis.myopenid.com/ http://www.myopenid.com/server 3BAE1517-2B32-4F6F-A09BD97CAD243DFF \N \N \N +42 http://karthiknet.wordpress.com/ http://karthiknet.wordpress.com/?openidserver=1 B4802D38-DA31-4AFA-A513EAE8187CB486 \N \N \N +43 https://www.google.com/accounts/o8/id?id=AItOawkRRpI2AWR2ALq1dDVvgUOR-MyBWVopXm4 https://www.google.com/accounts/o8/ud D1F36B29-CE29-489E-BE8319F4A34ADDEF mygoogleacc@web.de \N \N +45 http://cybernate.myopenid.com/ http://www.myopenid.com/server 9C2CB0A7-A7E0-4A79-A32F2BE50BD84AC6 \N \N \N +46 https://www.google.com/accounts/o8/id?id=AItOawmK5nnR_SDvu_XAD0TwApp82oOv1RRLFlk https://www.google.com/accounts/o8/ud 09FF244D-52C5-4686-B4E5351F66F3F8AC svonwolf@gmail.com Stefan Willoughby +47 https://www.google.com/accounts/o8/id?id=AItOawkekYZOJcLTElfWkaOEdsbduRAwBlso-Ig https://www.google.com/accounts/o8/ud B9C34B11-44E8-4E18-A72AA2FBA6C2F3F1 dewaldf@gmail.com Dewald Fortier +48 https://www.google.com/accounts/o8/id?id=AItOawlkJrTccUkYew9-q4kt6liOFQ85sufmA5E https://www.google.com/accounts/o8/ud 91315AD7-2A86-4503-88AD8A1A0D8B2386 tassadaque@gmail.com Muhammad Tassadaque Zia +49 https://www.google.com/accounts/o8/id?id=AItOawmlqN0l34dMmyCbD_URHIOB393x-uYHeDk https://www.google.com/accounts/o8/ud 181E7C29-45A2-4B67-8E174A6502085E9A gpetrioli@gmail.com Gabriele Petrioli +50 https://www.google.com/accounts/o8/id?id=AItOawkNHd6xC76gipaVhasFJfkT3GKcTT7HsRs https://www.google.com/accounts/o8/ud FB904870-E0CE-4EF9-BA5001FDFF99EDB7 mohapatra.dharmendra@gmail.com Dharmendra Mohapatra +51 https://www.google.com/accounts/o8/id?id=AItOawlG8G6uWSUl-u_Igq0aLGeJnCsUWdBzSdI https://www.google.com/accounts/o8/ud F4C713E6-FC83-4312-A00246F1A8E072EB cdempsey321@gmail.com Chris Dempsey +52 https://www.google.com/accounts/o8/id?id=AItOawlP-URGXgSp06z2k2EtxqYk42GWLmGd9UI https://www.google.com/accounts/o8/ud 576BE6FA-4C8A-4EBB-800EC9E0E9D610FB apraveen87@gmail.com Praveen Kumar +54 https://www.google.com/accounts/o8/id?id=AItOawk6y05GCBttdNJWLX3tz3nFtH8KDsmpDOM https://www.google.com/accounts/o8/ud 863CB8EF-836F-4698-9FBC3845E3CDF858 abclary@gmail.com Andy Clary +55 https://www.google.com/accounts/o8/id?id=AItOawlAtJydQSSpsxD_SFc6-uQhoHBBbs5TVw8 https://www.google.com/accounts/o8/ud 29E81033-177A-4A79-B3CA84B816ECA1AB bijuyes1980@gmail.com Biju s +57 https://www.google.com/accounts/o8/id?id=AItOawn1a5Wo9YpA2XkTYizWhILEAvZ4APoOiJA https://www.google.com/accounts/o8/ud E3CC7D89-8A8B-4E7D-950D3628CEFE9C92 shpak.aleks@gmail.com Alex Shpak +58 https://www.google.com/accounts/o8/id?id=AItOawkDMjq9PIvwt27MZSOzV1zT2QfYystSqnY https://www.google.com/accounts/o8/ud 51592C93-540B-4DA9-AE831531710CD102 garner.rachel@gmail.com Rachel Garner +59 https://me.yahoo.com/a/SVtLptULz9kDFRCh.a4GEzVTdoBIbhwHjfE-#62a9c https://open.login.yahooapis.com/openid/op/auth 91C6571E-789B-47DE-9BD8FCDE28C88F91 parkarfahim22@yahoo.co.in \N \N +61 https://www.google.com/accounts/o8/id?id=AItOawmFFE1d_SsWU-vqniBLzY5g1sNwo3n4_n4 https://www.google.com/accounts/o8/ud 68D30B91-BB76-4DEB-B20E88D35FF2C70E tmlsk8@gmail.com Trevor LeBlanc +60 https://www.google.com/accounts/o8/id?id=AItOawlyScvQdFEJwOKROXWMSgEV7Pd57sB-awA https://www.google.com/accounts/o8/ud DBCDFC7A-18F5-4EE7-9DAB47BF17E0443F thibaut.barrere@gmail.com Thibaut Barrère +44 https://www.google.com/accounts/o8/id?id=AItOawm--JZp9P8byJMmAjhNFjoXE5Qygopst8U https://www.google.com/accounts/o8/ud AC18CDE5-2480-4DED-BA2E7021F29D40D0 smartin108@gmail.com Andy Holaday +67 https://coder389.myopenid.com/ https://www.myopenid.com/server 201AAB1D-AB70-4328-B67FF754E2D71623 \N \N \N +66 https://www.google.com/accounts/o8/id?id=AItOawmHvEJOnBL-HfV9scHwGh1TeRAULLGs8Co https://www.google.com/accounts/o8/ud 06DBE69A-E7B8-46E4-A332F1F43417CC95 himanshujansari@gmail.com Himanshu Jansari +62 http://wolframx.myopenid.com/ http://www.myopenid.com/server 896C66A8-663B-4855-863E80BA8F3FECDE \N \N \N +63 https://www.google.com/accounts/o8/id?id=AItOawkFqgiB1Bp8LynSi25nNr3G8PHRcdfQqzM https://www.google.com/accounts/o8/ud 3BEFAB19-49F3-45A6-A28C4AF93BBCB0D0 pouyan.ghasemi@gmail.com pouyan ghasemi +64 https://www.google.com/accounts/o8/id?id=AItOawlpzpWOBmjCbzbp7fnTrD-fNhZwcb0SAQw https://www.google.com/accounts/o8/ud 2391144C-1133-4DBA-97241EEBAD924D5F okonomiyaki3000@gmail.com Elijah Madden +65 https://www.google.com/accounts/o8/id?id=AItOawm_yGkSDEPHcabHICFnaN-a3rlEs35UVq8 https://www.google.com/accounts/o8/ud 6F54C405-2CCF-4455-88E608ABE927B10D support@suraj.co.in Software Support +68 https://www.google.com/accounts/o8/id?id=AItOawn-2kRSuEJRZkC7h-Pr8Dp4KMoGC56Q6r4 https://www.google.com/accounts/o8/ud AE2AD85F-271C-44B1-B5E84FA6AE9289D9 gavrilak89@gmail.com Dima Soldatenko +69 https://www.google.com/accounts/o8/id?id=AItOawmOm9fhvDse92gBLDWf3bCxT9oJETq0v0M https://www.google.com/accounts/o8/ud 06BEFA81-9071-429A-A4A2634AA11E5FEB puggan@gmail.com Puggan Backlund +70 https://me.yahoo.com/a/u_q12wkspND_k8MnEmGEW1CQnzyhzFHs#590f3 https://open.login.yahooapis.com/openid/op/auth A5213B47-10BC-4E2F-A932105A37F9F1E3 kumar960835@yahoo.com \N \N +71 https://www.google.com/accounts/o8/id?id=AItOawmqxoWGrPinwLwDhXB8I42ZinoczyvghuA https://www.google.com/accounts/o8/ud E30D6A4A-22B5-4D3A-B29A77A33EB7933F mlancellotti@gmail.com Mariano Lancellotti +72 https://www.google.com/accounts/o8/id?id=AItOawn-PrZvhF6S8cLJ-UlSPvmj_FKztuKv3A8 https://www.google.com/accounts/o8/ud BD09BCD3-4B6B-4FF2-BDDA88DB789C0CAA create812@gmail.com Ben Johns +73 https://www.google.com/accounts/o8/id?id=AItOawmXA3O7gobM2QhVzTPHkyuQCCzvWBFH5_w https://www.google.com/accounts/o8/ud 45319FCF-4025-4502-8B7EB13717AAF334 senthilkumar.me2006@gmail.com Senthilkumar Elangovan +74 https://www.google.com/accounts/o8/id?id=AItOawlCQeSp8fvY17Jl-mLOJ1HA0fLshBtflIE https://www.google.com/accounts/o8/ud 0855157E-AFAB-4484-9E63DDD61D9A9F34 savingstrangers@gmail.com Nick Hand +53 https://www.google.com/accounts/o8/id?id=AItOawm6EGHp2EJTgdTeY0C80HAk8BqNPc_HiEc https://www.google.com/accounts/o8/ud 809C587A-2E49-4194-85A84FAECB490939 michael.searcy@gmail.com Mike Searcy +56 http://diecho.myopenid.com/ http://www.myopenid.com/server F96CA653-57B3-4B35-BFC63129A53CD5A6 \N \N \N +75 https://www.google.com/accounts/o8/id?id=AItOawmcPLb_DFhO6R4LM9OUti7aw_POXHOGjsk https://www.google.com/accounts/o8/ud 4543C886-2ED0-4999-909CB512D7BECB4F svetzal@gmail.com Stacey Vetzal +76 https://www.google.com/accounts/o8/id?id=AItOawmdsi7k03hIlvmHyv5FD3fPLHT5jtVYKPs https://www.google.com/accounts/o8/ud 4545C807-06B2-4B45-BB81749DFA345A8C fabiosje@gmail.com Fabio Souza +105 https://www.google.com/accounts/o8/id?id=AItOawkfzCZeJo_n1jmBJO82nn3FTJP-z-8F47g https://www.google.com/accounts/o8/ud 331071EA-026E-46C7-AE0D6AA497DCDDE9 justinswartsel@gmail.com Justin Swartsel +77 https://www.google.com/accounts/o8/id?id=AItOawlPkeQqCVl9Dwcvlz9_0_aAl-md8Co125c https://www.google.com/accounts/o8/ud AA33E295-18B3-42B5-BB6B9455E0B40410 beshkenadze@gmail.com Aleksandr Beshkenadze +78 https://www.google.com/accounts/o8/id?id=AItOawmi1YA8cc84XiJ2lhEC1qp6XKDI0g8pgxg https://www.google.com/accounts/o8/ud 7C392338-D3A9-4476-8C32E6C238C0871A greif.tomas@gmail.com Tomáš Greif +106 https://www.google.com/accounts/o8/id?id=AItOawkQ3ORMEBqMzHYwxd7PQWv37NpYwBSKlsE https://www.google.com/accounts/o8/ud 16D684C3-92EC-4612-A41680952DE662D8 grahampcharles@gmail.com Graham Charles +79 https://www.google.com/accounts/o8/id?id=AItOawmheNvcfpnX1LA_QKcvm5yVKp_fzMIkjQo https://www.google.com/accounts/o8/ud 5437ACE3-9ACE-4CFA-9F0A7CF20354C008 ravuya@gmail.com mike stedman +80 https://www.google.com/accounts/o8/id?id=AItOawnRwN7t-eGiH8tctJres-Qpcg6rM_tV5LA https://www.google.com/accounts/o8/ud 8C06A45F-1439-4F94-85566AA1FB38B3D8 dennis@denniscjones.com Dennis Jones +81 https://www.google.com/accounts/o8/id?id=AItOawk8XhugWQtF2z2wIcvwthnbShRYAKTMp0U https://www.google.com/accounts/o8/ud 6E1AD104-91C1-4E01-B864B4561C32BCE4 ilan.kasimov@gmail.com Ilan Kasimov +82 https://www.google.com/accounts/o8/id?id=AItOawnv9bWa0jOsgCDbSXghLzOOc3ZFGyEUfQg https://www.google.com/accounts/o8/ud 9CCAF4DF-CD4E-4136-8BBE955CACEF9366 mdanso@gmail.com Michael Danso +83 http://casualjuergen.wordpress.com/ http://casualjuergen.wordpress.com/?openidserver=1 280DFF1A-A3EE-40BA-A626344498BB28E5 \N \N \N +85 https://www.google.com/accounts/o8/id?id=AItOawlcrz-oEyVBRjPBk1ZP9PscUiKpXbvZ0R4 https://www.google.com/accounts/o8/ud FCB64F92-20AA-4C45-BC70535DA57704F3 kolypto@gmail.com Mark Vartanyan +86 https://www.google.com/accounts/o8/id?id=AItOawkQVAhJYXZgsmB9Q7ZJO6B21edEMIAd7dk https://www.google.com/accounts/o8/ud 0F3B878C-B729-4991-BF71B134ECA09838 dani4686@gmail.com D Daniel D +87 https://www.google.com/accounts/o8/id?id=AItOawldKFDBAtyWuB57z8HrpHMLvdzcr8BKz7s https://www.google.com/accounts/o8/ud 91F1E229-9BF1-43BF-8F38CF2B9999DE67 benyblack@gmail.com Behnam Yousefi +88 https://www.google.com/accounts/o8/id?id=AItOawkO8nEWxb2wBtQ-dkyFUtkobym_DktYd6c https://www.google.com/accounts/o8/ud 870984EA-C3B2-40D4-82063B51130D97C5 ivan.zivanovic@levelbit.com Ivan Zivanovic +89 https://www.google.com/accounts/o8/id?id=AItOawlVLvJ5JvBpuBPXm_flujI_Df2HEGr2R2c https://www.google.com/accounts/o8/ud 79DF3C03-B8F6-406F-968166E180E48FD7 karthikn2411@gmail.com KarthiKeyan Raju +90 https://www.google.com/accounts/o8/id?id=AItOawlBEtzNwPFzGOMDmBoJYrDmp1pEg6EdTZo https://www.google.com/accounts/o8/ud 44A78781-26C8-40E2-BF72F3CA79C11AAB matheuspatury@gmail.com Matheus Sampaio +91 https://www.google.com/accounts/o8/id?id=AItOawkVExdZypdUeJGrCcC6nhrHSX0lrJFZA50 https://www.google.com/accounts/o8/ud ECF63707-030B-4A4B-9D3EFF98E4420D44 henrik.holmgaard.hoyer@gmail.com Henrik Høyer +93 https://www.google.com/accounts/o8/id?id=AItOawkVTR_PWAydFItjjykvraQyIZt2L_ryIJQ https://www.google.com/accounts/o8/ud 54B3B7AF-5097-47D9-A46A4E0226E3FE0C fallensoldier52@gmail.com Cheney Tsai +94 https://www.google.com/accounts/o8/id?id=AItOawlvejpQRKtZqLPRp_7z7g6JccCFpUikPgY https://www.google.com/accounts/o8/ud 7EF21D14-D39B-4B2A-BDBC7A1D05AD5C58 dang.hvu@gmail.com Hoang-Vu Dang +95 https://www.google.com/accounts/o8/id?id=AItOawkOENFYAIqCr24H8EgKe_hAX86CXjS2-V8 https://www.google.com/accounts/o8/ud 3D91F008-8963-4BCE-AEED1DBC68EDC5C9 brsaweda@gmail.com Erwin Brandstetter +96 http://wodecraft.wordpress.com/ http://wodecraft.wordpress.com/?openidserver=1 80919925-3DEF-4EE2-86FE875B6CA7C8B9 \N \N \N +97 https://www.google.com/accounts/o8/id?id=AItOawnscJMg9IVeMcVYqoMftg8v0DonpCCGKSA https://www.google.com/accounts/o8/ud C9C550A4-56B1-4017-A811220B498B3D27 jennedebleser@gmail.com Jenne De Bleser +98 https://www.google.com/accounts/o8/id?id=AItOawlbfLCDIyFYeGBR-Vm5LDVlbp9-JlmXBrM https://www.google.com/accounts/o8/ud 99932BE0-9B24-48FF-86215206C92704BC stuehler.work@gmail.com Matt Stuehler +99 http://kabichill.myopenid.com/ http://www.myopenid.com/server 92F33B92-7705-4F90-A9FE1EF2CBD7DCFF \N \N \N +100 https://www.google.com/accounts/o8/id?id=AItOawnTUIZE-0qjeiFDrRxmAgiUDPLI6BSwawE https://www.google.com/accounts/o8/ud C137E191-F101-47D0-B515289FC592D106 ez.amiryo@gmail.com Hyun-woo Park +101 https://me.yahoo.com/a/NUjOJAV.qc1u8d.5U2nO117INeA-#9acdc https://open.login.yahooapis.com/openid/op/auth 17B36F44-5440-4CD5-99920A279BC57834 kkunal1@yahoo.co.in \N \N +102 https://www.google.com/accounts/o8/id?id=AItOawmZBtFaLbMbj2HxFrH06jSdnR_B5HhtYSQ https://www.google.com/accounts/o8/ud A0672F83-73DE-4440-B6521EDDE84D653E shiv3250@gmail.com Shiv Shankar +103 https://www.google.com/accounts/o8/id?id=AItOawnVjm3gi7hMO1N9K7kXEAnuXIYQ3mrweNg https://www.google.com/accounts/o8/ud 25148091-C19D-4B0C-BD0329EC786CBC19 dennis.babkin@gmail.com Dennis Babkin +104 https://www.google.com/accounts/o8/id?id=AItOawkhZc7Xbz-ChFFlsK0ZVCZFqjH-Ux3q-Us https://www.google.com/accounts/o8/ud 3D81112C-8728-4863-9BB9E93D155AB442 thibaut.delarbre@wiredelta.com Thibaut Delarbre +107 https://www.google.com/accounts/o8/id?id=AItOawmWbeXB4W3mMbnSe8rsy0H9sooXOqojIfg https://www.google.com/accounts/o8/ud 0395B960-CA92-42E0-A865C03164A43BF9 abbas.zolfaghari@gmail.com Abbas Zolfaghari +109 https://www.google.com/accounts/o8/id?id=AItOawktC5RxgqSIkwRIsRsfU36nEXLmtezsIXg https://www.google.com/accounts/o8/ud F2E762BC-4F4B-4AA1-A0B17307BD03339D whytheq@gmail.com jason quirk +84 https://www.google.com/accounts/o8/id?id=AItOawni6Q0XiDS_tmTYdu7tBJaYzEXGcFfngDY https://www.google.com/accounts/o8/ud D86453A8-3076-4A4C-8F8CD1EE0B807809 yessivaganesh@gmail.com sivaganesh santhanam +110 http://sashao.myopenid.com/ http://www.myopenid.com/server B2876F1B-EE7D-4DB0-B12B2FE0468D0FB9 \N \N \N +92 https://www.google.com/accounts/o8/id?id=AItOawn4ql3pxx4rO9hyuliIvnW-iDWwIjQTFIU https://www.google.com/accounts/o8/ud 04B39B76-8E25-462F-8203E5B30B9CBDE5 di@espacot.pt Francisco Moreira +111 https://me.yahoo.com/a/CBHIbEl01uRrM6wkXIgIoKRYPw.Zwo0.yz3O#d6ff7 https://open.login.yahooapis.com/openid/op/auth CA92F44F-DCAD-4A9E-AE61A85E37388C44 a_arabsheibani@yahoo.com \N \N +112 https://www.google.com/accounts/o8/id?id=AItOawkhGY6beZnC-TXMu72cwLt5IijGme0bDZ0 https://www.google.com/accounts/o8/ud 6112E5EC-11F7-4F46-944A6F1C30E41588 hamed.ma7@gmail.com Hamed Momeni +113 http://biswasishere.myopenid.com/ http://www.myopenid.com/server CB1AF487-6DC8-42F3-84A7F09A64F35B42 \N \N \N +114 https://www.google.com/accounts/o8/id?id=AItOawmOy39sXufB9FZL8ypG6hUwhRDQzq5D0IY https://www.google.com/accounts/o8/ud 1E50C03C-AA3D-407E-A934567E4A79473B supermania@gmail.com Yongbin Yu +137 https://me.yahoo.com/a/j1fhRxhtzpdebxb7adtV2bsvuNg3fq1Psg--#536d7 https://open.login.yahooapis.com/openid/op/auth 856861A8-94C9-41F3-ACE18075D02200F3 maayehkhaled@yahoo.com \N \N +116 https://www.google.com/accounts/o8/id?id=AItOawm120TjgbFcEDtayyz0nVAfhdd8ETh9Qk4 https://www.google.com/accounts/o8/ud AEF69138-E6B2-4CDC-9285182ADB65668C raje444pln@gmail.com raja mohan +117 https://www.google.com/accounts/o8/id?id=AItOawkAc3cjwBJ1dAJCuDF31lILIfLXBo-1WpQ https://www.google.com/accounts/o8/ud 6C5A34D2-6C37-47FC-A15EBF6A0385BFAE reputator@gmail.com Allan Larsen +118 https://www.google.com/accounts/o8/id?id=AItOawnOiIc49zwim5bN9CpY7amZlkZO7qaCcbY https://www.google.com/accounts/o8/ud D08A4BE9-C92D-4BE6-967103A3BC9001AF steven.samuel.cole@gmail.com Steven Samuel Cole +119 https://www.google.com/accounts/o8/id?id=AItOawmYcg6vWfdqx5UNwnZB297m34FCBBoGmZc https://www.google.com/accounts/o8/ud 530D5273-E54A-4D59-99F4454D975B278A adatapost@gmail.com KV Prajapati +120 https://www.google.com/accounts/o8/id?id=AItOawnb8h3cHS-iijYspFDSFyJscevvJopCgyo https://www.google.com/accounts/o8/ud 3AEA612C-53CB-41BD-A70FA05EF30F617D hieuht@vnoss.org Hà Trung Hiếu +121 http://rookiedev.myopenid.com/ http://www.myopenid.com/server 5FA4BD52-B5DC-4131-856F986AA454B1CF \N \N \N +122 http://jason.sperske.com/ http://jason.sperske.com/MyID.config.php 865AEC6F-ADDB-41FC-9A247F8957BF2651 \N \N \N +124 https://www.google.com/accounts/o8/id?id=AItOawnax10dl7lF0aC9qsEKECaFwWUzGB2x1C4 https://www.google.com/accounts/o8/ud 7F9CF0C1-7138-4665-BFB3D98FF3FF6D35 knbulut@gmail.com Kübra Nur Bulut +126 https://www.google.com/accounts/o8/id?id=AItOawlUJBkxm2gzpN7gnlIvkUsQNnTz0nnHWy8 https://www.google.com/accounts/o8/ud 1F7C702F-706A-4C6C-A6F88B5D1D7FD7A9 corinnekubler@gmail.com Corinne KUBLER +127 https://www.google.com/accounts/o8/id?id=AItOawnv7T93AXB8p8r4b8rYcEUkcHZcO96WwNc https://www.google.com/accounts/o8/ud C99FB97E-C708-454A-91DD54402B50EFD4 sathya@sathyasays.com Sathyajith Bhat +138 https://www.google.com/accounts/o8/id?id=AItOawn5oWaW4NgNkNLXVPeyv-jM-pcMvc_BAFY https://www.google.com/accounts/o8/ud 30097ACC-DA04-4151-B74863D2C2A22E85 markrada26@gmail.com Mark Rada +128 https://me.yahoo.com/jelevin26shd#ffca8 https://open.login.yahooapis.com/openid/op/auth FB2BC12D-C6D2-440E-93396E5795EE9C79 jelevin@yahoo.com \N \N +129 https://www.google.com/accounts/o8/id?id=AItOawkHqljRXQGV2hyTW7G1gy6tUQYUSfuSplM https://www.google.com/accounts/o8/ud E74EEFDB-1385-4226-84157D96D7109088 leangpengan@gmail.com Pengan LEANG +115 https://www.google.com/accounts/o8/id?id=AItOawkB3Go15ndEhkdhDYqLFfNF8HG_JlC044k https://www.google.com/accounts/o8/ud 945721E0-7CA0-4AA6-BE4909A332B0B999 agupta@activision.com Akhil Gupta +130 https://www.google.com/accounts/o8/id?id=AItOawlsPmmK0uDBZBs8lQO22LHrn8JO6UBXGQQ https://www.google.com/accounts/o8/ud 8EF6FD6F-3C4E-4E68-925A93429889FAFF andymcneish@googlemail.com Andy McNeish +131 https://www.google.com/accounts/o8/id?id=AItOawn-U_0Y5FN1oHMINrL0QP9LvsaF3pwWejw https://www.google.com/accounts/o8/ud 044B0DBD-9568-4C9A-837348BF27057A16 aa.kuma3@gmail.com Akio Kumano +133 https://www.google.com/accounts/o8/id?id=AItOawl-r8EuMLLRPhfloZ085EQrgA_nvdxy3KM https://www.google.com/accounts/o8/ud 82CF2F5F-EE68-4889-8C7EAEA2DD3B596D bhushan.tadwalkar@gmail.com Bhushan Tadwalkar +139 https://www.google.com/accounts/o8/id?id=AItOawlyU5SlwZvLSXeb_JOZfjdVtAAqC_5Ep0U https://www.google.com/accounts/o8/ud A5F628FE-A8AF-43F1-B99225CBE09192F4 ljdc14@gmail.com Louie Jay de la Cruz +140 https://www.google.com/accounts/o8/id?id=AItOawkf7zV_MUPe-wB875maPJE5408SwL_h61k https://www.google.com/accounts/o8/ud EC846568-028A-4A00-9C6F4FEE45A75583 sandeshmahajan72@gmail.com Sandesh Mahajan +134 https://www.google.com/accounts/o8/id?id=AItOawmy2Dp5mdScmoN24SRNCItPXNgK-9m1pXw https://www.google.com/accounts/o8/ud 3B5469A0-418F-4E6B-A27D1EA9E0D48860 john@alcock.org John Alcock +132 https://www.google.com/accounts/o8/id?id=AItOawmiUWAw91x5ukP6drJOUyQRP0_Z34DdUcs https://www.google.com/accounts/o8/ud 002D0B16-C765-4E3E-B34BA7C3BF161EC7 dirrell@gmail.com Tim Stanley +135 http://elwetana.myopenid.com/ http://www.myopenid.com/server 7278326E-8B3C-43CE-A20B906FEC861C16 \N \N \N +136 http://david-japan.myopenid.com/ http://www.myopenid.com/server 849B6915-BD51-4C63-A12AEB82A64D3042 \N \N \N +125 https://www.google.com/accounts/o8/id?id=AItOawkxxrN2_oTGokHXd41lYn6X2glHD8KxHcM https://www.google.com/accounts/o8/ud 488A32E9-3FD9-475C-93F5E7FE2C1BC9E8 kaiwinter@googlemail.com Kai Winter +141 https://me.yahoo.com/a/SvQJwzkboP1liVV6Y0kM9TwqyXtEv46RrUU-#416d0 https://open.login.yahooapis.com/openid/op/auth 28718FA4-53E4-48A0-AAB48B5E32878867 pillaimanisha@yahoo.com \N \N +142 https://me.yahoo.com/a/5PVa2A11rv.apRcUt3rE5i8.8tFswA--#0cae7 https://open.login.yahooapis.com/openid/op/auth 84148856-0209-4CF5-BCC2C66021B6FAFE rashi_169@yahoo.com \N \N +143 https://www.google.com/accounts/o8/id?id=AItOawkG42R0HC4-mr4qFUZ-g5tipDG-ebWpciM https://www.google.com/accounts/o8/ud 50BEAB31-1C5F-415A-AD0781D18A124294 brow4u@gmail.com Prem Dass Baskaran +144 https://www.google.com/accounts/o8/id?id=AItOawnIoBLKXTMLCg4lQ8ZujZogf_aQiUCHIwU https://www.google.com/accounts/o8/ud 788DBB9E-7F38-4AB1-A5974248C06B0669 ntnulemon@gmail.com lemon c +145 https://www.google.com/accounts/o8/id?id=AItOawme5x5Ptr86o622i2BKP1S9HDPLCs4WABU https://www.google.com/accounts/o8/ud C5612399-28F8-47C8-80C3D3FB58FCE27D adrianonantua@gmail.com Adriano Nântua Carneiro +146 https://www.google.com/accounts/o8/id?id=AItOawnj-dAuT95bW55vrRbtu1ybkM-IyBKesfc https://www.google.com/accounts/o8/ud 79E98A83-DCFD-4B76-92B9E5CE7C9D2686 hoganlong@gmail.com Hogan Long +147 https://www.google.com/accounts/o8/id?id=AItOawlmioGBvOVFyLZOSEzZNtPl2bjvL2AX9Ao https://www.google.com/accounts/o8/ud 096C9FF0-6C37-4224-A38F5D1F7AC96D68 andoreis@gmail.com Leandro Reis +148 http://saleemalik.myopenid.com/ http://www.myopenid.com/server EF63715D-B041-4997-9E7C6EA7E765CBAD \N \N \N +149 https://me.yahoo.com/a/ULZCrHwCwffHzAjGQgKhr68dO2rt#c2dce https://open.login.yahooapis.com/openid/op/auth A7FD94F0-6DED-47E6-BC53A93E39D5E99A suedeuno@yahoo.com \N \N +150 https://www.google.com/accounts/o8/id?id=AItOawnAU62AexltWfRtQB1mWjK-5BPDlaGs2uI https://www.google.com/accounts/o8/ud 3B6E672C-6832-4FA6-B79EC07FF9150214 kbeck88150@gmail.com Nicholas Kuhlenbeck +151 https://www.google.com/accounts/o8/id?id=AItOawmKUbtMmqNYJrCjXlsgjPl52_9rbNNeZFs https://www.google.com/accounts/o8/ud D82F1741-DA08-4FF3-A5C239ECCAE3EE07 eric.m.gray215@gmail.com Eric Gray +152 https://www.google.com/accounts/o8/id?id=AItOawlx0Y6vFBN0D2LrNz42rrXoRYh5oO8tPdg https://www.google.com/accounts/o8/ud DF5A2460-F2AA-4A57-B93482165B840F9C petersky@gmail.com Kyle Petersen +154 https://me.yahoo.com/a/DwJoAgYbiYr6zw2zCe5aJwm8axli2F_upMRTQ.q3#83322 https://open.login.yahooapis.com/openid/op/auth F380F1B3-BDB6-4F70-81921F96D7A569C9 nikhil_dayalapwar@yahoo.com \N \N +155 https://www.google.com/accounts/o8/id?id=AItOawkro-hYd3fI8u4YvEcw1aLgj7KSi0BlUZQ https://www.google.com/accounts/o8/ud 06334FD6-FF92-4D85-AD3268797035A2FC tapan.parikh6843@gmail.com Tapan Parikh +156 https://www.google.com/accounts/o8/id?id=AItOawkmM8r-8Jbsnuuvyy92UHXJFy2akcGFdZQ https://www.google.com/accounts/o8/ud 5CAB3F26-D085-49B9-B68DF57DD82F6BAE jjwdesign@gmail.com Jeff Walters +157 https://www.google.com/accounts/o8/id?id=AItOawkiSyf_ws60ebXIUmnfYUSwbpv25HvFqU0 https://www.google.com/accounts/o8/ud BBD672B5-222C-412A-B2056E8C13F0A0C9 muhammadali506@gmail.com Ali Naqvi +158 https://www.google.com/accounts/o8/id?id=AItOawlEbcwcxifnCT2W2gUhqaHn-KiuxVlb6YA https://www.google.com/accounts/o8/ud BB15876C-30CE-4504-A3CB4E2D359F3EB9 halladaypublic@gmail.com Tom Halladay +159 https://me.yahoo.com/a/XTi.qZA81IQDB9hOXgvrYn6accPV#e7416 https://open.login.yahooapis.com/openid/op/auth B73466E5-22F5-4A8A-9FD0467589826174 glenn_heinze@yahoo.com \N \N +160 https://www.google.com/accounts/o8/id?id=AItOawmNlTlkEDMik_x_GRWhsapsIonPq2GbA90 https://www.google.com/accounts/o8/ud 654ED480-62CF-4CAB-B70C043DC69D672C sillyerik@gmail.com Erik Eckhardt +161 https://www.google.com/accounts/o8/id?id=AItOawmRT-e8Xj51seHo6L8U4dWbnZxpFGsmqXQ https://www.google.com/accounts/o8/ud F2F61CBD-4315-4E1B-9FB1924E61547DC3 magnanamous12@gmail.com Scott Mankowitz +162 https://www.google.com/accounts/o8/id?id=AItOawmk16pt-S6zx9lWYLEEHTelQ2P7oKyBWEo https://www.google.com/accounts/o8/ud C16EDB36-6C83-4839-B1EA312BBB2CD3B0 amatthies@babbel.com Anne Matthies +163 https://www.google.com/accounts/o8/id?id=AItOawknGgACojSSmiW1AXatC56xZyyljlm1phk https://www.google.com/accounts/o8/ud 53ECB2C7-6308-4942-B23926FB256F5792 alastairjwright@gmail.com Alastair Wright +164 https://www.google.com/accounts/o8/id?id=AItOawkaIi435nnxMwDmb1V4nasDlX2A-NpvTgE https://www.google.com/accounts/o8/ud C5A1D505-FF58-4A64-B3A5526444D33949 sholmes2428@gmail.com Sabir Holmes +165 http://bugness.myopenid.com/ http://www.myopenid.com/server EE02C9A7-8B44-4D8C-AEE6C344B805C179 \N \N \N +166 https://www.google.com/accounts/o8/id?id=AItOawlXPn164jozJg1J1ZlSXymS0e3V_Kwpzxs https://www.google.com/accounts/o8/ud 8449430C-2A95-4996-AB223B89E93B67DD seijino8@gmail.com 清治 粕谷 +167 https://www.google.com/accounts/o8/id?id=AItOawn6-wKT4okb69tR7GcboktlbQgxhosGrbo https://www.google.com/accounts/o8/ud 305E66FC-7427-486F-B81689E5C9EE5643 j.palomar.jr@gmail.com JR Palomar +168 http://mscheuner.myopenid.com/ http://www.myopenid.com/server D1A052A6-8B07-445E-BA052AD9ADCD09E1 \N \N \N +169 https://www.google.com/accounts/o8/id?id=AItOawnDaArwgHrMi38QW65UhqwWgFcIinu8ncg https://www.google.com/accounts/o8/ud 021D41A0-DC7D-4EED-AAE80A92E523E4E4 theres.07@gmail.com therese j +170 https://www.google.com/accounts/o8/id?id=AItOawn1LyK2B-Bur7r9FqP6-x1YFyJJt4KiDBU https://www.google.com/accounts/o8/ud F0D59B5B-14AB-4AE2-B65B2D7B83EC2151 mharen@gmail.com Michael Haren +171 https://www.google.com/accounts/o8/id?id=AItOawmS2e_cvxE3dsZdkxYUh_hb2VKUOKUMsLI https://www.google.com/accounts/o8/ud 02769941-E9E9-4BB5-AED096C6D79D3479 arnautov.eugene@gmail.com Арнаутов Евгений +172 https://www.google.com/accounts/o8/id?id=AItOawlrXWO2by9YozzZZLRP7RD1wZ97qK_-r84 https://www.google.com/accounts/o8/ud 75AB3D4A-4CE7-4DF7-8496408E27CE2D16 olliejones@gmail.com Oliver Jones +173 https://me.yahoo.com/a/nrArpB873cgz.dUMMiHkSjZAzayl#441d1 https://open.login.yahooapis.com/openid/op/auth 0CAD51CF-89B8-49A6-AED1E3308552B1E6 navotera@yahoo.co.id \N \N +174 https://www.google.com/accounts/o8/id?id=AItOawnnr6CugDWbPjA5bEqZJWkT3i6cyyKuKhc https://www.google.com/accounts/o8/ud D617EF96-0942-4864-A2958744D4623831 matt@yurisko.net Matthew Wheeler +176 https://www.google.com/accounts/o8/id?id=AItOawmf2EVHZAZXkE00FIi37RcZ2c95fVA-4kg https://www.google.com/accounts/o8/ud CF803981-2CBE-454E-AF4601578DB0F18C empeus4@gmail.com Empeus Treius +177 https://www.google.com/accounts/o8/id?id=AItOawlrhNQkqE3_e6VDY0kteG3E_m_BmnqY4WQ https://www.google.com/accounts/o8/ud D7FD34EC-C61D-444F-8AD998EC64579808 matti.john@gmail.com Matti John +179 https://www.google.com/accounts/o8/id?id=AItOawlmfou9t0akoI18qvSbXcmJt_jJ7tZgG0U https://www.google.com/accounts/o8/ud 32E62454-FAC0-43BC-A5BE2F54D63A3AFA rekcah5@gmail.com Nick Maultsby +180 https://www.google.com/accounts/o8/id?id=AItOawkJfZkVmJpJScuy30xy8p7ocAqSOqcd078 https://www.google.com/accounts/o8/ud 3D6BDD03-F3EE-4401-ABD128CC15392440 bluebaroncanada@gmail.com James Baron +181 https://www.google.com/accounts/o8/id?id=AItOawnvdx6nD_Fv1MPzEGW8HOlf6c-HEz2VyUE https://www.google.com/accounts/o8/ud 7FAA4BE1-749E-4985-B3D88271CB31196C rene.zbinden@gmail.com Rene Zbinden +182 https://www.google.com/accounts/o8/id?id=AItOawkfMSGHU4tjrargIS4qaHgYWAmQfTtdSJc https://www.google.com/accounts/o8/ud 957D194D-D665-420D-A92CD2D8B73C78A1 udupiravi@gmail.com ravi j.v. +153 https://www.google.com/accounts/o8/id?id=AItOawkSnxAwWXbNDL59EIsD2RCKnWQrlEVIHjc https://www.google.com/accounts/o8/ud 413D30A7-16DB-4BCD-A329407616C5D70E adhikarideep@gmail.com Deepak adhikari +183 https://me.yahoo.com/a/68QVr30gl4HXzuE4RjrfFblMFEo-#87741 https://open.login.yahooapis.com/openid/op/auth 34A01E8F-0E8E-447B-828CA03153FF5037 ed.heal@yahoo.co.uk \N \N +184 http://sarmenb.myopenid.com/ http://www.myopenid.com/server 80CF24A2-2937-42F4-88F6D250B22FB503 \N \N \N +185 https://www.google.com/accounts/o8/id?id=AItOawnoNVUODZhww-bDs7fS5aZO3kDdsHusCwU https://www.google.com/accounts/o8/ud 8DA66749-D17E-4F61-B233410D8F5190FA rose.d.perrone@gmail.com Rose Perrone +175 https://www.google.com/accounts/o8/id?id=AItOawnjnVsT5-QwV-GkVfvf1gTcRRkKQt4Ch9k https://www.google.com/accounts/o8/ud C10FE08A-05C3-4AEA-8934C116F5A35907 scottwaynereed@gmail.com Scott Reed +208 https://www.google.com/accounts/o8/id?id=AItOawnyL9pu_N5ePNhd69YSAEOaEEDlbuDaNmE https://www.google.com/accounts/o8/ud 7286A7A9-92C8-4E88-9ABCE9B369205C31 maw74656@gmail.com Marc Weinstein +187 https://www.google.com/accounts/o8/id?id=AItOawnZ7VL0Dew8qlGrKLOL46MnAyx6rBO3NxA https://www.google.com/accounts/o8/ud 5AECC565-A219-4CB2-AE5C4C70FBA48B6D himanshujansari@gmail.com Himanshu Jansari +188 https://www.google.com/accounts/o8/id?id=AItOawmqoVo7xLzaZ5aYwSsh6_1fzeEYc2-rjjI https://www.google.com/accounts/o8/ud 5C8EC23E-F63C-46C4-BFB63B4E65EDE757 jasonjtien@gmail.com Jason Tien +190 https://www.google.com/accounts/o8/id?id=AItOawkHXL1rmXd_q4Kf_2XQNfjsNKNCrzjG82k https://www.google.com/accounts/o8/ud 1E3864AE-0853-4694-A2D51DE88D4B121B prabhakantha@gmail.com Prabhakantha Chandrakumara +191 https://www.google.com/accounts/o8/id?id=AItOawkw5MUwGQSxb716G2d6gMuNDhVN1Z2RHs8 https://www.google.com/accounts/o8/ud 0D271AF7-8238-4A0D-8C38A9D26454DFAF kenparisi@gmail.com Ken Parisi +209 https://www.google.com/accounts/o8/id?id=AItOawmk_6BxmLiLG04tVPvdfT5fM7e2NOanTK0 https://www.google.com/accounts/o8/ud 36146847-8D9C-4FB9-9422028341A72091 ashbyj@gmail.com jesse ashby +192 https://www.google.com/accounts/o8/id?id=AItOawkWMM3BEuMJLRPRmWtmAicTWk12f_4BHWk https://www.google.com/accounts/o8/ud 0F25F6CE-B2BA-40C4-9F8CF223E4E4AE07 crosan@gmail.com Andrew Cross +193 https://www.google.com/accounts/o8/id?id=AItOawmOpe6c3NjEFOHd9LiYHuX-bKKjg2hijeU https://www.google.com/accounts/o8/ud CBED905C-155A-4589-A7A5B110082C7812 jjohnskc@gmail.com Jason Johns +194 https://www.google.com/accounts/o8/id?id=AItOawnmZimRuyRr1FtsPPWiRcTCSexxmX-L0Z8 https://www.google.com/accounts/o8/ud 8B7EA0E6-29E3-461E-B98F626DE227C79E justin@createdm.com Justin Erswell +195 http://freefail.myid.net/ http://server.myid.net/server B8691E76-6CE9-47C0-BD096DBA60CC66E7 \N \N \N +210 https://www.google.com/accounts/o8/id?id=AItOawkFBt5UE_IlciS0r84IWveDiHcbeNy3tQQ https://www.google.com/accounts/o8/ud EB65776A-373C-487B-A52D9FA19B6834DA andreas.schnoerr@gmail.com Andreas Schnörr +217 https://www.google.com/accounts/o8/id?id=AItOawmxpU2lNHRw4EO3JN-9pZz70broifT1PxU https://www.google.com/accounts/o8/ud 465202B7-BBC5-4A40-830F55CEFE7F61FD neilmcguigan@gmail.com Neil McGuigan +196 https://me.yahoo.com/a/joqfhdJmloInkewTpenkUtWmUP4rCR0-#30790 https://open.login.yahooapis.com/openid/op/auth A713D1C3-D4E1-4CCE-97D0BBDE6CF80421 popescu_fm@yahoo.com \N \N +197 https://www.google.com/accounts/o8/id?id=AItOawlUrWBHPBzxy4Hf_5IdssHM9fw9siKFKZM https://www.google.com/accounts/o8/ud B5B5ABC0-0FBF-45FA-9E4AF2EFE24AE2A2 popescu.florin@gmail.com Florin Popescu +198 http://outerbridgemike.myopenid.com/ http://www.myopenid.com/server DD9B0860-9150-446B-9D4E1654DE1CFE27 \N \N \N +216 https://www.google.com/accounts/o8/id?id=AItOawm32a3UKfDOt9XYFhyqmcxNy6cIrhrsg_0 https://www.google.com/accounts/o8/ud 68C92F78-C730-4AF7-9F0B26C0B9E12593 deborah.claxton@gmail.com Deborah Claxton +199 https://www.google.com/accounts/o8/id?id=AItOawkYylkdaRvQiZZ5JhOINkslXred5CJgCLM https://www.google.com/accounts/o8/ud FC655BB2-490C-4042-9AADC51F33C5178F phaufe@gmail.com Pierre Haufe +211 https://www.google.com/accounts/o8/id?id=AItOawn3VnhXGoDvBz1NR12FA3yZ7OK4bt06ETg https://www.google.com/accounts/o8/ud 31D69FE3-15E0-457B-9BD4BB2E05DE43E2 cghrmauritius@gmail.com Chris Robinson +212 https://www.google.com/accounts/o8/id?id=AItOawmy2Qa4EyihZ_gQQS0o0ShhO6qoVnPQq7g https://www.google.com/accounts/o8/ud 1D45EE9F-B395-42EF-B360A1E4E54DA472 dimapravdin@gmail.com Dima Pravdin +200 https://www.google.com/accounts/o8/id?id=AItOawk8FjPQo0JbHDWOHNA_5SqGEaSyg4Ecirk https://www.google.com/accounts/o8/ud 599DB3B3-6C20-4A1C-B35906D31AC46641 chisholm.jacob@gmail.com Jacob Chisholm +201 http://vicious3891.livejournal.com/ http://www.livejournal.com/openid/server.bml 622D2625-B0DA-4F7B-924D5DDDF666C932 \N \N \N +202 https://www.google.com/accounts/o8/id?id=AItOawmBJlvPBhrZuRD6mdi7kgPGXClx-oqi6GM https://www.google.com/accounts/o8/ud 2C2ABAC6-6C53-4E21-ADD54AEEBB6922BC sunilpanchakarla@gmail.com Sunil Panchakarla +186 https://www.google.com/accounts/o8/id?id=AItOawmM4XGkcw9-k_OyNqXqZZ_7GAhDJI28sQw https://www.google.com/accounts/o8/ud E595056A-6622-41B4-A2643B092F3E3B4F chisholm.jacob@gmail.com Jacob Chisholm +203 https://www.google.com/accounts/o8/id?id=AItOawlNMtsetIuJcW0cGDPzaFU-rYKQ4LdnAD8 https://www.google.com/accounts/o8/ud 650A8C09-643D-4621-8B62B3FE03B78B74 lucianf@gmail.com Lucian Fratila +204 https://www.google.com/accounts/o8/id?id=AItOawk1JsynPzHR9GnFYjQuDrzl5VJsZMwhEhk https://www.google.com/accounts/o8/ud 311823CE-A388-4B19-A1485D2B3E3EA8D9 denzil.joseph@gmail.com Denzil Joseph +205 https://www.google.com/accounts/o8/id?id=AItOawl8Rz2euHn4DnkghIVQlPaVMlU64FscmL8 https://www.google.com/accounts/o8/ud B3DDDBE1-E0E3-4385-805E6C5D50F5F901 geophoenix3@gmail.com geo phoenix +206 https://www.google.com/accounts/o8/id?id=AItOawnrKImjmPEXjHjOHoQHJkpZORg8NLYK1Vo https://www.google.com/accounts/o8/ud 5A772473-B794-4E83-A3847E7EE70244F0 abas.abady@gmail.com Ahmad Abbas Abadi +207 https://www.google.com/accounts/o8/id?id=AItOawl8QpMx-wX5w_rz3Tr0k7wLKKVNrliN2I4 https://www.google.com/accounts/o8/ud D537F2BD-0138-4BF6-91DF4F3E26F39EE1 glen.edmonds@gmail.com Glen Edmonds +220 http://openid.aol.com/tetradonshar https://api.screenname.aol.com/auth/openidServer CDE75C81-D9AE-4EA7-BE8F64571B741E91 tetradonshar@aim.com \N \N +213 https://me.yahoo.com/a/FvrEXAxxhvCPZC7S5KQx7PA9XIs-#46342 https://open.login.yahooapis.com/openid/op/auth D9308BF6-CB7E-4BE3-8ADDAC1145041B1C arn2025@yahoo.com \N \N +214 https://me.yahoo.com/a/FuUAm4oszcYvDUFiZ75LM2dkXfzvCyg_4k0HSxfoi1ytUJLPVA--#ddb0a https://open.login.yahooapis.com/openid/op/auth 9D20403F-E982-458C-B15E4EAFF77615CF dannofthursday_original7@yahoo.com \N \N +215 https://www.google.com/accounts/o8/id?id=AItOawlExR0uMXxvLRNsUZclcNZhgde4wRRuK4M https://www.google.com/accounts/o8/ud 154EA07E-2907-4E3E-871ACA1ECFD2B42E chris.jasson@gmail.com Chris Jasson +219 https://www.google.com/accounts/o8/id?id=AItOawkYGIY0ULUj8rcLM0hsDbNpuCq26MXKKAw https://www.google.com/accounts/o8/ud 4D154390-9C12-4ADF-9CA4ECC1A2DE86C3 outofbrain@gmail.com Sirko B +189 https://www.google.com/accounts/o8/id?id=AItOawnQ9pCSJSCwgfAsf_UBo38v_LuljvoyA6s https://www.google.com/accounts/o8/ud 4C23CBFF-A2A2-4E11-96DC1C0C266889D0 avpsoftware@gmail.com Alexei Popov +178 https://www.google.com/accounts/o8/id?id=AItOawm6bzpfcKSn0nIM3Ij6ryI13P68jkyaxek https://www.google.com/accounts/o8/ud 1BF92B6A-2EFA-4BDA-9035B0EF55DB5487 johnronald.ramos@gmail.com John Ramos +221 https://www.google.com/accounts/o8/id?id=AItOawmtVbL2NrXDDasuI83kuSMedkqDlD1ONAY https://www.google.com/accounts/o8/ud A5A9C3C0-345C-46D4-90817586F36852D4 dammilaluna@gmail.com Alice DeM +123 https://www.google.com/accounts/o8/id?id=AItOawkE7QGX9NmClwhClka6wkYfzlLaEb_efIg https://www.google.com/accounts/o8/ud 10218D06-ACD0-4832-B82412C0DD00EEB4 mark.byers@gmail.com Mark Byers +222 http://sqlpathy.wordpress.com/ http://sqlpathy.wordpress.com/?openidserver=1 5E2B5FA7-6B79-4D40-9BB7199BE60D3D9C \N \N \N +223 https://www.google.com/accounts/o8/id?id=AItOawmTVWSZ3DE_QjjyYSdNLywJV8malrlL7nM https://www.google.com/accounts/o8/ud 8275CDBF-4E94-4F9B-B83F122BE0927701 rahulrrathi@gmail.com Rahul Rathi +226 https://www.google.com/accounts/o8/id?id=AItOawkCjPyUM067LiVfyNxBbYkkEzPJMPKfh4E https://www.google.com/accounts/o8/ud DA038599-D16F-47A5-8E781D1AD585EE74 borgille@gmail.com Rob Gillen +250 https://www.google.com/accounts/o8/id?id=AItOawmDuljFuwxcZdJMNIkXNku062ImOI6-zbo https://www.google.com/accounts/o8/ud BF2E5227-A291-41F9-82D53581DC7244FE eagle.ciit@gmail.com Sami Akram +227 http://angel.net/~nic http://www.myopenid.com/server 03FE5243-92AA-4439-9F4F79FC51661111 \N \N \N +228 https://www.google.com/accounts/o8/id?id=AItOawmt8bigMHV4SqYYel8funA6SY6Cl2-PUTQ https://www.google.com/accounts/o8/ud 1577563E-93A8-4414-96E98550167CF441 jamathern@gmail.com Jason Mathern +229 https://www.google.com/accounts/o8/id?id=AItOawlh1iYX_cZ0pgId-_weIuarWKLr536urxA https://www.google.com/accounts/o8/ud 32C00D3E-9930-42FB-9E65CA1474AF8AF3 b4r4n0v@gmail.com \N \N +255 https://www.google.com/accounts/o8/id?id=AItOawmGG2P5nWEzESkZBSjH3En96pXNY8AcdqY https://www.google.com/accounts/o8/ud 761FB42B-3320-4676-8291A60D6D776B02 daniel.leavitt@gmail.com Daniel Leavitt +224 http://luisfalcon.myopenid.com/ http://www.myopenid.com/server 51E4D268-AE83-4645-A22476C39976A140 \N \N \N +232 https://www.google.com/accounts/o8/id?id=AItOawk89OzJZ1cYkOnQeOEhoSluLFx3V1ZXu10 https://www.google.com/accounts/o8/ud DCD696D7-2644-48DE-88623301725E3914 rojmaate@googlemail.com \N \N +256 https://www.google.com/accounts/o8/id?id=AItOawnqVDxR1D_RosSj3lUs44l_8J4cMQPKtNo https://www.google.com/accounts/o8/ud 6D2DDB05-83D0-4648-84588D20DCA6CBE0 bmtp50123@gmail.com Budhi Mtp +231 https://www.google.com/accounts/o8/id?id=AItOawlgfugW5gT3XemN-D-cuLUmAHc9fyKIaZ0 https://www.google.com/accounts/o8/ud 39209E45-D02A-4F2E-BACF564715047BF7 phantom42@gmail.com Joe Coleman +234 https://www.google.com/accounts/o8/id?id=AItOawkzru-VdK5pX-k4JOMlMeGCovVw9Jn25sc https://www.google.com/accounts/o8/ud 20103F43-6C86-4117-BBDA3D03DB76CEA1 rathi.sanjay4861@gmail.com Sanjay Rathi +235 https://www.google.com/accounts/o8/id?id=AItOawlBHbgK1QDgLmPgXJU4dblTkr05yFy3gug https://www.google.com/accounts/o8/ud ACE9FBE5-1DC8-4AC4-A1045E01DA4D7C18 jwhaley58@gmail.com Justin Whaley +236 https://www.google.com/accounts/o8/id?id=AItOawkhomAJDAycVV3rhPfU1_UUpBIGpKCkwj8 https://www.google.com/accounts/o8/ud FC9C1BF4-7234-4962-8F94D6A7A3F1C9AC ashwini2201@gmail.com ashwini chaganty +237 https://me.yahoo.com/a/uWmqOWgNyvcPS0J3Y1P7opMR6w--#f6823 https://open.login.yahooapis.com/openid/op/auth 67457ADD-C1CA-4F64-A9621AA8D55690F5 qc2211@yahoo.com \N \N +238 https://www.google.com/accounts/o8/id?id=AItOawnVStEbl8o3PCe-faTPAjSHpXabGQLwszI https://www.google.com/accounts/o8/ud 9B6AE928-C937-45EB-8E9364330AEAA620 aabeyta17@gmail.com Anthony Abeyta +239 https://www.google.com/accounts/o8/id?id=AItOawlyrhvVMlfelqDu88e-ajTo3zB54i-JInI https://www.google.com/accounts/o8/ud C1D7C875-5044-4490-B91FF0D67B950C14 straube.adam@gmail.com adam straube +240 https://www.google.com/accounts/o8/id?id=AItOawkcVSEseZXh_avvWS0aA7C8GnrNCA22yeA https://www.google.com/accounts/o8/ud 507AFFDD-3C47-4F50-8B2ABE54915AB005 tommy.odell@gmail.com Tommy O'Dell +241 https://www.google.com/accounts/o8/id?id=AItOawmekBZi5PY_R3Ay6KPw1H0RQ6ux8R-srDM https://www.google.com/accounts/o8/ud 0FC6EABE-D60D-4096-A5B9BA36FB840EC9 silviuciprian@gmail.com Silviu Ciprian Ionescu +225 http://24ma13wg.myopenid.com/ http://www.myopenid.com/server 7C04DB8E-6447-4EAD-817EEEAA90D1729D \N \N \N +242 https://www.google.com/accounts/o8/id?id=AItOawl7MXT-DJ55LSmRK9IY6a4jRrgVU6SfSII https://www.google.com/accounts/o8/ud 6644E3D7-08A3-4C09-8BDFD968FE8BEE55 pmwoodcock@gmail.com Patrick Woodcock +243 https://www.google.com/accounts/o8/id?id=AItOawkFgml8up8rqUBO0j3zZJlO-TWiriwkzA0 https://www.google.com/accounts/o8/ud 13B84393-BA84-4955-B07ACABAA6344D72 kutsoff@gmail.com Алексей Куцов +244 http://briandurham.myopenid.com/ http://www.myopenid.com/server 3D96E664-829A-4034-9C3732600D1E820C \N \N \N +245 https://www.google.com/accounts/o8/id?id=AItOawnzvDxAnF_zkl3Hgz_iNtGF7isrJHWMRo4 https://www.google.com/accounts/o8/ud 6DA07157-4A82-498F-953D643F985A2D63 namdq.nu@gmail.com Nam Dau +246 http://aluna.myopenid.com/ http://www.myopenid.com/server 5AA52DFE-4175-4A45-AFDE82BA19907374 \N \N \N +247 https://www.google.com/accounts/o8/id?id=AItOawn1nACylQImWx5ITwjQIXKEFZwvl09kHvE https://www.google.com/accounts/o8/ud 95B77943-5940-4EA6-8EC28EAE2A46868D eolowo@sulusoft.com Emmanuel Olowosulu +248 https://www.google.com/accounts/o8/id?id=AItOawktSukGAI1BrDDOeluPa0ktXEfAHxTGGMg https://www.google.com/accounts/o8/ud 793A5D14-27C1-4AFD-93996B50E4ACF3AE anand.phadke@gmail.com Anand Phadke +249 https://www.google.com/accounts/o8/id?id=AItOawltP8I48TfNQeL2Q6tVkxChz5aOnFpHIdg https://www.google.com/accounts/o8/ud 0CE9A7C3-B15A-44AA-83C76D708E9411AB tom@chantlersolutions.com Tom Chantler +251 https://www.google.com/accounts/o8/id?id=AItOawlwfg47JWmC4l9ezOZIIsUGA0mPTXmx4Yc https://www.google.com/accounts/o8/ud 22E53CBF-1C8D-4B4E-8A30692A6793F1E8 dmitrii.shevchenko@gmail.com Dmytro Shevchenko +252 https://me.yahoo.com/a/PGisBWdznIBq6t25yqq0SJmDGGiL#292b3 https://open.login.yahooapis.com/openid/op/auth AEB48931-F8A7-4BF0-8EB0B3D753F46599 ebolavih@yahoo.es \N \N +253 https://www.google.com/accounts/o8/id?id=AItOawnKiVUZf9MuigIOsqzPNLjtoP6ZN0-_HYA https://www.google.com/accounts/o8/ud 099BD98E-7C1A-461F-AB3447BA4CA9E213 downwind@gmail.com Joachim Isaksson +254 https://www.google.com/accounts/o8/id?id=AItOawlk25sV7QvqcLDqN6BGWmH_J2hWi5A-lCQ https://www.google.com/accounts/o8/ud 95DF47D9-170A-4D28-AC19A1F84C195CD0 onyaktechsales@gmail.com Chris Onyak +257 https://www.google.com/accounts/o8/id?id=AItOawnwxTioc6LqIRnQdZ12jfhqGCa11sm3MAI https://www.google.com/accounts/o8/ud C5BB0FB0-95A1-4999-98DB9E68A0D707B7 ankurmit2006@gmail.com Ankur Mittal +258 http://dannyar555.myopenid.com/ http://www.myopenid.com/server D8BBB82D-7137-415B-8A2F1D08F8A5E1E1 \N \N \N +259 https://www.google.com/accounts/o8/id?id=AItOawnyv1T8Gf2a3-VPwUgPZCYQFur0sdRptXw https://www.google.com/accounts/o8/ud 56BE304F-4C9C-436F-AA675E10E48C0797 juergen.hollfelder@gmail.com Juergen Hollfelder +261 https://www.google.com/accounts/o8/id?id=AItOawnMQGYzYPje30W9jGWRVL697fsnSwDZVPQ https://www.google.com/accounts/o8/ud 3A1BFF80-CEF5-4A88-907B634121B38A08 chandimamk@gmail.com Chandima Kalansooriya +262 https://www.google.com/accounts/o8/id?id=AItOawlk-sn3wtu4hmaGzSOhYBc9DrF2MlLz058 https://www.google.com/accounts/o8/ud 9C8242ED-60BD-4D8E-B72B5A13B0CA3535 ray023@gmail.com Ray Nowell +263 https://me.yahoo.com/a/UOTyt1cO3oEZ4.jfotYYda.984c-#fe2f3 https://open.login.yahooapis.com/openid/op/auth A8E2C4B1-0446-4D6F-A3C7CF0476645849 hpdcebu@yahoo.com \N \N +264 https://www.google.com/accounts/o8/id?id=AItOawkJXN6ReP4R_eIpucb3NRok9eQ3tkL5dlk https://www.google.com/accounts/o8/ud 01B0B9A1-44E4-4B93-B640323BB055D115 pramendra@gmail.com Pramendra Gupta +265 http://mehdilotfi.myopenid.com/ http://www.myopenid.com/server 65F41A45-86F6-427B-B3CA7FAC7598CEDA \N \N \N +230 https://me.yahoo.com/a/_UsmdF9il82lVMlzdV7J5vur.ydT4W8-#2a81d https://open.login.yahooapis.com/openid/op/auth 31FACEDC-74B1-42BB-93841DDB25477DDA toseevivek@yahoo.co.in \N \N +266 https://www.google.com/accounts/o8/id?id=AItOawkg-hSt-rfT7E0fvzD--RqHfHoxYq8m9tY https://www.google.com/accounts/o8/ud BB1544DA-2307-4B2A-AEB41B4CB19B3CDB rich.bradshaw@gmail.com Rich Bradshaw +267 https://www.google.com/accounts/o8/id?id=AItOawk1Bknr8_0yNIictaql60zOUWhekgjHTlg https://www.google.com/accounts/o8/ud C44C74EE-2F9D-4B30-82B0ED50F575E507 bondythegreat@gmail.com bondy the great +268 https://www.google.com/accounts/o8/id?id=AItOawl3PP-544xpcSm5xj1kkI0l-OooeXGS7AQ https://www.google.com/accounts/o8/ud 1D2CE6EB-770C-4A82-BC65EFB447D5367C horriblehero@gmail.com Muthu kumar +269 https://www.google.com/accounts/o8/id?id=AItOawnovWZeern5qUVscH1jGlXmHsQXptn1LIA https://www.google.com/accounts/o8/ud 6F9BE5A6-016A-46BC-B3B9255B3A75EE4E turalsemail@gmail.com Tural Teyyuboglu +273 https://www.google.com/accounts/o8/id?id=AItOawnRXBDokS1WJ4lcHCTZl7Eh2KtPv9AudlI https://www.google.com/accounts/o8/ud E63B6292-8903-4DC6-81C6CF24B251E53D prasadniharika22@gmail.com Niharika Prasad +288 https://www.google.com/accounts/o8/id?id=AItOawljcCTEUfSULG9nD0-hJgTPZeqsIkpoNzA https://www.google.com/accounts/o8/ud B853D754-FC77-483C-A1FC6B5A567D633F emanuel.feruzi@hub26.com Emanuel Feruzi +272 http://mcafeemra.myopenid.com/ http://www.myopenid.com/server 0A67F171-5EE7-4A04-BD8FDA6188EA9826 \N \N \N +289 https://www.google.com/accounts/o8/id?id=AItOawmr21cR2rTYs_7a1LY4QebZMrv912kvHiw https://www.google.com/accounts/o8/ud EF92FBA0-D195-4C6F-B47B4EE9357DBE91 spmaganti@gmail.com Sai Maganti +292 https://www.google.com/accounts/o8/id?id=AItOawl3uisX-L-94cPFfKr0M-ia41Xt5SbYMDQ https://www.google.com/accounts/o8/ud C0B075B9-5E15-4056-96E7CA66F71B2982 epool862@gmail.com Ahmad Saiful Bahri Mat Amin +271 https://www.google.com/accounts/o8/id?id=AItOawljcG_bBiC55mUiDxC9JlbgoVukZ3F73pg https://www.google.com/accounts/o8/ud 17FC1CBA-FEA2-499E-B0A32B38DF25EEA9 ravimistryof180@gmail.com Ravi Mistry +274 https://www.google.com/accounts/o8/id?id=AItOawkCzdPyVx0gZiE-ZYoiEy1xZnVFhmtNlJc https://www.google.com/accounts/o8/ud 0D45FA28-686D-4F91-BB7A38947EFC74E8 rfusca@gmail.com Chris Spotts +275 https://www.google.com/accounts/o8/id?id=AItOawnhyqW0JkXnS4Jo7s0iY6D9WX1FpMWo9SY https://www.google.com/accounts/o8/ud 56A4CB55-DD57-46F0-AEDF07C566470986 luish.faria@gmail.com Luís Henrique Faria +276 https://me.yahoo.com/a/1NhmrdoorJIp92p7vsmQuj9LwKsDP7cNSg--#3ec1a https://open.login.yahooapis.com/openid/op/auth 0F02DEB0-2CC1-4A2B-BBFB15860E6D1943 mail2nil_123@yahoo.co.in \N \N +277 https://www.google.com/accounts/o8/id?id=AItOawkK8T37A9ayqf1C50XzjZlgiGPgT2x8HvM https://www.google.com/accounts/o8/ud 4A7C7BDE-9E6B-4B7A-9A1FAAA641BCCE39 philip.zeyliger@gmail.com philip zeyliger +278 http://www.google.com/profiles/10manju https://www.google.com/accounts/o8/ud?source=profiles C24F7AA4-5AFB-4922-917A4C8491C1D6D8 10manju@gmail.com Manjunath b +280 https://www.google.com/accounts/o8/id?id=AItOawk3dQpx8Yc5q2bgCEEcM9OStLbq7f4FUnI https://www.google.com/accounts/o8/ud 34D3CF7E-3CDE-48F3-8E6136DFB606A5A1 rhushikesh.naik50@gmail.com rhushikesh naik +281 https://www.google.com/accounts/o8/id?id=AItOawlWt8MNLaIlbNOdJBRQVgzxS9nwdrftuGE https://www.google.com/accounts/o8/ud CDD2A747-788E-45B7-88279D6BD9C86EBA libfolder@gmail.com Lib Folder +282 https://www.google.com/accounts/o8/id?id=AItOawkElJ3dTT0lN5NFzGoQ4if__C47302ns48 https://www.google.com/accounts/o8/ud E0451A04-52E9-49D8-A56B2B218F915409 ra102800@gmail.com Rodney Adams +283 https://www.google.com/accounts/o8/id?id=AItOawngAfzN5ewNIdxP5uvgRHGJJbPJ6rJHBbA https://www.google.com/accounts/o8/ud 16E8F690-9B1D-4102-B5741CBC84BD5D4C bitwiseman@gmail.com Liam Newman +284 https://www.google.com/accounts/o8/id?id=AItOawmt73qn5j_wZqD1T2J-v9rgKHjMhyHpyJc https://www.google.com/accounts/o8/ud 530AAB7A-CCF9-4F4B-8D01D39C3C09AA06 jesse.r.mejia@gmail.com Jesse Mejia +285 https://www.google.com/accounts/o8/id?id=AItOawnSaZQDkz3eUWbCw1-DLLUCNcZM4h_iCZ4 https://www.google.com/accounts/o8/ud C387AC26-5FF4-453B-A80BDFFC0817BC36 robertkaucher@gmail.com Robert Kaucher +286 https://www.google.com/accounts/o8/id?id=AItOawk1a6nF9lNVqCFhG0D6_jIwkJ7TBPVLdzg https://www.google.com/accounts/o8/ud F2851A32-C3A5-463A-99B7A843C61E72D6 juergen.aschenbrenner@gmail.com Juergen Aschenbrenner +287 https://me.yahoo.com/a/zQgImokUwfaNgKuzcVKrooAZ1q_OYS.B037JTZOztVcUCm27Gg--#0a1fe https://open.login.yahooapis.com/openid/op/auth 0483F97D-9A0C-4216-98EC9934E32F4E8A sintu1thinking@ymail.com \N \N +260 https://www.google.com/accounts/o8/id?id=AItOawnjw-1Vfy0N5CSkQjOyDpoONlFMWtG0R6Y https://www.google.com/accounts/o8/ud 32DFDB53-2F2A-46B3-A8B84CEAA1FFC886 scorpian140907@gmail.com shashi shekhar +290 https://www.google.com/accounts/o8/id?id=AItOawkcTPLbSX4Eo6xo0maU4n7nGSRpS9UQPz4 https://www.google.com/accounts/o8/ud 6C99B87F-AB65-4DAA-8C64F708BEC549D1 martin.meridius@gmail.com Martin Lukeš +291 https://www.google.com/accounts/o8/id?id=AItOawn7RDPrzvqO8s6Ea8cFm4o7cD8X_U528lU https://www.google.com/accounts/o8/ud 69F5C922-40A9-45D4-AB454FEA27978DF1 prasadniharika22@gmail.com Niharika Prasad +295 https://me.yahoo.com/a/fntSmEUA3J8LVc6WUAViP1OIN7C1tSiaMYc-#c319b https://open.login.yahooapis.com/openid/op/auth 4515C4CD-9496-4614-AD364631157AC012 slowprocessor@yahoo.com \N \N +293 http://nirmeet.myopenid.com/ http://www.myopenid.com/server BA69CE56-846E-4408-BBCABA942D9A3204 \N \N \N +296 https://www.google.com/accounts/o8/id?id=AItOawmcMuyhMyWtb9P8C9OzkGUz6yNw6wbQ3KI https://www.google.com/accounts/o8/ud E277EEDF-BC4A-442A-A48BC129AA6245F1 asmuri.anwar@gmail.com Asmuri Anwar +297 https://www.google.com/accounts/o8/id?id=AItOawm-sCte6qCtR2okII8I1-YHkbHpg5lySrU https://www.google.com/accounts/o8/ud 7C72445E-F27E-4708-9E9389AA563E3639 himalaya.dua@gmail.com Himalaya Dua +298 https://www.google.com/accounts/o8/id?id=AItOawlXh2PEJZWtrdWu-eo6aDLtLX5sZG1Q-Us https://www.google.com/accounts/o8/ud 5E2EDE91-D204-471C-BA675C81B212B54C aidan.feldman@gmail.com Aidan Feldman +299 https://www.google.com/accounts/o8/id?id=AItOawnnejC8037w9JxKMek5_wvYZNNi2Is0iKY https://www.google.com/accounts/o8/ud 817EBE5A-E330-4563-8ED72095329F41A7 mchunn@gmail.com Michael Chunn +302 https://www.google.com/accounts/o8/id?id=AItOawlQHJSFPXjLBNz08O1a5UudfEpFQSeQWxU https://www.google.com/accounts/o8/ud E202A81D-6D85-4EE9-A9D376CC01EFACFC quijada.serrano.luis@gmail.com Luis Quijada Serrano +270 https://www.google.com/accounts/o8/id?id=AItOawltJOfcF-tX_hulDCqoZKeeot78vDcZ4_A https://www.google.com/accounts/o8/ud BC84BB76-6F33-4F95-BBB5716BE470E8FA amitisprince@gmail.com Amit Krishna Kumar Singh +300 https://www.google.com/accounts/o8/id?id=AItOawmBe751x5tXJKWVJKRiANf7wlKgiSHKJmA https://www.google.com/accounts/o8/ud 3750E377-5AF0-4673-A9B836B3727FDFAD jarnebeutnagel@gmail.com Jarne W. Beutnagel +301 https://me.yahoo.com/a/YexJ53swrZ3MvKMvnVgh4EY8IhaQD40oIeTxnkV_5w--#d5837 https://open.login.yahooapis.com/openid/op/auth 0BB9C826-7075-4F01-8FA5DF8974EBA3BA capacitor.resistor@yahoo.com \N \N +303 https://www.google.com/accounts/o8/id?id=AItOawmNhqDyapJfwe5jvHFBgckZlXwsoxf5J4o https://www.google.com/accounts/o8/ud 32A11F3B-CF13-4A8C-832F0750D22B6653 isdartur@gmail.com Артур Гальма +304 https://www.google.com/accounts/o8/id?id=AItOawlr3JS52GFdczyk3RLoPFsc8UYS-wd4ISk https://www.google.com/accounts/o8/ud 686D6AE9-C69E-4B12-968BF2D010832CCF itimeheke@hot.ee Kristian Heljas +305 https://www.google.com/accounts/o8/id?id=AItOawmx-Z8Z6dBa1vtUCklQ3OWGTtaA68Agoj4 https://www.google.com/accounts/o8/ud AB0A736A-AAEE-4CEA-862C1BFB0A68071E andreu.alcon@gmail.com Andreu Alcón +306 http://anthony.derobert.net/ http://www.myopenid.com/server BF8C08FE-59EE-431A-8DBDECEBD78E359D \N \N \N +307 https://www.google.com/accounts/o8/id?id=AItOawlzf13ZgsdTcfvsnbG12iGf0jUAdf_--qA https://www.google.com/accounts/o8/ud B8BEEBEA-4113-4A09-BDB21515CD278FBA naftalilubin@gmail.com Naftali Lubin +308 https://www.google.com/accounts/o8/id?id=AItOawm9qoJD2pfHGZGMvXMWDAJOnsPHVt0QdoE https://www.google.com/accounts/o8/ud CC4FACEC-D7B0-46A2-87DDDB5D00A83465 carvajaldiazeduar@gmail.com Eduar Carvajal +309 https://www.google.com/accounts/o8/id?id=AItOawnIZtsGPqNC3gqPeX0SEwEW0dqrMyxrwZU https://www.google.com/accounts/o8/ud 31A82C66-1287-4FC8-BB289F97AAA5F1C5 mangeshnaiknaware@gmail.com Mangesh Naiknaware +311 https://www.google.com/accounts/o8/id?id=AItOawm_o30lRWIshfBI9uikzw9nP-lxPVfRYFA https://www.google.com/accounts/o8/ud F38E9B90-A97F-4D0A-B5C81F8B8D828821 cuan.alan.thompson@gmail.com Cuan Thompson +312 https://www.google.com/accounts/o8/id?id=AItOawlsPUXX7ZGOctNdYL13tP55ZH_hBi2sJ64 https://www.google.com/accounts/o8/ud 3AC5D5B8-73B1-47E4-A8DE60D173998FD2 joey@thehomestarmy.com Joey Smith +313 https://www.google.com/accounts/o8/id?id=AItOawmUjvR8tGw51qY-x_t091CZIyAUVy4atTc https://www.google.com/accounts/o8/ud A96E291D-A7E5-44DC-8CC6E36808E17B57 mangeshn25@gmail.com Mangesh Naiknaware +314 https://www.google.com/accounts/o8/id?id=AItOawnhHo93MzYfuAdmOnuKo_sCSud0ms9AzZA https://www.google.com/accounts/o8/ud 1BDAC204-B735-48E1-AF58B35503D9BD62 prajapatineha17@gmail.com Neha Prajapati +315 https://www.google.com/accounts/o8/id?id=AItOawlDuvqiuwZTQYm4Q09FXnEM2cwog4oAKAY https://www.google.com/accounts/o8/ud 5ED66415-43A3-4ABD-8A30C9F479C48BFD sumskyi@gmail.com Владислав Сумский +317 https://www.google.com/accounts/o8/id?id=AItOawlf-nURF3dIi3lxeQyasDCl0iCTqWD1SCU https://www.google.com/accounts/o8/ud B7306747-599F-4806-96B24C2CEADA66A3 admin@ba-cafe.com שי מרגוליס +318 https://www.google.com/accounts/o8/id?id=AItOawnBnjMaN525oK92WiiX-RYJR41BKDq76j4 https://www.google.com/accounts/o8/ud 6BCD7DB0-9E98-44BE-97CC47E2F4C5FBEA sintu1thinking@gmail.com Sintu Roy +319 https://www.google.com/accounts/o8/id?id=AItOawlX33-8ereDtCynBGubQEBUrCeVF76-pLA https://www.google.com/accounts/o8/ud 1C5D2EF8-703F-4B71-BF2F279202329CE9 adam@kikoo.co.uk Adam Hodgson +320 http://ambekar-neha21.myopenid.com/ http://www.myopenid.com/server 139776B9-A3DD-499D-861ECCF46C9EF99B \N \N \N +321 http://krithish.myopenid.com/ http://www.myopenid.com/server E5D17501-B50F-4E76-82EAFFCEC4A6F0C0 \N \N \N +322 https://www.google.com/accounts/o8/id?id=AItOawkaNLuh8Rrvze-P3Q_gkeifVONyBoWeiqY https://www.google.com/accounts/o8/ud ED64F75F-6B7B-453C-8D45C160667CF622 v1dnoe@mail.ru \N \N +310 https://www.google.com/accounts/o8/id?id=AItOawmaov6H7lHleaciKNduoOHLwD9MMzQli_M https://www.google.com/accounts/o8/ud F7DC568C-6772-4E29-9202EA9CC977DC71 ashwinv09@gmail.com Ashwin Venugopal +323 https://www.google.com/accounts/o8/id?id=AItOawkMggTJG5xETkmaeE9kTA0eG4EhL8FlZMs https://www.google.com/accounts/o8/ud A7660300-5143-47A0-82C5DA57C271E963 ferlegend@gmail.com luis Fernando +324 https://me.yahoo.com/a/12BNGkZ2goWpoQJJo3OiWrvmGkDuu4xYzw--#f74cd https://open.login.yahooapis.com/openid/op/auth E418C1AE-1B4C-467F-AC03C3C4B15D19B4 diegoreyes84@yahoo.com \N \N +325 https://www.google.com/accounts/o8/id?id=AItOawkoV1g_tEw04hOUauO2wY4Y1xyH2y1jElI https://www.google.com/accounts/o8/ud F252C8B3-5C5C-452E-98ED36DDE9DB76A8 javiermauricio.toledo@gmail.com Javier Mauricio Toledo +326 https://www.google.com/accounts/o8/id?id=AItOawl3qcbW8OX1CLMGR9xpe1WKzEWyJxX_kf0 https://www.google.com/accounts/o8/ud ACC8A198-5325-4240-A549E6AE3E12A773 henry.alvarad007@gmail.com Henry Alvarado +327 https://www.google.com/accounts/o8/id?id=AItOawkZdgTKdfvz8lsVYRPUy0tEIylBpnodF3E https://www.google.com/accounts/o8/ud 9F4E1171-B912-4B67-9A4B22EEF9831EC1 rc.spitfire@gmail.com Raúl Coto +328 https://www.google.com/accounts/o8/id?id=AItOawmUqN0VeQktAGFRXJqQo861xsIxQN0iD5o https://www.google.com/accounts/o8/ud EBE59487-2F12-4E50-BF9540DB63D19DFE juanpineda1987@gmail.com juan pineda +329 https://www.google.com/accounts/o8/id?id=AItOawkOWYRiTqFxYO_wiB3efIHM-R4fcQiW0Mw https://www.google.com/accounts/o8/ud 71D1FA7A-3BBE-4D65-9D648A9C957BF6B0 markos8m28@gmail.com Marcos Marroquin +330 https://www.google.com/accounts/o8/id?id=AItOawmRaxAEhKQf7Auje2XpNu7_MxkYZXZqUPQ https://www.google.com/accounts/o8/ud 45BA0996-2C47-4087-B81BB8EFD4379948 yariperez23@gmail.com Yarina Pérez +331 https://www.google.com/accounts/o8/id?id=AItOawnTHPJJqj12MgjjgVRm2N3NXl-As2XTo4U https://www.google.com/accounts/o8/ud 117912F1-06CB-4AB4-AAFE838340D396AC vitoly1@gmail.com vitoly1 s +332 https://www.google.com/accounts/o8/id?id=AItOawnSSgufSJ6M_6kE1hcAqwRroJX-B9-K_54 https://www.google.com/accounts/o8/ud 81E8AD8D-316E-451D-B1092E1BA4A6884B arnoldogarciar@gmail.com Arnoldo Garcia +333 https://www.google.com/accounts/o8/id?id=AItOawnZ5su1gXAF1Qtqf53upVrR8zMzaFMrifY https://www.google.com/accounts/o8/ud 63577163-779D-4B00-8AF1D6111FEF8162 cleon@gisystemsint.com Cristian Agustini Leon +334 https://www.google.com/accounts/o8/id?id=AItOawnAfRhuQXFz__rmlWC1rX4mX4FxvsLmHRU https://www.google.com/accounts/o8/ud 3C33FF1E-2B89-46E6-A393CFCC2762CB18 konker87@gmail.com Juan Francisco +335 https://www.google.com/accounts/o8/id?id=AItOawktCN0gX0n1lxiinG1lAugU3eUiJIqC96c https://www.google.com/accounts/o8/ud A550AF2D-E5C6-4FF6-9B22C280196E57E6 henry.salvatierra@gmail.com Henry Salvatierra +336 https://www.google.com/accounts/o8/id?id=AItOawlhENRejh5gvkI5ZG8cXgQ6_lXwu-jpIoA https://www.google.com/accounts/o8/ud DA9DE97D-448B-4458-839C8501FC7F6337 jonathan.diazr@gmail.com Jonathan Diaz +6 https://www.google.com/accounts/o8/id?id=AItOawkZL7SBwnHxW6UQl8OothYM3dElmuqhpEM https://www.google.com/accounts/o8/ud 36F1B7DC-B44D-407F-9A41F39CB4DEE613 ypercube@gmail.com Yper Cube +337 https://www.google.com/accounts/o8/id?id=AItOawkdhHJrgG151GDmj-opfLqoyskWRPYrorg https://www.google.com/accounts/o8/ud 2A13F38C-674F-4E3B-A1114192B5C67E41 joshwap@gmail.com Jorge Solis +338 https://me.yahoo.com/a/twwm63F.35WS1QowH4J_0rXyg7..#84940 https://open.login.yahooapis.com/openid/op/auth E260A270-3B3B-4D10-B9F986B0CEE3AA4D nuevo654@yahoo.com \N \N +355 https://www.google.com/accounts/o8/id?id=AItOawljm720NHUyqTb2r5KR0g5XNLD6HtRLn18 https://www.google.com/accounts/o8/ud 66C65E5A-6A47-4912-B554B86455FEF876 carlomagnor@gmail.com Carlo Regalado +294 https://www.google.com/accounts/o8/id?id=AItOawkN9cFgK9rW7xLcT9DLCuQFZkGTCrJlqkM https://www.google.com/accounts/o8/ud CB7C0700-8FA5-472C-9ECAF34095E409CE tsankarasubramanian@gmail.com Sankara Subramanian +358 https://www.google.com/accounts/o8/id?id=AItOawmhSoyCy98hhk-oG60yiqgT8u_F1ts77TI https://www.google.com/accounts/o8/ud 4A22AA44-A3D5-40FA-BFBB50F71DAEB15F mybrainz@gmail.com Gwang Min Kim +359 https://www.google.com/accounts/o8/id?id=AItOawkY4B0lDi9NYrDeiOMGWUysvAeMf8_LU2c https://www.google.com/accounts/o8/ud 25D41E5F-EDB4-4E4C-B0DDBFC675015D19 tovhanu@gmail.com Sailadhirajendranath Kayal +360 https://www.google.com/accounts/o8/id?id=AItOawnsS9hYJMVzVEIl8HLjgl0pqHiEZhiuMd8 https://www.google.com/accounts/o8/ud AE1420AA-3299-47DF-935531E96812A728 travis.gant@gmail.com Travis Gant +339 https://www.google.com/accounts/o8/id?id=AItOawmkjKpUbdbTe-mZ9CGN2fB-31fm8e-gAO8 https://www.google.com/accounts/o8/ud E2469F9A-6812-4980-969C3519F2AA10E0 principiantesdomingo@gmail.com principiantes domingo +340 https://www.google.com/accounts/o8/id?id=AItOawkM52sKbEf_VcXIFbwqJvTGpR3tKG3TkyQ https://www.google.com/accounts/o8/ud 9708C2C0-B532-4B78-9E7C8BB476C04B21 sendycrisostomo@hotmail.com \N \N +341 https://www.google.com/accounts/o8/id?id=AItOawlyEjZOGVeQy6PHHHG9_Xg7QbeZF1Dd0ck https://www.google.com/accounts/o8/ud 0B4A7E48-C79B-4F47-AE5AF24FDA6B642C bselvan@gmail.com burak selvan +342 https://www.google.com/accounts/o8/id?id=AItOawk38_vX6IX_zTK0jKoXBGCiFdcdF9pzGUQ https://www.google.com/accounts/o8/ud BA29FAAA-D8E6-4C80-B0CF463FC78DEA65 r.nivas@gmail.com Nivas R +343 https://www.google.com/accounts/o8/id?id=AItOawnrzctTgfIaO1nHVZp10Y0gdLHfEkGvrIM https://www.google.com/accounts/o8/ud 5BDD26B9-A221-4FF7-ACA0980779C4722C jfmr17@gmail.com Fernando Merida +346 https://www.google.com/accounts/o8/id?id=AItOawmY0WQdqBaFF20CRR04MSDNVvWuAUgEKQs https://www.google.com/accounts/o8/ud 69CDAAE5-1245-462F-BBCD0E3556C9A24C rsmailkutusu@gmail.com Recep SELLİ +366 https://www.google.com/accounts/o8/id?id=AItOawkLzE0hU0Eey_-gc9zNoGEReckBZMzuMUI https://www.google.com/accounts/o8/ud 3F8C3751-57F7-47D9-B17F2038AEA431B4 johannesraja@gmail.com johannes rara +356 http://matthewlarge.myopenid.com/ http://www.myopenid.com/server 9E92B096-24C7-4EDA-96A2E51427AC7D85 \N \N \N +348 https://www.google.com/accounts/o8/id?id=AItOawnRscwHvfUkIylSEqjZ3NgJb733NGl-hcU https://www.google.com/accounts/o8/ud E4731289-D724-49B9-BDA3F216D3680077 jdwoo@qintara.com John Dangcalan Woo +345 https://www.google.com/accounts/o8/id?id=AItOawmmxwjtXQx9dbjSAeXVesA27TOR85CqpxU https://www.google.com/accounts/o8/ud A98370CB-96F9-4EB9-AA611E4CCB6CB244 johntotetwoo@gmail.com John Woo +349 https://www.google.com/accounts/o8/id?id=AItOawnjM-iZFKYX8H7_78iVpcK4AtWZ_i3xFpE https://www.google.com/accounts/o8/ud E60D8986-F781-44BA-BB02F9792E5344AC thomas@gielfeldt.com Thomas Gielfeldt +350 https://www.google.com/accounts/o8/id?id=AItOawnfAO5JKPeyl7riPUEh326kQi3MTosqD-Q https://www.google.com/accounts/o8/ud 2E9244F6-ED7E-45D3-AE942B8C38D8513C nicholaskrasnov@gmail.com Nikolay Krasnov +351 http://ruslansagitov.livejournal.com/ http://www.livejournal.com/openid/server.bml 7A458820-6091-4C70-BA6682BD0644B7BF \N \N \N +218 https://www.google.com/accounts/o8/id?id=AItOawkwgoGwG5XKYKXBwU32f9xeTn5GqLCvFvw https://www.google.com/accounts/o8/ud 58889A88-71F2-4119-AA31A83C07FC7A77 peretta3x@gmail.com Rafael Peretta +352 https://www.google.com/accounts/o8/id?id=AItOawkF2knt8MjTGKQjzDg0R3TCwR2vnunbI0c https://www.google.com/accounts/o8/ud FD340D01-97AD-4F59-8ACC198F75987AD9 daniel.james.nd@gmail.com Daniel Noel-Davies +353 http://kashkns.myopenid.com/ http://www.myopenid.com/server 336741D0-8EF0-41B8-9C219B8418F59341 \N \N \N +354 https://www.google.com/accounts/o8/id?id=AItOawn44cS5DcgHGdj5OX19fdy0XIzj8GXES9Y https://www.google.com/accounts/o8/ud F929B386-5D8F-4A0F-A7A2A59805DDE04D josh.vankley@gmail.com Joshua Van Kley +361 http://ysridhar11.myopenid.com/ http://www.myopenid.com/server 678821EC-3C33-4797-A58353BD0F913EA1 \N \N \N +362 https://www.google.com/accounts/o8/id?id=AItOawlp1_bMn3WfIy6gdFnUzQyRJR4mfDvovuE https://www.google.com/accounts/o8/ud 73B52859-36D9-4CA2-8222961B0704DA06 joao.c.batista@gmail.com João Batista +363 https://www.google.com/accounts/o8/id?id=AItOawkamIcrnpaf94k1Pl8-yh85Mnnh2dwhIe8 https://www.google.com/accounts/o8/ud 37C0CAF7-6B83-4715-BE980725BCAA6560 nesrait@gmail.com Davide M. +364 https://me.yahoo.com/a/6Ff7d0ECqM4iLXuaf4DLwI6ybrsVCQ--#f67c2 https://open.login.yahooapis.com/openid/op/auth 9C10D8AE-DCA1-492A-A79366F148D2AD37 swapan_dr@yahoo.com \N \N +365 https://www.google.com/accounts/o8/id?id=AItOawk97VDsJ3YPrgqTCJ5rCOg58MHfXifw7NU https://www.google.com/accounts/o8/ud 4E409A72-2325-4842-A762DBE94B85C34F graimer@gmail.com The Graimer +367 https://www.google.com/accounts/o8/id?id=AItOawmq9o5l-JL6Ysd0rwiu91fXE8aH8Zpn0rI https://www.google.com/accounts/o8/ud E854260F-9114-4166-B044FA36241993A9 madhumitha.siva@gmail.com Madhumitha Sivaraman +368 https://www.google.com/accounts/o8/id?id=AItOawlxkEWwk9M-2YcQEb9T2RYeXq9oSED4hBY https://www.google.com/accounts/o8/ud 99E1E446-9998-496B-A5DDD8FE97E8A534 flpgdt@gmail.com Filippo Gadotti +369 https://www.google.com/accounts/o8/id?id=AItOawnpEledsLEcLkY-3WQHRTamdQHAK4VhrKM https://www.google.com/accounts/o8/ud 822A18C4-59C7-4E56-92109E0B40F5B27D geordee@gmail.com Geordee Naliyath +347 https://www.google.com/accounts/o8/id?id=AItOawkzxmYK3R03yF4Q9-JBP4mHEEsI8uf-w28 https://www.google.com/accounts/o8/ud CC1E05D2-5141-41C9-B59340548B7AC95A desanze@gmail.com Mariano Desanze +370 https://www.google.com/accounts/o8/id?id=AItOawmzH1FkbRptmyZ2iOimLSUpjj2pbSj_oUE https://www.google.com/accounts/o8/ud A91B0FDD-2F61-4BD7-AF5701A777871D5C eric@aquameta.com Eric Hanson +371 http://bignose.whitetree.org/ https://pip.verisignlabs.com/server 695563F8-94AB-48E9-A8F1C8AB5BB86CE7 \N \N \N +372 https://www.google.com/accounts/o8/id?id=AItOawn-6DC9VmCP74Dnxo-5G-F31SUUy2gDyNQ https://www.google.com/accounts/o8/ud EDF89789-5471-4E48-8E4A14D6BB383278 robertkaucher@gmail.com Robert Kaucher +374 https://www.google.com/accounts/o8/id?id=AItOawnrZVlQu-7XkMZNcKd_8tKx2Ygpc-q9y18 https://www.google.com/accounts/o8/ud A8D84318-FB60-460C-87F7D83266017D62 azhar@iarmar.com Ibrahim Azhar +375 https://www.google.com/accounts/o8/id?id=AItOawltmHt4cYy3lBjMsa8CXV6Yg_NMCwOqBew https://www.google.com/accounts/o8/ud 6F6052A8-F3A4-413C-9EC409A1318E7820 999arjun@gmail.com arjun cc +376 http://kengimel.myopenid.com/ http://www.myopenid.com/server 89110BF9-3B2E-49B1-8622CEDA71AA48DC \N \N \N +377 https://www.google.com/accounts/o8/id?id=AItOawm7NksogzgrAyss1Wbgapr6zfCGvPPu9AA https://www.google.com/accounts/o8/ud EEE99DCD-E413-497F-850B07C8FEB4EBD4 avinash007patil@gmail.com Avinash Patil +378 https://www.google.com/accounts/o8/id?id=AItOawnA7J9dZWWIfeicbPlxWBvFmb0FlLnDUko https://www.google.com/accounts/o8/ud 3CA7BF58-7232-4952-ACB3F535DD8BE392 avinashppatil87@gmail.com Avinash Patil +316 https://www.google.com/accounts/o8/id?id=AItOawmI-jVFGEcpIzrYr7oDwT8yUg9OdqjE77A https://www.google.com/accounts/o8/ud 19ED57C7-A233-45C7-8B424D1A0E89E340 mtucci25@gmail.com Michael Tucci +357 https://www.google.com/accounts/o8/id?id=AItOawnSlRwGapUJvLVGnOiXIiiDeHOtOGSbyu0 https://www.google.com/accounts/o8/ud ACEA1D31-0AEB-4E33-883B7951E41591D5 norbert.bous@gmail.com Norbert Bous +379 https://www.google.com/accounts/o8/id?id=AItOawmmQFE-GYywp7gVSwj5bJIYf6gN79BtSHQ https://www.google.com/accounts/o8/ud E6A51FBD-1713-4069-88D3F4C5363F5259 ron.nitzsche@gmail.com Ron Nitzsche +380 https://www.google.com/accounts/o8/id?id=AItOawlA4BQ-7I8zqo32RhJYZ8HpwUm4q-4u0sw https://www.google.com/accounts/o8/ud 3DCFB385-D7FB-4A1D-BEF73FBA71F3E82D jfeasel@gmail.com Jake Feasel +399 https://me.yahoo.com/a/PLYTHjM01d9sGVvOns54hM0kz1Xd0SY-#9fb13 https://open.login.yahooapis.com/openid/op/auth B40D2E56-9B10-4B2B-955B0FA8B1A0EADA pete_oakey@yahoo.com \N \N +373 https://www.google.com/accounts/o8/id?id=AItOawm-TbbJ2SWrQg3SF6paC4Zep5PW1n6HTCE https://www.google.com/accounts/o8/ud BE24E007-3E19-4706-BC507AE730A8EE85 dhreugh@gmail.com Jarne Beutnagel +381 https://www.google.com/accounts/o8/id?id=AItOawnUQ6ynXdsIDbOWieRDHxiVEERrmfvgbmo https://www.google.com/accounts/o8/ud 7484232D-465A-434C-BE5AC515FB6BE35E farnabaz@gmail.com Ahad Birang +383 https://www.google.com/accounts/o8/id?id=AItOawmxnl-UyVwZbyW36yTi5jBsnsCINg04ezE https://www.google.com/accounts/o8/ud 74A219B3-E159-490F-BC651AA3A3CFEB34 jwmnisi@gmail.com John Wisani +384 https://www.google.com/accounts/o8/id?id=AItOawlE-nhNO6RKC_JZ0wOujvgGAVAJRgs3ZNY https://www.google.com/accounts/o8/ud 9A877786-F8A4-46C8-B8250379BF91C090 ladelschikov@gmail.com Иван Ладельщиков +385 https://www.google.com/accounts/o8/id?id=AItOawmjHUBv3qn-9IH-DT7r7cPgYC7Lxu5x5nQ https://www.google.com/accounts/o8/ud 8550F52A-0F39-4D11-B5095CBC4B1310FD pmatuszewski999@gmail.com Paweł Matuszewski +386 https://www.google.com/accounts/o8/id?id=AItOawmKPR9ojK-oeUylVAxZhiVSU-ovamb6YnU https://www.google.com/accounts/o8/ud 576C50B8-9998-4B09-A7BCD4299861680A savef5@gmail.com Пётр Ермаков +387 https://www.google.com/accounts/o8/id?id=AItOawkavCTkr_0CqPWw4S2mkNISTovLgVmfCe0 https://www.google.com/accounts/o8/ud BFE56DB5-7623-408E-85CC46B72FCE80FF insside@gmail.com Тіма Маслюченко +389 https://www.google.com/accounts/o8/id?id=AItOawmvip-mUUeoz_77D74yhNLtyE6N9LJE9bg https://www.google.com/accounts/o8/ud C5630947-6279-45D6-BD6F53CF6B4C51AC danielciulinaru@gmail.com Daniel Ciulinaru +390 https://www.google.com/accounts/o8/id?id=AItOawm5QpFTq54pmKXWDz4qGAINxeLp70fENEA https://www.google.com/accounts/o8/ud 3EF3D455-1182-413B-9A20B50E132B4F67 johnyu2@gmail.com John Yu +391 https://www.google.com/accounts/o8/id?id=AItOawliR_3r9UFEyzw3f2epOoslji6pfaigf6A https://www.google.com/accounts/o8/ud 7690F158-1757-4250-91929B0EC1778C34 jimmymj@gmail.com Jimmy Jose +392 https://www.google.com/accounts/o8/id?id=AItOawkNGFIwvBk1vy67A2jh8KXk9MZ3VKzZTyM https://www.google.com/accounts/o8/ud AA28928A-5602-48EB-841843EC4BE022F9 gaurav.varshikar@gmail.com Gaurav Varshikar +388 https://www.google.com/accounts/o8/id?id=AItOawlzFctQ-VftmYI-JmVlMMmu_08cdCVp-SA https://www.google.com/accounts/o8/ud 7BC19C33-BC9E-4DB6-B56F4DA01005592A srcnckr@gmail.com Sercan Çakır +394 https://www.google.com/accounts/o8/id?id=AItOawkpTxleitUGatGgs02BR-qLMhepCxDwV_M https://www.google.com/accounts/o8/ud 43F6FEE3-CCD1-44A3-B0650F7DD1D9131F jurg@skimlinks.com Jurg Schwalb +395 https://www.google.com/accounts/o8/id?id=AItOawk1cPNX37PSlRoVZEeOAmHLmt32eFn8I7w https://www.google.com/accounts/o8/ud BFE9A9BE-DF21-48BA-B73376A640820014 mikegrahamjones@gmail.com Michael Jones +396 https://www.google.com/accounts/o8/id?id=AItOawljuHU5JYXN-FRNfRzDm2GYGN6UUIaTQAg https://www.google.com/accounts/o8/ud A7B7DFD1-B692-44D5-8F374CEC383F0418 seraphimg2@gmail.com Sofiane Merah +397 https://www.google.com/accounts/o8/id?id=AItOawlrwc-meNBXC06imzkCrl_xng858Yv6Rdk https://www.google.com/accounts/o8/ud 277FA894-297E-41FC-914C2B341088C298 aj.piscitelli@gmail.com AJ Piscitelli +398 https://www.google.com/accounts/o8/id?id=AItOawnNrucVeQ2EXxk91_sdH4iDqI5a-sP1UFQ https://www.google.com/accounts/o8/ud 2333D861-D7B9-439B-91F6DAD427AB7096 jbunio@calliduscloud.com Jonathan Bunio +400 https://www.google.com/accounts/o8/id?id=AItOawkivyZLNc4w9Kho4gHVqLPqQ-a08PfQMc0 https://www.google.com/accounts/o8/ud A0ACB66E-6FAF-4050-8FB37EB1F1A296E7 fedmich@gmail.com Federico Garcia +401 https://www.google.com/accounts/o8/id?id=AItOawlLcJC6yispiTEIhUVHeIL3tjRR3vGPkxU https://www.google.com/accounts/o8/ud CD4E5BC7-C6C4-4F8B-B481A91E80FA4372 carlos.daniel.ff@gmail.com Carlos Daniel Flores Flores +402 https://www.google.com/accounts/o8/id?id=AItOawmsS4VBCcpgPknWH_MpZYOk1SZ3V5Wl8MQ https://www.google.com/accounts/o8/ud 53880C93-D494-4A43-9BD3F034FA7AC00E ravishroshan@gmail.com Ravish Roshan +403 https://www.google.com/accounts/o8/id?id=AItOawlhunsMWfQR5L7uz9e1NdUmsoU8B5h6pjE https://www.google.com/accounts/o8/ud 25F20329-5234-44BE-88692440EBA2E158 matija.lokar@gmail.com Matija Lokar +404 https://www.google.com/accounts/o8/id?id=AItOawl4-qxdWpk8osG8cdVQC2ifummdJSohl9k https://www.google.com/accounts/o8/ud C64F2607-EFE9-4DF4-9EE4E2FB85E86B00 mdmerveille@gmail.com mamoudou diallo +393 https://www.google.com/accounts/o8/id?id=AItOawm3sr_F8wTsMwhxlDIH4iBAELYUvfBr-DM https://www.google.com/accounts/o8/ud 212E5A04-31A7-4410-9A5CE96488C80481 quijada.serrano.luis@gmail.com Luis Quijada Serrano +406 https://www.google.com/accounts/o8/id?id=AItOawkIhulVkZMsnW9F6hZgkyg1L_TywIZ31lE https://www.google.com/accounts/o8/ud 13ECC59D-905D-4AB9-A9C570D9374505DD whatisthebigpicture@gmail.com Justin Davis +407 https://www.google.com/accounts/o8/id?id=AItOawkTEQ1AVEkSn2L2uQImG5kJJiRpciDxCnw https://www.google.com/accounts/o8/ud 85D72B02-91B8-4934-81532903EE3F9A3C kranti1618@gmail.com kranti kumar +409 https://www.google.com/accounts/o8/id?id=AItOawl_wu-WFLSnQSfa2NClmN0CBg6xQsSQpDg https://www.google.com/accounts/o8/ud 5FF7F1E9-A807-4CBE-86758C808ADD59D4 sagarjauhari@gmail.com Sagar Jauhari +410 https://www.google.com/accounts/o8/id?id=AItOawlWshKGoT-WRr8oNDBYwQ82B6ZAwfydQ8I https://www.google.com/accounts/o8/ud A6E6EC64-E0C8-4A81-B125C7917B092338 shashankshakehar@gmail.com Shashank Shekhar +411 https://www.google.com/accounts/o8/id?id=AItOawkQLnp7HSmsdVf6uAZ8H7cQVDcq6AeGBRU https://www.google.com/accounts/o8/ud 3CC4F0B0-0F24-46CC-86572B00F489335B nicholaskrasnov@gmail.com Nikolay Krasnov +412 https://me.yahoo.com/a/ab0Z13dsq91Ay_MsOftnhmHwNLVLbA--#41d88 https://open.login.yahooapis.com/openid/op/auth 67D1DC4F-5D7F-42B2-ADBF895E0257A488 sarumoina@yahoo.com \N \N +413 https://www.google.com/accounts/o8/id?id=AItOawkE1ULF3k6qO8an_YiNf8X7lE0Z3KZZivY https://www.google.com/accounts/o8/ud 1FE5B13D-57F2-4FB7-AD0AEC9D14ED4A6D kranti1618@gmail.com kranti kumar +415 https://www.google.com/accounts/o8/id?id=AItOawmsNGyvDU9rK_jE7jzA0TG4rHZsp8Dtd40 https://www.google.com/accounts/o8/ud 7F6D8CA2-4ADD-489F-BF5AE0B466F6534D jeroen.bolle@gmail.com Jeroen Bolle +416 https://www.google.com/accounts/o8/id?id=AItOawm4al0W-UoYsl1rUagqwgLRAZ_yJJpc1CU https://www.google.com/accounts/o8/ud 9C98C587-D2E4-4653-BFF627014DEE9CCD ksnboopa@gmail.com Sankar Boopathi Kanagavel +417 https://www.google.com/accounts/o8/id?id=AItOawkzLju6tFEn_9nZefisvrEBMINqhNbhc74 https://www.google.com/accounts/o8/ud 760C7A7B-0F7D-4214-B35F120B88CD554C shyamilikrishnan.vc@gmail.com Shyamili Krishnan +418 https://www.google.com/accounts/o8/id?id=AItOawmzdQ3qVbB0uDJKN6PBebmus6E5tYJib2I https://www.google.com/accounts/o8/ud 31D41917-6AB6-4E33-B2BBDBA48BD41766 rahul@hostnsoft.com Rahul Chordiya +419 https://launchpad.net/~atiruz https://login.launchpad.net/+openid 28BAB789-826F-4CC8-9446A6DC74A928B8 \N \N \N +420 https://www.google.com/accounts/o8/id?id=AItOawnF999Ba6VPKPnNqyUE70dBcrv_NBJRn7Q https://www.google.com/accounts/o8/ud 2BF611DA-0B53-4278-A4CB0AAAB84CB6BD maheshvarma.cse@gmail.com MAHESH VARMA +421 https://www.google.com/accounts/o8/id?id=AItOawnB_5iTQNn267ynsvch4bTpSxbEg7hygek https://www.google.com/accounts/o8/ud 1DC26CEB-ACB8-45C7-B6DF8DF9DBE9F4A4 drfznet@gmail.com Denys Rubén Flores Zuleta +422 https://www.google.com/accounts/o8/id?id=AItOawm1xTFh1ex4h1WTZvySiXcFlGmqPOuab0M https://www.google.com/accounts/o8/ud C6906496-2CD5-439A-96C9298EC47ECE17 billy.braga@gmail.com Billy Braga +108 https://www.google.com/accounts/o8/id?id=AItOawldnNUQoVQ8chuHM5v1h2rKaPwoGMztjbA https://www.google.com/accounts/o8/ud BBF4547B-90D3-48FB-AEF2C89A93EE04B8 whytheq@gmail.com jason quirk +423 https://www.google.com/accounts/o8/id?id=AItOawlAG1_lwshfz2vtZG_WaASLGIXRxMHFJsM https://www.google.com/accounts/o8/ud 82B2C0C4-AC2A-4579-8A93941DE40EE2A6 dan.bencik@gmail.com Daniel Benčík +425 https://www.google.com/accounts/o8/id?id=AItOawmr9f-DfO07toJThftHwb9FhCLLdrJZBgs https://www.google.com/accounts/o8/ud 2F3F90CF-6DE9-4B1E-A0D04E67FB7BF252 bharat7387@gmail.com Bharat Bhushan +426 https://www.google.com/accounts/o8/id?id=AItOawnNGEKbOQIBYBOFeE8LgiiOwXMkZZWbZOQ https://www.google.com/accounts/o8/ud DB234451-700E-42FE-A74C0FCC4A0E9F13 randcd@gmail.com Christopher Rand +427 https://www.google.com/accounts/o8/id?id=AItOawk_ii1V39Vvt2t61Hm4IZPmzlNtGJ6uNNI https://www.google.com/accounts/o8/ud 7126D443-6906-46D6-B9E3E8F6DE01BDE7 huzaim2006@gmail.com Ahamed Huzaim +21 https://www.google.com/accounts/o8/id?id=AItOawnYwn-ipDkopDmQvzc_npbR85pjjH_LgYQ https://www.google.com/accounts/o8/ud 6AADC40C-C502-4C7F-9ACC5EDD1B007AA5 tim.schmelter@gmail.com Tim Schmelter +428 https://www.google.com/accounts/o8/id?id=AItOawmZu_wLEBxAsjRxMAX2NpxP3lCQxm5feP8 https://www.google.com/accounts/o8/ud DFFACE6D-4F09-482B-A7D29E38EA666E32 mart7ini@gmail.com Mart Ini +408 https://www.google.com/accounts/o8/id?id=AItOawkRkNdRtFzX_sjBQ5WzM2hc5NvqGHhCL8s https://www.google.com/accounts/o8/ud E2226405-4611-4231-B5C2C00AC590E490 claudio.santos.ribeiro@gmail.com Cláudio Ribeiro +432 https://www.google.com/accounts/o8/id?id=AItOawmAepiSEIkJexJ7zw6wF9JK2I92LL2qeW0 https://www.google.com/accounts/o8/ud B4793460-356D-42C5-82451C0E59D761F1 brsaweda@gmail.com Erwin Brandstetter +429 https://www.google.com/accounts/o8/id?id=AItOawlDMGgtd88fdHubqM_7QJLlWbHk30zDjSU https://www.google.com/accounts/o8/ud BCF79B80-F313-456B-AB84E6AAB0F61092 clodoaldo.pinto@gmail.com Clodoaldo Pinto Neto +430 https://me.yahoo.com/jayfcox#71d45 https://open.login.yahooapis.com/openid/op/auth E4A53518-C168-4CFA-A3800E35744DF315 sqrtofone@yahoo.com \N \N +434 https://www.google.com/accounts/o8/id?id=AItOawmSn2QkD4bxioavgPaAZoN7VD1u6jbEvSE https://www.google.com/accounts/o8/ud 17E28D32-B29C-41DF-A9E30B1E650313B8 thuventhiran@gmail.com Thuventhiran Govender +435 https://www.google.com/accounts/o8/id?id=AItOawkaQH1gjy3jIyQrCQq4ifk0Wa_sa98UKBk https://www.google.com/accounts/o8/ud 7A79AEAA-44CF-47D4-A2EFBF1EE55A8256 razanasir.ali@gmail.com Raza Baloch +431 https://www.google.com/accounts/o8/id?id=AItOawmEZAOTi5NfGM6E4dcIzPvniZ3-xnnk1SM https://www.google.com/accounts/o8/ud 17ED18AB-E2E4-441F-BDDE227F97306298 daviestrachan@gmail.com Davie Strachan +436 https://www.google.com/accounts/o8/id?id=AItOawlxZ1PYbWYq0Kia5-CY0jyraw4SygTqqdE https://www.google.com/accounts/o8/ud 5595AFA3-86E3-447F-85697FAE314B7517 Umamaheswari.m@myc2s.com Uma Maheshwari +437 https://www.google.com/accounts/o8/id?id=AItOawlQ-FuZYWOw2ZfF0P0nFc0g8RDNFKAXh6A https://www.google.com/accounts/o8/ud CFE3E790-A9FD-4866-80B191E9E72C1A74 singh04vishal@gmail.com vishal singh +414 https://www.google.com/accounts/o8/id?id=AItOawnYubIafo6NHa9kA790Uqb6X-0tGjMa1LQ https://www.google.com/accounts/o8/ud 2BAE73E7-D166-41C9-A8D6DF658FCCBEF2 pavtaras@gmail.com Pasha Tarasenko +439 https://www.google.com/accounts/o8/id?id=AItOawmYg8X8iOHw7eYo4BisZpKEFCoVLMltVR8 https://www.google.com/accounts/o8/ud BBACCF46-2E8F-4D4C-917A00402FAE5322 aniket.raut9@gmail.com Aniket Raut +438 https://www.google.com/accounts/o8/id?id=AItOawldRuzuDhjG-AiQ5jtUh_k27vijGoDzRKI https://www.google.com/accounts/o8/ud 74637C0E-BA65-4D1C-921B110F139840B4 sylvain.abadie2099@gmail.com Sylvain Abadie +440 https://www.google.com/accounts/o8/id?id=AItOawnjXgvmFgs6-UhYH1-h7ZcwqVQxRmAZRk4 https://www.google.com/accounts/o8/ud 51F06804-ADE6-41D5-B70D915FA88A29B0 pinarpayza86@gmail.com pınar payza +441 https://www.google.com/accounts/o8/id?id=AItOawms9iPSAOEzyiNhm8JuPG2yvpBDT6ql6v4 https://www.google.com/accounts/o8/ud 911C52F9-2310-4514-9C7406A2CF90E4E3 cyberkiwi2010@gmail.com Cyber Kiwi +1 https://www.google.com/accounts/o8/id?id=AItOawlpCAsDY3QlzBREwY3Gr7AlX3wVMacsCBw https://www.google.com/accounts/o8/ud 6C05F510-406F-43FF-A8C237ECF55C705A jfeasel@gmail.com Jake Feasel +442 https://www.google.com/accounts/o8/id?id=AItOawk6FB-7yFzRkkS0GbGxUS--5aAhNJ-m_Vs https://www.google.com/accounts/o8/ud EA6B0989-4A3C-4C0E-8C823A039A6E9B18 younus.abcoder@gmail.com Younus Ali +443 http://birnenjoe.myopenid.com/ http://www.myopenid.com/server 704F0E84-5C89-448E-BE33015093C8184A \N \N \N +444 https://www.google.com/accounts/o8/id?id=AItOawmYuryjJRodzmd0RxEtFoOllJhoUGSM4Co https://www.google.com/accounts/o8/ud 31FAFB7F-5375-461C-8D6EE7341027CEF3 alexandre.krier@aswat-telecom.com Alexandre KRIER +445 https://www.google.com/accounts/o8/id?id=AItOawk7Uzq5Y8PsVvr5JAfcpB5atBWhRS-tEXc https://www.google.com/accounts/o8/ud 950EB879-683E-486F-9D24E394E952DD93 m@42.am Manfred Touron +424 https://www.google.com/accounts/o8/id?id=AItOawlxuprz81GZa7RW8FukZ8vjUKyvId775b0 https://www.google.com/accounts/o8/ud 19F58560-9BFF-42EE-808E97B88591ACEA barmar1961@gmail.com Barry Margolin +344 https://www.google.com/accounts/o8/id?id=AItOawmjNyk98hNbJN557cy7fVfWXBWlVv8i8Ik https://www.google.com/accounts/o8/ud DAC046C6-DA18-4C3F-AD31BF8E7580E289 justin.james.cannon@gmail.com Justin Cannon +433 https://www.google.com/accounts/o8/id?id=AItOawnCPFRq_RXSWFn4jsuiGUxzUOx8SMO8JT8 https://www.google.com/accounts/o8/ud 734DECEC-7732-4E61-84632F1E75BC0D06 webwilliams@gmail.com William Borba +279 https://www.google.com/accounts/o8/id?id=AItOawnlUr49CcCS1-uK-vJaxTH2s7bJ-Ic9P50 https://www.google.com/accounts/o8/ud 7DF2C1BD-C198-4CB7-B337FBF395D33168 10manju@gmail.com Manjunath b +446 https://www.google.com/accounts/o8/id?id=AItOawnxC_ne5gX0vJ-hzxip_OAxjKPm2Y3gmTQ https://www.google.com/accounts/o8/ud 210F073D-27B9-4AA7-9DF4DFE6BA520E44 joel.brown@mooseware.ca Joel Brown +447 https://www.google.com/accounts/o8/id?id=AItOawmrwa1YELa2Y5rJE7Zuj2JyePHYKaUpyjQ https://www.google.com/accounts/o8/ud 1A76AFC0-A9C9-4A4E-BEFAE54766E61DB9 rarkenin@gmail.com Robert Arkenin +448 http://sebasucedo.myopenid.com/ http://www.myopenid.com/server B1C373F8-1D85-4397-B6467D0C6F8EC038 \N \N \N +449 http://air4x.myopenid.com/ http://www.myopenid.com/server A4FFA273-2A2C-42ED-A411376A6BE89277 \N \N \N +450 https://www.google.com/accounts/o8/id?id=AItOawnJ1G0AuMES8G53BM0DTtcvHNg8jRs4nnk https://www.google.com/accounts/o8/ud CE823CC0-9514-4E07-9BB5D40AE40EC9E7 mgaseries@gmail.com Mahmoud Gamal +451 https://www.google.com/accounts/o8/id?id=AItOawko8SHzKNeNck8km43IToBV6IBwSszxd6w https://www.google.com/accounts/o8/ud B5576345-7192-4EDD-A4A908D3C428515D btray77@gmail.com Brad Traynham +452 https://www.google.com/accounts/o8/id?id=AItOawmeZt2KuFDqNsdHOHOcmZJ-7U3kok1Rbn8 https://www.google.com/accounts/o8/ud 416A6211-CC48-438C-9CAB76E2EC31CFFA johnnyvandeberg@gmail.com John Huntjens +453 https://www.google.com/accounts/o8/id?id=AItOawkuqsMdp9jE9XwMRENSUiYaYJqS6mV-3fc https://www.google.com/accounts/o8/ud 9E0F2B11-60C3-45FD-A080AD6DF0927C7E shalithaw@9696.lk shalitha weerakoon +454 https://www.google.com/accounts/o8/id?id=AItOawmb_nnMgsyQL0cframYE1ZhEF9h7fOL3ZM https://www.google.com/accounts/o8/ud AF5C68B4-E4DF-44DB-B73DC57DA8A2236F adam.vegh@gmail.com Adam Vegh +455 https://www.google.com/accounts/o8/id?id=AItOawk_hgzVDYhz-EcYdK2T6m2uwqZcTZfaCjo https://www.google.com/accounts/o8/ud 4521A80E-A2C9-4D3E-969B2EDB8AEF2DD5 shatrurox@gmail.com Shatrughn Gupta +456 https://www.google.com/accounts/o8/id?id=AItOawkFG3I1csjQX67_hQjpdfngMYBUhQeKsak https://www.google.com/accounts/o8/ud B4D76910-2EA2-446A-B019EBB1F1FECDF2 craig.scofield@gmail.com Craig Scofield +457 http://brutsoft.com/ http://brutsoft.com/simpleid/ 04EE61F1-5F37-43A5-B711F7FF158F39FA \N \N \N +458 https://www.google.com/accounts/o8/id?id=AItOawkbLjDTCNzzktXYOl4iT8n4kZrvbYLJfy8 https://www.google.com/accounts/o8/ud 6E53BCCA-412B-46FE-A8CEC20D06475B6F tonylovejava@gmail.com TonyQ Wang +382 https://www.google.com/accounts/o8/id?id=AItOawkWy0gX3HKGO61MKBw2d5q3xtdl5y_nmdA https://www.google.com/accounts/o8/ud D5639AC5-4ACD-4C50-88F080F1F2FF0CC6 anu.nadar013@gmail.com Anusha Nadar +459 https://www.google.com/accounts/o8/id?id=AItOawmbpJeGTPVN46PvISFL414LSMFQnoprFds https://www.google.com/accounts/o8/ud 4703BEE0-526E-4B88-898FE352B33EF0C7 aplocher@gmail.com Adam Plocher +233 https://www.google.com/accounts/o8/id?id=AItOawmStmw3bLQv86JLRAE3mZKCdjHhLU5X8SU https://www.google.com/accounts/o8/ud 6A3EEBEB-E560-453F-84E00417B6C9EE63 bmoretz82@gmail.com Brandon Moretz +460 https://www.google.com/accounts/o8/id?id=AItOawlc9POPTndcxIH_na1XSahloGuMQSCC-iw https://www.google.com/accounts/o8/ud 941CBE59-DFC9-4831-97E49B4CC5EB097B jmbertucci@gmail.com John Bertucci +461 http://bansalvikas.myopenid.com/ http://www.myopenid.com/server A07C5AC9-1267-49B8-908B1AAE9634210F \N \N \N +462 https://www.google.com/accounts/o8/id?id=AItOawmfaLuyAs1Ak0ARKzRI-JnlSYBbHY5H2n8 https://www.google.com/accounts/o8/ud 8E22535C-BA4C-4408-B454F6B6228A2F65 maker.plays.ten@gmail.com maker plays +463 https://www.google.com/accounts/o8/id?id=AItOawka8MiHMujdSvRW8aw4JMAJh3y_eyxabyE https://www.google.com/accounts/o8/ud 5C053718-9641-4FE2-882B4F32C88C1AA7 enzoaeneas@gmail.com Kevin James +\. + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/src/main/webapp/db/mssql_clearDBUsers.sql b/src/main/webapp/db/mssql_clearDBUsers.sql new file mode 100644 index 0000000..186eeb6 --- /dev/null +++ b/src/main/webapp/db/mssql_clearDBUsers.sql @@ -0,0 +1,45 @@ +USE [master] +GO + +/****** Object: StoredProcedure [dbo].[clearDBUsers] Script Date: 8/25/2012 8:39:29 PM ******/ +SET ANSI_NULLS ON +GO + +SET QUOTED_IDENTIFIER ON +GO + + +CREATE PROCEDURE [dbo].[clearDBUsers] + @dbName SYSNAME +AS +BEGIN + SET NOCOUNT ON + + DECLARE @spid INT, + @cnt INT, + @sql VARCHAR(255) + + SELECT @spid = MIN(spid), @cnt = COUNT(*) + FROM master..sysprocesses + WHERE dbid = DB_ID(@dbname) + AND spid != @@SPID + + PRINT 'Starting to KILL '+RTRIM(@cnt)+' processes.' + + WHILE @spid IS NOT NULL + BEGIN + PRINT 'About to KILL '+RTRIM(@spid) + SET @sql = 'KILL '+RTRIM(@spid) + EXEC(@sql) + SELECT @spid = MIN(spid), @cnt = COUNT(*) + FROM master..sysprocesses + WHERE dbid = DB_ID(@dbname) + AND spid != @@SPID + PRINT RTRIM(@cnt)+' processes remain.' + END +END + + +GO + + diff --git a/src/main/webapp/db/schema.sql b/src/main/webapp/db/schema.sql new file mode 100644 index 0000000..85bd1ae --- /dev/null +++ b/src/main/webapp/db/schema.sql @@ -0,0 +1,495 @@ +-- +-- PostgreSQL database dump +-- + +SET statement_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SET check_function_bodies = false; +SET client_min_messages = warning; + +-- +-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: +-- + +CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; + + +-- +-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: +-- + +COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; + + +-- +-- Name: uuid-ossp; Type: EXTENSION; Schema: -; Owner: +-- + +CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public; + + +-- +-- Name: EXTENSION "uuid-ossp"; Type: COMMENT; Schema: -; Owner: +-- + +COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)'; + + +SET search_path = public, pg_catalog; + +SET default_tablespace = ''; + +SET default_with_oids = false; + +-- +-- Name: db_types; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE db_types ( + id integer NOT NULL, + full_name character varying(50), + simple_name character varying(50), + setup_script_template text, + jdbc_class_name character varying(50), + drop_script_template text, + custom_jdbc_attributes character varying(100), + batch_separator character varying(5), + notes character varying(250), + sample_fragment character varying(50), + execution_plan_prefix character varying(500), + execution_plan_suffix character varying(500), + execution_plan_xslt text, + context character varying(10), + execution_plan_check character varying(300), + is_latest_stable smallint DEFAULT 0 +); + + +ALTER TABLE public.db_types OWNER TO postgres; + +-- +-- Name: db_types2_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE db_types2_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.db_types2_id_seq OWNER TO postgres; + +-- +-- Name: db_types_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE db_types_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.db_types_id_seq OWNER TO postgres; + +-- +-- Name: db_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE db_types_id_seq OWNED BY db_types.id; + + +-- +-- Name: hosts; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE hosts ( + id integer NOT NULL, + db_type_id integer NOT NULL, + jdbc_url_template character varying(150), + cf_dsn character varying(50) +); + + +ALTER TABLE public.hosts OWNER TO postgres; + +-- +-- Name: hosts_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE hosts_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.hosts_id_seq OWNER TO postgres; + +-- +-- Name: hosts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE hosts_id_seq OWNED BY hosts.id; + + +-- +-- Name: queries; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE queries ( + schema_def_id integer NOT NULL, + sql text, + md5 character varying(32), + id integer NOT NULL, + statement_separator character varying(5) DEFAULT ';'::character varying, + author_id integer +); + + +ALTER TABLE public.queries OWNER TO postgres; + +-- +-- Name: query_sets; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE query_sets ( + id integer NOT NULL, + query_id integer NOT NULL, + schema_def_id integer NOT NULL, + row_count integer, + execution_time integer, + succeeded smallint, + sql text, + execution_plan text, + error_message text, + columns_list character varying(500) +); + + +ALTER TABLE public.query_sets OWNER TO postgres; + +-- +-- Name: schema_defs; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE schema_defs ( + id integer NOT NULL, + db_type_id integer NOT NULL, + short_code character varying(32), + last_used timestamp without time zone, + ddl text, + current_host_id integer, + md5 character varying(32), + statement_separator character varying(5) DEFAULT ';'::character varying, + owner_id integer, + structure_json text +); + + +ALTER TABLE public.schema_defs OWNER TO postgres; + +-- +-- Name: schema_defs_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE schema_defs_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.schema_defs_id_seq OWNER TO postgres; + +-- +-- Name: schema_defs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE schema_defs_id_seq OWNED BY schema_defs.id; + + +-- +-- Name: user_fiddles; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE user_fiddles ( + id integer NOT NULL, + user_id integer NOT NULL, + schema_def_id integer NOT NULL, + query_id integer, + last_accessed timestamp without time zone DEFAULT now(), + num_accesses integer DEFAULT 1, + show_in_history smallint DEFAULT 1, + favorite smallint DEFAULT 0 +); + + +ALTER TABLE public.user_fiddles OWNER TO postgres; + +-- +-- Name: user_fiddles_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE user_fiddles_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.user_fiddles_id_seq OWNER TO postgres; + +-- +-- Name: user_fiddles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE user_fiddles_id_seq OWNED BY user_fiddles.id; + + +-- +-- Name: users; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE users ( + id integer NOT NULL, + identity character varying(1000) NOT NULL, + openid_server character varying(1000) NOT NULL, + auth_token character varying(35) NOT NULL, + email character varying(1000), + firstname character varying(200), + lastname character varying(200) +); + + +ALTER TABLE public.users OWNER TO postgres; + +-- +-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE users_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.users_id_seq OWNER TO postgres; + +-- +-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE users_id_seq OWNED BY users.id; + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY db_types ALTER COLUMN id SET DEFAULT nextval('db_types_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY hosts ALTER COLUMN id SET DEFAULT nextval('hosts_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY schema_defs ALTER COLUMN id SET DEFAULT nextval('schema_defs_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY user_fiddles ALTER COLUMN id SET DEFAULT nextval('user_fiddles_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass); + + +-- +-- Name: db_types_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY db_types + ADD CONSTRAINT db_types_pkey PRIMARY KEY (id); + + +-- +-- Name: hosts_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY hosts + ADD CONSTRAINT hosts_pkey PRIMARY KEY (id); + + +-- +-- Name: queries_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY queries + ADD CONSTRAINT queries_pkey PRIMARY KEY (id, schema_def_id); + + +-- +-- Name: query_sets_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY query_sets + ADD CONSTRAINT query_sets_pkey PRIMARY KEY (id, schema_def_id, query_id); + + +-- +-- Name: schema_defs_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY schema_defs + ADD CONSTRAINT schema_defs_pkey PRIMARY KEY (id); + + +-- +-- Name: user_fiddles_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY user_fiddles + ADD CONSTRAINT user_fiddles_pkey PRIMARY KEY (id); + + +-- +-- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY users + ADD CONSTRAINT users_pkey PRIMARY KEY (id); + + +-- +-- Name: query_author; Type: INDEX; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE INDEX query_author ON queries USING btree (author_id); + + +-- +-- Name: query_md5s; Type: INDEX; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE UNIQUE INDEX query_md5s ON queries USING btree (md5, schema_def_id); + + +-- +-- Name: schema_md5s; Type: INDEX; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE UNIQUE INDEX schema_md5s ON schema_defs USING btree (md5, db_type_id); + + +-- +-- Name: schema_owner; Type: INDEX; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE INDEX schema_owner ON schema_defs USING btree (owner_id); + + +-- +-- Name: schema_short_codes; Type: INDEX; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE UNIQUE INDEX schema_short_codes ON schema_defs USING btree (short_code, db_type_id); + + +-- +-- Name: user_fiddles_user_id; Type: INDEX; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE INDEX user_fiddles_user_id ON user_fiddles USING btree (user_id); + + +-- +-- Name: user_fiddles_user_schema_query_id; Type: INDEX; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE INDEX user_fiddles_user_schema_query_id ON user_fiddles USING btree (user_id, schema_def_id, query_id); + + +-- +-- Name: user_identities; Type: INDEX; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE UNIQUE INDEX user_identities ON users USING btree (identity); + + +-- +-- Name: db_type_ref; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY hosts + ADD CONSTRAINT db_type_ref FOREIGN KEY (db_type_id) REFERENCES db_types(id); + + +-- +-- Name: db_type_ref; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY schema_defs + ADD CONSTRAINT db_type_ref FOREIGN KEY (db_type_id) REFERENCES db_types(id); + + +-- +-- Name: host_ref; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY schema_defs + ADD CONSTRAINT host_ref FOREIGN KEY (current_host_id) REFERENCES hosts(id); + + +-- +-- Name: schema_def_ref; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY queries + ADD CONSTRAINT schema_def_ref FOREIGN KEY (schema_def_id) REFERENCES schema_defs(id); + + +-- +-- Name: schema_def_ref; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY user_fiddles + ADD CONSTRAINT schema_def_ref FOREIGN KEY (schema_def_id) REFERENCES schema_defs(id); + + +-- +-- Name: public; Type: ACL; Schema: -; Owner: postgres +-- + +REVOKE ALL ON SCHEMA public FROM PUBLIC; +REVOKE ALL ON SCHEMA public FROM postgres; +GRANT ALL ON SCHEMA public TO postgres; +GRANT ALL ON SCHEMA public TO PUBLIC; + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/src/main/webapp/db/snapshot.sh b/src/main/webapp/db/snapshot.sh new file mode 100755 index 0000000..236f45e --- /dev/null +++ b/src/main/webapp/db/snapshot.sh @@ -0,0 +1,2 @@ +pg_dump -U postgres -s sqlfiddle > schema.sql +pg_dump -U postgres -a -T user_fiddles -T query_sets -T schema_defs -T queries sqlfiddle > data.sql diff --git a/src/main/webapp/events/functions.cfm b/src/main/webapp/events/functions.cfm new file mode 100644 index 0000000..db35cf4 --- /dev/null +++ b/src/main/webapp/events/functions.cfm @@ -0,0 +1 @@ +<!--- Place functions here that should be globally available in your application. --->
\ No newline at end of file diff --git a/src/main/webapp/events/onapplicationend.cfm b/src/main/webapp/events/onapplicationend.cfm new file mode 100644 index 0000000..9a654bf --- /dev/null +++ b/src/main/webapp/events/onapplicationend.cfm @@ -0,0 +1 @@ +<!--- Place code here that should be executed on the "onApplicationEnd" event. --->
\ No newline at end of file diff --git a/src/main/webapp/events/onapplicationstart.cfm b/src/main/webapp/events/onapplicationstart.cfm new file mode 100644 index 0000000..d4e94b0 --- /dev/null +++ b/src/main/webapp/events/onapplicationstart.cfm @@ -0,0 +1 @@ +<!--- Place code here that should be executed on the "onApplicationStart" event. --->
\ No newline at end of file diff --git a/src/main/webapp/events/onerror.cfm b/src/main/webapp/events/onerror.cfm new file mode 100644 index 0000000..e822117 --- /dev/null +++ b/src/main/webapp/events/onerror.cfm @@ -0,0 +1,8 @@ +<cfthrow object="#arguments.exception#">
+<!--- <cfheader statuscode="500" statustext="Internal Server Error">
+<!--- Place HTML here that should be displayed when an error is encountered while running in "production" mode. --->
+<h1>Error!</h1>
+<p>
+ Sorry, that caused an unexpected error.<br />
+ Please try again later.
+</p> --->
\ No newline at end of file diff --git a/src/main/webapp/events/onmaintenance.cfm b/src/main/webapp/events/onmaintenance.cfm new file mode 100644 index 0000000..10b439a --- /dev/null +++ b/src/main/webapp/events/onmaintenance.cfm @@ -0,0 +1,7 @@ +<cfheader statuscode="503" statustext="Service Unavailable">
+<!--- Place HTML here that should be displayed when the application is running in "maintenance" mode. --->
+<h1>Maintenance!</h1>
+<p>
+ Sorry, maintenance work is being performed.<br />
+ Please try again later.
+</p>
\ No newline at end of file diff --git a/src/main/webapp/events/onmissingtemplate.cfm b/src/main/webapp/events/onmissingtemplate.cfm new file mode 100644 index 0000000..735682c --- /dev/null +++ b/src/main/webapp/events/onmissingtemplate.cfm @@ -0,0 +1,7 @@ +<cfheader statuscode="404" statustext="Not Found">
+<!--- Place HTML here that should be displayed when a file is not found while running in "production" mode. --->
+<h1>File Not Found!</h1>
+<p>
+ Sorry, the page you requested could not be found.<br />
+ Please verify the address.
+</p>
\ No newline at end of file diff --git a/src/main/webapp/events/onrequestend.cfm b/src/main/webapp/events/onrequestend.cfm new file mode 100644 index 0000000..4b31706 --- /dev/null +++ b/src/main/webapp/events/onrequestend.cfm @@ -0,0 +1 @@ +<!--- Place code here that should be executed on the "onRequestEnd" event. --->
\ No newline at end of file diff --git a/src/main/webapp/events/onrequeststart.cfm b/src/main/webapp/events/onrequeststart.cfm new file mode 100644 index 0000000..dd25578 --- /dev/null +++ b/src/main/webapp/events/onrequeststart.cfm @@ -0,0 +1,24 @@ +<!--- Place code here that should be executed on the "onRequestStart" event. ---> + +<cfif (StructKeyExists(URL, "reload") && (!StructKeyExists(application, "wheels") || !StructKeyExists(application.wheels, "reloadPassword") || !Len(application.wheels.reloadPassword) || (StructKeyExists(URL, "password") && URL.password IS application.wheels.reloadPassword)))> + + <cfscript> + function getBase(){ + if(findnocase("index.cfm", cgi.script_name)){ + local.baseDir = Left(cgi.script_name,findnocase("index.cfm",cgi.script_name)-1); + }else{ + local.baseDir = cgi.script_name; + } + local.out = "http"; + if(isDefined("CGI.HTTPS") And CGI.HTTPS eq "On") local.out = local.out & "s"; + local.out = local.out & "://" & cgi.server_name; + if(Not ((cgi.SERVER_PORT eq 80 And Not (isDefined('CGI.HTTPS') And CGI.HTTPS eq "On")) Or (cgi.SERVER_PORT eq 443 And (isDefined('CGI.HTTPS') And CGI.HTTPS eq "On"))) ) local.out = local.out & ":" & cgi.SERVER_PORT; + local.out = local.out & local.baseDir; + return local.out; + } + </cfscript> + + <cfhttp url="#getBase()#index.cfm/Fiddles/dbtypes" method="get"></cfhttp> + <cffile action="write" file="#GetDirectoryFromPath(GetBaseTemplatePath())#javascripts/dbTypes_cached.js" output="#cfhttp.filecontent#" > + +</cfif> diff --git a/src/main/webapp/events/onsessionend.cfm b/src/main/webapp/events/onsessionend.cfm new file mode 100644 index 0000000..01c70cb --- /dev/null +++ b/src/main/webapp/events/onsessionend.cfm @@ -0,0 +1 @@ +<!--- Place code here that should be executed on the "onSessionEnd" event. --->
\ No newline at end of file diff --git a/src/main/webapp/events/onsessionstart.cfm b/src/main/webapp/events/onsessionstart.cfm new file mode 100644 index 0000000..e7d0199 --- /dev/null +++ b/src/main/webapp/events/onsessionstart.cfm @@ -0,0 +1 @@ +<!--- Place code here that should be executed on the "onSessionStart" event. --->
\ No newline at end of file diff --git a/src/main/webapp/favicon.ico b/src/main/webapp/favicon.ico Binary files differnew file mode 100644 index 0000000..361a9dd --- /dev/null +++ b/src/main/webapp/favicon.ico diff --git a/src/main/webapp/files/.gitignore b/src/main/webapp/files/.gitignore new file mode 100644 index 0000000..d3f5a12 --- /dev/null +++ b/src/main/webapp/files/.gitignore @@ -0,0 +1 @@ +
diff --git a/src/main/webapp/images/.gitignore b/src/main/webapp/images/.gitignore new file mode 100644 index 0000000..d3f5a12 --- /dev/null +++ b/src/main/webapp/images/.gitignore @@ -0,0 +1 @@ +
diff --git a/src/main/webapp/images/201206-Banner-SQLFiddle-Complete-An-728x90.gif b/src/main/webapp/images/201206-Banner-SQLFiddle-Complete-An-728x90.gif Binary files differnew file mode 100644 index 0000000..d184b84 --- /dev/null +++ b/src/main/webapp/images/201206-Banner-SQLFiddle-Complete-An-728x90.gif diff --git a/src/main/webapp/images/blog_sample.png b/src/main/webapp/images/blog_sample.png Binary files differnew file mode 100644 index 0000000..040c921 --- /dev/null +++ b/src/main/webapp/images/blog_sample.png diff --git a/src/main/webapp/images/fiddle_transparent.png b/src/main/webapp/images/fiddle_transparent.png Binary files differnew file mode 100644 index 0000000..62598c0 --- /dev/null +++ b/src/main/webapp/images/fiddle_transparent.png diff --git a/src/main/webapp/images/fiddle_transparent_small.png b/src/main/webapp/images/fiddle_transparent_small.png Binary files differnew file mode 100644 index 0000000..59cb732 --- /dev/null +++ b/src/main/webapp/images/fiddle_transparent_small.png diff --git a/src/main/webapp/images/fiddle_transparent_square.png b/src/main/webapp/images/fiddle_transparent_square.png Binary files differnew file mode 100644 index 0000000..d358d6a --- /dev/null +++ b/src/main/webapp/images/fiddle_transparent_square.png diff --git a/src/main/webapp/images/fiddle_white_square.jpg b/src/main/webapp/images/fiddle_white_square.jpg Binary files differnew file mode 100644 index 0000000..c12a064 --- /dev/null +++ b/src/main/webapp/images/fiddle_white_square.jpg diff --git a/src/main/webapp/images/geonorth.png b/src/main/webapp/images/geonorth.png Binary files differnew file mode 100644 index 0000000..78eae33 --- /dev/null +++ b/src/main/webapp/images/geonorth.png diff --git a/src/main/webapp/images/glyphicons-halflings-white.png b/src/main/webapp/images/glyphicons-halflings-white.png Binary files differnew file mode 100644 index 0000000..3bf6484 --- /dev/null +++ b/src/main/webapp/images/glyphicons-halflings-white.png diff --git a/src/main/webapp/images/glyphicons-halflings.png b/src/main/webapp/images/glyphicons-halflings.png Binary files differnew file mode 100644 index 0000000..79bc568 --- /dev/null +++ b/src/main/webapp/images/glyphicons-halflings.png diff --git a/src/main/webapp/images/qp/arithmetic_expression.gif b/src/main/webapp/images/qp/arithmetic_expression.gif Binary files differnew file mode 100644 index 0000000..0a77c47 --- /dev/null +++ b/src/main/webapp/images/qp/arithmetic_expression.gif diff --git a/src/main/webapp/images/qp/assert.gif b/src/main/webapp/images/qp/assert.gif Binary files differnew file mode 100644 index 0000000..82f1b9e --- /dev/null +++ b/src/main/webapp/images/qp/assert.gif diff --git a/src/main/webapp/images/qp/assign.gif b/src/main/webapp/images/qp/assign.gif Binary files differnew file mode 100644 index 0000000..c1ba357 --- /dev/null +++ b/src/main/webapp/images/qp/assign.gif diff --git a/src/main/webapp/images/qp/bitmap.gif b/src/main/webapp/images/qp/bitmap.gif Binary files differnew file mode 100644 index 0000000..2d2c305 --- /dev/null +++ b/src/main/webapp/images/qp/bitmap.gif diff --git a/src/main/webapp/images/qp/bookmark_lookup.gif b/src/main/webapp/images/qp/bookmark_lookup.gif Binary files differnew file mode 100644 index 0000000..18ef63a --- /dev/null +++ b/src/main/webapp/images/qp/bookmark_lookup.gif diff --git a/src/main/webapp/images/qp/clustered_index_delete.gif b/src/main/webapp/images/qp/clustered_index_delete.gif Binary files differnew file mode 100644 index 0000000..163e3e0 --- /dev/null +++ b/src/main/webapp/images/qp/clustered_index_delete.gif diff --git a/src/main/webapp/images/qp/clustered_index_insert.gif b/src/main/webapp/images/qp/clustered_index_insert.gif Binary files differnew file mode 100644 index 0000000..da3f6b8 --- /dev/null +++ b/src/main/webapp/images/qp/clustered_index_insert.gif diff --git a/src/main/webapp/images/qp/clustered_index_scan.gif b/src/main/webapp/images/qp/clustered_index_scan.gif Binary files differnew file mode 100644 index 0000000..a1719cf --- /dev/null +++ b/src/main/webapp/images/qp/clustered_index_scan.gif diff --git a/src/main/webapp/images/qp/clustered_index_seek.gif b/src/main/webapp/images/qp/clustered_index_seek.gif Binary files differnew file mode 100644 index 0000000..1fe8309 --- /dev/null +++ b/src/main/webapp/images/qp/clustered_index_seek.gif diff --git a/src/main/webapp/images/qp/clustered_index_update.gif b/src/main/webapp/images/qp/clustered_index_update.gif Binary files differnew file mode 100644 index 0000000..c887a34 --- /dev/null +++ b/src/main/webapp/images/qp/clustered_index_update.gif diff --git a/src/main/webapp/images/qp/collapse.gif b/src/main/webapp/images/qp/collapse.gif Binary files differnew file mode 100644 index 0000000..8912299 --- /dev/null +++ b/src/main/webapp/images/qp/collapse.gif diff --git a/src/main/webapp/images/qp/compute_scalar.gif b/src/main/webapp/images/qp/compute_scalar.gif Binary files differnew file mode 100644 index 0000000..2c42761 --- /dev/null +++ b/src/main/webapp/images/qp/compute_scalar.gif diff --git a/src/main/webapp/images/qp/concatenation.gif b/src/main/webapp/images/qp/concatenation.gif Binary files differnew file mode 100644 index 0000000..0e3c628 --- /dev/null +++ b/src/main/webapp/images/qp/concatenation.gif diff --git a/src/main/webapp/images/qp/constant_scan.gif b/src/main/webapp/images/qp/constant_scan.gif Binary files differnew file mode 100644 index 0000000..598e5c8 --- /dev/null +++ b/src/main/webapp/images/qp/constant_scan.gif diff --git a/src/main/webapp/images/qp/convert.gif b/src/main/webapp/images/qp/convert.gif Binary files differnew file mode 100644 index 0000000..9ebd4f9 --- /dev/null +++ b/src/main/webapp/images/qp/convert.gif diff --git a/src/main/webapp/images/qp/declare.gif b/src/main/webapp/images/qp/declare.gif Binary files differnew file mode 100644 index 0000000..5265548 --- /dev/null +++ b/src/main/webapp/images/qp/declare.gif diff --git a/src/main/webapp/images/qp/deleted_scan.gif b/src/main/webapp/images/qp/deleted_scan.gif Binary files differnew file mode 100644 index 0000000..2d7b2b7 --- /dev/null +++ b/src/main/webapp/images/qp/deleted_scan.gif diff --git a/src/main/webapp/images/qp/distribute_streams.gif b/src/main/webapp/images/qp/distribute_streams.gif Binary files differnew file mode 100644 index 0000000..2e16bcb --- /dev/null +++ b/src/main/webapp/images/qp/distribute_streams.gif diff --git a/src/main/webapp/images/qp/dynamic.gif b/src/main/webapp/images/qp/dynamic.gif Binary files differnew file mode 100644 index 0000000..234c661 --- /dev/null +++ b/src/main/webapp/images/qp/dynamic.gif diff --git a/src/main/webapp/images/qp/fetch_query.gif b/src/main/webapp/images/qp/fetch_query.gif Binary files differnew file mode 100644 index 0000000..b7cfda3 --- /dev/null +++ b/src/main/webapp/images/qp/fetch_query.gif diff --git a/src/main/webapp/images/qp/filter.gif b/src/main/webapp/images/qp/filter.gif Binary files differnew file mode 100644 index 0000000..45cbc11 --- /dev/null +++ b/src/main/webapp/images/qp/filter.gif diff --git a/src/main/webapp/images/qp/gather_streams.gif b/src/main/webapp/images/qp/gather_streams.gif Binary files differnew file mode 100644 index 0000000..eade15c --- /dev/null +++ b/src/main/webapp/images/qp/gather_streams.gif diff --git a/src/main/webapp/images/qp/hash_match.gif b/src/main/webapp/images/qp/hash_match.gif Binary files differnew file mode 100644 index 0000000..6287a21 --- /dev/null +++ b/src/main/webapp/images/qp/hash_match.gif diff --git a/src/main/webapp/images/qp/if.gif b/src/main/webapp/images/qp/if.gif Binary files differnew file mode 100644 index 0000000..95503b4 --- /dev/null +++ b/src/main/webapp/images/qp/if.gif diff --git a/src/main/webapp/images/qp/inserted_scan.gif b/src/main/webapp/images/qp/inserted_scan.gif Binary files differnew file mode 100644 index 0000000..89c0de8 --- /dev/null +++ b/src/main/webapp/images/qp/inserted_scan.gif diff --git a/src/main/webapp/images/qp/intrinsic.gif b/src/main/webapp/images/qp/intrinsic.gif Binary files differnew file mode 100644 index 0000000..8564f82 --- /dev/null +++ b/src/main/webapp/images/qp/intrinsic.gif diff --git a/src/main/webapp/images/qp/keyset.gif b/src/main/webapp/images/qp/keyset.gif Binary files differnew file mode 100644 index 0000000..659accc --- /dev/null +++ b/src/main/webapp/images/qp/keyset.gif diff --git a/src/main/webapp/images/qp/log_row_scan.gif b/src/main/webapp/images/qp/log_row_scan.gif Binary files differnew file mode 100644 index 0000000..40c93dc --- /dev/null +++ b/src/main/webapp/images/qp/log_row_scan.gif diff --git a/src/main/webapp/images/qp/merge_interval.gif b/src/main/webapp/images/qp/merge_interval.gif Binary files differnew file mode 100644 index 0000000..feef439 --- /dev/null +++ b/src/main/webapp/images/qp/merge_interval.gif diff --git a/src/main/webapp/images/qp/merge_join.gif b/src/main/webapp/images/qp/merge_join.gif Binary files differnew file mode 100644 index 0000000..d599581 --- /dev/null +++ b/src/main/webapp/images/qp/merge_join.gif diff --git a/src/main/webapp/images/qp/nested_loops.gif b/src/main/webapp/images/qp/nested_loops.gif Binary files differnew file mode 100644 index 0000000..89cf8d6 --- /dev/null +++ b/src/main/webapp/images/qp/nested_loops.gif diff --git a/src/main/webapp/images/qp/nonclustered_index_delete.gif b/src/main/webapp/images/qp/nonclustered_index_delete.gif Binary files differnew file mode 100644 index 0000000..102fdf9 --- /dev/null +++ b/src/main/webapp/images/qp/nonclustered_index_delete.gif diff --git a/src/main/webapp/images/qp/nonclustered_index_insert.gif b/src/main/webapp/images/qp/nonclustered_index_insert.gif Binary files differnew file mode 100644 index 0000000..76c480c --- /dev/null +++ b/src/main/webapp/images/qp/nonclustered_index_insert.gif diff --git a/src/main/webapp/images/qp/nonclustered_index_scan.gif b/src/main/webapp/images/qp/nonclustered_index_scan.gif Binary files differnew file mode 100644 index 0000000..19437c3 --- /dev/null +++ b/src/main/webapp/images/qp/nonclustered_index_scan.gif diff --git a/src/main/webapp/images/qp/nonclustered_index_seek.gif b/src/main/webapp/images/qp/nonclustered_index_seek.gif Binary files differnew file mode 100644 index 0000000..24c913c --- /dev/null +++ b/src/main/webapp/images/qp/nonclustered_index_seek.gif diff --git a/src/main/webapp/images/qp/nonclustered_index_spool.gif b/src/main/webapp/images/qp/nonclustered_index_spool.gif Binary files differnew file mode 100644 index 0000000..035b2dd --- /dev/null +++ b/src/main/webapp/images/qp/nonclustered_index_spool.gif diff --git a/src/main/webapp/images/qp/nonclustered_index_update.gif b/src/main/webapp/images/qp/nonclustered_index_update.gif Binary files differnew file mode 100644 index 0000000..3b92f8b --- /dev/null +++ b/src/main/webapp/images/qp/nonclustered_index_update.gif diff --git a/src/main/webapp/images/qp/online_index_insert.gif b/src/main/webapp/images/qp/online_index_insert.gif Binary files differnew file mode 100644 index 0000000..c1156d3 --- /dev/null +++ b/src/main/webapp/images/qp/online_index_insert.gif diff --git a/src/main/webapp/images/qp/parameter_table_scan.gif b/src/main/webapp/images/qp/parameter_table_scan.gif Binary files differnew file mode 100644 index 0000000..598e5c8 --- /dev/null +++ b/src/main/webapp/images/qp/parameter_table_scan.gif diff --git a/src/main/webapp/images/qp/population_query.gif b/src/main/webapp/images/qp/population_query.gif Binary files differnew file mode 100644 index 0000000..12f6639 --- /dev/null +++ b/src/main/webapp/images/qp/population_query.gif diff --git a/src/main/webapp/images/qp/rdi_lookup.gif b/src/main/webapp/images/qp/rdi_lookup.gif Binary files differnew file mode 100644 index 0000000..753d033 --- /dev/null +++ b/src/main/webapp/images/qp/rdi_lookup.gif diff --git a/src/main/webapp/images/qp/refresh_query.gif b/src/main/webapp/images/qp/refresh_query.gif Binary files differnew file mode 100644 index 0000000..06d21e1 --- /dev/null +++ b/src/main/webapp/images/qp/refresh_query.gif diff --git a/src/main/webapp/images/qp/remote_delete.gif b/src/main/webapp/images/qp/remote_delete.gif Binary files differnew file mode 100644 index 0000000..3d8f331 --- /dev/null +++ b/src/main/webapp/images/qp/remote_delete.gif diff --git a/src/main/webapp/images/qp/remote_insert.gif b/src/main/webapp/images/qp/remote_insert.gif Binary files differnew file mode 100644 index 0000000..969464a --- /dev/null +++ b/src/main/webapp/images/qp/remote_insert.gif diff --git a/src/main/webapp/images/qp/remote_query.gif b/src/main/webapp/images/qp/remote_query.gif Binary files differnew file mode 100644 index 0000000..706e487 --- /dev/null +++ b/src/main/webapp/images/qp/remote_query.gif diff --git a/src/main/webapp/images/qp/remote_scan.gif b/src/main/webapp/images/qp/remote_scan.gif Binary files differnew file mode 100644 index 0000000..de749f4 --- /dev/null +++ b/src/main/webapp/images/qp/remote_scan.gif diff --git a/src/main/webapp/images/qp/remote_update.gif b/src/main/webapp/images/qp/remote_update.gif Binary files differnew file mode 100644 index 0000000..eaeaa80 --- /dev/null +++ b/src/main/webapp/images/qp/remote_update.gif diff --git a/src/main/webapp/images/qp/repartition_streams.gif b/src/main/webapp/images/qp/repartition_streams.gif Binary files differnew file mode 100644 index 0000000..a91dc76 --- /dev/null +++ b/src/main/webapp/images/qp/repartition_streams.gif diff --git a/src/main/webapp/images/qp/result.gif b/src/main/webapp/images/qp/result.gif Binary files differnew file mode 100644 index 0000000..827876b --- /dev/null +++ b/src/main/webapp/images/qp/result.gif diff --git a/src/main/webapp/images/qp/row_count_spool.gif b/src/main/webapp/images/qp/row_count_spool.gif Binary files differnew file mode 100644 index 0000000..c14858a --- /dev/null +++ b/src/main/webapp/images/qp/row_count_spool.gif diff --git a/src/main/webapp/images/qp/segment.gif b/src/main/webapp/images/qp/segment.gif Binary files differnew file mode 100644 index 0000000..7002502 --- /dev/null +++ b/src/main/webapp/images/qp/segment.gif diff --git a/src/main/webapp/images/qp/sequence.gif b/src/main/webapp/images/qp/sequence.gif Binary files differnew file mode 100644 index 0000000..5def3e4 --- /dev/null +++ b/src/main/webapp/images/qp/sequence.gif diff --git a/src/main/webapp/images/qp/sequenceproject.gif b/src/main/webapp/images/qp/sequenceproject.gif Binary files differnew file mode 100644 index 0000000..efa1cca --- /dev/null +++ b/src/main/webapp/images/qp/sequenceproject.gif diff --git a/src/main/webapp/images/qp/snapshot.gif b/src/main/webapp/images/qp/snapshot.gif Binary files differnew file mode 100644 index 0000000..844cf63 --- /dev/null +++ b/src/main/webapp/images/qp/snapshot.gif diff --git a/src/main/webapp/images/qp/sort.gif b/src/main/webapp/images/qp/sort.gif Binary files differnew file mode 100644 index 0000000..5fa81fc --- /dev/null +++ b/src/main/webapp/images/qp/sort.gif diff --git a/src/main/webapp/images/qp/split.gif b/src/main/webapp/images/qp/split.gif Binary files differnew file mode 100644 index 0000000..bd4fe52 --- /dev/null +++ b/src/main/webapp/images/qp/split.gif diff --git a/src/main/webapp/images/qp/spool.gif b/src/main/webapp/images/qp/spool.gif Binary files differnew file mode 100644 index 0000000..e4bb759 --- /dev/null +++ b/src/main/webapp/images/qp/spool.gif diff --git a/src/main/webapp/images/qp/stream_aggregate.gif b/src/main/webapp/images/qp/stream_aggregate.gif Binary files differnew file mode 100644 index 0000000..2d50e42 --- /dev/null +++ b/src/main/webapp/images/qp/stream_aggregate.gif diff --git a/src/main/webapp/images/qp/switch.gif b/src/main/webapp/images/qp/switch.gif Binary files differnew file mode 100644 index 0000000..91e1b19 --- /dev/null +++ b/src/main/webapp/images/qp/switch.gif diff --git a/src/main/webapp/images/qp/table_delete.gif b/src/main/webapp/images/qp/table_delete.gif Binary files differnew file mode 100644 index 0000000..4f89c64 --- /dev/null +++ b/src/main/webapp/images/qp/table_delete.gif diff --git a/src/main/webapp/images/qp/table_insert.gif b/src/main/webapp/images/qp/table_insert.gif Binary files differnew file mode 100644 index 0000000..48719cf --- /dev/null +++ b/src/main/webapp/images/qp/table_insert.gif diff --git a/src/main/webapp/images/qp/table_scan.gif b/src/main/webapp/images/qp/table_scan.gif Binary files differnew file mode 100644 index 0000000..b4cfd0b --- /dev/null +++ b/src/main/webapp/images/qp/table_scan.gif diff --git a/src/main/webapp/images/qp/table_spool.gif b/src/main/webapp/images/qp/table_spool.gif Binary files differnew file mode 100644 index 0000000..92abd24 --- /dev/null +++ b/src/main/webapp/images/qp/table_spool.gif diff --git a/src/main/webapp/images/qp/table_update.gif b/src/main/webapp/images/qp/table_update.gif Binary files differnew file mode 100644 index 0000000..254a0c5 --- /dev/null +++ b/src/main/webapp/images/qp/table_update.gif diff --git a/src/main/webapp/images/qp/table_valued_function.gif b/src/main/webapp/images/qp/table_valued_function.gif Binary files differnew file mode 100644 index 0000000..1d49b69 --- /dev/null +++ b/src/main/webapp/images/qp/table_valued_function.gif diff --git a/src/main/webapp/images/qp/top.gif b/src/main/webapp/images/qp/top.gif Binary files differnew file mode 100644 index 0000000..996035f --- /dev/null +++ b/src/main/webapp/images/qp/top.gif diff --git a/src/main/webapp/images/qp/udx.gif b/src/main/webapp/images/qp/udx.gif Binary files differnew file mode 100644 index 0000000..f5a3ce6 --- /dev/null +++ b/src/main/webapp/images/qp/udx.gif diff --git a/src/main/webapp/images/qp/while.gif b/src/main/webapp/images/qp/while.gif Binary files differnew file mode 100644 index 0000000..f3e51e3 --- /dev/null +++ b/src/main/webapp/images/qp/while.gif diff --git a/src/main/webapp/images/sqlsentry/00.jpg b/src/main/webapp/images/sqlsentry/00.jpg Binary files differnew file mode 100644 index 0000000..4739aa6 --- /dev/null +++ b/src/main/webapp/images/sqlsentry/00.jpg diff --git a/src/main/webapp/images/sqlsentry/01.jpg b/src/main/webapp/images/sqlsentry/01.jpg Binary files differnew file mode 100644 index 0000000..6b023af --- /dev/null +++ b/src/main/webapp/images/sqlsentry/01.jpg diff --git a/src/main/webapp/images/sqlsentry/02.jpg b/src/main/webapp/images/sqlsentry/02.jpg Binary files differnew file mode 100644 index 0000000..3903ac7 --- /dev/null +++ b/src/main/webapp/images/sqlsentry/02.jpg diff --git a/src/main/webapp/images/sqlsentry/03.jpg b/src/main/webapp/images/sqlsentry/03.jpg Binary files differnew file mode 100644 index 0000000..e2897aa --- /dev/null +++ b/src/main/webapp/images/sqlsentry/03.jpg diff --git a/src/main/webapp/images/sqlsentry/04.jpg b/src/main/webapp/images/sqlsentry/04.jpg Binary files differnew file mode 100644 index 0000000..9c5ec3b --- /dev/null +++ b/src/main/webapp/images/sqlsentry/04.jpg diff --git a/src/main/webapp/images/stratascale.png b/src/main/webapp/images/stratascale.png Binary files differnew file mode 100644 index 0000000..3e98fc2 --- /dev/null +++ b/src/main/webapp/images/stratascale.png diff --git a/src/main/webapp/index.cfm b/src/main/webapp/index.cfm new file mode 100644 index 0000000..2a4a3b1 --- /dev/null +++ b/src/main/webapp/index.cfm @@ -0,0 +1 @@ +<cfinclude template="wheels/index.cfm">
\ No newline at end of file diff --git a/src/main/webapp/javascripts/.gitignore b/src/main/webapp/javascripts/.gitignore new file mode 100644 index 0000000..d770fc1 --- /dev/null +++ b/src/main/webapp/javascripts/.gitignore @@ -0,0 +1,2 @@ +
+/dbTypes_cached.js diff --git a/src/main/webapp/javascripts/fiddle_backbone/app.js b/src/main/webapp/javascripts/fiddle_backbone/app.js new file mode 100644 index 0000000..9672967 --- /dev/null +++ b/src/main/webapp/javascripts/fiddle_backbone/app.js @@ -0,0 +1,296 @@ +// this is essentially the controller, as far as I can tell + +define([ + 'BrowserEngines/engines', + + 'fiddle_backbone/models/UsedFiddle', + 'fiddle_backbone/models/MyFiddleHistory', + 'fiddle_backbone/models/DBTypesList', + 'fiddle_backbone/models/SchemaDef', + 'fiddle_backbone/models/Query', + + 'fiddle_backbone/views/DBTypesList', + 'fiddle_backbone/views/SchemaDef', + 'fiddle_backbone/views/Query', + + 'fiddle_backbone/router', + 'libs/renderTerminator', + + 'libs/jquery/jquery.blockUI', + 'libs/jquery/jquery.cookie', + 'Bootstrap/bootstrap-collapse', + 'Bootstrap/bootstrap-tab', + 'Bootstrap/bootstrap-dropdown', + 'Bootstrap/bootstrap-modal', + 'Bootstrap/bootstrap-tooltip', + 'Bootstrap/bootstrap-popover' + +], function ( + browserEngines, + UsedFiddle, MyFiddleHistory, DBTypesList, SchemaDef, Query, + DBTypesListView, SchemaDefView, QueryView, + Router, + renderTerminator + ) { + + var initialize = function(dbTypesData) { + + var router = {}; + + var myFiddleHistory = new MyFiddleHistory(); + + var dbTypes = new DBTypesList(); + + var schemaDef = new SchemaDef({browserEngines: browserEngines}); + + var query = new Query({ + "schemaDef": schemaDef + }); + + var dbTypesListView = new DBTypesListView({ + el: $("#db_type_id")[0], + collection: dbTypes + }); + + var schemaDefView = new SchemaDefView({ + id: "schema_ddl", + model: schemaDef, + output_el: $("#output"), + browser_el: $("#browser") + }); + + var queryView = new QueryView({ + id: "sql", + model: query, + output_el: $("#output") + }); + + /* UI Changes */ + dbTypes.on("change", function () { + // see also the router function defined below that also binds to this event + dbTypesListView.render(); + if (schemaDef.has("dbType")) + { + schemaDef.set("ready", (schemaDef.get("dbType").id == this.getSelectedType().id)); + } + }); + + schemaDef.on("change", function () { + if (this.hasChanged("ready")) + schemaDefView.updateDependents(); + + if (this.hasChanged("errorMessage")) + schemaDefView.renderOutput(); + + if (this.hasChanged("schema_structure")) + schemaDefView.renderSchemaBrowser(); + }); + + schemaDef.on("reloaded", function () { + this.set("dbType", dbTypes.getSelectedType()); + schemaDefView.render(); + }); + + query.on("reloaded", function () { + this.set({"pendingChanges": false}, {silent: true}); + + queryView.render(); + }); + + schemaDef.on("built failed", function () { + // see also the router function defined below that also binds to this event + $("#buildSchema label").prop('disabled', false); + $("#buildSchema label").html($("#buildSchema label").data("originalValue")); + schemaDefView.renderOutput(); + schemaDefView.renderSchemaBrowser(); + }); + + query.on("change", function () { + if ((this.hasChanged("sql") || this.hasChanged("statement_separator")) && !this.hasChanged("id") && !this.get("pendingChanges")) + { + this.set({"pendingChanges": true}, {silent: true}); + } + }); + + query.on("executed", function () { + // see also the router function defined below that also binds to this event + var $button = $(".runQuery"); + $button.prop('disabled', false); + $button.html($button.data("originalValue")); + + this.set({"pendingChanges": false}, {silent: true}); + queryView.renderOutput(); + }); + + /* Non-view object event binding */ + $("#buildSchema").click(function (e) { + var $button = $("label", this); + e.preventDefault(); + + if ($button.prop('disabled')) return false; + + $button.data("originalValue", $button.html()); + $button.prop('disabled', true).text('Building Schema...'); + + schemaDef.build(dbTypes); + }); + + var handleRunQuery = function (e) { + var $button = $(".runQuery"); + e.preventDefault(); + + if ($button.prop('disabled')) return false; + $button.data("originalValue", $button.html()); + $button.prop('disabled', true).text('Executing SQL...'); + + queryView.checkForSelectedText(); + query.execute(); + }; + + $(".runQuery").click(handleRunQuery); + $(document).keyup(function (e) { + if (e.keyCode == 116) // F5 + { + e.preventDefault(); + handleRunQuery(e); + } + }); + + $("#runQueryOptions li a").click(function (e) { + e.preventDefault(); + queryView.setOutputType(this.id); + queryView.renderOutput(); + }); + + $("#queryPrettify").click(function (e) { + var thisButton = $(this); + thisButton.attr("disabled", true); + e.preventDefault(); + $.post("index.cfm/proxy/formatSQL", {sql: query.get("sql")}, function (resp) { + query.set({"sql": resp}); + query.trigger('reloaded'); + query.set({"pendingChanges": true}); + + thisButton.attr("disabled", false); + }); + }); + + $(".terminator .dropdown-menu a").on('click', function (e) { + e.preventDefault(); + + renderTerminator($(this).closest(".panel"), $(this).attr('href')); + + if ($(this).closest(".panel").hasClass("schema")) + { + schemaDefView.handleSchemaChange(); + } + else // must be the query panel button + { + query.set({ + "pendingChanges": true, + "statement_separator": $(this).attr('href') + }, {silent: true}); + } + + }); + + + $(window).bind('beforeunload', function () { + if (query.get("pendingChanges")) + return "Warning! You have made changes to your query which will be lost. Continue?'"; + }); + + /* Data loading */ + dbTypes.on("reset", function () { + // When the dbTypes are loaded, everything else is ready to go.... + router = Router.initialize(dbTypes, schemaDef, query, myFiddleHistory, dbTypesListView); + + if (this.length && !this.getSelectedType()) + { + this.setSelectedType(this.first().id, true); + } + + // make sure everything is up-to-date on the page + dbTypesListView.render(); + schemaDefView.render(); + queryView.render(); + }); + + myFiddleHistory.on("change reset remove", function () { + if (localStorage) + { + localStorage.setItem("fiddleHistory", JSON.stringify(this.toJSON())); + } + }); + + + /* Events which will trigger new route navigation */ + + $("#clear").click(function (e) { + e.preventDefault(); + schemaDef.reset(); + query.reset(); + router.navigate("!" + dbTypes.getSelectedType().id, {trigger: true}); + }); + + $("#sample").click(function (e) { + e.preventDefault(); + router.navigate("!" + dbTypes.getSelectedType().get("sample_fragment"), {trigger: true}); + }); + + dbTypes.on("change", function () { + dbTypesListView.render(); + if ( + query.id && + schemaDef.get("short_code").length && + schemaDef.get("dbType").id == this.getSelectedType().id + ) + router.navigate("!" + this.getSelectedType().id + "/" + schemaDef.get("short_code") + "/" + query.id); + else if ( + schemaDef.get("short_code").length && + schemaDef.get("dbType").id == this.getSelectedType().id + ) + router.navigate("!" + this.getSelectedType().id + "/" + schemaDef.get("short_code")); + else + router.navigate("!" + this.getSelectedType().id); + }); + + schemaDef.on("built", function () { + + myFiddleHistory.insert(new UsedFiddle({ + "fragment": "!" + this.get("dbType").id + "/" + this.get("short_code") + })); + + router.navigate("!" + this.get("dbType").id + "/" + this.get("short_code")); + }); + + query.on("executed", function () { + var schemaDef = this.get("schemaDef"); + + myFiddleHistory.insert(new UsedFiddle({ + "fragment": "!" + schemaDef.get("dbType").id + "/" + schemaDef.get("short_code") + "/" + this.id + })); + + router.navigate( + "!" + schemaDef.get("dbType").id + "/" + schemaDef.get("short_code") + "/" + this.id + ); + }); + + + + dbTypes.reset(dbTypesData); + + + return { + dbTypes: dbTypes, + schemaDef: schemaDef, + schemaDefView: schemaDefView, + queryView: queryView + } + + }; + + return { + initialize: initialize + }; +});
\ No newline at end of file diff --git a/src/main/webapp/javascripts/fiddle_backbone/models/DBType.js b/src/main/webapp/javascripts/fiddle_backbone/models/DBType.js new file mode 100644 index 0000000..9320779 --- /dev/null +++ b/src/main/webapp/javascripts/fiddle_backbone/models/DBType.js @@ -0,0 +1,17 @@ +define(["Backbone"], function (Backbone) { + + var DBType = Backbone.Model.extend({ + defaults: { + "sample_fragment":"", + "notes":"", + "simple_name": "", + "full_name": "", + "selected": false, + "context": "host", + "className": "" + } + }); + + return DBType; + +});
\ No newline at end of file diff --git a/src/main/webapp/javascripts/fiddle_backbone/models/DBTypesList.js b/src/main/webapp/javascripts/fiddle_backbone/models/DBTypesList.js new file mode 100644 index 0000000..b064537 --- /dev/null +++ b/src/main/webapp/javascripts/fiddle_backbone/models/DBTypesList.js @@ -0,0 +1,26 @@ +define(["Backbone", "fiddle_backbone/models/DBType"], function (Backbone, DBType) { + + var DBTypesList = Backbone.Collection.extend({ + model: DBType, + getSelectedType: function () { + var selectedType = this.filter(function (dbType) { + return dbType.get("selected"); + }); + if (selectedType.length) + return selectedType[0]; + else + return false; + }, + setSelectedType: function (db_type_id, silentSelected) { + this.each(function (dbType) { + dbType.set({"selected": (dbType.id == db_type_id)}, {silent: true}); + }); + if (! silentSelected) + this.trigger("change"); + } + + }); + + return DBTypesList; + +});
\ No newline at end of file diff --git a/src/main/webapp/javascripts/fiddle_backbone/models/MyFiddleHistory.js b/src/main/webapp/javascripts/fiddle_backbone/models/MyFiddleHistory.js new file mode 100644 index 0000000..d7cffce --- /dev/null +++ b/src/main/webapp/javascripts/fiddle_backbone/models/MyFiddleHistory.js @@ -0,0 +1,54 @@ +define(["Backbone", "fiddle_backbone/models/UsedFiddle"], function (Backbone, UsedFiddle) { + + var MyFiddleHistory = Backbone.Collection.extend({ + model: UsedFiddle, + comparator: function (m1,m2) { + if (m1.get("last_used") == m2.get("last_used")) + return 0; + else if (m1.get("last_used") > m2.get("last_used")) + return -1; + else + return 1; + }, + insert: function (uf) { + if (! $("#user_choices", this).length) // simple way to detect if we are logged in + { + var existingFiddle = this.find(function (m){ + return m.get("fragment") == uf.get("fragment"); + }); + + if (existingFiddle) + { + existingFiddle.set("last_used", uf.get("last_used")); + this.sort(); + } + else + { + this.add(uf); + } + this.trigger("change"); + } + }, + initialize: function () { + try + { + if (localStorage) + { + var historyJSON = localStorage.getItem("fiddleHistory"); + if (historyJSON && historyJSON.length) + { + this.add($.parseJSON(historyJSON)); + } + + } + } + catch (e) + { + // I guess localStorage isn't available + } + } + }); + + return MyFiddleHistory; + +});
\ No newline at end of file diff --git a/src/main/webapp/javascripts/fiddle_backbone/models/Query.js b/src/main/webapp/javascripts/fiddle_backbone/models/Query.js new file mode 100644 index 0000000..2b6bd45 --- /dev/null +++ b/src/main/webapp/javascripts/fiddle_backbone/models/Query.js @@ -0,0 +1,86 @@ +define(["jQuery", "Backbone"], function ($, Backbone) { + + var Query = Backbone.Model.extend({ + + defaults: { + "id": 0, + "sql": "", + "sets": [], + "pendingChanges": false, + "statement_separator": ";" + }, + reset: function () { + this.set(this.defaults); + this.trigger("reloaded"); + }, + execute: function () { + + var thisModel = this; + + if (! this.has("schemaDef") || + ! this.get("schemaDef").has("dbType") || + ! this.get("schemaDef").get("ready") ) + { return false; } + + $.ajax({ + + type: "POST", + url: "index.cfm/fiddles/runQuery", + data: { + db_type_id: this.get("schemaDef").get("dbType").id, + schema_short_code: this.get("schemaDef").get("short_code"), + statement_separator: this.get("statement_separator"), + sql: this.get("sql") + }, + dataType: "json", + success: function (resp, textStatus, jqXHR) { + if (thisModel.get("schemaDef").get("dbType").get("context") == "browser") + { + thisModel.get("schemaDef").get("browserEngines")[thisModel.get("schemaDef").get("dbType").get("className")].executeQuery({ + sql: thisModel.get("sql"), + statement_separator: thisModel.get("statement_separator"), + success: function (sets) { + thisModel.set({ + "id": resp["ID"], + "sets": sets + }); + thisModel.trigger("executed"); + }, + error: function (e) { + thisModel.set({ + "sets": [{ + "SUCCEEDED": false, + "ERRORMESSAGE": e + }] + }); + thisModel.trigger("executed"); + } + }); + } + else + { + thisModel.set({ + "id": resp["ID"], + "sets": resp["sets"] + }); + } + }, + error: function (jqXHR, textStatus, errorThrown) + { + thisModel.set({ + "sets": [] + }); + }, + complete: function (jqXHR, textStatus) + { + thisModel.trigger("executed"); + } + }); + + } + + }); + + return Query; + +}); diff --git a/src/main/webapp/javascripts/fiddle_backbone/models/SchemaDef.js b/src/main/webapp/javascripts/fiddle_backbone/models/SchemaDef.js new file mode 100644 index 0000000..5f94145 --- /dev/null +++ b/src/main/webapp/javascripts/fiddle_backbone/models/SchemaDef.js @@ -0,0 +1,126 @@ +define(["Backbone"], function (Backbone) { + + var SchemaDef = Backbone.Model.extend({ + + defaults: { + "ddl":"", + "short_code":"", + "simple_name": "", + "full_name": "", + "valid": true, + "errorMessage": "", + "loading": false, + "ready": false, + "schema_structure": [], + "statement_separator": ";", + "browserEngines": {} + }, + reset: function () { + this.set(this.defaults); + this.trigger("reloaded"); + }, + build: function (dbTypes) { + var selectedDBType = dbTypes.getSelectedType(); + var thisModel = this; + if (!selectedDBType) + return false; + + if (!this.has("dbType") || this.get("dbType").id != selectedDBType.id) + this.set("dbType", selectedDBType); + + $.ajax({ + type: "POST", + url: "index.cfm/fiddles/createSchema", + data: { + statement_separator: this.get('statement_separator'), + db_type_id: this.get('dbType').id, + schema_ddl: this.get('ddl') + }, + dataType: "json", + success: function (data, textStatus, jqXHR) { + if (data["short_code"]) + { + if (selectedDBType.get("context") == "browser") + { + thisModel.get("browserEngines")[selectedDBType.get("className")].buildSchema({ + + short_code: $.trim(data["short_code"]), + statement_separator: thisModel.get('statement_separator'), + ddl: thisModel.get('ddl'), + success: function () { + thisModel.set({ + "short_code": $.trim(data["short_code"]), + "ready": true, + "valid": true, + "errorMessage": "" + }); + + thisModel.get("browserEngines")[selectedDBType.get("className")].getSchemaStructure({ + callback: function (schemaStruct) { + thisModel.set({ + "schema_structure": schemaStruct + }); + thisModel.trigger("built"); + } + }); + + }, + error: function (message) { + thisModel.set({ + "short_code": $.trim(data["short_code"]), + "ready": false, + "valid": false, + "errorMessage": message, + "schema_structure": [] + }); + thisModel.trigger("failed"); + } + + }); + } + else + { + thisModel.set({ + "short_code": $.trim(data["short_code"]), + "ready": true, + "valid": true, + "errorMessage": "", + "schema_structure": data["schema_structure"] + }); + + thisModel.trigger("built"); + } + + } + else + { + thisModel.set({ + "short_code": "", + "ready": false, + "valid": false, + "errorMessage": data["error"], + "schema_structure": [] + }); + thisModel.trigger("failed"); + } + }, + error: function (jqXHR, textStatus, errorThrown) + { + thisModel.set({ + "short_code": "", + "ready": false, + "valid": false, + "errorMessage": errorThrown, + "schema_structure": [] + }); + thisModel.trigger("failed"); + + } + }); + + } + }); + + return SchemaDef; + +});
\ No newline at end of file diff --git a/src/main/webapp/javascripts/fiddle_backbone/models/UsedFiddle.js b/src/main/webapp/javascripts/fiddle_backbone/models/UsedFiddle.js new file mode 100644 index 0000000..5cb6b84 --- /dev/null +++ b/src/main/webapp/javascripts/fiddle_backbone/models/UsedFiddle.js @@ -0,0 +1,17 @@ +define(["Backbone"], function (Backbone) { + + var UsedFiddle = Backbone.Model.extend({ + defaults: { + "fragment": "", + "full_name": "", + "ddl": "", + "sql": "" + }, + initialize: function () { + this.set("last_used", new Date()); + } + }); + + return UsedFiddle; + +}); diff --git a/src/main/webapp/javascripts/fiddle_backbone/router.js b/src/main/webapp/javascripts/fiddle_backbone/router.js new file mode 100644 index 0000000..7bb3d36 --- /dev/null +++ b/src/main/webapp/javascripts/fiddle_backbone/router.js @@ -0,0 +1,294 @@ +define([ + 'jQuery', + 'Underscore', + 'Backbone', + "libs/renderTerminator", + "fiddle_backbone/models/UsedFiddle" +], function($, _, Backbone, renderTerminator, UsedFiddle){ + + var initialize = function(dbTypes, schemaDef, query, myFiddleHistory, dbTypesListView) { + + var Router = Backbone.Router.extend({ + + routes: { + "!:db_type_id": "DBType", // #!1 + "!:db_type_id/:short_code":"SchemaDef", // #!1/abc12 + "!:db_type_id/:short_code/:query_id":"Query", // #!1/abc12/1 + "!:db_type_id/:short_code/:query_id/:set_id":"SetAnchor" // #!1/abc12/1/1 + }, + + DBType: function (db_type_id) { + // update currently-selected dbtype + dbTypes.setSelectedType(db_type_id, true); + dbTypesListView.render(); + }, + + SchemaDef: function (db_type_id, short_code) { + this.loadContent(db_type_id, "!" + db_type_id + "/" + short_code); + }, + + Query: function (db_type_id, short_code, query_id) { + this.loadContent(db_type_id, "!" + db_type_id + "/" + short_code + "/" + query_id); + }, + SetAnchor: function (db_type_id, short_code, query_id, set_id) { + + var selectSet = function () { + if ($("#set_" + set_id).length) + { + window.scrollTo(0,$("#set_" + set_id).offset()["top"]-50); + $("#set_" + set_id).addClass("highlight"); + } + }; + + if ( + !dbTypes.getSelectedType() || + dbTypes.getSelectedType().get("id") != db_type_id || + schemaDef.get("short_code") != short_code || + query.get("id") != query_id + ) + { + query.bind("reloaded", _.once(selectSet)); + this.loadContent(db_type_id, "!" + db_type_id + "/" + short_code + "/" + query_id); + } + else + { + $(".set").removeClass("highlight"); + selectSet(); + } + }, + + loadContent: function (db_type_id,frag) { + + this.DBType(db_type_id); + + if (query.get("pendingChanges") && !confirm("Warning! You have made changes to your query which will be lost. Continue?'")) + return false; + + schemaDef.set("loading", true); + + $(".helpTip").css("display", "none"); + $("body").block({ message: "Loading..."}); + + $.getJSON("index.cfm/fiddles/loadContent", {fragment: frag}, function (resp) { + schemaDef.set("loading", false); + + if (resp["short_code"]) + { + + var selectedDBType = dbTypes.getSelectedType(); + + if (selectedDBType.get("context") == "browser") + { + if ( + selectedDBType.get("className") == "sqljs" && + schemaDef.get("browserEngines")["websql"].nativeSQLite + ) + { + if (confirm("Fiddle originally built with SQL.js, but you have WebSQL available - would you like to use that instead (it'll be faster to load)?")) + { + dbTypes.setSelectedType($("#db_type_id a:contains('WebSQL')").closest('li').attr('db_type_id')); + selectedDBType = dbTypes.getSelectedType(); + schemaDef.set({ + "ddl": resp["ddl"], + "dbType": selectedDBType, + "statement_separator": resp["schema_statement_separator"] + }); + if (resp["sql"]) + { + query.set({ + "schemaDef": schemaDef, + "sql": resp["sql"], + "statement_separator": resp["query_statement_separator"] + }); + schemaDef.on("built", _.once(function () { + query.execute(); + })); + + } + schemaDef.build(dbTypes); + + + } + } + + schemaDef.get("browserEngines")[selectedDBType.get("className")].buildSchema({ + + short_code: $.trim(resp["short_code"]), + statement_separator: resp["schema_statement_separator"], + ddl: resp["ddl"], + success: function () { + + schemaDef.set({ + "short_code": resp["short_code"], + "ddl": resp["ddl"], + "ready": true, + "valid": true, + "errorMessage": "", + "statement_separator": resp["schema_statement_separator"], + "dbType": dbTypes.getSelectedType() + }); + renderTerminator($(".panel.schema"), resp["schema_statement_separator"]); + + if (resp["sql"]) + { + myFiddleHistory.insert(new UsedFiddle({ + "fragment": "!" + db_type_id + "/" + resp["short_code"] + "/" + resp["id"] + })); + + query.set({ + "id": resp["id"], + "sql": resp["sql"], + "statement_separator": resp["query_statement_separator"] + }); + } + else + { + myFiddleHistory.insert(new UsedFiddle({ + "fragment": "!" + db_type_id + "/" + resp["short_code"] + })); + } + + schemaDef.get("browserEngines")[selectedDBType.get("className")].getSchemaStructure({ + callback: function (schemaStruct) { + schemaDef.set({ + "schema_structure": schemaStruct + }); + + schemaDef.trigger("reloaded"); + + if (resp["sql"]) + { + schemaDef.get("browserEngines")[selectedDBType.get("className")].executeQuery({ + sql: resp["sql"], + statement_separator: resp["query_statement_separator"], + success: function (sets) { + + query.set({ + "sets": sets + }); + + query.trigger("reloaded"); + + $("body").unblock(); + }, + error: function (e) { + + query.set({ + "sets": [] + }); + + query.trigger("reloaded"); + + $("body").unblock(); + } + }); + } + else + { + $("body").unblock(); + } // end if resp["sql"] + + } + }); + + + }, + error: function (message) { + + schemaDef.set({ + "short_code": resp["short_code"], + "ddl": resp["ddl"], + "ready": true, + "valid": false, + "errorMessage": message, + "dbType": dbTypes.getSelectedType(), + "statement_separator": resp["schema_statement_separator"], + "schema_structure": [] + }); + + renderTerminator($(".panel.schema"), resp["schema_statement_separator"]); + + if (resp["sql"]) + { + query.set({ + "id": resp["id"], + "sql": resp["sql"], + "statement_separator": resp["query_statement_separator"], + "schemaDef": schemaDef + }); + query.trigger("reloaded"); + } + + schemaDef.trigger("failed"); + schemaDef.trigger("reloaded"); + + $("body").unblock(); + + } + + }); + } + else // context not "browser" + { + + schemaDef.set({ + "short_code": resp["short_code"], + "ddl": resp["ddl"], + "ready": true, + "valid": true, + "errorMessage": "", + "statement_separator": resp["schema_statement_separator"], + "schema_structure": resp["schema_structure"] + }); + renderTerminator($(".panel.schema"), resp["schema_statement_separator"]); + schemaDef.trigger("reloaded"); + + if (resp["sql"]) + { + myFiddleHistory.insert(new UsedFiddle({ + "fragment": "!" + db_type_id + "/" + resp["short_code"] + "/" + resp["id"] + })); + + query.set({ + "id": resp["id"], + "sql": resp["sql"], + "sets": resp["sets"], + "statement_separator": resp["query_statement_separator"] + }); + query.trigger("reloaded"); + } + else + { + myFiddleHistory.insert(new UsedFiddle({ + "fragment": "!" + db_type_id + "/" + resp["short_code"] + })); + } + + $("body").unblock(); + + } + + } + else + { + $("body").unblock(); + } + }); + + + } + + + }); + + var router = new Router; + Backbone.history.start({pushState: false}); + + return router; + }; + + return { + initialize: initialize + }; + +});
\ No newline at end of file diff --git a/src/main/webapp/javascripts/fiddle_backbone/templates/dbTypes.html b/src/main/webapp/javascripts/fiddle_backbone/templates/dbTypes.html new file mode 100644 index 0000000..e5a4997 --- /dev/null +++ b/src/main/webapp/javascripts/fiddle_backbone/templates/dbTypes.html @@ -0,0 +1,8 @@ + <a class="dropdown-toggle" data-toggle="dropdown" href="#"> + {{selectedFullName}} <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + {{#each dbTypes}} + <li db_type_id="{{this.id}}" class="{{this.className}}"><a href="#"><i class="icon-tag"></i>{{this.full_name}}</a></li> + {{/each}} + </ul> diff --git a/src/main/webapp/javascripts/fiddle_backbone/templates/queryPlaintextOutput.html b/src/main/webapp/javascripts/fiddle_backbone/templates/queryPlaintextOutput.html new file mode 100644 index 0000000..04c04d9 --- /dev/null +++ b/src/main/webapp/javascripts/fiddle_backbone/templates/queryPlaintextOutput.html @@ -0,0 +1,50 @@ + {{#if id}} + {{#each_with_index sets}} + <div class="set" id="set_{{index}}"> + {{#if this.RESULTS.DATA.length}} + <pre class="results"> +|{{#each_simple_value_with_index this.RESULTS.COLUMNS}} {{result_display_padded ../this/RESULTS/COLUMNWIDTHS}} |{{/each_simple_value_with_index}} +-{{#each_simple_value_with_index this.RESULTS.COLUMNS}}-{{divider_display ../this/RESULTS/COLUMNWIDTHS}}--{{/each_simple_value_with_index}}{{#each this.RESULTS.DATA}} +|{{#each_simple_value_with_index this}} {{result_display_padded ../../this/RESULTS/COLUMNWIDTHS}} |{{/each_simple_value_with_index}}{{/each}} + </pre> + {{/if}} + {{#if this.SUCCEEDED}} + <div id="messages_{{index}}" class="alert alert-success database-messages"> + <i class="icon-ok"></i> + Record Count: {{this.RESULTS.DATA.length}}; Execution Time: {{this.EXECUTIONTIME}}ms + {{#if this.EXECUTIONPLAN.DATA.length}} + <a href="#executionPlan" class="executionPlanLink"><i class="icon-plus"></i>View Execution Plan</a> + {{/if}} + <a href="#!{{../../schemaDef/dbType/id}}/{{../../schemaDef/short_code}}/{{../../id}}/{{index}}" class="setLink"><i class="icon-share-alt"></i> link</a> + </div> + + {{#if this.EXECUTIONPLAN.DATA.length}} + <table class="executionPlan table table-bordered"> + <tr> + {{#each this.EXECUTIONPLAN.COLUMNS}} + <th>{{this}}</th> + {{/each}} + </tr> + {{#each this.EXECUTIONPLAN.DATA}} + <tr> + {{#each this}} + <td><div style="position:relative">{{{this}}}</div></td> + {{/each}} + </tr> + {{/each}} + + {{#if ../../../schemaDef/dbType/isSQLServer}} + <tr> + <td><a href="index.cfm/Fiddles/getSQLPlan?db_type_id={{../../../../schemaDef/dbType/id}}&short_code={{../../../../schemaDef/short_code}}&query_id={{../../../../id}}&id={{index}}">Download .sqlplan</a></td> + </tr> + {{/if}} + + </table> + {{/if}} + + {{else}} + <div id="messages_{{index}}" class="alert alert-error database-error database-messages"><i class="icon-remove"></i>{{this.ERRORMESSAGE}}</div> + {{/if}} + </div> + {{/each_with_index}} + {{/if}} diff --git a/src/main/webapp/javascripts/fiddle_backbone/templates/queryTabularOutput.html b/src/main/webapp/javascripts/fiddle_backbone/templates/queryTabularOutput.html new file mode 100644 index 0000000..3670320 --- /dev/null +++ b/src/main/webapp/javascripts/fiddle_backbone/templates/queryTabularOutput.html @@ -0,0 +1,59 @@ + {{#if id}} + {{#each_with_index sets}} + <div class="set" id="set_{{index}}"> + {{#if this.RESULTS.DATA.length}} + <table class="results table table-bordered table-striped"> + <tr> + {{#each this.RESULTS.COLUMNS}} + <th>{{this}}</th> + {{/each}} + </tr> + {{#each this.RESULTS.DATA}} + <tr> + {{#each this}} + <td>{{result_display this this}}</td> + {{/each}} + </tr> + {{/each}} + </table> + {{/if}} + {{#if this.SUCCEEDED}} + <div id="messages_{{index}}" class="alert alert-success database-messages"> + <i class="icon-ok"></i> + Record Count: {{this.RESULTS.DATA.length}}; Execution Time: {{this.EXECUTIONTIME}}ms + {{#if this.EXECUTIONPLAN.DATA.length}} + <a href="#executionPlan" class="executionPlanLink"><i class="icon-plus"></i>View Execution Plan</a> + {{/if}} + <a href="#!{{../../schemaDef/dbType/id}}/{{../../schemaDef/short_code}}/{{../../id}}/{{index}}" class="setLink"><i class="icon-share-alt"></i> link</a> + </div> + + {{#if this.EXECUTIONPLAN.DATA.length}} + <table class="executionPlan table table-bordered"> + <tr> + {{#each this.EXECUTIONPLAN.COLUMNS}} + <th>{{this}}</th> + {{/each}} + </tr> + {{#each this.EXECUTIONPLAN.DATA}} + <tr> + {{#each this}} + <td><div style="position:relative">{{{this}}}</div></td> + {{/each}} + </tr> + {{/each}} + + {{#if ../../../schemaDef/dbType/isSQLServer}} + <tr> + <td><a href="index.cfm/Fiddles/getSQLPlan?db_type_id={{../../../../schemaDef/dbType/id}}&short_code={{../../../../schemaDef/short_code}}&query_id={{../../../../id}}&id={{index}}">Download .sqlplan</a> | <a href="http://www.sqlsentry.net/plan-explorer/sql-server-query-view.asp?ad=201208-sqlfiddle-pe" target="_new">Download SQL Sentry Plan Explorer (free)</a></td> + </tr> + {{/if}} + + </table> + {{/if}} + + {{else}} + <div id="messages_{{index}}" class="alert alert-error database-messages"><i class="icon-remove"></i>{{this.ERRORMESSAGE}}</div> + {{/if}} + </div> + {{/each_with_index}} + {{/if}}
\ No newline at end of file diff --git a/src/main/webapp/javascripts/fiddle_backbone/templates/schemaBrowser.html b/src/main/webapp/javascripts/fiddle_backbone/templates/schemaBrowser.html new file mode 100644 index 0000000..cdee721 --- /dev/null +++ b/src/main/webapp/javascripts/fiddle_backbone/templates/schemaBrowser.html @@ -0,0 +1,13 @@ + <h3>Schema Browser</h3> + <ul class="tables"> + {{#each objects}} + <li> + <a href="#{{this.table_name}}"><i class="icon-plus"></i> {{this.table_name}}</a> ({{this.table_type}}) + <ul class="columns"> + {{#each this.columns}} + <li>{{name}} {{type}}</li> + {{/each}} + </ul> + </li> + {{/each}} + </ul> diff --git a/src/main/webapp/javascripts/fiddle_backbone/templates/schemaOutput.html b/src/main/webapp/javascripts/fiddle_backbone/templates/schemaOutput.html new file mode 100644 index 0000000..1cff2a6 --- /dev/null +++ b/src/main/webapp/javascripts/fiddle_backbone/templates/schemaOutput.html @@ -0,0 +1,5 @@ + {{#if errorMessage}} + <div class="alert alert-error database-error database-messages"><i class="icon-remove"></i>{{errorMessage}}</div> + {{else}} + <div class="alert alert-success database-messages"><i class="icon-ok"></i>Schema Ready</div> + {{/if}} diff --git a/src/main/webapp/javascripts/fiddle_backbone/views/DBTypesList.js b/src/main/webapp/javascripts/fiddle_backbone/views/DBTypesList.js new file mode 100644 index 0000000..012a099 --- /dev/null +++ b/src/main/webapp/javascripts/fiddle_backbone/views/DBTypesList.js @@ -0,0 +1,37 @@ +define (["jQuery", "Backbone", "Handlebars", "text!fiddle_backbone/templates/dbTypes.html"], + function ($,Backbone,Handlebars,dbTypesTemplate) { + + var DBTypesListView = Backbone.View.extend({ + initialize: function () { + this.compiledTemplate = Handlebars.compile(dbTypesTemplate); + }, + events: { + "click ul.dropdown-menu li": "clickDBType" + }, + clickDBType: function (e) { + e.preventDefault(); + this.collection.setSelectedType($(e.currentTarget).attr("db_type_id")); + }, + render: function () { + var selectedDBType = this.collection.getSelectedType(); + + $(this.el).html( + this.compiledTemplate({ + dbTypes: this.collection.map(function (dbType) { + var json = dbType.toJSON(); + json.className = (json.selected ? "active" : ""); + return json; + }), + selectedFullName: selectedDBType.get("full_name") + }) + ); + + $("#db_type_label_collapsed .navbar-text").text(selectedDBType.get("full_name")); + + return this; + } + }); + + return DBTypesListView; + +}); diff --git a/src/main/webapp/javascripts/fiddle_backbone/views/Query.js b/src/main/webapp/javascripts/fiddle_backbone/views/Query.js new file mode 100644 index 0000000..f5f78d2 --- /dev/null +++ b/src/main/webapp/javascripts/fiddle_backbone/views/Query.js @@ -0,0 +1,120 @@ +define ([ + "jQuery", + "Backbone", + "Handlebars", + "FiddleEditor", + "libs/renderTerminator", + 'XPlans/oracle/loadswf', + 'XPlans/mssql', + "text!fiddle_backbone/templates/queryTabularOutput.html", + "text!fiddle_backbone/templates/queryPlaintextOutput.html", + 'HandlebarsHelpers/divider_display', + 'HandlebarsHelpers/each_simple_value_with_index', + 'HandlebarsHelpers/each_with_index', + 'HandlebarsHelpers/result_display_padded', + 'HandlebarsHelpers/result_display' + ], + function ($,Backbone,Handlebars,fiddleEditor,renderTerminator,loadswf,QP,tabTemplate,plainTemplate) { + + + var QueryView = Backbone.View.extend({ + + initialize: function () { + + this.editor = new fiddleEditor(this.id,this.handleQueryChange, this); + this.outputType = "tabular"; + this.compiledOutputTemplate = {}; + this.compiledOutputTemplate["tabular"] = Handlebars.compile(tabTemplate); + this.compiledOutputTemplate["plaintext"] = Handlebars.compile(plainTemplate); + + }, + setOutputType: function (type) { + this.outputType = type; + }, + handleQueryChange: function () { + + var schemaDef = this.model.get("schemaDef"); + + this.model.set({ + "sql":this.editor.getValue() + }); + $(".sql .helpTip").css("display", (!schemaDef.get("ready") || schemaDef.get("loading") || this.model.get("sql").length) ? "none" : "block"); + }, + render: function () { + this.editor.setValue(this.model.get("sql")); + + if (this.model.id) + this.renderOutput(); + + renderTerminator($(".panel.sql"), this.model.get("statement_separator")); + }, + renderOutput: function() { + var thisModel = this.model; + var inspectedData = this.model.toJSON(); + + /* This loop determines the max width of each column, so it can be padded appropriately (if needed) */ + _.each(inspectedData.sets, function (set, sidx) { + if (set.RESULTS) + { + // Initialize the column widths with the length of the headers + var columnWidths = _.map(set.RESULTS.COLUMNS, function (col) { + return col.length; + }); + + // then increase the width as needed if a bigger value is found in the data + _.each(set.RESULTS.DATA, function (row) { + columnWidths = _.map(row, function (col,cidx) { + return _.max([col.toString().length,columnWidths[cidx]]) ; + }); + }); + inspectedData.sets[sidx].RESULTS.COLUMNWIDTHS = columnWidths; + } + }); + inspectedData["schemaDef"] = this.model.get("schemaDef").toJSON(); + inspectedData["schemaDef"]["dbType"] = this.model.get("schemaDef").get("dbType").toJSON(); + inspectedData["schemaDef"]["dbType"]["isSQLServer"] = this.model.get("schemaDef").get("dbType").get("simple_name") == "SQL Server"; + + this.options.output_el.html( + this.compiledOutputTemplate[this.outputType](inspectedData) + ); + + $("script.oracle_xplan_xml").each(function () { + + $(this).siblings("div.oracle_xplan") + .html( + loadswf($(this).text()) + ); + }); + + + this.options.output_el.find("a.executionPlanLink").click(function (e) { + e.preventDefault(); + $("i", this).toggleClass("icon-minus icon-plus"); + $(this).closest(".set").find(".executionPlan").toggle(); + + if ($("i", this).hasClass("icon-minus") && + thisModel.get("schemaDef").get("dbType").get("simple_name") == 'SQL Server' + ) + { + QP.drawLines($(this).closest(".set").find(".executionPlan div")); + } + + + }); + + }, + refresh: function () { + this.editor.refresh(); + }, + checkForSelectedText: function () { + if (this.editor.somethingSelected()) + this.model.set("sql", this.editor.getSelection()); + else + this.model.set("sql", this.editor.getValue()); + } + + }); + + return QueryView; + +});
\ No newline at end of file diff --git a/src/main/webapp/javascripts/fiddle_backbone/views/SchemaDef.js b/src/main/webapp/javascripts/fiddle_backbone/views/SchemaDef.js new file mode 100644 index 0000000..5cf2283 --- /dev/null +++ b/src/main/webapp/javascripts/fiddle_backbone/views/SchemaDef.js @@ -0,0 +1,75 @@ +define (["jQuery", "Backbone", "Handlebars", "FiddleEditor", "libs/renderTerminator", + "text!fiddle_backbone/templates/schemaOutput.html", "text!fiddle_backbone/templates/schemaBrowser.html"], + function ($,Backbone,Handlebars,fiddleEditor,renderTerminator,schemaOutputTemplate,schemaBrowserTemplate) { + + var SchemaDefView = Backbone.View.extend({ + + initialize: function () { + + this.editor = new fiddleEditor(this.id,this.handleSchemaChange, this); + + this.compiledOutputTemplate = Handlebars.compile(schemaOutputTemplate); + + this.compiledSchemaBrowserTemplate = Handlebars.compile(schemaBrowserTemplate); + + }, + handleSchemaChange: function () { + + if (this.model.get("ddl") != this.editor.getValue() || this.model.get("statement_separator") != $(".panel.schema .terminator").data("statement_separator")) + { + this.model.set({ + "ddl":this.editor.getValue(), + "statement_separator":$(".panel.schema .terminator").data("statement_separator"), + "ready": false + }); + + $(".schema .helpTip").css("display", this.model.get("ddl").length ? "none" : "block"); + $(".sql .helpTip").css("display", (!this.model.get("ready") || this.model.get("loading")) ? "none" : "block"); + + } + + }, + render: function () { + this.editor.setValue(this.model.get("ddl")); + this.updateDependents(); + renderTerminator($(".panel.schema"), this.model.get("statement_separator")); + }, + renderOutput: function() { + this.options.output_el.html( + this.compiledOutputTemplate(this.model.toJSON()) + ); + }, + renderSchemaBrowser: function () { + this.options.browser_el.html( + this.compiledSchemaBrowserTemplate({ + "objects": this.model.get('schema_structure') + }) + ); + }, + refresh: function () { + this.editor.refresh(); + }, + updateDependents: function () { + + if (this.model.get("ready")) + { + $(".needsReadySchema").unblock(); + $("#schemaBrowser").attr("disabled", false); + $(".schema .helpTip").css("display", "none"); + //$(".sql .helpTip").css("display", (this.model.get('loading') || window.query.get("sql").length) ? "none" : "block"); + } + else + { + $(".needsReadySchema").block({ message: "Please build schema." }); + $("#schemaBrowser").attr("disabled", true); + $(".schema .helpTip").css("display", (this.model.get('loading') || this.model.get("ddl").length) ? "none" : "block"); + + } + + } + + }); + + return SchemaDefView; + +});
\ No newline at end of file diff --git a/src/main/webapp/javascripts/libs/backbone.js b/src/main/webapp/javascripts/libs/backbone.js new file mode 100644 index 0000000..15a74d1 --- /dev/null +++ b/src/main/webapp/javascripts/libs/backbone.js @@ -0,0 +1,1461 @@ +// Backbone.js 0.9.2 + +// (c) 2010-2012 Jeremy Ashkenas, DocumentCloud Inc. +// Backbone may be freely distributed under the MIT license. +// For all details and documentation: +// http://backbonejs.org + +(function(){ + + // Initial Setup + // ------------- + + // Save a reference to the global object (`window` in the browser, `global` + // on the server). + var root = this; + + // Save the previous value of the `Backbone` variable, so that it can be + // restored later on, if `noConflict` is used. + var previousBackbone = root.Backbone; + + // Create a local reference to splice. + var splice = Array.prototype.splice; + + // The top-level namespace. All public Backbone classes and modules will + // be attached to this. Exported for both CommonJS and the browser. + var Backbone; + if (typeof exports !== 'undefined') { + Backbone = exports; + } else { + Backbone = root.Backbone = {}; + } + + // Current version of the library. Keep in sync with `package.json`. + Backbone.VERSION = '0.9.2'; + + // Require Underscore, if we're on the server, and it's not already present. + var _ = root._; + if (!_ && (typeof require !== 'undefined')) _ = require('underscore'); + + // For Backbone's purposes, jQuery, Zepto, or Ender owns the `$` variable. + Backbone.$ = root.jQuery || root.Zepto || root.ender; + + // Runs Backbone.js in *noConflict* mode, returning the `Backbone` variable + // to its previous owner. Returns a reference to this Backbone object. + Backbone.noConflict = function() { + root.Backbone = previousBackbone; + return this; + }; + + // Turn on `emulateHTTP` to support legacy HTTP servers. Setting this option + // will fake `"PUT"` and `"DELETE"` requests via the `_method` parameter and + // set a `X-Http-Method-Override` header. + Backbone.emulateHTTP = false; + + // Turn on `emulateJSON` to support legacy servers that can't deal with direct + // `application/json` requests ... will encode the body as + // `application/x-www-form-urlencoded` instead and will send the model in a + // form param named `model`. + Backbone.emulateJSON = false; + + // Backbone.Events + // ----------------- + + // Regular expression used to split event strings + var eventSplitter = /\s+/; + + // A module that can be mixed in to *any object* in order to provide it with + // custom events. You may bind with `on` or remove with `off` callback functions + // to an event; `trigger`-ing an event fires all callbacks in succession. + // + // var object = {}; + // _.extend(object, Backbone.Events); + // object.on('expand', function(){ alert('expanded'); }); + // object.trigger('expand'); + // + var Events = Backbone.Events = { + + // Bind one or more space separated events, `events`, to a `callback` + // function. Passing `"all"` will bind the callback to all events fired. + on: function(events, callback, context) { + var calls, event, list; + if (!callback) return this; + + events = events.split(eventSplitter); + calls = this._callbacks || (this._callbacks = {}); + + while (event = events.shift()) { + list = calls[event] || (calls[event] = []); + list.push(callback, context); + } + + return this; + }, + + // Remove one or many callbacks. If `context` is null, removes all callbacks + // with that function. If `callback` is null, removes all callbacks for the + // event. If `events` is null, removes all bound callbacks for all events. + off: function(events, callback, context) { + var event, calls, list, i; + + // No events, or removing *all* events. + if (!(calls = this._callbacks)) return this; + if (!(events || callback || context)) { + delete this._callbacks; + return this; + } + + events = events ? events.split(eventSplitter) : _.keys(calls); + + // Loop through the callback list, splicing where appropriate. + while (event = events.shift()) { + if (!(list = calls[event]) || !(callback || context)) { + delete calls[event]; + continue; + } + + for (i = list.length - 2; i >= 0; i -= 2) { + if (!(callback && list[i] !== callback || context && list[i + 1] !== context)) { + list.splice(i, 2); + } + } + } + + return this; + }, + + // Trigger one or many events, firing all bound callbacks. Callbacks are + // passed the same arguments as `trigger` is, apart from the event name + // (unless you're listening on `"all"`, which will cause your callback to + // receive the true name of the event as the first argument). + trigger: function(events) { + var event, calls, list, i, length, args, all, rest; + if (!(calls = this._callbacks)) return this; + + rest = []; + events = events.split(eventSplitter); + for (i = 1, length = arguments.length; i < length; i++) { + rest[i - 1] = arguments[i]; + } + + // For each event, walk through the list of callbacks twice, first to + // trigger the event, then to trigger any `"all"` callbacks. + while (event = events.shift()) { + // Copy callback lists to prevent modification. + if (all = calls.all) all = all.slice(); + if (list = calls[event]) list = list.slice(); + + // Execute event callbacks. + if (list) { + for (i = 0, length = list.length; i < length; i += 2) { + list[i].apply(list[i + 1] || this, rest); + } + } + + // Execute "all" callbacks. + if (all) { + args = [event].concat(rest); + for (i = 0, length = all.length; i < length; i += 2) { + all[i].apply(all[i + 1] || this, args); + } + } + } + + return this; + } + + }; + + // Aliases for backwards compatibility. + Events.bind = Events.on; + Events.unbind = Events.off; + + // Backbone.Model + // -------------- + + // Create a new model, with defined attributes. A client id (`cid`) + // is automatically generated and assigned for you. + var Model = Backbone.Model = function(attributes, options) { + var defaults; + attributes || (attributes = {}); + if (options && options.collection) this.collection = options.collection; + if (options && options.parse) attributes = this.parse(attributes); + if (defaults = getValue(this, 'defaults')) { + attributes = _.extend({}, defaults, attributes); + } + this.attributes = {}; + this._escapedAttributes = {}; + this.cid = _.uniqueId('c'); + this.changed = {}; + this._silent = {}; + this._pending = {}; + this.set(attributes, {silent: true}); + // Reset change tracking. + this.changed = {}; + this._silent = {}; + this._pending = {}; + this._previousAttributes = _.clone(this.attributes); + this.initialize.apply(this, arguments); + }; + + // Attach all inheritable methods to the Model prototype. + _.extend(Model.prototype, Events, { + + // A hash of attributes whose current and previous value differ. + changed: null, + + // A hash of attributes that have silently changed since the last time + // `change` was called. Will become pending attributes on the next call. + _silent: null, + + // A hash of attributes that have changed since the last `'change'` event + // began. + _pending: null, + + // The default name for the JSON `id` attribute is `"id"`. MongoDB and + // CouchDB users may want to set this to `"_id"`. + idAttribute: 'id', + + // Initialize is an empty function by default. Override it with your own + // initialization logic. + initialize: function(){}, + + // Return a copy of the model's `attributes` object. + toJSON: function(options) { + return _.clone(this.attributes); + }, + + // Proxy `Backbone.sync` by default. + sync: function() { + return Backbone.sync.apply(this, arguments); + }, + + // Get the value of an attribute. + get: function(attr) { + return this.attributes[attr]; + }, + + // Get the HTML-escaped value of an attribute. + escape: function(attr) { + var html; + if (html = this._escapedAttributes[attr]) return html; + var val = this.get(attr); + return this._escapedAttributes[attr] = _.escape(val == null ? '' : '' + val); + }, + + // Returns `true` if the attribute contains a value that is not null + // or undefined. + has: function(attr) { + return this.get(attr) != null; + }, + + // Set a hash of model attributes on the object, firing `"change"` unless + // you choose to silence it. + set: function(key, value, options) { + var attrs, attr, val; + + // Handle both `"key", value` and `{key: value}` -style arguments. + if (_.isObject(key) || key == null) { + attrs = key; + options = value; + } else { + attrs = {}; + attrs[key] = value; + } + + // Extract attributes and options. + options || (options = {}); + if (!attrs) return this; + if (attrs instanceof Model) attrs = attrs.attributes; + if (options.unset) for (attr in attrs) attrs[attr] = void 0; + + // Run validation. + if (!this._validate(attrs, options)) return false; + + // Check for changes of `id`. + if (this.idAttribute in attrs) this.id = attrs[this.idAttribute]; + + var changes = options.changes = {}; + var now = this.attributes; + var escaped = this._escapedAttributes; + var prev = this._previousAttributes || {}; + + // For each `set` attribute... + for (attr in attrs) { + val = attrs[attr]; + + // If the new and current value differ, record the change. + if (!_.isEqual(now[attr], val) || (options.unset && _.has(now, attr))) { + delete escaped[attr]; + (options.silent ? this._silent : changes)[attr] = true; + } + + // Update or delete the current value. + options.unset ? delete now[attr] : now[attr] = val; + + // If the new and previous value differ, record the change. If not, + // then remove changes for this attribute. + if (!_.isEqual(prev[attr], val) || (_.has(now, attr) != _.has(prev, attr))) { + this.changed[attr] = val; + if (!options.silent) this._pending[attr] = true; + } else { + delete this.changed[attr]; + delete this._pending[attr]; + } + } + + // Fire the `"change"` events. + if (!options.silent) this.change(options); + return this; + }, + + // Remove an attribute from the model, firing `"change"` unless you choose + // to silence it. `unset` is a noop if the attribute doesn't exist. + unset: function(attr, options) { + options = _.extend({}, options, {unset: true}); + return this.set(attr, null, options); + }, + + // Clear all attributes on the model, firing `"change"` unless you choose + // to silence it. + clear: function(options) { + options = _.extend({}, options, {unset: true}); + return this.set(_.clone(this.attributes), options); + }, + + // Fetch the model from the server. If the server's representation of the + // model differs from its current attributes, they will be overriden, + // triggering a `"change"` event. + fetch: function(options) { + options = options ? _.clone(options) : {}; + var model = this; + var success = options.success; + options.success = function(resp, status, xhr) { + if (!model.set(model.parse(resp, xhr), options)) return false; + if (success) success(model, resp, options); + model.trigger('sync', model, resp, options); + }; + options.error = Backbone.wrapError(options.error, model, options); + return this.sync('read', this, options); + }, + + // Set a hash of model attributes, and sync the model to the server. + // If the server returns an attributes hash that differs, the model's + // state will be `set` again. + save: function(key, value, options) { + var attrs, current, done; + + // Handle both `("key", value)` and `({key: value})` -style calls. + if (_.isObject(key) || key == null) { + attrs = key; + options = value; + } else { + attrs = {}; + attrs[key] = value; + } + options = options ? _.clone(options) : {}; + + // If we're "wait"-ing to set changed attributes, validate early. + if (options.wait) { + if (!this._validate(attrs, options)) return false; + current = _.clone(this.attributes); + } + + // Regular saves `set` attributes before persisting to the server. + var silentOptions = _.extend({}, options, {silent: true}); + if (attrs && !this.set(attrs, options.wait ? silentOptions : options)) { + return false; + } + + // Do not persist invalid models. + if (!attrs && !this.isValid()) return false; + + // After a successful server-side save, the client is (optionally) + // updated with the server-side state. + var model = this; + var success = options.success; + options.success = function(resp, status, xhr) { + done = true; + var serverAttrs = model.parse(resp, xhr); + if (options.wait) serverAttrs = _.extend(attrs || {}, serverAttrs); + if (!model.set(serverAttrs, options)) return false; + if (success) success(model, resp, options); + model.trigger('sync', model, resp, options); + }; + + // Finish configuring and sending the Ajax request. + options.error = Backbone.wrapError(options.error, model, options); + var xhr = this.sync(this.isNew() ? 'create' : 'update', this, options); + + // When using `wait`, reset attributes to original values unless + // `success` has been called already. + if (!done && options.wait) { + this.clear(silentOptions); + this.set(current, silentOptions); + } + + return xhr; + }, + + // Destroy this model on the server if it was already persisted. + // Optimistically removes the model from its collection, if it has one. + // If `wait: true` is passed, waits for the server to respond before removal. + destroy: function(options) { + options = options ? _.clone(options) : {}; + var model = this; + var success = options.success; + + var destroy = function() { + model.trigger('destroy', model, model.collection, options); + }; + + options.success = function(resp) { + if (options.wait || model.isNew()) destroy(); + if (success) success(model, resp, options); + if (!model.isNew()) model.trigger('sync', model, resp, options); + }; + + if (this.isNew()) { + options.success(); + return false; + } + + options.error = Backbone.wrapError(options.error, model, options); + var xhr = this.sync('delete', this, options); + if (!options.wait) destroy(); + return xhr; + }, + + // Default URL for the model's representation on the server -- if you're + // using Backbone's restful methods, override this to change the endpoint + // that will be called. + url: function() { + var base = getValue(this, 'urlRoot') || getValue(this.collection, 'url') || urlError(); + if (this.isNew()) return base; + return base + (base.charAt(base.length - 1) == '/' ? '' : '/') + encodeURIComponent(this.id); + }, + + // **parse** converts a response into the hash of attributes to be `set` on + // the model. The default implementation is just to pass the response along. + parse: function(resp, xhr) { + return resp; + }, + + // Create a new model with identical attributes to this one. + clone: function() { + return new this.constructor(this.attributes); + }, + + // A model is new if it has never been saved to the server, and lacks an id. + isNew: function() { + return this.id == null; + }, + + // Call this method to manually fire a `"change"` event for this model and + // a `"change:attribute"` event for each changed attribute. + // Calling this will cause all objects observing the model to update. + change: function(options) { + options || (options = {}); + var changing = this._changing; + this._changing = true; + + // Silent changes become pending changes. + for (var attr in this._silent) this._pending[attr] = true; + + // Silent changes are triggered. + var changes = _.extend({}, options.changes, this._silent); + this._silent = {}; + for (var attr in changes) { + this.trigger('change:' + attr, this, this.get(attr), options); + } + if (changing) return this; + + // Continue firing `"change"` events while there are pending changes. + while (!_.isEmpty(this._pending)) { + this._pending = {}; + this.trigger('change', this, options); + // Pending and silent changes still remain. + for (var attr in this.changed) { + if (this._pending[attr] || this._silent[attr]) continue; + delete this.changed[attr]; + } + this._previousAttributes = _.clone(this.attributes); + } + + this._changing = false; + return this; + }, + + // Determine if the model has changed since the last `"change"` event. + // If you specify an attribute name, determine if that attribute has changed. + hasChanged: function(attr) { + if (attr == null) return !_.isEmpty(this.changed); + return _.has(this.changed, attr); + }, + + // Return an object containing all the attributes that have changed, or + // false if there are no changed attributes. Useful for determining what + // parts of a view need to be updated and/or what attributes need to be + // persisted to the server. Unset attributes will be set to undefined. + // You can also pass an attributes object to diff against the model, + // determining if there *would be* a change. + changedAttributes: function(diff) { + if (!diff) return this.hasChanged() ? _.clone(this.changed) : false; + var val, changed = false, old = this._previousAttributes; + for (var attr in diff) { + if (_.isEqual(old[attr], (val = diff[attr]))) continue; + (changed || (changed = {}))[attr] = val; + } + return changed; + }, + + // Get the previous value of an attribute, recorded at the time the last + // `"change"` event was fired. + previous: function(attr) { + if (attr == null || !this._previousAttributes) return null; + return this._previousAttributes[attr]; + }, + + // Get all of the attributes of the model at the time of the previous + // `"change"` event. + previousAttributes: function() { + return _.clone(this._previousAttributes); + }, + + // Check if the model is currently in a valid state. It's only possible to + // get into an *invalid* state if you're using silent changes. + isValid: function() { + return !this.validate || !this.validate(this.attributes); + }, + + // Run validation against the next complete set of model attributes, + // returning `true` if all is well. If a specific `error` callback has + // been passed, call that instead of firing the general `"error"` event. + _validate: function(attrs, options) { + if (options.silent || !this.validate) return true; + attrs = _.extend({}, this.attributes, attrs); + var error = this.validate(attrs, options); + if (!error) return true; + if (options && options.error) { + options.error(this, error, options); + } else { + this.trigger('error', this, error, options); + } + return false; + } + + }); + + // Backbone.Collection + // ------------------- + + // Provides a standard collection class for our sets of models, ordered + // or unordered. If a `comparator` is specified, the Collection will maintain + // its models in sort order, as they're added and removed. + var Collection = Backbone.Collection = function(models, options) { + options || (options = {}); + if (options.model) this.model = options.model; + if (options.comparator !== undefined) this.comparator = options.comparator; + this._reset(); + this.initialize.apply(this, arguments); + if (models) this.reset(models, {silent: true, parse: options.parse}); + }; + + // Define the Collection's inheritable methods. + _.extend(Collection.prototype, Events, { + + // The default model for a collection is just a **Backbone.Model**. + // This should be overridden in most cases. + model: Model, + + // Initialize is an empty function by default. Override it with your own + // initialization logic. + initialize: function(){}, + + // The JSON representation of a Collection is an array of the + // models' attributes. + toJSON: function(options) { + return this.map(function(model){ return model.toJSON(options); }); + }, + + // Proxy `Backbone.sync` by default. + sync: function() { + return Backbone.sync.apply(this, arguments); + }, + + // Add a model, or list of models to the set. Pass **silent** to avoid + // firing the `add` event for every new model. + add: function(models, options) { + var i, index, length, model, cid, id, cids = {}, ids = {}, dups = []; + options || (options = {}); + models = _.isArray(models) ? models.slice() : [models]; + + // Begin by turning bare objects into model references, and preventing + // invalid models or duplicate models from being added. + for (i = 0, length = models.length; i < length; i++) { + if (!(model = models[i] = this._prepareModel(models[i], options))) { + throw new Error("Can't add an invalid model to a collection"); + } + cid = model.cid; + id = model.id; + if (cids[cid] || this._byCid[cid] || ((id != null) && (ids[id] || this._byId[id]))) { + dups.push(i); + continue; + } + cids[cid] = ids[id] = model; + } + + // Remove duplicates. + i = dups.length; + while (i--) { + dups[i] = models.splice(dups[i], 1)[0]; + } + + // Listen to added models' events, and index models for lookup by + // `id` and by `cid`. + for (i = 0, length = models.length; i < length; i++) { + (model = models[i]).on('all', this._onModelEvent, this); + this._byCid[model.cid] = model; + if (model.id != null) this._byId[model.id] = model; + } + + // Insert models into the collection, re-sorting if needed, and triggering + // `add` events unless silenced. + this.length += length; + index = options.at != null ? options.at : this.models.length; + splice.apply(this.models, [index, 0].concat(models)); + + // Merge in duplicate models. + if (options.merge) { + for (i = 0, length = dups.length; i < length; i++) { + if (model = this._byId[dups[i].id]) { + model.set(dups[i], options); + } + } + } + + // Sort the collection if appropriate. + if (this.comparator && options.at == null) this.sort({silent: true}); + + if (options.silent) return this; + for (i = 0, length = this.models.length; i < length; i++) { + if (!cids[(model = this.models[i]).cid]) continue; + options.index = i; + model.trigger('add', model, this, options); + } + + return this; + }, + + // Remove a model, or a list of models from the set. Pass silent to avoid + // firing the `remove` event for every model removed. + remove: function(models, options) { + var i, l, index, model; + options || (options = {}); + models = _.isArray(models) ? models.slice() : [models]; + for (i = 0, l = models.length; i < l; i++) { + model = this.getByCid(models[i]) || this.get(models[i]); + if (!model) continue; + delete this._byId[model.id]; + delete this._byCid[model.cid]; + index = this.indexOf(model); + this.models.splice(index, 1); + this.length--; + if (!options.silent) { + options.index = index; + model.trigger('remove', model, this, options); + } + this._removeReference(model); + } + return this; + }, + + // Add a model to the end of the collection. + push: function(model, options) { + model = this._prepareModel(model, options); + this.add(model, options); + return model; + }, + + // Remove a model from the end of the collection. + pop: function(options) { + var model = this.at(this.length - 1); + this.remove(model, options); + return model; + }, + + // Add a model to the beginning of the collection. + unshift: function(model, options) { + model = this._prepareModel(model, options); + this.add(model, _.extend({at: 0}, options)); + return model; + }, + + // Remove a model from the beginning of the collection. + shift: function(options) { + var model = this.at(0); + this.remove(model, options); + return model; + }, + + // Slice out a sub-array of models from the collection. + slice: function(begin, end) { + return this.models.slice(begin, end); + }, + + // Get a model from the set by id. + get: function(id) { + if (id == null) return void 0; + return this._byId[id.id != null ? id.id : id]; + }, + + // Get a model from the set by client id. + getByCid: function(cid) { + return cid && this._byCid[cid.cid || cid]; + }, + + // Get the model at the given index. + at: function(index) { + return this.models[index]; + }, + + // Return models with matching attributes. Useful for simple cases of `filter`. + where: function(attrs) { + if (_.isEmpty(attrs)) return []; + return this.filter(function(model) { + for (var key in attrs) { + if (attrs[key] !== model.get(key)) return false; + } + return true; + }); + }, + + // Force the collection to re-sort itself. You don't need to call this under + // normal circumstances, as the set will maintain sort order as each item + // is added. + sort: function(options) { + options || (options = {}); + if (!this.comparator) throw new Error('Cannot sort a set without a comparator'); + var boundComparator = _.bind(this.comparator, this); + if (this.comparator.length == 1) { + this.models = this.sortBy(boundComparator); + } else { + this.models.sort(boundComparator); + } + if (!options.silent) this.trigger('reset', this, options); + return this; + }, + + // Pluck an attribute from each model in the collection. + pluck: function(attr) { + return _.map(this.models, function(model){ return model.get(attr); }); + }, + + // When you have more items than you want to add or remove individually, + // you can reset the entire set with a new list of models, without firing + // any `add` or `remove` events. Fires `reset` when finished. + reset: function(models, options) { + models || (models = []); + options || (options = {}); + for (var i = 0, l = this.models.length; i < l; i++) { + this._removeReference(this.models[i]); + } + this._reset(); + this.add(models, _.extend({silent: true}, options)); + if (!options.silent) this.trigger('reset', this, options); + return this; + }, + + // Fetch the default set of models for this collection, resetting the + // collection when they arrive. If `add: true` is passed, appends the + // models to the collection instead of resetting. + fetch: function(options) { + options = options ? _.clone(options) : {}; + if (options.parse === undefined) options.parse = true; + var collection = this; + var success = options.success; + options.success = function(resp, status, xhr) { + collection[options.add ? 'add' : 'reset'](collection.parse(resp, xhr), options); + if (success) success(collection, resp, options); + collection.trigger('sync', collection, resp, options); + }; + options.error = Backbone.wrapError(options.error, collection, options); + return this.sync('read', this, options); + }, + + // Create a new instance of a model in this collection. Add the model to the + // collection immediately, unless `wait: true` is passed, in which case we + // wait for the server to agree. + create: function(model, options) { + var coll = this; + options = options ? _.clone(options) : {}; + model = this._prepareModel(model, options); + if (!model) return false; + if (!options.wait) coll.add(model, options); + var success = options.success; + options.success = function(model, resp, options) { + if (options.wait) coll.add(model, options); + if (success) success(model, resp, options); + }; + model.save(null, options); + return model; + }, + + // **parse** converts a response into a list of models to be added to the + // collection. The default implementation is just to pass it through. + parse: function(resp, xhr) { + return resp; + }, + + // Create a new collection with an identical list of models as this one. + clone: function() { + return new this.constructor(this.models); + }, + + // Proxy to _'s chain. Can't be proxied the same way the rest of the + // underscore methods are proxied because it relies on the underscore + // constructor. + chain: function() { + return _(this.models).chain(); + }, + + // Reset all internal state. Called when the collection is reset. + _reset: function(options) { + this.length = 0; + this.models = []; + this._byId = {}; + this._byCid = {}; + }, + + // Prepare a model or hash of attributes to be added to this collection. + _prepareModel: function(attrs, options) { + if (attrs instanceof Model) { + if (!attrs.collection) attrs.collection = this; + return attrs; + } + options || (options = {}); + options.collection = this; + var model = new this.model(attrs, options); + if (!model._validate(model.attributes, options)) return false; + return model; + }, + + // Internal method to remove a model's ties to a collection. + _removeReference: function(model) { + if (this == model.collection) { + delete model.collection; + } + model.off('all', this._onModelEvent, this); + }, + + // Internal method called every time a model in the set fires an event. + // Sets need to update their indexes when models change ids. All other + // events simply proxy through. "add" and "remove" events that originate + // in other collections are ignored. + _onModelEvent: function(event, model, collection, options) { + if ((event == 'add' || event == 'remove') && collection != this) return; + if (event == 'destroy') { + this.remove(model, options); + } + if (model && event === 'change:' + model.idAttribute) { + delete this._byId[model.previous(model.idAttribute)]; + if (model.id != null) this._byId[model.id] = model; + } + this.trigger.apply(this, arguments); + } + + }); + + // Underscore methods that we want to implement on the Collection. + var methods = ['forEach', 'each', 'map', 'reduce', 'reduceRight', 'find', + 'detect', 'filter', 'select', 'reject', 'every', 'all', 'some', 'any', + 'include', 'contains', 'invoke', 'max', 'min', 'sortBy', 'sortedIndex', + 'toArray', 'size', 'first', 'initial', 'rest', 'last', 'without', 'indexOf', + 'shuffle', 'lastIndexOf', 'isEmpty', 'groupBy']; + + // Mix in each Underscore method as a proxy to `Collection#models`. + _.each(methods, function(method) { + Collection.prototype[method] = function() { + return _[method].apply(_, [this.models].concat(_.toArray(arguments))); + }; + }); + + // Backbone.Router + // ------------------- + + // Routers map faux-URLs to actions, and fire events when routes are + // matched. Creating a new one sets its `routes` hash, if not set statically. + var Router = Backbone.Router = function(options) { + options || (options = {}); + if (options.routes) this.routes = options.routes; + this._bindRoutes(); + this.initialize.apply(this, arguments); + }; + + // Cached regular expressions for matching named param parts and splatted + // parts of route strings. + var namedParam = /:\w+/g; + var splatParam = /\*\w+/g; + var escapeRegExp = /[-[\]{}()+?.,\\^$|#\s]/g; + + // Set up all inheritable **Backbone.Router** properties and methods. + _.extend(Router.prototype, Events, { + + // Initialize is an empty function by default. Override it with your own + // initialization logic. + initialize: function(){}, + + // Manually bind a single named route to a callback. For example: + // + // this.route('search/:query/p:num', 'search', function(query, num) { + // ... + // }); + // + route: function(route, name, callback) { + Backbone.history || (Backbone.history = new History); + if (!_.isRegExp(route)) route = this._routeToRegExp(route); + if (!callback) callback = this[name]; + Backbone.history.route(route, _.bind(function(fragment) { + var args = this._extractParameters(route, fragment); + callback && callback.apply(this, args); + this.trigger.apply(this, ['route:' + name].concat(args)); + Backbone.history.trigger('route', this, name, args); + }, this)); + return this; + }, + + // Simple proxy to `Backbone.history` to save a fragment into the history. + navigate: function(fragment, options) { + Backbone.history.navigate(fragment, options); + }, + + // Bind all defined routes to `Backbone.history`. We have to reverse the + // order of the routes here to support behavior where the most general + // routes can be defined at the bottom of the route map. + _bindRoutes: function() { + if (!this.routes) return; + var routes = []; + for (var route in this.routes) { + routes.unshift([route, this.routes[route]]); + } + for (var i = 0, l = routes.length; i < l; i++) { + this.route(routes[i][0], routes[i][1], this[routes[i][1]]); + } + }, + + // Convert a route string into a regular expression, suitable for matching + // against the current location hash. + _routeToRegExp: function(route) { + route = route.replace(escapeRegExp, '\\$&') + .replace(namedParam, '([^\/]+)') + .replace(splatParam, '(.*?)'); + return new RegExp('^' + route + '$'); + }, + + // Given a route, and a URL fragment that it matches, return the array of + // extracted parameters. + _extractParameters: function(route, fragment) { + return route.exec(fragment).slice(1); + } + + }); + + // Backbone.History + // ---------------- + + // Handles cross-browser history management, based on URL fragments. If the + // browser does not support `onhashchange`, falls back to polling. + var History = Backbone.History = function(options) { + this.handlers = []; + _.bindAll(this, 'checkUrl'); + this.location = options && options.location || root.location; + this.history = options && options.history || root.history; + }; + + // Cached regex for cleaning leading hashes and slashes . + var routeStripper = /^[#\/]/; + + // Cached regex for detecting MSIE. + var isExplorer = /msie [\w.]+/; + + // Cached regex for removing a trailing slash. + var trailingSlash = /\/$/; + + // Has the history handling already been started? + History.started = false; + + // Set up all inheritable **Backbone.History** properties and methods. + _.extend(History.prototype, Events, { + + // The default interval to poll for hash changes, if necessary, is + // twenty times a second. + interval: 50, + + // Gets the true hash value. Cannot use location.hash directly due to bug + // in Firefox where location.hash will always be decoded. + getHash: function(window) { + var match = (window || this).location.href.match(/#(.*)$/); + return match ? match[1] : ''; + }, + + // Get the cross-browser normalized URL fragment, either from the URL, + // the hash, or the override. + getFragment: function(fragment, forcePushState) { + if (fragment == null) { + if (this._hasPushState || !this._wantsHashChange || forcePushState) { + fragment = this.location.pathname; + var root = this.options.root.replace(trailingSlash, ''); + if (!fragment.indexOf(root)) fragment = fragment.substr(root.length); + } else { + fragment = this.getHash(); + } + } + return decodeURIComponent(fragment.replace(routeStripper, '')); + }, + + // Start the hash change handling, returning `true` if the current URL matches + // an existing route, and `false` otherwise. + start: function(options) { + if (History.started) throw new Error("Backbone.history has already been started"); + History.started = true; + + // Figure out the initial configuration. Do we need an iframe? + // Is pushState desired ... is it available? + this.options = _.extend({}, {root: '/'}, this.options, options); + this._wantsHashChange = this.options.hashChange !== false; + this._wantsPushState = !!this.options.pushState; + this._hasPushState = !!(this.options.pushState && this.history && this.history.pushState); + var fragment = this.getFragment(); + var docMode = document.documentMode; + var oldIE = (isExplorer.exec(navigator.userAgent.toLowerCase()) && (!docMode || docMode <= 7)); + + if (oldIE && this._wantsHashChange) { + this.iframe = Backbone.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo('body')[0].contentWindow; + this.navigate(fragment); + } + + // Depending on whether we're using pushState or hashes, and whether + // 'onhashchange' is supported, determine how we check the URL state. + if (this._hasPushState) { + Backbone.$(window).bind('popstate', this.checkUrl); + } else if (this._wantsHashChange && ('onhashchange' in window) && !oldIE) { + Backbone.$(window).bind('hashchange', this.checkUrl); + } else if (this._wantsHashChange) { + this._checkUrlInterval = setInterval(this.checkUrl, this.interval); + } + + // Determine if we need to change the base url, for a pushState link + // opened by a non-pushState browser. + this.fragment = fragment; + var loc = this.location; + var atRoot = (loc.pathname == this.options.root) && !loc.search; + + // If we've started off with a route from a `pushState`-enabled browser, + // but we're currently in a browser that doesn't support it... + if (this._wantsHashChange && this._wantsPushState && !this._hasPushState && !atRoot) { + this.fragment = this.getFragment(null, true); + this.location.replace(this.options.root + this.location.search + '#' + this.fragment); + // Return immediately as browser will do redirect to new url + return true; + + // Or if we've started out with a hash-based route, but we're currently + // in a browser where it could be `pushState`-based instead... + } else if (this._wantsPushState && this._hasPushState && atRoot && loc.hash) { + this.fragment = this.getHash().replace(routeStripper, ''); + this.history.replaceState({}, document.title, loc.protocol + '//' + loc.host + this.options.root + this.fragment); + } + + if (!this.options.silent) { + return this.loadUrl(); + } + }, + + // Disable Backbone.history, perhaps temporarily. Not useful in a real app, + // but possibly useful for unit testing Routers. + stop: function() { + Backbone.$(window).unbind('popstate', this.checkUrl).unbind('hashchange', this.checkUrl); + clearInterval(this._checkUrlInterval); + History.started = false; + }, + + // Add a route to be tested when the fragment changes. Routes added later + // may override previous routes. + route: function(route, callback) { + this.handlers.unshift({route: route, callback: callback}); + }, + + // Checks the current URL to see if it has changed, and if it has, + // calls `loadUrl`, normalizing across the hidden iframe. + checkUrl: function(e) { + var current = this.getFragment(); + if (current == this.fragment && this.iframe) { + current = this.getFragment(this.getHash(this.iframe)); + } + if (current == this.fragment) return false; + if (this.iframe) this.navigate(current); + this.loadUrl() || this.loadUrl(this.getHash()); + }, + + // Attempt to load the current URL fragment. If a route succeeds with a + // match, returns `true`. If no defined routes matches the fragment, + // returns `false`. + loadUrl: function(fragmentOverride) { + var fragment = this.fragment = this.getFragment(fragmentOverride); + var matched = _.any(this.handlers, function(handler) { + if (handler.route.test(fragment)) { + handler.callback(fragment); + return true; + } + }); + return matched; + }, + + // Save a fragment into the hash history, or replace the URL state if the + // 'replace' option is passed. You are responsible for properly URL-encoding + // the fragment in advance. + // + // The options object can contain `trigger: true` if you wish to have the + // route callback be fired (not usually desirable), or `replace: true`, if + // you wish to modify the current URL without adding an entry to the history. + navigate: function(fragment, options) { + if (!History.started) return false; + if (!options || options === true) options = {trigger: options}; + var frag = (fragment || '').replace(routeStripper, ''); + if (this.fragment == frag) return; + this.fragment = frag; + var url = (frag.indexOf(this.options.root) != 0 ? this.options.root : '') + frag; + + // If pushState is available, we use it to set the fragment as a real URL. + if (this._hasPushState) { + this.history[options.replace ? 'replaceState' : 'pushState']({}, document.title, url); + + // If hash changes haven't been explicitly disabled, update the hash + // fragment to store history. + } else if (this._wantsHashChange) { + this._updateHash(this.location, frag, options.replace); + if (this.iframe && (frag != this.getFragment(this.getHash(this.iframe)))) { + // Opening and closing the iframe tricks IE7 and earlier to push a + // history entry on hash-tag change. When replace is true, we don't + // want this. + if(!options.replace) this.iframe.document.open().close(); + this._updateHash(this.iframe.location, frag, options.replace); + } + + // If you've told us that you explicitly don't want fallback hashchange- + // based history, then `navigate` becomes a page refresh. + } else { + return this.location.assign(url); + } + if (options.trigger) this.loadUrl(fragment); + }, + + // Update the hash location, either replacing the current entry, or adding + // a new one to the browser history. + _updateHash: function(location, fragment, replace) { + if (replace) { + location.replace(location.href.replace(/(javascript:|#).*$/, '') + '#' + fragment); + } else { + location.hash = fragment; + } + } + }); + + // Backbone.View + // ------------- + + // Creating a Backbone.View creates its initial element outside of the DOM, + // if an existing element is not provided... + var View = Backbone.View = function(options) { + this.cid = _.uniqueId('view'); + this._configure(options || {}); + this._ensureElement(); + this.initialize.apply(this, arguments); + this.delegateEvents(); + }; + + // Cached regex to split keys for `delegate`. + var delegateEventSplitter = /^(\S+)\s*(.*)$/; + + // List of view options to be merged as properties. + var viewOptions = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName']; + + // Set up all inheritable **Backbone.View** properties and methods. + _.extend(View.prototype, Events, { + + // The default `tagName` of a View's element is `"div"`. + tagName: 'div', + + // jQuery delegate for element lookup, scoped to DOM elements within the + // current view. This should be prefered to global lookups where possible. + $: function(selector) { + return this.$el.find(selector); + }, + + // Initialize is an empty function by default. Override it with your own + // initialization logic. + initialize: function(){}, + + // **render** is the core function that your view should override, in order + // to populate its element (`this.el`), with the appropriate HTML. The + // convention is for **render** to always return `this`. + render: function() { + return this; + }, + + // Remove this view from the DOM. Note that the view isn't present in the + // DOM by default, so calling this method may be a no-op. + remove: function() { + this.$el.remove(); + return this; + }, + + // For small amounts of DOM Elements, where a full-blown template isn't + // needed, use **make** to manufacture elements, one at a time. + // + // var el = this.make('li', {'class': 'row'}, this.model.escape('title')); + // + make: function(tagName, attributes, content) { + var el = document.createElement(tagName); + if (attributes) Backbone.$(el).attr(attributes); + if (content != null) Backbone.$(el).html(content); + return el; + }, + + // Change the view's element (`this.el` property), including event + // re-delegation. + setElement: function(element, delegate) { + if (this.$el) this.undelegateEvents(); + this.$el = element instanceof Backbone.$ ? element : Backbone.$(element); + this.el = this.$el[0]; + if (delegate !== false) this.delegateEvents(); + return this; + }, + + // Set callbacks, where `this.events` is a hash of + // + // *{"event selector": "callback"}* + // + // { + // 'mousedown .title': 'edit', + // 'click .button': 'save' + // 'click .open': function(e) { ... } + // } + // + // pairs. Callbacks will be bound to the view, with `this` set properly. + // Uses event delegation for efficiency. + // Omitting the selector binds the event to `this.el`. + // This only works for delegate-able events: not `focus`, `blur`, and + // not `change`, `submit`, and `reset` in Internet Explorer. + delegateEvents: function(events) { + if (!(events || (events = getValue(this, 'events')))) return; + this.undelegateEvents(); + for (var key in events) { + var method = events[key]; + if (!_.isFunction(method)) method = this[events[key]]; + if (!method) throw new Error('Method "' + events[key] + '" does not exist'); + var match = key.match(delegateEventSplitter); + var eventName = match[1], selector = match[2]; + method = _.bind(method, this); + eventName += '.delegateEvents' + this.cid; + if (selector === '') { + this.$el.bind(eventName, method); + } else { + this.$el.delegate(selector, eventName, method); + } + } + }, + + // Clears all callbacks previously bound to the view with `delegateEvents`. + // You usually don't need to use this, but may wish to if you have multiple + // Backbone views attached to the same DOM element. + undelegateEvents: function() { + this.$el.unbind('.delegateEvents' + this.cid); + }, + + // Performs the initial configuration of a View with a set of options. + // Keys with special meaning *(model, collection, id, className)*, are + // attached directly to the view. + _configure: function(options) { + if (this.options) options = _.extend({}, this.options, options); + for (var i = 0, l = viewOptions.length; i < l; i++) { + var attr = viewOptions[i]; + if (options[attr]) this[attr] = options[attr]; + } + this.options = options; + }, + + // Ensure that the View has a DOM element to render into. + // If `this.el` is a string, pass it through `$()`, take the first + // matching element, and re-assign it to `el`. Otherwise, create + // an element from the `id`, `className` and `tagName` properties. + _ensureElement: function() { + if (!this.el) { + var attrs = _.extend({}, getValue(this, 'attributes')); + if (this.id) attrs.id = this.id; + if (this.className) attrs['class'] = this.className; + this.setElement(this.make(getValue(this, 'tagName'), attrs), false); + } else { + this.setElement(this.el, false); + } + } + + }); + + // The self-propagating extend function that Backbone classes use. + var extend = function(protoProps, classProps) { + var child = inherits(this, protoProps, classProps); + child.extend = this.extend; + return child; + }; + + // Set up inheritance for the model, collection, and view. + Model.extend = Collection.extend = Router.extend = View.extend = extend; + + // Backbone.sync + // ------------- + + // Map from CRUD to HTTP for our default `Backbone.sync` implementation. + var methodMap = { + 'create': 'POST', + 'update': 'PUT', + 'delete': 'DELETE', + 'read': 'GET' + }; + + // Override this function to change the manner in which Backbone persists + // models to the server. You will be passed the type of request, and the + // model in question. By default, makes a RESTful Ajax request + // to the model's `url()`. Some possible customizations could be: + // + // * Use `setTimeout` to batch rapid-fire updates into a single request. + // * Send up the models as XML instead of JSON. + // * Persist models via WebSockets instead of Ajax. + // + // Turn on `Backbone.emulateHTTP` in order to send `PUT` and `DELETE` requests + // as `POST`, with a `_method` parameter containing the true HTTP method, + // as well as all requests with the body as `application/x-www-form-urlencoded` + // instead of `application/json` with the model in a param named `model`. + // Useful when interfacing with server-side languages like **PHP** that make + // it difficult to read the body of `PUT` requests. + Backbone.sync = function(method, model, options) { + var type = methodMap[method]; + + // Default options, unless specified. + options || (options = {}); + + // Default JSON-request options. + var params = {type: type, dataType: 'json'}; + + // Ensure that we have a URL. + if (!options.url) { + params.url = getValue(model, 'url') || urlError(); + } + + // Ensure that we have the appropriate request data. + if (!options.data && model && (method == 'create' || method == 'update')) { + params.contentType = 'application/json'; + params.data = JSON.stringify(model); + } + + // For older servers, emulate JSON by encoding the request into an HTML-form. + if (Backbone.emulateJSON) { + params.contentType = 'application/x-www-form-urlencoded'; + params.data = params.data ? {model: params.data} : {}; + } + + // For older servers, emulate HTTP by mimicking the HTTP method with `_method` + // And an `X-HTTP-Method-Override` header. + if (Backbone.emulateHTTP) { + if (type === 'PUT' || type === 'DELETE') { + if (Backbone.emulateJSON) params.data._method = type; + params.type = 'POST'; + params.beforeSend = function(xhr) { + xhr.setRequestHeader('X-HTTP-Method-Override', type); + }; + } + } + + // Don't process data on a non-GET request. + if (params.type !== 'GET' && !Backbone.emulateJSON) { + params.processData = false; + } + + // Make the request, allowing the user to override any Ajax options. + return Backbone.ajax(_.extend(params, options)); + }; + + // Set the default implementation of `Backbone.ajax` to proxy through to `$`. + Backbone.ajax = function() { + return Backbone.$.ajax.apply(Backbone.$, arguments); + }; + + // Wrap an optional error callback with a fallback error event. + Backbone.wrapError = function(onError, originalModel, options) { + return function(model, resp) { + resp = model === originalModel ? resp : model; + if (onError) { + onError(originalModel, resp, options); + } else { + originalModel.trigger('error', originalModel, resp, options); + } + }; + }; + + // Helpers + // ------- + + // Shared empty constructor function to aid in prototype-chain creation. + var ctor = function(){}; + + // Helper function to correctly set up the prototype chain, for subclasses. + // Similar to `goog.inherits`, but uses a hash of prototype properties and + // class properties to be extended. + var inherits = function(parent, protoProps, staticProps) { + var child; + + // The constructor function for the new subclass is either defined by you + // (the "constructor" property in your `extend` definition), or defaulted + // by us to simply call the parent's constructor. + if (protoProps && protoProps.hasOwnProperty('constructor')) { + child = protoProps.constructor; + } else { + child = function(){ parent.apply(this, arguments); }; + } + + // Inherit class (static) properties from parent. + _.extend(child, parent); + + // Set the prototype chain to inherit from `parent`, without calling + // `parent`'s constructor function. + ctor.prototype = parent.prototype; + child.prototype = new ctor(); + + // Add prototype properties (instance properties) to the subclass, + // if supplied. + if (protoProps) _.extend(child.prototype, protoProps); + + // Add static properties to the constructor function, if supplied. + if (staticProps) _.extend(child, staticProps); + + // Correctly set child's `prototype.constructor`. + child.prototype.constructor = child; + + // Set a convenience property in case the parent's prototype is needed later. + child.__super__ = parent.prototype; + + return child; + }; + + // Helper function to get a value from a Backbone object as a property + // or as a function. + var getValue = function(object, prop) { + if (!(object && object[prop])) return null; + return _.isFunction(object[prop]) ? object[prop]() : object[prop]; + }; + + // Throw an error when a URL is needed, and none is supplied. + var urlError = function() { + throw new Error('A "url" property or function must be specified'); + }; + +}).call(this); diff --git a/src/main/webapp/javascripts/libs/bootstrap/bootstrap-collapse.js b/src/main/webapp/javascripts/libs/bootstrap/bootstrap-collapse.js new file mode 100644 index 0000000..fbc915b --- /dev/null +++ b/src/main/webapp/javascripts/libs/bootstrap/bootstrap-collapse.js @@ -0,0 +1,157 @@ +/* ============================================================= + * bootstrap-collapse.js v2.0.4 + * http://twitter.github.com/bootstrap/javascript.html#collapse + * ============================================================= + * Copyright 2012 Twitter, Inc. + * + * 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. + * ============================================================ */ + + +!function ($) { + + "use strict"; // jshint ;_; + + + /* COLLAPSE PUBLIC CLASS DEFINITION + * ================================ */ + + var Collapse = function (element, options) { + this.$element = $(element) + this.options = $.extend({}, $.fn.collapse.defaults, options) + + if (this.options.parent) { + this.$parent = $(this.options.parent) + } + + this.options.toggle && this.toggle() + } + + Collapse.prototype = { + + constructor: Collapse + + , dimension: function () { + var hasWidth = this.$element.hasClass('width') + return hasWidth ? 'width' : 'height' + } + + , show: function () { + var dimension + , scroll + , actives + , hasData + + if (this.transitioning) return + + dimension = this.dimension() + scroll = $.camelCase(['scroll', dimension].join('-')) + actives = this.$parent && this.$parent.find('> .accordion-group > .in') + + if (actives && actives.length) { + hasData = actives.data('collapse') + if (hasData && hasData.transitioning) return + actives.collapse('hide') + hasData || actives.data('collapse', null) + } + + this.$element[dimension](0) + this.transition('addClass', $.Event('show'), 'shown') + this.$element[dimension](this.$element[0][scroll]) + } + + , hide: function () { + var dimension + if (this.transitioning) return + dimension = this.dimension() + this.reset(this.$element[dimension]()) + this.transition('removeClass', $.Event('hide'), 'hidden') + this.$element[dimension](0) + } + + , reset: function (size) { + var dimension = this.dimension() + + this.$element + .removeClass('collapse') + [dimension](size || 'auto') + [0].offsetWidth + + this.$element[size !== null ? 'addClass' : 'removeClass']('collapse') + + return this + } + + , transition: function (method, startEvent, completeEvent) { + var that = this + , complete = function () { + if (startEvent.type == 'show') that.reset() + that.transitioning = 0 + that.$element.trigger(completeEvent) + } + + this.$element.trigger(startEvent) + + if (startEvent.isDefaultPrevented()) return + + this.transitioning = 1 + + this.$element[method]('in') + + $.support.transition && this.$element.hasClass('collapse') ? + this.$element.one($.support.transition.end, complete) : + complete() + } + + , toggle: function () { + this[this.$element.hasClass('in') ? 'hide' : 'show']() + } + + } + + + /* COLLAPSIBLE PLUGIN DEFINITION + * ============================== */ + + $.fn.collapse = function (option) { + return this.each(function () { + var $this = $(this) + , data = $this.data('collapse') + , options = typeof option == 'object' && option + if (!data) $this.data('collapse', (data = new Collapse(this, options))) + if (typeof option == 'string') data[option]() + }) + } + + $.fn.collapse.defaults = { + toggle: true + } + + $.fn.collapse.Constructor = Collapse + + + /* COLLAPSIBLE DATA-API + * ==================== */ + + $(function () { + $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) { + var $this = $(this), href + , target = $this.attr('data-target') + || e.preventDefault() + || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 + , option = $(target).data('collapse') ? 'toggle' : $this.data() + $(target).collapse(option) + }) + }) + +}(window.jQuery);
\ No newline at end of file diff --git a/src/main/webapp/javascripts/libs/bootstrap/bootstrap-dropdown.js b/src/main/webapp/javascripts/libs/bootstrap/bootstrap-dropdown.js new file mode 100644 index 0000000..454a968 --- /dev/null +++ b/src/main/webapp/javascripts/libs/bootstrap/bootstrap-dropdown.js @@ -0,0 +1,100 @@ +/* ============================================================ + * bootstrap-dropdown.js v2.0.4 + * http://twitter.github.com/bootstrap/javascript.html#dropdowns + * ============================================================ + * Copyright 2012 Twitter, Inc. + * + * 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. + * ============================================================ */ + + +!function ($) { + + "use strict"; // jshint ;_; + + + /* DROPDOWN CLASS DEFINITION + * ========================= */ + + var toggle = '[data-toggle="dropdown"]' + , Dropdown = function (element) { + var $el = $(element).on('click.dropdown.data-api', this.toggle) + $('html').on('click.dropdown.data-api', function () { + $el.parent().removeClass('open') + }) + } + + Dropdown.prototype = { + + constructor: Dropdown + + , toggle: function (e) { + var $this = $(this) + , $parent + , selector + , isActive + + if ($this.is('.disabled, :disabled')) return + + selector = $this.attr('data-target') + + if (!selector) { + selector = $this.attr('href') + selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 + } + + $parent = $(selector) + $parent.length || ($parent = $this.parent()) + + isActive = $parent.hasClass('open') + + clearMenus() + + if (!isActive) $parent.toggleClass('open') + + return false + } + + } + + function clearMenus() { + $(toggle).parent().removeClass('open') + } + + + /* DROPDOWN PLUGIN DEFINITION + * ========================== */ + + $.fn.dropdown = function (option) { + return this.each(function () { + var $this = $(this) + , data = $this.data('dropdown') + if (!data) $this.data('dropdown', (data = new Dropdown(this))) + if (typeof option == 'string') data[option].call($this) + }) + } + + $.fn.dropdown.Constructor = Dropdown + + + /* APPLY TO STANDARD DROPDOWN ELEMENTS + * =================================== */ + + $(function () { + $('html').on('click.dropdown.data-api', clearMenus) + $('body') + .on('click.dropdown', '.dropdown form', function (e) { e.stopPropagation() }) + .on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle) + }) + +}(window.jQuery);
\ No newline at end of file diff --git a/src/main/webapp/javascripts/libs/bootstrap/bootstrap-modal.js b/src/main/webapp/javascripts/libs/bootstrap/bootstrap-modal.js new file mode 100644 index 0000000..38fd0c8 --- /dev/null +++ b/src/main/webapp/javascripts/libs/bootstrap/bootstrap-modal.js @@ -0,0 +1,218 @@ +/* ========================================================= + * bootstrap-modal.js v2.0.4 + * http://twitter.github.com/bootstrap/javascript.html#modals + * ========================================================= + * Copyright 2012 Twitter, Inc. + * + * 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. + * ========================================================= */ + + +!function ($) { + + "use strict"; // jshint ;_; + + + /* MODAL CLASS DEFINITION + * ====================== */ + + var Modal = function (content, options) { + this.options = options + this.$element = $(content) + .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)) + } + + Modal.prototype = { + + constructor: Modal + + , toggle: function () { + return this[!this.isShown ? 'show' : 'hide']() + } + + , show: function () { + var that = this + , e = $.Event('show') + + this.$element.trigger(e) + + if (this.isShown || e.isDefaultPrevented()) return + + $('body').addClass('modal-open') + + this.isShown = true + + escape.call(this) + backdrop.call(this, function () { + var transition = $.support.transition && that.$element.hasClass('fade') + + if (!that.$element.parent().length) { + that.$element.appendTo(document.body) //don't move modals dom position + } + + that.$element + .show() + + if (transition) { + that.$element[0].offsetWidth // force reflow + } + + that.$element.addClass('in') + + transition ? + that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) : + that.$element.trigger('shown') + + }) + } + + , hide: function (e) { + e && e.preventDefault() + + var that = this + + e = $.Event('hide') + + this.$element.trigger(e) + + if (!this.isShown || e.isDefaultPrevented()) return + + this.isShown = false + + $('body').removeClass('modal-open') + + escape.call(this) + + this.$element.removeClass('in') + + $.support.transition && this.$element.hasClass('fade') ? + hideWithTransition.call(this) : + hideModal.call(this) + } + + } + + + /* MODAL PRIVATE METHODS + * ===================== */ + + function hideWithTransition() { + var that = this + , timeout = setTimeout(function () { + that.$element.off($.support.transition.end) + hideModal.call(that) + }, 500) + + this.$element.one($.support.transition.end, function () { + clearTimeout(timeout) + hideModal.call(that) + }) + } + + function hideModal(that) { + this.$element + .hide() + .trigger('hidden') + + backdrop.call(this) + } + + function backdrop(callback) { + var that = this + , animate = this.$element.hasClass('fade') ? 'fade' : '' + + if (this.isShown && this.options.backdrop) { + var doAnimate = $.support.transition && animate + + this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') + .appendTo(document.body) + + if (this.options.backdrop != 'static') { + this.$backdrop.click($.proxy(this.hide, this)) + } + + if (doAnimate) this.$backdrop[0].offsetWidth // force reflow + + this.$backdrop.addClass('in') + + doAnimate ? + this.$backdrop.one($.support.transition.end, callback) : + callback() + + } else if (!this.isShown && this.$backdrop) { + this.$backdrop.removeClass('in') + + $.support.transition && this.$element.hasClass('fade')? + this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) : + removeBackdrop.call(this) + + } else if (callback) { + callback() + } + } + + function removeBackdrop() { + this.$backdrop.remove() + this.$backdrop = null + } + + function escape() { + var that = this + if (this.isShown && this.options.keyboard) { + $(document).on('keyup.dismiss.modal', function ( e ) { + e.which == 27 && that.hide() + }) + } else if (!this.isShown) { + $(document).off('keyup.dismiss.modal') + } + } + + + /* MODAL PLUGIN DEFINITION + * ======================= */ + + $.fn.modal = function (option) { + return this.each(function () { + var $this = $(this) + , data = $this.data('modal') + , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option) + if (!data) $this.data('modal', (data = new Modal(this, options))) + if (typeof option == 'string') data[option]() + else if (options.show) data.show() + }) + } + + $.fn.modal.defaults = { + backdrop: true + , keyboard: true + , show: true + } + + $.fn.modal.Constructor = Modal + + + /* MODAL DATA-API + * ============== */ + + $(function () { + $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) { + var $this = $(this), href + , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 + , option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data()) + + e.preventDefault() + $target.modal(option) + }) + }) + +}(window.jQuery);
\ No newline at end of file diff --git a/src/main/webapp/javascripts/libs/bootstrap/bootstrap-popover.js b/src/main/webapp/javascripts/libs/bootstrap/bootstrap-popover.js new file mode 100644 index 0000000..39fbe35 --- /dev/null +++ b/src/main/webapp/javascripts/libs/bootstrap/bootstrap-popover.js @@ -0,0 +1,98 @@ +/* =========================================================== + * bootstrap-popover.js v2.0.4 + * http://twitter.github.com/bootstrap/javascript.html#popovers + * =========================================================== + * Copyright 2012 Twitter, Inc. + * + * 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. + * =========================================================== */ + + +!function ($) { + + "use strict"; // jshint ;_; + + + /* POPOVER PUBLIC CLASS DEFINITION + * =============================== */ + + var Popover = function ( element, options ) { + this.init('popover', element, options) + } + + + /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js + ========================================== */ + + Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, { + + constructor: Popover + + , setContent: function () { + var $tip = this.tip() + , title = this.getTitle() + , content = this.getContent() + + $tip.find('.popover-title')[this.isHTML(title) ? 'html' : 'text'](title) + $tip.find('.popover-content > *')[this.isHTML(content) ? 'html' : 'text'](content) + + $tip.removeClass('fade top bottom left right in') + } + + , hasContent: function () { + return this.getTitle() || this.getContent() + } + + , getContent: function () { + var content + , $e = this.$element + , o = this.options + + content = $e.attr('data-content') + || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content) + + return content + } + + , tip: function () { + if (!this.$tip) { + this.$tip = $(this.options.template) + } + return this.$tip + } + + }) + + + /* POPOVER PLUGIN DEFINITION + * ======================= */ + + $.fn.popover = function (option) { + return this.each(function () { + var $this = $(this) + , data = $this.data('popover') + , options = typeof option == 'object' && option + if (!data) $this.data('popover', (data = new Popover(this, options))) + if (typeof option == 'string') data[option]() + }) + } + + $.fn.popover.Constructor = Popover + + $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, { + placement: 'right' + , content: '' + , template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>' + }) + +}(window.jQuery);
\ No newline at end of file diff --git a/src/main/webapp/javascripts/libs/bootstrap/bootstrap-tab.js b/src/main/webapp/javascripts/libs/bootstrap/bootstrap-tab.js new file mode 100644 index 0000000..d87f350 --- /dev/null +++ b/src/main/webapp/javascripts/libs/bootstrap/bootstrap-tab.js @@ -0,0 +1,135 @@ +/* ======================================================== + * bootstrap-tab.js v2.0.4 + * http://twitter.github.com/bootstrap/javascript.html#tabs + * ======================================================== + * Copyright 2012 Twitter, Inc. + * + * 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. + * ======================================================== */ + + +!function ($) { + + "use strict"; // jshint ;_; + + + /* TAB CLASS DEFINITION + * ==================== */ + + var Tab = function ( element ) { + this.element = $(element) + } + + Tab.prototype = { + + constructor: Tab + + , show: function () { + var $this = this.element + , $ul = $this.closest('ul:not(.dropdown-menu)') + , selector = $this.attr('data-target') + , previous + , $target + , e + + if (!selector) { + selector = $this.attr('href') + selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 + } + + if ( $this.parent('li').hasClass('active') ) return + + previous = $ul.find('.active a').last()[0] + + e = $.Event('show', { + relatedTarget: previous + }) + + $this.trigger(e) + + if (e.isDefaultPrevented()) return + + $target = $(selector) + + this.activate($this.parent('li'), $ul) + this.activate($target, $target.parent(), function () { + $this.trigger({ + type: 'shown' + , relatedTarget: previous + }) + }) + } + + , activate: function ( element, container, callback) { + var $active = container.find('> .active') + , transition = callback + && $.support.transition + && $active.hasClass('fade') + + function next() { + $active + .removeClass('active') + .find('> .dropdown-menu > .active') + .removeClass('active') + + element.addClass('active') + + if (transition) { + element[0].offsetWidth // reflow for transition + element.addClass('in') + } else { + element.removeClass('fade') + } + + if ( element.parent('.dropdown-menu') ) { + element.closest('li.dropdown').addClass('active') + } + + callback && callback() + } + + transition ? + $active.one($.support.transition.end, next) : + next() + + $active.removeClass('in') + } + } + + + /* TAB PLUGIN DEFINITION + * ===================== */ + + $.fn.tab = function ( option ) { + return this.each(function () { + var $this = $(this) + , data = $this.data('tab') + if (!data) $this.data('tab', (data = new Tab(this))) + if (typeof option == 'string') data[option]() + }) + } + + $.fn.tab.Constructor = Tab + + + /* TAB DATA-API + * ============ */ + + $(function () { + $('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { + e.preventDefault() + $(this).tab('show') + }) + }) + +}(window.jQuery);
\ No newline at end of file diff --git a/src/main/webapp/javascripts/libs/bootstrap/bootstrap-tooltip.js b/src/main/webapp/javascripts/libs/bootstrap/bootstrap-tooltip.js new file mode 100644 index 0000000..b476f1c --- /dev/null +++ b/src/main/webapp/javascripts/libs/bootstrap/bootstrap-tooltip.js @@ -0,0 +1,275 @@ +/* =========================================================== + * bootstrap-tooltip.js v2.0.4 + * http://twitter.github.com/bootstrap/javascript.html#tooltips + * Inspired by the original jQuery.tipsy by Jason Frame + * =========================================================== + * Copyright 2012 Twitter, Inc. + * + * 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. + * ========================================================== */ + + +!function ($) { + + "use strict"; // jshint ;_; + + + /* TOOLTIP PUBLIC CLASS DEFINITION + * =============================== */ + + var Tooltip = function (element, options) { + this.init('tooltip', element, options) + } + + Tooltip.prototype = { + + constructor: Tooltip + + , init: function (type, element, options) { + var eventIn + , eventOut + + this.type = type + this.$element = $(element) + this.options = this.getOptions(options) + this.enabled = true + + if (this.options.trigger != 'manual') { + eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus' + eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur' + this.$element.on(eventIn, this.options.selector, $.proxy(this.enter, this)) + this.$element.on(eventOut, this.options.selector, $.proxy(this.leave, this)) + } + + this.options.selector ? + (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : + this.fixTitle() + } + + , getOptions: function (options) { + options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data()) + + if (options.delay && typeof options.delay == 'number') { + options.delay = { + show: options.delay + , hide: options.delay + } + } + + return options + } + + , enter: function (e) { + var self = $(e.currentTarget)[this.type](this._options).data(this.type) + + if (!self.options.delay || !self.options.delay.show) return self.show() + + clearTimeout(this.timeout) + self.hoverState = 'in' + this.timeout = setTimeout(function() { + if (self.hoverState == 'in') self.show() + }, self.options.delay.show) + } + + , leave: function (e) { + var self = $(e.currentTarget)[this.type](this._options).data(this.type) + + if (this.timeout) clearTimeout(this.timeout) + if (!self.options.delay || !self.options.delay.hide) return self.hide() + + self.hoverState = 'out' + this.timeout = setTimeout(function() { + if (self.hoverState == 'out') self.hide() + }, self.options.delay.hide) + } + + , show: function () { + var $tip + , inside + , pos + , actualWidth + , actualHeight + , placement + , tp + + if (this.hasContent() && this.enabled) { + $tip = this.tip() + this.setContent() + + if (this.options.animation) { + $tip.addClass('fade') + } + + placement = typeof this.options.placement == 'function' ? + this.options.placement.call(this, $tip[0], this.$element[0]) : + this.options.placement + + inside = /in/.test(placement) + + $tip + .remove() + .css({ top: 0, left: 0, display: 'block' }) + .appendTo(inside ? this.$element : document.body) + + pos = this.getPosition(inside) + + actualWidth = $tip[0].offsetWidth + actualHeight = $tip[0].offsetHeight + + switch (inside ? placement.split(' ')[1] : placement) { + case 'bottom': + tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2} + break + case 'top': + tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2} + break + case 'left': + tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth} + break + case 'right': + tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width} + break + } + + $tip + .css(tp) + .addClass(placement) + .addClass('in') + } + } + + , isHTML: function(text) { + // html string detection logic adapted from jQuery + return typeof text != 'string' + || ( text.charAt(0) === "<" + && text.charAt( text.length - 1 ) === ">" + && text.length >= 3 + ) || /^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(text) + } + + , setContent: function () { + var $tip = this.tip() + , title = this.getTitle() + + $tip.find('.tooltip-inner')[this.isHTML(title) ? 'html' : 'text'](title) + $tip.removeClass('fade in top bottom left right') + } + + , hide: function () { + var that = this + , $tip = this.tip() + + $tip.removeClass('in') + + function removeWithAnimation() { + var timeout = setTimeout(function () { + $tip.off($.support.transition.end).remove() + }, 500) + + $tip.one($.support.transition.end, function () { + clearTimeout(timeout) + $tip.remove() + }) + } + + $.support.transition && this.$tip.hasClass('fade') ? + removeWithAnimation() : + $tip.remove() + } + + , fixTitle: function () { + var $e = this.$element + if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') { + $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title') + } + } + + , hasContent: function () { + return this.getTitle() + } + + , getPosition: function (inside) { + return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), { + width: this.$element[0].offsetWidth + , height: this.$element[0].offsetHeight + }) + } + + , getTitle: function () { + var title + , $e = this.$element + , o = this.options + + title = $e.attr('data-original-title') + || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) + + return title + } + + , tip: function () { + return this.$tip = this.$tip || $(this.options.template) + } + + , validate: function () { + if (!this.$element[0].parentNode) { + this.hide() + this.$element = null + this.options = null + } + } + + , enable: function () { + this.enabled = true + } + + , disable: function () { + this.enabled = false + } + + , toggleEnabled: function () { + this.enabled = !this.enabled + } + + , toggle: function () { + this[this.tip().hasClass('in') ? 'hide' : 'show']() + } + + } + + + /* TOOLTIP PLUGIN DEFINITION + * ========================= */ + + $.fn.tooltip = function ( option ) { + return this.each(function () { + var $this = $(this) + , data = $this.data('tooltip') + , options = typeof option == 'object' && option + if (!data) $this.data('tooltip', (data = new Tooltip(this, options))) + if (typeof option == 'string') data[option]() + }) + } + + $.fn.tooltip.Constructor = Tooltip + + $.fn.tooltip.defaults = { + animation: true + , placement: 'top' + , selector: false + , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' + , trigger: 'hover' + , title: '' + , delay: 0 + } + +}(window.jQuery); diff --git a/src/main/webapp/javascripts/libs/browserEngines/engines.js b/src/main/webapp/javascripts/libs/browserEngines/engines.js new file mode 100644 index 0000000..51d549c --- /dev/null +++ b/src/main/webapp/javascripts/libs/browserEngines/engines.js @@ -0,0 +1,8 @@ +define(['BrowserEngines/sqljs_driver', 'BrowserEngines/websql_driver'], function (SQLjs, WebSQL) { + + return { + sqljs: (new SQLjs), + websql: (new WebSQL) + }; + +}); diff --git a/src/main/webapp/javascripts/libs/browserEngines/sqlite_driver.js b/src/main/webapp/javascripts/libs/browserEngines/sqlite_driver.js new file mode 100644 index 0000000..dfadb95 --- /dev/null +++ b/src/main/webapp/javascripts/libs/browserEngines/sqlite_driver.js @@ -0,0 +1,72 @@ +define(function () { + + var SQLite_driver = function () { + return this; + } + + SQLite_driver.prototype.getSchemaStructure = function (args) { + /* + We are going to get the schema structure by running a special query to get back the table + definitions. We'll use that query to find the column names and types by parsing out the columns + from the create table statements. + */ + // this query gets back a result set which contains each table, along with the create table statement used + var schema_sql = "select * from sqlite_master where type IN ('table', 'view') and name != '__WebKitDatabaseInfoTable__' order by type,name"; + + var localCallback = function (resultSets) { + var colMap = {}; + var schemaStruct = []; + + for (var i in resultSets[0]["RESULTS"]["COLUMNS"]) + { + colMap[resultSets[0]["RESULTS"]["COLUMNS"][i]] = i; + } + + for (var j in resultSets[0]["RESULTS"]["DATA"]) + { + var tableDef = resultSets[0]["RESULTS"]["DATA"][j][colMap["sql"]]; + var tableName = resultSets[0]["RESULTS"]["DATA"][j][colMap["name"]]; + var tableType = resultSets[0]["RESULTS"]["DATA"][j][colMap["type"]]; + + var tableStruct = { + "table_name": tableName, + "table_type": tableType, + "columns": [] + }; + + if (tableType == "table") { // sadly, there is no easy way to get the columns back from views in WebSQL + var colsDef = /^[\s\S]*?\(([\s\S]*)\)$/.exec(tableDef)[1].split(/,\s*/); + + + for (var k in colsDef) { + var col_components = colsDef[k].replace(/(^\s*)|(\s*$)/, '').split(/\s+/); + tableStruct["columns"].push({ + "name": col_components.shift(), // first part of the col def + "type": col_components.join(' ') // rest of the col def + }) + } + } + schemaStruct.push(tableStruct); + } + + args["callback"](schemaStruct); + + } + + + // use the method available in child classes to get the results from our special query + this.executeQuery({sql: schema_sql, "success": localCallback}); + + } + + SQLite_driver.prototype.splitStatement = function (statements, separator) + { + if (! separator) separator = ";"; + var escaped_separator = separator.replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1"); + + var sArray = (statements ? statements.split(new RegExp(escaped_separator + "\s*\r?(\n|$)")) : []); + return sArray; + } + + return SQLite_driver; +});
\ No newline at end of file diff --git a/src/main/webapp/javascripts/libs/browserEngines/sqljs_driver.js b/src/main/webapp/javascripts/libs/browserEngines/sqljs_driver.js new file mode 100644 index 0000000..0576fea --- /dev/null +++ b/src/main/webapp/javascripts/libs/browserEngines/sqljs_driver.js @@ -0,0 +1,159 @@ +define(["jQuery","BrowserEngines/sqlite_driver"], function ($,SQLite_driver) { + + var SQLjs_driver = function () { + this.db = null; + return this; + } + + $.extend(SQLjs_driver.prototype,SQLite_driver.prototype); // inherit from parent class + + SQLjs_driver.prototype.buildSchema = function (args) { + + var _this = this; // preserve reference to current object through local closures + + try { + + /* + * Closure used to handle both cases of when the sql.js library + * has already been loaded, or when it has not yet been. + */ + var jsBuildSchema = function () { + + _this.db = SQL.open(); + $.each(SQLite_driver.prototype.splitStatement.call(this,args["ddl"],args["statement_separator"]), function (i, statement) { + _this.db.exec(statement); + }); + + args["success"](); + } + + // If the sql.js code isn't yet loaded, do it now. + if (window.SQL === undefined) + { + $.getScript("javascripts_static/sql.js", function (script, textStatus, jqXHR) { + jsBuildSchema(); + }).fail(function(jqxhr, settings, exception){ + args["error"]("Your browser does not work with SQL.js. Try using a different browser (Chrome, Safari, Firefox, IE 10, etc...), or a newer version of your current one."); + }); + } + else + { + if (_this.db) + { + _this.db.close(); + } + + jsBuildSchema(); + } + + } + catch (e) + { + args["error"](e); + } + + } + + SQLjs_driver.prototype.executeQuery = function (args) { + + var _this = this; // preserve reference to current object through local closures + + try { + if (! _this.db) + { + throw ("Database Schema not available!"); + } + + var returnSets = []; + + _this.db.exec("BEGIN TRANSACTION"); + + $.each(SQLite_driver.prototype.splitStatement.call(this,args["sql"],args["statement_separator"]), function (i, statement) { + if ($.trim(statement).length) { + var startTime = new Date(); + + var setArray = []; + + try { + setArray = _this.db.exec(statement); + + var thisSet = { + "SUCCEEDED": true, + "EXECUTIONTIME": (new Date()) - startTime, + "RESULTS": { + "COLUMNS": [], + "DATA": [] + }, + "EXECUTIONPLAN": { + "COLUMNS": [], + "DATA": [] + } + + }; + + if (setArray.length) { + $.each(setArray, function(rowNumber, row){ + var rowVals = []; + $.each(row, function(columnNumber, col){ + if (rowNumber == 0) { + thisSet["RESULTS"]["COLUMNS"].push(col.column); + } + rowVals.push(col.value); + }); + thisSet["RESULTS"]["DATA"].push(rowVals); + }); + } + + try { + + exectionPlanArray = _this.db.exec("EXPLAIN QUERY PLAN " + statement); + + if (exectionPlanArray.length) { + $.each(exectionPlanArray, function(rowNumber, row){ + var rowVals = []; + $.each(row, function(columnNumber, col){ + if (rowNumber == 0) { + thisSet["EXECUTIONPLAN"]["COLUMNS"].push(col.column); + } + rowVals.push(col.value); + }); + thisSet["EXECUTIONPLAN"]["DATA"].push(rowVals); + }); + } + + } + catch (e) { + // if we get an error with the execution plan, just ignore and move on. + } + + returnSets.push(thisSet); + + + } + catch (e) { + var thisSet = { + "SUCCEEDED": false, + "EXECUTIONTIME": (new Date()) - startTime, + "ERRORMESSAGE": e + }; + returnSets.push(thisSet); + return false; // breaks the each loop + } + + } + }); + + _this.db.exec("ROLLBACK TRANSACTION"); + + args["success"](returnSets); + + } + catch (e) + { + args["error"](e); + } + + } + + return SQLjs_driver; +}); diff --git a/src/main/webapp/javascripts/libs/browserEngines/websql_driver.js b/src/main/webapp/javascripts/libs/browserEngines/websql_driver.js new file mode 100644 index 0000000..e985ba5 --- /dev/null +++ b/src/main/webapp/javascripts/libs/browserEngines/websql_driver.js @@ -0,0 +1,272 @@ +define(["jQuery","BrowserEngines/sqlite_driver"], function ($,SQLite_driver) { + + var WebSQL_driver = function(){ + this.db = null; + this.ddl = []; + this.nativeSQLite = (window.openDatabase !== undefined); + return this; + }; + + $.extend(WebSQL_driver.prototype,SQLite_driver.prototype); // inherit from parent class + + WebSQL_driver.prototype.buildSchema = function (args) { + + var _this = this; // preserve reference to current object through local closures + + try { + + if (_this.nativeSQLite) + { + _this.db = openDatabase(args["short_code"], '1.0', args["short_code"], args["ddl"].length * 1024); + + _this.db.transaction(function(tx){ + + var statements = _this.splitStatement(args["ddl"],args["statement_separator"]); + _this.ddl = statements; + + var currentStatement = 0; + var statement = statements[currentStatement]; + + var sequentiallyExecute = function(tx2, result){ + if (currentStatement < statements.length-1) + { + do { + currentStatement++; + statement = statements[currentStatement]; + } while (currentStatement < statements.length-1 && statement.match(/^\s*$/)); + + if (!statement.match(/^\s*$/)) { + tx.executeSql(statement, [], sequentiallyExecute, handleFailure); + } + else + { + tx.executeSql("intentional failure used to rollback transaction"); + args["success"](); + } + + } + else + { + tx.executeSql("intentional failure used to rollback transaction"); + args["success"](); + } + }; + + var handleFailure = function (tx2, result) { + if (result.message != "not an error") // thank you safari, for this + { + args["error"](result.message); + } + else + { + args["success"](); + } + + return true; // roll back transaction + }; + + if (statement) { + tx.executeSql(statement, [], sequentiallyExecute, handleFailure); + } + else { + args["success"](); + } + }); + + } + else + { + args["error"]("SQLite (WebSQL) not available in your browser. Try either using a webkit-based browser (such as Safari or Chrome) or using the SQLite (SQL.js) database type.") + } + + } + catch (e) + { + args["error"](e); + } + + } + + + WebSQL_driver.prototype.executeQuery = function (args) { + + var _this = this; // preserve reference to current object through local closures + + try { + + if (_this.db == null ) { + throw("You need to build the schema before you can run a query."); + } + + var returnSets = []; + + _this.db.transaction(function(tx){ + + var sequentiallyExecute = function(tx2, result) { + + var thisSet = { + "SUCCEEDED": true, + "EXECUTIONTIME": (new Date()) - startTime, + "RESULTS": { + "COLUMNS": [], + "DATA": [] + }, + "EXECUTIONPLAN": { + "COLUMNS": [], + "DATA": [] + } + + }; + + for (var i = 0; i < result.rows.length; i++) { + var rowVals = []; + var item = result.rows.item(i); + + /* We can't be sure about the order of the columns returned, since they are returned as + * a simple unordered structure. So, we'll just take the order returned the from the first + * request, then just use that order for each row. + */ + if (i == 0) { + for (col in item) { + thisSet["RESULTS"]["COLUMNS"].push(col); + } + } + + for (var j = 0; j < thisSet["RESULTS"]["COLUMNS"].length; j++) { + rowVals.push(item[thisSet["RESULTS"]["COLUMNS"][j]]); + } + + thisSet["RESULTS"]["DATA"].push(rowVals); + } + + tx.executeSql("EXPLAIN QUERY PLAN " + statement, [], function (tx3, executionPlanResult) { + + for (var l = 0; l < executionPlanResult.rows.length; l++) { + var rowVals = []; + var item = executionPlanResult.rows.item(l); + + /* We can't be sure about the order of the columns returned, since they are returned as + * a simple unordered structure. So, we'll just take the order returned the from the first + * request, then just use that order for each row. + */ + if (l == 0) { + for (col in item) { + thisSet["EXECUTIONPLAN"]["COLUMNS"].push(col); + } + } + + for (var j = 0; j < thisSet["EXECUTIONPLAN"]["COLUMNS"].length; j++) { + rowVals.push(item[thisSet["EXECUTIONPLAN"]["COLUMNS"][j]]); + } + + thisSet["EXECUTIONPLAN"]["DATA"].push(rowVals); + } + + if (currentStatement > _this.ddl.length-1) + returnSets.push(thisSet); + + // executeSQL runs asynchronously, so we have to make recursive calls to handle subsequent queries in order. + if (currentStatement < (statements.length - 1)) + { + do { + currentStatement++; + statement = statements[currentStatement]; + } while (currentStatement < statements.length-1 && statement.match(/^\s*$/)); + + if (! statement.match(/^\s*$/)) + tx.executeSql(statement, [], sequentiallyExecute, handleFailure); + else + { + tx.executeSql("intentional failure used to rollback transaction"); + args["success"](returnSets); + } + + } + else + { + tx.executeSql("intentional failure used to rollback transaction"); + args["success"](returnSets); + } + + + }, + function(tx3, executionPlanResult){ + // if the explain failed, then just append the base set to the result and move on.... + + if (currentStatement > _this.ddl.length-1) + returnSets.push(thisSet); + + // executeSQL runs asynchronously, so we have to make recursive calls to handle subsequent queries in order. + if (currentStatement < (statements.length - 1)) + { + do { + currentStatement++; + statement = statements[currentStatement]; + } while (currentStatement < statements.length-1 && statement.match(/^\s*$/)); + + if (! statement.match(/^\s*$/)) + tx.executeSql(statement, [], sequentiallyExecute, handleFailure); + else + { + tx.executeSql("intentional failure used to rollback transaction"); + args["success"](returnSets); + } + } + else + { + tx.executeSql("intentional failure used to rollback transaction"); + args["success"](returnSets); + } + + + }); + + } + + var handleFailure = function (tx, result) { + if (result.message != "not an error") // thank you safari, for this + { + var thisSet = { + "SUCCEEDED": false, + "EXECUTIONTIME": (new Date()) - startTime, + "ERRORMESSAGE": result.message + }; + returnSets.push(thisSet); + } + + args["success"](returnSets); // 'success' - slightly confusing here, but in this context a failed query is still a valid result from the database + return true; // roll back transaction + } + + var setArray = [], k, stop = false; + + var statements = _this.ddl.slice(0); + + $.each(_this.splitStatement(args["sql"],args["statement_separator"]), function (i, stmt) { statements.push(stmt); }); + + var currentStatement = 0; + var statement = statements[currentStatement]; + + var startTime = new Date(); + + /* + * executeSql runs asynchronously, so I impose a semblance of synchronous-ness via recusive calls + */ + tx.executeSql(statement, [], sequentiallyExecute, handleFailure); + + + + }); + + } + catch (e) + { + args["error"](e); + } + + + } + + return WebSQL_driver; +}); + diff --git a/src/main/webapp/javascripts/libs/codemirror/codemirror.js b/src/main/webapp/javascripts/libs/codemirror/codemirror.js new file mode 100644 index 0000000..93c9839 --- /dev/null +++ b/src/main/webapp/javascripts/libs/codemirror/codemirror.js @@ -0,0 +1,3045 @@ +// All functions that need access to the editor's state live inside +// the CodeMirror function. Below that, at the bottom of the file, +// some utilities are defined. + +// CodeMirror is the only global var we claim +var CodeMirror = (function() { + // This is the function that produces an editor instance. Its + // closure is used to store the editor state. + function CodeMirror(place, givenOptions) { + // Determine effective options based on given values and defaults. + var options = {}, defaults = CodeMirror.defaults; + for (var opt in defaults) + if (defaults.hasOwnProperty(opt)) + options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt]; + + // The element in which the editor lives. + var wrapper = document.createElement("div"); + wrapper.className = "CodeMirror" + (options.lineWrapping ? " CodeMirror-wrap" : ""); + // This mess creates the base DOM structure for the editor. + wrapper.innerHTML = + '<div style="overflow: hidden; position: relative; width: 3px; height: 0px;">' + // Wraps and hides input textarea + '<textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" ' + + 'autocorrect="off" autocapitalize="off"></textarea></div>' + + '<div class="CodeMirror-scroll" tabindex="-1">' + + '<div style="position: relative">' + // Set to the height of the text, causes scrolling + '<div style="position: relative">' + // Moved around its parent to cover visible view + '<div class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div>' + + // Provides positioning relative to (visible) text origin + '<div class="CodeMirror-lines"><div style="position: relative; z-index: 0">' + + '<div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden;"></div>' + + '<pre class="CodeMirror-cursor"> </pre>' + // Absolutely positioned blinky cursor + '<div style="position: relative; z-index: -1"></div><div></div>' + // DIVs containing the selection and the actual code + '</div></div></div></div></div>'; + if (place.appendChild) place.appendChild(wrapper); else place(wrapper); + // I've never seen more elegant code in my life. + var inputDiv = wrapper.firstChild, input = inputDiv.firstChild, + scroller = wrapper.lastChild, code = scroller.firstChild, + mover = code.firstChild, gutter = mover.firstChild, gutterText = gutter.firstChild, + lineSpace = gutter.nextSibling.firstChild, measure = lineSpace.firstChild, + cursor = measure.nextSibling, selectionDiv = cursor.nextSibling, + lineDiv = selectionDiv.nextSibling; + themeChanged(); + // Needed to hide big blue blinking cursor on Mobile Safari + if (ios) input.style.width = "0px"; + if (!webkit) lineSpace.draggable = true; + lineSpace.style.outline = "none"; + if (options.tabindex != null) input.tabIndex = options.tabindex; + if (options.autofocus) focusInput(); + if (!options.gutter && !options.lineNumbers) gutter.style.display = "none"; + // Needed to handle Tab key in KHTML + if (khtml) inputDiv.style.height = "1px", inputDiv.style.position = "absolute"; + + // Check for problem with IE innerHTML not working when we have a + // P (or similar) parent node. + try { stringWidth("x"); } + catch (e) { + if (e.message.match(/runtime/i)) + e = new Error("A CodeMirror inside a P-style element does not work in Internet Explorer. (innerHTML bug)"); + throw e; + } + + // Delayed object wrap timeouts, making sure only one is active. blinker holds an interval. + var poll = new Delayed(), highlight = new Delayed(), blinker; + + // mode holds a mode API object. doc is the tree of Line objects, + // work an array of lines that should be parsed, and history the + // undo history (instance of History constructor). + var mode, doc = new BranchChunk([new LeafChunk([new Line("")])]), work, focused; + loadMode(); + // The selection. These are always maintained to point at valid + // positions. Inverted is used to remember that the user is + // selecting bottom-to-top. + var sel = {from: {line: 0, ch: 0}, to: {line: 0, ch: 0}, inverted: false}; + // Selection-related flags. shiftSelecting obviously tracks + // whether the user is holding shift. + var shiftSelecting, lastClick, lastDoubleClick, lastScrollPos = 0, draggingText, + overwrite = false, suppressEdits = false; + // Variables used by startOperation/endOperation to track what + // happened during the operation. + var updateInput, userSelChange, changes, textChanged, selectionChanged, leaveInputAlone, + gutterDirty, callbacks; + // Current visible range (may be bigger than the view window). + var displayOffset = 0, showingFrom = 0, showingTo = 0, lastSizeC = 0; + // bracketHighlighted is used to remember that a bracket has been + // marked. + var bracketHighlighted; + // Tracks the maximum line length so that the horizontal scrollbar + // can be kept static when scrolling. + var maxLine = "", maxWidth; + var tabCache = {}; + + // Initialize the content. + operation(function(){setValue(options.value || ""); updateInput = false;})(); + var history = new History(); + + // Register our event handlers. + connect(scroller, "mousedown", operation(onMouseDown)); + connect(scroller, "dblclick", operation(onDoubleClick)); + connect(lineSpace, "selectstart", e_preventDefault); + // Gecko browsers fire contextmenu *after* opening the menu, at + // which point we can't mess with it anymore. Context menu is + // handled in onMouseDown for Gecko. + if (!gecko) connect(scroller, "contextmenu", onContextMenu); + connect(scroller, "scroll", function() { + lastScrollPos = scroller.scrollTop; + updateDisplay([]); + if (options.fixedGutter) gutter.style.left = scroller.scrollLeft + "px"; + if (options.onScroll) options.onScroll(instance); + }); + connect(window, "resize", function() {updateDisplay(true);}); + connect(input, "keyup", operation(onKeyUp)); + connect(input, "input", fastPoll); + connect(input, "keydown", operation(onKeyDown)); + connect(input, "keypress", operation(onKeyPress)); + connect(input, "focus", onFocus); + connect(input, "blur", onBlur); + + if (options.dragDrop) { + connect(lineSpace, "dragstart", onDragStart); + function drag_(e) { + if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return; + e_stop(e); + } + connect(scroller, "dragenter", drag_); + connect(scroller, "dragover", drag_); + connect(scroller, "drop", operation(onDrop)); + } + connect(scroller, "paste", function(){focusInput(); fastPoll();}); + connect(input, "paste", fastPoll); + connect(input, "cut", operation(function(){ + if (!options.readOnly) replaceSelection(""); + })); + + // Needed to handle Tab key in KHTML + if (khtml) connect(code, "mouseup", function() { + if (document.activeElement == input) input.blur(); + focusInput(); + }); + + // IE throws unspecified error in certain cases, when + // trying to access activeElement before onload + var hasFocus; try { hasFocus = (document.activeElement == input); } catch(e) { } + if (hasFocus || options.autofocus) setTimeout(onFocus, 20); + else onBlur(); + + function isLine(l) {return l >= 0 && l < doc.size;} + // The instance object that we'll return. Mostly calls out to + // local functions in the CodeMirror function. Some do some extra + // range checking and/or clipping. operation is used to wrap the + // call so that changes it makes are tracked, and the display is + // updated afterwards. + var instance = wrapper.CodeMirror = { + getValue: getValue, + setValue: operation(setValue), + getSelection: getSelection, + replaceSelection: operation(replaceSelection), + focus: function(){window.focus(); focusInput(); onFocus(); fastPoll();}, + setOption: function(option, value) { + var oldVal = options[option]; + options[option] = value; + if (option == "mode" || option == "indentUnit") loadMode(); + else if (option == "readOnly" && value == "nocursor") {onBlur(); input.blur();} + else if (option == "readOnly" && !value) {resetInput(true);} + else if (option == "theme") themeChanged(); + else if (option == "lineWrapping" && oldVal != value) operation(wrappingChanged)(); + else if (option == "tabSize") updateDisplay(true); + if (option == "lineNumbers" || option == "gutter" || option == "firstLineNumber" || option == "theme") { + gutterChanged(); + updateDisplay(true); + } + }, + getOption: function(option) {return options[option];}, + undo: operation(undo), + redo: operation(redo), + indentLine: operation(function(n, dir) { + if (typeof dir != "string") { + if (dir == null) dir = options.smartIndent ? "smart" : "prev"; + else dir = dir ? "add" : "subtract"; + } + if (isLine(n)) indentLine(n, dir); + }), + indentSelection: operation(indentSelected), + historySize: function() {return {undo: history.done.length, redo: history.undone.length};}, + clearHistory: function() {history = new History();}, + matchBrackets: operation(function(){matchBrackets(true);}), + getTokenAt: operation(function(pos) { + pos = clipPos(pos); + return getLine(pos.line).getTokenAt(mode, getStateBefore(pos.line), pos.ch); + }), + getStateAfter: function(line) { + line = clipLine(line == null ? doc.size - 1: line); + return getStateBefore(line + 1); + }, + cursorCoords: function(start, mode) { + if (start == null) start = sel.inverted; + return this.charCoords(start ? sel.from : sel.to, mode); + }, + charCoords: function(pos, mode) { + pos = clipPos(pos); + if (mode == "local") return localCoords(pos, false); + if (mode == "div") return localCoords(pos, true); + return pageCoords(pos); + }, + coordsChar: function(coords) { + var off = eltOffset(lineSpace); + return coordsChar(coords.x - off.left, coords.y - off.top); + }, + markText: operation(markText), + setBookmark: setBookmark, + findMarksAt: findMarksAt, + setMarker: operation(addGutterMarker), + clearMarker: operation(removeGutterMarker), + setLineClass: operation(setLineClass), + hideLine: operation(function(h) {return setLineHidden(h, true);}), + showLine: operation(function(h) {return setLineHidden(h, false);}), + onDeleteLine: function(line, f) { + if (typeof line == "number") { + if (!isLine(line)) return null; + line = getLine(line); + } + (line.handlers || (line.handlers = [])).push(f); + return line; + }, + lineInfo: lineInfo, + addWidget: function(pos, node, scroll, vert, horiz) { + pos = localCoords(clipPos(pos)); + var top = pos.yBot, left = pos.x; + node.style.position = "absolute"; + code.appendChild(node); + if (vert == "over") top = pos.y; + else if (vert == "near") { + var vspace = Math.max(scroller.offsetHeight, doc.height * textHeight()), + hspace = Math.max(code.clientWidth, lineSpace.clientWidth) - paddingLeft(); + if (pos.yBot + node.offsetHeight > vspace && pos.y > node.offsetHeight) + top = pos.y - node.offsetHeight; + if (left + node.offsetWidth > hspace) + left = hspace - node.offsetWidth; + } + node.style.top = (top + paddingTop()) + "px"; + node.style.left = node.style.right = ""; + if (horiz == "right") { + left = code.clientWidth - node.offsetWidth; + node.style.right = "0px"; + } else { + if (horiz == "left") left = 0; + else if (horiz == "middle") left = (code.clientWidth - node.offsetWidth) / 2; + node.style.left = (left + paddingLeft()) + "px"; + } + if (scroll) + scrollIntoView(left, top, left + node.offsetWidth, top + node.offsetHeight); + }, + + lineCount: function() {return doc.size;}, + clipPos: clipPos, + getCursor: function(start) { + if (start == null) start = sel.inverted; + return copyPos(start ? sel.from : sel.to); + }, + somethingSelected: function() {return !posEq(sel.from, sel.to);}, + setCursor: operation(function(line, ch, user) { + if (ch == null && typeof line.line == "number") setCursor(line.line, line.ch, user); + else setCursor(line, ch, user); + }), + setSelection: operation(function(from, to, user) { + (user ? setSelectionUser : setSelection)(clipPos(from), clipPos(to || from)); + }), + getLine: function(line) {if (isLine(line)) return getLine(line).text;}, + getLineHandle: function(line) {if (isLine(line)) return getLine(line);}, + setLine: operation(function(line, text) { + if (isLine(line)) replaceRange(text, {line: line, ch: 0}, {line: line, ch: getLine(line).text.length}); + }), + removeLine: operation(function(line) { + if (isLine(line)) replaceRange("", {line: line, ch: 0}, clipPos({line: line+1, ch: 0})); + }), + replaceRange: operation(replaceRange), + getRange: function(from, to) {return getRange(clipPos(from), clipPos(to));}, + + triggerOnKeyDown: operation(onKeyDown), + execCommand: function(cmd) {return commands[cmd](instance);}, + // Stuff used by commands, probably not much use to outside code. + moveH: operation(moveH), + deleteH: operation(deleteH), + moveV: operation(moveV), + toggleOverwrite: function() { + if(overwrite){ + overwrite = false; + cursor.className = cursor.className.replace(" CodeMirror-overwrite", ""); + } else { + overwrite = true; + cursor.className += " CodeMirror-overwrite"; + } + }, + + posFromIndex: function(off) { + var lineNo = 0, ch; + doc.iter(0, doc.size, function(line) { + var sz = line.text.length + 1; + if (sz > off) { ch = off; return true; } + off -= sz; + ++lineNo; + }); + return clipPos({line: lineNo, ch: ch}); + }, + indexFromPos: function (coords) { + if (coords.line < 0 || coords.ch < 0) return 0; + var index = coords.ch; + doc.iter(0, coords.line, function (line) { + index += line.text.length + 1; + }); + return index; + }, + scrollTo: function(x, y) { + if (x != null) scroller.scrollLeft = x; + if (y != null) scroller.scrollTop = y; + updateDisplay([]); + }, + + operation: function(f){return operation(f)();}, + compoundChange: function(f){return compoundChange(f);}, + refresh: function(){ + updateDisplay(true); + if (scroller.scrollHeight > lastScrollPos) + scroller.scrollTop = lastScrollPos; + }, + getInputField: function(){return input;}, + getWrapperElement: function(){return wrapper;}, + getScrollerElement: function(){return scroller;}, + getGutterElement: function(){return gutter;} + }; + + function getLine(n) { return getLineAt(doc, n); } + function updateLineHeight(line, height) { + gutterDirty = true; + var diff = height - line.height; + for (var n = line; n; n = n.parent) n.height += diff; + } + + function setValue(code) { + var top = {line: 0, ch: 0}; + updateLines(top, {line: doc.size - 1, ch: getLine(doc.size-1).text.length}, + splitLines(code), top, top); + updateInput = true; + } + function getValue() { + var text = []; + doc.iter(0, doc.size, function(line) { text.push(line.text); }); + return text.join("\n"); + } + + function onMouseDown(e) { + setShift(e_prop(e, "shiftKey")); + // Check whether this is a click in a widget + for (var n = e_target(e); n != wrapper; n = n.parentNode) + if (n.parentNode == code && n != mover) return; + + // See if this is a click in the gutter + for (var n = e_target(e); n != wrapper; n = n.parentNode) + if (n.parentNode == gutterText) { + if (options.onGutterClick) + options.onGutterClick(instance, indexOf(gutterText.childNodes, n) + showingFrom, e); + return e_preventDefault(e); + } + + var start = posFromMouse(e); + + switch (e_button(e)) { + case 3: + if (gecko && !mac) onContextMenu(e); + return; + case 2: + if (start) setCursor(start.line, start.ch, true); + return; + } + // For button 1, if it was clicked inside the editor + // (posFromMouse returning non-null), we have to adjust the + // selection. + if (!start) {if (e_target(e) == scroller) e_preventDefault(e); return;} + + if (!focused) onFocus(); + + var now = +new Date; + if (lastDoubleClick && lastDoubleClick.time > now - 400 && posEq(lastDoubleClick.pos, start)) { + e_preventDefault(e); + setTimeout(focusInput, 20); + return selectLine(start.line); + } else if (lastClick && lastClick.time > now - 400 && posEq(lastClick.pos, start)) { + lastDoubleClick = {time: now, pos: start}; + e_preventDefault(e); + return selectWordAt(start); + } else { lastClick = {time: now, pos: start}; } + + var last = start, going; + if (options.dragDrop && dragAndDrop && !options.readOnly && !posEq(sel.from, sel.to) && + !posLess(start, sel.from) && !posLess(sel.to, start)) { + // Let the drag handler handle this. + if (webkit) lineSpace.draggable = true; + function dragEnd(e2) { + if (webkit) lineSpace.draggable = false; + draggingText = false; + up(); drop(); + if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) { + e_preventDefault(e2); + setCursor(start.line, start.ch, true); + focusInput(); + } + } + var up = connect(document, "mouseup", operation(dragEnd), true); + var drop = connect(scroller, "drop", operation(dragEnd), true); + draggingText = true; + // IE's approach to draggable + if (lineSpace.dragDrop) lineSpace.dragDrop(); + return; + } + e_preventDefault(e); + setCursor(start.line, start.ch, true); + + function extend(e) { + var cur = posFromMouse(e, true); + if (cur && !posEq(cur, last)) { + if (!focused) onFocus(); + last = cur; + setSelectionUser(start, cur); + updateInput = false; + var visible = visibleLines(); + if (cur.line >= visible.to || cur.line < visible.from) + going = setTimeout(operation(function(){extend(e);}), 150); + } + } + + function done(e) { + clearTimeout(going); + var cur = posFromMouse(e); + if (cur) setSelectionUser(start, cur); + e_preventDefault(e); + focusInput(); + updateInput = true; + move(); up(); + } + var move = connect(document, "mousemove", operation(function(e) { + clearTimeout(going); + e_preventDefault(e); + if (!ie && !e_button(e)) done(e); + else extend(e); + }), true); + var up = connect(document, "mouseup", operation(done), true); + } + function onDoubleClick(e) { + for (var n = e_target(e); n != wrapper; n = n.parentNode) + if (n.parentNode == gutterText) return e_preventDefault(e); + var start = posFromMouse(e); + if (!start) return; + lastDoubleClick = {time: +new Date, pos: start}; + e_preventDefault(e); + selectWordAt(start); + } + function onDrop(e) { + if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return; + e.preventDefault(); + var pos = posFromMouse(e, true), files = e.dataTransfer.files; + if (!pos || options.readOnly) return; + if (files && files.length && window.FileReader && window.File) { + function loadFile(file, i) { + var reader = new FileReader; + reader.onload = function() { + text[i] = reader.result; + if (++read == n) { + pos = clipPos(pos); + operation(function() { + var end = replaceRange(text.join(""), pos, pos); + setSelectionUser(pos, end); + })(); + } + }; + reader.readAsText(file); + } + var n = files.length, text = Array(n), read = 0; + for (var i = 0; i < n; ++i) loadFile(files[i], i); + } + else { + try { + var text = e.dataTransfer.getData("Text"); + if (text) { + compoundChange(function() { + var curFrom = sel.from, curTo = sel.to; + setSelectionUser(pos, pos); + if (draggingText) replaceRange("", curFrom, curTo); + replaceSelection(text); + focusInput(); + }); + } + } + catch(e){} + } + } + function onDragStart(e) { + var txt = getSelection(); + e.dataTransfer.setData("Text", txt); + + // Use dummy image instead of default browsers image. + if (gecko || chrome) { + var img = document.createElement('img'); + img.scr = 'data:image/gif;base64,R0lGODdhAgACAIAAAAAAAP///ywAAAAAAgACAAACAoRRADs='; //1x1 image + e.dataTransfer.setDragImage(img, 0, 0); + } + } + + function doHandleBinding(bound, dropShift) { + if (typeof bound == "string") { + bound = commands[bound]; + if (!bound) return false; + } + var prevShift = shiftSelecting; + try { + if (options.readOnly) suppressEdits = true; + if (dropShift) shiftSelecting = null; + bound(instance); + } catch(e) { + if (e != Pass) throw e; + return false; + } finally { + shiftSelecting = prevShift; + suppressEdits = false; + } + return true; + } + function handleKeyBinding(e) { + // Handle auto keymap transitions + var startMap = getKeyMap(options.keyMap), next = startMap.auto; + clearTimeout(maybeTransition); + if (next && !isModifierKey(e)) maybeTransition = setTimeout(function() { + if (getKeyMap(options.keyMap) == startMap) { + options.keyMap = (next.call ? next.call(null, instance) : next); + } + }, 50); + + var name = keyNames[e_prop(e, "keyCode")], handled = false; + if (name == null || e.altGraphKey) return false; + if (e_prop(e, "altKey")) name = "Alt-" + name; + if (e_prop(e, "ctrlKey")) name = "Ctrl-" + name; + if (e_prop(e, "metaKey")) name = "Cmd-" + name; + + var stopped = false; + function stop() { stopped = true; } + + if (e_prop(e, "shiftKey")) { + handled = lookupKey("Shift-" + name, options.extraKeys, options.keyMap, + function(b) {return doHandleBinding(b, true);}, stop) + || lookupKey(name, options.extraKeys, options.keyMap, function(b) { + if (typeof b == "string" && /^go[A-Z]/.test(b)) return doHandleBinding(b); + }, stop); + } else { + handled = lookupKey(name, options.extraKeys, options.keyMap, doHandleBinding, stop); + } + if (stopped) handled = false; + if (handled) { + e_preventDefault(e); + if (ie) { e.oldKeyCode = e.keyCode; e.keyCode = 0; } + } + return handled; + } + function handleCharBinding(e, ch) { + var handled = lookupKey("'" + ch + "'", options.extraKeys, + options.keyMap, function(b) { return doHandleBinding(b, true); }); + if (handled) e_preventDefault(e); + return handled; + } + + var lastStoppedKey = null, maybeTransition; + function onKeyDown(e) { + if (!focused) onFocus(); + if (ie && e.keyCode == 27) { e.returnValue = false; } + if (pollingFast) { if (readInput()) pollingFast = false; } + if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return; + var code = e_prop(e, "keyCode"); + // IE does strange things with escape. + setShift(code == 16 || e_prop(e, "shiftKey")); + // First give onKeyEvent option a chance to handle this. + var handled = handleKeyBinding(e); + if (window.opera) { + lastStoppedKey = handled ? code : null; + // Opera has no cut event... we try to at least catch the key combo + if (!handled && code == 88 && e_prop(e, mac ? "metaKey" : "ctrlKey")) + replaceSelection(""); + } + } + function onKeyPress(e) { + if (pollingFast) readInput(); + if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return; + var keyCode = e_prop(e, "keyCode"), charCode = e_prop(e, "charCode"); + if (window.opera && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;} + if (((window.opera && !e.which) || khtml) && handleKeyBinding(e)) return; + var ch = String.fromCharCode(charCode == null ? keyCode : charCode); + if (options.electricChars && mode.electricChars && options.smartIndent && !options.readOnly) { + if (mode.electricChars.indexOf(ch) > -1) + setTimeout(operation(function() {indentLine(sel.to.line, "smart");}), 75); + } + if (handleCharBinding(e, ch)) return; + fastPoll(); + } + function onKeyUp(e) { + if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return; + if (e_prop(e, "keyCode") == 16) shiftSelecting = null; + } + + function onFocus() { + if (options.readOnly == "nocursor") return; + if (!focused) { + if (options.onFocus) options.onFocus(instance); + focused = true; + if (wrapper.className.search(/\bCodeMirror-focused\b/) == -1) + wrapper.className += " CodeMirror-focused"; + if (!leaveInputAlone) resetInput(true); + } + slowPoll(); + restartBlink(); + } + function onBlur() { + if (focused) { + if (options.onBlur) options.onBlur(instance); + focused = false; + if (bracketHighlighted) + operation(function(){ + if (bracketHighlighted) { bracketHighlighted(); bracketHighlighted = null; } + })(); + wrapper.className = wrapper.className.replace(" CodeMirror-focused", ""); + } + clearInterval(blinker); + setTimeout(function() {if (!focused) shiftSelecting = null;}, 150); + } + + // Replace the range from from to to by the strings in newText. + // Afterwards, set the selection to selFrom, selTo. + function updateLines(from, to, newText, selFrom, selTo) { + if (suppressEdits) return; + if (history) { + var old = []; + doc.iter(from.line, to.line + 1, function(line) { old.push(line.text); }); + history.addChange(from.line, newText.length, old); + while (history.done.length > options.undoDepth) history.done.shift(); + } + updateLinesNoUndo(from, to, newText, selFrom, selTo); + } + function unredoHelper(from, to) { + if (!from.length) return; + var set = from.pop(), out = []; + for (var i = set.length - 1; i >= 0; i -= 1) { + var change = set[i]; + var replaced = [], end = change.start + change.added; + doc.iter(change.start, end, function(line) { replaced.push(line.text); }); + out.push({start: change.start, added: change.old.length, old: replaced}); + var pos = clipPos({line: change.start + change.old.length - 1, + ch: editEnd(replaced[replaced.length-1], change.old[change.old.length-1])}); + updateLinesNoUndo({line: change.start, ch: 0}, {line: end - 1, ch: getLine(end-1).text.length}, change.old, pos, pos); + } + updateInput = true; + to.push(out); + } + function undo() {unredoHelper(history.done, history.undone);} + function redo() {unredoHelper(history.undone, history.done);} + + function updateLinesNoUndo(from, to, newText, selFrom, selTo) { + if (suppressEdits) return; + var recomputeMaxLength = false, maxLineLength = maxLine.length; + if (!options.lineWrapping) + doc.iter(from.line, to.line + 1, function(line) { + if (line.text.length == maxLineLength) {recomputeMaxLength = true; return true;} + }); + if (from.line != to.line || newText.length > 1) gutterDirty = true; + + var nlines = to.line - from.line, firstLine = getLine(from.line), lastLine = getLine(to.line); + // First adjust the line structure, taking some care to leave highlighting intact. + if (from.ch == 0 && to.ch == 0 && newText[newText.length - 1] == "") { + // This is a whole-line replace. Treated specially to make + // sure line objects move the way they are supposed to. + var added = [], prevLine = null; + if (from.line) { + prevLine = getLine(from.line - 1); + prevLine.fixMarkEnds(lastLine); + } else lastLine.fixMarkStarts(); + for (var i = 0, e = newText.length - 1; i < e; ++i) + added.push(Line.inheritMarks(newText[i], prevLine)); + if (nlines) doc.remove(from.line, nlines, callbacks); + if (added.length) doc.insert(from.line, added); + } else if (firstLine == lastLine) { + if (newText.length == 1) + firstLine.replace(from.ch, to.ch, newText[0]); + else { + lastLine = firstLine.split(to.ch, newText[newText.length-1]); + firstLine.replace(from.ch, null, newText[0]); + firstLine.fixMarkEnds(lastLine); + var added = []; + for (var i = 1, e = newText.length - 1; i < e; ++i) + added.push(Line.inheritMarks(newText[i], firstLine)); + added.push(lastLine); + doc.insert(from.line + 1, added); + } + } else if (newText.length == 1) { + firstLine.replace(from.ch, null, newText[0]); + lastLine.replace(null, to.ch, ""); + firstLine.append(lastLine); + doc.remove(from.line + 1, nlines, callbacks); + } else { + var added = []; + firstLine.replace(from.ch, null, newText[0]); + lastLine.replace(null, to.ch, newText[newText.length-1]); + firstLine.fixMarkEnds(lastLine); + for (var i = 1, e = newText.length - 1; i < e; ++i) + added.push(Line.inheritMarks(newText[i], firstLine)); + if (nlines > 1) doc.remove(from.line + 1, nlines - 1, callbacks); + doc.insert(from.line + 1, added); + } + if (options.lineWrapping) { + var perLine = Math.max(5, scroller.clientWidth / charWidth() - 3); + doc.iter(from.line, from.line + newText.length, function(line) { + if (line.hidden) return; + var guess = Math.ceil(line.text.length / perLine) || 1; + if (guess != line.height) updateLineHeight(line, guess); + }); + } else { + doc.iter(from.line, from.line + newText.length, function(line) { + var l = line.text; + if (l.length > maxLineLength) { + maxLine = l; maxLineLength = l.length; maxWidth = null; + recomputeMaxLength = false; + } + }); + if (recomputeMaxLength) { + maxLineLength = 0; maxLine = ""; maxWidth = null; + doc.iter(0, doc.size, function(line) { + var l = line.text; + if (l.length > maxLineLength) { + maxLineLength = l.length; maxLine = l; + } + }); + } + } + + // Add these lines to the work array, so that they will be + // highlighted. Adjust work lines if lines were added/removed. + var newWork = [], lendiff = newText.length - nlines - 1; + for (var i = 0, l = work.length; i < l; ++i) { + var task = work[i]; + if (task < from.line) newWork.push(task); + else if (task > to.line) newWork.push(task + lendiff); + } + var hlEnd = from.line + Math.min(newText.length, 500); + highlightLines(from.line, hlEnd); + newWork.push(hlEnd); + work = newWork; + startWorker(100); + // Remember that these lines changed, for updating the display + changes.push({from: from.line, to: to.line + 1, diff: lendiff}); + var changeObj = {from: from, to: to, text: newText}; + if (textChanged) { + for (var cur = textChanged; cur.next; cur = cur.next) {} + cur.next = changeObj; + } else textChanged = changeObj; + + // Update the selection + function updateLine(n) {return n <= Math.min(to.line, to.line + lendiff) ? n : n + lendiff;} + setSelection(selFrom, selTo, updateLine(sel.from.line), updateLine(sel.to.line)); + + // Make sure the scroll-size div has the correct height. + if (scroller.clientHeight) + code.style.height = (doc.height * textHeight() + 2 * paddingTop()) + "px"; + } + + function replaceRange(code, from, to) { + from = clipPos(from); + if (!to) to = from; else to = clipPos(to); + code = splitLines(code); + function adjustPos(pos) { + if (posLess(pos, from)) return pos; + if (!posLess(to, pos)) return end; + var line = pos.line + code.length - (to.line - from.line) - 1; + var ch = pos.ch; + if (pos.line == to.line) + ch += code[code.length-1].length - (to.ch - (to.line == from.line ? from.ch : 0)); + return {line: line, ch: ch}; + } + var end; + replaceRange1(code, from, to, function(end1) { + end = end1; + return {from: adjustPos(sel.from), to: adjustPos(sel.to)}; + }); + return end; + } + function replaceSelection(code, collapse) { + replaceRange1(splitLines(code), sel.from, sel.to, function(end) { + if (collapse == "end") return {from: end, to: end}; + else if (collapse == "start") return {from: sel.from, to: sel.from}; + else return {from: sel.from, to: end}; + }); + } + function replaceRange1(code, from, to, computeSel) { + var endch = code.length == 1 ? code[0].length + from.ch : code[code.length-1].length; + var newSel = computeSel({line: from.line + code.length - 1, ch: endch}); + updateLines(from, to, code, newSel.from, newSel.to); + } + + function getRange(from, to) { + var l1 = from.line, l2 = to.line; + if (l1 == l2) return getLine(l1).text.slice(from.ch, to.ch); + var code = [getLine(l1).text.slice(from.ch)]; + doc.iter(l1 + 1, l2, function(line) { code.push(line.text); }); + code.push(getLine(l2).text.slice(0, to.ch)); + return code.join("\n"); + } + function getSelection() { + return getRange(sel.from, sel.to); + } + + var pollingFast = false; // Ensures slowPoll doesn't cancel fastPoll + function slowPoll() { + if (pollingFast) return; + poll.set(options.pollInterval, function() { + startOperation(); + readInput(); + if (focused) slowPoll(); + endOperation(); + }); + } + function fastPoll() { + var missed = false; + pollingFast = true; + function p() { + startOperation(); + var changed = readInput(); + if (!changed && !missed) {missed = true; poll.set(60, p);} + else {pollingFast = false; slowPoll();} + endOperation(); + } + poll.set(20, p); + } + + // Previnput is a hack to work with IME. If we reset the textarea + // on every change, that breaks IME. So we look for changes + // compared to the previous content instead. (Modern browsers have + // events that indicate IME taking place, but these are not widely + // supported or compatible enough yet to rely on.) + var prevInput = ""; + function readInput() { + if (leaveInputAlone || !focused || hasSelection(input) || options.readOnly) return false; + var text = input.value; + if (text == prevInput) return false; + shiftSelecting = null; + var same = 0, l = Math.min(prevInput.length, text.length); + while (same < l && prevInput[same] == text[same]) ++same; + if (same < prevInput.length) + sel.from = {line: sel.from.line, ch: sel.from.ch - (prevInput.length - same)}; + else if (overwrite && posEq(sel.from, sel.to)) + sel.to = {line: sel.to.line, ch: Math.min(getLine(sel.to.line).text.length, sel.to.ch + (text.length - same))}; + replaceSelection(text.slice(same), "end"); + prevInput = text; + return true; + } + function resetInput(user) { + if (!posEq(sel.from, sel.to)) { + prevInput = ""; + input.value = getSelection(); + selectInput(input); + } else if (user) prevInput = input.value = ""; + } + + function focusInput() { + if (options.readOnly != "nocursor") input.focus(); + } + + function scrollEditorIntoView() { + if (!cursor.getBoundingClientRect) return; + var rect = cursor.getBoundingClientRect(); + // IE returns bogus coordinates when the instance sits inside of an iframe and the cursor is hidden + if (ie && rect.top == rect.bottom) return; + var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight); + if (rect.top < 0 || rect.bottom > winH) cursor.scrollIntoView(); + } + function scrollCursorIntoView() { + var cursor = localCoords(sel.inverted ? sel.from : sel.to); + var x = options.lineWrapping ? Math.min(cursor.x, lineSpace.offsetWidth) : cursor.x; + return scrollIntoView(x, cursor.y, x, cursor.yBot); + } + function scrollIntoView(x1, y1, x2, y2) { + var pl = paddingLeft(), pt = paddingTop(); + y1 += pt; y2 += pt; x1 += pl; x2 += pl; + var screen = scroller.clientHeight, screentop = scroller.scrollTop, scrolled = false, result = true; + if (y1 < screentop) {scroller.scrollTop = Math.max(0, y1); scrolled = true;} + else if (y2 > screentop + screen) {scroller.scrollTop = y2 - screen; scrolled = true;} + + var screenw = scroller.clientWidth, screenleft = scroller.scrollLeft; + var gutterw = options.fixedGutter ? gutter.clientWidth : 0; + var atLeft = x1 < gutterw + pl + 10; + if (x1 < screenleft + gutterw || atLeft) { + if (atLeft) x1 = 0; + scroller.scrollLeft = Math.max(0, x1 - 10 - gutterw); + scrolled = true; + } + else if (x2 > screenw + screenleft - 3) { + scroller.scrollLeft = x2 + 10 - screenw; + scrolled = true; + if (x2 > code.clientWidth) result = false; + } + if (scrolled && options.onScroll) options.onScroll(instance); + return result; + } + + function visibleLines() { + var lh = textHeight(), top = scroller.scrollTop - paddingTop(); + var fromHeight = Math.max(0, Math.floor(top / lh)); + var toHeight = Math.ceil((top + scroller.clientHeight) / lh); + return {from: lineAtHeight(doc, fromHeight), + to: lineAtHeight(doc, toHeight)}; + } + // Uses a set of changes plus the current scroll position to + // determine which DOM updates have to be made, and makes the + // updates. + function updateDisplay(changes, suppressCallback) { + if (!scroller.clientWidth) { + showingFrom = showingTo = displayOffset = 0; + return; + } + // Compute the new visible window + var visible = visibleLines(); + // Bail out if the visible area is already rendered and nothing changed. + if (changes !== true && changes.length == 0 && visible.from > showingFrom && visible.to < showingTo) return; + var from = Math.max(visible.from - 100, 0), to = Math.min(doc.size, visible.to + 100); + if (showingFrom < from && from - showingFrom < 20) from = showingFrom; + if (showingTo > to && showingTo - to < 20) to = Math.min(doc.size, showingTo); + + // Create a range of theoretically intact lines, and punch holes + // in that using the change info. + var intact = changes === true ? [] : + computeIntact([{from: showingFrom, to: showingTo, domStart: 0}], changes); + // Clip off the parts that won't be visible + var intactLines = 0; + for (var i = 0; i < intact.length; ++i) { + var range = intact[i]; + if (range.from < from) {range.domStart += (from - range.from); range.from = from;} + if (range.to > to) range.to = to; + if (range.from >= range.to) intact.splice(i--, 1); + else intactLines += range.to - range.from; + } + if (intactLines == to - from && from == showingFrom && to == showingTo) return; + intact.sort(function(a, b) {return a.domStart - b.domStart;}); + + var th = textHeight(), gutterDisplay = gutter.style.display; + lineDiv.style.display = "none"; + patchDisplay(from, to, intact); + lineDiv.style.display = gutter.style.display = ""; + + // Position the mover div to align with the lines it's supposed + // to be showing (which will cover the visible display) + var different = from != showingFrom || to != showingTo || lastSizeC != scroller.clientHeight + th; + // This is just a bogus formula that detects when the editor is + // resized or the font size changes. + if (different) lastSizeC = scroller.clientHeight + th; + showingFrom = from; showingTo = to; + displayOffset = heightAtLine(doc, from); + mover.style.top = (displayOffset * th) + "px"; + if (scroller.clientHeight) + code.style.height = (doc.height * th + 2 * paddingTop()) + "px"; + + // Since this is all rather error prone, it is honoured with the + // only assertion in the whole file. + if (lineDiv.childNodes.length != showingTo - showingFrom) + throw new Error("BAD PATCH! " + JSON.stringify(intact) + " size=" + (showingTo - showingFrom) + + " nodes=" + lineDiv.childNodes.length); + + function checkHeights() { + maxWidth = scroller.clientWidth; + var curNode = lineDiv.firstChild, heightChanged = false; + doc.iter(showingFrom, showingTo, function(line) { + if (!line.hidden) { + var height = Math.round(curNode.offsetHeight / th) || 1; + if (line.height != height) { + updateLineHeight(line, height); + gutterDirty = heightChanged = true; + } + } + curNode = curNode.nextSibling; + }); + if (heightChanged) + code.style.height = (doc.height * th + 2 * paddingTop()) + "px"; + return heightChanged; + } + + if (options.lineWrapping) { + checkHeights(); + } else { + if (maxWidth == null) maxWidth = stringWidth(maxLine); + if (maxWidth > scroller.clientWidth) { + lineSpace.style.width = maxWidth + "px"; + // Needed to prevent odd wrapping/hiding of widgets placed in here. + code.style.width = ""; + code.style.width = scroller.scrollWidth + "px"; + } else { + lineSpace.style.width = code.style.width = ""; + } + } + + gutter.style.display = gutterDisplay; + if (different || gutterDirty) { + // If the gutter grew in size, re-check heights. If those changed, re-draw gutter. + updateGutter() && options.lineWrapping && checkHeights() && updateGutter(); + } + updateSelection(); + if (!suppressCallback && options.onUpdate) options.onUpdate(instance); + return true; + } + + function computeIntact(intact, changes) { + for (var i = 0, l = changes.length || 0; i < l; ++i) { + var change = changes[i], intact2 = [], diff = change.diff || 0; + for (var j = 0, l2 = intact.length; j < l2; ++j) { + var range = intact[j]; + if (change.to <= range.from && change.diff) + intact2.push({from: range.from + diff, to: range.to + diff, + domStart: range.domStart}); + else if (change.to <= range.from || change.from >= range.to) + intact2.push(range); + else { + if (change.from > range.from) + intact2.push({from: range.from, to: change.from, domStart: range.domStart}); + if (change.to < range.to) + intact2.push({from: change.to + diff, to: range.to + diff, + domStart: range.domStart + (change.to - range.from)}); + } + } + intact = intact2; + } + return intact; + } + + function patchDisplay(from, to, intact) { + // The first pass removes the DOM nodes that aren't intact. + if (!intact.length) lineDiv.innerHTML = ""; + else { + function killNode(node) { + var tmp = node.nextSibling; + node.parentNode.removeChild(node); + return tmp; + } + var domPos = 0, curNode = lineDiv.firstChild, n; + for (var i = 0; i < intact.length; ++i) { + var cur = intact[i]; + while (cur.domStart > domPos) {curNode = killNode(curNode); domPos++;} + for (var j = 0, e = cur.to - cur.from; j < e; ++j) {curNode = curNode.nextSibling; domPos++;} + } + while (curNode) curNode = killNode(curNode); + } + // This pass fills in the lines that actually changed. + var nextIntact = intact.shift(), curNode = lineDiv.firstChild, j = from; + var scratch = document.createElement("div"); + doc.iter(from, to, function(line) { + if (nextIntact && nextIntact.to == j) nextIntact = intact.shift(); + if (!nextIntact || nextIntact.from > j) { + if (line.hidden) var html = scratch.innerHTML = "<pre></pre>"; + else { + var html = '<pre' + (line.className ? ' class="' + line.className + '"' : '') + '>' + + line.getHTML(makeTab) + '</pre>'; + // Kludge to make sure the styled element lies behind the selection (by z-index) + if (line.bgClassName) + html = '<div style="position: relative"><pre class="' + line.bgClassName + + '" style="position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: -2"> </pre>' + html + "</div>"; + } + scratch.innerHTML = html; + lineDiv.insertBefore(scratch.firstChild, curNode); + } else { + curNode = curNode.nextSibling; + } + ++j; + }); + } + + function updateGutter() { + if (!options.gutter && !options.lineNumbers) return; + var hText = mover.offsetHeight, hEditor = scroller.clientHeight; + gutter.style.height = (hText - hEditor < 2 ? hEditor : hText) + "px"; + var html = [], i = showingFrom, normalNode; + doc.iter(showingFrom, Math.max(showingTo, showingFrom + 1), function(line) { + if (line.hidden) { + html.push("<pre></pre>"); + } else { + var marker = line.gutterMarker; + var text = options.lineNumbers ? i + options.firstLineNumber : null; + if (marker && marker.text) + text = marker.text.replace("%N%", text != null ? text : ""); + else if (text == null) + text = "\u00a0"; + html.push((marker && marker.style ? '<pre class="' + marker.style + '">' : "<pre>"), text); + for (var j = 1; j < line.height; ++j) html.push("<br/> "); + html.push("</pre>"); + if (!marker) normalNode = i; + } + ++i; + }); + gutter.style.display = "none"; + gutterText.innerHTML = html.join(""); + // Make sure scrolling doesn't cause number gutter size to pop + if (normalNode != null) { + var node = gutterText.childNodes[normalNode - showingFrom]; + var minwidth = String(doc.size).length, val = eltText(node), pad = ""; + while (val.length + pad.length < minwidth) pad += "\u00a0"; + if (pad) node.insertBefore(document.createTextNode(pad), node.firstChild); + } + gutter.style.display = ""; + var resized = Math.abs((parseInt(lineSpace.style.marginLeft) || 0) - gutter.offsetWidth) > 2; + lineSpace.style.marginLeft = gutter.offsetWidth + "px"; + gutterDirty = false; + return resized; + } + function updateSelection() { + var collapsed = posEq(sel.from, sel.to); + var fromPos = localCoords(sel.from, true); + var toPos = collapsed ? fromPos : localCoords(sel.to, true); + var headPos = sel.inverted ? fromPos : toPos, th = textHeight(); + var wrapOff = eltOffset(wrapper), lineOff = eltOffset(lineDiv); + inputDiv.style.top = Math.max(0, Math.min(scroller.offsetHeight, headPos.y + lineOff.top - wrapOff.top)) + "px"; + inputDiv.style.left = Math.max(0, Math.min(scroller.offsetWidth, headPos.x + lineOff.left - wrapOff.left)) + "px"; + if (collapsed) { + cursor.style.top = headPos.y + "px"; + cursor.style.left = (options.lineWrapping ? Math.min(headPos.x, lineSpace.offsetWidth) : headPos.x) + "px"; + cursor.style.display = ""; + selectionDiv.style.display = "none"; + } else { + var sameLine = fromPos.y == toPos.y, html = ""; + var clientWidth = lineSpace.clientWidth || lineSpace.offsetWidth; + var clientHeight = lineSpace.clientHeight || lineSpace.offsetHeight; + function add(left, top, right, height) { + var rstyle = quirksMode ? "width: " + (!right ? clientWidth : clientWidth - right - left) + "px" + : "right: " + right + "px"; + html += '<div class="CodeMirror-selected" style="position: absolute; left: ' + left + + 'px; top: ' + top + 'px; ' + rstyle + '; height: ' + height + 'px"></div>'; + } + if (sel.from.ch && fromPos.y >= 0) { + var right = sameLine ? clientWidth - toPos.x : 0; + add(fromPos.x, fromPos.y, right, th); + } + var middleStart = Math.max(0, fromPos.y + (sel.from.ch ? th : 0)); + var middleHeight = Math.min(toPos.y, clientHeight) - middleStart; + if (middleHeight > 0.2 * th) + add(0, middleStart, 0, middleHeight); + if ((!sameLine || !sel.from.ch) && toPos.y < clientHeight - .5 * th) + add(0, toPos.y, clientWidth - toPos.x, th); + selectionDiv.innerHTML = html; + cursor.style.display = "none"; + selectionDiv.style.display = ""; + } + } + + function setShift(val) { + if (val) shiftSelecting = shiftSelecting || (sel.inverted ? sel.to : sel.from); + else shiftSelecting = null; + } + function setSelectionUser(from, to) { + var sh = shiftSelecting && clipPos(shiftSelecting); + if (sh) { + if (posLess(sh, from)) from = sh; + else if (posLess(to, sh)) to = sh; + } + setSelection(from, to); + userSelChange = true; + } + // Update the selection. Last two args are only used by + // updateLines, since they have to be expressed in the line + // numbers before the update. + function setSelection(from, to, oldFrom, oldTo) { + goalColumn = null; + if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;} + if (posEq(sel.from, from) && posEq(sel.to, to)) return; + if (posLess(to, from)) {var tmp = to; to = from; from = tmp;} + + // Skip over hidden lines. + if (from.line != oldFrom) { + var from1 = skipHidden(from, oldFrom, sel.from.ch); + // If there is no non-hidden line left, force visibility on current line + if (!from1) setLineHidden(from.line, false); + else from = from1; + } + if (to.line != oldTo) to = skipHidden(to, oldTo, sel.to.ch); + + if (posEq(from, to)) sel.inverted = false; + else if (posEq(from, sel.to)) sel.inverted = false; + else if (posEq(to, sel.from)) sel.inverted = true; + + if (options.autoClearEmptyLines && posEq(sel.from, sel.to)) { + var head = sel.inverted ? from : to; + if (head.line != sel.from.line && sel.from.line < doc.size) { + var oldLine = getLine(sel.from.line); + if (/^\s+$/.test(oldLine.text)) + setTimeout(operation(function() { + if (oldLine.parent && /^\s+$/.test(oldLine.text)) { + var no = lineNo(oldLine); + replaceRange("", {line: no, ch: 0}, {line: no, ch: oldLine.text.length}); + } + }, 10)); + } + } + + sel.from = from; sel.to = to; + selectionChanged = true; + } + function skipHidden(pos, oldLine, oldCh) { + function getNonHidden(dir) { + var lNo = pos.line + dir, end = dir == 1 ? doc.size : -1; + while (lNo != end) { + var line = getLine(lNo); + if (!line.hidden) { + var ch = pos.ch; + if (toEnd || ch > oldCh || ch > line.text.length) ch = line.text.length; + return {line: lNo, ch: ch}; + } + lNo += dir; + } + } + var line = getLine(pos.line); + var toEnd = pos.ch == line.text.length && pos.ch != oldCh; + if (!line.hidden) return pos; + if (pos.line >= oldLine) return getNonHidden(1) || getNonHidden(-1); + else return getNonHidden(-1) || getNonHidden(1); + } + function setCursor(line, ch, user) { + var pos = clipPos({line: line, ch: ch || 0}); + (user ? setSelectionUser : setSelection)(pos, pos); + } + + function clipLine(n) {return Math.max(0, Math.min(n, doc.size-1));} + function clipPos(pos) { + if (pos.line < 0) return {line: 0, ch: 0}; + if (pos.line >= doc.size) return {line: doc.size-1, ch: getLine(doc.size-1).text.length}; + var ch = pos.ch, linelen = getLine(pos.line).text.length; + if (ch == null || ch > linelen) return {line: pos.line, ch: linelen}; + else if (ch < 0) return {line: pos.line, ch: 0}; + else return pos; + } + + function findPosH(dir, unit) { + var end = sel.inverted ? sel.from : sel.to, line = end.line, ch = end.ch; + var lineObj = getLine(line); + function findNextLine() { + for (var l = line + dir, e = dir < 0 ? -1 : doc.size; l != e; l += dir) { + var lo = getLine(l); + if (!lo.hidden) { line = l; lineObj = lo; return true; } + } + } + function moveOnce(boundToLine) { + if (ch == (dir < 0 ? 0 : lineObj.text.length)) { + if (!boundToLine && findNextLine()) ch = dir < 0 ? lineObj.text.length : 0; + else return false; + } else ch += dir; + return true; + } + if (unit == "char") moveOnce(); + else if (unit == "column") moveOnce(true); + else if (unit == "word") { + var sawWord = false; + for (;;) { + if (dir < 0) if (!moveOnce()) break; + if (isWordChar(lineObj.text.charAt(ch))) sawWord = true; + else if (sawWord) {if (dir < 0) {dir = 1; moveOnce();} break;} + if (dir > 0) if (!moveOnce()) break; + } + } + return {line: line, ch: ch}; + } + function moveH(dir, unit) { + var pos = dir < 0 ? sel.from : sel.to; + if (shiftSelecting || posEq(sel.from, sel.to)) pos = findPosH(dir, unit); + setCursor(pos.line, pos.ch, true); + } + function deleteH(dir, unit) { + if (!posEq(sel.from, sel.to)) replaceRange("", sel.from, sel.to); + else if (dir < 0) replaceRange("", findPosH(dir, unit), sel.to); + else replaceRange("", sel.from, findPosH(dir, unit)); + userSelChange = true; + } + var goalColumn = null; + function moveV(dir, unit) { + var dist = 0, pos = localCoords(sel.inverted ? sel.from : sel.to, true); + if (goalColumn != null) pos.x = goalColumn; + if (unit == "page") dist = Math.min(scroller.clientHeight, window.innerHeight || document.documentElement.clientHeight); + else if (unit == "line") dist = textHeight(); + var target = coordsChar(pos.x, pos.y + dist * dir + 2); + if (unit == "page") scroller.scrollTop += localCoords(target, true).y - pos.y; + setCursor(target.line, target.ch, true); + goalColumn = pos.x; + } + + function selectWordAt(pos) { + var line = getLine(pos.line).text; + var start = pos.ch, end = pos.ch; + while (start > 0 && isWordChar(line.charAt(start - 1))) --start; + while (end < line.length && isWordChar(line.charAt(end))) ++end; + setSelectionUser({line: pos.line, ch: start}, {line: pos.line, ch: end}); + } + function selectLine(line) { + setSelectionUser({line: line, ch: 0}, clipPos({line: line + 1, ch: 0})); + } + function indentSelected(mode) { + if (posEq(sel.from, sel.to)) return indentLine(sel.from.line, mode); + var e = sel.to.line - (sel.to.ch ? 0 : 1); + for (var i = sel.from.line; i <= e; ++i) indentLine(i, mode); + } + + function indentLine(n, how) { + if (!how) how = "add"; + if (how == "smart") { + if (!mode.indent) how = "prev"; + else var state = getStateBefore(n); + } + + var line = getLine(n), curSpace = line.indentation(options.tabSize), + curSpaceString = line.text.match(/^\s*/)[0], indentation; + if (how == "prev") { + if (n) indentation = getLine(n-1).indentation(options.tabSize); + else indentation = 0; + } + else if (how == "smart") indentation = mode.indent(state, line.text.slice(curSpaceString.length), line.text); + else if (how == "add") indentation = curSpace + options.indentUnit; + else if (how == "subtract") indentation = curSpace - options.indentUnit; + indentation = Math.max(0, indentation); + var diff = indentation - curSpace; + + if (!diff) { + if (sel.from.line != n && sel.to.line != n) return; + var indentString = curSpaceString; + } + else { + var indentString = "", pos = 0; + if (options.indentWithTabs) + for (var i = Math.floor(indentation / options.tabSize); i; --i) {pos += options.tabSize; indentString += "\t";} + while (pos < indentation) {++pos; indentString += " ";} + } + + replaceRange(indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length}); + } + + function loadMode() { + mode = CodeMirror.getMode(options, options.mode); + doc.iter(0, doc.size, function(line) { line.stateAfter = null; }); + work = [0]; + startWorker(); + } + function gutterChanged() { + var visible = options.gutter || options.lineNumbers; + gutter.style.display = visible ? "" : "none"; + if (visible) gutterDirty = true; + else lineDiv.parentNode.style.marginLeft = 0; + } + function wrappingChanged(from, to) { + if (options.lineWrapping) { + wrapper.className += " CodeMirror-wrap"; + var perLine = scroller.clientWidth / charWidth() - 3; + doc.iter(0, doc.size, function(line) { + if (line.hidden) return; + var guess = Math.ceil(line.text.length / perLine) || 1; + if (guess != 1) updateLineHeight(line, guess); + }); + lineSpace.style.width = code.style.width = ""; + } else { + wrapper.className = wrapper.className.replace(" CodeMirror-wrap", ""); + maxWidth = null; maxLine = ""; + doc.iter(0, doc.size, function(line) { + if (line.height != 1 && !line.hidden) updateLineHeight(line, 1); + if (line.text.length > maxLine.length) maxLine = line.text; + }); + } + changes.push({from: 0, to: doc.size}); + } + function makeTab(col) { + var w = options.tabSize - col % options.tabSize, cached = tabCache[w]; + if (cached) return cached; + for (var str = '<span class="cm-tab">', i = 0; i < w; ++i) str += " "; + return (tabCache[w] = {html: str + "</span>", width: w}); + } + function themeChanged() { + scroller.className = scroller.className.replace(/\s*cm-s-\S+/g, "") + + options.theme.replace(/(^|\s)\s*/g, " cm-s-"); + } + + function TextMarker() { this.set = []; } + TextMarker.prototype.clear = operation(function() { + var min = Infinity, max = -Infinity; + for (var i = 0, e = this.set.length; i < e; ++i) { + var line = this.set[i], mk = line.marked; + if (!mk || !line.parent) continue; + var lineN = lineNo(line); + min = Math.min(min, lineN); max = Math.max(max, lineN); + for (var j = 0; j < mk.length; ++j) + if (mk[j].marker == this) mk.splice(j--, 1); + } + if (min != Infinity) + changes.push({from: min, to: max + 1}); + }); + TextMarker.prototype.find = function() { + var from, to; + for (var i = 0, e = this.set.length; i < e; ++i) { + var line = this.set[i], mk = line.marked; + for (var j = 0; j < mk.length; ++j) { + var mark = mk[j]; + if (mark.marker == this) { + if (mark.from != null || mark.to != null) { + var found = lineNo(line); + if (found != null) { + if (mark.from != null) from = {line: found, ch: mark.from}; + if (mark.to != null) to = {line: found, ch: mark.to}; + } + } + } + } + } + return {from: from, to: to}; + }; + + function markText(from, to, className) { + from = clipPos(from); to = clipPos(to); + var tm = new TextMarker(); + if (!posLess(from, to)) return tm; + function add(line, from, to, className) { + getLine(line).addMark(new MarkedText(from, to, className, tm)); + } + if (from.line == to.line) add(from.line, from.ch, to.ch, className); + else { + add(from.line, from.ch, null, className); + for (var i = from.line + 1, e = to.line; i < e; ++i) + add(i, null, null, className); + add(to.line, null, to.ch, className); + } + changes.push({from: from.line, to: to.line + 1}); + return tm; + } + + function setBookmark(pos) { + pos = clipPos(pos); + var bm = new Bookmark(pos.ch); + getLine(pos.line).addMark(bm); + return bm; + } + + function findMarksAt(pos) { + pos = clipPos(pos); + var markers = [], marked = getLine(pos.line).marked; + if (!marked) return markers; + for (var i = 0, e = marked.length; i < e; ++i) { + var m = marked[i]; + if ((m.from == null || m.from <= pos.ch) && + (m.to == null || m.to >= pos.ch)) + markers.push(m.marker || m); + } + return markers; + } + + function addGutterMarker(line, text, className) { + if (typeof line == "number") line = getLine(clipLine(line)); + line.gutterMarker = {text: text, style: className}; + gutterDirty = true; + return line; + } + function removeGutterMarker(line) { + if (typeof line == "number") line = getLine(clipLine(line)); + line.gutterMarker = null; + gutterDirty = true; + } + + function changeLine(handle, op) { + var no = handle, line = handle; + if (typeof handle == "number") line = getLine(clipLine(handle)); + else no = lineNo(handle); + if (no == null) return null; + if (op(line, no)) changes.push({from: no, to: no + 1}); + else return null; + return line; + } + function setLineClass(handle, className, bgClassName) { + return changeLine(handle, function(line) { + if (line.className != className || line.bgClassName != bgClassName) { + line.className = className; + line.bgClassName = bgClassName; + return true; + } + }); + } + function setLineHidden(handle, hidden) { + return changeLine(handle, function(line, no) { + if (line.hidden != hidden) { + line.hidden = hidden; + updateLineHeight(line, hidden ? 0 : 1); + var fline = sel.from.line, tline = sel.to.line; + if (hidden && (fline == no || tline == no)) { + var from = fline == no ? skipHidden({line: fline, ch: 0}, fline, 0) : sel.from; + var to = tline == no ? skipHidden({line: tline, ch: 0}, tline, 0) : sel.to; + // Can't hide the last visible line, we'd have no place to put the cursor + if (!to) return; + setSelection(from, to); + } + return (gutterDirty = true); + } + }); + } + + function lineInfo(line) { + if (typeof line == "number") { + if (!isLine(line)) return null; + var n = line; + line = getLine(line); + if (!line) return null; + } + else { + var n = lineNo(line); + if (n == null) return null; + } + var marker = line.gutterMarker; + return {line: n, handle: line, text: line.text, markerText: marker && marker.text, + markerClass: marker && marker.style, lineClass: line.className, bgClass: line.bgClassName}; + } + + function stringWidth(str) { + measure.innerHTML = "<pre><span>x</span></pre>"; + measure.firstChild.firstChild.firstChild.nodeValue = str; + return measure.firstChild.firstChild.offsetWidth || 10; + } + // These are used to go from pixel positions to character + // positions, taking varying character widths into account. + function charFromX(line, x) { + if (x <= 0) return 0; + var lineObj = getLine(line), text = lineObj.text; + function getX(len) { + return measureLine(lineObj, len).left; + } + var from = 0, fromX = 0, to = text.length, toX; + // Guess a suitable upper bound for our search. + var estimated = Math.min(to, Math.ceil(x / charWidth())); + for (;;) { + var estX = getX(estimated); + if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2)); + else {toX = estX; to = estimated; break;} + } + if (x > toX) return to; + // Try to guess a suitable lower bound as well. + estimated = Math.floor(to * 0.8); estX = getX(estimated); + if (estX < x) {from = estimated; fromX = estX;} + // Do a binary search between these bounds. + for (;;) { + if (to - from <= 1) return (toX - x > x - fromX) ? from : to; + var middle = Math.ceil((from + to) / 2), middleX = getX(middle); + if (middleX > x) {to = middle; toX = middleX;} + else {from = middle; fromX = middleX;} + } + } + + var tempId = "CodeMirror-temp-" + Math.floor(Math.random() * 0xffffff).toString(16); + function measureLine(line, ch) { + if (ch == 0) return {top: 0, left: 0}; + var wbr = options.lineWrapping && ch < line.text.length && + spanAffectsWrapping.test(line.text.slice(ch - 1, ch + 1)); + measure.innerHTML = "<pre>" + line.getHTML(makeTab, ch, tempId, wbr) + "</pre>"; + var elt = document.getElementById(tempId); + var top = elt.offsetTop, left = elt.offsetLeft; + // Older IEs report zero offsets for spans directly after a wrap + if (ie && top == 0 && left == 0) { + var backup = document.createElement("span"); + backup.innerHTML = "x"; + elt.parentNode.insertBefore(backup, elt.nextSibling); + top = backup.offsetTop; + } + return {top: top, left: left}; + } + function localCoords(pos, inLineWrap) { + var x, lh = textHeight(), y = lh * (heightAtLine(doc, pos.line) - (inLineWrap ? displayOffset : 0)); + if (pos.ch == 0) x = 0; + else { + var sp = measureLine(getLine(pos.line), pos.ch); + x = sp.left; + if (options.lineWrapping) y += Math.max(0, sp.top); + } + return {x: x, y: y, yBot: y + lh}; + } + // Coords must be lineSpace-local + function coordsChar(x, y) { + if (y < 0) y = 0; + var th = textHeight(), cw = charWidth(), heightPos = displayOffset + Math.floor(y / th); + var lineNo = lineAtHeight(doc, heightPos); + if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc.size - 1).text.length}; + var lineObj = getLine(lineNo), text = lineObj.text; + var tw = options.lineWrapping, innerOff = tw ? heightPos - heightAtLine(doc, lineNo) : 0; + if (x <= 0 && innerOff == 0) return {line: lineNo, ch: 0}; + function getX(len) { + var sp = measureLine(lineObj, len); + if (tw) { + var off = Math.round(sp.top / th); + return Math.max(0, sp.left + (off - innerOff) * scroller.clientWidth); + } + return sp.left; + } + var from = 0, fromX = 0, to = text.length, toX; + // Guess a suitable upper bound for our search. + var estimated = Math.min(to, Math.ceil((x + innerOff * scroller.clientWidth * .9) / cw)); + for (;;) { + var estX = getX(estimated); + if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2)); + else {toX = estX; to = estimated; break;} + } + if (x > toX) return {line: lineNo, ch: to}; + // Try to guess a suitable lower bound as well. + estimated = Math.floor(to * 0.8); estX = getX(estimated); + if (estX < x) {from = estimated; fromX = estX;} + // Do a binary search between these bounds. + for (;;) { + if (to - from <= 1) return {line: lineNo, ch: (toX - x > x - fromX) ? from : to}; + var middle = Math.ceil((from + to) / 2), middleX = getX(middle); + if (middleX > x) {to = middle; toX = middleX;} + else {from = middle; fromX = middleX;} + } + } + function pageCoords(pos) { + var local = localCoords(pos, true), off = eltOffset(lineSpace); + return {x: off.left + local.x, y: off.top + local.y, yBot: off.top + local.yBot}; + } + + var cachedHeight, cachedHeightFor, measureText; + function textHeight() { + if (measureText == null) { + measureText = "<pre>"; + for (var i = 0; i < 49; ++i) measureText += "x<br/>"; + measureText += "x</pre>"; + } + var offsetHeight = lineDiv.clientHeight; + if (offsetHeight == cachedHeightFor) return cachedHeight; + cachedHeightFor = offsetHeight; + measure.innerHTML = measureText; + cachedHeight = measure.firstChild.offsetHeight / 50 || 1; + measure.innerHTML = ""; + return cachedHeight; + } + var cachedWidth, cachedWidthFor = 0; + function charWidth() { + if (scroller.clientWidth == cachedWidthFor) return cachedWidth; + cachedWidthFor = scroller.clientWidth; + return (cachedWidth = stringWidth("x")); + } + function paddingTop() {return lineSpace.offsetTop;} + function paddingLeft() {return lineSpace.offsetLeft;} + + function posFromMouse(e, liberal) { + var offW = eltOffset(scroller, true), x, y; + // Fails unpredictably on IE[67] when mouse is dragged around quickly. + try { x = e.clientX; y = e.clientY; } catch (e) { return null; } + // This is a mess of a heuristic to try and determine whether a + // scroll-bar was clicked or not, and to return null if one was + // (and !liberal). + if (!liberal && (x - offW.left > scroller.clientWidth || y - offW.top > scroller.clientHeight)) + return null; + var offL = eltOffset(lineSpace, true); + return coordsChar(x - offL.left, y - offL.top); + } + function onContextMenu(e) { + var pos = posFromMouse(e), scrollPos = scroller.scrollTop; + if (!pos || window.opera) return; // Opera is difficult. + if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to)) + operation(setCursor)(pos.line, pos.ch); + + var oldCSS = input.style.cssText; + inputDiv.style.position = "absolute"; + input.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) + + "px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: white; " + + "border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);"; + leaveInputAlone = true; + var val = input.value = getSelection(); + focusInput(); + selectInput(input); + function rehide() { + var newVal = splitLines(input.value).join("\n"); + if (newVal != val) operation(replaceSelection)(newVal, "end"); + inputDiv.style.position = "relative"; + input.style.cssText = oldCSS; + if (ie_lt9) scroller.scrollTop = scrollPos; + leaveInputAlone = false; + resetInput(true); + slowPoll(); + } + + if (gecko) { + e_stop(e); + var mouseup = connect(window, "mouseup", function() { + mouseup(); + setTimeout(rehide, 20); + }, true); + } else { + setTimeout(rehide, 50); + } + } + + // Cursor-blinking + function restartBlink() { + clearInterval(blinker); + var on = true; + cursor.style.visibility = ""; + blinker = setInterval(function() { + cursor.style.visibility = (on = !on) ? "" : "hidden"; + }, 650); + } + + var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"}; + function matchBrackets(autoclear) { + var head = sel.inverted ? sel.from : sel.to, line = getLine(head.line), pos = head.ch - 1; + var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)]; + if (!match) return; + var ch = match.charAt(0), forward = match.charAt(1) == ">", d = forward ? 1 : -1, st = line.styles; + for (var off = pos + 1, i = 0, e = st.length; i < e; i+=2) + if ((off -= st[i].length) <= 0) {var style = st[i+1]; break;} + + var stack = [line.text.charAt(pos)], re = /[(){}[\]]/; + function scan(line, from, to) { + if (!line.text) return; + var st = line.styles, pos = forward ? 0 : line.text.length - 1, cur; + for (var i = forward ? 0 : st.length - 2, e = forward ? st.length : -2; i != e; i += 2*d) { + var text = st[i]; + if (st[i+1] != null && st[i+1] != style) {pos += d * text.length; continue;} + for (var j = forward ? 0 : text.length - 1, te = forward ? text.length : -1; j != te; j += d, pos+=d) { + if (pos >= from && pos < to && re.test(cur = text.charAt(j))) { + var match = matching[cur]; + if (match.charAt(1) == ">" == forward) stack.push(cur); + else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false}; + else if (!stack.length) return {pos: pos, match: true}; + } + } + } + } + for (var i = head.line, e = forward ? Math.min(i + 100, doc.size) : Math.max(-1, i - 100); i != e; i+=d) { + var line = getLine(i), first = i == head.line; + var found = scan(line, first && forward ? pos + 1 : 0, first && !forward ? pos : line.text.length); + if (found) break; + } + if (!found) found = {pos: null, match: false}; + var style = found.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket"; + var one = markText({line: head.line, ch: pos}, {line: head.line, ch: pos+1}, style), + two = found.pos != null && markText({line: i, ch: found.pos}, {line: i, ch: found.pos + 1}, style); + var clear = operation(function(){one.clear(); two && two.clear();}); + if (autoclear) setTimeout(clear, 800); + else bracketHighlighted = clear; + } + + // Finds the line to start with when starting a parse. Tries to + // find a line with a stateAfter, so that it can start with a + // valid state. If that fails, it returns the line with the + // smallest indentation, which tends to need the least context to + // parse correctly. + function findStartLine(n) { + var minindent, minline; + for (var search = n, lim = n - 40; search > lim; --search) { + if (search == 0) return 0; + var line = getLine(search-1); + if (line.stateAfter) return search; + var indented = line.indentation(options.tabSize); + if (minline == null || minindent > indented) { + minline = search - 1; + minindent = indented; + } + } + return minline; + } + function getStateBefore(n) { + var start = findStartLine(n), state = start && getLine(start-1).stateAfter; + if (!state) state = startState(mode); + else state = copyState(mode, state); + doc.iter(start, n, function(line) { + line.highlight(mode, state, options.tabSize); + line.stateAfter = copyState(mode, state); + }); + if (start < n) changes.push({from: start, to: n}); + if (n < doc.size && !getLine(n).stateAfter) work.push(n); + return state; + } + function highlightLines(start, end) { + var state = getStateBefore(start); + doc.iter(start, end, function(line) { + line.highlight(mode, state, options.tabSize); + line.stateAfter = copyState(mode, state); + }); + } + function highlightWorker() { + var end = +new Date + options.workTime; + var foundWork = work.length; + while (work.length) { + if (!getLine(showingFrom).stateAfter) var task = showingFrom; + else var task = work.pop(); + if (task >= doc.size) continue; + var start = findStartLine(task), state = start && getLine(start-1).stateAfter; + if (state) state = copyState(mode, state); + else state = startState(mode); + + var unchanged = 0, compare = mode.compareStates, realChange = false, + i = start, bail = false; + doc.iter(i, doc.size, function(line) { + var hadState = line.stateAfter; + if (+new Date > end) { + work.push(i); + startWorker(options.workDelay); + if (realChange) changes.push({from: task, to: i + 1}); + return (bail = true); + } + var changed = line.highlight(mode, state, options.tabSize); + if (changed) realChange = true; + line.stateAfter = copyState(mode, state); + var done = null; + if (compare) { + var same = hadState && compare(hadState, state); + if (same != Pass) done = !!same; + } + if (done == null) { + if (changed !== false || !hadState) unchanged = 0; + else if (++unchanged > 3 && (!mode.indent || mode.indent(hadState, "") == mode.indent(state, ""))) + done = true; + } + if (done) return true; + ++i; + }); + if (bail) return; + if (realChange) changes.push({from: task, to: i + 1}); + } + if (foundWork && options.onHighlightComplete) + options.onHighlightComplete(instance); + } + function startWorker(time) { + if (!work.length) return; + highlight.set(time, operation(highlightWorker)); + } + + // Operations are used to wrap changes in such a way that each + // change won't have to update the cursor and display (which would + // be awkward, slow, and error-prone), but instead updates are + // batched and then all combined and executed at once. + function startOperation() { + updateInput = userSelChange = textChanged = null; + changes = []; selectionChanged = false; callbacks = []; + } + function endOperation() { + var reScroll = false, updated; + if (selectionChanged) reScroll = !scrollCursorIntoView(); + if (changes.length) updated = updateDisplay(changes, true); + else { + if (selectionChanged) updateSelection(); + if (gutterDirty) updateGutter(); + } + if (reScroll) scrollCursorIntoView(); + if (selectionChanged) {scrollEditorIntoView(); restartBlink();} + + if (focused && !leaveInputAlone && + (updateInput === true || (updateInput !== false && selectionChanged))) + resetInput(userSelChange); + + if (selectionChanged && options.matchBrackets) + setTimeout(operation(function() { + if (bracketHighlighted) {bracketHighlighted(); bracketHighlighted = null;} + if (posEq(sel.from, sel.to)) matchBrackets(false); + }), 20); + var tc = textChanged, cbs = callbacks; // these can be reset by callbacks + if (selectionChanged && options.onCursorActivity) + options.onCursorActivity(instance); + if (tc && options.onChange && instance) + options.onChange(instance, tc); + for (var i = 0; i < cbs.length; ++i) cbs[i](instance); + if (updated && options.onUpdate) options.onUpdate(instance); + } + var nestedOperation = 0; + function operation(f) { + return function() { + if (!nestedOperation++) startOperation(); + try {var result = f.apply(this, arguments);} + finally {if (!--nestedOperation) endOperation();} + return result; + }; + } + + function compoundChange(f) { + history.startCompound(); + try { return f(); } finally { history.endCompound(); } + } + + for (var ext in extensions) + if (extensions.propertyIsEnumerable(ext) && + !instance.propertyIsEnumerable(ext)) + instance[ext] = extensions[ext]; + return instance; + } // (end of function CodeMirror) + + // The default configuration options. + CodeMirror.defaults = { + value: "", + mode: null, + theme: "default", + indentUnit: 2, + indentWithTabs: false, + smartIndent: true, + tabSize: 4, + keyMap: "default", + extraKeys: null, + electricChars: true, + autoClearEmptyLines: false, + onKeyEvent: null, + onDragEvent: null, + lineWrapping: false, + lineNumbers: false, + gutter: false, + fixedGutter: false, + firstLineNumber: 1, + readOnly: false, + dragDrop: true, + onChange: null, + onCursorActivity: null, + onGutterClick: null, + onHighlightComplete: null, + onUpdate: null, + onFocus: null, onBlur: null, onScroll: null, + matchBrackets: false, + workTime: 100, + workDelay: 200, + pollInterval: 100, + undoDepth: 40, + tabindex: null, + autofocus: null + }; + + var ios = /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent); + var mac = ios || /Mac/.test(navigator.platform); + var win = /Win/.test(navigator.platform); + + // Known modes, by name and by MIME + var modes = CodeMirror.modes = {}, mimeModes = CodeMirror.mimeModes = {}; + CodeMirror.defineMode = function(name, mode) { + if (!CodeMirror.defaults.mode && name != "null") CodeMirror.defaults.mode = name; + if (arguments.length > 2) { + mode.dependencies = []; + for (var i = 2; i < arguments.length; ++i) mode.dependencies.push(arguments[i]); + } + modes[name] = mode; + }; + CodeMirror.defineMIME = function(mime, spec) { + mimeModes[mime] = spec; + }; + CodeMirror.resolveMode = function(spec) { + if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) + spec = mimeModes[spec]; + else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) + return CodeMirror.resolveMode("application/xml"); + if (typeof spec == "string") return {name: spec}; + else return spec || {name: "null"}; + }; + CodeMirror.getMode = function(options, spec) { + var spec = CodeMirror.resolveMode(spec); + var mfactory = modes[spec.name]; + if (!mfactory) return CodeMirror.getMode(options, "text/plain"); + return mfactory(options, spec); + }; + CodeMirror.listModes = function() { + var list = []; + for (var m in modes) + if (modes.propertyIsEnumerable(m)) list.push(m); + return list; + }; + CodeMirror.listMIMEs = function() { + var list = []; + for (var m in mimeModes) + if (mimeModes.propertyIsEnumerable(m)) list.push({mime: m, mode: mimeModes[m]}); + return list; + }; + + var extensions = CodeMirror.extensions = {}; + CodeMirror.defineExtension = function(name, func) { + extensions[name] = func; + }; + + var commands = CodeMirror.commands = { + selectAll: function(cm) {cm.setSelection({line: 0, ch: 0}, {line: cm.lineCount() - 1});}, + killLine: function(cm) { + var from = cm.getCursor(true), to = cm.getCursor(false), sel = !posEq(from, to); + if (!sel && cm.getLine(from.line).length == from.ch) cm.replaceRange("", from, {line: from.line + 1, ch: 0}); + else cm.replaceRange("", from, sel ? to : {line: from.line}); + }, + deleteLine: function(cm) {var l = cm.getCursor().line; cm.replaceRange("", {line: l, ch: 0}, {line: l});}, + undo: function(cm) {cm.undo();}, + redo: function(cm) {cm.redo();}, + goDocStart: function(cm) {cm.setCursor(0, 0, true);}, + goDocEnd: function(cm) {cm.setSelection({line: cm.lineCount() - 1}, null, true);}, + goLineStart: function(cm) {cm.setCursor(cm.getCursor().line, 0, true);}, + goLineStartSmart: function(cm) { + var cur = cm.getCursor(); + var text = cm.getLine(cur.line), firstNonWS = Math.max(0, text.search(/\S/)); + cm.setCursor(cur.line, cur.ch <= firstNonWS && cur.ch ? 0 : firstNonWS, true); + }, + goLineEnd: function(cm) {cm.setSelection({line: cm.getCursor().line}, null, true);}, + goLineUp: function(cm) {cm.moveV(-1, "line");}, + goLineDown: function(cm) {cm.moveV(1, "line");}, + goPageUp: function(cm) {cm.moveV(-1, "page");}, + goPageDown: function(cm) {cm.moveV(1, "page");}, + goCharLeft: function(cm) {cm.moveH(-1, "char");}, + goCharRight: function(cm) {cm.moveH(1, "char");}, + goColumnLeft: function(cm) {cm.moveH(-1, "column");}, + goColumnRight: function(cm) {cm.moveH(1, "column");}, + goWordLeft: function(cm) {cm.moveH(-1, "word");}, + goWordRight: function(cm) {cm.moveH(1, "word");}, + delCharLeft: function(cm) {cm.deleteH(-1, "char");}, + delCharRight: function(cm) {cm.deleteH(1, "char");}, + delWordLeft: function(cm) {cm.deleteH(-1, "word");}, + delWordRight: function(cm) {cm.deleteH(1, "word");}, + indentAuto: function(cm) {cm.indentSelection("smart");}, + indentMore: function(cm) {cm.indentSelection("add");}, + indentLess: function(cm) {cm.indentSelection("subtract");}, + insertTab: function(cm) {cm.replaceSelection("\t", "end");}, + transposeChars: function(cm) { + var cur = cm.getCursor(), line = cm.getLine(cur.line); + if (cur.ch > 0 && cur.ch < line.length - 1) + cm.replaceRange(line.charAt(cur.ch) + line.charAt(cur.ch - 1), + {line: cur.line, ch: cur.ch - 1}, {line: cur.line, ch: cur.ch + 1}); + }, + newlineAndIndent: function(cm) { + cm.replaceSelection("\n", "end"); + cm.indentLine(cm.getCursor().line); + }, + toggleOverwrite: function(cm) {cm.toggleOverwrite();} + }; + + var keyMap = CodeMirror.keyMap = {}; + keyMap.basic = { + "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown", + "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown", + "Delete": "delCharRight", "Backspace": "delCharLeft", "Tab": "insertTab", "Shift-Tab": "indentAuto", + "Enter": "newlineAndIndent", "Insert": "toggleOverwrite" + }; + // Note that the save and find-related commands aren't defined by + // default. Unknown commands are simply ignored. + keyMap.pcDefault = { + "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo", + "Ctrl-Home": "goDocStart", "Alt-Up": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Down": "goDocEnd", + "Ctrl-Left": "goWordLeft", "Ctrl-Right": "goWordRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd", + "Ctrl-Backspace": "delWordLeft", "Ctrl-Delete": "delWordRight", "Ctrl-S": "save", "Ctrl-F": "find", + "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll", + "Ctrl-[": "indentLess", "Ctrl-]": "indentMore", + fallthrough: "basic" + }; + keyMap.macDefault = { + "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo", + "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goWordLeft", + "Alt-Right": "goWordRight", "Cmd-Left": "goLineStart", "Cmd-Right": "goLineEnd", "Alt-Backspace": "delWordLeft", + "Ctrl-Alt-Backspace": "delWordRight", "Alt-Delete": "delWordRight", "Cmd-S": "save", "Cmd-F": "find", + "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll", + "Cmd-[": "indentLess", "Cmd-]": "indentMore", + fallthrough: ["basic", "emacsy"] + }; + keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault; + keyMap.emacsy = { + "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown", + "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd", + "Ctrl-V": "goPageUp", "Shift-Ctrl-V": "goPageDown", "Ctrl-D": "delCharRight", "Ctrl-H": "delCharLeft", + "Alt-D": "delWordRight", "Alt-Backspace": "delWordLeft", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars" + }; + + function getKeyMap(val) { + if (typeof val == "string") return keyMap[val]; + else return val; + } + function lookupKey(name, extraMap, map, handle, stop) { + function lookup(map) { + map = getKeyMap(map); + var found = map[name]; + if (found != null && handle(found)) return true; + if (map.nofallthrough) { + if (stop) stop(); + return true; + } + var fallthrough = map.fallthrough; + if (fallthrough == null) return false; + if (Object.prototype.toString.call(fallthrough) != "[object Array]") + return lookup(fallthrough); + for (var i = 0, e = fallthrough.length; i < e; ++i) { + if (lookup(fallthrough[i])) return true; + } + return false; + } + if (extraMap && lookup(extraMap)) return true; + return lookup(map); + } + function isModifierKey(event) { + var name = keyNames[e_prop(event, "keyCode")]; + return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod"; + } + + CodeMirror.fromTextArea = function(textarea, options) { + if (!options) options = {}; + options.value = textarea.value; + if (!options.tabindex && textarea.tabindex) + options.tabindex = textarea.tabindex; + if (options.autofocus == null && textarea.getAttribute("autofocus") != null) + options.autofocus = true; + + function save() {textarea.value = instance.getValue();} + if (textarea.form) { + // Deplorable hack to make the submit method do the right thing. + var rmSubmit = connect(textarea.form, "submit", save, true); + if (typeof textarea.form.submit == "function") { + var realSubmit = textarea.form.submit; + function wrappedSubmit() { + save(); + textarea.form.submit = realSubmit; + textarea.form.submit(); + textarea.form.submit = wrappedSubmit; + } + textarea.form.submit = wrappedSubmit; + } + } + + textarea.style.display = "none"; + var instance = CodeMirror(function(node) { + textarea.parentNode.insertBefore(node, textarea.nextSibling); + }, options); + instance.save = save; + instance.getTextArea = function() { return textarea; }; + instance.toTextArea = function() { + save(); + textarea.parentNode.removeChild(instance.getWrapperElement()); + textarea.style.display = ""; + if (textarea.form) { + rmSubmit(); + if (typeof textarea.form.submit == "function") + textarea.form.submit = realSubmit; + } + }; + return instance; + }; + + // Utility functions for working with state. Exported because modes + // sometimes need to do this. + function copyState(mode, state) { + if (state === true) return state; + if (mode.copyState) return mode.copyState(state); + var nstate = {}; + for (var n in state) { + var val = state[n]; + if (val instanceof Array) val = val.concat([]); + nstate[n] = val; + } + return nstate; + } + CodeMirror.copyState = copyState; + function startState(mode, a1, a2) { + return mode.startState ? mode.startState(a1, a2) : true; + } + CodeMirror.startState = startState; + + // The character stream used by a mode's parser. + function StringStream(string, tabSize) { + this.pos = this.start = 0; + this.string = string; + this.tabSize = tabSize || 8; + } + StringStream.prototype = { + eol: function() {return this.pos >= this.string.length;}, + sol: function() {return this.pos == 0;}, + peek: function() {return this.string.charAt(this.pos);}, + next: function() { + if (this.pos < this.string.length) + return this.string.charAt(this.pos++); + }, + eat: function(match) { + var ch = this.string.charAt(this.pos); + if (typeof match == "string") var ok = ch == match; + else var ok = ch && (match.test ? match.test(ch) : match(ch)); + if (ok) {++this.pos; return ch;} + }, + eatWhile: function(match) { + var start = this.pos; + while (this.eat(match)){} + return this.pos > start; + }, + eatSpace: function() { + var start = this.pos; + while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos; + return this.pos > start; + }, + skipToEnd: function() {this.pos = this.string.length;}, + skipTo: function(ch) { + var found = this.string.indexOf(ch, this.pos); + if (found > -1) {this.pos = found; return true;} + }, + backUp: function(n) {this.pos -= n;}, + column: function() {return countColumn(this.string, this.start, this.tabSize);}, + indentation: function() {return countColumn(this.string, null, this.tabSize);}, + match: function(pattern, consume, caseInsensitive) { + if (typeof pattern == "string") { + function cased(str) {return caseInsensitive ? str.toLowerCase() : str;} + if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) { + if (consume !== false) this.pos += pattern.length; + return true; + } + } + else { + var match = this.string.slice(this.pos).match(pattern); + if (match && consume !== false) this.pos += match[0].length; + return match; + } + }, + current: function(){return this.string.slice(this.start, this.pos);} + }; + CodeMirror.StringStream = StringStream; + + function MarkedText(from, to, className, marker) { + this.from = from; this.to = to; this.style = className; this.marker = marker; + } + MarkedText.prototype = { + attach: function(line) { this.marker.set.push(line); }, + detach: function(line) { + var ix = indexOf(this.marker.set, line); + if (ix > -1) this.marker.set.splice(ix, 1); + }, + split: function(pos, lenBefore) { + if (this.to <= pos && this.to != null) return null; + var from = this.from < pos || this.from == null ? null : this.from - pos + lenBefore; + var to = this.to == null ? null : this.to - pos + lenBefore; + return new MarkedText(from, to, this.style, this.marker); + }, + dup: function() { return new MarkedText(null, null, this.style, this.marker); }, + clipTo: function(fromOpen, from, toOpen, to, diff) { + if (fromOpen && to > this.from && (to < this.to || this.to == null)) + this.from = null; + else if (this.from != null && this.from >= from) + this.from = Math.max(to, this.from) + diff; + if (toOpen && (from < this.to || this.to == null) && (from > this.from || this.from == null)) + this.to = null; + else if (this.to != null && this.to > from) + this.to = to < this.to ? this.to + diff : from; + }, + isDead: function() { return this.from != null && this.to != null && this.from >= this.to; }, + sameSet: function(x) { return this.marker == x.marker; } + }; + + function Bookmark(pos) { + this.from = pos; this.to = pos; this.line = null; + } + Bookmark.prototype = { + attach: function(line) { this.line = line; }, + detach: function(line) { if (this.line == line) this.line = null; }, + split: function(pos, lenBefore) { + if (pos < this.from) { + this.from = this.to = (this.from - pos) + lenBefore; + return this; + } + }, + isDead: function() { return this.from > this.to; }, + clipTo: function(fromOpen, from, toOpen, to, diff) { + if ((fromOpen || from < this.from) && (toOpen || to > this.to)) { + this.from = 0; this.to = -1; + } else if (this.from > from) { + this.from = this.to = Math.max(to, this.from) + diff; + } + }, + sameSet: function(x) { return false; }, + find: function() { + if (!this.line || !this.line.parent) return null; + return {line: lineNo(this.line), ch: this.from}; + }, + clear: function() { + if (this.line) { + var found = indexOf(this.line.marked, this); + if (found != -1) this.line.marked.splice(found, 1); + this.line = null; + } + } + }; + + // Line objects. These hold state related to a line, including + // highlighting info (the styles array). + function Line(text, styles) { + this.styles = styles || [text, null]; + this.text = text; + this.height = 1; + this.marked = this.gutterMarker = this.className = this.bgClassName = this.handlers = null; + this.stateAfter = this.parent = this.hidden = null; + } + Line.inheritMarks = function(text, orig) { + var ln = new Line(text), mk = orig && orig.marked; + if (mk) { + for (var i = 0; i < mk.length; ++i) { + if (mk[i].to == null && mk[i].style) { + var newmk = ln.marked || (ln.marked = []), mark = mk[i]; + var nmark = mark.dup(); newmk.push(nmark); nmark.attach(ln); + } + } + } + return ln; + } + Line.prototype = { + // Replace a piece of a line, keeping the styles around it intact. + replace: function(from, to_, text) { + var st = [], mk = this.marked, to = to_ == null ? this.text.length : to_; + copyStyles(0, from, this.styles, st); + if (text) st.push(text, null); + copyStyles(to, this.text.length, this.styles, st); + this.styles = st; + this.text = this.text.slice(0, from) + text + this.text.slice(to); + this.stateAfter = null; + if (mk) { + var diff = text.length - (to - from); + for (var i = 0; i < mk.length; ++i) { + var mark = mk[i]; + mark.clipTo(from == null, from || 0, to_ == null, to, diff); + if (mark.isDead()) {mark.detach(this); mk.splice(i--, 1);} + } + } + }, + // Split a part off a line, keeping styles and markers intact. + split: function(pos, textBefore) { + var st = [textBefore, null], mk = this.marked; + copyStyles(pos, this.text.length, this.styles, st); + var taken = new Line(textBefore + this.text.slice(pos), st); + if (mk) { + for (var i = 0; i < mk.length; ++i) { + var mark = mk[i]; + var newmark = mark.split(pos, textBefore.length); + if (newmark) { + if (!taken.marked) taken.marked = []; + taken.marked.push(newmark); newmark.attach(taken); + if (newmark == mark) mk.splice(i--, 1); + } + } + } + return taken; + }, + append: function(line) { + var mylen = this.text.length, mk = line.marked, mymk = this.marked; + this.text += line.text; + copyStyles(0, line.text.length, line.styles, this.styles); + if (mymk) { + for (var i = 0; i < mymk.length; ++i) + if (mymk[i].to == null) mymk[i].to = mylen; + } + if (mk && mk.length) { + if (!mymk) this.marked = mymk = []; + outer: for (var i = 0; i < mk.length; ++i) { + var mark = mk[i]; + if (!mark.from) { + for (var j = 0; j < mymk.length; ++j) { + var mymark = mymk[j]; + if (mymark.to == mylen && mymark.sameSet(mark)) { + mymark.to = mark.to == null ? null : mark.to + mylen; + if (mymark.isDead()) { + mymark.detach(this); + mk.splice(i--, 1); + } + continue outer; + } + } + } + mymk.push(mark); + mark.attach(this); + mark.from += mylen; + if (mark.to != null) mark.to += mylen; + } + } + }, + fixMarkEnds: function(other) { + var mk = this.marked, omk = other.marked; + if (!mk) return; + for (var i = 0; i < mk.length; ++i) { + var mark = mk[i], close = mark.to == null; + if (close && omk) { + for (var j = 0; j < omk.length; ++j) + if (omk[j].sameSet(mark)) {close = false; break;} + } + if (close) mark.to = this.text.length; + } + }, + fixMarkStarts: function() { + var mk = this.marked; + if (!mk) return; + for (var i = 0; i < mk.length; ++i) + if (mk[i].from == null) mk[i].from = 0; + }, + addMark: function(mark) { + mark.attach(this); + if (this.marked == null) this.marked = []; + this.marked.push(mark); + this.marked.sort(function(a, b){return (a.from || 0) - (b.from || 0);}); + }, + // Run the given mode's parser over a line, update the styles + // array, which contains alternating fragments of text and CSS + // classes. + highlight: function(mode, state, tabSize) { + var stream = new StringStream(this.text, tabSize), st = this.styles, pos = 0; + var changed = false, curWord = st[0], prevWord; + if (this.text == "" && mode.blankLine) mode.blankLine(state); + while (!stream.eol()) { + var style = mode.token(stream, state); + var substr = this.text.slice(stream.start, stream.pos); + stream.start = stream.pos; + if (pos && st[pos-1] == style) + st[pos-2] += substr; + else if (substr) { + if (!changed && (st[pos+1] != style || (pos && st[pos-2] != prevWord))) changed = true; + st[pos++] = substr; st[pos++] = style; + prevWord = curWord; curWord = st[pos]; + } + // Give up when line is ridiculously long + if (stream.pos > 5000) { + st[pos++] = this.text.slice(stream.pos); st[pos++] = null; + break; + } + } + if (st.length != pos) {st.length = pos; changed = true;} + if (pos && st[pos-2] != prevWord) changed = true; + // Short lines with simple highlights return null, and are + // counted as changed by the driver because they are likely to + // highlight the same way in various contexts. + return changed || (st.length < 5 && this.text.length < 10 ? null : false); + }, + // Fetch the parser token for a given character. Useful for hacks + // that want to inspect the mode state (say, for completion). + getTokenAt: function(mode, state, ch) { + var txt = this.text, stream = new StringStream(txt); + while (stream.pos < ch && !stream.eol()) { + stream.start = stream.pos; + var style = mode.token(stream, state); + } + return {start: stream.start, + end: stream.pos, + string: stream.current(), + className: style || null, + state: state}; + }, + indentation: function(tabSize) {return countColumn(this.text, null, tabSize);}, + // Produces an HTML fragment for the line, taking selection, + // marking, and highlighting into account. + getHTML: function(makeTab, wrapAt, wrapId, wrapWBR) { + var html = [], first = true, col = 0; + function span_(text, style) { + if (!text) return; + // Work around a bug where, in some compat modes, IE ignores leading spaces + if (first && ie && text.charAt(0) == " ") text = "\u00a0" + text.slice(1); + first = false; + if (text.indexOf("\t") == -1) { + col += text.length; + var escaped = htmlEscape(text); + } else { + var escaped = ""; + for (var pos = 0;;) { + var idx = text.indexOf("\t", pos); + if (idx == -1) { + escaped += htmlEscape(text.slice(pos)); + col += text.length - pos; + break; + } else { + col += idx - pos; + var tab = makeTab(col); + escaped += htmlEscape(text.slice(pos, idx)) + tab.html; + col += tab.width; + pos = idx + 1; + } + } + } + if (style) html.push('<span class="', style, '">', escaped, "</span>"); + else html.push(escaped); + } + var span = span_; + if (wrapAt != null) { + var outPos = 0, open = "<span id=\"" + wrapId + "\">"; + span = function(text, style) { + var l = text.length; + if (wrapAt >= outPos && wrapAt < outPos + l) { + if (wrapAt > outPos) { + span_(text.slice(0, wrapAt - outPos), style); + // See comment at the definition of spanAffectsWrapping + if (wrapWBR) html.push("<wbr>"); + } + html.push(open); + span_(text.slice(wrapAt - outPos), style); + html.push("</span>"); + wrapAt--; + outPos += l; + } else { + outPos += l; + span_(text, style); + // Output empty wrapper when at end of line + if (outPos == wrapAt && outPos == len) html.push(open + "</span>"); + // Stop outputting HTML when gone sufficiently far beyond measure + else if (outPos > wrapAt + 10 && /\s/.test(text)) span = function(){}; + } + } + } + + var st = this.styles, allText = this.text, marked = this.marked; + var len = allText.length; + function styleToClass(style) { + if (!style) return null; + return "cm-" + style.replace(/ +/g, " cm-"); + } + + if (!allText && wrapAt == null) { + span(" "); + } else if (!marked || !marked.length) { + for (var i = 0, ch = 0; ch < len; i+=2) { + var str = st[i], style = st[i+1], l = str.length; + if (ch + l > len) str = str.slice(0, len - ch); + ch += l; + span(str, styleToClass(style)); + } + } else { + var pos = 0, i = 0, text = "", style, sg = 0; + var nextChange = marked[0].from || 0, marks = [], markpos = 0; + function advanceMarks() { + var m; + while (markpos < marked.length && + ((m = marked[markpos]).from == pos || m.from == null)) { + if (m.style != null) marks.push(m); + ++markpos; + } + nextChange = markpos < marked.length ? marked[markpos].from : Infinity; + for (var i = 0; i < marks.length; ++i) { + var to = marks[i].to || Infinity; + if (to == pos) marks.splice(i--, 1); + else nextChange = Math.min(to, nextChange); + } + } + var m = 0; + while (pos < len) { + if (nextChange == pos) advanceMarks(); + var upto = Math.min(len, nextChange); + while (true) { + if (text) { + var end = pos + text.length; + var appliedStyle = style; + for (var j = 0; j < marks.length; ++j) + appliedStyle = (appliedStyle ? appliedStyle + " " : "") + marks[j].style; + span(end > upto ? text.slice(0, upto - pos) : text, appliedStyle); + if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;} + pos = end; + } + text = st[i++]; style = styleToClass(st[i++]); + } + } + } + return html.join(""); + }, + cleanUp: function() { + this.parent = null; + if (this.marked) + for (var i = 0, e = this.marked.length; i < e; ++i) this.marked[i].detach(this); + } + }; + // Utility used by replace and split above + function copyStyles(from, to, source, dest) { + for (var i = 0, pos = 0, state = 0; pos < to; i+=2) { + var part = source[i], end = pos + part.length; + if (state == 0) { + if (end > from) dest.push(part.slice(from - pos, Math.min(part.length, to - pos)), source[i+1]); + if (end >= from) state = 1; + } + else if (state == 1) { + if (end > to) dest.push(part.slice(0, to - pos), source[i+1]); + else dest.push(part, source[i+1]); + } + pos = end; + } + } + + // Data structure that holds the sequence of lines. + function LeafChunk(lines) { + this.lines = lines; + this.parent = null; + for (var i = 0, e = lines.length, height = 0; i < e; ++i) { + lines[i].parent = this; + height += lines[i].height; + } + this.height = height; + } + LeafChunk.prototype = { + chunkSize: function() { return this.lines.length; }, + remove: function(at, n, callbacks) { + for (var i = at, e = at + n; i < e; ++i) { + var line = this.lines[i]; + this.height -= line.height; + line.cleanUp(); + if (line.handlers) + for (var j = 0; j < line.handlers.length; ++j) callbacks.push(line.handlers[j]); + } + this.lines.splice(at, n); + }, + collapse: function(lines) { + lines.splice.apply(lines, [lines.length, 0].concat(this.lines)); + }, + insertHeight: function(at, lines, height) { + this.height += height; + // The trick below is apparently too advanced for IE, which + // occasionally corrupts this.lines (duplicating elements) when + // it is used. + if (ie) this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at)); + else this.lines.splice.apply(this.lines, [at, 0].concat(lines)); + for (var i = 0, e = lines.length; i < e; ++i) lines[i].parent = this; + }, + iterN: function(at, n, op) { + for (var e = at + n; at < e; ++at) + if (op(this.lines[at])) return true; + } + }; + function BranchChunk(children) { + this.children = children; + var size = 0, height = 0; + for (var i = 0, e = children.length; i < e; ++i) { + var ch = children[i]; + size += ch.chunkSize(); height += ch.height; + ch.parent = this; + } + this.size = size; + this.height = height; + this.parent = null; + } + BranchChunk.prototype = { + chunkSize: function() { return this.size; }, + remove: function(at, n, callbacks) { + this.size -= n; + for (var i = 0; i < this.children.length; ++i) { + var child = this.children[i], sz = child.chunkSize(); + if (at < sz) { + var rm = Math.min(n, sz - at), oldHeight = child.height; + child.remove(at, rm, callbacks); + this.height -= oldHeight - child.height; + if (sz == rm) { this.children.splice(i--, 1); child.parent = null; } + if ((n -= rm) == 0) break; + at = 0; + } else at -= sz; + } + if (this.size - n < 25) { + var lines = []; + this.collapse(lines); + this.children = [new LeafChunk(lines)]; + this.children[0].parent = this; + } + }, + collapse: function(lines) { + for (var i = 0, e = this.children.length; i < e; ++i) this.children[i].collapse(lines); + }, + insert: function(at, lines) { + var height = 0; + for (var i = 0, e = lines.length; i < e; ++i) height += lines[i].height; + this.insertHeight(at, lines, height); + }, + insertHeight: function(at, lines, height) { + this.size += lines.length; + this.height += height; + for (var i = 0, e = this.children.length; i < e; ++i) { + var child = this.children[i], sz = child.chunkSize(); + if (at <= sz) { + child.insertHeight(at, lines, height); + if (child.lines && child.lines.length > 50) { + while (child.lines.length > 50) { + var spilled = child.lines.splice(child.lines.length - 25, 25); + var newleaf = new LeafChunk(spilled); + child.height -= newleaf.height; + this.children.splice(i + 1, 0, newleaf); + newleaf.parent = this; + } + this.maybeSpill(); + } + break; + } + at -= sz; + } + }, + maybeSpill: function() { + if (this.children.length <= 10) return; + var me = this; + do { + var spilled = me.children.splice(me.children.length - 5, 5); + var sibling = new BranchChunk(spilled); + if (!me.parent) { // Become the parent node + var copy = new BranchChunk(me.children); + copy.parent = me; + me.children = [copy, sibling]; + me = copy; + } else { + me.size -= sibling.size; + me.height -= sibling.height; + var myIndex = indexOf(me.parent.children, me); + me.parent.children.splice(myIndex + 1, 0, sibling); + } + sibling.parent = me.parent; + } while (me.children.length > 10); + me.parent.maybeSpill(); + }, + iter: function(from, to, op) { this.iterN(from, to - from, op); }, + iterN: function(at, n, op) { + for (var i = 0, e = this.children.length; i < e; ++i) { + var child = this.children[i], sz = child.chunkSize(); + if (at < sz) { + var used = Math.min(n, sz - at); + if (child.iterN(at, used, op)) return true; + if ((n -= used) == 0) break; + at = 0; + } else at -= sz; + } + } + }; + + function getLineAt(chunk, n) { + while (!chunk.lines) { + for (var i = 0;; ++i) { + var child = chunk.children[i], sz = child.chunkSize(); + if (n < sz) { chunk = child; break; } + n -= sz; + } + } + return chunk.lines[n]; + } + function lineNo(line) { + if (line.parent == null) return null; + var cur = line.parent, no = indexOf(cur.lines, line); + for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) { + for (var i = 0, e = chunk.children.length; ; ++i) { + if (chunk.children[i] == cur) break; + no += chunk.children[i].chunkSize(); + } + } + return no; + } + function lineAtHeight(chunk, h) { + var n = 0; + outer: do { + for (var i = 0, e = chunk.children.length; i < e; ++i) { + var child = chunk.children[i], ch = child.height; + if (h < ch) { chunk = child; continue outer; } + h -= ch; + n += child.chunkSize(); + } + return n; + } while (!chunk.lines); + for (var i = 0, e = chunk.lines.length; i < e; ++i) { + var line = chunk.lines[i], lh = line.height; + if (h < lh) break; + h -= lh; + } + return n + i; + } + function heightAtLine(chunk, n) { + var h = 0; + outer: do { + for (var i = 0, e = chunk.children.length; i < e; ++i) { + var child = chunk.children[i], sz = child.chunkSize(); + if (n < sz) { chunk = child; continue outer; } + n -= sz; + h += child.height; + } + return h; + } while (!chunk.lines); + for (var i = 0; i < n; ++i) h += chunk.lines[i].height; + return h; + } + + // The history object 'chunks' changes that are made close together + // and at almost the same time into bigger undoable units. + function History() { + this.time = 0; + this.done = []; this.undone = []; + this.compound = 0; + this.closed = false; + } + History.prototype = { + addChange: function(start, added, old) { + this.undone.length = 0; + var time = +new Date, cur = this.done[this.done.length - 1], last = cur && cur[cur.length - 1]; + var dtime = time - this.time; + + if (this.compound && cur && !this.closed) { + cur.push({start: start, added: added, old: old}); + } else if (dtime > 400 || !last || this.closed || + last.start > start + old.length || last.start + last.added < start) { + this.done.push([{start: start, added: added, old: old}]); + this.closed = false; + } else { + var startBefore = Math.max(0, last.start - start), + endAfter = Math.max(0, (start + old.length) - (last.start + last.added)); + for (var i = startBefore; i > 0; --i) last.old.unshift(old[i - 1]); + for (var i = endAfter; i > 0; --i) last.old.push(old[old.length - i]); + if (startBefore) last.start = start; + last.added += added - (old.length - startBefore - endAfter); + } + this.time = time; + }, + startCompound: function() { + if (!this.compound++) this.closed = true; + }, + endCompound: function() { + if (!--this.compound) this.closed = true; + } + }; + + function stopMethod() {e_stop(this);} + // Ensure an event has a stop method. + function addStop(event) { + if (!event.stop) event.stop = stopMethod; + return event; + } + + function e_preventDefault(e) { + if (e.preventDefault) e.preventDefault(); + else e.returnValue = false; + } + function e_stopPropagation(e) { + if (e.stopPropagation) e.stopPropagation(); + else e.cancelBubble = true; + } + function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);} + CodeMirror.e_stop = e_stop; + CodeMirror.e_preventDefault = e_preventDefault; + CodeMirror.e_stopPropagation = e_stopPropagation; + + function e_target(e) {return e.target || e.srcElement;} + function e_button(e) { + if (e.which) return e.which; + else if (e.button & 1) return 1; + else if (e.button & 2) return 3; + else if (e.button & 4) return 2; + } + + // Allow 3rd-party code to override event properties by adding an override + // object to an event object. + function e_prop(e, prop) { + var overridden = e.override && e.override.hasOwnProperty(prop); + return overridden ? e.override[prop] : e[prop]; + } + + // Event handler registration. If disconnect is true, it'll return a + // function that unregisters the handler. + function connect(node, type, handler, disconnect) { + if (typeof node.addEventListener == "function") { + node.addEventListener(type, handler, false); + if (disconnect) return function() {node.removeEventListener(type, handler, false);}; + } + else { + var wrapHandler = function(event) {handler(event || window.event);}; + node.attachEvent("on" + type, wrapHandler); + if (disconnect) return function() {node.detachEvent("on" + type, wrapHandler);}; + } + } + CodeMirror.connect = connect; + + function Delayed() {this.id = null;} + Delayed.prototype = {set: function(ms, f) {clearTimeout(this.id); this.id = setTimeout(f, ms);}}; + + var Pass = CodeMirror.Pass = {toString: function(){return "CodeMirror.Pass";}}; + + var gecko = /gecko\/\d{7}/i.test(navigator.userAgent); + var ie = /MSIE \d/.test(navigator.userAgent); + var ie_lt9 = /MSIE [1-8]\b/.test(navigator.userAgent); + var quirksMode = ie && document.documentMode == 5; + var webkit = /WebKit\//.test(navigator.userAgent); + var chrome = /Chrome\//.test(navigator.userAgent); + var safari = /Apple Computer/.test(navigator.vendor); + var khtml = /KHTML\//.test(navigator.userAgent); + + // Detect drag-and-drop + var dragAndDrop = function() { + // There is *some* kind of drag-and-drop support in IE6-8, but I + // couldn't get it to work yet. + if (ie_lt9) return false; + var div = document.createElement('div'); + return "draggable" in div || "dragDrop" in div; + }(); + + // Feature-detect whether newlines in textareas are converted to \r\n + var lineSep = function () { + var te = document.createElement("textarea"); + te.value = "foo\nbar"; + if (te.value.indexOf("\r") > -1) return "\r\n"; + return "\n"; + }(); + + // For a reason I have yet to figure out, some browsers disallow + // word wrapping between certain characters *only* if a new inline + // element is started between them. This makes it hard to reliably + // measure the position of things, since that requires inserting an + // extra span. This terribly fragile set of regexps matches the + // character combinations that suffer from this phenomenon on the + // various browsers. + var spanAffectsWrapping = /^$/; // Won't match any two-character string + if (gecko) spanAffectsWrapping = /$'/; + else if (safari) spanAffectsWrapping = /\-[^ \-?]|\?[^ !'\"\),.\-\/:;\?\]\}]/; + else if (chrome) spanAffectsWrapping = /\-[^ \-\.?]|\?[^ \-\.?\]\}:;!'\"\),\/]|[\.!\"#&%\)*+,:;=>\]|\}~][\(\{\[<]|\$'/; + + // Counts the column offset in a string, taking tabs into account. + // Used mostly to find indentation. + function countColumn(string, end, tabSize) { + if (end == null) { + end = string.search(/[^\s\u00a0]/); + if (end == -1) end = string.length; + } + for (var i = 0, n = 0; i < end; ++i) { + if (string.charAt(i) == "\t") n += tabSize - (n % tabSize); + else ++n; + } + return n; + } + + function computedStyle(elt) { + if (elt.currentStyle) return elt.currentStyle; + return window.getComputedStyle(elt, null); + } + + // Find the position of an element by following the offsetParent chain. + // If screen==true, it returns screen (rather than page) coordinates. + function eltOffset(node, screen) { + var bod = node.ownerDocument.body; + var x = 0, y = 0, skipBody = false; + for (var n = node; n; n = n.offsetParent) { + var ol = n.offsetLeft, ot = n.offsetTop; + // Firefox reports weird inverted offsets when the body has a border. + if (n == bod) { x += Math.abs(ol); y += Math.abs(ot); } + else { x += ol, y += ot; } + if (screen && computedStyle(n).position == "fixed") + skipBody = true; + } + var e = screen && !skipBody ? null : bod; + for (var n = node.parentNode; n != e; n = n.parentNode) + if (n.scrollLeft != null) { x -= n.scrollLeft; y -= n.scrollTop;} + return {left: x, top: y}; + } + // Use the faster and saner getBoundingClientRect method when possible. + if (document.documentElement.getBoundingClientRect != null) eltOffset = function(node, screen) { + // Take the parts of bounding client rect that we are interested in so we are able to edit if need be, + // since the returned value cannot be changed externally (they are kept in sync as the element moves within the page) + try { var box = node.getBoundingClientRect(); box = { top: box.top, left: box.left }; } + catch(e) { box = {top: 0, left: 0}; } + if (!screen) { + // Get the toplevel scroll, working around browser differences. + if (window.pageYOffset == null) { + var t = document.documentElement || document.body.parentNode; + if (t.scrollTop == null) t = document.body; + box.top += t.scrollTop; box.left += t.scrollLeft; + } else { + box.top += window.pageYOffset; box.left += window.pageXOffset; + } + } + return box; + }; + + // Get a node's text content. + function eltText(node) { + return node.textContent || node.innerText || node.nodeValue || ""; + } + function selectInput(node) { + if (ios) { // Mobile Safari apparently has a bug where select() is broken. + node.selectionStart = 0; + node.selectionEnd = node.value.length; + } else node.select(); + } + + // Operations on {line, ch} objects. + function posEq(a, b) {return a.line == b.line && a.ch == b.ch;} + function posLess(a, b) {return a.line < b.line || (a.line == b.line && a.ch < b.ch);} + function copyPos(x) {return {line: x.line, ch: x.ch};} + + var escapeElement = document.createElement("pre"); + function htmlEscape(str) { + escapeElement.textContent = str; + return escapeElement.innerHTML; + } + // Recent (late 2011) Opera betas insert bogus newlines at the start + // of the textContent, so we strip those. + if (htmlEscape("a") == "\na") + htmlEscape = function(str) { + escapeElement.textContent = str; + return escapeElement.innerHTML.slice(1); + }; + // Some IEs don't preserve tabs through innerHTML + else if (htmlEscape("\t") != "\t") + htmlEscape = function(str) { + escapeElement.innerHTML = ""; + escapeElement.appendChild(document.createTextNode(str)); + return escapeElement.innerHTML; + }; + CodeMirror.htmlEscape = htmlEscape; + + // Used to position the cursor after an undo/redo by finding the + // last edited character. + function editEnd(from, to) { + if (!to) return 0; + if (!from) return to.length; + for (var i = from.length, j = to.length; i >= 0 && j >= 0; --i, --j) + if (from.charAt(i) != to.charAt(j)) break; + return j + 1; + } + + function indexOf(collection, elt) { + if (collection.indexOf) return collection.indexOf(elt); + for (var i = 0, e = collection.length; i < e; ++i) + if (collection[i] == elt) return i; + return -1; + } + function isWordChar(ch) { + return /\w/.test(ch) || ch.toUpperCase() != ch.toLowerCase(); + } + + // See if "".split is the broken IE version, if so, provide an + // alternative way to split lines. + var splitLines = "\n\nb".split(/\n/).length != 3 ? function(string) { + var pos = 0, nl, result = []; + while ((nl = string.indexOf("\n", pos)) > -1) { + result.push(string.slice(pos, string.charAt(nl-1) == "\r" ? nl - 1 : nl)); + pos = nl + 1; + } + result.push(string.slice(pos)); + return result; + } : function(string){return string.split(/\r?\n/);}; + CodeMirror.splitLines = splitLines; + + var hasSelection = window.getSelection ? function(te) { + try { return te.selectionStart != te.selectionEnd; } + catch(e) { return false; } + } : function(te) { + try {var range = te.ownerDocument.selection.createRange();} + catch(e) {} + if (!range || range.parentElement() != te) return false; + return range.compareEndPoints("StartToEnd", range) != 0; + }; + + CodeMirror.defineMode("null", function() { + return {token: function(stream) {stream.skipToEnd();}}; + }); + CodeMirror.defineMIME("text/plain", "null"); + + var keyNames = {3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt", + 19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End", + 36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert", + 46: "Delete", 59: ";", 91: "Mod", 92: "Mod", 93: "Mod", 127: "Delete", 186: ";", 187: "=", 188: ",", + 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\", 221: "]", 222: "'", 63276: "PageUp", + 63277: "PageDown", 63275: "End", 63273: "Home", 63234: "Left", 63232: "Up", 63235: "Right", + 63233: "Down", 63302: "Insert", 63272: "Delete"}; + CodeMirror.keyNames = keyNames; + (function() { + // Number keys + for (var i = 0; i < 10; i++) keyNames[i + 48] = String(i); + // Alphabetic keys + for (var i = 65; i <= 90; i++) keyNames[i] = String.fromCharCode(i); + // Function keys + for (var i = 1; i <= 12; i++) keyNames[i + 111] = keyNames[i + 63235] = "F" + i; + })(); + + return CodeMirror; +})(); diff --git a/src/main/webapp/javascripts/libs/codemirror/mode/mysql/mysql.js b/src/main/webapp/javascripts/libs/codemirror/mode/mysql/mysql.js new file mode 100644 index 0000000..dca5b0f --- /dev/null +++ b/src/main/webapp/javascripts/libs/codemirror/mode/mysql/mysql.js @@ -0,0 +1,188 @@ +/* + * MySQL Mode for CodeMirror 2 by MySQL-Tools + * @author James Thorne (partydroid) + * @link http://github.com/partydroid/MySQL-Tools + * @link http://mysqltools.org + * @version 02/Jan/2012 +*/ +CodeMirror.defineMode("mysql", function(config) { + var indentUnit = config.indentUnit; + var curPunc; + + function wordRegexp(words) { + return new RegExp("^(?:" + words.join("|") + ")$", "i"); + } + var ops = wordRegexp(["str", "lang", "langmatches", "datatype", "bound", "sameterm", "isiri", "isuri", + "isblank", "isliteral", "union", "a"]); + var keywords = wordRegexp([ + ('ACCESSIBLE'),('ALTER'),('AS'),('BEFORE'),('BINARY'),('BY'),('CASE'),('CHARACTER'),('COLUMN'),('CONTINUE'),('CROSS'),('CURRENT_TIMESTAMP'),('DATABASE'),('DAY_MICROSECOND'),('DEC'),('DEFAULT'), + ('DESC'),('DISTINCT'),('DOUBLE'),('EACH'),('ENCLOSED'),('EXIT'),('FETCH'),('FLOAT8'),('FOREIGN'),('GRANT'),('HIGH_PRIORITY'),('HOUR_SECOND'),('IN'),('INNER'),('INSERT'),('INT2'),('INT8'), + ('INTO'),('JOIN'),('KILL'),('LEFT'),('LINEAR'),('LOCALTIME'),('LONG'),('LOOP'),('MATCH'),('MEDIUMTEXT'),('MINUTE_SECOND'),('NATURAL'),('NULL'),('OPTIMIZE'),('OR'),('OUTER'),('PRIMARY'), + ('RANGE'),('READ_WRITE'),('REGEXP'),('REPEAT'),('RESTRICT'),('RIGHT'),('SCHEMAS'),('SENSITIVE'),('SHOW'),('SPECIFIC'),('SQLSTATE'),('SQL_CALC_FOUND_ROWS'),('STARTING'),('TERMINATED'), + ('TINYINT'),('TRAILING'),('UNDO'),('UNLOCK'),('USAGE'),('UTC_DATE'),('VALUES'),('VARCHARACTER'),('WHERE'),('WRITE'),('ZEROFILL'),('ALL'),('AND'),('ASENSITIVE'),('BIGINT'),('BOTH'),('CASCADE'), + ('CHAR'),('COLLATE'),('CONSTRAINT'),('CREATE'),('CURRENT_TIME'),('CURSOR'),('DAY_HOUR'),('DAY_SECOND'),('DECLARE'),('DELETE'),('DETERMINISTIC'),('DIV'),('DUAL'),('ELSEIF'),('EXISTS'),('FALSE'), + ('FLOAT4'),('FORCE'),('FULLTEXT'),('HAVING'),('HOUR_MINUTE'),('IGNORE'),('INFILE'),('INSENSITIVE'),('INT1'),('INT4'),('INTERVAL'),('ITERATE'),('KEYS'),('LEAVE'),('LIMIT'),('LOAD'),('LOCK'), + ('LONGTEXT'),('MASTER_SSL_VERIFY_SERVER_CERT'),('MEDIUMINT'),('MINUTE_MICROSECOND'),('MODIFIES'),('NO_WRITE_TO_BINLOG'),('ON'),('OPTIONALLY'),('OUT'),('PRECISION'),('PURGE'),('READS'), + ('REFERENCES'),('RENAME'),('REQUIRE'),('REVOKE'),('SCHEMA'),('SELECT'),('SET'),('SPATIAL'),('SQLEXCEPTION'),('SQL_BIG_RESULT'),('SSL'),('TABLE'),('TINYBLOB'),('TO'),('TRUE'),('UNIQUE'), + ('UPDATE'),('USING'),('UTC_TIMESTAMP'),('VARCHAR'),('WHEN'),('WITH'),('YEAR_MONTH'),('ADD'),('ANALYZE'),('ASC'),('BETWEEN'),('BLOB'),('CALL'),('CHANGE'),('CHECK'),('CONDITION'),('CONVERT'), + ('CURRENT_DATE'),('CURRENT_USER'),('DATABASES'),('DAY_MINUTE'),('DECIMAL'),('DELAYED'),('DESCRIBE'),('DISTINCTROW'),('DROP'),('ELSE'),('ESCAPED'),('EXPLAIN'),('FLOAT'),('FOR'),('FROM'), + ('GROUP'),('HOUR_MICROSECOND'),('IF'),('INDEX'),('INOUT'),('INT'),('INT3'),('INTEGER'),('IS'),('KEY'),('LEADING'),('LIKE'),('LINES'),('LOCALTIMESTAMP'),('LONGBLOB'),('LOW_PRIORITY'), + ('MEDIUMBLOB'),('MIDDLEINT'),('MOD'),('NOT'),('NUMERIC'),('OPTION'),('ORDER'),('OUTFILE'),('PROCEDURE'),('READ'),('REAL'),('RELEASE'),('REPLACE'),('RETURN'),('RLIKE'),('SECOND_MICROSECOND'), + ('SEPARATOR'),('SMALLINT'),('SQL'),('SQLWARNING'),('SQL_SMALL_RESULT'),('STRAIGHT_JOIN'),('THEN'),('TINYTEXT'),('TRIGGER'),('UNION'),('UNSIGNED'),('USE'),('UTC_TIME'),('VARBINARY'),('VARYING'), + ('WHILE'),('XOR'),('FULL'),('COLUMNS'),('MIN'),('MAX'),('STDEV'),('COUNT') + ]); + var operatorChars = /[*+\-<>=&|]/; + + function tokenBase(stream, state) { + var ch = stream.next(); + curPunc = null; + if (ch == "$" || ch == "?") { + stream.match(/^[\w\d]*/); + return "variable-2"; + } + else if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) { + stream.match(/^[^\s\u00a0>]*>?/); + return "atom"; + } + else if (ch == "\"" || ch == "'") { + state.tokenize = tokenLiteral(ch); + return state.tokenize(stream, state); + } + else if (ch == "`") { + state.tokenize = tokenOpLiteral(ch); + return state.tokenize(stream, state); + } + else if (/[{}\(\),\.;\[\]]/.test(ch)) { + curPunc = ch; + return null; + } + else if (ch == "-") { + ch2 = stream.next(); + if(ch2=="-") + { + stream.skipToEnd(); + return "comment"; + } + + } + else if (operatorChars.test(ch)) { + stream.eatWhile(operatorChars); + return null; + } + else if (ch == ":") { + stream.eatWhile(/[\w\d\._\-]/); + return "atom"; + } + else { + stream.eatWhile(/[_\w\d]/); + if (stream.eat(":")) { + stream.eatWhile(/[\w\d_\-]/); + return "atom"; + } + var word = stream.current(), type; + if (ops.test(word)) + return null; + else if (keywords.test(word)) + return "keyword"; + else + return "variable"; + } + } + + function tokenLiteral(quote) { + return function(stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == quote && !escaped) { + state.tokenize = tokenBase; + break; + } + escaped = !escaped && ch == "\\"; + } + return "string"; + }; + } + + function tokenOpLiteral(quote) { + return function(stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == quote && !escaped) { + state.tokenize = tokenBase; + break; + } + escaped = !escaped && ch == "\\"; + } + return "variable-2"; + }; + } + + + function pushContext(state, type, col) { + state.context = {prev: state.context, indent: state.indent, col: col, type: type}; + } + function popContext(state) { + state.indent = state.context.indent; + state.context = state.context.prev; + } + + return { + startState: function(base) { + return {tokenize: tokenBase, + context: null, + indent: 0, + col: 0}; + }, + + token: function(stream, state) { + if (stream.sol()) { + if (state.context && state.context.align == null) state.context.align = false; + state.indent = stream.indentation(); + } + if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + + if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") { + state.context.align = true; + } + + if (curPunc == "(") pushContext(state, ")", stream.column()); + else if (curPunc == "[") pushContext(state, "]", stream.column()); + else if (curPunc == "{") pushContext(state, "}", stream.column()); + else if (/[\]\}\)]/.test(curPunc)) { + while (state.context && state.context.type == "pattern") popContext(state); + if (state.context && curPunc == state.context.type) popContext(state); + } + else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state); + else if (/atom|string|variable/.test(style) && state.context) { + if (/[\}\]]/.test(state.context.type)) + pushContext(state, "pattern", stream.column()); + else if (state.context.type == "pattern" && !state.context.align) { + state.context.align = true; + state.context.col = stream.column(); + } + } + + return style; + }, + + indent: function(state, textAfter) { + var firstChar = textAfter && textAfter.charAt(0); + var context = state.context; + if (/[\]\}]/.test(firstChar)) + while (context && context.type == "pattern") context = context.prev; + + var closing = context && firstChar == context.type; + if (!context) + return 0; + else if (context.type == "pattern") + return context.col; + else if (context.align) + return context.col + (closing ? 0 : 1); + else + return context.indent + (closing ? 0 : indentUnit); + } + }; +}); + +CodeMirror.defineMIME("text/x-mysql", "mysql"); diff --git a/src/main/webapp/javascripts/libs/codemirror/mode/plsql/plsql.js b/src/main/webapp/javascripts/libs/codemirror/mode/plsql/plsql.js new file mode 100644 index 0000000..a2ac2e8 --- /dev/null +++ b/src/main/webapp/javascripts/libs/codemirror/mode/plsql/plsql.js @@ -0,0 +1,217 @@ +CodeMirror.defineMode("plsql", function(config, parserConfig) { + var indentUnit = config.indentUnit, + keywords = parserConfig.keywords, + functions = parserConfig.functions, + types = parserConfig.types, + sqlplus = parserConfig.sqlplus, + multiLineStrings = parserConfig.multiLineStrings; + var isOperatorChar = /[+\-*&%=<>!?:\/|]/; + function chain(stream, state, f) { + state.tokenize = f; + return f(stream, state); + } + + var type; + function ret(tp, style) { + type = tp; + return style; + } + + function tokenBase(stream, state) { + var ch = stream.next(); + // start of string? + if (ch == '"' || ch == "'") + return chain(stream, state, tokenString(ch)); + // is it one of the special signs []{}().,;? Seperator? + else if (/[\[\]{}\(\),;\.]/.test(ch)) + return ret(ch); + // start of a number value? + else if (/\d/.test(ch)) { + stream.eatWhile(/[\w\.]/); + return ret("number", "number"); + } + // multi line comment or simple operator? + else if (ch == "/") { + if (stream.eat("*")) { + return chain(stream, state, tokenComment); + } + else { + stream.eatWhile(isOperatorChar); + return ret("operator", "operator"); + } + } + // single line comment or simple operator? + else if (ch == "-") { + if (stream.eat("-")) { + stream.skipToEnd(); + return ret("comment", "comment"); + } + else { + stream.eatWhile(isOperatorChar); + return ret("operator", "operator"); + } + } + // pl/sql variable? + else if (ch == "@" || ch == "$") { + stream.eatWhile(/[\w\d\$_]/); + return ret("word", "variable"); + } + // is it a operator? + else if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return ret("operator", "operator"); + } + else { + // get the whole word + stream.eatWhile(/[\w\$_]/); + // is it one of the listed keywords? + if (keywords && keywords.propertyIsEnumerable(stream.current().toLowerCase())) return ret("keyword", "keyword"); + // is it one of the listed functions? + if (functions && functions.propertyIsEnumerable(stream.current().toLowerCase())) return ret("keyword", "builtin"); + // is it one of the listed types? + if (types && types.propertyIsEnumerable(stream.current().toLowerCase())) return ret("keyword", "variable-2"); + // is it one of the listed sqlplus keywords? + if (sqlplus && sqlplus.propertyIsEnumerable(stream.current().toLowerCase())) return ret("keyword", "variable-3"); + // default: just a "word" + return ret("word", "plsql-word"); + } + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, next, end = false; + while ((next = stream.next()) != null) { + if (next == quote && !escaped) {end = true; break;} + escaped = !escaped && next == "\\"; + } + if (end || !(escaped || multiLineStrings)) + state.tokenize = tokenBase; + return ret("string", "plsql-string"); + }; + } + + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == "/" && maybeEnd) { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return ret("comment", "plsql-comment"); + } + + // Interface + + return { + startState: function(basecolumn) { + return { + tokenize: tokenBase, + startOfLine: true + }; + }, + + token: function(stream, state) { + if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + return style; + } + }; +}); + +(function() { + function keywords(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + var cKeywords = "abort accept access add all alter and any array arraylen as asc assert assign at attributes audit " + + "authorization avg " + + "base_table begin between binary_integer body boolean by " + + "case cast char char_base check close cluster clusters colauth column comment commit compress connect " + + "connected constant constraint crash create current currval cursor " + + "data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete " + + "desc digits dispose distinct do drop " + + "else elsif enable end entry escape exception exception_init exchange exclusive exists exit external " + + "fast fetch file for force form from function " + + "generic goto grant group " + + "having " + + "identified if immediate in increment index indexes indicator initial initrans insert interface intersect " + + "into is " + + "key " + + "level library like limited local lock log logging long loop " + + "master maxextents maxtrans member minextents minus mislabel mode modify multiset " + + "new next no noaudit nocompress nologging noparallel not nowait number_base " + + "object of off offline on online only open option or order out " + + "package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior " + + "private privileges procedure public " + + "raise range raw read rebuild record ref references refresh release rename replace resource restrict return " + + "returning reverse revoke rollback row rowid rowlabel rownum rows run " + + "savepoint schema segment select separate session set share snapshot some space split sql start statement " + + "storage subtype successful synonym " + + "tabauth table tables tablespace task terminate then to trigger truncate type " + + "union unique unlimited unrecoverable unusable update use using " + + "validate value values variable view views " + + "when whenever where while with work"; + + var cFunctions = "abs acos add_months ascii asin atan atan2 average " + + "bfilename " + + "ceil chartorowid chr concat convert cos cosh count " + + "decode deref dual dump dup_val_on_index " + + "empty error exp " + + "false floor found " + + "glb greatest " + + "hextoraw " + + "initcap instr instrb isopen " + + "last_day least lenght lenghtb ln lower lpad ltrim lub " + + "make_ref max min mod months_between " + + "new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower " + + "nls_sort nls_upper nlssort no_data_found notfound null nvl " + + "others " + + "power " + + "rawtohex reftohex round rowcount rowidtochar rpad rtrim " + + "sign sin sinh soundex sqlcode sqlerrm sqrt stddev substr substrb sum sysdate " + + "tan tanh to_char to_date to_label to_multi_byte to_number to_single_byte translate true trunc " + + "uid upper user userenv " + + "variance vsize"; + + var cTypes = "bfile blob " + + "character clob " + + "dec " + + "float " + + "int integer " + + "mlslabel " + + "natural naturaln nchar nclob number numeric nvarchar2 " + + "real rowtype " + + "signtype smallint string " + + "varchar varchar2"; + + var cSqlplus = "appinfo arraysize autocommit autoprint autorecovery autotrace " + + "blockterminator break btitle " + + "cmdsep colsep compatibility compute concat copycommit copytypecheck " + + "define describe " + + "echo editfile embedded escape exec execute " + + "feedback flagger flush " + + "heading headsep " + + "instance " + + "linesize lno loboffset logsource long longchunksize " + + "markup " + + "native newpage numformat numwidth " + + "pagesize pause pno " + + "recsep recsepchar release repfooter repheader " + + "serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber " + + "sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix " + + "tab term termout time timing trimout trimspool ttitle " + + "underline " + + "verify version " + + "wrap"; + + CodeMirror.defineMIME("text/x-plsql", { + name: "plsql", + keywords: keywords(cKeywords), + functions: keywords(cFunctions), + types: keywords(cTypes), + sqlplus: keywords(cSqlplus) + }); +}()); diff --git a/src/main/webapp/javascripts/libs/date.format.js b/src/main/webapp/javascripts/libs/date.format.js new file mode 100644 index 0000000..3992c50 --- /dev/null +++ b/src/main/webapp/javascripts/libs/date.format.js @@ -0,0 +1,126 @@ +/*
+ * Date Format 1.2.3
+ * (c) 2007-2009 Steven Levithan <stevenlevithan.com>
+ * MIT license
+ *
+ * Includes enhancements by Scott Trenda <scott.trenda.net>
+ * and Kris Kowal <cixar.com/~kris.kowal/>
+ *
+ * Accepts a date, a mask, or a date and a mask.
+ * Returns a formatted version of the given date.
+ * The date defaults to the current date/time.
+ * The mask defaults to dateFormat.masks.default.
+ */
+
+var dateFormat = function () {
+ var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
+ timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
+ timezoneClip = /[^-+\dA-Z]/g,
+ pad = function (val, len) {
+ val = String(val);
+ len = len || 2;
+ while (val.length < len) val = "0" + val;
+ return val;
+ };
+
+ // Regexes and supporting functions are cached through closure
+ return function (date, mask, utc) {
+ var dF = dateFormat;
+
+ // You can't provide utc if you skip other args (use the "UTC:" mask prefix)
+ if (arguments.length == 1 && Object.prototype.toString.call(date) == "[object String]" && !/\d/.test(date)) {
+ mask = date;
+ date = undefined;
+ }
+
+ // Passing date through Date applies Date.parse, if necessary
+ date = date ? new Date(date) : new Date;
+ if (isNaN(date)) throw SyntaxError("invalid date");
+
+ mask = String(dF.masks[mask] || mask || dF.masks["default"]);
+
+ // Allow setting the utc argument via the mask
+ if (mask.slice(0, 4) == "UTC:") {
+ mask = mask.slice(4);
+ utc = true;
+ }
+
+ var _ = utc ? "getUTC" : "get",
+ d = date[_ + "Date"](),
+ D = date[_ + "Day"](),
+ m = date[_ + "Month"](),
+ y = date[_ + "FullYear"](),
+ H = date[_ + "Hours"](),
+ M = date[_ + "Minutes"](),
+ s = date[_ + "Seconds"](),
+ L = date[_ + "Milliseconds"](),
+ o = utc ? 0 : date.getTimezoneOffset(),
+ flags = {
+ d: d,
+ dd: pad(d),
+ ddd: dF.i18n.dayNames[D],
+ dddd: dF.i18n.dayNames[D + 7],
+ m: m + 1,
+ mm: pad(m + 1),
+ mmm: dF.i18n.monthNames[m],
+ mmmm: dF.i18n.monthNames[m + 12],
+ yy: String(y).slice(2),
+ yyyy: y,
+ h: H % 12 || 12,
+ hh: pad(H % 12 || 12),
+ H: H,
+ HH: pad(H),
+ M: M,
+ MM: pad(M),
+ s: s,
+ ss: pad(s),
+ l: pad(L, 3),
+ L: pad(L > 99 ? Math.round(L / 10) : L),
+ t: H < 12 ? "a" : "p",
+ tt: H < 12 ? "am" : "pm",
+ T: H < 12 ? "A" : "P",
+ TT: H < 12 ? "AM" : "PM",
+ Z: utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""),
+ o: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
+ S: ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]
+ };
+
+ return mask.replace(token, function ($0) {
+ return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);
+ });
+ };
+}();
+
+// Some common format strings
+dateFormat.masks = {
+ "default": "ddd mmm dd yyyy HH:MM:ss",
+ shortDate: "m/d/yy",
+ mediumDate: "mmm d, yyyy",
+ longDate: "mmmm d, yyyy",
+ fullDate: "dddd, mmmm d, yyyy",
+ shortTime: "h:MM TT",
+ mediumTime: "h:MM:ss TT",
+ longTime: "h:MM:ss TT Z",
+ isoDate: "yyyy-mm-dd",
+ isoTime: "HH:MM:ss",
+ isoDateTime: "yyyy-mm-dd'T'HH:MM:ss",
+ isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
+};
+
+// Internationalization strings
+dateFormat.i18n = {
+ dayNames: [
+ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
+ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
+ ],
+ monthNames: [
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
+ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
+ ]
+};
+
+// For convenience...
+Date.prototype.format = function (mask, utc) {
+ return dateFormat(this, mask, utc);
+};
+
diff --git a/src/main/webapp/javascripts/libs/ddl_builder/ddl_builder.js b/src/main/webapp/javascripts/libs/ddl_builder/ddl_builder.js new file mode 100644 index 0000000..a2797dc --- /dev/null +++ b/src/main/webapp/javascripts/libs/ddl_builder/ddl_builder.js @@ -0,0 +1,381 @@ +/* + * DDL Builder + * Copyright Jake Feasel, 2012 + * Released under MIT license + * For questions email admin at sqlfiddle dot com + * http://github.com/jakefeasel/DDLBuilder + */ + +define( + [ + "jQuery", + "Handlebars", + "DateFormat", + 'text!./templates/generic.sql', + 'text!./templates/oracle.sql', + 'text!./templates/sqlite.sql', + 'HandlebarsHelpers/each_with_index' + ], + function ($, Handlebars, dateFormat, generic_template, oracle_template, sqlite_template) { + + ddl_builder = function (args) { + if (!args) args = {}; + // output settings + this.fieldPrefix = ''; + this.fieldSuffix = ''; + this.tablePrefix = ''; + this.tableSuffix = ''; + + + this.dateFormatMask = "yyyy-mm-dd HH:MM:ss"; + + this.charType = 'varchar'; + this.intType = 'int'; + this.floatType = 'numeric'; + this.dateType = 'datetime'; + + // input settings + this.valueSeparator = ''; + + this.column_count = 0; + this.definition = { + tableName: "Table1", + columns: [/* sample column structure + { + name: 'id', + type: 'int', + length: '', + db_type: 'int4' + }, + { + name: 'name', + type: 'char', + length: 20, + db_type: 'varchar(20)' + } + */], + data: [/* sample data structure + // r for "row", v for "value" + {r:[{v:1},{v:'Jake'}]}, + {r:[{v:2},{v:'Rachel'}]}, + {r:[{v:3},{v:'Andrew'}]}, + {r:[{v:4},{v:'Ada'}]}, + {r:[{v:5},{v:'Lucy O\'Malley'}]} + + + */] + }; + + + this.ddlTemplate = generic_template; + + this.compiledTemplate = Handlebars.compile(this.ddlTemplate); + this.setup(args); + return this; + } + + ddl_builder.prototype.setup = function (settings) { + for (var opt in settings) + { + this[opt] = settings[opt]; + } + + if (settings["ddlTemplate"]) + this.compiledTemplate = Handlebars.compile(this.ddlTemplate); + + if (settings["tableName"]) + this.definition.tableName = settings.tableName; + + return this; + } + + ddl_builder.prototype.setupForDBType = function (type,separator) { + + switch (type) + { + case 'SQL Server': + this.setup({ + statement_separator: separator, + fieldPrefix: '[', + fieldSuffix: ']', + tablePrefix: '[', + tableSuffix: ']' + }); + break; + + case 'MySQL': + this.setup({ + statement_separator: separator, + fieldPrefix: '`', + fieldSuffix: '`', + tablePrefix: '`', + tableSuffix: '`' + }); + break; + case 'PostgreSQL': + this.setup({ + statement_separator: separator, + dateType: 'timestamp', + fieldPrefix: '"', + fieldSuffix: '"' + }); + break; + + case 'Oracle': + var template = oracle_template; + + this.setup({ + dateFormatMask: 'dd-mmm-yyyy hh:MM:ss TT', + statement_separator: separator, + ddlTemplate: template, + dateType: 'timestamp', + charType: 'varchar2', + fieldPrefix: '"', + fieldSuffix: '"' + }); + break; + + + + case 'SQLite': + var template = sqlite_template; + + + this.setup({ + fieldPrefix: '"', + fieldSuffix: '"', + tablePrefix: '"', + tableSuffix: '"', + statement_separator: separator, + ddlTemplate: template, + dateType: 'DATE', + charType: 'TEXT', + intType: 'INTEGER', + floatType: 'REAL' + }); + break; + + + } + return this; + } + + ddl_builder.prototype.populateDBTypes = function () { + for (var i=0;i<this.definition.columns.length;i++) + { + if (this.definition.columns[i].type == 'charType') + this.definition.columns[i].db_type = this[this.definition.columns[i].type] + "(" + this.definition.columns[i].length + ")"; + else + this.definition.columns[i].db_type = this[this.definition.columns[i].type]; + } + + this.definition.dateFormatMask = this.dateFormatMask; + + }; + + ddl_builder.prototype.populateWrappers = function () { + this.definition.fieldPrefix = this.fieldPrefix; + this.definition.fieldSuffix = this.fieldSuffix; + }; + + + ddl_builder.prototype.guessValueSeparator = function (raw) { + + + var lines = raw.split("\n"); + var header_found = false, column_count = 0, found_separator = ''; + + for (var i = 0; i<lines.length; i++) + { + if (lines[i].search(/[A-Z0-9_]/i) != -1 && !header_found) // if this line contains letters/numbers/underscores, then we can assume we've hit the header row + { + var chunks = $.trim(lines[i]).match(/([A-Z0-9_]+ ?)+([^A-Z0-9_]*)/gi); + if (chunks.length == 1) + { + chunks = $.trim(lines[i]).match(/([A-Z0-9_]+ ?)+?([^A-Z0-9_]*)/gi); + } + + header_found = true; + + for (var j = 0; j < chunks.length; j++) + { + var this_separator = chunks[j].match(/[A-Z0-9_]+([^A-Z0-9_]*)$/i).pop(); // gets the last returned value from regexp + + if (this_separator.search(/^\s\s+$/) != -1) + this_separator = new RegExp("\\s\\s+"); + else if (this_separator.search(/^\t+$/) != -1) + this_separator = new RegExp("\\t+"); + else if (this_separator.search(/^\s+$/) != -1) + this_separator = new RegExp("\\s+"); + else + this_separator = $.trim(this_separator); + + if (this_separator instanceof RegExp || this_separator.length) + { + if (!(found_separator instanceof RegExp) && !found_separator.length) + found_separator = this_separator; + else if (found_separator.toString() != this_separator.toString()) + return {status: false, message: 'Unable to find consistent column separator in header row'}; // different separators founds? + } + else if (! (this_separator instanceof RegExp) && !(found_separator instanceof RegExp) && !found_separator.length) + { + found_separator = "\n"; + } + + } + if (found_separator instanceof RegExp || found_separator.length) + column_count = $.trim(lines[i]).split(found_separator).length; + else + column_count = 1; + + + } + else if (lines[i].search(/[A-Z0-9_]/i) != -1) + { + if ($.trim(lines[i]).split(found_separator).length != column_count && + ( + found_separator.toString() != /\s\s+/.toString() || + $.trim(lines[i]).split(/\s+/).length != column_count + ) + ) + return {status: false, message: 'Line ' + i + ' does not have the same number of columns as the header, based on separator "' + found_separator + '".'}; + + } + + } + return {status: true, separator: found_separator, column_count: column_count}; + } + + ddl_builder.prototype.parse = function (raw) { + + + + if (!this.valueSeparator.length) + { + var result = this.guessValueSeparator(raw); + if (!result.status) + return "ERROR! " + result.message; + else + { + this.column_count = result.column_count; + this.valueSeparator = result.separator; + } + } + + var lines = raw.split("\n"); + + for (var i=0;i<lines.length;i++) + { + var elements = $.trim(lines[i]).split(this.valueSeparator); + + if ($.trim(lines[i]).length && + ( + elements.length == this.column_count || + ( + this.valueSeparator.toString() == /\s\s+/.toString() && + (elements = $.trim(lines[i]).split(/\s+/)).length == this.column_count + ) + ) + ) + { + if (! this.definition.columns.length) + { + for (var j = 0; j < elements.length; j++) + { + var value = $.trim(elements[j]); + if (value.length) + this.definition.columns.push({"name": value}); + else + this.definition.columns.push(false); + } + } + else + { + + var tmpRow = []; + for (var j = 0; j < elements.length; j++) + { + if (this.definition.columns[j] !== false) + { + var value = $.trim(elements[j]).replace(/'/g, "''"); + + // if the current field is not a number, or if we have previously decided that this one of the non-numeric field types... + if (isNaN(value) || this.definition.columns[j].type == 'dateType' || this.definition.columns[j].type == 'charType') + { + + // if we haven't previously decided that this is a character field, and it can be cast as a date, then declare it a date + if (this.definition.columns[j].type != 'charType' && !isNaN(Date.parse(value)) ) + this.definition.columns[j].type = "dateType"; + else + this.definition.columns[j].type = "charType"; + } + else // this must be some kind of number field + { + if (this.definition.columns[j].type != 'floatType' && value % 1 != 0) + this.definition.columns[j].type = 'floatType'; + else + this.definition.columns[j].type = 'intType'; + } + + if (!this.definition.columns[j].length || value.length > this.definition.columns[j].length) + { + this.definition.columns[j].length = value.length; + } + + tmpRow.push({v:value}); + } + + } + this.definition.data.push({r: tmpRow}); + + } + + } + } + this.populateDBTypes(); + this.populateWrappers(); + return this.render(); + } + + /* HandlebarsJS-using code below */ + + Handlebars.registerHelper("formatted_field", function(root) { + + var colType = ''; + var index = -1; + for (var j = 0; j < root.columns.length; j++) + { + if (root.columns[j]) + index++; + + if (index == this.index) + { + colType = root.columns[j].type; + break; + } + } + + + if (!this.v.length || this.v.toUpperCase() == 'NULL') + return 'NULL'; + if (colType == 'charType') + return new Handlebars.SafeString("'" + this.v.replace(/'/g, "''") + "'"); + + if (colType == 'dateType') + return new Handlebars.SafeString("'" + dateFormat(this.v, root.dateFormatMask) + "'"); + + return this.v; + }); + + Handlebars.registerHelper("column_name_for_index", function(root) { + return root.columns[this.index].name; + }); + + + ddl_builder.prototype.render = function () { + return this.compiledTemplate($.extend(this.definition, {"separator": this.statement_separator})); + } + + return ddl_builder; + +}); diff --git a/src/main/webapp/javascripts/libs/ddl_builder/qunit/columnTypes.js b/src/main/webapp/javascripts/libs/ddl_builder/qunit/columnTypes.js new file mode 100644 index 0000000..6ad3301 --- /dev/null +++ b/src/main/webapp/javascripts/libs/ddl_builder/qunit/columnTypes.js @@ -0,0 +1,8 @@ +define(["jQuery","QUnit", "DDLBuilder/ddl_builder"], function ($,QUnit,DDLBuilder) { + + return function (id,types) { + var ddl_builder = new DDLBuilder({ddlTemplate: "{{#each_with_index columns}}{{#if index}},{{/if}}{{db_type}}{{/each_with_index}}}"}); + QUnit.equal(ddl_builder.parse($("#" + id).html()), types, "Column types"); + }; + +}); diff --git a/src/main/webapp/javascripts/libs/ddl_builder/qunit/fixture.html b/src/main/webapp/javascripts/libs/ddl_builder/qunit/fixture.html new file mode 100644 index 0000000..d2d5d40 --- /dev/null +++ b/src/main/webapp/javascripts/libs/ddl_builder/qunit/fixture.html @@ -0,0 +1,106 @@ +<div id="ddlInputText"> + <span id="simplestFormattedCSV" types="int,int" valueSeparator="," headers="a,b" recordCount="1"> + a,b + 1,2 + </span> + <span id="twoColumnFixedWidth" types="int,varchar(5)" valueSeparator="/\s\s+/" headers="Period,Result" recordCount="13"> + Period Result + 1 Green + 1 Blue + 1 Blue + 1 Red + 1 Blue + 1 Blue + 1 Blue + 2 Green + 2 Green + 2 Green + 2 Blue + 2 Red + 2 Red + </span> + <span id="fixedWidthDates" types="datetime,datetime,int,int,varchar(7)" valueSeparator="/\s\s+/" headers="date_due,date_paid,amount_due,amount_paid,category_type" recordCount="4"> + date_due date_paid amount_due amount_paid category_type + 2012-08-12 2012-08-12 500 450 Income + 2012-08-13 2012-08-17 200 300 Expense + 2012-09-15 2012-09-13 300 300 Income + 2012-09-17 2012-09-16 100 100 Income + </span> + <span id="centeredPipes" types="varchar(1),int" valueSeparator="|" headers="L,N" recordCount="9"> + L | N + ------------------- + A | 1 + A | 3 + A | 5 + B | 5 + B | 7 + B | 9 + C | 1 + C | 2 + C | 3 + </span> + <span id="ASCII_bordered" types="int,int,datetime,int" valueSeparator="|" headers="IdPayment,Costs_IdCost,Date,Amount" recordCount="3"> + +-----------+--------------+----------+--------+ + | IdPayment | Costs_IdCost | Date | Amount | + +-----------+--------------+----------+--------+ + | 1 | 2 |2012/09/10| 1000 | + +-----------+--------------+----------+--------+ + | 2 | 2 |2012/09/20| 3000 | + +-----------+--------------+----------+--------+ + | 3 | 2 |2012/10/01| 5000 | + +-----------+--------------+----------+--------+ + </span> + <span id="fixedWidthWithSpaces" types="varchar(6),varchar(13)" valueSeparator="/\s\s+/" headers="Cul 1,Cul 2" recordCount="8"> + Cul 1 Cul 2 + ===================== + A10000 Test + A10001 Test 123 + A20000 Test 1 + A20001 Test 999 + A30000 Test 2 + A30002 Test 5555 + A40000 Test 3 + A40006 Test 84384848 + </span> + <span id="pipedColumns" types="varchar(8),int,numeric" valueSeparator="|" headers="Scoreband,TotalNoOfPeople,AvgScore" recordCount="4"> + Scoreband| TotalNoOfPeople | AvgScore + -------------------------------- + -5 to 0 | 2 | -2 + 0 to 5 | 3 | 2 + 5 to 10 | 2 | 8 + 10 to 15 | 3 | 13.3 + </span> + <span id="variableSpaceDelimited" types="varchar(3),varchar(4),varchar(5)" valueSeparator="/\s\s+/" headers="c1,c2,c3" recordCount="4"> + c1 c2 c3 + 1A2 cat black + 1G2 dog red + B11 frog green + 1G2 girl red + </span> + <span id="bracketHeaders" types="int,varchar(3),datetime" valueSeparator="/\s\s+/" headers="Serial Number,LID,Last Updated Date" recordCount="12"> +[Serial Number] [LID] [Last Updated Date] +-------------------------------------- +123456 AAA 2012-09-24 +123456 AAA 2012-09-23 +123456 AAA 2012-09-22 +123456 AAA 2012-09-21 +123456 BBB 2012-09-20 +123456 BBB 2012-09-19 +123456 AAA 2012-09-18 +123456 AAA 2012-09-17 +123456 AAA 2012-09-16 +234567 BBB 2012-09-24 +234567 BBB 2012-09-23 +234567 AAA 2012-09-22 + </span> + <span id="singleSpacedColumnNames" types="int,int,int,int,int" valueSeparator="/\s+/" headers="customdata,check,service,loc,value" recordCount="6"> +customdata check service loc value + 101 0 0 4 4 + 101 0 0 3 3 + 101 5 4 4 3 + 102 0 0 1 2 + 102 4 4 3 3 + 103 0 0 4 4 + </span> + +</div> diff --git a/src/main/webapp/javascripts/libs/ddl_builder/qunit/guessValueSeparators.js b/src/main/webapp/javascripts/libs/ddl_builder/qunit/guessValueSeparators.js new file mode 100644 index 0000000..c118837 --- /dev/null +++ b/src/main/webapp/javascripts/libs/ddl_builder/qunit/guessValueSeparators.js @@ -0,0 +1,15 @@ +define(["jQuery","QUnit", "DDLBuilder/ddl_builder"], function ($,QUnit,DDLBuilder) { + + return function(id,sep) { + + var ddl_builder = new DDLBuilder(), + result = ddl_builder.guessValueSeparator($("#" + id).html()); + + if (result.separator) + QUnit.equal(ddl_builder.guessValueSeparator($("#" + id).html()).separator.toString(), sep.toString(), "Guessing Value Separators"); + else + QUnit.ok(false, "Guessing value separators failed with message:" + result.message); + }; + + +}); diff --git a/src/main/webapp/javascripts/libs/ddl_builder/qunit/headerNames.js b/src/main/webapp/javascripts/libs/ddl_builder/qunit/headerNames.js new file mode 100644 index 0000000..d8107ad --- /dev/null +++ b/src/main/webapp/javascripts/libs/ddl_builder/qunit/headerNames.js @@ -0,0 +1,8 @@ +define(["jQuery","QUnit", "DDLBuilder/ddl_builder"], function ($,QUnit,DDLBuilder) { + + return function (id,headers) { + var ddl_builder = new DDLBuilder({ddlTemplate: "{{#each_with_index columns}}{{#if index}},{{/if}}{{name}}{{/each_with_index}}}"}); + QUnit.equal(ddl_builder.parse($("#" + id).html()), headers, "Finding header names"); + }; + +}); diff --git a/src/main/webapp/javascripts/libs/ddl_builder/qunit/main.js b/src/main/webapp/javascripts/libs/ddl_builder/qunit/main.js new file mode 100644 index 0000000..aba2ec9 --- /dev/null +++ b/src/main/webapp/javascripts/libs/ddl_builder/qunit/main.js @@ -0,0 +1,28 @@ +define([ + "jQuery", + "QUnit", + "text!./fixture.html", + "./columnTypes", + "./guessValueSeparators", + "./headerNames", + "./recordCount" + ], + + function ($,QUnit,fixtureContent, + columnTypes,guessValueSeparators, + headerNames,recordCount) { + + $("#qunit-fixture").append(fixtureContent); + + $("#qunit-fixture #ddlInputText span").each(function () { + var $this = $(this); + QUnit.test("Parsing " + $this.attr('id'), function () { + columnTypes($this.attr('id'), $this.attr('types')); + guessValueSeparators($this.attr('id'), $this.attr('valueSeparator')); + headerNames($this.attr('id'), $this.attr('headers')); + recordCount($this.attr('id'), $this.attr('recordCount')); + }); + }); + + } +)
\ No newline at end of file diff --git a/src/main/webapp/javascripts/libs/ddl_builder/qunit/recordCount.js b/src/main/webapp/javascripts/libs/ddl_builder/qunit/recordCount.js new file mode 100644 index 0000000..0ec59fd --- /dev/null +++ b/src/main/webapp/javascripts/libs/ddl_builder/qunit/recordCount.js @@ -0,0 +1,18 @@ +define(["jQuery","QUnit", "DDLBuilder/ddl_builder"], function ($,QUnit,DDLBuilder) { + + return function (id,count) { + var ddl_builder = new DDLBuilder({ddlTemplate: "[{{#each_with_index data}}{{#if index}},{{/if}}}{{index}}{{/each_with_index}}}]"}); + var result = ddl_builder.parse($("#" + id).html()), + parsedResult = false; + + try { + parsedResult = $.parseJSON(result); + } catch (err){} + + if (parsedResult) + QUnit.equal(parsedResult.length, count, "Getting Record Count"); + else + QUnit.ok(false, "Getting Record Count failed: Unable to parse result to JSON array ("+ result +")"); + }; + +}); diff --git a/src/main/webapp/javascripts/libs/ddl_builder/templates/generic.sql b/src/main/webapp/javascripts/libs/ddl_builder/templates/generic.sql new file mode 100644 index 0000000..f7a4f5f --- /dev/null +++ b/src/main/webapp/javascripts/libs/ddl_builder/templates/generic.sql @@ -0,0 +1,10 @@ +CREATE TABLE {{{tablePrefix}}}{{tableName}}{{{tableSuffix}}} + ({{#each_with_index columns}}{{#if index}}, {{/if}}{{{../fieldPrefix}}}{{name}}{{{../fieldSuffix}}} {{db_type}}{{/each_with_index}}) +{{separator}} + +INSERT INTO {{{tablePrefix}}}{{tableName}}{{{tableSuffix}}} + ({{#each_with_index columns}}{{#if index}}, {{/if}}{{{../fieldPrefix}}}{{name}}{{{../fieldSuffix}}}{{/each_with_index}}) +VALUES + {{#each_with_index data}}{{#if index}}, + {{/if}}({{#each_with_index r}}{{#if index}}, {{/if}}{{formatted_field ../..}}{{/each_with_index}}){{/each_with_index}} +{{separator}} diff --git a/src/main/webapp/javascripts/libs/ddl_builder/templates/oracle.sql b/src/main/webapp/javascripts/libs/ddl_builder/templates/oracle.sql new file mode 100644 index 0000000..8180cf0 --- /dev/null +++ b/src/main/webapp/javascripts/libs/ddl_builder/templates/oracle.sql @@ -0,0 +1,9 @@ +CREATE TABLE {{{tablePrefix}}}{{tableName}}{{{tableSuffix}}} + ({{#each_with_index columns}}{{#if index}}, {{/if}}{{{../fieldPrefix}}}{{name}}{{{../fieldSuffix}}} {{db_type}}{{/each_with_index}}) +{{separator}} + +INSERT ALL {{#each_with_index data}} + INTO {{{../tablePrefix}}}{{../tableName}}{{{../tableSuffix}}} ({{#each_with_index r}}{{#if index}}, {{/if}}{{{../../fieldPrefix}}}{{column_name_for_index ../..}}{{{../../fieldSuffix}}}{{/each_with_index}}) + VALUES ({{#each_with_index r}}{{#if index}}, {{/if}}{{formatted_field ../..}}{{/each_with_index}}){{/each_with_index}} +SELECT * FROM dual +{{separator}}
\ No newline at end of file diff --git a/src/main/webapp/javascripts/libs/ddl_builder/templates/sqlite.sql b/src/main/webapp/javascripts/libs/ddl_builder/templates/sqlite.sql new file mode 100644 index 0000000..4de3c7e --- /dev/null +++ b/src/main/webapp/javascripts/libs/ddl_builder/templates/sqlite.sql @@ -0,0 +1,12 @@ +CREATE TABLE {{tablePrefix}}{{tableName}}{{tableSuffix}} + ({{#each_with_index columns}}{{#if index}}, {{/if}}{{{../fieldPrefix}}}{{name}}{{{../fieldSuffix}}} {{db_type}}{{/each_with_index}}) +{{separator}} + +{{#each_with_index data}} +INSERT INTO {{tablePrefix}}{{../tableName}}{{tableSuffix}} + ({{#each_with_index ../columns}}{{#if index}}, {{/if}}{{{../../fieldPrefix}}}{{name}}{{{../../fieldSuffix}}}{{/each_with_index}}) +VALUES + ({{#each_with_index r}}{{#if index}}, {{/if}}{{formatted_field ../..}}{{/each_with_index}}) +{{../separator}} + +{{/each_with_index}}
\ No newline at end of file diff --git a/src/main/webapp/javascripts/libs/fiddleEditor.js b/src/main/webapp/javascripts/libs/fiddleEditor.js new file mode 100644 index 0000000..89e79e4 --- /dev/null +++ b/src/main/webapp/javascripts/libs/fiddleEditor.js @@ -0,0 +1,94 @@ +define(["CodeMirror", "MySQLCodeMirror"], function (CodeMirror, myMode){ + + var fiddleEditor = function (domID, changeHandler, viewRef) { + this.codeMirrorSupported = !( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ); + + if (this.codeMirrorSupported) + this.codeMirror = CodeMirror.fromTextArea(document.getElementById(domID), { + mode: "mysql", + extraKeys: {Tab: "indentMore"}, + lineNumbers: true, + onChange: function(){ changeHandler.call(viewRef) } + }); + else + { + this.textArea = document.getElementById(domID); + $(this.textArea).on('change', function(){ changeHandler.call(viewRef) }); + $(this.textArea).on('keyup', function(){ changeHandler.call(viewRef) }); + $(this.textArea).attr('fullscreen',false); + } + + return this; + }; + fiddleEditor.prototype.getValue = function () { + if (this.codeMirrorSupported) return this.codeMirror.getValue(); + else return this.textArea.value; + } + fiddleEditor.prototype.setValue = function(val) { + if (this.codeMirrorSupported) this.codeMirror.setValue(val); + else { + this.textArea.value = val; + $(this.textArea).trigger('change'); + } + } + fiddleEditor.prototype.refresh = function() { + if (this.codeMirrorSupported) this.codeMirror.refresh(); + else { /* NOOP */ } + } + fiddleEditor.prototype.somethingSelected = function() { + if (this.codeMirrorSupported) return this.codeMirror.somethingSelected(); + else { return false } + } + fiddleEditor.prototype.getSelection = function() { + if (this.codeMirrorSupported) return this.codeMirror.getSelection(); + else { return this.textArea.value } + } + fiddleEditor.prototype.getScrollerElement = function () { + if (this.codeMirrorSupported) return this.codeMirror.getScrollerElement(); + else { return null } + } + fiddleEditor.prototype.getGutterElement = function () { + if (this.codeMirrorSupported) return this.codeMirror.getGutterElement(); + else { return null } + } + fiddleEditor.prototype.isFullscreen = function () { + if (this.codeMirrorSupported) return $(this.codeMirror.getScrollerElement()).hasClass('CodeMirror-fullscreen') + else { return $(this.textArea).attr('fullscreen') == true; } + } + fiddleEditor.prototype.setFullscreen = function (fullscreenMode) { + if (fullscreenMode) + { + var wHeight = $(window).height() - 40; + if (this.codeMirrorSupported) + { + $(this.codeMirror.getScrollerElement()).addClass('CodeMirror-fullscreen').height(wHeight); + $(this.codeMirror.getGutterElement()).height(wHeight); + } + else + { + $(this.textArea).addClass('fullscreen'); + $(this.textArea).height(wHeight); + $(this.textArea).attr('fullscreen', fullscreenMode); + } + } + else + { + if (this.codeMirrorSupported) + { + $(this.codeMirror.getScrollerElement()).removeClass('CodeMirror-fullscreen'); + $(this.codeMirror.getGutterElement()).css('height', 'auto'); + $(this.codeMirror.getScrollerElement()).css('height', '200px'); + } + else + { + $(this.textArea).removeClass('fullscreen'); + + $(this.textArea).height(100); + $(this.textArea).attr('fullscreen', fullscreenMode); + } + } + } + + return fiddleEditor; + +});
\ No newline at end of file diff --git a/src/main/webapp/javascripts/libs/handlebars-1.0.0.beta.6.js b/src/main/webapp/javascripts/libs/handlebars-1.0.0.beta.6.js new file mode 100644 index 0000000..83119ff --- /dev/null +++ b/src/main/webapp/javascripts/libs/handlebars-1.0.0.beta.6.js @@ -0,0 +1,1550 @@ +// lib/handlebars/base.js +var Handlebars = {}; + +Handlebars.VERSION = "1.0.beta.6"; + +Handlebars.helpers = {}; +Handlebars.partials = {}; + +Handlebars.registerHelper = function(name, fn, inverse) { + if(inverse) { fn.not = inverse; } + this.helpers[name] = fn; +}; + +Handlebars.registerPartial = function(name, str) { + this.partials[name] = str; +}; + +Handlebars.registerHelper('helperMissing', function(arg) { + if(arguments.length === 2) { + return undefined; + } else { + throw new Error("Could not find property '" + arg + "'"); + } +}); + +var toString = Object.prototype.toString, functionType = "[object Function]"; + +Handlebars.registerHelper('blockHelperMissing', function(context, options) { + var inverse = options.inverse || function() {}, fn = options.fn; + + + var ret = ""; + var type = toString.call(context); + + if(type === functionType) { context = context.call(this); } + + if(context === true) { + return fn(this); + } else if(context === false || context == null) { + return inverse(this); + } else if(type === "[object Array]") { + if(context.length > 0) { + for(var i=0, j=context.length; i<j; i++) { + ret = ret + fn(context[i]); + } + } else { + ret = inverse(this); + } + return ret; + } else { + return fn(context); + } +}); + +Handlebars.registerHelper('each', function(context, options) { + var fn = options.fn, inverse = options.inverse; + var ret = ""; + + if(context && context.length > 0) { + for(var i=0, j=context.length; i<j; i++) { + ret = ret + fn(context[i]); + } + } else { + ret = inverse(this); + } + return ret; +}); + +Handlebars.registerHelper('if', function(context, options) { + var type = toString.call(context); + if(type === functionType) { context = context.call(this); } + + if(!context || Handlebars.Utils.isEmpty(context)) { + return options.inverse(this); + } else { + return options.fn(this); + } +}); + +Handlebars.registerHelper('unless', function(context, options) { + var fn = options.fn, inverse = options.inverse; + options.fn = inverse; + options.inverse = fn; + + return Handlebars.helpers['if'].call(this, context, options); +}); + +Handlebars.registerHelper('with', function(context, options) { + return options.fn(context); +}); + +Handlebars.registerHelper('log', function(context) { + Handlebars.log(context); +}); +; +// lib/handlebars/compiler/parser.js +/* Jison generated parser */ +var handlebars = (function(){ + +var parser = {trace: function trace() { }, +yy: {}, +symbols_: {"error":2,"root":3,"program":4,"EOF":5,"statements":6,"simpleInverse":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"inMustache":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"OPEN_PARTIAL":24,"params":25,"hash":26,"param":27,"STRING":28,"INTEGER":29,"BOOLEAN":30,"hashSegments":31,"hashSegment":32,"ID":33,"EQUALS":34,"pathSegments":35,"SEP":36,"$accept":0,"$end":1}, +terminals_: {2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"OPEN_PARTIAL",28:"STRING",29:"INTEGER",30:"BOOLEAN",33:"ID",34:"EQUALS",36:"SEP"}, +productions_: [0,[3,2],[4,3],[4,1],[4,0],[6,1],[6,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[7,2],[17,3],[17,2],[17,2],[17,1],[25,2],[25,1],[27,1],[27,1],[27,1],[27,1],[26,1],[31,2],[31,1],[32,3],[32,3],[32,3],[32,3],[21,1],[35,3],[35,1]], +performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { + +var $0 = $$.length - 1; +switch (yystate) { +case 1: return $$[$0-1] +break; +case 2: this.$ = new yy.ProgramNode($$[$0-2], $$[$0]) +break; +case 3: this.$ = new yy.ProgramNode($$[$0]) +break; +case 4: this.$ = new yy.ProgramNode([]) +break; +case 5: this.$ = [$$[$0]] +break; +case 6: $$[$0-1].push($$[$0]); this.$ = $$[$0-1] +break; +case 7: this.$ = new yy.InverseNode($$[$0-2], $$[$0-1], $$[$0]) +break; +case 8: this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0]) +break; +case 9: this.$ = $$[$0] +break; +case 10: this.$ = $$[$0] +break; +case 11: this.$ = new yy.ContentNode($$[$0]) +break; +case 12: this.$ = new yy.CommentNode($$[$0]) +break; +case 13: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]) +break; +case 14: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]) +break; +case 15: this.$ = $$[$0-1] +break; +case 16: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]) +break; +case 17: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], true) +break; +case 18: this.$ = new yy.PartialNode($$[$0-1]) +break; +case 19: this.$ = new yy.PartialNode($$[$0-2], $$[$0-1]) +break; +case 20: +break; +case 21: this.$ = [[$$[$0-2]].concat($$[$0-1]), $$[$0]] +break; +case 22: this.$ = [[$$[$0-1]].concat($$[$0]), null] +break; +case 23: this.$ = [[$$[$0-1]], $$[$0]] +break; +case 24: this.$ = [[$$[$0]], null] +break; +case 25: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]; +break; +case 26: this.$ = [$$[$0]] +break; +case 27: this.$ = $$[$0] +break; +case 28: this.$ = new yy.StringNode($$[$0]) +break; +case 29: this.$ = new yy.IntegerNode($$[$0]) +break; +case 30: this.$ = new yy.BooleanNode($$[$0]) +break; +case 31: this.$ = new yy.HashNode($$[$0]) +break; +case 32: $$[$0-1].push($$[$0]); this.$ = $$[$0-1] +break; +case 33: this.$ = [$$[$0]] +break; +case 34: this.$ = [$$[$0-2], $$[$0]] +break; +case 35: this.$ = [$$[$0-2], new yy.StringNode($$[$0])] +break; +case 36: this.$ = [$$[$0-2], new yy.IntegerNode($$[$0])] +break; +case 37: this.$ = [$$[$0-2], new yy.BooleanNode($$[$0])] +break; +case 38: this.$ = new yy.IdNode($$[$0]) +break; +case 39: $$[$0-2].push($$[$0]); this.$ = $$[$0-2]; +break; +case 40: this.$ = [$$[$0]] +break; +} +}, +table: [{3:1,4:2,5:[2,4],6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{1:[3]},{5:[1,16]},{5:[2,3],7:17,8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,19],20:[2,3],22:[1,13],23:[1,14],24:[1,15]},{5:[2,5],14:[2,5],15:[2,5],16:[2,5],19:[2,5],20:[2,5],22:[2,5],23:[2,5],24:[2,5]},{4:20,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{4:21,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{17:22,21:23,33:[1,25],35:24},{17:26,21:23,33:[1,25],35:24},{17:27,21:23,33:[1,25],35:24},{17:28,21:23,33:[1,25],35:24},{21:29,33:[1,25],35:24},{1:[2,1]},{6:30,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{5:[2,6],14:[2,6],15:[2,6],16:[2,6],19:[2,6],20:[2,6],22:[2,6],23:[2,6],24:[2,6]},{17:22,18:[1,31],21:23,33:[1,25],35:24},{10:32,20:[1,33]},{10:34,20:[1,33]},{18:[1,35]},{18:[2,24],21:40,25:36,26:37,27:38,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,38],28:[2,38],29:[2,38],30:[2,38],33:[2,38],36:[1,46]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],36:[2,40]},{18:[1,47]},{18:[1,48]},{18:[1,49]},{18:[1,50],21:51,33:[1,25],35:24},{5:[2,2],8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,2],22:[1,13],23:[1,14],24:[1,15]},{14:[2,20],15:[2,20],16:[2,20],19:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,7],14:[2,7],15:[2,7],16:[2,7],19:[2,7],20:[2,7],22:[2,7],23:[2,7],24:[2,7]},{21:52,33:[1,25],35:24},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{18:[2,22],21:40,26:53,27:54,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,23]},{18:[2,26],28:[2,26],29:[2,26],30:[2,26],33:[2,26]},{18:[2,31],32:55,33:[1,56]},{18:[2,27],28:[2,27],29:[2,27],30:[2,27],33:[2,27]},{18:[2,28],28:[2,28],29:[2,28],30:[2,28],33:[2,28]},{18:[2,29],28:[2,29],29:[2,29],30:[2,29],33:[2,29]},{18:[2,30],28:[2,30],29:[2,30],30:[2,30],33:[2,30]},{18:[2,33],33:[2,33]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],34:[1,57],36:[2,40]},{33:[1,58]},{14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,17],14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],24:[2,17]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]},{18:[1,59]},{18:[1,60]},{18:[2,21]},{18:[2,25],28:[2,25],29:[2,25],30:[2,25],33:[2,25]},{18:[2,32],33:[2,32]},{34:[1,57]},{21:61,28:[1,62],29:[1,63],30:[1,64],33:[1,25],35:24},{18:[2,39],28:[2,39],29:[2,39],30:[2,39],33:[2,39],36:[2,39]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{18:[2,34],33:[2,34]},{18:[2,35],33:[2,35]},{18:[2,36],33:[2,36]},{18:[2,37],33:[2,37]}], +defaultActions: {16:[2,1],37:[2,23],53:[2,21]}, +parseError: function parseError(str, hash) { + throw new Error(str); +}, +parse: function parse(input) { + var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; + this.lexer.setInput(input); + this.lexer.yy = this.yy; + this.yy.lexer = this.lexer; + if (typeof this.lexer.yylloc == "undefined") + this.lexer.yylloc = {}; + var yyloc = this.lexer.yylloc; + lstack.push(yyloc); + if (typeof this.yy.parseError === "function") + this.parseError = this.yy.parseError; + function popStack(n) { + stack.length = stack.length - 2 * n; + vstack.length = vstack.length - n; + lstack.length = lstack.length - n; + } + function lex() { + var token; + token = self.lexer.lex() || 1; + if (typeof token !== "number") { + token = self.symbols_[token] || token; + } + return token; + } + var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; + while (true) { + state = stack[stack.length - 1]; + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol == null) + symbol = lex(); + action = table[state] && table[state][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + if (!recovering) { + expected = []; + for (p in table[state]) + if (this.terminals_[p] && p > 2) { + expected.push("'" + this.terminals_[p] + "'"); + } + var errStr = ""; + if (this.lexer.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + this.terminals_[symbol] + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); + } + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(this.lexer.yytext); + lstack.push(this.lexer.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = this.lexer.yyleng; + yytext = this.lexer.yytext; + yylineno = this.lexer.yylineno; + yyloc = this.lexer.yylloc; + if (recovering > 0) + recovering--; + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = {first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column}; + r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); + if (typeof r !== "undefined") { + return r; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; + } + } + return true; +} +};/* Jison generated lexer */ +var lexer = (function(){ + +var lexer = ({EOF:1, +parseError:function parseError(str, hash) { + if (this.yy.parseError) { + this.yy.parseError(str, hash); + } else { + throw new Error(str); + } + }, +setInput:function (input) { + this._input = input; + this._more = this._less = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ''; + this.conditionStack = ['INITIAL']; + this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0}; + return this; + }, +input:function () { + var ch = this._input[0]; + this.yytext+=ch; + this.yyleng++; + this.match+=ch; + this.matched+=ch; + var lines = ch.match(/\n/); + if (lines) this.yylineno++; + this._input = this._input.slice(1); + return ch; + }, +unput:function (ch) { + this._input = ch + this._input; + return this; + }, +more:function () { + this._more = true; + return this; + }, +pastInput:function () { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); + }, +upcomingInput:function () { + var next = this.match; + if (next.length < 20) { + next += this._input.substr(0, 20-next.length); + } + return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, ""); + }, +showPosition:function () { + var pre = this.pastInput(); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c+"^"; + }, +next:function () { + if (this.done) { + return this.EOF; + } + if (!this._input) this.done = true; + + var token, + match, + col, + lines; + if (!this._more) { + this.yytext = ''; + this.match = ''; + } + var rules = this._currentRules(); + for (var i=0;i < rules.length; i++) { + match = this._input.match(this.rules[rules[i]]); + if (match) { + lines = match[0].match(/\n.*/g); + if (lines) this.yylineno += lines.length; + this.yylloc = {first_line: this.yylloc.last_line, + last_line: this.yylineno+1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length-1].length-1 : this.yylloc.last_column + match[0].length} + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + this._more = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, rules[i],this.conditionStack[this.conditionStack.length-1]); + if (token) return token; + else return; + } + } + if (this._input === "") { + return this.EOF; + } else { + this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(), + {text: "", token: null, line: this.yylineno}); + } + }, +lex:function lex() { + var r = this.next(); + if (typeof r !== 'undefined') { + return r; + } else { + return this.lex(); + } + }, +begin:function begin(condition) { + this.conditionStack.push(condition); + }, +popState:function popState() { + return this.conditionStack.pop(); + }, +_currentRules:function _currentRules() { + return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules; + }, +topState:function () { + return this.conditionStack[this.conditionStack.length-2]; + }, +pushState:function begin(condition) { + this.begin(condition); + }}); +lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { + +var YYSTATE=YY_START +switch($avoiding_name_collisions) { +case 0: + if(yy_.yytext.slice(-1) !== "\\") this.begin("mu"); + if(yy_.yytext.slice(-1) === "\\") yy_.yytext = yy_.yytext.substr(0,yy_.yyleng-1), this.begin("emu"); + if(yy_.yytext) return 14; + +break; +case 1: return 14; +break; +case 2: this.popState(); return 14; +break; +case 3: return 24; +break; +case 4: return 16; +break; +case 5: return 20; +break; +case 6: return 19; +break; +case 7: return 19; +break; +case 8: return 23; +break; +case 9: return 23; +break; +case 10: yy_.yytext = yy_.yytext.substr(3,yy_.yyleng-5); this.popState(); return 15; +break; +case 11: return 22; +break; +case 12: return 34; +break; +case 13: return 33; +break; +case 14: return 33; +break; +case 15: return 36; +break; +case 16: /*ignore whitespace*/ +break; +case 17: this.popState(); return 18; +break; +case 18: this.popState(); return 18; +break; +case 19: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\"/g,'"'); return 28; +break; +case 20: return 30; +break; +case 21: return 30; +break; +case 22: return 29; +break; +case 23: return 33; +break; +case 24: yy_.yytext = yy_.yytext.substr(1, yy_.yyleng-2); return 33; +break; +case 25: return 'INVALID'; +break; +case 26: return 5; +break; +} +}; +lexer.rules = [/^[^\x00]*?(?=(\{\{))/,/^[^\x00]+/,/^[^\x00]{2,}?(?=(\{\{))/,/^\{\{>/,/^\{\{#/,/^\{\{\//,/^\{\{\^/,/^\{\{\s*else\b/,/^\{\{\{/,/^\{\{&/,/^\{\{![\s\S]*?\}\}/,/^\{\{/,/^=/,/^\.(?=[} ])/,/^\.\./,/^[\/.]/,/^\s+/,/^\}\}\}/,/^\}\}/,/^"(\\["]|[^"])*"/,/^true(?=[}\s])/,/^false(?=[}\s])/,/^[0-9]+(?=[}\s])/,/^[a-zA-Z0-9_$-]+(?=[=}\s\/.])/,/^\[[^\]]*\]/,/^./,/^$/]; +lexer.conditions = {"mu":{"rules":[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"INITIAL":{"rules":[0,1,26],"inclusive":true}};return lexer;})() +parser.lexer = lexer; +return parser; +})(); +if (typeof require !== 'undefined' && typeof exports !== 'undefined') { +exports.parser = handlebars; +exports.parse = function () { return handlebars.parse.apply(handlebars, arguments); } +exports.main = function commonjsMain(args) { + if (!args[1]) + throw new Error('Usage: '+args[0]+' FILE'); + if (typeof process !== 'undefined') { + var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), "utf8"); + } else { + var cwd = require("file").path(require("file").cwd()); + var source = cwd.join(args[1]).read({charset: "utf-8"}); + } + return exports.parser.parse(source); +} +if (typeof module !== 'undefined' && require.main === module) { + exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args); +} +}; +; +// lib/handlebars/compiler/base.js +Handlebars.Parser = handlebars; + +Handlebars.parse = function(string) { + Handlebars.Parser.yy = Handlebars.AST; + return Handlebars.Parser.parse(string); +}; + +Handlebars.print = function(ast) { + return new Handlebars.PrintVisitor().accept(ast); +}; + +Handlebars.logger = { + DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3, level: 3, + + // override in the host environment + log: function(level, str) {} +}; + +Handlebars.log = function(level, str) { Handlebars.logger.log(level, str); }; +; +// lib/handlebars/compiler/ast.js +(function() { + + Handlebars.AST = {}; + + Handlebars.AST.ProgramNode = function(statements, inverse) { + this.type = "program"; + this.statements = statements; + if(inverse) { this.inverse = new Handlebars.AST.ProgramNode(inverse); } + }; + + Handlebars.AST.MustacheNode = function(params, hash, unescaped) { + this.type = "mustache"; + this.id = params[0]; + this.params = params.slice(1); + this.hash = hash; + this.escaped = !unescaped; + }; + + Handlebars.AST.PartialNode = function(id, context) { + this.type = "partial"; + + // TODO: disallow complex IDs + + this.id = id; + this.context = context; + }; + + var verifyMatch = function(open, close) { + if(open.original !== close.original) { + throw new Handlebars.Exception(open.original + " doesn't match " + close.original); + } + }; + + Handlebars.AST.BlockNode = function(mustache, program, close) { + verifyMatch(mustache.id, close); + this.type = "block"; + this.mustache = mustache; + this.program = program; + }; + + Handlebars.AST.InverseNode = function(mustache, program, close) { + verifyMatch(mustache.id, close); + this.type = "inverse"; + this.mustache = mustache; + this.program = program; + }; + + Handlebars.AST.ContentNode = function(string) { + this.type = "content"; + this.string = string; + }; + + Handlebars.AST.HashNode = function(pairs) { + this.type = "hash"; + this.pairs = pairs; + }; + + Handlebars.AST.IdNode = function(parts) { + this.type = "ID"; + this.original = parts.join("."); + + var dig = [], depth = 0; + + for(var i=0,l=parts.length; i<l; i++) { + var part = parts[i]; + + if(part === "..") { depth++; } + else if(part === "." || part === "this") { this.isScoped = true; } + else { dig.push(part); } + } + + this.parts = dig; + this.string = dig.join('.'); + this.depth = depth; + this.isSimple = (dig.length === 1) && (depth === 0); + }; + + Handlebars.AST.StringNode = function(string) { + this.type = "STRING"; + this.string = string; + }; + + Handlebars.AST.IntegerNode = function(integer) { + this.type = "INTEGER"; + this.integer = integer; + }; + + Handlebars.AST.BooleanNode = function(bool) { + this.type = "BOOLEAN"; + this.bool = bool; + }; + + Handlebars.AST.CommentNode = function(comment) { + this.type = "comment"; + this.comment = comment; + }; + +})();; +// lib/handlebars/utils.js +Handlebars.Exception = function(message) { + var tmp = Error.prototype.constructor.apply(this, arguments); + + for (var p in tmp) { + if (tmp.hasOwnProperty(p)) { this[p] = tmp[p]; } + } + + this.message = tmp.message; +}; +Handlebars.Exception.prototype = new Error; + +// Build out our basic SafeString type +Handlebars.SafeString = function(string) { + this.string = string; +}; +Handlebars.SafeString.prototype.toString = function() { + return this.string.toString(); +}; + +(function() { + var escape = { + "<": "<", + ">": ">", + '"': """, + "'": "'", + "`": "`" + }; + + var badChars = /&(?!\w+;)|[<>"'`]/g; + var possible = /[&<>"'`]/; + + var escapeChar = function(chr) { + return escape[chr] || "&"; + }; + + Handlebars.Utils = { + escapeExpression: function(string) { + // don't escape SafeStrings, since they're already safe + if (string instanceof Handlebars.SafeString) { + return string.toString(); + } else if (string == null || string === false) { + return ""; + } + + if(!possible.test(string)) { return string; } + return string.replace(badChars, escapeChar); + }, + + isEmpty: function(value) { + if (typeof value === "undefined") { + return true; + } else if (value === null) { + return true; + } else if (value === false) { + return true; + } else if(Object.prototype.toString.call(value) === "[object Array]" && value.length === 0) { + return true; + } else { + return false; + } + } + }; +})();; +// lib/handlebars/compiler/compiler.js +Handlebars.Compiler = function() {}; +Handlebars.JavaScriptCompiler = function() {}; + +(function(Compiler, JavaScriptCompiler) { + Compiler.OPCODE_MAP = { + appendContent: 1, + getContext: 2, + lookupWithHelpers: 3, + lookup: 4, + append: 5, + invokeMustache: 6, + appendEscaped: 7, + pushString: 8, + truthyOrFallback: 9, + functionOrFallback: 10, + invokeProgram: 11, + invokePartial: 12, + push: 13, + assignToHash: 15, + pushStringParam: 16 + }; + + Compiler.MULTI_PARAM_OPCODES = { + appendContent: 1, + getContext: 1, + lookupWithHelpers: 2, + lookup: 1, + invokeMustache: 3, + pushString: 1, + truthyOrFallback: 1, + functionOrFallback: 1, + invokeProgram: 3, + invokePartial: 1, + push: 1, + assignToHash: 1, + pushStringParam: 1 + }; + + Compiler.DISASSEMBLE_MAP = {}; + + for(var prop in Compiler.OPCODE_MAP) { + var value = Compiler.OPCODE_MAP[prop]; + Compiler.DISASSEMBLE_MAP[value] = prop; + } + + Compiler.multiParamSize = function(code) { + return Compiler.MULTI_PARAM_OPCODES[Compiler.DISASSEMBLE_MAP[code]]; + }; + + Compiler.prototype = { + compiler: Compiler, + + disassemble: function() { + var opcodes = this.opcodes, opcode, nextCode; + var out = [], str, name, value; + + for(var i=0, l=opcodes.length; i<l; i++) { + opcode = opcodes[i]; + + if(opcode === 'DECLARE') { + name = opcodes[++i]; + value = opcodes[++i]; + out.push("DECLARE " + name + " = " + value); + } else { + str = Compiler.DISASSEMBLE_MAP[opcode]; + + var extraParams = Compiler.multiParamSize(opcode); + var codes = []; + + for(var j=0; j<extraParams; j++) { + nextCode = opcodes[++i]; + + if(typeof nextCode === "string") { + nextCode = "\"" + nextCode.replace("\n", "\\n") + "\""; + } + + codes.push(nextCode); + } + + str = str + " " + codes.join(" "); + + out.push(str); + } + } + + return out.join("\n"); + }, + + guid: 0, + + compile: function(program, options) { + this.children = []; + this.depths = {list: []}; + this.options = options; + + // These changes will propagate to the other compiler components + var knownHelpers = this.options.knownHelpers; + this.options.knownHelpers = { + 'helperMissing': true, + 'blockHelperMissing': true, + 'each': true, + 'if': true, + 'unless': true, + 'with': true, + 'log': true + }; + if (knownHelpers) { + for (var name in knownHelpers) { + this.options.knownHelpers[name] = knownHelpers[name]; + } + } + + return this.program(program); + }, + + accept: function(node) { + return this[node.type](node); + }, + + program: function(program) { + var statements = program.statements, statement; + this.opcodes = []; + + for(var i=0, l=statements.length; i<l; i++) { + statement = statements[i]; + this[statement.type](statement); + } + this.isSimple = l === 1; + + this.depths.list = this.depths.list.sort(function(a, b) { + return a - b; + }); + + return this; + }, + + compileProgram: function(program) { + var result = new this.compiler().compile(program, this.options); + var guid = this.guid++; + + this.usePartial = this.usePartial || result.usePartial; + + this.children[guid] = result; + + for(var i=0, l=result.depths.list.length; i<l; i++) { + depth = result.depths.list[i]; + + if(depth < 2) { continue; } + else { this.addDepth(depth - 1); } + } + + return guid; + }, + + block: function(block) { + var mustache = block.mustache; + var depth, child, inverse, inverseGuid; + + var params = this.setupStackForMustache(mustache); + + var programGuid = this.compileProgram(block.program); + + if(block.program.inverse) { + inverseGuid = this.compileProgram(block.program.inverse); + this.declare('inverse', inverseGuid); + } + + this.opcode('invokeProgram', programGuid, params.length, !!mustache.hash); + this.declare('inverse', null); + this.opcode('append'); + }, + + inverse: function(block) { + var params = this.setupStackForMustache(block.mustache); + + var programGuid = this.compileProgram(block.program); + + this.declare('inverse', programGuid); + + this.opcode('invokeProgram', null, params.length, !!block.mustache.hash); + this.declare('inverse', null); + this.opcode('append'); + }, + + hash: function(hash) { + var pairs = hash.pairs, pair, val; + + this.opcode('push', '{}'); + + for(var i=0, l=pairs.length; i<l; i++) { + pair = pairs[i]; + val = pair[1]; + + this.accept(val); + this.opcode('assignToHash', pair[0]); + } + }, + + partial: function(partial) { + var id = partial.id; + this.usePartial = true; + + if(partial.context) { + this.ID(partial.context); + } else { + this.opcode('push', 'depth0'); + } + + this.opcode('invokePartial', id.original); + this.opcode('append'); + }, + + content: function(content) { + this.opcode('appendContent', content.string); + }, + + mustache: function(mustache) { + var params = this.setupStackForMustache(mustache); + + this.opcode('invokeMustache', params.length, mustache.id.original, !!mustache.hash); + + if(mustache.escaped && !this.options.noEscape) { + this.opcode('appendEscaped'); + } else { + this.opcode('append'); + } + }, + + ID: function(id) { + this.addDepth(id.depth); + + this.opcode('getContext', id.depth); + + this.opcode('lookupWithHelpers', id.parts[0] || null, id.isScoped || false); + + for(var i=1, l=id.parts.length; i<l; i++) { + this.opcode('lookup', id.parts[i]); + } + }, + + STRING: function(string) { + this.opcode('pushString', string.string); + }, + + INTEGER: function(integer) { + this.opcode('push', integer.integer); + }, + + BOOLEAN: function(bool) { + this.opcode('push', bool.bool); + }, + + comment: function() {}, + + // HELPERS + pushParams: function(params) { + var i = params.length, param; + + while(i--) { + param = params[i]; + + if(this.options.stringParams) { + if(param.depth) { + this.addDepth(param.depth); + } + + this.opcode('getContext', param.depth || 0); + this.opcode('pushStringParam', param.string); + } else { + this[param.type](param); + } + } + }, + + opcode: function(name, val1, val2, val3) { + this.opcodes.push(Compiler.OPCODE_MAP[name]); + if(val1 !== undefined) { this.opcodes.push(val1); } + if(val2 !== undefined) { this.opcodes.push(val2); } + if(val3 !== undefined) { this.opcodes.push(val3); } + }, + + declare: function(name, value) { + this.opcodes.push('DECLARE'); + this.opcodes.push(name); + this.opcodes.push(value); + }, + + addDepth: function(depth) { + if(depth === 0) { return; } + + if(!this.depths[depth]) { + this.depths[depth] = true; + this.depths.list.push(depth); + } + }, + + setupStackForMustache: function(mustache) { + var params = mustache.params; + + this.pushParams(params); + + if(mustache.hash) { + this.hash(mustache.hash); + } + + this.ID(mustache.id); + + return params; + } + }; + + JavaScriptCompiler.prototype = { + // PUBLIC API: You can override these methods in a subclass to provide + // alternative compiled forms for name lookup and buffering semantics + nameLookup: function(parent, name, type) { + if (/^[0-9]+$/.test(name)) { + return parent + "[" + name + "]"; + } else if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { + return parent + "." + name; + } + else { + return parent + "['" + name + "']"; + } + }, + + appendToBuffer: function(string) { + if (this.environment.isSimple) { + return "return " + string + ";"; + } else { + return "buffer += " + string + ";"; + } + }, + + initializeBuffer: function() { + return this.quotedString(""); + }, + + namespace: "Handlebars", + // END PUBLIC API + + compile: function(environment, options, context, asObject) { + this.environment = environment; + this.options = options || {}; + + this.name = this.environment.name; + this.isChild = !!context; + this.context = context || { + programs: [], + aliases: { self: 'this' }, + registers: {list: []} + }; + + this.preamble(); + + this.stackSlot = 0; + this.stackVars = []; + + this.compileChildren(environment, options); + + var opcodes = environment.opcodes, opcode; + + this.i = 0; + + for(l=opcodes.length; this.i<l; this.i++) { + opcode = this.nextOpcode(0); + + if(opcode[0] === 'DECLARE') { + this.i = this.i + 2; + this[opcode[1]] = opcode[2]; + } else { + this.i = this.i + opcode[1].length; + this[opcode[0]].apply(this, opcode[1]); + } + } + + return this.createFunctionContext(asObject); + }, + + nextOpcode: function(n) { + var opcodes = this.environment.opcodes, opcode = opcodes[this.i + n], name, val; + var extraParams, codes; + + if(opcode === 'DECLARE') { + name = opcodes[this.i + 1]; + val = opcodes[this.i + 2]; + return ['DECLARE', name, val]; + } else { + name = Compiler.DISASSEMBLE_MAP[opcode]; + + extraParams = Compiler.multiParamSize(opcode); + codes = []; + + for(var j=0; j<extraParams; j++) { + codes.push(opcodes[this.i + j + 1 + n]); + } + + return [name, codes]; + } + }, + + eat: function(opcode) { + this.i = this.i + opcode.length; + }, + + preamble: function() { + var out = []; + + // this register will disambiguate helper lookup from finding a function in + // a context. This is necessary for mustache compatibility, which requires + // that context functions in blocks are evaluated by blockHelperMissing, and + // then proceed as if the resulting value was provided to blockHelperMissing. + this.useRegister('foundHelper'); + + if (!this.isChild) { + var namespace = this.namespace; + var copies = "helpers = helpers || " + namespace + ".helpers;"; + if(this.environment.usePartial) { copies = copies + " partials = partials || " + namespace + ".partials;"; } + out.push(copies); + } else { + out.push(''); + } + + if (!this.environment.isSimple) { + out.push(", buffer = " + this.initializeBuffer()); + } else { + out.push(""); + } + + // track the last context pushed into place to allow skipping the + // getContext opcode when it would be a noop + this.lastContext = 0; + this.source = out; + }, + + createFunctionContext: function(asObject) { + var locals = this.stackVars; + if (!this.isChild) { + locals = locals.concat(this.context.registers.list); + } + + if(locals.length > 0) { + this.source[1] = this.source[1] + ", " + locals.join(", "); + } + + // Generate minimizer alias mappings + if (!this.isChild) { + var aliases = [] + for (var alias in this.context.aliases) { + this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias]; + } + } + + if (this.source[1]) { + this.source[1] = "var " + this.source[1].substring(2) + ";"; + } + + // Merge children + if (!this.isChild) { + this.source[1] += '\n' + this.context.programs.join('\n') + '\n'; + } + + if (!this.environment.isSimple) { + this.source.push("return buffer;"); + } + + var params = this.isChild ? ["depth0", "data"] : ["Handlebars", "depth0", "helpers", "partials", "data"]; + + for(var i=0, l=this.environment.depths.list.length; i<l; i++) { + params.push("depth" + this.environment.depths.list[i]); + } + + if (asObject) { + params.push(this.source.join("\n ")); + + return Function.apply(this, params); + } else { + var functionSource = 'function ' + (this.name || '') + '(' + params.join(',') + ') {\n ' + this.source.join("\n ") + '}'; + Handlebars.log(Handlebars.logger.DEBUG, functionSource + "\n\n"); + return functionSource; + } + }, + + appendContent: function(content) { + this.source.push(this.appendToBuffer(this.quotedString(content))); + }, + + append: function() { + var local = this.popStack(); + this.source.push("if(" + local + " || " + local + " === 0) { " + this.appendToBuffer(local) + " }"); + if (this.environment.isSimple) { + this.source.push("else { " + this.appendToBuffer("''") + " }"); + } + }, + + appendEscaped: function() { + var opcode = this.nextOpcode(1), extra = ""; + this.context.aliases.escapeExpression = 'this.escapeExpression'; + + if(opcode[0] === 'appendContent') { + extra = " + " + this.quotedString(opcode[1][0]); + this.eat(opcode); + } + + this.source.push(this.appendToBuffer("escapeExpression(" + this.popStack() + ")" + extra)); + }, + + getContext: function(depth) { + if(this.lastContext !== depth) { + this.lastContext = depth; + } + }, + + lookupWithHelpers: function(name, isScoped) { + if(name) { + var topStack = this.nextStack(); + + this.usingKnownHelper = false; + + var toPush; + if (!isScoped && this.options.knownHelpers[name]) { + toPush = topStack + " = " + this.nameLookup('helpers', name, 'helper'); + this.usingKnownHelper = true; + } else if (isScoped || this.options.knownHelpersOnly) { + toPush = topStack + " = " + this.nameLookup('depth' + this.lastContext, name, 'context'); + } else { + this.register('foundHelper', this.nameLookup('helpers', name, 'helper')); + toPush = topStack + " = foundHelper || " + this.nameLookup('depth' + this.lastContext, name, 'context'); + } + + toPush += ';'; + this.source.push(toPush); + } else { + this.pushStack('depth' + this.lastContext); + } + }, + + lookup: function(name) { + var topStack = this.topStack(); + this.source.push(topStack + " = (" + topStack + " === null || " + topStack + " === undefined || " + topStack + " === false ? " + + topStack + " : " + this.nameLookup(topStack, name, 'context') + ");"); + }, + + pushStringParam: function(string) { + this.pushStack('depth' + this.lastContext); + this.pushString(string); + }, + + pushString: function(string) { + this.pushStack(this.quotedString(string)); + }, + + push: function(name) { + this.pushStack(name); + }, + + invokeMustache: function(paramSize, original, hasHash) { + this.populateParams(paramSize, this.quotedString(original), "{}", null, hasHash, function(nextStack, helperMissingString, id) { + if (!this.usingKnownHelper) { + this.context.aliases.helperMissing = 'helpers.helperMissing'; + this.context.aliases.undef = 'void 0'; + this.source.push("else if(" + id + "=== undef) { " + nextStack + " = helperMissing.call(" + helperMissingString + "); }"); + if (nextStack !== id) { + this.source.push("else { " + nextStack + " = " + id + "; }"); + } + } + }); + }, + + invokeProgram: function(guid, paramSize, hasHash) { + var inverse = this.programExpression(this.inverse); + var mainProgram = this.programExpression(guid); + + this.populateParams(paramSize, null, mainProgram, inverse, hasHash, function(nextStack, helperMissingString, id) { + if (!this.usingKnownHelper) { + this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing'; + this.source.push("else { " + nextStack + " = blockHelperMissing.call(" + helperMissingString + "); }"); + } + }); + }, + + populateParams: function(paramSize, helperId, program, inverse, hasHash, fn) { + var needsRegister = hasHash || this.options.stringParams || inverse || this.options.data; + var id = this.popStack(), nextStack; + var params = [], param, stringParam, stringOptions; + + if (needsRegister) { + this.register('tmp1', program); + stringOptions = 'tmp1'; + } else { + stringOptions = '{ hash: {} }'; + } + + if (needsRegister) { + var hash = (hasHash ? this.popStack() : '{}'); + this.source.push('tmp1.hash = ' + hash + ';'); + } + + if(this.options.stringParams) { + this.source.push('tmp1.contexts = [];'); + } + + for(var i=0; i<paramSize; i++) { + param = this.popStack(); + params.push(param); + + if(this.options.stringParams) { + this.source.push('tmp1.contexts.push(' + this.popStack() + ');'); + } + } + + if(inverse) { + this.source.push('tmp1.fn = tmp1;'); + this.source.push('tmp1.inverse = ' + inverse + ';'); + } + + if(this.options.data) { + this.source.push('tmp1.data = data;'); + } + + params.push(stringOptions); + + this.populateCall(params, id, helperId || id, fn, program !== '{}'); + }, + + populateCall: function(params, id, helperId, fn, program) { + var paramString = ["depth0"].concat(params).join(", "); + var helperMissingString = ["depth0"].concat(helperId).concat(params).join(", "); + + var nextStack = this.nextStack(); + + if (this.usingKnownHelper) { + this.source.push(nextStack + " = " + id + ".call(" + paramString + ");"); + } else { + this.context.aliases.functionType = '"function"'; + var condition = program ? "foundHelper && " : "" + this.source.push("if(" + condition + "typeof " + id + " === functionType) { " + nextStack + " = " + id + ".call(" + paramString + "); }"); + } + fn.call(this, nextStack, helperMissingString, id); + this.usingKnownHelper = false; + }, + + invokePartial: function(context) { + params = [this.nameLookup('partials', context, 'partial'), "'" + context + "'", this.popStack(), "helpers", "partials"]; + + if (this.options.data) { + params.push("data"); + } + + this.pushStack("self.invokePartial(" + params.join(", ") + ");"); + }, + + assignToHash: function(key) { + var value = this.popStack(); + var hash = this.topStack(); + + this.source.push(hash + "['" + key + "'] = " + value + ";"); + }, + + // HELPERS + + compiler: JavaScriptCompiler, + + compileChildren: function(environment, options) { + var children = environment.children, child, compiler; + + for(var i=0, l=children.length; i<l; i++) { + child = children[i]; + compiler = new this.compiler(); + + this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children + var index = this.context.programs.length; + child.index = index; + child.name = 'program' + index; + this.context.programs[index] = compiler.compile(child, options, this.context); + } + }, + + programExpression: function(guid) { + if(guid == null) { return "self.noop"; } + + var child = this.environment.children[guid], + depths = child.depths.list; + var programParams = [child.index, child.name, "data"]; + + for(var i=0, l = depths.length; i<l; i++) { + depth = depths[i]; + + if(depth === 1) { programParams.push("depth0"); } + else { programParams.push("depth" + (depth - 1)); } + } + + if(depths.length === 0) { + return "self.program(" + programParams.join(", ") + ")"; + } else { + programParams.shift(); + return "self.programWithDepth(" + programParams.join(", ") + ")"; + } + }, + + register: function(name, val) { + this.useRegister(name); + this.source.push(name + " = " + val + ";"); + }, + + useRegister: function(name) { + if(!this.context.registers[name]) { + this.context.registers[name] = true; + this.context.registers.list.push(name); + } + }, + + pushStack: function(item) { + this.source.push(this.nextStack() + " = " + item + ";"); + return "stack" + this.stackSlot; + }, + + nextStack: function() { + this.stackSlot++; + if(this.stackSlot > this.stackVars.length) { this.stackVars.push("stack" + this.stackSlot); } + return "stack" + this.stackSlot; + }, + + popStack: function() { + return "stack" + this.stackSlot--; + }, + + topStack: function() { + return "stack" + this.stackSlot; + }, + + quotedString: function(str) { + return '"' + str + .replace(/\\/g, '\\\\') + .replace(/"/g, '\\"') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + '"'; + } + }; + + var reservedWords = ( + "break else new var" + + " case finally return void" + + " catch for switch while" + + " continue function this with" + + " default if throw" + + " delete in try" + + " do instanceof typeof" + + " abstract enum int short" + + " boolean export interface static" + + " byte extends long super" + + " char final native synchronized" + + " class float package throws" + + " const goto private transient" + + " debugger implements protected volatile" + + " double import public let yield" + ).split(" "); + + var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {}; + + for(var i=0, l=reservedWords.length; i<l; i++) { + compilerWords[reservedWords[i]] = true; + } + + JavaScriptCompiler.isValidJavaScriptVariableName = function(name) { + if(!JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(name)) { + return true; + } + return false; + } + +})(Handlebars.Compiler, Handlebars.JavaScriptCompiler); + +Handlebars.precompile = function(string, options) { + options = options || {}; + + var ast = Handlebars.parse(string); + var environment = new Handlebars.Compiler().compile(ast, options); + return new Handlebars.JavaScriptCompiler().compile(environment, options); +}; + +Handlebars.compile = function(string, options) { + options = options || {}; + + var compiled; + function compile() { + var ast = Handlebars.parse(string); + var environment = new Handlebars.Compiler().compile(ast, options); + var templateSpec = new Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true); + return Handlebars.template(templateSpec); + } + + // Template is only compiled on first use and cached after that point. + return function(context, options) { + if (!compiled) { + compiled = compile(); + } + return compiled.call(this, context, options); + }; +}; +; +// lib/handlebars/runtime.js +Handlebars.VM = { + template: function(templateSpec) { + // Just add water + var container = { + escapeExpression: Handlebars.Utils.escapeExpression, + invokePartial: Handlebars.VM.invokePartial, + programs: [], + program: function(i, fn, data) { + var programWrapper = this.programs[i]; + if(data) { + return Handlebars.VM.program(fn, data); + } else if(programWrapper) { + return programWrapper; + } else { + programWrapper = this.programs[i] = Handlebars.VM.program(fn); + return programWrapper; + } + }, + programWithDepth: Handlebars.VM.programWithDepth, + noop: Handlebars.VM.noop + }; + + return function(context, options) { + options = options || {}; + return templateSpec.call(container, Handlebars, context, options.helpers, options.partials, options.data); + }; + }, + + programWithDepth: function(fn, data, $depth) { + var args = Array.prototype.slice.call(arguments, 2); + + return function(context, options) { + options = options || {}; + + return fn.apply(this, [context, options.data || data].concat(args)); + }; + }, + program: function(fn, data) { + return function(context, options) { + options = options || {}; + + return fn(context, options.data || data); + }; + }, + noop: function() { return ""; }, + invokePartial: function(partial, name, context, helpers, partials, data) { + options = { helpers: helpers, partials: partials, data: data }; + + if(partial === undefined) { + throw new Handlebars.Exception("The partial " + name + " could not be found"); + } else if(partial instanceof Function) { + return partial(context, options); + } else if (!Handlebars.compile) { + throw new Handlebars.Exception("The partial " + name + " could not be compiled when running in runtime-only mode"); + } else { + partials[name] = Handlebars.compile(partial); + return partials[name](context, options); + } + } +}; + +Handlebars.template = Handlebars.VM.template; +; diff --git a/src/main/webapp/javascripts/libs/handlebarsHelpers/divider_display.js b/src/main/webapp/javascripts/libs/handlebarsHelpers/divider_display.js new file mode 100644 index 0000000..126e459 --- /dev/null +++ b/src/main/webapp/javascripts/libs/handlebarsHelpers/divider_display.js @@ -0,0 +1,14 @@ +define(["Handlebars"], function (Handlebars) { + + + Handlebars.registerHelper("divider_display", function(colWidths) { + var padding = []; + + padding.length = colWidths[this.index] + 1; + + return padding.join('-'); + + }); + + // returns nothing +});
\ No newline at end of file diff --git a/src/main/webapp/javascripts/libs/handlebarsHelpers/each_simple_value_with_index.js b/src/main/webapp/javascripts/libs/handlebarsHelpers/each_simple_value_with_index.js new file mode 100644 index 0000000..d35f7aa --- /dev/null +++ b/src/main/webapp/javascripts/libs/handlebarsHelpers/each_simple_value_with_index.js @@ -0,0 +1,31 @@ +define(["Handlebars"], function (Handlebars) { + + + Handlebars.registerHelper("each_simple_value_with_index", function(array, fn) { + var buffer = ""; + k=0; + for (var i = 0, j = array.length; i < j; i++) { + var item = { + value: array[i] + }; + + // stick an index property onto the item, starting with 0 + item.index = k; + + item.first = (k == 0); + item.last = (k == array.length); + + // show the inside of the block + buffer += fn(item); + + k++; + } + + // return the finished buffer + return buffer; + + }); + + + // returns nothing +});
\ No newline at end of file diff --git a/src/main/webapp/javascripts/libs/handlebarsHelpers/each_with_index.js b/src/main/webapp/javascripts/libs/handlebarsHelpers/each_with_index.js new file mode 100644 index 0000000..5b6ba58 --- /dev/null +++ b/src/main/webapp/javascripts/libs/handlebarsHelpers/each_with_index.js @@ -0,0 +1,30 @@ +define(["Handlebars"], function (Handlebars) { + + Handlebars.registerHelper("each_with_index", function(array, fn) { + var buffer = ""; + var k=0; + for (var i = 0, j = array.length; i < j; i++) { + if (array[i]) + { + var item = array[i]; + + // stick an index property onto the item, starting with 0 + item.index = k; + + item.first = (k == 0); + item.last = (k == array.length); + + // show the inside of the block + buffer += fn(item); + + k++; + } + } + + // return the finished buffer + return buffer; + + }); + + // returns nothing +});
\ No newline at end of file diff --git a/src/main/webapp/javascripts/libs/handlebarsHelpers/result_display.js b/src/main/webapp/javascripts/libs/handlebarsHelpers/result_display.js new file mode 100644 index 0000000..fa50a2d --- /dev/null +++ b/src/main/webapp/javascripts/libs/handlebarsHelpers/result_display.js @@ -0,0 +1,22 @@ +define(["jQuery","Handlebars"], function ($,Handlebars) { + + + Handlebars.registerHelper("result_display", function(value) { + // thanks to John Gruber for this regexp http://daringfireball.net/2010/07/improved_regex_for_matching_urls + // also to "Searls" for his port to JS https://gist.github.com/1033143 + var urlRegexp = /\b((?:https?:\/\/|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?������]))/ig; + + if ($.isPlainObject(value)) + return JSON.stringify(value); + else if (value == null) + return "(null)"; + else if (value === false) + return "false"; + else if (typeof value === "string" && value.match(urlRegexp) && Handlebars.Utils.escapeExpression(value) == value) + return new Handlebars.SafeString(value.replace(urlRegexp, "<a href='$1' target='_new'>$1</a>")); + else + return value; + }); + + // returns nothing +});
\ No newline at end of file diff --git a/src/main/webapp/javascripts/libs/handlebarsHelpers/result_display_padded.js b/src/main/webapp/javascripts/libs/handlebarsHelpers/result_display_padded.js new file mode 100644 index 0000000..1d1ed8b --- /dev/null +++ b/src/main/webapp/javascripts/libs/handlebarsHelpers/result_display_padded.js @@ -0,0 +1,13 @@ +define(["Handlebars"], function (Handlebars) { + + + Handlebars.registerHelper("result_display_padded", function(colWidths) { + var padding = []; + + padding.length = colWidths[this.index] - this.value.toString().length + 1; + + return padding.join(' ') + this.value.toString(); + }); + + // returns nothing +});
\ No newline at end of file diff --git a/src/main/webapp/javascripts/libs/idselector.js b/src/main/webapp/javascripts/libs/idselector.js new file mode 100644 index 0000000..fac2331 --- /dev/null +++ b/src/main/webapp/javascripts/libs/idselector.js @@ -0,0 +1,532 @@ +(function () { + function gen_selector() { + var quirksMode = document.compatMode != 'CSS1Compat'; + + function log(msg) { + if (window.console) {window.console.log('ID Selector: ' + msg);} + } + + function readCookie(name) { + var nameEQ = name + "="; + var ca = document.cookie.split(';'); + for(var i=0;i < ca.length;i++) { + var c = ca[i]; + while (c.charAt(0)==' ') c = c.substring(1,c.length); + if (c.indexOf(nameEQ) == 0) + return decodeURIComponent(c.substring(nameEQ.length,c.length)); + } + return null; + } + var openidCookie = readCookie('__openid_selector_openid'); + var opIdCookie = readCookie('__openid_selector_op_id'); + var unameCookie = readCookie('__openid_selector_uname'); + + var s; + var providers = [{shortname: "myOpenID", url_suffix: ".myopenid.com/", openid1: true, openid2: true, id: 8, icon: "myopenid.ico", url_prefix: "http://", website: "https://www.myopenid.com/", longname: "myOpenID", usercalled: "username"}, {shortname: "claimID", url_suffix: "", openid1: true, openid2: false, id: 4, icon: "claimid.ico", url_prefix: "http://claimid.com/", website: "http://claimid.com/", longname: "claimID", usercalled: "username"}, {shortname: "Clickpass", url_suffix: "", openid1: true, openid2: true, id: 5, icon: "clickpass.ico", url_prefix: "http://clickpass.com/public/", website: "http://www.clickpass.com/", longname: "Clickpass", usercalled: "username"}, {shortname: "Wordpress", url_suffix: ".wordpress.com/", openid1: true, openid2: false, id: 14, icon: "wordpress.ico", url_prefix: "http://", website: "http://www.wordpress.com/", longname: "Wordpress", usercalled: "username"}, {shortname: "Blogger", url_suffix: ".blogspot.com/", openid1: true, openid2: false, id: 2, icon: "blogger.ico", url_prefix: "http://", website: "http://www.blogger.com/", longname: "Google Blogger", usercalled: "blog name"}, {shortname: "Livejournal", url_suffix: ".livejournal.com/", openid1: true, openid2: false, id: 7, icon: "lj.ico", url_prefix: "http://", website: "http://www.livejournal.com/", longname: "Livejournal", usercalled: "username"}, {shortname: "Technorati", url_suffix: "", openid1: true, openid2: false, id: 10, icon: "technorati.ico", url_prefix: "http://technorati.com/people/technorati/", website: "http://www.technorati.com/", longname: "Technorati", usercalled: "username"}, {shortname: "Flickr", url_suffix: "", openid1: false, openid2: true, id: 6, icon: "flickr.ico", url_prefix: "http://www.flickr.com/photos/", website: "http://www.flickr.com/", longname: "Flickr", usercalled: "username"}, {shortname: "Identity.net", url_suffix: ".identity.net/", openid1: true, openid2: true, id: 23, icon: "identity.ico", url_prefix: "http://", website: "http://identity.net/", longname: "Identity.net", usercalled: "username"}, {shortname: "Google", url_suffix: "", openid1: false, openid2: true, id: 26, icon: "google.ico", url_prefix: "", website: "https://www.google.com/accounts/o8/id", longname: "Google", usercalled: "username"}, {shortname: "Yahoo!", url_suffix: "", openid1: false, openid2: true, id: 15, icon: "yahoo.ico", url_prefix: "http://me.yahoo.com/", website: "http://yahoo.com/", longname: "Yahoo!", usercalled: "yahoo id"}, {shortname: "AOL", url_suffix: "", openid1: true, openid2: false, id: 1, icon: "aol.ico", url_prefix: "http://openid.aol.com/", website: "http://www.aol.com/", longname: "America Online/AIM", usercalled: "screenname"}]; + + var oidTbId = window.idselector_input_id ? window.idselector_input_id : "openid_identifier"; + var oidTb = document.getElementById(oidTbId); + if (oidTb == null) { + log('couldn\'t find openid input box with id = ' + oidTbId); + for (i = 0; !oidTb && i < document.forms.length; i++) { + oidTb = document.forms[i].openid_identifier;} + for (i = 0; !oidTb && i < document.forms.length; i++) { + oidTb = document.forms[i].openid_url;} + } + + if (oidTb == null) {log('couldn\'t find openid input box'); return;} + var orig = oidTb.value; + + var btnIcn = document.createElement('img'); + s = btnIcn.style; s.width = '16px'; s.height = '16px'; + s.verticalAlign = 'middle'; s.padding = '0px'; s.border = '0px'; + s.margin = '0px'; s.display = 'inline'; + + var btnMkr = document.createElement('div'); + btnMkr.innerHTML = "<button type=\"button\"></button>"; + + var arrow = document.createElement('img'); + arrow.src = "https://www.idselector.com/images/arrow.gif"; + arrow.style.display = 'inline'; + + var btn = btnMkr.firstChild; + btnMkr.removeChild(btn); + btn.id = '__idselector_button'; + btn.style.cursor = "pointer"; + + btn.appendChild(btnIcn); + btn.appendChild(document.createTextNode(" ")); + btn.appendChild(arrow); + + var popup = document.createElement('iframe'); + popup.frameBorder = 0; popup.scrolling = 'no'; + s = popup.style; s.display = 'none'; s.position = 'absolute'; + s.width = '400px'; s.height = '0px'; s.margin = '0px'; s.padding = '0px'; s.zIndex = 10000; + s.border = '0px'; + + var prnt = oidTb.parentNode; + var target = null; + if (window.idselector_target_id) { + target = document.getElementById(window.idselector_target_id); + if (!target) {log("couldn't find element with id " + window.idselector_target_id);} + } + if (target) { + target.insertBefore(btn, target.firstChild); + } else { + prnt.insertBefore(btn, oidTb.nextSibling); + prnt.insertBefore(document.createTextNode(" "), btn); + } + document.body.appendChild(popup); + + var pdoc = popup.contentWindow.document; + pdoc.open(); + pdoc.write('<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\"><html><head><title>ID Selector</title><style type=\"text/css\">html{color:#000;background:#6e91af;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:\'\';}abbr,acronym {border:0;font-variant:normal;}sup {vertical-align:text-top;}sub {vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}body {border:1px solid #6e91af;font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}table {font-size:inherit;font:100%;}pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%;}</style></head><body></body></html>'); + pdoc.close(); + + var pbody = pdoc.body; + + var back = pdoc.createElement('img'); + back.style.verticalAlign = "middle"; back.style.cursor = "pointer"; + back.src = "https://www.idselector.com/images/arrow_white_back.png"; + + var forward = pdoc.createElement('img'); + forward.style.verticalAlign = "middle"; forward.style.cursor = "pointer"; + forward.src = "https://www.idselector.com/images/arrow_white_forward.png"; + + var headRight = pdoc.createElement('div'); + headRight.style[document.all ? 'styleFloat' : 'cssFloat'] = 'right'; + headRight.innerHTML = '<a href="https://www.myopenid.com/signup?affiliate_id=21239" style="color:#fff;" target="_blank">Get an OpenID</a>'; + + var header = pdoc.createElement('div'); + s = header.style; s.fontWeight = "bold"; s.color = "#fff"; + s.padding = "2px 8px 2px 8px"; + + header.appendChild(headRight); + header.appendChild(pdoc.createTextNode("Sign in with OpenID using")); + + var nameLabel = pdoc.createElement('span'); + nameLabel.appendChild(pdoc.createTextNode("xxx:")); + + var nameTb = pdoc.createElement('input'); + nameTb.type = "text"; + nameTb.size = 20; + s = nameTb.style; s.verticalAlign = 'middle'; s.padding = '2px 2px 2px 20px'; + s.backgroundRepeat = 'no-repeat'; s.backgroundPosition = '2px 2px'; + + var footer = pdoc.createElement('div'); + s = footer.style; + s.color = "#fff"; + s.padding = "2px 8px 2px 8px"; + s.textAlign = "right"; + s.position = "relative"; + + footer.appendChild(nameLabel); + footer.appendChild(pdoc.createTextNode(" ")) + footer.appendChild(nameTb); + + function Cell(grid, idx) { + this.grid = grid; + this.idx = idx; + + var td = this.td = pdoc.createElement('td'); + s = td.style; + s.fontWeight = "bold"; + s.padding = "4px"; + s.verticalAlign = "middle"; + s.cursor = "pointer"; + + var _this = this; + td.onmouseover = function () { + _this.onMouseOver(); + } + td.onmouseout = function () { + _this.onMouseOut(); + } + td.onclick = function () { + _this.onClick(); + } + + var provider = providers[idx]; + var icon = pdoc.createElement("img"); + icon.src = provider ? ('https://www.idselector.com/static/opicons/' + provider.icon) : + 'https://www.idselector.com/images/openid.ico'; + icon.style.width = "16px"; + icon.style.height = "16px"; + icon.style.verticalAlign = "middle"; + td.appendChild(icon); + td.appendChild(pdoc.createTextNode(" ")); + td.appendChild(pdoc.createTextNode(provider ? provider.shortname : "Other OpenID")); + + this.selected = false; + } + + _id = Cell.prototype = {}; + _id.onMouseOver = function () { + if (!this.selected) { + this.td.style.backgroundColor = "#eee"; + } + } + _id.onMouseOut = function () { + if (!this.selected) { + this.td.style.backgroundColor = ""; + } + } + _id.onClick = function () { + this.grid.select(this); + provider = providers[this.idx]; + if (this.idx == -1) { + oidTb.value = 'http://'; + oidTb.focus(); + } else { + if (provider["openid2"] && !provider["openid1"]) { + oidTb.focus(); + setTimeout(hidePopup, 1); + } else { + nameTb.focus(); + nameTb.select(); + } + } + } + + _id.setSelected = function (selected) { + this.td.style.backgroundColor = selected ? '#c6d9e8' : ""; + this.selected = selected; + } + + function Grid() { + this.table = pdoc.createElement('table'); + this.table.style.backgroundColor = "#FFF"; + this.table.style.width = "100%"; + this.table.style.border = "1px solid #6e91af"; + this.tbody = pdoc.createElement('tbody'); + this.table.appendChild(this.tbody); + this.maxOffset = (Math.ceil(providers.length/12) - 1) * 12; + this.cells = []; + for (var i = 0; i < providers.length; i++) { + this.cells[i] = new Cell(this, i); + } + + this.rows = [pdoc.createElement('tr'), pdoc.createElement('tr'), + pdoc.createElement('tr'), pdoc.createElement('tr')]; + + this.otherCell = new Cell(this, -1); + var links = pdoc.createElement('td'); + links.style.padding = "4px"; + links.style.textAlign = "right"; + links.style.verticalAlign = "middle"; + links.colSpan = 2; + links.innerHTML = '<a href="http://openid.net/" style="color:#6e91af;" target="_blank">Help</a>'; + + var bottom_row = pdoc.createElement('tr'); + bottom_row.style.borderTop = "1px solid #AAA"; + bottom_row.appendChild(this.otherCell.td); + bottom_row.appendChild(links); + + for (var j = 0; j < 4; j++) {this.tbody.appendChild(this.rows[j]);} + this.tbody.appendChild(bottom_row); + + this.offset = 0; + } + + _id = Grid.prototype = {}; + _id.forward = function() { + this.offset = Math.min(this.offset + 12, this.maxOffset) + this.gen(); + } + _id.back = function() { + this.offset = Math.max(this.offset - 12, 0) + this.gen(); + } + _id.gen = function() { + for (var i = 0; i < 4; i++) { + var row = this.rows[i]; + while (row.firstChild) {row.removeChild(row.firstChild);} + } + for (var i = 0; i < 12; i++) { + var row = this.rows[Math.floor(i/3)]; + var cell = this.cells[this.offset + i]; + if (cell) { + row.appendChild(cell.td); + } else { + row.appendChild(pdoc.createElement('td')); + } + } + forward.style.visibility = (this.offset == this.maxOffset) ? 'hidden' : ''; + back.style.visibility = (this.offset == 0) ? 'hidden' : ''; + popup.style.height = (pbody.offsetHeight + 2) + "px"; + } + + _id.select = function (cell) { + if (this.curr) { + this.curr.setSelected(false); + } + + this.curr = cell; + cell.setSelected(true); + if (cell.idx > -1) { + var provider = providers[cell.idx]; + + if (provider["openid2"] && !provider["openid1"]) { + nameLabel.style.visibility = 'hidden'; + nameTb.style.visibility = 'hidden'; + oidTb.value = provider['website']; + } else { + nameLabel.style.visibility = ''; + nameTb.style.visibility = ''; + + nameLabel.removeChild(nameLabel.firstChild); + var s = pdoc.createTextNode(provider.longname + " " + + provider.usercalled + ":"); + nameLabel.appendChild(s); + nameTb.style.backgroundImage = 'url(https://www.idselector.com/static/opicons/' + provider.icon + ')'; + oidTb.value = provider.url_prefix + "username" + + provider.url_suffix; + nameTb.value = "username"; + } + btnIcn.src = 'https://www.idselector.com/static/opicons/' + provider.icon; + } else { + nameLabel.style.visibility = 'hidden'; + nameTb.style.visibility = 'hidden'; + btnIcn.src = 'https://www.idselector.com/images/openid.ico'; + } + } + + _id.setName = function (name) { + var p = providers[this.curr.idx]; + oidTb.value = p.url_prefix + name + p.url_suffix; + } + + var grid = new Grid(); + grid.gen(); + + pbody.appendChild(header); + pbody.appendChild(grid.table); + pbody.appendChild(footer); + + function showPopup() { + var scrolled = window.ActiveXObject ? (quirksMode ? document.body.scrollLeft : document.documentElement.scrollLeft) : window.pageXOffset; + var viewportWidth = quirksMode ? document.body.clientWidth : document.documentElement.clientWidth; + var xUpper = viewportWidth + scrolled - 401; + var x = oidTb.offsetLeft; + var y = oidTb.offsetTop; + if (oidTb.clientTop) { + y += oidTb.clientTop; + } else if (document.defaultView && + document.defaultView.getComputedStyle) { + var cs = document.defaultView.getComputedStyle(oidTb, ''); + y += parseInt(cs.getPropertyValue('border-top-width')); + y += parseInt(cs.getPropertyValue('border-bottom-width')); + } + + var w = oidTb.offsetParent; + while (w) { + x += w.offsetLeft; + y += w.offsetTop; + if (w.clientLeft) { + x += w.clientLeft; + y += w.clientTop; + } else if (document.defaultView && + document.defaultView.getComputedStyle) { + + var cs = document.defaultView.getComputedStyle(w, ''); + y += parseInt(cs.getPropertyValue('border-top-width')); + x += parseInt(cs.getPropertyValue('border-left-width')); + } + w = w.offsetParent; + } + y = y + oidTb.offsetHeight; + + x = Math.max(Math.min(x, xUpper), 0); + + var s = popup.style; s.left = x + "px"; s.top = y + "px"; + s.display = 'block'; s.height = (pbody.offsetHeight + 2) + "px"; + var html = document.body.parentNode; + } + + function hidePopup() { + popup.style.display = 'none'; + } + + function cursorEnd(tb) { + if (tb.isTextEdit) { + var rng = tb.createTextRange(); + if (rng) { + rng.move("character", tb.value.length); + rng.select(); + } + } + + } + + function oidFocus() { + if (oidTb.value == "Click to Sign In") { + oidTb.value = 'http://'; + } + cursorEnd(oidTb); + showPopup(); + } + + btn.onclick = function(e) { + (popup.style.display == 'none') ? showPopup() : hidePopup(); + if (e) {e.cancelBubble = true;} /* safari */ + return false; + } + + btn.onfocus = function () { + btn.blur(); + } + + forward.onclick = function() { + grid.forward(); + } + + back.onclick = function() { + grid.back(); + } + + oidTb.onkeypress = function(e) { + var key; + if(window.event) { + key = window.event.keyCode; + } else if(e.which) {key = e.which;} + if (key != 13 && key != 9) { + grid.select(grid.otherCell); + } + } + + + nameTb.onkeydown = function(e) { + var key; + if(popup.contentWindow.event) { + key = popup.contentWindow.event.keyCode; + } else if(e.which) {key = e.which;} + if (key == 13 || key == 9) { + setTimeout(function () { + oidTb.onfocus = oidFocus; + oidTb.focus(); + setTimeout(hidePopup, 1); + }, 1); + } + } + + nameTb.onkeyup = function() { + var val = this.value; + if (!val) { + val = "username"; + this.value = val; + this.select(); + } + grid.setName(val); + } + + oldOnResize = window.onresize; + window.onresize = function (evt) { + try { + if (popup.style.display == 'block') { + showPopup(); + } + } finally { + oldOnResize && oldOnResize(evt); + } + } + + oldOnScroll = window.onscroll; + window.onscroll = function (evt) { + try { + if (popup.style.display == 'block') { + showPopup(); + } + } finally { + oldOnScroll && oldOnScroll(evt); + } + } + + if (opIdCookie) { + var cell = null; + for (var i = 0; i < providers.length; i++) { + if (providers[i].id == opIdCookie) { + cell = grid.cells[i]; + } + } + + if (cell) { + grid.select(cell); + nameTb.value = unameCookie; + } + } + + if (!grid.curr) { + grid.select(grid.otherCell); + } + if (openidCookie) { + oidTb.value = openidCookie; + } else if (orig.length == 0) { + oidTb.value = "Click to Sign In"; + } + + function createCookie(name,value,days) { + if (days) { + var date = new Date(); + date.setTime(date.getTime()+(days*24*60*60*1000)); + var expires = "; expires="+date.toGMTString(); + } + else var expires = ""; + document.cookie = name+"="+encodeURIComponent(value)+expires+"; path=/"; + } + + oidTb.onfocus = oidFocus; + + + var form = null; + prnt = oidTb.parentNode; + while (prnt && prnt.nodeType == 1) { + if (prnt.nodeName == 'FORM') { + form = prnt; + break; + } + prnt = prnt.parentNode; + } + if (form) { + var oldOnSubmit = form.onsubmit; + form.onsubmit = function(evt) { + try { + createCookie('__openid_selector_openid', oidTb.value, 365); + if (grid.curr.idx > -1) { + var opId = providers[grid.curr.idx].id; + createCookie('__openid_selector_op_id', opId, 365); + createCookie('__openid_selector_uname', nameTb.value, 365); + } else { + createCookie('__openid_selector_op_id','',-1); + createCookie('__openid_selector_uname','',-1); + } + } finally { + if (oldOnSubmit) { + return oldOnSubmit(evt); + } + } + }; + } + + if (window.ActiveXObject) { + document.body.parentNode.attachEvent('onclick', function() { + if (window.event.srcElement != oidTb && + window.event.srcElement != btn) { + hidePopup(); + } + }); + } else { + document.body.parentNode.addEventListener('click', function(evt) { + if (evt.target != oidTb && evt.target != btn) {hidePopup();} + }, false); + } + } + + var oldOnLoad = window.onload; + window.onload = function(evt) { + try { + gen_selector(); + } finally { + return oldOnLoad && oldOnLoad(evt); + } + } +})();
\ No newline at end of file diff --git a/src/main/webapp/javascripts/libs/jquery/jquery.blockUI.js b/src/main/webapp/javascripts/libs/jquery/jquery.blockUI.js new file mode 100644 index 0000000..55b52a9 --- /dev/null +++ b/src/main/webapp/javascripts/libs/jquery/jquery.blockUI.js @@ -0,0 +1,499 @@ +/*! + * jQuery blockUI plugin + * Version 2.39 (23-MAY-2011) + * @requires jQuery v1.2.3 or later + * + * Examples at: http://malsup.com/jquery/block/ + * Copyright (c) 2007-2010 M. Alsup + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + * Thanks to Amir-Hossein Sobhi for some excellent contributions! + */ + +;(function($) { + +if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) { + alert('blockUI requires jQuery v1.2.3 or later! You are using v' + $.fn.jquery); + return; +} + +$.fn._fadeIn = $.fn.fadeIn; + +var noOp = function() {}; + +// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle +// retarded userAgent strings on Vista) +var mode = document.documentMode || 0; +var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8); +var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode; + +// global $ methods for blocking/unblocking the entire page +$.blockUI = function(opts) { install(window, opts); }; +$.unblockUI = function(opts) { remove(window, opts); }; + +// convenience method for quick growl-like notifications (http://www.google.com/search?q=growl) +$.growlUI = function(title, message, timeout, onClose) { + var $m = $('<div class="growlUI"></div>'); + if (title) $m.append('<h1>'+title+'</h1>'); + if (message) $m.append('<h2>'+message+'</h2>'); + if (timeout == undefined) timeout = 3000; + $.blockUI({ + message: $m, fadeIn: 700, fadeOut: 1000, centerY: false, + timeout: timeout, showOverlay: false, + onUnblock: onClose, + css: $.blockUI.defaults.growlCSS + }); +}; + +// plugin method for blocking element content +$.fn.block = function(opts) { + return this.unblock({ fadeOut: 0 }).each(function() { + if ($.css(this,'position') == 'static') + this.style.position = 'relative'; + if ($.browser.msie) + this.style.zoom = 1; // force 'hasLayout' + install(this, opts); + }); +}; + +// plugin method for unblocking element content +$.fn.unblock = function(opts) { + return this.each(function() { + remove(this, opts); + }); +}; + +$.blockUI.version = 2.39; // 2nd generation blocking at no extra cost! + +// override these in your code to change the default behavior and style +$.blockUI.defaults = { + // message displayed when blocking (use null for no message) + message: '<h1>Please wait...</h1>', + + title: null, // title string; only used when theme == true + draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded) + + theme: false, // set to true to use with jQuery UI themes + + // styles for the message when blocking; if you wish to disable + // these and use an external stylesheet then do this in your code: + // $.blockUI.defaults.css = {}; + css: { + padding: 0, + margin: 0, + width: '30%', + top: '40%', + left: '35%', + textAlign: 'center', + color: '#000', + border: '3px solid #aaa', + backgroundColor:'#fff', + cursor: 'wait' + }, + + // minimal style set used when themes are used + themedCSS: { + width: '30%', + top: '40%', + left: '35%' + }, + + // styles for the overlay + overlayCSS: { + backgroundColor: '#000', + opacity: 0.6, + cursor: 'wait' + }, + + // styles applied when using $.growlUI + growlCSS: { + width: '350px', + top: '10px', + left: '', + right: '10px', + border: 'none', + padding: '5px', + opacity: 0.6, + cursor: 'default', + color: '#fff', + backgroundColor: '#000', + '-webkit-border-radius': '10px', + '-moz-border-radius': '10px', + 'border-radius': '10px' + }, + + // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w + // (hat tip to Jorge H. N. de Vasconcelos) + iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank', + + // force usage of iframe in non-IE browsers (handy for blocking applets) + forceIframe: false, + + // z-index for the blocking overlay + baseZ: 1000, + + // set these to true to have the message automatically centered + centerX: true, // <-- only effects element blocking (page block controlled via css above) + centerY: true, + + // allow body element to be stetched in ie6; this makes blocking look better + // on "short" pages. disable if you wish to prevent changes to the body height + allowBodyStretch: true, + + // enable if you want key and mouse events to be disabled for content that is blocked + bindEvents: true, + + // be default blockUI will supress tab navigation from leaving blocking content + // (if bindEvents is true) + constrainTabKey: true, + + // fadeIn time in millis; set to 0 to disable fadeIn on block + fadeIn: 200, + + // fadeOut time in millis; set to 0 to disable fadeOut on unblock + fadeOut: 400, + + // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock + timeout: 0, + + // disable if you don't want to show the overlay + showOverlay: true, + + // if true, focus will be placed in the first available input field when + // page blocking + focusInput: true, + + // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity) + applyPlatformOpacityRules: true, + + // callback method invoked when fadeIn has completed and blocking message is visible + onBlock: null, + + // callback method invoked when unblocking has completed; the callback is + // passed the element that has been unblocked (which is the window object for page + // blocks) and the options that were passed to the unblock call: + // onUnblock(element, options) + onUnblock: null, + + // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493 + quirksmodeOffsetHack: 4, + + // class name of the message block + blockMsgClass: 'blockMsg' +}; + +// private data and functions follow... + +var pageBlock = null; +var pageBlockEls = []; + +function install(el, opts) { + var full = (el == window); + var msg = opts && opts.message !== undefined ? opts.message : undefined; + opts = $.extend({}, $.blockUI.defaults, opts || {}); + opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {}); + var css = $.extend({}, $.blockUI.defaults.css, opts.css || {}); + var themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {}); + msg = msg === undefined ? opts.message : msg; + + // remove the current block (if there is one) + if (full && pageBlock) + remove(window, {fadeOut:0}); + + // if an existing element is being used as the blocking content then we capture + // its current place in the DOM (and current display style) so we can restore + // it when we unblock + if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) { + var node = msg.jquery ? msg[0] : msg; + var data = {}; + $(el).data('blockUI.history', data); + data.el = node; + data.parent = node.parentNode; + data.display = node.style.display; + data.position = node.style.position; + if (data.parent) + data.parent.removeChild(node); + } + + $(el).data('blockUI.onUnblock', opts.onUnblock); + var z = opts.baseZ; + + // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform; + // layer1 is the iframe layer which is used to supress bleed through of underlying content + // layer2 is the overlay layer which has opacity and a wait cursor (by default) + // layer3 is the message content that is displayed while blocking + + var lyr1 = ($.browser.msie || opts.forceIframe) + ? $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>') + : $('<div class="blockUI" style="display:none"></div>'); + + var lyr2 = opts.theme + ? $('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+ (z++) +';display:none"></div>') + : $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>'); + + var lyr3, s; + if (opts.theme && full) { + s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:fixed">' + + '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || ' ')+'</div>' + + '<div class="ui-widget-content ui-dialog-content"></div>' + + '</div>'; + } + else if (opts.theme) { + s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:absolute">' + + '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || ' ')+'</div>' + + '<div class="ui-widget-content ui-dialog-content"></div>' + + '</div>'; + } + else if (full) { + s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage" style="z-index:'+(z+10)+';display:none;position:fixed"></div>'; + } + else { + s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement" style="z-index:'+(z+10)+';display:none;position:absolute"></div>'; + } + lyr3 = $(s); + + // if we have a message, style it + if (msg) { + if (opts.theme) { + lyr3.css(themedCSS); + lyr3.addClass('ui-widget-content'); + } + else + lyr3.css(css); + } + + // style the overlay + if (!opts.theme && (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform)))) + lyr2.css(opts.overlayCSS); + lyr2.css('position', full ? 'fixed' : 'absolute'); + + // make iframe layer transparent in IE + if ($.browser.msie || opts.forceIframe) + lyr1.css('opacity',0.0); + + //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el); + var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el); + $.each(layers, function() { + this.appendTo($par); + }); + + if (opts.theme && opts.draggable && $.fn.draggable) { + lyr3.draggable({ + handle: '.ui-dialog-titlebar', + cancel: 'li' + }); + } + + // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling) + var expr = setExpr && (!$.boxModel || $('object,embed', full ? null : el).length > 0); + if (ie6 || expr) { + // give body 100% height + if (full && opts.allowBodyStretch && $.boxModel) + $('html,body').css('height','100%'); + + // fix ie6 issue when blocked element has a border width + if ((ie6 || !$.boxModel) && !full) { + var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth'); + var fixT = t ? '(0 - '+t+')' : 0; + var fixL = l ? '(0 - '+l+')' : 0; + } + + // simulate fixed position + $.each([lyr1,lyr2,lyr3], function(i,o) { + var s = o[0].style; + s.position = 'absolute'; + if (i < 2) { + full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"') + : s.setExpression('height','this.parentNode.offsetHeight + "px"'); + full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"') + : s.setExpression('width','this.parentNode.offsetWidth + "px"'); + if (fixL) s.setExpression('left', fixL); + if (fixT) s.setExpression('top', fixT); + } + else if (opts.centerY) { + if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'); + s.marginTop = 0; + } + else if (!opts.centerY && full) { + var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0; + var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"'; + s.setExpression('top',expression); + } + }); + } + + // show the message + if (msg) { + if (opts.theme) + lyr3.find('.ui-widget-content').append(msg); + else + lyr3.append(msg); + if (msg.jquery || msg.nodeType) + $(msg).show(); + } + + if (($.browser.msie || opts.forceIframe) && opts.showOverlay) + lyr1.show(); // opacity is zero + if (opts.fadeIn) { + var cb = opts.onBlock ? opts.onBlock : noOp; + var cb1 = (opts.showOverlay && !msg) ? cb : noOp; + var cb2 = msg ? cb : noOp; + if (opts.showOverlay) + lyr2._fadeIn(opts.fadeIn, cb1); + if (msg) + lyr3._fadeIn(opts.fadeIn, cb2); + } + else { + if (opts.showOverlay) + lyr2.show(); + if (msg) + lyr3.show(); + if (opts.onBlock) + opts.onBlock(); + } + + // bind key and mouse events + bind(1, el, opts); + + if (full) { + pageBlock = lyr3[0]; + pageBlockEls = $(':input:enabled:visible',pageBlock); + if (opts.focusInput) + setTimeout(focus, 20); + } + else + center(lyr3[0], opts.centerX, opts.centerY); + + if (opts.timeout) { + // auto-unblock + var to = setTimeout(function() { + full ? $.unblockUI(opts) : $(el).unblock(opts); + }, opts.timeout); + $(el).data('blockUI.timeout', to); + } +}; + +// remove the block +function remove(el, opts) { + var full = (el == window); + var $el = $(el); + var data = $el.data('blockUI.history'); + var to = $el.data('blockUI.timeout'); + if (to) { + clearTimeout(to); + $el.removeData('blockUI.timeout'); + } + opts = $.extend({}, $.blockUI.defaults, opts || {}); + bind(0, el, opts); // unbind events + + if (opts.onUnblock === null) { + opts.onUnblock = $el.data('blockUI.onUnblock'); + $el.removeData('blockUI.onUnblock'); + } + + var els; + if (full) // crazy selector to handle odd field errors in ie6/7 + els = $('body').children().filter('.blockUI').add('body > .blockUI'); + else + els = $('.blockUI', el); + + if (full) + pageBlock = pageBlockEls = null; + + if (opts.fadeOut) { + els.fadeOut(opts.fadeOut); + setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut); + } + else + reset(els, data, opts, el); +}; + +// move blocking element back into the DOM where it started +function reset(els,data,opts,el) { + els.each(function(i,o) { + // remove via DOM calls so we don't lose event handlers + if (this.parentNode) + this.parentNode.removeChild(this); + }); + + if (data && data.el) { + data.el.style.display = data.display; + data.el.style.position = data.position; + if (data.parent) + data.parent.appendChild(data.el); + $(el).removeData('blockUI.history'); + } + + if (typeof opts.onUnblock == 'function') + opts.onUnblock(el,opts); +}; + +// bind/unbind the handler +function bind(b, el, opts) { + var full = el == window, $el = $(el); + + // don't bother unbinding if there is nothing to unbind + if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked'))) + return; + if (!full) + $el.data('blockUI.isBlocked', b); + + // don't bind events when overlay is not in use or if bindEvents is false + if (!opts.bindEvents || (b && !opts.showOverlay)) + return; + + // bind anchors and inputs for mouse and key events + var events = 'mousedown mouseup keydown keypress'; + b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler); + +// former impl... +// var $e = $('a,:input'); +// b ? $e.bind(events, opts, handler) : $e.unbind(events, handler); +}; + +// event handler to suppress keyboard/mouse events when blocking +function handler(e) { + // allow tab navigation (conditionally) + if (e.keyCode && e.keyCode == 9) { + if (pageBlock && e.data.constrainTabKey) { + var els = pageBlockEls; + var fwd = !e.shiftKey && e.target === els[els.length-1]; + var back = e.shiftKey && e.target === els[0]; + if (fwd || back) { + setTimeout(function(){focus(back)},10); + return false; + } + } + } + var opts = e.data; + // allow events within the message content + if ($(e.target).parents('div.' + opts.blockMsgClass).length > 0) + return true; + + // allow events for content that is not being blocked + return $(e.target).parents().children().filter('div.blockUI').length == 0; +}; + +function focus(back) { + if (!pageBlockEls) + return; + var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0]; + if (e) + e.focus(); +}; + +function center(el, x, y) { + var p = el.parentNode, s = el.style; + var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth'); + var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth'); + if (x) s.left = l > 0 ? (l+'px') : '0'; + if (y) s.top = t > 0 ? (t+'px') : '0'; +}; + +function sz(el, p) { + return parseInt($.css(el,p))||0; +}; + +})(jQuery); diff --git a/src/main/webapp/javascripts/libs/jquery/jquery.cookie.js b/src/main/webapp/javascripts/libs/jquery/jquery.cookie.js new file mode 100644 index 0000000..6d5974a --- /dev/null +++ b/src/main/webapp/javascripts/libs/jquery/jquery.cookie.js @@ -0,0 +1,47 @@ +/*! + * jQuery Cookie Plugin + * https://github.com/carhartl/jquery-cookie + * + * Copyright 2011, Klaus Hartl + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://www.opensource.org/licenses/mit-license.php + * http://www.opensource.org/licenses/GPL-2.0 + */ +(function($) { + $.cookie = function(key, value, options) { + + // key and at least value given, set cookie... + if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(value)) || value === null || value === undefined)) { + options = $.extend({}, options); + + if (value === null || value === undefined) { + options.expires = -1; + } + + if (typeof options.expires === 'number') { + var days = options.expires, t = options.expires = new Date(); + t.setDate(t.getDate() + days); + } + + value = String(value); + + return (document.cookie = [ + encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value), + options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE + options.path ? '; path=' + options.path : '', + options.domain ? '; domain=' + options.domain : '', + options.secure ? '; secure' : '' + ].join('')); + } + + // key and possibly options given, get cookie... + options = value || {}; + var decode = options.raw ? function(s) { return s; } : decodeURIComponent; + + var pairs = document.cookie.split('; '); + for (var i = 0, pair; pair = pairs[i] && pairs[i].split('='); i++) { + if (decode(pair[0]) === key) return decode(pair[1] || ''); // IE saves cookies with empty string as "c; ", e.g. without "=" as opposed to EOMB, thus pair[1] may be undefined + } + return null; + }; +})(jQuery); diff --git a/src/main/webapp/javascripts/libs/jquery/jquery.js b/src/main/webapp/javascripts/libs/jquery/jquery.js new file mode 100644 index 0000000..3774ff9 --- /dev/null +++ b/src/main/webapp/javascripts/libs/jquery/jquery.js @@ -0,0 +1,9404 @@ +/*! + * jQuery JavaScript Library v1.7.2 + * http://jquery.com/ + * + * Copyright 2011, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Wed Mar 21 12:46:34 2012 -0700 + */ +(function( window, undefined ) { + +// Use the correct document accordingly with window argument (sandbox) +var document = window.document, + navigator = window.navigator, + location = window.location; +var jQuery = (function() { + +// Define a local copy of jQuery +var jQuery = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + return new jQuery.fn.init( selector, context, rootjQuery ); + }, + + // Map over jQuery in case of overwrite + _jQuery = window.jQuery, + + // Map over the $ in case of overwrite + _$ = window.$, + + // A central reference to the root jQuery(document) + rootjQuery, + + // A simple way to check for HTML strings or ID strings + // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) + quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, + + // Check if a string has a non-whitespace character in it + rnotwhite = /\S/, + + // Used for trimming whitespace + trimLeft = /^\s+/, + trimRight = /\s+$/, + + // Match a standalone tag + rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, + + // JSON RegExp + rvalidchars = /^[\],:{}\s]*$/, + rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, + rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, + rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, + + // Useragent RegExp + rwebkit = /(webkit)[ \/]([\w.]+)/, + ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, + rmsie = /(msie) ([\w.]+)/, + rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, + + // Matches dashed string for camelizing + rdashAlpha = /-([a-z]|[0-9])/ig, + rmsPrefix = /^-ms-/, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return ( letter + "" ).toUpperCase(); + }, + + // Keep a UserAgent string for use with jQuery.browser + userAgent = navigator.userAgent, + + // For matching the engine and version of the browser + browserMatch, + + // The deferred used on DOM ready + readyList, + + // The ready event handler + DOMContentLoaded, + + // Save a reference to some core methods + toString = Object.prototype.toString, + hasOwn = Object.prototype.hasOwnProperty, + push = Array.prototype.push, + slice = Array.prototype.slice, + trim = String.prototype.trim, + indexOf = Array.prototype.indexOf, + + // [[Class]] -> type pairs + class2type = {}; + +jQuery.fn = jQuery.prototype = { + constructor: jQuery, + init: function( selector, context, rootjQuery ) { + var match, elem, ret, doc; + + // Handle $(""), $(null), or $(undefined) + if ( !selector ) { + return this; + } + + // Handle $(DOMElement) + if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + } + + // The body element only exists once, optimize finding it + if ( selector === "body" && !context && document.body ) { + this.context = document; + this[0] = document.body; + this.selector = selector; + this.length = 1; + return this; + } + + // Handle HTML strings + if ( typeof selector === "string" ) { + // Are we dealing with HTML string or an ID? + if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = quickExpr.exec( selector ); + } + + // Verify a match, and that no context was specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) { + context = context instanceof jQuery ? context[0] : context; + doc = ( context ? context.ownerDocument || context : document ); + + // If a single string is passed in and it's a single tag + // just do a createElement and skip the rest + ret = rsingleTag.exec( selector ); + + if ( ret ) { + if ( jQuery.isPlainObject( context ) ) { + selector = [ document.createElement( ret[1] ) ]; + jQuery.fn.attr.call( selector, context, true ); + + } else { + selector = [ doc.createElement( ret[1] ) ]; + } + + } else { + ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); + selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes; + } + + return jQuery.merge( this, selector ); + + // HANDLE: $("#id") + } else { + elem = document.getElementById( match[2] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id !== match[2] ) { + return rootjQuery.find( selector ); + } + + // Otherwise, we inject the element directly into the jQuery object + this.length = 1; + this[0] = elem; + } + + this.context = document; + this.selector = selector; + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || rootjQuery ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return rootjQuery.ready( selector ); + } + + if ( selector.selector !== undefined ) { + this.selector = selector.selector; + this.context = selector.context; + } + + return jQuery.makeArray( selector, this ); + }, + + // Start with an empty selector + selector: "", + + // The current version of jQuery being used + jquery: "1.7.2", + + // The default length of a jQuery object is 0 + length: 0, + + // The number of elements contained in the matched element set + size: function() { + return this.length; + }, + + toArray: function() { + return slice.call( this, 0 ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num == null ? + + // Return a 'clean' array + this.toArray() : + + // Return just the object + ( num < 0 ? this[ this.length + num ] : this[ num ] ); + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems, name, selector ) { + // Build a new jQuery matched element set + var ret = this.constructor(); + + if ( jQuery.isArray( elems ) ) { + push.apply( ret, elems ); + + } else { + jQuery.merge( ret, elems ); + } + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + ret.context = this.context; + + if ( name === "find" ) { + ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; + } else if ( name ) { + ret.selector = this.selector + "." + name + "(" + selector + ")"; + } + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, + + ready: function( fn ) { + // Attach the listeners + jQuery.bindReady(); + + // Add the callback + readyList.add( fn ); + + return this; + }, + + eq: function( i ) { + i = +i; + return i === -1 ? + this.slice( i ) : + this.slice( i, i + 1 ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + slice: function() { + return this.pushStack( slice.apply( this, arguments ), + "slice", slice.call(arguments).join(",") ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map(this, function( elem, i ) { + return callback.call( elem, i, elem ); + })); + }, + + end: function() { + return this.prevObject || this.constructor(null); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: push, + sort: [].sort, + splice: [].splice +}; + +// Give the init function the jQuery prototype for later instantiation +jQuery.fn.init.prototype = jQuery.fn; + +jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[0] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction(target) ) { + target = {}; + } + + // extend jQuery itself if only one argument is passed + if ( length === i ) { + target = this; + --i; + } + + for ( ; i < length; i++ ) { + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) { + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray(src) ? src : []; + + } else { + clone = src && jQuery.isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend({ + noConflict: function( deep ) { + if ( window.$ === jQuery ) { + window.$ = _$; + } + + if ( deep && window.jQuery === jQuery ) { + window.jQuery = _jQuery; + } + + return jQuery; + }, + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + + // Handle when the DOM is ready + ready: function( wait ) { + // Either a released hold or an DOMready/load event and not yet ready + if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( !document.body ) { + return setTimeout( jQuery.ready, 1 ); + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.fireWith( document, [ jQuery ] ); + + // Trigger any bound ready events + if ( jQuery.fn.trigger ) { + jQuery( document ).trigger( "ready" ).off( "ready" ); + } + } + }, + + bindReady: function() { + if ( readyList ) { + return; + } + + readyList = jQuery.Callbacks( "once memory" ); + + // Catch cases where $(document).ready() is called after the + // browser event has already occurred. + if ( document.readyState === "complete" ) { + // Handle it asynchronously to allow scripts the opportunity to delay ready + return setTimeout( jQuery.ready, 1 ); + } + + // Mozilla, Opera and webkit nightlies currently support this event + if ( document.addEventListener ) { + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", jQuery.ready, false ); + + // If IE event model is used + } else if ( document.attachEvent ) { + // ensure firing before onload, + // maybe late but safe also for iframes + document.attachEvent( "onreadystatechange", DOMContentLoaded ); + + // A fallback to window.onload, that will always work + window.attachEvent( "onload", jQuery.ready ); + + // If IE and not a frame + // continually check to see if the document is ready + var toplevel = false; + + try { + toplevel = window.frameElement == null; + } catch(e) {} + + if ( document.documentElement.doScroll && toplevel ) { + doScrollCheck(); + } + } + }, + + // See test/unit/core.js for details concerning isFunction. + // Since version 1.3, DOM methods and functions like alert + // aren't supported. They return false on IE (#2968). + isFunction: function( obj ) { + return jQuery.type(obj) === "function"; + }, + + isArray: Array.isArray || function( obj ) { + return jQuery.type(obj) === "array"; + }, + + isWindow: function( obj ) { + return obj != null && obj == obj.window; + }, + + isNumeric: function( obj ) { + return !isNaN( parseFloat(obj) ) && isFinite( obj ); + }, + + type: function( obj ) { + return obj == null ? + String( obj ) : + class2type[ toString.call(obj) ] || "object"; + }, + + isPlainObject: function( obj ) { + // Must be an Object. + // Because of IE, we also have to check the presence of the constructor property. + // Make sure that DOM nodes and window objects don't pass through, as well + if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { + return false; + } + + try { + // Not own constructor property must be Object + if ( obj.constructor && + !hasOwn.call(obj, "constructor") && + !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { + return false; + } + } catch ( e ) { + // IE8,9 Will throw exceptions on certain host objects #9897 + return false; + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + + var key; + for ( key in obj ) {} + + return key === undefined || hasOwn.call( obj, key ); + }, + + isEmptyObject: function( obj ) { + for ( var name in obj ) { + return false; + } + return true; + }, + + error: function( msg ) { + throw new Error( msg ); + }, + + parseJSON: function( data ) { + if ( typeof data !== "string" || !data ) { + return null; + } + + // Make sure leading/trailing whitespace is removed (IE can't handle it) + data = jQuery.trim( data ); + + // Attempt to parse using the native JSON parser first + if ( window.JSON && window.JSON.parse ) { + return window.JSON.parse( data ); + } + + // Make sure the incoming data is actual JSON + // Logic borrowed from http://json.org/json2.js + if ( rvalidchars.test( data.replace( rvalidescape, "@" ) + .replace( rvalidtokens, "]" ) + .replace( rvalidbraces, "")) ) { + + return ( new Function( "return " + data ) )(); + + } + jQuery.error( "Invalid JSON: " + data ); + }, + + // Cross-browser xml parsing + parseXML: function( data ) { + if ( typeof data !== "string" || !data ) { + return null; + } + var xml, tmp; + try { + if ( window.DOMParser ) { // Standard + tmp = new DOMParser(); + xml = tmp.parseFromString( data , "text/xml" ); + } else { // IE + xml = new ActiveXObject( "Microsoft.XMLDOM" ); + xml.async = "false"; + xml.loadXML( data ); + } + } catch( e ) { + xml = undefined; + } + if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { + jQuery.error( "Invalid XML: " + data ); + } + return xml; + }, + + noop: function() {}, + + // Evaluates a script in a global context + // Workarounds based on findings by Jim Driscoll + // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context + globalEval: function( data ) { + if ( data && rnotwhite.test( data ) ) { + // We use execScript on Internet Explorer + // We use an anonymous function so that context is window + // rather than jQuery in Firefox + ( window.execScript || function( data ) { + window[ "eval" ].call( window, data ); + } )( data ); + } + }, + + // Convert dashed to camelCase; used by the css and data modules + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); + }, + + // args is for internal usage only + each: function( object, callback, args ) { + var name, i = 0, + length = object.length, + isObj = length === undefined || jQuery.isFunction( object ); + + if ( args ) { + if ( isObj ) { + for ( name in object ) { + if ( callback.apply( object[ name ], args ) === false ) { + break; + } + } + } else { + for ( ; i < length; ) { + if ( callback.apply( object[ i++ ], args ) === false ) { + break; + } + } + } + + // A special, fast, case for the most common use of each + } else { + if ( isObj ) { + for ( name in object ) { + if ( callback.call( object[ name ], name, object[ name ] ) === false ) { + break; + } + } + } else { + for ( ; i < length; ) { + if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { + break; + } + } + } + } + + return object; + }, + + // Use native String.trim function wherever possible + trim: trim ? + function( text ) { + return text == null ? + "" : + trim.call( text ); + } : + + // Otherwise use our own trimming functionality + function( text ) { + return text == null ? + "" : + text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); + }, + + // results is for internal usage only + makeArray: function( array, results ) { + var ret = results || []; + + if ( array != null ) { + // The window, strings (and functions) also have 'length' + // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 + var type = jQuery.type( array ); + + if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { + push.call( ret, array ); + } else { + jQuery.merge( ret, array ); + } + } + + return ret; + }, + + inArray: function( elem, array, i ) { + var len; + + if ( array ) { + if ( indexOf ) { + return indexOf.call( array, elem, i ); + } + + len = array.length; + i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; + + for ( ; i < len; i++ ) { + // Skip accessing in sparse arrays + if ( i in array && array[ i ] === elem ) { + return i; + } + } + } + + return -1; + }, + + merge: function( first, second ) { + var i = first.length, + j = 0; + + if ( typeof second.length === "number" ) { + for ( var l = second.length; j < l; j++ ) { + first[ i++ ] = second[ j ]; + } + + } else { + while ( second[j] !== undefined ) { + first[ i++ ] = second[ j++ ]; + } + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, inv ) { + var ret = [], retVal; + inv = !!inv; + + // Go through the array, only saving the items + // that pass the validator function + for ( var i = 0, length = elems.length; i < length; i++ ) { + retVal = !!callback( elems[ i ], i ); + if ( inv !== retVal ) { + ret.push( elems[ i ] ); + } + } + + return ret; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var value, key, ret = [], + i = 0, + length = elems.length, + // jquery objects are treated as arrays + isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; + + // Go through the array, translating each of the items to their + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + + // Go through every key on the object, + } else { + for ( key in elems ) { + value = callback( elems[ key ], key, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + } + + // Flatten any nested arrays + return ret.concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + if ( typeof context === "string" ) { + var tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + var args = slice.call( arguments, 2 ), + proxy = function() { + return fn.apply( context, args.concat( slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; + + return proxy; + }, + + // Mutifunctional method to get and set values to a collection + // The value/s can optionally be executed if it's a function + access: function( elems, fn, key, value, chainable, emptyGet, pass ) { + var exec, + bulk = key == null, + i = 0, + length = elems.length; + + // Sets many values + if ( key && typeof key === "object" ) { + for ( i in key ) { + jQuery.access( elems, fn, i, key[i], 1, emptyGet, value ); + } + chainable = 1; + + // Sets one value + } else if ( value !== undefined ) { + // Optionally, function values get executed if exec is true + exec = pass === undefined && jQuery.isFunction( value ); + + if ( bulk ) { + // Bulk operations only iterate when executing function values + if ( exec ) { + exec = fn; + fn = function( elem, key, value ) { + return exec.call( jQuery( elem ), value ); + }; + + // Otherwise they run against the entire set + } else { + fn.call( elems, value ); + fn = null; + } + } + + if ( fn ) { + for (; i < length; i++ ) { + fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); + } + } + + chainable = 1; + } + + return chainable ? + elems : + + // Gets + bulk ? + fn.call( elems ) : + length ? fn( elems[0], key ) : emptyGet; + }, + + now: function() { + return ( new Date() ).getTime(); + }, + + // Use of jQuery.browser is frowned upon. + // More details: http://docs.jquery.com/Utilities/jQuery.browser + uaMatch: function( ua ) { + ua = ua.toLowerCase(); + + var match = rwebkit.exec( ua ) || + ropera.exec( ua ) || + rmsie.exec( ua ) || + ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || + []; + + return { browser: match[1] || "", version: match[2] || "0" }; + }, + + sub: function() { + function jQuerySub( selector, context ) { + return new jQuerySub.fn.init( selector, context ); + } + jQuery.extend( true, jQuerySub, this ); + jQuerySub.superclass = this; + jQuerySub.fn = jQuerySub.prototype = this(); + jQuerySub.fn.constructor = jQuerySub; + jQuerySub.sub = this.sub; + jQuerySub.fn.init = function init( selector, context ) { + if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { + context = jQuerySub( context ); + } + + return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); + }; + jQuerySub.fn.init.prototype = jQuerySub.fn; + var rootjQuerySub = jQuerySub(document); + return jQuerySub; + }, + + browser: {} +}); + +// Populate the class2type map +jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +}); + +browserMatch = jQuery.uaMatch( userAgent ); +if ( browserMatch.browser ) { + jQuery.browser[ browserMatch.browser ] = true; + jQuery.browser.version = browserMatch.version; +} + +// Deprecated, use jQuery.browser.webkit instead +if ( jQuery.browser.webkit ) { + jQuery.browser.safari = true; +} + +// IE doesn't match non-breaking spaces with \s +if ( rnotwhite.test( "\xA0" ) ) { + trimLeft = /^[\s\xA0]+/; + trimRight = /[\s\xA0]+$/; +} + +// All jQuery objects should point back to these +rootjQuery = jQuery(document); + +// Cleanup functions for the document ready method +if ( document.addEventListener ) { + DOMContentLoaded = function() { + document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + jQuery.ready(); + }; + +} else if ( document.attachEvent ) { + DOMContentLoaded = function() { + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( document.readyState === "complete" ) { + document.detachEvent( "onreadystatechange", DOMContentLoaded ); + jQuery.ready(); + } + }; +} + +// The DOM ready check for Internet Explorer +function doScrollCheck() { + if ( jQuery.isReady ) { + return; + } + + try { + // If IE is used, use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + document.documentElement.doScroll("left"); + } catch(e) { + setTimeout( doScrollCheck, 1 ); + return; + } + + // and execute any waiting functions + jQuery.ready(); +} + +return jQuery; + +})(); + + +// String to Object flags format cache +var flagsCache = {}; + +// Convert String-formatted flags into Object-formatted ones and store in cache +function createFlags( flags ) { + var object = flagsCache[ flags ] = {}, + i, length; + flags = flags.split( /\s+/ ); + for ( i = 0, length = flags.length; i < length; i++ ) { + object[ flags[i] ] = true; + } + return object; +} + +/* + * Create a callback list using the following parameters: + * + * flags: an optional list of space-separated flags that will change how + * the callback list behaves + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible flags: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( flags ) { + + // Convert flags from String-formatted to Object-formatted + // (we check in cache first) + flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; + + var // Actual callback list + list = [], + // Stack of fire calls for repeatable lists + stack = [], + // Last fire value (for non-forgettable lists) + memory, + // Flag to know if list was already fired + fired, + // Flag to know if list is currently firing + firing, + // First callback to fire (used internally by add and fireWith) + firingStart, + // End of the loop when firing + firingLength, + // Index of currently firing callback (modified by remove if needed) + firingIndex, + // Add one or several callbacks to the list + add = function( args ) { + var i, + length, + elem, + type, + actual; + for ( i = 0, length = args.length; i < length; i++ ) { + elem = args[ i ]; + type = jQuery.type( elem ); + if ( type === "array" ) { + // Inspect recursively + add( elem ); + } else if ( type === "function" ) { + // Add if not in unique mode and callback is not in + if ( !flags.unique || !self.has( elem ) ) { + list.push( elem ); + } + } + } + }, + // Fire callbacks + fire = function( context, args ) { + args = args || []; + memory = !flags.memory || [ context, args ]; + fired = true; + firing = true; + firingIndex = firingStart || 0; + firingStart = 0; + firingLength = list.length; + for ( ; list && firingIndex < firingLength; firingIndex++ ) { + if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { + memory = true; // Mark as halted + break; + } + } + firing = false; + if ( list ) { + if ( !flags.once ) { + if ( stack && stack.length ) { + memory = stack.shift(); + self.fireWith( memory[ 0 ], memory[ 1 ] ); + } + } else if ( memory === true ) { + self.disable(); + } else { + list = []; + } + } + }, + // Actual Callbacks object + self = { + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + var length = list.length; + add( arguments ); + // Do we need to add the callbacks to the + // current firing batch? + if ( firing ) { + firingLength = list.length; + // With memory, if we're not firing then + // we should call right away, unless previous + // firing was halted (stopOnFalse) + } else if ( memory && memory !== true ) { + firingStart = length; + fire( memory[ 0 ], memory[ 1 ] ); + } + } + return this; + }, + // Remove a callback from the list + remove: function() { + if ( list ) { + var args = arguments, + argIndex = 0, + argLength = args.length; + for ( ; argIndex < argLength ; argIndex++ ) { + for ( var i = 0; i < list.length; i++ ) { + if ( args[ argIndex ] === list[ i ] ) { + // Handle firingIndex and firingLength + if ( firing ) { + if ( i <= firingLength ) { + firingLength--; + if ( i <= firingIndex ) { + firingIndex--; + } + } + } + // Remove the element + list.splice( i--, 1 ); + // If we have some unicity property then + // we only need to do this once + if ( flags.unique ) { + break; + } + } + } + } + } + return this; + }, + // Control if a given callback is in the list + has: function( fn ) { + if ( list ) { + var i = 0, + length = list.length; + for ( ; i < length; i++ ) { + if ( fn === list[ i ] ) { + return true; + } + } + } + return false; + }, + // Remove all callbacks from the list + empty: function() { + list = []; + return this; + }, + // Have the list do nothing anymore + disable: function() { + list = stack = memory = undefined; + return this; + }, + // Is it disabled? + disabled: function() { + return !list; + }, + // Lock the list in its current state + lock: function() { + stack = undefined; + if ( !memory || memory === true ) { + self.disable(); + } + return this; + }, + // Is it locked? + locked: function() { + return !stack; + }, + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + if ( stack ) { + if ( firing ) { + if ( !flags.once ) { + stack.push( [ context, args ] ); + } + } else if ( !( flags.once && memory ) ) { + fire( context, args ); + } + } + return this; + }, + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + // To know if the callbacks have already been called at least once + fired: function() { + return !!fired; + } + }; + + return self; +}; + + + + +var // Static reference to slice + sliceDeferred = [].slice; + +jQuery.extend({ + + Deferred: function( func ) { + var doneList = jQuery.Callbacks( "once memory" ), + failList = jQuery.Callbacks( "once memory" ), + progressList = jQuery.Callbacks( "memory" ), + state = "pending", + lists = { + resolve: doneList, + reject: failList, + notify: progressList + }, + promise = { + done: doneList.add, + fail: failList.add, + progress: progressList.add, + + state: function() { + return state; + }, + + // Deprecated + isResolved: doneList.fired, + isRejected: failList.fired, + + then: function( doneCallbacks, failCallbacks, progressCallbacks ) { + deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); + return this; + }, + always: function() { + deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); + return this; + }, + pipe: function( fnDone, fnFail, fnProgress ) { + return jQuery.Deferred(function( newDefer ) { + jQuery.each( { + done: [ fnDone, "resolve" ], + fail: [ fnFail, "reject" ], + progress: [ fnProgress, "notify" ] + }, function( handler, data ) { + var fn = data[ 0 ], + action = data[ 1 ], + returned; + if ( jQuery.isFunction( fn ) ) { + deferred[ handler ](function() { + returned = fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify ); + } else { + newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); + } + }); + } else { + deferred[ handler ]( newDefer[ action ] ); + } + }); + }).promise(); + }, + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + if ( obj == null ) { + obj = promise; + } else { + for ( var key in promise ) { + obj[ key ] = promise[ key ]; + } + } + return obj; + } + }, + deferred = promise.promise({}), + key; + + for ( key in lists ) { + deferred[ key ] = lists[ key ].fire; + deferred[ key + "With" ] = lists[ key ].fireWith; + } + + // Handle state + deferred.done( function() { + state = "resolved"; + }, failList.disable, progressList.lock ).fail( function() { + state = "rejected"; + }, doneList.disable, progressList.lock ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( firstParam ) { + var args = sliceDeferred.call( arguments, 0 ), + i = 0, + length = args.length, + pValues = new Array( length ), + count = length, + pCount = length, + deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? + firstParam : + jQuery.Deferred(), + promise = deferred.promise(); + function resolveFunc( i ) { + return function( value ) { + args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; + if ( !( --count ) ) { + deferred.resolveWith( deferred, args ); + } + }; + } + function progressFunc( i ) { + return function( value ) { + pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; + deferred.notifyWith( promise, pValues ); + }; + } + if ( length > 1 ) { + for ( ; i < length; i++ ) { + if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { + args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); + } else { + --count; + } + } + if ( !count ) { + deferred.resolveWith( deferred, args ); + } + } else if ( deferred !== firstParam ) { + deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); + } + return promise; + } +}); + + + + +jQuery.support = (function() { + + var support, + all, + a, + select, + opt, + input, + fragment, + tds, + events, + eventName, + i, + isSupported, + div = document.createElement( "div" ), + documentElement = document.documentElement; + + // Preliminary tests + div.setAttribute("className", "t"); + div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; + + all = div.getElementsByTagName( "*" ); + a = div.getElementsByTagName( "a" )[ 0 ]; + + // Can't get basic test support + if ( !all || !all.length || !a ) { + return {}; + } + + // First batch of supports tests + select = document.createElement( "select" ); + opt = select.appendChild( document.createElement("option") ); + input = div.getElementsByTagName( "input" )[ 0 ]; + + support = { + // IE strips leading whitespace when .innerHTML is used + leadingWhitespace: ( div.firstChild.nodeType === 3 ), + + // Make sure that tbody elements aren't automatically inserted + // IE will insert them into empty tables + tbody: !div.getElementsByTagName("tbody").length, + + // Make sure that link elements get serialized correctly by innerHTML + // This requires a wrapper element in IE + htmlSerialize: !!div.getElementsByTagName("link").length, + + // Get the style information from getAttribute + // (IE uses .cssText instead) + style: /top/.test( a.getAttribute("style") ), + + // Make sure that URLs aren't manipulated + // (IE normalizes it by default) + hrefNormalized: ( a.getAttribute("href") === "/a" ), + + // Make sure that element opacity exists + // (IE uses filter instead) + // Use a regex to work around a WebKit issue. See #5145 + opacity: /^0.55/.test( a.style.opacity ), + + // Verify style float existence + // (IE uses styleFloat instead of cssFloat) + cssFloat: !!a.style.cssFloat, + + // Make sure that if no value is specified for a checkbox + // that it defaults to "on". + // (WebKit defaults to "" instead) + checkOn: ( input.value === "on" ), + + // Make sure that a selected-by-default option has a working selected property. + // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) + optSelected: opt.selected, + + // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) + getSetAttribute: div.className !== "t", + + // Tests for enctype support on a form(#6743) + enctype: !!document.createElement("form").enctype, + + // Makes sure cloning an html5 element does not cause problems + // Where outerHTML is undefined, this still works + html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>", + + // Will be defined later + submitBubbles: true, + changeBubbles: true, + focusinBubbles: false, + deleteExpando: true, + noCloneEvent: true, + inlineBlockNeedsLayout: false, + shrinkWrapBlocks: false, + reliableMarginRight: true, + pixelMargin: true + }; + + // jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead + jQuery.boxModel = support.boxModel = (document.compatMode === "CSS1Compat"); + + // Make sure checked status is properly cloned + input.checked = true; + support.noCloneChecked = input.cloneNode( true ).checked; + + // Make sure that the options inside disabled selects aren't marked as disabled + // (WebKit marks them as disabled) + select.disabled = true; + support.optDisabled = !opt.disabled; + + // Test to see if it's possible to delete an expando from an element + // Fails in Internet Explorer + try { + delete div.test; + } catch( e ) { + support.deleteExpando = false; + } + + if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { + div.attachEvent( "onclick", function() { + // Cloning a node shouldn't copy over any + // bound event handlers (IE does this) + support.noCloneEvent = false; + }); + div.cloneNode( true ).fireEvent( "onclick" ); + } + + // Check if a radio maintains its value + // after being appended to the DOM + input = document.createElement("input"); + input.value = "t"; + input.setAttribute("type", "radio"); + support.radioValue = input.value === "t"; + + input.setAttribute("checked", "checked"); + + // #11217 - WebKit loses check when the name is after the checked attribute + input.setAttribute( "name", "t" ); + + div.appendChild( input ); + fragment = document.createDocumentFragment(); + fragment.appendChild( div.lastChild ); + + // WebKit doesn't clone checked state correctly in fragments + support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Check if a disconnected checkbox will retain its checked + // value of true after appended to the DOM (IE6/7) + support.appendChecked = input.checked; + + fragment.removeChild( input ); + fragment.appendChild( div ); + + // Technique from Juriy Zaytsev + // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ + // We only care about the case where non-standard event systems + // are used, namely in IE. Short-circuiting here helps us to + // avoid an eval call (in setAttribute) which can cause CSP + // to go haywire. See: https://developer.mozilla.org/en/Security/CSP + if ( div.attachEvent ) { + for ( i in { + submit: 1, + change: 1, + focusin: 1 + }) { + eventName = "on" + i; + isSupported = ( eventName in div ); + if ( !isSupported ) { + div.setAttribute( eventName, "return;" ); + isSupported = ( typeof div[ eventName ] === "function" ); + } + support[ i + "Bubbles" ] = isSupported; + } + } + + fragment.removeChild( div ); + + // Null elements to avoid leaks in IE + fragment = select = opt = div = input = null; + + // Run tests that need a body at doc ready + jQuery(function() { + var container, outer, inner, table, td, offsetSupport, + marginDiv, conMarginTop, style, html, positionTopLeftWidthHeight, + paddingMarginBorderVisibility, paddingMarginBorder, + body = document.getElementsByTagName("body")[0]; + + if ( !body ) { + // Return for frameset docs that don't have a body + return; + } + + conMarginTop = 1; + paddingMarginBorder = "padding:0;margin:0;border:"; + positionTopLeftWidthHeight = "position:absolute;top:0;left:0;width:1px;height:1px;"; + paddingMarginBorderVisibility = paddingMarginBorder + "0;visibility:hidden;"; + style = "style='" + positionTopLeftWidthHeight + paddingMarginBorder + "5px solid #000;"; + html = "<div " + style + "display:block;'><div style='" + paddingMarginBorder + "0;display:block;overflow:hidden;'></div></div>" + + "<table " + style + "' cellpadding='0' cellspacing='0'>" + + "<tr><td></td></tr></table>"; + + container = document.createElement("div"); + container.style.cssText = paddingMarginBorderVisibility + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px"; + body.insertBefore( container, body.firstChild ); + + // Construct the test element + div = document.createElement("div"); + container.appendChild( div ); + + // Check if table cells still have offsetWidth/Height when they are set + // to display:none and there are still other visible table cells in a + // table row; if so, offsetWidth/Height are not reliable for use when + // determining if an element has been hidden directly using + // display:none (it is still safe to use offsets if a parent element is + // hidden; don safety goggles and see bug #4512 for more information). + // (only IE 8 fails this test) + div.innerHTML = "<table><tr><td style='" + paddingMarginBorder + "0;display:none'></td><td>t</td></tr></table>"; + tds = div.getElementsByTagName( "td" ); + isSupported = ( tds[ 0 ].offsetHeight === 0 ); + + tds[ 0 ].style.display = ""; + tds[ 1 ].style.display = "none"; + + // Check if empty table cells still have offsetWidth/Height + // (IE <= 8 fail this test) + support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); + + // Check if div with explicit width and no margin-right incorrectly + // gets computed margin-right based on width of container. For more + // info see bug #3333 + // Fails in WebKit before Feb 2011 nightlies + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + if ( window.getComputedStyle ) { + div.innerHTML = ""; + marginDiv = document.createElement( "div" ); + marginDiv.style.width = "0"; + marginDiv.style.marginRight = "0"; + div.style.width = "2px"; + div.appendChild( marginDiv ); + support.reliableMarginRight = + ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; + } + + if ( typeof div.style.zoom !== "undefined" ) { + // Check if natively block-level elements act like inline-block + // elements when setting their display to 'inline' and giving + // them layout + // (IE < 8 does this) + div.innerHTML = ""; + div.style.width = div.style.padding = "1px"; + div.style.border = 0; + div.style.overflow = "hidden"; + div.style.display = "inline"; + div.style.zoom = 1; + support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); + + // Check if elements with layout shrink-wrap their children + // (IE 6 does this) + div.style.display = "block"; + div.style.overflow = "visible"; + div.innerHTML = "<div style='width:5px;'></div>"; + support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); + } + + div.style.cssText = positionTopLeftWidthHeight + paddingMarginBorderVisibility; + div.innerHTML = html; + + outer = div.firstChild; + inner = outer.firstChild; + td = outer.nextSibling.firstChild.firstChild; + + offsetSupport = { + doesNotAddBorder: ( inner.offsetTop !== 5 ), + doesAddBorderForTableAndCells: ( td.offsetTop === 5 ) + }; + + inner.style.position = "fixed"; + inner.style.top = "20px"; + + // safari subtracts parent border width here which is 5px + offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 ); + inner.style.position = inner.style.top = ""; + + outer.style.overflow = "hidden"; + outer.style.position = "relative"; + + offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 ); + offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop ); + + if ( window.getComputedStyle ) { + div.style.marginTop = "1%"; + support.pixelMargin = ( window.getComputedStyle( div, null ) || { marginTop: 0 } ).marginTop !== "1%"; + } + + if ( typeof container.style.zoom !== "undefined" ) { + container.style.zoom = 1; + } + + body.removeChild( container ); + marginDiv = div = container = null; + + jQuery.extend( support, offsetSupport ); + }); + + return support; +})(); + + + + +var rbrace = /^(?:\{.*\}|\[.*\])$/, + rmultiDash = /([A-Z])/g; + +jQuery.extend({ + cache: {}, + + // Please use with caution + uuid: 0, + + // Unique for each copy of jQuery on the page + // Non-digits removed to match rinlinejQuery + expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), + + // The following elements throw uncatchable exceptions if you + // attempt to add expando properties to them. + noData: { + "embed": true, + // Ban all objects except for Flash (which handle expandos) + "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", + "applet": true + }, + + hasData: function( elem ) { + elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; + return !!elem && !isEmptyDataObject( elem ); + }, + + data: function( elem, name, data, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var privateCache, thisCache, ret, + internalKey = jQuery.expando, + getByName = typeof name === "string", + + // We have to handle DOM nodes and JS objects differently because IE6-7 + // can't GC object references properly across the DOM-JS boundary + isNode = elem.nodeType, + + // Only DOM nodes need the global jQuery cache; JS object data is + // attached directly to the object so GC can occur automatically + cache = isNode ? jQuery.cache : elem, + + // Only defining an ID for JS objects if its cache already exists allows + // the code to shortcut on the same path as a DOM node with no cache + id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey, + isEvents = name === "events"; + + // Avoid doing any more work than we need to when trying to get data on an + // object that has no data at all + if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) { + return; + } + + if ( !id ) { + // Only DOM nodes need a new unique ID for each element since their data + // ends up in the global cache + if ( isNode ) { + elem[ internalKey ] = id = ++jQuery.uuid; + } else { + id = internalKey; + } + } + + if ( !cache[ id ] ) { + cache[ id ] = {}; + + // Avoids exposing jQuery metadata on plain JS objects when the object + // is serialized using JSON.stringify + if ( !isNode ) { + cache[ id ].toJSON = jQuery.noop; + } + } + + // An object can be passed to jQuery.data instead of a key/value pair; this gets + // shallow copied over onto the existing cache + if ( typeof name === "object" || typeof name === "function" ) { + if ( pvt ) { + cache[ id ] = jQuery.extend( cache[ id ], name ); + } else { + cache[ id ].data = jQuery.extend( cache[ id ].data, name ); + } + } + + privateCache = thisCache = cache[ id ]; + + // jQuery data() is stored in a separate object inside the object's internal data + // cache in order to avoid key collisions between internal data and user-defined + // data. + if ( !pvt ) { + if ( !thisCache.data ) { + thisCache.data = {}; + } + + thisCache = thisCache.data; + } + + if ( data !== undefined ) { + thisCache[ jQuery.camelCase( name ) ] = data; + } + + // Users should not attempt to inspect the internal events object using jQuery.data, + // it is undocumented and subject to change. But does anyone listen? No. + if ( isEvents && !thisCache[ name ] ) { + return privateCache.events; + } + + // Check for both converted-to-camel and non-converted data property names + // If a data property was specified + if ( getByName ) { + + // First Try to find as-is property data + ret = thisCache[ name ]; + + // Test for null|undefined property data + if ( ret == null ) { + + // Try to find the camelCased property + ret = thisCache[ jQuery.camelCase( name ) ]; + } + } else { + ret = thisCache; + } + + return ret; + }, + + removeData: function( elem, name, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var thisCache, i, l, + + // Reference to internal data cache key + internalKey = jQuery.expando, + + isNode = elem.nodeType, + + // See jQuery.data for more information + cache = isNode ? jQuery.cache : elem, + + // See jQuery.data for more information + id = isNode ? elem[ internalKey ] : internalKey; + + // If there is already no cache entry for this object, there is no + // purpose in continuing + if ( !cache[ id ] ) { + return; + } + + if ( name ) { + + thisCache = pvt ? cache[ id ] : cache[ id ].data; + + if ( thisCache ) { + + // Support array or space separated string names for data keys + if ( !jQuery.isArray( name ) ) { + + // try the string as a key before any manipulation + if ( name in thisCache ) { + name = [ name ]; + } else { + + // split the camel cased version by spaces unless a key with the spaces exists + name = jQuery.camelCase( name ); + if ( name in thisCache ) { + name = [ name ]; + } else { + name = name.split( " " ); + } + } + } + + for ( i = 0, l = name.length; i < l; i++ ) { + delete thisCache[ name[i] ]; + } + + // If there is no data left in the cache, we want to continue + // and let the cache object itself get destroyed + if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { + return; + } + } + } + + // See jQuery.data for more information + if ( !pvt ) { + delete cache[ id ].data; + + // Don't destroy the parent cache unless the internal data object + // had been the only thing left in it + if ( !isEmptyDataObject(cache[ id ]) ) { + return; + } + } + + // Browsers that fail expando deletion also refuse to delete expandos on + // the window, but it will allow it on all other JS objects; other browsers + // don't care + // Ensure that `cache` is not a window object #10080 + if ( jQuery.support.deleteExpando || !cache.setInterval ) { + delete cache[ id ]; + } else { + cache[ id ] = null; + } + + // We destroyed the cache and need to eliminate the expando on the node to avoid + // false lookups in the cache for entries that no longer exist + if ( isNode ) { + // IE does not allow us to delete expando properties from nodes, + // nor does it have a removeAttribute function on Document nodes; + // we must handle all of these cases + if ( jQuery.support.deleteExpando ) { + delete elem[ internalKey ]; + } else if ( elem.removeAttribute ) { + elem.removeAttribute( internalKey ); + } else { + elem[ internalKey ] = null; + } + } + }, + + // For internal use only. + _data: function( elem, name, data ) { + return jQuery.data( elem, name, data, true ); + }, + + // A method for determining if a DOM node can handle the data expando + acceptData: function( elem ) { + if ( elem.nodeName ) { + var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; + + if ( match ) { + return !(match === true || elem.getAttribute("classid") !== match); + } + } + + return true; + } +}); + +jQuery.fn.extend({ + data: function( key, value ) { + var parts, part, attr, name, l, + elem = this[0], + i = 0, + data = null; + + // Gets all values + if ( key === undefined ) { + if ( this.length ) { + data = jQuery.data( elem ); + + if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { + attr = elem.attributes; + for ( l = attr.length; i < l; i++ ) { + name = attr[i].name; + + if ( name.indexOf( "data-" ) === 0 ) { + name = jQuery.camelCase( name.substring(5) ); + + dataAttr( elem, name, data[ name ] ); + } + } + jQuery._data( elem, "parsedAttrs", true ); + } + } + + return data; + } + + // Sets multiple values + if ( typeof key === "object" ) { + return this.each(function() { + jQuery.data( this, key ); + }); + } + + parts = key.split( ".", 2 ); + parts[1] = parts[1] ? "." + parts[1] : ""; + part = parts[1] + "!"; + + return jQuery.access( this, function( value ) { + + if ( value === undefined ) { + data = this.triggerHandler( "getData" + part, [ parts[0] ] ); + + // Try to fetch any internally stored data first + if ( data === undefined && elem ) { + data = jQuery.data( elem, key ); + data = dataAttr( elem, key, data ); + } + + return data === undefined && parts[1] ? + this.data( parts[0] ) : + data; + } + + parts[1] = value; + this.each(function() { + var self = jQuery( this ); + + self.triggerHandler( "setData" + part, parts ); + jQuery.data( this, key, value ); + self.triggerHandler( "changeData" + part, parts ); + }); + }, null, value, arguments.length > 1, null, false ); + }, + + removeData: function( key ) { + return this.each(function() { + jQuery.removeData( this, key ); + }); + } +}); + +function dataAttr( elem, key, data ) { + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + + var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); + + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = data === "true" ? true : + data === "false" ? false : + data === "null" ? null : + jQuery.isNumeric( data ) ? +data : + rbrace.test( data ) ? jQuery.parseJSON( data ) : + data; + } catch( e ) {} + + // Make sure we set the data so it isn't changed later + jQuery.data( elem, key, data ); + + } else { + data = undefined; + } + } + + return data; +} + +// checks a cache object for emptiness +function isEmptyDataObject( obj ) { + for ( var name in obj ) { + + // if the public data object is empty, the private is still empty + if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { + continue; + } + if ( name !== "toJSON" ) { + return false; + } + } + + return true; +} + + + + +function handleQueueMarkDefer( elem, type, src ) { + var deferDataKey = type + "defer", + queueDataKey = type + "queue", + markDataKey = type + "mark", + defer = jQuery._data( elem, deferDataKey ); + if ( defer && + ( src === "queue" || !jQuery._data(elem, queueDataKey) ) && + ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) { + // Give room for hard-coded callbacks to fire first + // and eventually mark/queue something else on the element + setTimeout( function() { + if ( !jQuery._data( elem, queueDataKey ) && + !jQuery._data( elem, markDataKey ) ) { + jQuery.removeData( elem, deferDataKey, true ); + defer.fire(); + } + }, 0 ); + } +} + +jQuery.extend({ + + _mark: function( elem, type ) { + if ( elem ) { + type = ( type || "fx" ) + "mark"; + jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 ); + } + }, + + _unmark: function( force, elem, type ) { + if ( force !== true ) { + type = elem; + elem = force; + force = false; + } + if ( elem ) { + type = type || "fx"; + var key = type + "mark", + count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 ); + if ( count ) { + jQuery._data( elem, key, count ); + } else { + jQuery.removeData( elem, key, true ); + handleQueueMarkDefer( elem, type, "mark" ); + } + } + }, + + queue: function( elem, type, data ) { + var q; + if ( elem ) { + type = ( type || "fx" ) + "queue"; + q = jQuery._data( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !q || jQuery.isArray(data) ) { + q = jQuery._data( elem, type, jQuery.makeArray(data) ); + } else { + q.push( data ); + } + } + return q || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + fn = queue.shift(), + hooks = {}; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + } + + if ( fn ) { + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } + + jQuery._data( elem, type + ".run", hooks ); + fn.call( elem, function() { + jQuery.dequeue( elem, type ); + }, hooks ); + } + + if ( !queue.length ) { + jQuery.removeData( elem, type + "queue " + type + ".run", true ); + handleQueueMarkDefer( elem, type, "queue" ); + } + } +}); + +jQuery.fn.extend({ + queue: function( type, data ) { + var setter = 2; + + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + setter--; + } + + if ( arguments.length < setter ) { + return jQuery.queue( this[0], type ); + } + + return data === undefined ? + this : + this.each(function() { + var queue = jQuery.queue( this, type, data ); + + if ( type === "fx" && queue[0] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + }); + }, + dequeue: function( type ) { + return this.each(function() { + jQuery.dequeue( this, type ); + }); + }, + // Based off of the plugin by Clint Helfers, with permission. + // http://blindsignals.com/index.php/2009/07/jquery-delay/ + delay: function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; + type = type || "fx"; + + return this.queue( type, function( next, hooks ) { + var timeout = setTimeout( next, time ); + hooks.stop = function() { + clearTimeout( timeout ); + }; + }); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, object ) { + if ( typeof type !== "string" ) { + object = type; + type = undefined; + } + type = type || "fx"; + var defer = jQuery.Deferred(), + elements = this, + i = elements.length, + count = 1, + deferDataKey = type + "defer", + queueDataKey = type + "queue", + markDataKey = type + "mark", + tmp; + function resolve() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + } + while( i-- ) { + if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || + ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || + jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && + jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { + count++; + tmp.add( resolve ); + } + } + resolve(); + return defer.promise( object ); + } +}); + + + + +var rclass = /[\n\t\r]/g, + rspace = /\s+/, + rreturn = /\r/g, + rtype = /^(?:button|input)$/i, + rfocusable = /^(?:button|input|object|select|textarea)$/i, + rclickable = /^a(?:rea)?$/i, + rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, + getSetAttribute = jQuery.support.getSetAttribute, + nodeHook, boolHook, fixSpecified; + +jQuery.fn.extend({ + attr: function( name, value ) { + return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); + }, + + removeAttr: function( name ) { + return this.each(function() { + jQuery.removeAttr( this, name ); + }); + }, + + prop: function( name, value ) { + return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); + }, + + removeProp: function( name ) { + name = jQuery.propFix[ name ] || name; + return this.each(function() { + // try/catch handles cases where IE balks (such as removing a property on window) + try { + this[ name ] = undefined; + delete this[ name ]; + } catch( e ) {} + }); + }, + + addClass: function( value ) { + var classNames, i, l, elem, + setClass, c, cl; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).addClass( value.call(this, j, this.className) ); + }); + } + + if ( value && typeof value === "string" ) { + classNames = value.split( rspace ); + + for ( i = 0, l = this.length; i < l; i++ ) { + elem = this[ i ]; + + if ( elem.nodeType === 1 ) { + if ( !elem.className && classNames.length === 1 ) { + elem.className = value; + + } else { + setClass = " " + elem.className + " "; + + for ( c = 0, cl = classNames.length; c < cl; c++ ) { + if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { + setClass += classNames[ c ] + " "; + } + } + elem.className = jQuery.trim( setClass ); + } + } + } + } + + return this; + }, + + removeClass: function( value ) { + var classNames, i, l, elem, className, c, cl; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).removeClass( value.call(this, j, this.className) ); + }); + } + + if ( (value && typeof value === "string") || value === undefined ) { + classNames = ( value || "" ).split( rspace ); + + for ( i = 0, l = this.length; i < l; i++ ) { + elem = this[ i ]; + + if ( elem.nodeType === 1 && elem.className ) { + if ( value ) { + className = (" " + elem.className + " ").replace( rclass, " " ); + for ( c = 0, cl = classNames.length; c < cl; c++ ) { + className = className.replace(" " + classNames[ c ] + " ", " "); + } + elem.className = jQuery.trim( className ); + + } else { + elem.className = ""; + } + } + } + } + + return this; + }, + + toggleClass: function( value, stateVal ) { + var type = typeof value, + isBool = typeof stateVal === "boolean"; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( i ) { + jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); + }); + } + + return this.each(function() { + if ( type === "string" ) { + // toggle individual class names + var className, + i = 0, + self = jQuery( this ), + state = stateVal, + classNames = value.split( rspace ); + + while ( (className = classNames[ i++ ]) ) { + // check each className given, space seperated list + state = isBool ? state : !self.hasClass( className ); + self[ state ? "addClass" : "removeClass" ]( className ); + } + + } else if ( type === "undefined" || type === "boolean" ) { + if ( this.className ) { + // store className if set + jQuery._data( this, "__className__", this.className ); + } + + // toggle whole className + this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; + } + }); + }, + + hasClass: function( selector ) { + var className = " " + selector + " ", + i = 0, + l = this.length; + for ( ; i < l; i++ ) { + if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { + return true; + } + } + + return false; + }, + + val: function( value ) { + var hooks, ret, isFunction, + elem = this[0]; + + if ( !arguments.length ) { + if ( elem ) { + hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; + + if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { + return ret; + } + + ret = elem.value; + + return typeof ret === "string" ? + // handle most common string cases + ret.replace(rreturn, "") : + // handle cases where value is null/undef or number + ret == null ? "" : ret; + } + + return; + } + + isFunction = jQuery.isFunction( value ); + + return this.each(function( i ) { + var self = jQuery(this), val; + + if ( this.nodeType !== 1 ) { + return; + } + + if ( isFunction ) { + val = value.call( this, i, self.val() ); + } else { + val = value; + } + + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + } else if ( typeof val === "number" ) { + val += ""; + } else if ( jQuery.isArray( val ) ) { + val = jQuery.map(val, function ( value ) { + return value == null ? "" : value + ""; + }); + } + + hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; + + // If set returns undefined, fall back to normal setting + if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { + this.value = val; + } + }); + } +}); + +jQuery.extend({ + valHooks: { + option: { + get: function( elem ) { + // attributes.value is undefined in Blackberry 4.7 but + // uses .value. See #6932 + var val = elem.attributes.value; + return !val || val.specified ? elem.value : elem.text; + } + }, + select: { + get: function( elem ) { + var value, i, max, option, + index = elem.selectedIndex, + values = [], + options = elem.options, + one = elem.type === "select-one"; + + // Nothing was selected + if ( index < 0 ) { + return null; + } + + // Loop through all the selected options + i = one ? index : 0; + max = one ? index + 1 : options.length; + for ( ; i < max; i++ ) { + option = options[ i ]; + + // Don't return options that are disabled or in a disabled optgroup + if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && + (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { + + // Get the specific value for the option + value = jQuery( option ).val(); + + // We don't need an array for one selects + if ( one ) { + return value; + } + + // Multi-Selects return an array + values.push( value ); + } + } + + // Fixes Bug #2551 -- select.val() broken in IE after form.reset() + if ( one && !values.length && options.length ) { + return jQuery( options[ index ] ).val(); + } + + return values; + }, + + set: function( elem, value ) { + var values = jQuery.makeArray( value ); + + jQuery(elem).find("option").each(function() { + this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; + }); + + if ( !values.length ) { + elem.selectedIndex = -1; + } + return values; + } + } + }, + + attrFn: { + val: true, + css: true, + html: true, + text: true, + data: true, + width: true, + height: true, + offset: true + }, + + attr: function( elem, name, value, pass ) { + var ret, hooks, notxml, + nType = elem.nodeType; + + // don't get/set attributes on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + if ( pass && name in jQuery.attrFn ) { + return jQuery( elem )[ name ]( value ); + } + + // Fallback to prop when attributes are not supported + if ( typeof elem.getAttribute === "undefined" ) { + return jQuery.prop( elem, name, value ); + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + // All attributes are lowercase + // Grab necessary hook if one is defined + if ( notxml ) { + name = name.toLowerCase(); + hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); + } + + if ( value !== undefined ) { + + if ( value === null ) { + jQuery.removeAttr( elem, name ); + return; + + } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + elem.setAttribute( name, "" + value ); + return value; + } + + } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + + ret = elem.getAttribute( name ); + + // Non-existent attributes return null, we normalize to undefined + return ret === null ? + undefined : + ret; + } + }, + + removeAttr: function( elem, value ) { + var propName, attrNames, name, l, isBool, + i = 0; + + if ( value && elem.nodeType === 1 ) { + attrNames = value.toLowerCase().split( rspace ); + l = attrNames.length; + + for ( ; i < l; i++ ) { + name = attrNames[ i ]; + + if ( name ) { + propName = jQuery.propFix[ name ] || name; + isBool = rboolean.test( name ); + + // See #9699 for explanation of this approach (setting first, then removal) + // Do not do this for boolean attributes (see #10870) + if ( !isBool ) { + jQuery.attr( elem, name, "" ); + } + elem.removeAttribute( getSetAttribute ? name : propName ); + + // Set corresponding property to false for boolean attributes + if ( isBool && propName in elem ) { + elem[ propName ] = false; + } + } + } + } + }, + + attrHooks: { + type: { + set: function( elem, value ) { + // We can't allow the type property to be changed (since it causes problems in IE) + if ( rtype.test( elem.nodeName ) && elem.parentNode ) { + jQuery.error( "type property can't be changed" ); + } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { + // Setting the type on a radio button after the value resets the value in IE6-9 + // Reset value to it's default in case type is set after value + // This is for element creation + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } + }, + // Use the value property for back compat + // Use the nodeHook for button elements in IE6/7 (#1954) + value: { + get: function( elem, name ) { + if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { + return nodeHook.get( elem, name ); + } + return name in elem ? + elem.value : + null; + }, + set: function( elem, value, name ) { + if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { + return nodeHook.set( elem, value, name ); + } + // Does not return so that setAttribute is also used + elem.value = value; + } + } + }, + + propFix: { + tabindex: "tabIndex", + readonly: "readOnly", + "for": "htmlFor", + "class": "className", + maxlength: "maxLength", + cellspacing: "cellSpacing", + cellpadding: "cellPadding", + rowspan: "rowSpan", + colspan: "colSpan", + usemap: "useMap", + frameborder: "frameBorder", + contenteditable: "contentEditable" + }, + + prop: function( elem, name, value ) { + var ret, hooks, notxml, + nType = elem.nodeType; + + // don't get/set properties on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + if ( notxml ) { + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; + } + + if ( value !== undefined ) { + if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + return ( elem[ name ] = value ); + } + + } else { + if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + return elem[ name ]; + } + } + }, + + propHooks: { + tabIndex: { + get: function( elem ) { + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + var attributeNode = elem.getAttributeNode("tabindex"); + + return attributeNode && attributeNode.specified ? + parseInt( attributeNode.value, 10 ) : + rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? + 0 : + undefined; + } + } + } +}); + +// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional) +jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex; + +// Hook for boolean attributes +boolHook = { + get: function( elem, name ) { + // Align boolean attributes with corresponding properties + // Fall back to attribute presence where some booleans are not supported + var attrNode, + property = jQuery.prop( elem, name ); + return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? + name.toLowerCase() : + undefined; + }, + set: function( elem, value, name ) { + var propName; + if ( value === false ) { + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else { + // value is true since we know at this point it's type boolean and not false + // Set boolean attributes to the same name and set the DOM property + propName = jQuery.propFix[ name ] || name; + if ( propName in elem ) { + // Only set the IDL specifically if it already exists on the element + elem[ propName ] = true; + } + + elem.setAttribute( name, name.toLowerCase() ); + } + return name; + } +}; + +// IE6/7 do not support getting/setting some attributes with get/setAttribute +if ( !getSetAttribute ) { + + fixSpecified = { + name: true, + id: true, + coords: true + }; + + // Use this for any attribute in IE6/7 + // This fixes almost every IE6/7 issue + nodeHook = jQuery.valHooks.button = { + get: function( elem, name ) { + var ret; + ret = elem.getAttributeNode( name ); + return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ? + ret.nodeValue : + undefined; + }, + set: function( elem, value, name ) { + // Set the existing or create a new attribute node + var ret = elem.getAttributeNode( name ); + if ( !ret ) { + ret = document.createAttribute( name ); + elem.setAttributeNode( ret ); + } + return ( ret.nodeValue = value + "" ); + } + }; + + // Apply the nodeHook to tabindex + jQuery.attrHooks.tabindex.set = nodeHook.set; + + // Set width and height to auto instead of 0 on empty string( Bug #8150 ) + // This is for removals + jQuery.each([ "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + set: function( elem, value ) { + if ( value === "" ) { + elem.setAttribute( name, "auto" ); + return value; + } + } + }); + }); + + // Set contenteditable to false on removals(#10429) + // Setting to empty string throws an error as an invalid value + jQuery.attrHooks.contenteditable = { + get: nodeHook.get, + set: function( elem, value, name ) { + if ( value === "" ) { + value = "false"; + } + nodeHook.set( elem, value, name ); + } + }; +} + + +// Some attributes require a special call on IE +if ( !jQuery.support.hrefNormalized ) { + jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + get: function( elem ) { + var ret = elem.getAttribute( name, 2 ); + return ret === null ? undefined : ret; + } + }); + }); +} + +if ( !jQuery.support.style ) { + jQuery.attrHooks.style = { + get: function( elem ) { + // Return undefined in the case of empty string + // Normalize to lowercase since IE uppercases css property names + return elem.style.cssText.toLowerCase() || undefined; + }, + set: function( elem, value ) { + return ( elem.style.cssText = "" + value ); + } + }; +} + +// Safari mis-reports the default selected property of an option +// Accessing the parent's selectedIndex property fixes it +if ( !jQuery.support.optSelected ) { + jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { + get: function( elem ) { + var parent = elem.parentNode; + + if ( parent ) { + parent.selectedIndex; + + // Make sure that it also works with optgroups, see #5701 + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + return null; + } + }); +} + +// IE6/7 call enctype encoding +if ( !jQuery.support.enctype ) { + jQuery.propFix.enctype = "encoding"; +} + +// Radios and checkboxes getter/setter +if ( !jQuery.support.checkOn ) { + jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + get: function( elem ) { + // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified + return elem.getAttribute("value") === null ? "on" : elem.value; + } + }; + }); +} +jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { + set: function( elem, value ) { + if ( jQuery.isArray( value ) ) { + return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); + } + } + }); +}); + + + + +var rformElems = /^(?:textarea|input|select)$/i, + rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/, + rhoverHack = /(?:^|\s)hover(\.\S+)?\b/, + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|contextmenu)|click/, + rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/, + quickParse = function( selector ) { + var quick = rquickIs.exec( selector ); + if ( quick ) { + // 0 1 2 3 + // [ _, tag, id, class ] + quick[1] = ( quick[1] || "" ).toLowerCase(); + quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" ); + } + return quick; + }, + quickIs = function( elem, m ) { + var attrs = elem.attributes || {}; + return ( + (!m[1] || elem.nodeName.toLowerCase() === m[1]) && + (!m[2] || (attrs.id || {}).value === m[2]) && + (!m[3] || m[3].test( (attrs[ "class" ] || {}).value )) + ); + }, + hoverHack = function( events ) { + return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); + }; + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + add: function( elem, types, handler, data, selector ) { + + var elemData, eventHandle, events, + t, tns, type, namespaces, handleObj, + handleObjIn, quick, handlers, special; + + // Don't attach events to noData or text/comment nodes (allow plain objects tho) + if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + events = elemData.events; + if ( !events ) { + elemData.events = events = {}; + } + eventHandle = elemData.handle; + if ( !eventHandle ) { + elemData.handle = eventHandle = function( e ) { + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? + jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : + undefined; + }; + // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events + eventHandle.elem = elem; + } + + // Handle multiple events separated by a space + // jQuery(...).bind("mouseover mouseout", fn); + types = jQuery.trim( hoverHack(types) ).split( " " ); + for ( t = 0; t < types.length; t++ ) { + + tns = rtypenamespace.exec( types[t] ) || []; + type = tns[1]; + namespaces = ( tns[2] || "" ).split( "." ).sort(); + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend({ + type: type, + origType: tns[1], + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + quick: selector && quickParse( selector ), + namespace: namespaces.join(".") + }, handleObjIn ); + + // Init the event handler queue if we're the first + handlers = events[ type ]; + if ( !handlers ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener/attachEvent if the special events handler returns false + if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + // Bind the global event handler to the element + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle, false ); + + } else if ( elem.attachEvent ) { + elem.attachEvent( "on" + type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + // Nullify elem to prevent memory leaks in IE + elem = null; + }, + + global: {}, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + + var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), + t, tns, type, origType, namespaces, origCount, + j, events, special, handle, eventType, handleObj; + + if ( !elemData || !(events = elemData.events) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = jQuery.trim( hoverHack( types || "" ) ).split(" "); + for ( t = 0; t < types.length; t++ ) { + tns = rtypenamespace.exec( types[t] ) || []; + type = origType = tns[1]; + namespaces = tns[2]; + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector? special.delegateType : special.bindType ) || type; + eventType = events[ type ] || []; + origCount = eventType.length; + namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null; + + // Remove matching events + for ( j = 0; j < eventType.length; j++ ) { + handleObj = eventType[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !namespaces || namespaces.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { + eventType.splice( j--, 1 ); + + if ( handleObj.selector ) { + eventType.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( eventType.length === 0 && origCount !== eventType.length ) { + if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + handle = elemData.handle; + if ( handle ) { + handle.elem = null; + } + + // removeData also checks for emptiness and clears the expando if empty + // so use it instead of delete + jQuery.removeData( elem, [ "events", "handle" ], true ); + } + }, + + // Events that are safe to short-circuit if no handlers are attached. + // Native DOM events should not be added, they may have inline handlers. + customEvent: { + "getData": true, + "setData": true, + "changeData": true + }, + + trigger: function( event, data, elem, onlyHandlers ) { + // Don't do events on text and comment nodes + if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { + return; + } + + // Event object or event type + var type = event.type || event, + namespaces = [], + cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf( "!" ) >= 0 ) { + // Exclusive events trigger only for the exact event (no namespaces) + type = type.slice(0, -1); + exclusive = true; + } + + if ( type.indexOf( "." ) >= 0 ) { + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split("."); + type = namespaces.shift(); + namespaces.sort(); + } + + if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { + // No jQuery handlers for this event type, and it can't have inline handlers + return; + } + + // Caller can pass in an Event, Object, or just an event type string + event = typeof event === "object" ? + // jQuery.Event object + event[ jQuery.expando ] ? event : + // Object literal + new jQuery.Event( type, event ) : + // Just the event type (string) + new jQuery.Event( type ); + + event.type = type; + event.isTrigger = true; + event.exclusive = exclusive; + event.namespace = namespaces.join( "." ); + event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null; + ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; + + // Handle a global trigger + if ( !elem ) { + + // TODO: Stop taunting the data cache; remove global events and always attach to document + cache = jQuery.cache; + for ( i in cache ) { + if ( cache[ i ].events && cache[ i ].events[ type ] ) { + jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); + } + } + return; + } + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data != null ? jQuery.makeArray( data ) : []; + data.unshift( event ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + eventPath = [[ elem, special.bindType || type ]]; + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; + old = null; + for ( ; cur; cur = cur.parentNode ) { + eventPath.push([ cur, bubbleType ]); + old = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( old && old === elem.ownerDocument ) { + eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); + } + } + + // Fire handlers on the event path + for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { + + cur = eventPath[i][0]; + event.type = eventPath[i][1]; + + handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + // Note that this is a bare JS function and not a jQuery handler + handle = ontype && cur[ ontype ]; + if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) { + event.preventDefault(); + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && + !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name name as the event. + // Can't use an .isFunction() check here because IE6/7 fails that test. + // Don't do default actions on window, that's where global variables be (#6170) + // IE<9 dies on focus/blur to hidden element (#1486) + if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + old = elem[ ontype ]; + + if ( old ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + elem[ type ](); + jQuery.event.triggered = undefined; + + if ( old ) { + elem[ ontype ] = old; + } + } + } + } + + return event.result; + }, + + dispatch: function( event ) { + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( event || window.event ); + + var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), + delegateCount = handlers.delegateCount, + args = [].slice.call( arguments, 0 ), + run_all = !event.exclusive && !event.namespace, + special = jQuery.event.special[ event.type ] || {}, + handlerQueue = [], + i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[0] = event; + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers that should run if there are delegated events + // Avoid non-left-click bubbling in Firefox (#3861) + if ( delegateCount && !(event.button && event.type === "click") ) { + + // Pregenerate a single jQuery object for reuse with .is() + jqcur = jQuery(this); + jqcur.context = this.ownerDocument || this; + + for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { + + // Don't process events on disabled elements (#6911, #8165) + if ( cur.disabled !== true ) { + selMatch = {}; + matches = []; + jqcur[0] = cur; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + sel = handleObj.selector; + + if ( selMatch[ sel ] === undefined ) { + selMatch[ sel ] = ( + handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel ) + ); + } + if ( selMatch[ sel ] ) { + matches.push( handleObj ); + } + } + if ( matches.length ) { + handlerQueue.push({ elem: cur, matches: matches }); + } + } + } + } + + // Add the remaining (directly-bound) handlers + if ( handlers.length > delegateCount ) { + handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); + } + + // Run delegates first; they may want to stop propagation beneath us + for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { + matched = handlerQueue[ i ]; + event.currentTarget = matched.elem; + + for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { + handleObj = matched.matches[ j ]; + + // Triggered event must either 1) be non-exclusive and have no namespace, or + // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). + if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { + + event.data = handleObj.data; + event.handleObj = handleObj; + + ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) + .apply( matched.elem, args ); + + if ( ret !== undefined ) { + event.result = ret; + if ( ret === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + // Includes some event props shared by KeyEvent and MouseEvent + // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** + props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), + + fixHooks: {}, + + keyHooks: { + props: "char charCode key keyCode".split(" "), + filter: function( event, original ) { + + // Add which for key events + if ( event.which == null ) { + event.which = original.charCode != null ? original.charCode : original.keyCode; + } + + return event; + } + }, + + mouseHooks: { + props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), + filter: function( event, original ) { + var eventDoc, doc, body, + button = original.button, + fromElement = original.fromElement; + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && original.clientX != null ) { + eventDoc = event.target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + + // Add relatedTarget, if necessary + if ( !event.relatedTarget && fromElement ) { + event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && button !== undefined ) { + event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event; + } + }, + + fix: function( event ) { + if ( event[ jQuery.expando ] ) { + return event; + } + + // Create a writable copy of the event object and normalize some properties + var i, prop, + originalEvent = event, + fixHook = jQuery.event.fixHooks[ event.type ] || {}, + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; + + event = jQuery.Event( originalEvent ); + + for ( i = copy.length; i; ) { + prop = copy[ --i ]; + event[ prop ] = originalEvent[ prop ]; + } + + // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) + if ( !event.target ) { + event.target = originalEvent.srcElement || document; + } + + // Target should not be a text node (#504, Safari) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; + } + + // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) + if ( event.metaKey === undefined ) { + event.metaKey = event.ctrlKey; + } + + return fixHook.filter? fixHook.filter( event, originalEvent ) : event; + }, + + special: { + ready: { + // Make sure the ready event is setup + setup: jQuery.bindReady + }, + + load: { + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + + focus: { + delegateType: "focusin" + }, + blur: { + delegateType: "focusout" + }, + + beforeunload: { + setup: function( data, namespaces, eventHandle ) { + // We only want to do this special case on windows + if ( jQuery.isWindow( this ) ) { + this.onbeforeunload = eventHandle; + } + }, + + teardown: function( namespaces, eventHandle ) { + if ( this.onbeforeunload === eventHandle ) { + this.onbeforeunload = null; + } + } + } + }, + + simulate: function( type, elem, event, bubble ) { + // Piggyback on a donor event to simulate a different one. + // Fake originalEvent to avoid donor's stopPropagation, but if the + // simulated event prevents default then we do the same on the donor. + var e = jQuery.extend( + new jQuery.Event(), + event, + { type: type, + isSimulated: true, + originalEvent: {} + } + ); + if ( bubble ) { + jQuery.event.trigger( e, null, elem ); + } else { + jQuery.event.dispatch.call( elem, e ); + } + if ( e.isDefaultPrevented() ) { + event.preventDefault(); + } + } +}; + +// Some plugins are using, but it's undocumented/deprecated and will be removed. +// The 1.7 special event interface should provide all the hooks needed now. +jQuery.event.handle = jQuery.event.dispatch; + +jQuery.removeEvent = document.removeEventListener ? + function( elem, type, handle ) { + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle, false ); + } + } : + function( elem, type, handle ) { + if ( elem.detachEvent ) { + elem.detachEvent( "on" + type, handle ); + } + }; + +jQuery.Event = function( src, props ) { + // Allow instantiation without the 'new' keyword + if ( !(this instanceof jQuery.Event) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || + src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +function returnFalse() { + return false; +} +function returnTrue() { + return true; +} + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + preventDefault: function() { + this.isDefaultPrevented = returnTrue; + + var e = this.originalEvent; + if ( !e ) { + return; + } + + // if preventDefault exists run it on the original event + if ( e.preventDefault ) { + e.preventDefault(); + + // otherwise set the returnValue property of the original event to false (IE) + } else { + e.returnValue = false; + } + }, + stopPropagation: function() { + this.isPropagationStopped = returnTrue; + + var e = this.originalEvent; + if ( !e ) { + return; + } + // if stopPropagation exists run it on the original event + if ( e.stopPropagation ) { + e.stopPropagation(); + } + // otherwise set the cancelBubble property of the original event to true (IE) + e.cancelBubble = true; + }, + stopImmediatePropagation: function() { + this.isImmediatePropagationStopped = returnTrue; + this.stopPropagation(); + }, + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse +}; + +// Create mouseenter/leave events using mouseover/out and event-time checks +jQuery.each({ + mouseenter: "mouseover", + mouseleave: "mouseout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var target = this, + related = event.relatedTarget, + handleObj = event.handleObj, + selector = handleObj.selector, + ret; + + // For mousenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || (related !== target && !jQuery.contains( target, related )) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +}); + +// IE submit delegation +if ( !jQuery.support.submitBubbles ) { + + jQuery.event.special.submit = { + setup: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Lazy-add a submit handler when a descendant form may potentially be submitted + jQuery.event.add( this, "click._submit keypress._submit", function( e ) { + // Node name check avoids a VML-related crash in IE (#9807) + var elem = e.target, + form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; + if ( form && !form._submit_attached ) { + jQuery.event.add( form, "submit._submit", function( event ) { + event._submit_bubble = true; + }); + form._submit_attached = true; + } + }); + // return undefined since we don't need an event listener + }, + + postDispatch: function( event ) { + // If form was submitted by the user, bubble the event up the tree + if ( event._submit_bubble ) { + delete event._submit_bubble; + if ( this.parentNode && !event.isTrigger ) { + jQuery.event.simulate( "submit", this.parentNode, event, true ); + } + } + }, + + teardown: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Remove delegated handlers; cleanData eventually reaps submit handlers attached above + jQuery.event.remove( this, "._submit" ); + } + }; +} + +// IE change delegation and checkbox/radio fix +if ( !jQuery.support.changeBubbles ) { + + jQuery.event.special.change = { + + setup: function() { + + if ( rformElems.test( this.nodeName ) ) { + // IE doesn't fire change on a check/radio until blur; trigger it on click + // after a propertychange. Eat the blur-change in special.change.handle. + // This still fires onchange a second time for check/radio after blur. + if ( this.type === "checkbox" || this.type === "radio" ) { + jQuery.event.add( this, "propertychange._change", function( event ) { + if ( event.originalEvent.propertyName === "checked" ) { + this._just_changed = true; + } + }); + jQuery.event.add( this, "click._change", function( event ) { + if ( this._just_changed && !event.isTrigger ) { + this._just_changed = false; + jQuery.event.simulate( "change", this, event, true ); + } + }); + } + return false; + } + // Delegated event; lazy-add a change handler on descendant inputs + jQuery.event.add( this, "beforeactivate._change", function( e ) { + var elem = e.target; + + if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) { + jQuery.event.add( elem, "change._change", function( event ) { + if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { + jQuery.event.simulate( "change", this.parentNode, event, true ); + } + }); + elem._change_attached = true; + } + }); + }, + + handle: function( event ) { + var elem = event.target; + + // Swallow native change events from checkbox/radio, we already triggered them above + if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { + return event.handleObj.handler.apply( this, arguments ); + } + }, + + teardown: function() { + jQuery.event.remove( this, "._change" ); + + return rformElems.test( this.nodeName ); + } + }; +} + +// Create "bubbling" focus and blur events +if ( !jQuery.support.focusinBubbles ) { + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler while someone wants focusin/focusout + var attaches = 0, + handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + if ( attaches++ === 0 ) { + document.addEventListener( orig, handler, true ); + } + }, + teardown: function() { + if ( --attaches === 0 ) { + document.removeEventListener( orig, handler, true ); + } + } + }; + }); +} + +jQuery.fn.extend({ + + on: function( types, selector, data, fn, /*INTERNAL*/ one ) { + var origFn, type; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { // && selector != null + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + this.on( type, selector, data, types[ type ], one ); + } + return this; + } + + if ( data == null && fn == null ) { + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return this; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return this.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + }); + }, + one: function( types, selector, data, fn ) { + return this.on( types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + if ( types && types.preventDefault && types.handleObj ) { + // ( event ) dispatched jQuery.Event + var handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + // ( types-object [, selector] ) + for ( var type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each(function() { + jQuery.event.remove( this, types, fn, selector ); + }); + }, + + bind: function( types, data, fn ) { + return this.on( types, null, data, fn ); + }, + unbind: function( types, fn ) { + return this.off( types, null, fn ); + }, + + live: function( types, data, fn ) { + jQuery( this.context ).on( types, this.selector, data, fn ); + return this; + }, + die: function( types, fn ) { + jQuery( this.context ).off( types, this.selector || "**", fn ); + return this; + }, + + delegate: function( selector, types, data, fn ) { + return this.on( types, selector, data, fn ); + }, + undelegate: function( selector, types, fn ) { + // ( namespace ) or ( selector, types [, fn] ) + return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn ); + }, + + trigger: function( type, data ) { + return this.each(function() { + jQuery.event.trigger( type, data, this ); + }); + }, + triggerHandler: function( type, data ) { + if ( this[0] ) { + return jQuery.event.trigger( type, data, this[0], true ); + } + }, + + toggle: function( fn ) { + // Save reference to arguments for access in closure + var args = arguments, + guid = fn.guid || jQuery.guid++, + i = 0, + toggler = function( event ) { + // Figure out which function to execute + var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; + jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); + + // Make sure that clicks stop + event.preventDefault(); + + // and execute the function + return args[ lastToggle ].apply( this, arguments ) || false; + }; + + // link all the functions, so any of them can unbind this click handler + toggler.guid = guid; + while ( i < args.length ) { + args[ i++ ].guid = guid; + } + + return this.click( toggler ); + }, + + hover: function( fnOver, fnOut ) { + return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); + } +}); + +jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + + "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { + + // Handle event binding + jQuery.fn[ name ] = function( data, fn ) { + if ( fn == null ) { + fn = data; + data = null; + } + + return arguments.length > 0 ? + this.on( name, null, data, fn ) : + this.trigger( name ); + }; + + if ( jQuery.attrFn ) { + jQuery.attrFn[ name ] = true; + } + + if ( rkeyEvent.test( name ) ) { + jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; + } + + if ( rmouseEvent.test( name ) ) { + jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; + } +}); + + + +/*! + * Sizzle CSS Selector Engine + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){ + +var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, + expando = "sizcache" + (Math.random() + '').replace('.', ''), + done = 0, + toString = Object.prototype.toString, + hasDuplicate = false, + baseHasDuplicate = true, + rBackslash = /\\/g, + rReturn = /\r\n/g, + rNonWord = /\W/; + +// Here we check if the JavaScript engine is using some sort of +// optimization where it does not always call our comparision +// function. If that is the case, discard the hasDuplicate value. +// Thus far that includes Google Chrome. +[0, 0].sort(function() { + baseHasDuplicate = false; + return 0; +}); + +var Sizzle = function( selector, context, results, seed ) { + results = results || []; + context = context || document; + + var origContext = context; + + if ( context.nodeType !== 1 && context.nodeType !== 9 ) { + return []; + } + + if ( !selector || typeof selector !== "string" ) { + return results; + } + + var m, set, checkSet, extra, ret, cur, pop, i, + prune = true, + contextXML = Sizzle.isXML( context ), + parts = [], + soFar = selector; + + // Reset the position of the chunker regexp (start from head) + do { + chunker.exec( "" ); + m = chunker.exec( soFar ); + + if ( m ) { + soFar = m[3]; + + parts.push( m[1] ); + + if ( m[2] ) { + extra = m[3]; + break; + } + } + } while ( m ); + + if ( parts.length > 1 && origPOS.exec( selector ) ) { + + if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { + set = posProcess( parts[0] + parts[1], context, seed ); + + } else { + set = Expr.relative[ parts[0] ] ? + [ context ] : + Sizzle( parts.shift(), context ); + + while ( parts.length ) { + selector = parts.shift(); + + if ( Expr.relative[ selector ] ) { + selector += parts.shift(); + } + + set = posProcess( selector, set, seed ); + } + } + + } else { + // Take a shortcut and set the context if the root selector is an ID + // (but not if it'll be faster if the inner selector is an ID) + if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && + Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { + + ret = Sizzle.find( parts.shift(), context, contextXML ); + context = ret.expr ? + Sizzle.filter( ret.expr, ret.set )[0] : + ret.set[0]; + } + + if ( context ) { + ret = seed ? + { expr: parts.pop(), set: makeArray(seed) } : + Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); + + set = ret.expr ? + Sizzle.filter( ret.expr, ret.set ) : + ret.set; + + if ( parts.length > 0 ) { + checkSet = makeArray( set ); + + } else { + prune = false; + } + + while ( parts.length ) { + cur = parts.pop(); + pop = cur; + + if ( !Expr.relative[ cur ] ) { + cur = ""; + } else { + pop = parts.pop(); + } + + if ( pop == null ) { + pop = context; + } + + Expr.relative[ cur ]( checkSet, pop, contextXML ); + } + + } else { + checkSet = parts = []; + } + } + + if ( !checkSet ) { + checkSet = set; + } + + if ( !checkSet ) { + Sizzle.error( cur || selector ); + } + + if ( toString.call(checkSet) === "[object Array]" ) { + if ( !prune ) { + results.push.apply( results, checkSet ); + + } else if ( context && context.nodeType === 1 ) { + for ( i = 0; checkSet[i] != null; i++ ) { + if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { + results.push( set[i] ); + } + } + + } else { + for ( i = 0; checkSet[i] != null; i++ ) { + if ( checkSet[i] && checkSet[i].nodeType === 1 ) { + results.push( set[i] ); + } + } + } + + } else { + makeArray( checkSet, results ); + } + + if ( extra ) { + Sizzle( extra, origContext, results, seed ); + Sizzle.uniqueSort( results ); + } + + return results; +}; + +Sizzle.uniqueSort = function( results ) { + if ( sortOrder ) { + hasDuplicate = baseHasDuplicate; + results.sort( sortOrder ); + + if ( hasDuplicate ) { + for ( var i = 1; i < results.length; i++ ) { + if ( results[i] === results[ i - 1 ] ) { + results.splice( i--, 1 ); + } + } + } + } + + return results; +}; + +Sizzle.matches = function( expr, set ) { + return Sizzle( expr, null, null, set ); +}; + +Sizzle.matchesSelector = function( node, expr ) { + return Sizzle( expr, null, null, [node] ).length > 0; +}; + +Sizzle.find = function( expr, context, isXML ) { + var set, i, len, match, type, left; + + if ( !expr ) { + return []; + } + + for ( i = 0, len = Expr.order.length; i < len; i++ ) { + type = Expr.order[i]; + + if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { + left = match[1]; + match.splice( 1, 1 ); + + if ( left.substr( left.length - 1 ) !== "\\" ) { + match[1] = (match[1] || "").replace( rBackslash, "" ); + set = Expr.find[ type ]( match, context, isXML ); + + if ( set != null ) { + expr = expr.replace( Expr.match[ type ], "" ); + break; + } + } + } + } + + if ( !set ) { + set = typeof context.getElementsByTagName !== "undefined" ? + context.getElementsByTagName( "*" ) : + []; + } + + return { set: set, expr: expr }; +}; + +Sizzle.filter = function( expr, set, inplace, not ) { + var match, anyFound, + type, found, item, filter, left, + i, pass, + old = expr, + result = [], + curLoop = set, + isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); + + while ( expr && set.length ) { + for ( type in Expr.filter ) { + if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { + filter = Expr.filter[ type ]; + left = match[1]; + + anyFound = false; + + match.splice(1,1); + + if ( left.substr( left.length - 1 ) === "\\" ) { + continue; + } + + if ( curLoop === result ) { + result = []; + } + + if ( Expr.preFilter[ type ] ) { + match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); + + if ( !match ) { + anyFound = found = true; + + } else if ( match === true ) { + continue; + } + } + + if ( match ) { + for ( i = 0; (item = curLoop[i]) != null; i++ ) { + if ( item ) { + found = filter( item, match, i, curLoop ); + pass = not ^ found; + + if ( inplace && found != null ) { + if ( pass ) { + anyFound = true; + + } else { + curLoop[i] = false; + } + + } else if ( pass ) { + result.push( item ); + anyFound = true; + } + } + } + } + + if ( found !== undefined ) { + if ( !inplace ) { + curLoop = result; + } + + expr = expr.replace( Expr.match[ type ], "" ); + + if ( !anyFound ) { + return []; + } + + break; + } + } + } + + // Improper expression + if ( expr === old ) { + if ( anyFound == null ) { + Sizzle.error( expr ); + + } else { + break; + } + } + + old = expr; + } + + return curLoop; +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +/** + * Utility function for retreiving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +var getText = Sizzle.getText = function( elem ) { + var i, node, + nodeType = elem.nodeType, + ret = ""; + + if ( nodeType ) { + if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + // Use textContent || innerText for elements + if ( typeof elem.textContent === 'string' ) { + return elem.textContent; + } else if ( typeof elem.innerText === 'string' ) { + // Replace IE's carriage returns + return elem.innerText.replace( rReturn, '' ); + } else { + // Traverse it's children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + } else { + + // If no nodeType, this is expected to be an array + for ( i = 0; (node = elem[i]); i++ ) { + // Do not traverse comment nodes + if ( node.nodeType !== 8 ) { + ret += getText( node ); + } + } + } + return ret; +}; + +var Expr = Sizzle.selectors = { + order: [ "ID", "NAME", "TAG" ], + + match: { + ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, + CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, + NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, + ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, + TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, + CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, + POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, + PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ + }, + + leftMatch: {}, + + attrMap: { + "class": "className", + "for": "htmlFor" + }, + + attrHandle: { + href: function( elem ) { + return elem.getAttribute( "href" ); + }, + type: function( elem ) { + return elem.getAttribute( "type" ); + } + }, + + relative: { + "+": function(checkSet, part){ + var isPartStr = typeof part === "string", + isTag = isPartStr && !rNonWord.test( part ), + isPartStrNotTag = isPartStr && !isTag; + + if ( isTag ) { + part = part.toLowerCase(); + } + + for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { + if ( (elem = checkSet[i]) ) { + while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} + + checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? + elem || false : + elem === part; + } + } + + if ( isPartStrNotTag ) { + Sizzle.filter( part, checkSet, true ); + } + }, + + ">": function( checkSet, part ) { + var elem, + isPartStr = typeof part === "string", + i = 0, + l = checkSet.length; + + if ( isPartStr && !rNonWord.test( part ) ) { + part = part.toLowerCase(); + + for ( ; i < l; i++ ) { + elem = checkSet[i]; + + if ( elem ) { + var parent = elem.parentNode; + checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; + } + } + + } else { + for ( ; i < l; i++ ) { + elem = checkSet[i]; + + if ( elem ) { + checkSet[i] = isPartStr ? + elem.parentNode : + elem.parentNode === part; + } + } + + if ( isPartStr ) { + Sizzle.filter( part, checkSet, true ); + } + } + }, + + "": function(checkSet, part, isXML){ + var nodeCheck, + doneName = done++, + checkFn = dirCheck; + + if ( typeof part === "string" && !rNonWord.test( part ) ) { + part = part.toLowerCase(); + nodeCheck = part; + checkFn = dirNodeCheck; + } + + checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); + }, + + "~": function( checkSet, part, isXML ) { + var nodeCheck, + doneName = done++, + checkFn = dirCheck; + + if ( typeof part === "string" && !rNonWord.test( part ) ) { + part = part.toLowerCase(); + nodeCheck = part; + checkFn = dirNodeCheck; + } + + checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); + } + }, + + find: { + ID: function( match, context, isXML ) { + if ( typeof context.getElementById !== "undefined" && !isXML ) { + var m = context.getElementById(match[1]); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [m] : []; + } + }, + + NAME: function( match, context ) { + if ( typeof context.getElementsByName !== "undefined" ) { + var ret = [], + results = context.getElementsByName( match[1] ); + + for ( var i = 0, l = results.length; i < l; i++ ) { + if ( results[i].getAttribute("name") === match[1] ) { + ret.push( results[i] ); + } + } + + return ret.length === 0 ? null : ret; + } + }, + + TAG: function( match, context ) { + if ( typeof context.getElementsByTagName !== "undefined" ) { + return context.getElementsByTagName( match[1] ); + } + } + }, + preFilter: { + CLASS: function( match, curLoop, inplace, result, not, isXML ) { + match = " " + match[1].replace( rBackslash, "" ) + " "; + + if ( isXML ) { + return match; + } + + for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { + if ( elem ) { + if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { + if ( !inplace ) { + result.push( elem ); + } + + } else if ( inplace ) { + curLoop[i] = false; + } + } + } + + return false; + }, + + ID: function( match ) { + return match[1].replace( rBackslash, "" ); + }, + + TAG: function( match, curLoop ) { + return match[1].replace( rBackslash, "" ).toLowerCase(); + }, + + CHILD: function( match ) { + if ( match[1] === "nth" ) { + if ( !match[2] ) { + Sizzle.error( match[0] ); + } + + match[2] = match[2].replace(/^\+|\s*/g, ''); + + // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' + var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( + match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || + !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); + + // calculate the numbers (first)n+(last) including if they are negative + match[2] = (test[1] + (test[2] || 1)) - 0; + match[3] = test[3] - 0; + } + else if ( match[2] ) { + Sizzle.error( match[0] ); + } + + // TODO: Move to normal caching system + match[0] = done++; + + return match; + }, + + ATTR: function( match, curLoop, inplace, result, not, isXML ) { + var name = match[1] = match[1].replace( rBackslash, "" ); + + if ( !isXML && Expr.attrMap[name] ) { + match[1] = Expr.attrMap[name]; + } + + // Handle if an un-quoted value was used + match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); + + if ( match[2] === "~=" ) { + match[4] = " " + match[4] + " "; + } + + return match; + }, + + PSEUDO: function( match, curLoop, inplace, result, not ) { + if ( match[1] === "not" ) { + // If we're dealing with a complex expression, or a simple one + if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { + match[3] = Sizzle(match[3], null, null, curLoop); + + } else { + var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); + + if ( !inplace ) { + result.push.apply( result, ret ); + } + + return false; + } + + } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { + return true; + } + + return match; + }, + + POS: function( match ) { + match.unshift( true ); + + return match; + } + }, + + filters: { + enabled: function( elem ) { + return elem.disabled === false && elem.type !== "hidden"; + }, + + disabled: function( elem ) { + return elem.disabled === true; + }, + + checked: function( elem ) { + return elem.checked === true; + }, + + selected: function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + parent: function( elem ) { + return !!elem.firstChild; + }, + + empty: function( elem ) { + return !elem.firstChild; + }, + + has: function( elem, i, match ) { + return !!Sizzle( match[3], elem ).length; + }, + + header: function( elem ) { + return (/h\d/i).test( elem.nodeName ); + }, + + text: function( elem ) { + var attr = elem.getAttribute( "type" ), type = elem.type; + // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) + // use getAttribute instead to test this case + return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); + }, + + radio: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; + }, + + checkbox: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; + }, + + file: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; + }, + + password: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; + }, + + submit: function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && "submit" === elem.type; + }, + + image: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; + }, + + reset: function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && "reset" === elem.type; + }, + + button: function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && "button" === elem.type || name === "button"; + }, + + input: function( elem ) { + return (/input|select|textarea|button/i).test( elem.nodeName ); + }, + + focus: function( elem ) { + return elem === elem.ownerDocument.activeElement; + } + }, + setFilters: { + first: function( elem, i ) { + return i === 0; + }, + + last: function( elem, i, match, array ) { + return i === array.length - 1; + }, + + even: function( elem, i ) { + return i % 2 === 0; + }, + + odd: function( elem, i ) { + return i % 2 === 1; + }, + + lt: function( elem, i, match ) { + return i < match[3] - 0; + }, + + gt: function( elem, i, match ) { + return i > match[3] - 0; + }, + + nth: function( elem, i, match ) { + return match[3] - 0 === i; + }, + + eq: function( elem, i, match ) { + return match[3] - 0 === i; + } + }, + filter: { + PSEUDO: function( elem, match, i, array ) { + var name = match[1], + filter = Expr.filters[ name ]; + + if ( filter ) { + return filter( elem, i, match, array ); + + } else if ( name === "contains" ) { + return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; + + } else if ( name === "not" ) { + var not = match[3]; + + for ( var j = 0, l = not.length; j < l; j++ ) { + if ( not[j] === elem ) { + return false; + } + } + + return true; + + } else { + Sizzle.error( name ); + } + }, + + CHILD: function( elem, match ) { + var first, last, + doneName, parent, cache, + count, diff, + type = match[1], + node = elem; + + switch ( type ) { + case "only": + case "first": + while ( (node = node.previousSibling) ) { + if ( node.nodeType === 1 ) { + return false; + } + } + + if ( type === "first" ) { + return true; + } + + node = elem; + + /* falls through */ + case "last": + while ( (node = node.nextSibling) ) { + if ( node.nodeType === 1 ) { + return false; + } + } + + return true; + + case "nth": + first = match[2]; + last = match[3]; + + if ( first === 1 && last === 0 ) { + return true; + } + + doneName = match[0]; + parent = elem.parentNode; + + if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { + count = 0; + + for ( node = parent.firstChild; node; node = node.nextSibling ) { + if ( node.nodeType === 1 ) { + node.nodeIndex = ++count; + } + } + + parent[ expando ] = doneName; + } + + diff = elem.nodeIndex - last; + + if ( first === 0 ) { + return diff === 0; + + } else { + return ( diff % first === 0 && diff / first >= 0 ); + } + } + }, + + ID: function( elem, match ) { + return elem.nodeType === 1 && elem.getAttribute("id") === match; + }, + + TAG: function( elem, match ) { + return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; + }, + + CLASS: function( elem, match ) { + return (" " + (elem.className || elem.getAttribute("class")) + " ") + .indexOf( match ) > -1; + }, + + ATTR: function( elem, match ) { + var name = match[1], + result = Sizzle.attr ? + Sizzle.attr( elem, name ) : + Expr.attrHandle[ name ] ? + Expr.attrHandle[ name ]( elem ) : + elem[ name ] != null ? + elem[ name ] : + elem.getAttribute( name ), + value = result + "", + type = match[2], + check = match[4]; + + return result == null ? + type === "!=" : + !type && Sizzle.attr ? + result != null : + type === "=" ? + value === check : + type === "*=" ? + value.indexOf(check) >= 0 : + type === "~=" ? + (" " + value + " ").indexOf(check) >= 0 : + !check ? + value && result !== false : + type === "!=" ? + value !== check : + type === "^=" ? + value.indexOf(check) === 0 : + type === "$=" ? + value.substr(value.length - check.length) === check : + type === "|=" ? + value === check || value.substr(0, check.length + 1) === check + "-" : + false; + }, + + POS: function( elem, match, i, array ) { + var name = match[2], + filter = Expr.setFilters[ name ]; + + if ( filter ) { + return filter( elem, i, match, array ); + } + } + } +}; + +var origPOS = Expr.match.POS, + fescape = function(all, num){ + return "\\" + (num - 0 + 1); + }; + +for ( var type in Expr.match ) { + Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); + Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); +} +// Expose origPOS +// "global" as in regardless of relation to brackets/parens +Expr.match.globalPOS = origPOS; + +var makeArray = function( array, results ) { + array = Array.prototype.slice.call( array, 0 ); + + if ( results ) { + results.push.apply( results, array ); + return results; + } + + return array; +}; + +// Perform a simple check to determine if the browser is capable of +// converting a NodeList to an array using builtin methods. +// Also verifies that the returned array holds DOM nodes +// (which is not the case in the Blackberry browser) +try { + Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; + +// Provide a fallback method if it does not work +} catch( e ) { + makeArray = function( array, results ) { + var i = 0, + ret = results || []; + + if ( toString.call(array) === "[object Array]" ) { + Array.prototype.push.apply( ret, array ); + + } else { + if ( typeof array.length === "number" ) { + for ( var l = array.length; i < l; i++ ) { + ret.push( array[i] ); + } + + } else { + for ( ; array[i]; i++ ) { + ret.push( array[i] ); + } + } + } + + return ret; + }; +} + +var sortOrder, siblingCheck; + +if ( document.documentElement.compareDocumentPosition ) { + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { + return a.compareDocumentPosition ? -1 : 1; + } + + return a.compareDocumentPosition(b) & 4 ? -1 : 1; + }; + +} else { + sortOrder = function( a, b ) { + // The nodes are identical, we can exit early + if ( a === b ) { + hasDuplicate = true; + return 0; + + // Fallback to using sourceIndex (in IE) if it's available on both nodes + } else if ( a.sourceIndex && b.sourceIndex ) { + return a.sourceIndex - b.sourceIndex; + } + + var al, bl, + ap = [], + bp = [], + aup = a.parentNode, + bup = b.parentNode, + cur = aup; + + // If the nodes are siblings (or identical) we can do a quick check + if ( aup === bup ) { + return siblingCheck( a, b ); + + // If no parents were found then the nodes are disconnected + } else if ( !aup ) { + return -1; + + } else if ( !bup ) { + return 1; + } + + // Otherwise they're somewhere else in the tree so we need + // to build up a full list of the parentNodes for comparison + while ( cur ) { + ap.unshift( cur ); + cur = cur.parentNode; + } + + cur = bup; + + while ( cur ) { + bp.unshift( cur ); + cur = cur.parentNode; + } + + al = ap.length; + bl = bp.length; + + // Start walking down the tree looking for a discrepancy + for ( var i = 0; i < al && i < bl; i++ ) { + if ( ap[i] !== bp[i] ) { + return siblingCheck( ap[i], bp[i] ); + } + } + + // We ended someplace up the tree so do a sibling check + return i === al ? + siblingCheck( a, bp[i], -1 ) : + siblingCheck( ap[i], b, 1 ); + }; + + siblingCheck = function( a, b, ret ) { + if ( a === b ) { + return ret; + } + + var cur = a.nextSibling; + + while ( cur ) { + if ( cur === b ) { + return -1; + } + + cur = cur.nextSibling; + } + + return 1; + }; +} + +// Check to see if the browser returns elements by name when +// querying by getElementById (and provide a workaround) +(function(){ + // We're going to inject a fake input element with a specified name + var form = document.createElement("div"), + id = "script" + (new Date()).getTime(), + root = document.documentElement; + + form.innerHTML = "<a name='" + id + "'/>"; + + // Inject it into the root element, check its status, and remove it quickly + root.insertBefore( form, root.firstChild ); + + // The workaround has to do additional checks after a getElementById + // Which slows things down for other browsers (hence the branching) + if ( document.getElementById( id ) ) { + Expr.find.ID = function( match, context, isXML ) { + if ( typeof context.getElementById !== "undefined" && !isXML ) { + var m = context.getElementById(match[1]); + + return m ? + m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? + [m] : + undefined : + []; + } + }; + + Expr.filter.ID = function( elem, match ) { + var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); + + return elem.nodeType === 1 && node && node.nodeValue === match; + }; + } + + root.removeChild( form ); + + // release memory in IE + root = form = null; +})(); + +(function(){ + // Check to see if the browser returns only elements + // when doing getElementsByTagName("*") + + // Create a fake element + var div = document.createElement("div"); + div.appendChild( document.createComment("") ); + + // Make sure no comments are found + if ( div.getElementsByTagName("*").length > 0 ) { + Expr.find.TAG = function( match, context ) { + var results = context.getElementsByTagName( match[1] ); + + // Filter out possible comments + if ( match[1] === "*" ) { + var tmp = []; + + for ( var i = 0; results[i]; i++ ) { + if ( results[i].nodeType === 1 ) { + tmp.push( results[i] ); + } + } + + results = tmp; + } + + return results; + }; + } + + // Check to see if an attribute returns normalized href attributes + div.innerHTML = "<a href='#'></a>"; + + if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && + div.firstChild.getAttribute("href") !== "#" ) { + + Expr.attrHandle.href = function( elem ) { + return elem.getAttribute( "href", 2 ); + }; + } + + // release memory in IE + div = null; +})(); + +if ( document.querySelectorAll ) { + (function(){ + var oldSizzle = Sizzle, + div = document.createElement("div"), + id = "__sizzle__"; + + div.innerHTML = "<p class='TEST'></p>"; + + // Safari can't handle uppercase or unicode characters when + // in quirks mode. + if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { + return; + } + + Sizzle = function( query, context, extra, seed ) { + context = context || document; + + // Only use querySelectorAll on non-XML documents + // (ID selectors don't work in non-HTML documents) + if ( !seed && !Sizzle.isXML(context) ) { + // See if we find a selector to speed up + var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); + + if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { + // Speed-up: Sizzle("TAG") + if ( match[1] ) { + return makeArray( context.getElementsByTagName( query ), extra ); + + // Speed-up: Sizzle(".CLASS") + } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { + return makeArray( context.getElementsByClassName( match[2] ), extra ); + } + } + + if ( context.nodeType === 9 ) { + // Speed-up: Sizzle("body") + // The body element only exists once, optimize finding it + if ( query === "body" && context.body ) { + return makeArray( [ context.body ], extra ); + + // Speed-up: Sizzle("#ID") + } else if ( match && match[3] ) { + var elem = context.getElementById( match[3] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id === match[3] ) { + return makeArray( [ elem ], extra ); + } + + } else { + return makeArray( [], extra ); + } + } + + try { + return makeArray( context.querySelectorAll(query), extra ); + } catch(qsaError) {} + + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { + var oldContext = context, + old = context.getAttribute( "id" ), + nid = old || id, + hasParent = context.parentNode, + relativeHierarchySelector = /^\s*[+~]/.test( query ); + + if ( !old ) { + context.setAttribute( "id", nid ); + } else { + nid = nid.replace( /'/g, "\\$&" ); + } + if ( relativeHierarchySelector && hasParent ) { + context = context.parentNode; + } + + try { + if ( !relativeHierarchySelector || hasParent ) { + return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); + } + + } catch(pseudoError) { + } finally { + if ( !old ) { + oldContext.removeAttribute( "id" ); + } + } + } + } + + return oldSizzle(query, context, extra, seed); + }; + + for ( var prop in oldSizzle ) { + Sizzle[ prop ] = oldSizzle[ prop ]; + } + + // release memory in IE + div = null; + })(); +} + +(function(){ + var html = document.documentElement, + matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; + + if ( matches ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9 fails this) + var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), + pseudoWorks = false; + + try { + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( document.documentElement, "[test!='']:sizzle" ); + + } catch( pseudoError ) { + pseudoWorks = true; + } + + Sizzle.matchesSelector = function( node, expr ) { + // Make sure that attribute selectors are quoted + expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); + + if ( !Sizzle.isXML( node ) ) { + try { + if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { + var ret = matches.call( node, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || !disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9, so check for that + node.document && node.document.nodeType !== 11 ) { + return ret; + } + } + } catch(e) {} + } + + return Sizzle(expr, null, null, [node]).length > 0; + }; + } +})(); + +(function(){ + var div = document.createElement("div"); + + div.innerHTML = "<div class='test e'></div><div class='test'></div>"; + + // Opera can't find a second classname (in 9.6) + // Also, make sure that getElementsByClassName actually exists + if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { + return; + } + + // Safari caches class attributes, doesn't catch changes (in 3.2) + div.lastChild.className = "e"; + + if ( div.getElementsByClassName("e").length === 1 ) { + return; + } + + Expr.order.splice(1, 0, "CLASS"); + Expr.find.CLASS = function( match, context, isXML ) { + if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { + return context.getElementsByClassName(match[1]); + } + }; + + // release memory in IE + div = null; +})(); + +function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + + if ( elem ) { + var match = false; + + elem = elem[dir]; + + while ( elem ) { + if ( elem[ expando ] === doneName ) { + match = checkSet[elem.sizset]; + break; + } + + if ( elem.nodeType === 1 && !isXML ){ + elem[ expando ] = doneName; + elem.sizset = i; + } + + if ( elem.nodeName.toLowerCase() === cur ) { + match = elem; + break; + } + + elem = elem[dir]; + } + + checkSet[i] = match; + } + } +} + +function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + + if ( elem ) { + var match = false; + + elem = elem[dir]; + + while ( elem ) { + if ( elem[ expando ] === doneName ) { + match = checkSet[elem.sizset]; + break; + } + + if ( elem.nodeType === 1 ) { + if ( !isXML ) { + elem[ expando ] = doneName; + elem.sizset = i; + } + + if ( typeof cur !== "string" ) { + if ( elem === cur ) { + match = true; + break; + } + + } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { + match = elem; + break; + } + } + + elem = elem[dir]; + } + + checkSet[i] = match; + } + } +} + +if ( document.documentElement.contains ) { + Sizzle.contains = function( a, b ) { + return a !== b && (a.contains ? a.contains(b) : true); + }; + +} else if ( document.documentElement.compareDocumentPosition ) { + Sizzle.contains = function( a, b ) { + return !!(a.compareDocumentPosition(b) & 16); + }; + +} else { + Sizzle.contains = function() { + return false; + }; +} + +Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; + + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +var posProcess = function( selector, context, seed ) { + var match, + tmpSet = [], + later = "", + root = context.nodeType ? [context] : context; + + // Position selectors must be done after the filter + // And so must :not(positional) so we move all PSEUDOs to the end + while ( (match = Expr.match.PSEUDO.exec( selector )) ) { + later += match[0]; + selector = selector.replace( Expr.match.PSEUDO, "" ); + } + + selector = Expr.relative[selector] ? selector + "*" : selector; + + for ( var i = 0, l = root.length; i < l; i++ ) { + Sizzle( selector, root[i], tmpSet, seed ); + } + + return Sizzle.filter( later, tmpSet ); +}; + +// EXPOSE +// Override sizzle attribute retrieval +Sizzle.attr = jQuery.attr; +Sizzle.selectors.attrMap = {}; +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; +jQuery.expr[":"] = jQuery.expr.filters; +jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; + + +})(); + + +var runtil = /Until$/, + rparentsprev = /^(?:parents|prevUntil|prevAll)/, + // Note: This RegExp should be improved, or likely pulled from Sizzle + rmultiselector = /,/, + isSimple = /^.[^:#\[\.,]*$/, + slice = Array.prototype.slice, + POS = jQuery.expr.match.globalPOS, + // methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.fn.extend({ + find: function( selector ) { + var self = this, + i, l; + + if ( typeof selector !== "string" ) { + return jQuery( selector ).filter(function() { + for ( i = 0, l = self.length; i < l; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + }); + } + + var ret = this.pushStack( "", "find", selector ), + length, n, r; + + for ( i = 0, l = this.length; i < l; i++ ) { + length = ret.length; + jQuery.find( selector, this[i], ret ); + + if ( i > 0 ) { + // Make sure that the results are unique + for ( n = length; n < ret.length; n++ ) { + for ( r = 0; r < length; r++ ) { + if ( ret[r] === ret[n] ) { + ret.splice(n--, 1); + break; + } + } + } + } + } + + return ret; + }, + + has: function( target ) { + var targets = jQuery( target ); + return this.filter(function() { + for ( var i = 0, l = targets.length; i < l; i++ ) { + if ( jQuery.contains( this, targets[i] ) ) { + return true; + } + } + }); + }, + + not: function( selector ) { + return this.pushStack( winnow(this, selector, false), "not", selector); + }, + + filter: function( selector ) { + return this.pushStack( winnow(this, selector, true), "filter", selector ); + }, + + is: function( selector ) { + return !!selector && ( + typeof selector === "string" ? + // If this is a positional selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + POS.test( selector ) ? + jQuery( selector, this.context ).index( this[0] ) >= 0 : + jQuery.filter( selector, this ).length > 0 : + this.filter( selector ).length > 0 ); + }, + + closest: function( selectors, context ) { + var ret = [], i, l, cur = this[0]; + + // Array (deprecated as of jQuery 1.7) + if ( jQuery.isArray( selectors ) ) { + var level = 1; + + while ( cur && cur.ownerDocument && cur !== context ) { + for ( i = 0; i < selectors.length; i++ ) { + + if ( jQuery( cur ).is( selectors[ i ] ) ) { + ret.push({ selector: selectors[ i ], elem: cur, level: level }); + } + } + + cur = cur.parentNode; + level++; + } + + return ret; + } + + // String + var pos = POS.test( selectors ) || typeof selectors !== "string" ? + jQuery( selectors, context || this.context ) : + 0; + + for ( i = 0, l = this.length; i < l; i++ ) { + cur = this[i]; + + while ( cur ) { + if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { + ret.push( cur ); + break; + + } else { + cur = cur.parentNode; + if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { + break; + } + } + } + } + + ret = ret.length > 1 ? jQuery.unique( ret ) : ret; + + return this.pushStack( ret, "closest", selectors ); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; + } + + // index in selector + if ( typeof elem === "string" ) { + return jQuery.inArray( this[0], jQuery( elem ) ); + } + + // Locate the position of the desired element + return jQuery.inArray( + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[0] : elem, this ); + }, + + add: function( selector, context ) { + var set = typeof selector === "string" ? + jQuery( selector, context ) : + jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), + all = jQuery.merge( this.get(), set ); + + return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? + all : + jQuery.unique( all ) ); + }, + + andSelf: function() { + return this.add( this.prevObject ); + } +}); + +// A painfully simple check to see if an element is disconnected +// from a document (should be improved, where feasible). +function isDisconnected( node ) { + return !node || !node.parentNode || node.parentNode.nodeType === 11; +} + +jQuery.each({ + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return jQuery.dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return jQuery.dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return jQuery.nth( elem, 2, "nextSibling" ); + }, + prev: function( elem ) { + return jQuery.nth( elem, 2, "previousSibling" ); + }, + nextAll: function( elem ) { + return jQuery.dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return jQuery.dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return jQuery.dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return jQuery.dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); + }, + children: function( elem ) { + return jQuery.sibling( elem.firstChild ); + }, + contents: function( elem ) { + return jQuery.nodeName( elem, "iframe" ) ? + elem.contentDocument || elem.contentWindow.document : + jQuery.makeArray( elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var ret = jQuery.map( this, fn, until ); + + if ( !runtil.test( name ) ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + ret = jQuery.filter( selector, ret ); + } + + ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; + + if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { + ret = ret.reverse(); + } + + return this.pushStack( ret, name, slice.call( arguments ).join(",") ); + }; +}); + +jQuery.extend({ + filter: function( expr, elems, not ) { + if ( not ) { + expr = ":not(" + expr + ")"; + } + + return elems.length === 1 ? + jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : + jQuery.find.matches(expr, elems); + }, + + dir: function( elem, dir, until ) { + var matched = [], + cur = elem[ dir ]; + + while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { + if ( cur.nodeType === 1 ) { + matched.push( cur ); + } + cur = cur[dir]; + } + return matched; + }, + + nth: function( cur, result, dir, elem ) { + result = result || 1; + var num = 0; + + for ( ; cur; cur = cur[dir] ) { + if ( cur.nodeType === 1 && ++num === result ) { + break; + } + } + + return cur; + }, + + sibling: function( n, elem ) { + var r = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + r.push( n ); + } + } + + return r; + } +}); + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, keep ) { + + // Can't pass null or undefined to indexOf in Firefox 4 + // Set to 0 to skip string check + qualifier = qualifier || 0; + + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep(elements, function( elem, i ) { + var retVal = !!qualifier.call( elem, i, elem ); + return retVal === keep; + }); + + } else if ( qualifier.nodeType ) { + return jQuery.grep(elements, function( elem, i ) { + return ( elem === qualifier ) === keep; + }); + + } else if ( typeof qualifier === "string" ) { + var filtered = jQuery.grep(elements, function( elem ) { + return elem.nodeType === 1; + }); + + if ( isSimple.test( qualifier ) ) { + return jQuery.filter(qualifier, filtered, !keep); + } else { + qualifier = jQuery.filter( qualifier, filtered ); + } + } + + return jQuery.grep(elements, function( elem, i ) { + return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; + }); +} + + + + +function createSafeFragment( document ) { + var list = nodeNames.split( "|" ), + safeFrag = document.createDocumentFragment(); + + if ( safeFrag.createElement ) { + while ( list.length ) { + safeFrag.createElement( + list.pop() + ); + } + } + return safeFrag; +} + +var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", + rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, + rleadingWhitespace = /^\s+/, + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, + rtagName = /<([\w:]+)/, + rtbody = /<tbody/i, + rhtml = /<|&#?\w+;/, + rnoInnerhtml = /<(?:script|style)/i, + rnocache = /<(?:script|object|embed|option|style)/i, + rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), + // checked="checked" or checked + rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, + rscriptType = /\/(java|ecma)script/i, + rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)/, + wrapMap = { + option: [ 1, "<select multiple='multiple'>", "</select>" ], + legend: [ 1, "<fieldset>", "</fieldset>" ], + thead: [ 1, "<table>", "</table>" ], + tr: [ 2, "<table><tbody>", "</tbody></table>" ], + td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], + col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], + area: [ 1, "<map>", "</map>" ], + _default: [ 0, "", "" ] + }, + safeFragment = createSafeFragment( document ); + +wrapMap.optgroup = wrapMap.option; +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +// IE can't serialize <link> and <script> tags normally +if ( !jQuery.support.htmlSerialize ) { + wrapMap._default = [ 1, "div<div>", "</div>" ]; +} + +jQuery.fn.extend({ + text: function( value ) { + return jQuery.access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); + }, null, value, arguments.length ); + }, + + wrapAll: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapAll( html.call(this, i) ); + }); + } + + if ( this[0] ) { + // The elements to wrap the target around + var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); + + if ( this[0].parentNode ) { + wrap.insertBefore( this[0] ); + } + + wrap.map(function() { + var elem = this; + + while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { + elem = elem.firstChild; + } + + return elem; + }).append( this ); + } + + return this; + }, + + wrapInner: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapInner( html.call(this, i) ); + }); + } + + return this.each(function() { + var self = jQuery( this ), + contents = self.contents(); + + if ( contents.length ) { + contents.wrapAll( html ); + + } else { + self.append( html ); + } + }); + }, + + wrap: function( html ) { + var isFunction = jQuery.isFunction( html ); + + return this.each(function(i) { + jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); + }); + }, + + unwrap: function() { + return this.parent().each(function() { + if ( !jQuery.nodeName( this, "body" ) ) { + jQuery( this ).replaceWith( this.childNodes ); + } + }).end(); + }, + + append: function() { + return this.domManip(arguments, true, function( elem ) { + if ( this.nodeType === 1 ) { + this.appendChild( elem ); + } + }); + }, + + prepend: function() { + return this.domManip(arguments, true, function( elem ) { + if ( this.nodeType === 1 ) { + this.insertBefore( elem, this.firstChild ); + } + }); + }, + + before: function() { + if ( this[0] && this[0].parentNode ) { + return this.domManip(arguments, false, function( elem ) { + this.parentNode.insertBefore( elem, this ); + }); + } else if ( arguments.length ) { + var set = jQuery.clean( arguments ); + set.push.apply( set, this.toArray() ); + return this.pushStack( set, "before", arguments ); + } + }, + + after: function() { + if ( this[0] && this[0].parentNode ) { + return this.domManip(arguments, false, function( elem ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + }); + } else if ( arguments.length ) { + var set = this.pushStack( this, "after", arguments ); + set.push.apply( set, jQuery.clean(arguments) ); + return set; + } + }, + + // keepData is for internal use only--do not document + remove: function( selector, keepData ) { + for ( var i = 0, elem; (elem = this[i]) != null; i++ ) { + if ( !selector || jQuery.filter( selector, [ elem ] ).length ) { + if ( !keepData && elem.nodeType === 1 ) { + jQuery.cleanData( elem.getElementsByTagName("*") ); + jQuery.cleanData( [ elem ] ); + } + + if ( elem.parentNode ) { + elem.parentNode.removeChild( elem ); + } + } + } + + return this; + }, + + empty: function() { + for ( var i = 0, elem; (elem = this[i]) != null; i++ ) { + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( elem.getElementsByTagName("*") ); + } + + // Remove any remaining nodes + while ( elem.firstChild ) { + elem.removeChild( elem.firstChild ); + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map( function () { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + }); + }, + + html: function( value ) { + return jQuery.access( this, function( value ) { + var elem = this[0] || {}, + i = 0, + l = this.length; + + if ( value === undefined ) { + return elem.nodeType === 1 ? + elem.innerHTML.replace( rinlinejQuery, "" ) : + null; + } + + + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && + !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { + + value = value.replace( rxhtmlTag, "<$1></$2>" ); + + try { + for (; i < l; i++ ) { + // Remove element nodes and prevent memory leaks + elem = this[i] || {}; + if ( elem.nodeType === 1 ) { + jQuery.cleanData( elem.getElementsByTagName( "*" ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch(e) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function( value ) { + if ( this[0] && this[0].parentNode ) { + // Make sure that the elements are removed from the DOM before they are inserted + // this can help fix replacing a parent with child elements + if ( jQuery.isFunction( value ) ) { + return this.each(function(i) { + var self = jQuery(this), old = self.html(); + self.replaceWith( value.call( this, i, old ) ); + }); + } + + if ( typeof value !== "string" ) { + value = jQuery( value ).detach(); + } + + return this.each(function() { + var next = this.nextSibling, + parent = this.parentNode; + + jQuery( this ).remove(); + + if ( next ) { + jQuery(next).before( value ); + } else { + jQuery(parent).append( value ); + } + }); + } else { + return this.length ? + this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) : + this; + } + }, + + detach: function( selector ) { + return this.remove( selector, true ); + }, + + domManip: function( args, table, callback ) { + var results, first, fragment, parent, + value = args[0], + scripts = []; + + // We can't cloneNode fragments that contain checked, in WebKit + if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) { + return this.each(function() { + jQuery(this).domManip( args, table, callback, true ); + }); + } + + if ( jQuery.isFunction(value) ) { + return this.each(function(i) { + var self = jQuery(this); + args[0] = value.call(this, i, table ? self.html() : undefined); + self.domManip( args, table, callback ); + }); + } + + if ( this[0] ) { + parent = value && value.parentNode; + + // If we're in a fragment, just use that instead of building a new one + if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) { + results = { fragment: parent }; + + } else { + results = jQuery.buildFragment( args, this, scripts ); + } + + fragment = results.fragment; + + if ( fragment.childNodes.length === 1 ) { + first = fragment = fragment.firstChild; + } else { + first = fragment.firstChild; + } + + if ( first ) { + table = table && jQuery.nodeName( first, "tr" ); + + for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) { + callback.call( + table ? + root(this[i], first) : + this[i], + // Make sure that we do not leak memory by inadvertently discarding + // the original fragment (which might have attached data) instead of + // using it; in addition, use the original fragment object for the last + // item instead of first because it can end up being emptied incorrectly + // in certain situations (Bug #8070). + // Fragments from the fragment cache must always be cloned and never used + // in place. + results.cacheable || ( l > 1 && i < lastIndex ) ? + jQuery.clone( fragment, true, true ) : + fragment + ); + } + } + + if ( scripts.length ) { + jQuery.each( scripts, function( i, elem ) { + if ( elem.src ) { + jQuery.ajax({ + type: "GET", + global: false, + url: elem.src, + async: false, + dataType: "script" + }); + } else { + jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) ); + } + + if ( elem.parentNode ) { + elem.parentNode.removeChild( elem ); + } + }); + } + } + + return this; + } +}); + +function root( elem, cur ) { + return jQuery.nodeName(elem, "table") ? + (elem.getElementsByTagName("tbody")[0] || + elem.appendChild(elem.ownerDocument.createElement("tbody"))) : + elem; +} + +function cloneCopyEvent( src, dest ) { + + if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { + return; + } + + var type, i, l, + oldData = jQuery._data( src ), + curData = jQuery._data( dest, oldData ), + events = oldData.events; + + if ( events ) { + delete curData.handle; + curData.events = {}; + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + + // make the cloned public data object a copy from the original + if ( curData.data ) { + curData.data = jQuery.extend( {}, curData.data ); + } +} + +function cloneFixAttributes( src, dest ) { + var nodeName; + + // We do not need to do anything for non-Elements + if ( dest.nodeType !== 1 ) { + return; + } + + // clearAttributes removes the attributes, which we don't want, + // but also removes the attachEvent events, which we *do* want + if ( dest.clearAttributes ) { + dest.clearAttributes(); + } + + // mergeAttributes, in contrast, only merges back on the + // original attributes, not the events + if ( dest.mergeAttributes ) { + dest.mergeAttributes( src ); + } + + nodeName = dest.nodeName.toLowerCase(); + + // IE6-8 fail to clone children inside object elements that use + // the proprietary classid attribute value (rather than the type + // attribute) to identify the type of content to display + if ( nodeName === "object" ) { + dest.outerHTML = src.outerHTML; + + } else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) { + // IE6-8 fails to persist the checked state of a cloned checkbox + // or radio button. Worse, IE6-7 fail to give the cloned element + // a checked appearance if the defaultChecked value isn't also set + if ( src.checked ) { + dest.defaultChecked = dest.checked = src.checked; + } + + // IE6-7 get confused and end up setting the value of a cloned + // checkbox/radio button to an empty string instead of "on" + if ( dest.value !== src.value ) { + dest.value = src.value; + } + + // IE6-8 fails to return the selected option to the default selected + // state when cloning options + } else if ( nodeName === "option" ) { + dest.selected = src.defaultSelected; + + // IE6-8 fails to set the defaultValue to the correct value when + // cloning other types of input fields + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + + // IE blanks contents when cloning scripts + } else if ( nodeName === "script" && dest.text !== src.text ) { + dest.text = src.text; + } + + // Event data gets referenced instead of copied if the expando + // gets copied too + dest.removeAttribute( jQuery.expando ); + + // Clear flags for bubbling special change/submit events, they must + // be reattached when the newly cloned events are first activated + dest.removeAttribute( "_submit_attached" ); + dest.removeAttribute( "_change_attached" ); +} + +jQuery.buildFragment = function( args, nodes, scripts ) { + var fragment, cacheable, cacheresults, doc, + first = args[ 0 ]; + + // nodes may contain either an explicit document object, + // a jQuery collection or context object. + // If nodes[0] contains a valid object to assign to doc + if ( nodes && nodes[0] ) { + doc = nodes[0].ownerDocument || nodes[0]; + } + + // Ensure that an attr object doesn't incorrectly stand in as a document object + // Chrome and Firefox seem to allow this to occur and will throw exception + // Fixes #8950 + if ( !doc.createDocumentFragment ) { + doc = document; + } + + // Only cache "small" (1/2 KB) HTML strings that are associated with the main document + // Cloning options loses the selected state, so don't cache them + // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment + // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache + // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501 + if ( args.length === 1 && typeof first === "string" && first.length < 512 && doc === document && + first.charAt(0) === "<" && !rnocache.test( first ) && + (jQuery.support.checkClone || !rchecked.test( first )) && + (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) { + + cacheable = true; + + cacheresults = jQuery.fragments[ first ]; + if ( cacheresults && cacheresults !== 1 ) { + fragment = cacheresults; + } + } + + if ( !fragment ) { + fragment = doc.createDocumentFragment(); + jQuery.clean( args, doc, fragment, scripts ); + } + + if ( cacheable ) { + jQuery.fragments[ first ] = cacheresults ? fragment : 1; + } + + return { fragment: fragment, cacheable: cacheable }; +}; + +jQuery.fragments = {}; + +jQuery.each({ + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var ret = [], + insert = jQuery( selector ), + parent = this.length === 1 && this[0].parentNode; + + if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) { + insert[ original ]( this[0] ); + return this; + + } else { + for ( var i = 0, l = insert.length; i < l; i++ ) { + var elems = ( i > 0 ? this.clone(true) : this ).get(); + jQuery( insert[i] )[ original ]( elems ); + ret = ret.concat( elems ); + } + + return this.pushStack( ret, name, insert.selector ); + } + }; +}); + +function getAll( elem ) { + if ( typeof elem.getElementsByTagName !== "undefined" ) { + return elem.getElementsByTagName( "*" ); + + } else if ( typeof elem.querySelectorAll !== "undefined" ) { + return elem.querySelectorAll( "*" ); + + } else { + return []; + } +} + +// Used in clean, fixes the defaultChecked property +function fixDefaultChecked( elem ) { + if ( elem.type === "checkbox" || elem.type === "radio" ) { + elem.defaultChecked = elem.checked; + } +} +// Finds all inputs and passes them to fixDefaultChecked +function findInputs( elem ) { + var nodeName = ( elem.nodeName || "" ).toLowerCase(); + if ( nodeName === "input" ) { + fixDefaultChecked( elem ); + // Skip scripts, get other children + } else if ( nodeName !== "script" && typeof elem.getElementsByTagName !== "undefined" ) { + jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked ); + } +} + +// Derived From: http://www.iecss.com/shimprove/javascript/shimprove.1-0-1.js +function shimCloneNode( elem ) { + var div = document.createElement( "div" ); + safeFragment.appendChild( div ); + + div.innerHTML = elem.outerHTML; + return div.firstChild; +} + +jQuery.extend({ + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var srcElements, + destElements, + i, + // IE<=8 does not properly clone detached, unknown element nodes + clone = jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ? + elem.cloneNode( true ) : + shimCloneNode( elem ); + + if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && + (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { + // IE copies events bound via attachEvent when using cloneNode. + // Calling detachEvent on the clone will also remove the events + // from the original. In order to get around this, we use some + // proprietary methods to clear the events. Thanks to MooTools + // guys for this hotness. + + cloneFixAttributes( elem, clone ); + + // Using Sizzle here is crazy slow, so we use getElementsByTagName instead + srcElements = getAll( elem ); + destElements = getAll( clone ); + + // Weird iteration because IE will replace the length property + // with an element if you are cloning the body and one of the + // elements on the page has a name or id of "length" + for ( i = 0; srcElements[i]; ++i ) { + // Ensure that the destination node is not null; Fixes #9587 + if ( destElements[i] ) { + cloneFixAttributes( srcElements[i], destElements[i] ); + } + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + cloneCopyEvent( elem, clone ); + + if ( deepDataAndEvents ) { + srcElements = getAll( elem ); + destElements = getAll( clone ); + + for ( i = 0; srcElements[i]; ++i ) { + cloneCopyEvent( srcElements[i], destElements[i] ); + } + } + } + + srcElements = destElements = null; + + // Return the cloned set + return clone; + }, + + clean: function( elems, context, fragment, scripts ) { + var checkScriptType, script, j, + ret = []; + + context = context || document; + + // !context.createElement fails in IE with an error but returns typeof 'object' + if ( typeof context.createElement === "undefined" ) { + context = context.ownerDocument || context[0] && context[0].ownerDocument || document; + } + + for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { + if ( typeof elem === "number" ) { + elem += ""; + } + + if ( !elem ) { + continue; + } + + // Convert html string into DOM nodes + if ( typeof elem === "string" ) { + if ( !rhtml.test( elem ) ) { + elem = context.createTextNode( elem ); + } else { + // Fix "XHTML"-style tags in all browsers + elem = elem.replace(rxhtmlTag, "<$1></$2>"); + + // Trim whitespace, otherwise indexOf won't work as expected + var tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(), + wrap = wrapMap[ tag ] || wrapMap._default, + depth = wrap[0], + div = context.createElement("div"), + safeChildNodes = safeFragment.childNodes, + remove; + + // Append wrapper element to unknown element safe doc fragment + if ( context === document ) { + // Use the fragment we've already created for this document + safeFragment.appendChild( div ); + } else { + // Use a fragment created with the owner document + createSafeFragment( context ).appendChild( div ); + } + + // Go to html and back, then peel off extra wrappers + div.innerHTML = wrap[1] + elem + wrap[2]; + + // Move to the right depth + while ( depth-- ) { + div = div.lastChild; + } + + // Remove IE's autoinserted <tbody> from table fragments + if ( !jQuery.support.tbody ) { + + // String was a <table>, *may* have spurious <tbody> + var hasBody = rtbody.test(elem), + tbody = tag === "table" && !hasBody ? + div.firstChild && div.firstChild.childNodes : + + // String was a bare <thead> or <tfoot> + wrap[1] === "<table>" && !hasBody ? + div.childNodes : + []; + + for ( j = tbody.length - 1; j >= 0 ; --j ) { + if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { + tbody[ j ].parentNode.removeChild( tbody[ j ] ); + } + } + } + + // IE completely kills leading whitespace when innerHTML is used + if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { + div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); + } + + elem = div.childNodes; + + // Clear elements from DocumentFragment (safeFragment or otherwise) + // to avoid hoarding elements. Fixes #11356 + if ( div ) { + div.parentNode.removeChild( div ); + + // Guard against -1 index exceptions in FF3.6 + if ( safeChildNodes.length > 0 ) { + remove = safeChildNodes[ safeChildNodes.length - 1 ]; + + if ( remove && remove.parentNode ) { + remove.parentNode.removeChild( remove ); + } + } + } + } + } + + // Resets defaultChecked for any radios and checkboxes + // about to be appended to the DOM in IE 6/7 (#8060) + var len; + if ( !jQuery.support.appendChecked ) { + if ( elem[0] && typeof (len = elem.length) === "number" ) { + for ( j = 0; j < len; j++ ) { + findInputs( elem[j] ); + } + } else { + findInputs( elem ); + } + } + + if ( elem.nodeType ) { + ret.push( elem ); + } else { + ret = jQuery.merge( ret, elem ); + } + } + + if ( fragment ) { + checkScriptType = function( elem ) { + return !elem.type || rscriptType.test( elem.type ); + }; + for ( i = 0; ret[i]; i++ ) { + script = ret[i]; + if ( scripts && jQuery.nodeName( script, "script" ) && (!script.type || rscriptType.test( script.type )) ) { + scripts.push( script.parentNode ? script.parentNode.removeChild( script ) : script ); + + } else { + if ( script.nodeType === 1 ) { + var jsTags = jQuery.grep( script.getElementsByTagName( "script" ), checkScriptType ); + + ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) ); + } + fragment.appendChild( script ); + } + } + } + + return ret; + }, + + cleanData: function( elems ) { + var data, id, + cache = jQuery.cache, + special = jQuery.event.special, + deleteExpando = jQuery.support.deleteExpando; + + for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { + if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { + continue; + } + + id = elem[ jQuery.expando ]; + + if ( id ) { + data = cache[ id ]; + + if ( data && data.events ) { + for ( var type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + + // Null the DOM reference to avoid IE6/7/8 leak (#7054) + if ( data.handle ) { + data.handle.elem = null; + } + } + + if ( deleteExpando ) { + delete elem[ jQuery.expando ]; + + } else if ( elem.removeAttribute ) { + elem.removeAttribute( jQuery.expando ); + } + + delete cache[ id ]; + } + } + } +}); + + + + +var ralpha = /alpha\([^)]*\)/i, + ropacity = /opacity=([^)]*)/, + // fixed for IE9, see #8346 + rupper = /([A-Z]|^ms)/g, + rnum = /^[\-+]?(?:\d*\.)?\d+$/i, + rnumnonpx = /^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i, + rrelNum = /^([\-+])=([\-+.\de]+)/, + rmargin = /^margin/, + + cssShow = { position: "absolute", visibility: "hidden", display: "block" }, + + // order is important! + cssExpand = [ "Top", "Right", "Bottom", "Left" ], + + curCSS, + + getComputedStyle, + currentStyle; + +jQuery.fn.css = function( name, value ) { + return jQuery.access( this, function( elem, name, value ) { + return value !== undefined ? + jQuery.style( elem, name, value ) : + jQuery.css( elem, name ); + }, name, value, arguments.length > 1 ); +}; + +jQuery.extend({ + // Add in style property hooks for overriding the default + // behavior of getting and setting a style property + cssHooks: { + opacity: { + get: function( elem, computed ) { + if ( computed ) { + // We should always get a number back from opacity + var ret = curCSS( elem, "opacity" ); + return ret === "" ? "1" : ret; + + } else { + return elem.style.opacity; + } + } + } + }, + + // Exclude the following css properties to add px + cssNumber: { + "fillOpacity": true, + "fontWeight": true, + "lineHeight": true, + "opacity": true, + "orphans": true, + "widows": true, + "zIndex": true, + "zoom": true + }, + + // Add in properties whose names you wish to fix before + // setting or getting the value + cssProps: { + // normalize float css property + "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" + }, + + // Get and set the style property on a DOM Node + style: function( elem, name, value, extra ) { + // Don't set styles on text and comment nodes + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { + return; + } + + // Make sure that we're working with the right name + var ret, type, origName = jQuery.camelCase( name ), + style = elem.style, hooks = jQuery.cssHooks[ origName ]; + + name = jQuery.cssProps[ origName ] || origName; + + // Check if we're setting a value + if ( value !== undefined ) { + type = typeof value; + + // convert relative number strings (+= or -=) to relative numbers. #7345 + if ( type === "string" && (ret = rrelNum.exec( value )) ) { + value = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) ); + // Fixes bug #9237 + type = "number"; + } + + // Make sure that NaN and null values aren't set. See: #7116 + if ( value == null || type === "number" && isNaN( value ) ) { + return; + } + + // If a number was passed in, add 'px' to the (except for certain CSS properties) + if ( type === "number" && !jQuery.cssNumber[ origName ] ) { + value += "px"; + } + + // If a hook was provided, use that value, otherwise just set the specified value + if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) { + // Wrapped to prevent IE from throwing errors when 'invalid' values are provided + // Fixes bug #5509 + try { + style[ name ] = value; + } catch(e) {} + } + + } else { + // If a hook was provided get the non-computed value from there + if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { + return ret; + } + + // Otherwise just get the value from the style object + return style[ name ]; + } + }, + + css: function( elem, name, extra ) { + var ret, hooks; + + // Make sure that we're working with the right name + name = jQuery.camelCase( name ); + hooks = jQuery.cssHooks[ name ]; + name = jQuery.cssProps[ name ] || name; + + // cssFloat needs a special treatment + if ( name === "cssFloat" ) { + name = "float"; + } + + // If a hook was provided get the computed value from there + if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) { + return ret; + + // Otherwise, if a way to get the computed value exists, use that + } else if ( curCSS ) { + return curCSS( elem, name ); + } + }, + + // A method for quickly swapping in/out CSS properties to get correct calculations + swap: function( elem, options, callback ) { + var old = {}, + ret, name; + + // Remember the old values, and insert the new ones + for ( name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + ret = callback.call( elem ); + + // Revert the old values + for ( name in options ) { + elem.style[ name ] = old[ name ]; + } + + return ret; + } +}); + +// DEPRECATED in 1.3, Use jQuery.css() instead +jQuery.curCSS = jQuery.css; + +if ( document.defaultView && document.defaultView.getComputedStyle ) { + getComputedStyle = function( elem, name ) { + var ret, defaultView, computedStyle, width, + style = elem.style; + + name = name.replace( rupper, "-$1" ).toLowerCase(); + + if ( (defaultView = elem.ownerDocument.defaultView) && + (computedStyle = defaultView.getComputedStyle( elem, null )) ) { + + ret = computedStyle.getPropertyValue( name ); + if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) { + ret = jQuery.style( elem, name ); + } + } + + // A tribute to the "awesome hack by Dean Edwards" + // WebKit uses "computed value (percentage if specified)" instead of "used value" for margins + // which is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values + if ( !jQuery.support.pixelMargin && computedStyle && rmargin.test( name ) && rnumnonpx.test( ret ) ) { + width = style.width; + style.width = ret; + ret = computedStyle.width; + style.width = width; + } + + return ret; + }; +} + +if ( document.documentElement.currentStyle ) { + currentStyle = function( elem, name ) { + var left, rsLeft, uncomputed, + ret = elem.currentStyle && elem.currentStyle[ name ], + style = elem.style; + + // Avoid setting ret to empty string here + // so we don't default to auto + if ( ret == null && style && (uncomputed = style[ name ]) ) { + ret = uncomputed; + } + + // From the awesome hack by Dean Edwards + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 + + // If we're not dealing with a regular pixel number + // but a number that has a weird ending, we need to convert it to pixels + if ( rnumnonpx.test( ret ) ) { + + // Remember the original values + left = style.left; + rsLeft = elem.runtimeStyle && elem.runtimeStyle.left; + + // Put in the new values to get a computed value out + if ( rsLeft ) { + elem.runtimeStyle.left = elem.currentStyle.left; + } + style.left = name === "fontSize" ? "1em" : ret; + ret = style.pixelLeft + "px"; + + // Revert the changed values + style.left = left; + if ( rsLeft ) { + elem.runtimeStyle.left = rsLeft; + } + } + + return ret === "" ? "auto" : ret; + }; +} + +curCSS = getComputedStyle || currentStyle; + +function getWidthOrHeight( elem, name, extra ) { + + // Start with offset property + var val = name === "width" ? elem.offsetWidth : elem.offsetHeight, + i = name === "width" ? 1 : 0, + len = 4; + + if ( val > 0 ) { + if ( extra !== "border" ) { + for ( ; i < len; i += 2 ) { + if ( !extra ) { + val -= parseFloat( jQuery.css( elem, "padding" + cssExpand[ i ] ) ) || 0; + } + if ( extra === "margin" ) { + val += parseFloat( jQuery.css( elem, extra + cssExpand[ i ] ) ) || 0; + } else { + val -= parseFloat( jQuery.css( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; + } + } + } + + return val + "px"; + } + + // Fall back to computed then uncomputed css if necessary + val = curCSS( elem, name ); + if ( val < 0 || val == null ) { + val = elem.style[ name ]; + } + + // Computed unit is not pixels. Stop here and return. + if ( rnumnonpx.test(val) ) { + return val; + } + + // Normalize "", auto, and prepare for extra + val = parseFloat( val ) || 0; + + // Add padding, border, margin + if ( extra ) { + for ( ; i < len; i += 2 ) { + val += parseFloat( jQuery.css( elem, "padding" + cssExpand[ i ] ) ) || 0; + if ( extra !== "padding" ) { + val += parseFloat( jQuery.css( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; + } + if ( extra === "margin" ) { + val += parseFloat( jQuery.css( elem, extra + cssExpand[ i ]) ) || 0; + } + } + } + + return val + "px"; +} + +jQuery.each([ "height", "width" ], function( i, name ) { + jQuery.cssHooks[ name ] = { + get: function( elem, computed, extra ) { + if ( computed ) { + if ( elem.offsetWidth !== 0 ) { + return getWidthOrHeight( elem, name, extra ); + } else { + return jQuery.swap( elem, cssShow, function() { + return getWidthOrHeight( elem, name, extra ); + }); + } + } + }, + + set: function( elem, value ) { + return rnum.test( value ) ? + value + "px" : + value; + } + }; +}); + +if ( !jQuery.support.opacity ) { + jQuery.cssHooks.opacity = { + get: function( elem, computed ) { + // IE uses filters for opacity + return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? + ( parseFloat( RegExp.$1 ) / 100 ) + "" : + computed ? "1" : ""; + }, + + set: function( elem, value ) { + var style = elem.style, + currentStyle = elem.currentStyle, + opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", + filter = currentStyle && currentStyle.filter || style.filter || ""; + + // IE has trouble with opacity if it does not have layout + // Force it by setting the zoom level + style.zoom = 1; + + // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 + if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) { + + // Setting style.filter to null, "" & " " still leave "filter:" in the cssText + // if "filter:" is present at all, clearType is disabled, we want to avoid this + // style.removeAttribute is IE Only, but so apparently is this code path... + style.removeAttribute( "filter" ); + + // if there there is no filter style applied in a css rule, we are done + if ( currentStyle && !currentStyle.filter ) { + return; + } + } + + // otherwise, set new filter values + style.filter = ralpha.test( filter ) ? + filter.replace( ralpha, opacity ) : + filter + " " + opacity; + } + }; +} + +jQuery(function() { + // This hook cannot be added until DOM ready because the support test + // for it is not run until after DOM ready + if ( !jQuery.support.reliableMarginRight ) { + jQuery.cssHooks.marginRight = { + get: function( elem, computed ) { + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + // Work around by temporarily setting element display to inline-block + return jQuery.swap( elem, { "display": "inline-block" }, function() { + if ( computed ) { + return curCSS( elem, "margin-right" ); + } else { + return elem.style.marginRight; + } + }); + } + }; + } +}); + +if ( jQuery.expr && jQuery.expr.filters ) { + jQuery.expr.filters.hidden = function( elem ) { + var width = elem.offsetWidth, + height = elem.offsetHeight; + + return ( width === 0 && height === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none"); + }; + + jQuery.expr.filters.visible = function( elem ) { + return !jQuery.expr.filters.hidden( elem ); + }; +} + +// These hooks are used by animate to expand properties +jQuery.each({ + margin: "", + padding: "", + border: "Width" +}, function( prefix, suffix ) { + + jQuery.cssHooks[ prefix + suffix ] = { + expand: function( value ) { + var i, + + // assumes a single number if not a string + parts = typeof value === "string" ? value.split(" ") : [ value ], + expanded = {}; + + for ( i = 0; i < 4; i++ ) { + expanded[ prefix + cssExpand[ i ] + suffix ] = + parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; + } + + return expanded; + } + }; +}); + + + + +var r20 = /%20/g, + rbracket = /\[\]$/, + rCRLF = /\r?\n/g, + rhash = /#.*$/, + rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL + rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, + // #7653, #8125, #8152: local protocol detection + rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/, + rnoContent = /^(?:GET|HEAD)$/, + rprotocol = /^\/\//, + rquery = /\?/, + rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, + rselectTextarea = /^(?:select|textarea)/i, + rspacesAjax = /\s+/, + rts = /([?&])_=[^&]*/, + rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/, + + // Keep a copy of the old load method + _load = jQuery.fn.load, + + /* Prefilters + * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) + * 2) These are called: + * - BEFORE asking for a transport + * - AFTER param serialization (s.data is a string if s.processData is true) + * 3) key is the dataType + * 4) the catchall symbol "*" can be used + * 5) execution will start with transport dataType and THEN continue down to "*" if needed + */ + prefilters = {}, + + /* Transports bindings + * 1) key is the dataType + * 2) the catchall symbol "*" can be used + * 3) selection will start with transport dataType and THEN go to "*" if needed + */ + transports = {}, + + // Document location + ajaxLocation, + + // Document location segments + ajaxLocParts, + + // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression + allTypes = ["*/"] + ["*"]; + +// #8138, IE may throw an exception when accessing +// a field from window.location if document.domain has been set +try { + ajaxLocation = location.href; +} catch( e ) { + // Use the href attribute of an A element + // since IE will modify it given document.location + ajaxLocation = document.createElement( "a" ); + ajaxLocation.href = ""; + ajaxLocation = ajaxLocation.href; +} + +// Segment location into parts +ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; + +// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport +function addToPrefiltersOrTransports( structure ) { + + // dataTypeExpression is optional and defaults to "*" + return function( dataTypeExpression, func ) { + + if ( typeof dataTypeExpression !== "string" ) { + func = dataTypeExpression; + dataTypeExpression = "*"; + } + + if ( jQuery.isFunction( func ) ) { + var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ), + i = 0, + length = dataTypes.length, + dataType, + list, + placeBefore; + + // For each dataType in the dataTypeExpression + for ( ; i < length; i++ ) { + dataType = dataTypes[ i ]; + // We control if we're asked to add before + // any existing element + placeBefore = /^\+/.test( dataType ); + if ( placeBefore ) { + dataType = dataType.substr( 1 ) || "*"; + } + list = structure[ dataType ] = structure[ dataType ] || []; + // then we add to the structure accordingly + list[ placeBefore ? "unshift" : "push" ]( func ); + } + } + }; +} + +// Base inspection function for prefilters and transports +function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, + dataType /* internal */, inspected /* internal */ ) { + + dataType = dataType || options.dataTypes[ 0 ]; + inspected = inspected || {}; + + inspected[ dataType ] = true; + + var list = structure[ dataType ], + i = 0, + length = list ? list.length : 0, + executeOnly = ( structure === prefilters ), + selection; + + for ( ; i < length && ( executeOnly || !selection ); i++ ) { + selection = list[ i ]( options, originalOptions, jqXHR ); + // If we got redirected to another dataType + // we try there if executing only and not done already + if ( typeof selection === "string" ) { + if ( !executeOnly || inspected[ selection ] ) { + selection = undefined; + } else { + options.dataTypes.unshift( selection ); + selection = inspectPrefiltersOrTransports( + structure, options, originalOptions, jqXHR, selection, inspected ); + } + } + } + // If we're only executing or nothing was selected + // we try the catchall dataType if not done already + if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) { + selection = inspectPrefiltersOrTransports( + structure, options, originalOptions, jqXHR, "*", inspected ); + } + // unnecessary when only executing (prefilters) + // but it'll be ignored by the caller in that case + return selection; +} + +// A special extend for ajax options +// that takes "flat" options (not to be deep extended) +// Fixes #9887 +function ajaxExtend( target, src ) { + var key, deep, + flatOptions = jQuery.ajaxSettings.flatOptions || {}; + for ( key in src ) { + if ( src[ key ] !== undefined ) { + ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; + } + } + if ( deep ) { + jQuery.extend( true, target, deep ); + } +} + +jQuery.fn.extend({ + load: function( url, params, callback ) { + if ( typeof url !== "string" && _load ) { + return _load.apply( this, arguments ); + + // Don't do a request if no elements are being requested + } else if ( !this.length ) { + return this; + } + + var off = url.indexOf( " " ); + if ( off >= 0 ) { + var selector = url.slice( off, url.length ); + url = url.slice( 0, off ); + } + + // Default to a GET request + var type = "GET"; + + // If the second parameter was provided + if ( params ) { + // If it's a function + if ( jQuery.isFunction( params ) ) { + // We assume that it's the callback + callback = params; + params = undefined; + + // Otherwise, build a param string + } else if ( typeof params === "object" ) { + params = jQuery.param( params, jQuery.ajaxSettings.traditional ); + type = "POST"; + } + } + + var self = this; + + // Request the remote document + jQuery.ajax({ + url: url, + type: type, + dataType: "html", + data: params, + // Complete callback (responseText is used internally) + complete: function( jqXHR, status, responseText ) { + // Store the response as specified by the jqXHR object + responseText = jqXHR.responseText; + // If successful, inject the HTML into all the matched elements + if ( jqXHR.isResolved() ) { + // #4825: Get the actual response in case + // a dataFilter is present in ajaxSettings + jqXHR.done(function( r ) { + responseText = r; + }); + // See if a selector was specified + self.html( selector ? + // Create a dummy div to hold the results + jQuery("<div>") + // inject the contents of the document in, removing the scripts + // to avoid any 'Permission Denied' errors in IE + .append(responseText.replace(rscript, "")) + + // Locate the specified elements + .find(selector) : + + // If not, just inject the full result + responseText ); + } + + if ( callback ) { + self.each( callback, [ responseText, status, jqXHR ] ); + } + } + }); + + return this; + }, + + serialize: function() { + return jQuery.param( this.serializeArray() ); + }, + + serializeArray: function() { + return this.map(function(){ + return this.elements ? jQuery.makeArray( this.elements ) : this; + }) + .filter(function(){ + return this.name && !this.disabled && + ( this.checked || rselectTextarea.test( this.nodeName ) || + rinput.test( this.type ) ); + }) + .map(function( i, elem ){ + var val = jQuery( this ).val(); + + return val == null ? + null : + jQuery.isArray( val ) ? + jQuery.map( val, function( val, i ){ + return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + }) : + { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + }).get(); + } +}); + +// Attach a bunch of functions for handling common AJAX events +jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){ + jQuery.fn[ o ] = function( f ){ + return this.on( o, f ); + }; +}); + +jQuery.each( [ "get", "post" ], function( i, method ) { + jQuery[ method ] = function( url, data, callback, type ) { + // shift arguments if data argument was omitted + if ( jQuery.isFunction( data ) ) { + type = type || callback; + callback = data; + data = undefined; + } + + return jQuery.ajax({ + type: method, + url: url, + data: data, + success: callback, + dataType: type + }); + }; +}); + +jQuery.extend({ + + getScript: function( url, callback ) { + return jQuery.get( url, undefined, callback, "script" ); + }, + + getJSON: function( url, data, callback ) { + return jQuery.get( url, data, callback, "json" ); + }, + + // Creates a full fledged settings object into target + // with both ajaxSettings and settings fields. + // If target is omitted, writes into ajaxSettings. + ajaxSetup: function( target, settings ) { + if ( settings ) { + // Building a settings object + ajaxExtend( target, jQuery.ajaxSettings ); + } else { + // Extending ajaxSettings + settings = target; + target = jQuery.ajaxSettings; + } + ajaxExtend( target, settings ); + return target; + }, + + ajaxSettings: { + url: ajaxLocation, + isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), + global: true, + type: "GET", + contentType: "application/x-www-form-urlencoded; charset=UTF-8", + processData: true, + async: true, + /* + timeout: 0, + data: null, + dataType: null, + username: null, + password: null, + cache: null, + traditional: false, + headers: {}, + */ + + accepts: { + xml: "application/xml, text/xml", + html: "text/html", + text: "text/plain", + json: "application/json, text/javascript", + "*": allTypes + }, + + contents: { + xml: /xml/, + html: /html/, + json: /json/ + }, + + responseFields: { + xml: "responseXML", + text: "responseText" + }, + + // List of data converters + // 1) key format is "source_type destination_type" (a single space in-between) + // 2) the catchall symbol "*" can be used for source_type + converters: { + + // Convert anything to text + "* text": window.String, + + // Text to html (true = no transformation) + "text html": true, + + // Evaluate text as a json expression + "text json": jQuery.parseJSON, + + // Parse text as xml + "text xml": jQuery.parseXML + }, + + // For options that shouldn't be deep extended: + // you can add your own custom options here if + // and when you create one that shouldn't be + // deep extended (see ajaxExtend) + flatOptions: { + context: true, + url: true + } + }, + + ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), + ajaxTransport: addToPrefiltersOrTransports( transports ), + + // Main method + ajax: function( url, options ) { + + // If url is an object, simulate pre-1.5 signature + if ( typeof url === "object" ) { + options = url; + url = undefined; + } + + // Force options to be an object + options = options || {}; + + var // Create the final options object + s = jQuery.ajaxSetup( {}, options ), + // Callbacks context + callbackContext = s.context || s, + // Context for global events + // It's the callbackContext if one was provided in the options + // and if it's a DOM node or a jQuery collection + globalEventContext = callbackContext !== s && + ( callbackContext.nodeType || callbackContext instanceof jQuery ) ? + jQuery( callbackContext ) : jQuery.event, + // Deferreds + deferred = jQuery.Deferred(), + completeDeferred = jQuery.Callbacks( "once memory" ), + // Status-dependent callbacks + statusCode = s.statusCode || {}, + // ifModified key + ifModifiedKey, + // Headers (they are sent all at once) + requestHeaders = {}, + requestHeadersNames = {}, + // Response headers + responseHeadersString, + responseHeaders, + // transport + transport, + // timeout handle + timeoutTimer, + // Cross-domain detection vars + parts, + // The jqXHR state + state = 0, + // To know if global events are to be dispatched + fireGlobals, + // Loop variable + i, + // Fake xhr + jqXHR = { + + readyState: 0, + + // Caches the header + setRequestHeader: function( name, value ) { + if ( !state ) { + var lname = name.toLowerCase(); + name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; + requestHeaders[ name ] = value; + } + return this; + }, + + // Raw string + getAllResponseHeaders: function() { + return state === 2 ? responseHeadersString : null; + }, + + // Builds headers hashtable if needed + getResponseHeader: function( key ) { + var match; + if ( state === 2 ) { + if ( !responseHeaders ) { + responseHeaders = {}; + while( ( match = rheaders.exec( responseHeadersString ) ) ) { + responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; + } + } + match = responseHeaders[ key.toLowerCase() ]; + } + return match === undefined ? null : match; + }, + + // Overrides response content-type header + overrideMimeType: function( type ) { + if ( !state ) { + s.mimeType = type; + } + return this; + }, + + // Cancel the request + abort: function( statusText ) { + statusText = statusText || "abort"; + if ( transport ) { + transport.abort( statusText ); + } + done( 0, statusText ); + return this; + } + }; + + // Callback for when everything is done + // It is defined here because jslint complains if it is declared + // at the end of the function (which would be more logical and readable) + function done( status, nativeStatusText, responses, headers ) { + + // Called once + if ( state === 2 ) { + return; + } + + // State is "done" now + state = 2; + + // Clear timeout if it exists + if ( timeoutTimer ) { + clearTimeout( timeoutTimer ); + } + + // Dereference transport for early garbage collection + // (no matter how long the jqXHR object will be used) + transport = undefined; + + // Cache response headers + responseHeadersString = headers || ""; + + // Set readyState + jqXHR.readyState = status > 0 ? 4 : 0; + + var isSuccess, + success, + error, + statusText = nativeStatusText, + response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined, + lastModified, + etag; + + // If successful, handle type chaining + if ( status >= 200 && status < 300 || status === 304 ) { + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + + if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) { + jQuery.lastModified[ ifModifiedKey ] = lastModified; + } + if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) { + jQuery.etag[ ifModifiedKey ] = etag; + } + } + + // If not modified + if ( status === 304 ) { + + statusText = "notmodified"; + isSuccess = true; + + // If we have data + } else { + + try { + success = ajaxConvert( s, response ); + statusText = "success"; + isSuccess = true; + } catch(e) { + // We have a parsererror + statusText = "parsererror"; + error = e; + } + } + } else { + // We extract error from statusText + // then normalize statusText and status for non-aborts + error = statusText; + if ( !statusText || status ) { + statusText = "error"; + if ( status < 0 ) { + status = 0; + } + } + } + + // Set data for the fake xhr object + jqXHR.status = status; + jqXHR.statusText = "" + ( nativeStatusText || statusText ); + + // Success/Error + if ( isSuccess ) { + deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); + } else { + deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); + } + + // Status-dependent callbacks + jqXHR.statusCode( statusCode ); + statusCode = undefined; + + if ( fireGlobals ) { + globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ), + [ jqXHR, s, isSuccess ? success : error ] ); + } + + // Complete + completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); + + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); + // Handle the global AJAX counter + if ( !( --jQuery.active ) ) { + jQuery.event.trigger( "ajaxStop" ); + } + } + } + + // Attach deferreds + deferred.promise( jqXHR ); + jqXHR.success = jqXHR.done; + jqXHR.error = jqXHR.fail; + jqXHR.complete = completeDeferred.add; + + // Status-dependent callbacks + jqXHR.statusCode = function( map ) { + if ( map ) { + var tmp; + if ( state < 2 ) { + for ( tmp in map ) { + statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ]; + } + } else { + tmp = map[ jqXHR.status ]; + jqXHR.then( tmp, tmp ); + } + } + return this; + }; + + // Remove hash character (#7531: and string promotion) + // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) + // We also use the url parameter if available + s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); + + // Extract dataTypes list + s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax ); + + // Determine if a cross-domain request is in order + if ( s.crossDomain == null ) { + parts = rurl.exec( s.url.toLowerCase() ); + s.crossDomain = !!( parts && + ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] || + ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) != + ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) ) + ); + } + + // Convert data if not already a string + if ( s.data && s.processData && typeof s.data !== "string" ) { + s.data = jQuery.param( s.data, s.traditional ); + } + + // Apply prefilters + inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); + + // If request was aborted inside a prefilter, stop there + if ( state === 2 ) { + return false; + } + + // We can fire global events as of now if asked to + fireGlobals = s.global; + + // Uppercase the type + s.type = s.type.toUpperCase(); + + // Determine if request has content + s.hasContent = !rnoContent.test( s.type ); + + // Watch for a new set of requests + if ( fireGlobals && jQuery.active++ === 0 ) { + jQuery.event.trigger( "ajaxStart" ); + } + + // More options handling for requests with no content + if ( !s.hasContent ) { + + // If data is available, append data to url + if ( s.data ) { + s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data; + // #9682: remove data so that it's not used in an eventual retry + delete s.data; + } + + // Get ifModifiedKey before adding the anti-cache parameter + ifModifiedKey = s.url; + + // Add anti-cache in url if needed + if ( s.cache === false ) { + + var ts = jQuery.now(), + // try replacing _= if it is there + ret = s.url.replace( rts, "$1_=" + ts ); + + // if nothing was replaced, add timestamp to the end + s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" ); + } + } + + // Set the correct header, if data is being sent + if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { + jqXHR.setRequestHeader( "Content-Type", s.contentType ); + } + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + ifModifiedKey = ifModifiedKey || s.url; + if ( jQuery.lastModified[ ifModifiedKey ] ) { + jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] ); + } + if ( jQuery.etag[ ifModifiedKey ] ) { + jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] ); + } + } + + // Set the Accepts header for the server, depending on the dataType + jqXHR.setRequestHeader( + "Accept", + s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? + s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : + s.accepts[ "*" ] + ); + + // Check for headers option + for ( i in s.headers ) { + jqXHR.setRequestHeader( i, s.headers[ i ] ); + } + + // Allow custom headers/mimetypes and early abort + if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { + // Abort if not done already + jqXHR.abort(); + return false; + + } + + // Install callbacks on deferreds + for ( i in { success: 1, error: 1, complete: 1 } ) { + jqXHR[ i ]( s[ i ] ); + } + + // Get transport + transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); + + // If no transport, we auto-abort + if ( !transport ) { + done( -1, "No Transport" ); + } else { + jqXHR.readyState = 1; + // Send global event + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); + } + // Timeout + if ( s.async && s.timeout > 0 ) { + timeoutTimer = setTimeout( function(){ + jqXHR.abort( "timeout" ); + }, s.timeout ); + } + + try { + state = 1; + transport.send( requestHeaders, done ); + } catch (e) { + // Propagate exception as error if not done + if ( state < 2 ) { + done( -1, e ); + // Simply rethrow otherwise + } else { + throw e; + } + } + } + + return jqXHR; + }, + + // Serialize an array of form elements or a set of + // key/values into a query string + param: function( a, traditional ) { + var s = [], + add = function( key, value ) { + // If value is a function, invoke it and return its value + value = jQuery.isFunction( value ) ? value() : value; + s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); + }; + + // Set traditional to true for jQuery <= 1.3.2 behavior. + if ( traditional === undefined ) { + traditional = jQuery.ajaxSettings.traditional; + } + + // If an array was passed in, assume that it is an array of form elements. + if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { + // Serialize the form elements + jQuery.each( a, function() { + add( this.name, this.value ); + }); + + } else { + // If traditional, encode the "old" way (the way 1.3.2 or older + // did it), otherwise encode params recursively. + for ( var prefix in a ) { + buildParams( prefix, a[ prefix ], traditional, add ); + } + } + + // Return the resulting serialization + return s.join( "&" ).replace( r20, "+" ); + } +}); + +function buildParams( prefix, obj, traditional, add ) { + if ( jQuery.isArray( obj ) ) { + // Serialize array item. + jQuery.each( obj, function( i, v ) { + if ( traditional || rbracket.test( prefix ) ) { + // Treat each array item as a scalar. + add( prefix, v ); + + } else { + // If array item is non-scalar (array or object), encode its + // numeric index to resolve deserialization ambiguity issues. + // Note that rack (as of 1.0.0) can't currently deserialize + // nested arrays properly, and attempting to do so may cause + // a server error. Possible fixes are to modify rack's + // deserialization algorithm or to provide an option or flag + // to force array serialization to be shallow. + buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); + } + }); + + } else if ( !traditional && jQuery.type( obj ) === "object" ) { + // Serialize object item. + for ( var name in obj ) { + buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); + } + + } else { + // Serialize scalar item. + add( prefix, obj ); + } +} + +// This is still on the jQuery object... for now +// Want to move this to jQuery.ajax some day +jQuery.extend({ + + // Counter for holding the number of active queries + active: 0, + + // Last-Modified header cache for next request + lastModified: {}, + etag: {} + +}); + +/* Handles responses to an ajax request: + * - sets all responseXXX fields accordingly + * - finds the right dataType (mediates between content-type and expected dataType) + * - returns the corresponding response + */ +function ajaxHandleResponses( s, jqXHR, responses ) { + + var contents = s.contents, + dataTypes = s.dataTypes, + responseFields = s.responseFields, + ct, + type, + finalDataType, + firstDataType; + + // Fill responseXXX fields + for ( type in responseFields ) { + if ( type in responses ) { + jqXHR[ responseFields[type] ] = responses[ type ]; + } + } + + // Remove auto dataType and get content-type in the process + while( dataTypes[ 0 ] === "*" ) { + dataTypes.shift(); + if ( ct === undefined ) { + ct = s.mimeType || jqXHR.getResponseHeader( "content-type" ); + } + } + + // Check if we're dealing with a known content-type + if ( ct ) { + for ( type in contents ) { + if ( contents[ type ] && contents[ type ].test( ct ) ) { + dataTypes.unshift( type ); + break; + } + } + } + + // Check to see if we have a response for the expected dataType + if ( dataTypes[ 0 ] in responses ) { + finalDataType = dataTypes[ 0 ]; + } else { + // Try convertible dataTypes + for ( type in responses ) { + if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { + finalDataType = type; + break; + } + if ( !firstDataType ) { + firstDataType = type; + } + } + // Or just use first one + finalDataType = finalDataType || firstDataType; + } + + // If we found a dataType + // We add the dataType to the list if needed + // and return the corresponding response + if ( finalDataType ) { + if ( finalDataType !== dataTypes[ 0 ] ) { + dataTypes.unshift( finalDataType ); + } + return responses[ finalDataType ]; + } +} + +// Chain conversions given the request and the original response +function ajaxConvert( s, response ) { + + // Apply the dataFilter if provided + if ( s.dataFilter ) { + response = s.dataFilter( response, s.dataType ); + } + + var dataTypes = s.dataTypes, + converters = {}, + i, + key, + length = dataTypes.length, + tmp, + // Current and previous dataTypes + current = dataTypes[ 0 ], + prev, + // Conversion expression + conversion, + // Conversion function + conv, + // Conversion functions (transitive conversion) + conv1, + conv2; + + // For each dataType in the chain + for ( i = 1; i < length; i++ ) { + + // Create converters map + // with lowercased keys + if ( i === 1 ) { + for ( key in s.converters ) { + if ( typeof key === "string" ) { + converters[ key.toLowerCase() ] = s.converters[ key ]; + } + } + } + + // Get the dataTypes + prev = current; + current = dataTypes[ i ]; + + // If current is auto dataType, update it to prev + if ( current === "*" ) { + current = prev; + // If no auto and dataTypes are actually different + } else if ( prev !== "*" && prev !== current ) { + + // Get the converter + conversion = prev + " " + current; + conv = converters[ conversion ] || converters[ "* " + current ]; + + // If there is no direct converter, search transitively + if ( !conv ) { + conv2 = undefined; + for ( conv1 in converters ) { + tmp = conv1.split( " " ); + if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) { + conv2 = converters[ tmp[1] + " " + current ]; + if ( conv2 ) { + conv1 = converters[ conv1 ]; + if ( conv1 === true ) { + conv = conv2; + } else if ( conv2 === true ) { + conv = conv1; + } + break; + } + } + } + } + // If we found no converter, dispatch an error + if ( !( conv || conv2 ) ) { + jQuery.error( "No conversion from " + conversion.replace(" "," to ") ); + } + // If found converter is not an equivalence + if ( conv !== true ) { + // Convert with 1 or 2 converters accordingly + response = conv ? conv( response ) : conv2( conv1(response) ); + } + } + } + return response; +} + + + + +var jsc = jQuery.now(), + jsre = /(\=)\?(&|$)|\?\?/i; + +// Default jsonp settings +jQuery.ajaxSetup({ + jsonp: "callback", + jsonpCallback: function() { + return jQuery.expando + "_" + ( jsc++ ); + } +}); + +// Detect, normalize options and install callbacks for jsonp requests +jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { + + var inspectData = ( typeof s.data === "string" ) && /^application\/x\-www\-form\-urlencoded/.test( s.contentType ); + + if ( s.dataTypes[ 0 ] === "jsonp" || + s.jsonp !== false && ( jsre.test( s.url ) || + inspectData && jsre.test( s.data ) ) ) { + + var responseContainer, + jsonpCallback = s.jsonpCallback = + jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback, + previous = window[ jsonpCallback ], + url = s.url, + data = s.data, + replace = "$1" + jsonpCallback + "$2"; + + if ( s.jsonp !== false ) { + url = url.replace( jsre, replace ); + if ( s.url === url ) { + if ( inspectData ) { + data = data.replace( jsre, replace ); + } + if ( s.data === data ) { + // Add callback manually + url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback; + } + } + } + + s.url = url; + s.data = data; + + // Install callback + window[ jsonpCallback ] = function( response ) { + responseContainer = [ response ]; + }; + + // Clean-up function + jqXHR.always(function() { + // Set callback back to previous value + window[ jsonpCallback ] = previous; + // Call if it was a function and we have a response + if ( responseContainer && jQuery.isFunction( previous ) ) { + window[ jsonpCallback ]( responseContainer[ 0 ] ); + } + }); + + // Use data converter to retrieve json after script execution + s.converters["script json"] = function() { + if ( !responseContainer ) { + jQuery.error( jsonpCallback + " was not called" ); + } + return responseContainer[ 0 ]; + }; + + // force json dataType + s.dataTypes[ 0 ] = "json"; + + // Delegate to script + return "script"; + } +}); + + + + +// Install script dataType +jQuery.ajaxSetup({ + accepts: { + script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" + }, + contents: { + script: /javascript|ecmascript/ + }, + converters: { + "text script": function( text ) { + jQuery.globalEval( text ); + return text; + } + } +}); + +// Handle cache's special case and global +jQuery.ajaxPrefilter( "script", function( s ) { + if ( s.cache === undefined ) { + s.cache = false; + } + if ( s.crossDomain ) { + s.type = "GET"; + s.global = false; + } +}); + +// Bind script tag hack transport +jQuery.ajaxTransport( "script", function(s) { + + // This transport only deals with cross domain requests + if ( s.crossDomain ) { + + var script, + head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement; + + return { + + send: function( _, callback ) { + + script = document.createElement( "script" ); + + script.async = "async"; + + if ( s.scriptCharset ) { + script.charset = s.scriptCharset; + } + + script.src = s.url; + + // Attach handlers for all browsers + script.onload = script.onreadystatechange = function( _, isAbort ) { + + if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { + + // Handle memory leak in IE + script.onload = script.onreadystatechange = null; + + // Remove the script + if ( head && script.parentNode ) { + head.removeChild( script ); + } + + // Dereference the script + script = undefined; + + // Callback if not abort + if ( !isAbort ) { + callback( 200, "success" ); + } + } + }; + // Use insertBefore instead of appendChild to circumvent an IE6 bug. + // This arises when a base node is used (#2709 and #4378). + head.insertBefore( script, head.firstChild ); + }, + + abort: function() { + if ( script ) { + script.onload( 0, 1 ); + } + } + }; + } +}); + + + + +var // #5280: Internet Explorer will keep connections alive if we don't abort on unload + xhrOnUnloadAbort = window.ActiveXObject ? function() { + // Abort all pending requests + for ( var key in xhrCallbacks ) { + xhrCallbacks[ key ]( 0, 1 ); + } + } : false, + xhrId = 0, + xhrCallbacks; + +// Functions to create xhrs +function createStandardXHR() { + try { + return new window.XMLHttpRequest(); + } catch( e ) {} +} + +function createActiveXHR() { + try { + return new window.ActiveXObject( "Microsoft.XMLHTTP" ); + } catch( e ) {} +} + +// Create the request object +// (This is still attached to ajaxSettings for backward compatibility) +jQuery.ajaxSettings.xhr = window.ActiveXObject ? + /* Microsoft failed to properly + * implement the XMLHttpRequest in IE7 (can't request local files), + * so we use the ActiveXObject when it is available + * Additionally XMLHttpRequest can be disabled in IE7/IE8 so + * we need a fallback. + */ + function() { + return !this.isLocal && createStandardXHR() || createActiveXHR(); + } : + // For all other browsers, use the standard XMLHttpRequest object + createStandardXHR; + +// Determine support properties +(function( xhr ) { + jQuery.extend( jQuery.support, { + ajax: !!xhr, + cors: !!xhr && ( "withCredentials" in xhr ) + }); +})( jQuery.ajaxSettings.xhr() ); + +// Create transport if the browser can provide an xhr +if ( jQuery.support.ajax ) { + + jQuery.ajaxTransport(function( s ) { + // Cross domain only allowed if supported through XMLHttpRequest + if ( !s.crossDomain || jQuery.support.cors ) { + + var callback; + + return { + send: function( headers, complete ) { + + // Get a new xhr + var xhr = s.xhr(), + handle, + i; + + // Open the socket + // Passing null username, generates a login popup on Opera (#2865) + if ( s.username ) { + xhr.open( s.type, s.url, s.async, s.username, s.password ); + } else { + xhr.open( s.type, s.url, s.async ); + } + + // Apply custom fields if provided + if ( s.xhrFields ) { + for ( i in s.xhrFields ) { + xhr[ i ] = s.xhrFields[ i ]; + } + } + + // Override mime type if needed + if ( s.mimeType && xhr.overrideMimeType ) { + xhr.overrideMimeType( s.mimeType ); + } + + // X-Requested-With header + // For cross-domain requests, seeing as conditions for a preflight are + // akin to a jigsaw puzzle, we simply never set it to be sure. + // (it can always be set on a per-request basis or even using ajaxSetup) + // For same-domain requests, won't change header if already provided. + if ( !s.crossDomain && !headers["X-Requested-With"] ) { + headers[ "X-Requested-With" ] = "XMLHttpRequest"; + } + + // Need an extra try/catch for cross domain requests in Firefox 3 + try { + for ( i in headers ) { + xhr.setRequestHeader( i, headers[ i ] ); + } + } catch( _ ) {} + + // Do send the request + // This may raise an exception which is actually + // handled in jQuery.ajax (so no try/catch here) + xhr.send( ( s.hasContent && s.data ) || null ); + + // Listener + callback = function( _, isAbort ) { + + var status, + statusText, + responseHeaders, + responses, + xml; + + // Firefox throws exceptions when accessing properties + // of an xhr when a network error occured + // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) + try { + + // Was never called and is aborted or complete + if ( callback && ( isAbort || xhr.readyState === 4 ) ) { + + // Only called once + callback = undefined; + + // Do not keep as active anymore + if ( handle ) { + xhr.onreadystatechange = jQuery.noop; + if ( xhrOnUnloadAbort ) { + delete xhrCallbacks[ handle ]; + } + } + + // If it's an abort + if ( isAbort ) { + // Abort it manually if needed + if ( xhr.readyState !== 4 ) { + xhr.abort(); + } + } else { + status = xhr.status; + responseHeaders = xhr.getAllResponseHeaders(); + responses = {}; + xml = xhr.responseXML; + + // Construct response list + if ( xml && xml.documentElement /* #4958 */ ) { + responses.xml = xml; + } + + // When requesting binary data, IE6-9 will throw an exception + // on any attempt to access responseText (#11426) + try { + responses.text = xhr.responseText; + } catch( _ ) { + } + + // Firefox throws an exception when accessing + // statusText for faulty cross-domain requests + try { + statusText = xhr.statusText; + } catch( e ) { + // We normalize with Webkit giving an empty statusText + statusText = ""; + } + + // Filter status for non standard behaviors + + // If the request is local and we have data: assume a success + // (success with no data won't get notified, that's the best we + // can do given current implementations) + if ( !status && s.isLocal && !s.crossDomain ) { + status = responses.text ? 200 : 404; + // IE - #1450: sometimes returns 1223 when it should be 204 + } else if ( status === 1223 ) { + status = 204; + } + } + } + } catch( firefoxAccessException ) { + if ( !isAbort ) { + complete( -1, firefoxAccessException ); + } + } + + // Call complete if needed + if ( responses ) { + complete( status, statusText, responses, responseHeaders ); + } + }; + + // if we're in sync mode or it's in cache + // and has been retrieved directly (IE6 & IE7) + // we need to manually fire the callback + if ( !s.async || xhr.readyState === 4 ) { + callback(); + } else { + handle = ++xhrId; + if ( xhrOnUnloadAbort ) { + // Create the active xhrs callbacks list if needed + // and attach the unload handler + if ( !xhrCallbacks ) { + xhrCallbacks = {}; + jQuery( window ).unload( xhrOnUnloadAbort ); + } + // Add to list of active xhrs callbacks + xhrCallbacks[ handle ] = callback; + } + xhr.onreadystatechange = callback; + } + }, + + abort: function() { + if ( callback ) { + callback(0,1); + } + } + }; + } + }); +} + + + + +var elemdisplay = {}, + iframe, iframeDoc, + rfxtypes = /^(?:toggle|show|hide)$/, + rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i, + timerId, + fxAttrs = [ + // height animations + [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ], + // width animations + [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ], + // opacity animations + [ "opacity" ] + ], + fxNow; + +jQuery.fn.extend({ + show: function( speed, easing, callback ) { + var elem, display; + + if ( speed || speed === 0 ) { + return this.animate( genFx("show", 3), speed, easing, callback ); + + } else { + for ( var i = 0, j = this.length; i < j; i++ ) { + elem = this[ i ]; + + if ( elem.style ) { + display = elem.style.display; + + // Reset the inline display of this element to learn if it is + // being hidden by cascaded rules or not + if ( !jQuery._data(elem, "olddisplay") && display === "none" ) { + display = elem.style.display = ""; + } + + // Set elements which have been overridden with display: none + // in a stylesheet to whatever the default browser style is + // for such an element + if ( (display === "" && jQuery.css(elem, "display") === "none") || + !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) { + jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) ); + } + } + } + + // Set the display of most of the elements in a second loop + // to avoid the constant reflow + for ( i = 0; i < j; i++ ) { + elem = this[ i ]; + + if ( elem.style ) { + display = elem.style.display; + + if ( display === "" || display === "none" ) { + elem.style.display = jQuery._data( elem, "olddisplay" ) || ""; + } + } + } + + return this; + } + }, + + hide: function( speed, easing, callback ) { + if ( speed || speed === 0 ) { + return this.animate( genFx("hide", 3), speed, easing, callback); + + } else { + var elem, display, + i = 0, + j = this.length; + + for ( ; i < j; i++ ) { + elem = this[i]; + if ( elem.style ) { + display = jQuery.css( elem, "display" ); + + if ( display !== "none" && !jQuery._data( elem, "olddisplay" ) ) { + jQuery._data( elem, "olddisplay", display ); + } + } + } + + // Set the display of the elements in a second loop + // to avoid the constant reflow + for ( i = 0; i < j; i++ ) { + if ( this[i].style ) { + this[i].style.display = "none"; + } + } + + return this; + } + }, + + // Save the old toggle function + _toggle: jQuery.fn.toggle, + + toggle: function( fn, fn2, callback ) { + var bool = typeof fn === "boolean"; + + if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) { + this._toggle.apply( this, arguments ); + + } else if ( fn == null || bool ) { + this.each(function() { + var state = bool ? fn : jQuery(this).is(":hidden"); + jQuery(this)[ state ? "show" : "hide" ](); + }); + + } else { + this.animate(genFx("toggle", 3), fn, fn2, callback); + } + + return this; + }, + + fadeTo: function( speed, to, easing, callback ) { + return this.filter(":hidden").css("opacity", 0).show().end() + .animate({opacity: to}, speed, easing, callback); + }, + + animate: function( prop, speed, easing, callback ) { + var optall = jQuery.speed( speed, easing, callback ); + + if ( jQuery.isEmptyObject( prop ) ) { + return this.each( optall.complete, [ false ] ); + } + + // Do not change referenced properties as per-property easing will be lost + prop = jQuery.extend( {}, prop ); + + function doAnimation() { + // XXX 'this' does not always have a nodeName when running the + // test suite + + if ( optall.queue === false ) { + jQuery._mark( this ); + } + + var opt = jQuery.extend( {}, optall ), + isElement = this.nodeType === 1, + hidden = isElement && jQuery(this).is(":hidden"), + name, val, p, e, hooks, replace, + parts, start, end, unit, + method; + + // will store per property easing and be used to determine when an animation is complete + opt.animatedProperties = {}; + + // first pass over propertys to expand / normalize + for ( p in prop ) { + name = jQuery.camelCase( p ); + if ( p !== name ) { + prop[ name ] = prop[ p ]; + delete prop[ p ]; + } + + if ( ( hooks = jQuery.cssHooks[ name ] ) && "expand" in hooks ) { + replace = hooks.expand( prop[ name ] ); + delete prop[ name ]; + + // not quite $.extend, this wont overwrite keys already present. + // also - reusing 'p' from above because we have the correct "name" + for ( p in replace ) { + if ( ! ( p in prop ) ) { + prop[ p ] = replace[ p ]; + } + } + } + } + + for ( name in prop ) { + val = prop[ name ]; + // easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default) + if ( jQuery.isArray( val ) ) { + opt.animatedProperties[ name ] = val[ 1 ]; + val = prop[ name ] = val[ 0 ]; + } else { + opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || 'swing'; + } + + if ( val === "hide" && hidden || val === "show" && !hidden ) { + return opt.complete.call( this ); + } + + if ( isElement && ( name === "height" || name === "width" ) ) { + // Make sure that nothing sneaks out + // Record all 3 overflow attributes because IE does not + // change the overflow attribute when overflowX and + // overflowY are set to the same value + opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ]; + + // Set display property to inline-block for height/width + // animations on inline elements that are having width/height animated + if ( jQuery.css( this, "display" ) === "inline" && + jQuery.css( this, "float" ) === "none" ) { + + // inline-level elements accept inline-block; + // block-level elements need to be inline with layout + if ( !jQuery.support.inlineBlockNeedsLayout || defaultDisplay( this.nodeName ) === "inline" ) { + this.style.display = "inline-block"; + + } else { + this.style.zoom = 1; + } + } + } + } + + if ( opt.overflow != null ) { + this.style.overflow = "hidden"; + } + + for ( p in prop ) { + e = new jQuery.fx( this, opt, p ); + val = prop[ p ]; + + if ( rfxtypes.test( val ) ) { + + // Tracks whether to show or hide based on private + // data attached to the element + method = jQuery._data( this, "toggle" + p ) || ( val === "toggle" ? hidden ? "show" : "hide" : 0 ); + if ( method ) { + jQuery._data( this, "toggle" + p, method === "show" ? "hide" : "show" ); + e[ method ](); + } else { + e[ val ](); + } + + } else { + parts = rfxnum.exec( val ); + start = e.cur(); + + if ( parts ) { + end = parseFloat( parts[2] ); + unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" ); + + // We need to compute starting value + if ( unit !== "px" ) { + jQuery.style( this, p, (end || 1) + unit); + start = ( (end || 1) / e.cur() ) * start; + jQuery.style( this, p, start + unit); + } + + // If a +=/-= token was provided, we're doing a relative animation + if ( parts[1] ) { + end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start; + } + + e.custom( start, end, unit ); + + } else { + e.custom( start, val, "" ); + } + } + } + + // For JS strict compliance + return true; + } + + return optall.queue === false ? + this.each( doAnimation ) : + this.queue( optall.queue, doAnimation ); + }, + + stop: function( type, clearQueue, gotoEnd ) { + if ( typeof type !== "string" ) { + gotoEnd = clearQueue; + clearQueue = type; + type = undefined; + } + if ( clearQueue && type !== false ) { + this.queue( type || "fx", [] ); + } + + return this.each(function() { + var index, + hadTimers = false, + timers = jQuery.timers, + data = jQuery._data( this ); + + // clear marker counters if we know they won't be + if ( !gotoEnd ) { + jQuery._unmark( true, this ); + } + + function stopQueue( elem, data, index ) { + var hooks = data[ index ]; + jQuery.removeData( elem, index, true ); + hooks.stop( gotoEnd ); + } + + if ( type == null ) { + for ( index in data ) { + if ( data[ index ] && data[ index ].stop && index.indexOf(".run") === index.length - 4 ) { + stopQueue( this, data, index ); + } + } + } else if ( data[ index = type + ".run" ] && data[ index ].stop ){ + stopQueue( this, data, index ); + } + + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { + if ( gotoEnd ) { + + // force the next step to be the last + timers[ index ]( true ); + } else { + timers[ index ].saveState(); + } + hadTimers = true; + timers.splice( index, 1 ); + } + } + + // start the next in the queue if the last step wasn't forced + // timers currently will call their complete callbacks, which will dequeue + // but only if they were gotoEnd + if ( !( gotoEnd && hadTimers ) ) { + jQuery.dequeue( this, type ); + } + }); + } + +}); + +// Animations created synchronously will run synchronously +function createFxNow() { + setTimeout( clearFxNow, 0 ); + return ( fxNow = jQuery.now() ); +} + +function clearFxNow() { + fxNow = undefined; +} + +// Generate parameters to create a standard animation +function genFx( type, num ) { + var obj = {}; + + jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice( 0, num )), function() { + obj[ this ] = type; + }); + + return obj; +} + +// Generate shortcuts for custom animations +jQuery.each({ + slideDown: genFx( "show", 1 ), + slideUp: genFx( "hide", 1 ), + slideToggle: genFx( "toggle", 1 ), + fadeIn: { opacity: "show" }, + fadeOut: { opacity: "hide" }, + fadeToggle: { opacity: "toggle" } +}, function( name, props ) { + jQuery.fn[ name ] = function( speed, easing, callback ) { + return this.animate( props, speed, easing, callback ); + }; +}); + +jQuery.extend({ + speed: function( speed, easing, fn ) { + var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { + complete: fn || !fn && easing || + jQuery.isFunction( speed ) && speed, + duration: speed, + easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing + }; + + opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : + opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; + + // normalize opt.queue - true/undefined/null -> "fx" + if ( opt.queue == null || opt.queue === true ) { + opt.queue = "fx"; + } + + // Queueing + opt.old = opt.complete; + + opt.complete = function( noUnmark ) { + if ( jQuery.isFunction( opt.old ) ) { + opt.old.call( this ); + } + + if ( opt.queue ) { + jQuery.dequeue( this, opt.queue ); + } else if ( noUnmark !== false ) { + jQuery._unmark( this ); + } + }; + + return opt; + }, + + easing: { + linear: function( p ) { + return p; + }, + swing: function( p ) { + return ( -Math.cos( p*Math.PI ) / 2 ) + 0.5; + } + }, + + timers: [], + + fx: function( elem, options, prop ) { + this.options = options; + this.elem = elem; + this.prop = prop; + + options.orig = options.orig || {}; + } + +}); + +jQuery.fx.prototype = { + // Simple function for setting a style value + update: function() { + if ( this.options.step ) { + this.options.step.call( this.elem, this.now, this ); + } + + ( jQuery.fx.step[ this.prop ] || jQuery.fx.step._default )( this ); + }, + + // Get the current size + cur: function() { + if ( this.elem[ this.prop ] != null && (!this.elem.style || this.elem.style[ this.prop ] == null) ) { + return this.elem[ this.prop ]; + } + + var parsed, + r = jQuery.css( this.elem, this.prop ); + // Empty strings, null, undefined and "auto" are converted to 0, + // complex values such as "rotate(1rad)" are returned as is, + // simple values such as "10px" are parsed to Float. + return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed; + }, + + // Start an animation from one number to another + custom: function( from, to, unit ) { + var self = this, + fx = jQuery.fx; + + this.startTime = fxNow || createFxNow(); + this.end = to; + this.now = this.start = from; + this.pos = this.state = 0; + this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" ); + + function t( gotoEnd ) { + return self.step( gotoEnd ); + } + + t.queue = this.options.queue; + t.elem = this.elem; + t.saveState = function() { + if ( jQuery._data( self.elem, "fxshow" + self.prop ) === undefined ) { + if ( self.options.hide ) { + jQuery._data( self.elem, "fxshow" + self.prop, self.start ); + } else if ( self.options.show ) { + jQuery._data( self.elem, "fxshow" + self.prop, self.end ); + } + } + }; + + if ( t() && jQuery.timers.push(t) && !timerId ) { + timerId = setInterval( fx.tick, fx.interval ); + } + }, + + // Simple 'show' function + show: function() { + var dataShow = jQuery._data( this.elem, "fxshow" + this.prop ); + + // Remember where we started, so that we can go back to it later + this.options.orig[ this.prop ] = dataShow || jQuery.style( this.elem, this.prop ); + this.options.show = true; + + // Begin the animation + // Make sure that we start at a small width/height to avoid any flash of content + if ( dataShow !== undefined ) { + // This show is picking up where a previous hide or show left off + this.custom( this.cur(), dataShow ); + } else { + this.custom( this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur() ); + } + + // Start by showing the element + jQuery( this.elem ).show(); + }, + + // Simple 'hide' function + hide: function() { + // Remember where we started, so that we can go back to it later + this.options.orig[ this.prop ] = jQuery._data( this.elem, "fxshow" + this.prop ) || jQuery.style( this.elem, this.prop ); + this.options.hide = true; + + // Begin the animation + this.custom( this.cur(), 0 ); + }, + + // Each step of an animation + step: function( gotoEnd ) { + var p, n, complete, + t = fxNow || createFxNow(), + done = true, + elem = this.elem, + options = this.options; + + if ( gotoEnd || t >= options.duration + this.startTime ) { + this.now = this.end; + this.pos = this.state = 1; + this.update(); + + options.animatedProperties[ this.prop ] = true; + + for ( p in options.animatedProperties ) { + if ( options.animatedProperties[ p ] !== true ) { + done = false; + } + } + + if ( done ) { + // Reset the overflow + if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) { + + jQuery.each( [ "", "X", "Y" ], function( index, value ) { + elem.style[ "overflow" + value ] = options.overflow[ index ]; + }); + } + + // Hide the element if the "hide" operation was done + if ( options.hide ) { + jQuery( elem ).hide(); + } + + // Reset the properties, if the item has been hidden or shown + if ( options.hide || options.show ) { + for ( p in options.animatedProperties ) { + jQuery.style( elem, p, options.orig[ p ] ); + jQuery.removeData( elem, "fxshow" + p, true ); + // Toggle data is no longer needed + jQuery.removeData( elem, "toggle" + p, true ); + } + } + + // Execute the complete function + // in the event that the complete function throws an exception + // we must ensure it won't be called twice. #5684 + + complete = options.complete; + if ( complete ) { + + options.complete = false; + complete.call( elem ); + } + } + + return false; + + } else { + // classical easing cannot be used with an Infinity duration + if ( options.duration == Infinity ) { + this.now = t; + } else { + n = t - this.startTime; + this.state = n / options.duration; + + // Perform the easing function, defaults to swing + this.pos = jQuery.easing[ options.animatedProperties[this.prop] ]( this.state, n, 0, 1, options.duration ); + this.now = this.start + ( (this.end - this.start) * this.pos ); + } + // Perform the next step of the animation + this.update(); + } + + return true; + } +}; + +jQuery.extend( jQuery.fx, { + tick: function() { + var timer, + timers = jQuery.timers, + i = 0; + + for ( ; i < timers.length; i++ ) { + timer = timers[ i ]; + // Checks the timer has not already been removed + if ( !timer() && timers[ i ] === timer ) { + timers.splice( i--, 1 ); + } + } + + if ( !timers.length ) { + jQuery.fx.stop(); + } + }, + + interval: 13, + + stop: function() { + clearInterval( timerId ); + timerId = null; + }, + + speeds: { + slow: 600, + fast: 200, + // Default speed + _default: 400 + }, + + step: { + opacity: function( fx ) { + jQuery.style( fx.elem, "opacity", fx.now ); + }, + + _default: function( fx ) { + if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) { + fx.elem.style[ fx.prop ] = fx.now + fx.unit; + } else { + fx.elem[ fx.prop ] = fx.now; + } + } + } +}); + +// Ensure props that can't be negative don't go there on undershoot easing +jQuery.each( fxAttrs.concat.apply( [], fxAttrs ), function( i, prop ) { + // exclude marginTop, marginLeft, marginBottom and marginRight from this list + if ( prop.indexOf( "margin" ) ) { + jQuery.fx.step[ prop ] = function( fx ) { + jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit ); + }; + } +}); + +if ( jQuery.expr && jQuery.expr.filters ) { + jQuery.expr.filters.animated = function( elem ) { + return jQuery.grep(jQuery.timers, function( fn ) { + return elem === fn.elem; + }).length; + }; +} + +// Try to restore the default display value of an element +function defaultDisplay( nodeName ) { + + if ( !elemdisplay[ nodeName ] ) { + + var body = document.body, + elem = jQuery( "<" + nodeName + ">" ).appendTo( body ), + display = elem.css( "display" ); + elem.remove(); + + // If the simple way fails, + // get element's real default display by attaching it to a temp iframe + if ( display === "none" || display === "" ) { + // No iframe to use yet, so create it + if ( !iframe ) { + iframe = document.createElement( "iframe" ); + iframe.frameBorder = iframe.width = iframe.height = 0; + } + + body.appendChild( iframe ); + + // Create a cacheable copy of the iframe document on first call. + // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML + // document to it; WebKit & Firefox won't allow reusing the iframe document. + if ( !iframeDoc || !iframe.createElement ) { + iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document; + iframeDoc.write( ( jQuery.support.boxModel ? "<!doctype html>" : "" ) + "<html><body>" ); + iframeDoc.close(); + } + + elem = iframeDoc.createElement( nodeName ); + + iframeDoc.body.appendChild( elem ); + + display = jQuery.css( elem, "display" ); + body.removeChild( iframe ); + } + + // Store the correct default display + elemdisplay[ nodeName ] = display; + } + + return elemdisplay[ nodeName ]; +} + + + + +var getOffset, + rtable = /^t(?:able|d|h)$/i, + rroot = /^(?:body|html)$/i; + +if ( "getBoundingClientRect" in document.documentElement ) { + getOffset = function( elem, doc, docElem, box ) { + try { + box = elem.getBoundingClientRect(); + } catch(e) {} + + // Make sure we're not dealing with a disconnected DOM node + if ( !box || !jQuery.contains( docElem, elem ) ) { + return box ? { top: box.top, left: box.left } : { top: 0, left: 0 }; + } + + var body = doc.body, + win = getWindow( doc ), + clientTop = docElem.clientTop || body.clientTop || 0, + clientLeft = docElem.clientLeft || body.clientLeft || 0, + scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop, + scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft, + top = box.top + scrollTop - clientTop, + left = box.left + scrollLeft - clientLeft; + + return { top: top, left: left }; + }; + +} else { + getOffset = function( elem, doc, docElem ) { + var computedStyle, + offsetParent = elem.offsetParent, + prevOffsetParent = elem, + body = doc.body, + defaultView = doc.defaultView, + prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle, + top = elem.offsetTop, + left = elem.offsetLeft; + + while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) { + if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) { + break; + } + + computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle; + top -= elem.scrollTop; + left -= elem.scrollLeft; + + if ( elem === offsetParent ) { + top += elem.offsetTop; + left += elem.offsetLeft; + + if ( jQuery.support.doesNotAddBorder && !(jQuery.support.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) { + top += parseFloat( computedStyle.borderTopWidth ) || 0; + left += parseFloat( computedStyle.borderLeftWidth ) || 0; + } + + prevOffsetParent = offsetParent; + offsetParent = elem.offsetParent; + } + + if ( jQuery.support.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) { + top += parseFloat( computedStyle.borderTopWidth ) || 0; + left += parseFloat( computedStyle.borderLeftWidth ) || 0; + } + + prevComputedStyle = computedStyle; + } + + if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) { + top += body.offsetTop; + left += body.offsetLeft; + } + + if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) { + top += Math.max( docElem.scrollTop, body.scrollTop ); + left += Math.max( docElem.scrollLeft, body.scrollLeft ); + } + + return { top: top, left: left }; + }; +} + +jQuery.fn.offset = function( options ) { + if ( arguments.length ) { + return options === undefined ? + this : + this.each(function( i ) { + jQuery.offset.setOffset( this, options, i ); + }); + } + + var elem = this[0], + doc = elem && elem.ownerDocument; + + if ( !doc ) { + return null; + } + + if ( elem === doc.body ) { + return jQuery.offset.bodyOffset( elem ); + } + + return getOffset( elem, doc, doc.documentElement ); +}; + +jQuery.offset = { + + bodyOffset: function( body ) { + var top = body.offsetTop, + left = body.offsetLeft; + + if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) { + top += parseFloat( jQuery.css(body, "marginTop") ) || 0; + left += parseFloat( jQuery.css(body, "marginLeft") ) || 0; + } + + return { top: top, left: left }; + }, + + setOffset: function( elem, options, i ) { + var position = jQuery.css( elem, "position" ); + + // set position first, in-case top/left are set even on static elem + if ( position === "static" ) { + elem.style.position = "relative"; + } + + var curElem = jQuery( elem ), + curOffset = curElem.offset(), + curCSSTop = jQuery.css( elem, "top" ), + curCSSLeft = jQuery.css( elem, "left" ), + calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, + props = {}, curPosition = {}, curTop, curLeft; + + // need to be able to calculate position if either top or left is auto and position is either absolute or fixed + if ( calculatePosition ) { + curPosition = curElem.position(); + curTop = curPosition.top; + curLeft = curPosition.left; + } else { + curTop = parseFloat( curCSSTop ) || 0; + curLeft = parseFloat( curCSSLeft ) || 0; + } + + if ( jQuery.isFunction( options ) ) { + options = options.call( elem, i, curOffset ); + } + + if ( options.top != null ) { + props.top = ( options.top - curOffset.top ) + curTop; + } + if ( options.left != null ) { + props.left = ( options.left - curOffset.left ) + curLeft; + } + + if ( "using" in options ) { + options.using.call( elem, props ); + } else { + curElem.css( props ); + } + } +}; + + +jQuery.fn.extend({ + + position: function() { + if ( !this[0] ) { + return null; + } + + var elem = this[0], + + // Get *real* offsetParent + offsetParent = this.offsetParent(), + + // Get correct offsets + offset = this.offset(), + parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); + + // Subtract element margins + // note: when an element has margin: auto the offsetLeft and marginLeft + // are the same in Safari causing offset.left to incorrectly be 0 + offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0; + offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0; + + // Add offsetParent borders + parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0; + parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0; + + // Subtract the two offsets + return { + top: offset.top - parentOffset.top, + left: offset.left - parentOffset.left + }; + }, + + offsetParent: function() { + return this.map(function() { + var offsetParent = this.offsetParent || document.body; + while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) { + offsetParent = offsetParent.offsetParent; + } + return offsetParent; + }); + } +}); + + +// Create scrollLeft and scrollTop methods +jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) { + var top = /Y/.test( prop ); + + jQuery.fn[ method ] = function( val ) { + return jQuery.access( this, function( elem, method, val ) { + var win = getWindow( elem ); + + if ( val === undefined ) { + return win ? (prop in win) ? win[ prop ] : + jQuery.support.boxModel && win.document.documentElement[ method ] || + win.document.body[ method ] : + elem[ method ]; + } + + if ( win ) { + win.scrollTo( + !top ? val : jQuery( win ).scrollLeft(), + top ? val : jQuery( win ).scrollTop() + ); + + } else { + elem[ method ] = val; + } + }, method, val, arguments.length, null ); + }; +}); + +function getWindow( elem ) { + return jQuery.isWindow( elem ) ? + elem : + elem.nodeType === 9 ? + elem.defaultView || elem.parentWindow : + false; +} + + + + +// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods +jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { + var clientProp = "client" + name, + scrollProp = "scroll" + name, + offsetProp = "offset" + name; + + // innerHeight and innerWidth + jQuery.fn[ "inner" + name ] = function() { + var elem = this[0]; + return elem ? + elem.style ? + parseFloat( jQuery.css( elem, type, "padding" ) ) : + this[ type ]() : + null; + }; + + // outerHeight and outerWidth + jQuery.fn[ "outer" + name ] = function( margin ) { + var elem = this[0]; + return elem ? + elem.style ? + parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) : + this[ type ]() : + null; + }; + + jQuery.fn[ type ] = function( value ) { + return jQuery.access( this, function( elem, type, value ) { + var doc, docElemProp, orig, ret; + + if ( jQuery.isWindow( elem ) ) { + // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat + doc = elem.document; + docElemProp = doc.documentElement[ clientProp ]; + return jQuery.support.boxModel && docElemProp || + doc.body && doc.body[ clientProp ] || docElemProp; + } + + // Get document width or height + if ( elem.nodeType === 9 ) { + // Either scroll[Width/Height] or offset[Width/Height], whichever is greater + doc = elem.documentElement; + + // when a window > document, IE6 reports a offset[Width/Height] > client[Width/Height] + // so we can't use max, as it'll choose the incorrect offset[Width/Height] + // instead we use the correct client[Width/Height] + // support:IE6 + if ( doc[ clientProp ] >= doc[ scrollProp ] ) { + return doc[ clientProp ]; + } + + return Math.max( + elem.body[ scrollProp ], doc[ scrollProp ], + elem.body[ offsetProp ], doc[ offsetProp ] + ); + } + + // Get width or height on the element + if ( value === undefined ) { + orig = jQuery.css( elem, type ); + ret = parseFloat( orig ); + return jQuery.isNumeric( ret ) ? ret : orig; + } + + // Set the width or height on the element + jQuery( elem ).css( type, value ); + }, type, value, arguments.length, null ); + }; +}); + + + + +// Expose jQuery to the global object +window.jQuery = window.$ = jQuery; + +// Expose jQuery as an AMD module, but only for AMD loaders that +// understand the issues with loading multiple versions of jQuery +// in a page that all might call define(). The loader will indicate +// they have special allowances for multiple jQuery versions by +// specifying define.amd.jQuery = true. Register as a named module, +// since jQuery can be concatenated with other files that may use define, +// but not use a proper concatenation script that understands anonymous +// AMD modules. A named AMD is safest and most robust way to register. +// Lowercase jquery is used because AMD module names are derived from +// file names, and jQuery is normally delivered in a lowercase file name. +// Do this after creating the global so that if an AMD module wants to call +// noConflict to hide this version of jQuery, it will work. +if ( typeof define === "function" && define.amd && define.amd.jQuery ) { + define( "jquery", [], function () { return jQuery; } ); +} + + + +})( window ); diff --git a/src/main/webapp/javascripts/libs/json2.js b/src/main/webapp/javascripts/libs/json2.js new file mode 100644 index 0000000..2dbf60d --- /dev/null +++ b/src/main/webapp/javascripts/libs/json2.js @@ -0,0 +1,487 @@ +/* + http://www.JSON.org/json2.js + 2011-10-19 + + Public Domain. + + NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. + + See http://www.JSON.org/js.html + + + This code should be minified before deployment. + See http://javascript.crockford.com/jsmin.html + + USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO + NOT CONTROL. + + + This file creates a global JSON object containing two methods: stringify + and parse. + + JSON.stringify(value, replacer, space) + value any JavaScript value, usually an object or array. + + replacer an optional parameter that determines how object + values are stringified for objects. It can be a + function or an array of strings. + + space an optional parameter that specifies the indentation + of nested structures. If it is omitted, the text will + be packed without extra whitespace. If it is a number, + it will specify the number of spaces to indent at each + level. If it is a string (such as '\t' or ' '), + it contains the characters used to indent at each level. + + This method produces a JSON text from a JavaScript value. + + When an object value is found, if the object contains a toJSON + method, its toJSON method will be called and the result will be + stringified. A toJSON method does not serialize: it returns the + value represented by the name/value pair that should be serialized, + or undefined if nothing should be serialized. The toJSON method + will be passed the key associated with the value, and this will be + bound to the value + + For example, this would serialize Dates as ISO strings. + + Date.prototype.toJSON = function (key) { + function f(n) { + // Format integers to have at least two digits. + return n < 10 ? '0' + n : n; + } + + return this.getUTCFullYear() + '-' + + f(this.getUTCMonth() + 1) + '-' + + f(this.getUTCDate()) + 'T' + + f(this.getUTCHours()) + ':' + + f(this.getUTCMinutes()) + ':' + + f(this.getUTCSeconds()) + 'Z'; + }; + + You can provide an optional replacer method. It will be passed the + key and value of each member, with this bound to the containing + object. The value that is returned from your method will be + serialized. If your method returns undefined, then the member will + be excluded from the serialization. + + If the replacer parameter is an array of strings, then it will be + used to select the members to be serialized. It filters the results + such that only members with keys listed in the replacer array are + stringified. + + Values that do not have JSON representations, such as undefined or + functions, will not be serialized. Such values in objects will be + dropped; in arrays they will be replaced with null. You can use + a replacer function to replace those with JSON values. + JSON.stringify(undefined) returns undefined. + + The optional space parameter produces a stringification of the + value that is filled with line breaks and indentation to make it + easier to read. + + If the space parameter is a non-empty string, then that string will + be used for indentation. If the space parameter is a number, then + the indentation will be that many spaces. + + Example: + + text = JSON.stringify(['e', {pluribus: 'unum'}]); + // text is '["e",{"pluribus":"unum"}]' + + + text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t'); + // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' + + text = JSON.stringify([new Date()], function (key, value) { + return this[key] instanceof Date ? + 'Date(' + this[key] + ')' : value; + }); + // text is '["Date(---current time---)"]' + + + JSON.parse(text, reviver) + This method parses a JSON text to produce an object or array. + It can throw a SyntaxError exception. + + The optional reviver parameter is a function that can filter and + transform the results. It receives each of the keys and values, + and its return value is used instead of the original value. + If it returns what it received, then the structure is not modified. + If it returns undefined then the member is deleted. + + Example: + + // Parse the text. Values that look like ISO date strings will + // be converted to Date objects. + + myData = JSON.parse(text, function (key, value) { + var a; + if (typeof value === 'string') { + a = +/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); + if (a) { + return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], + +a[5], +a[6])); + } + } + return value; + }); + + myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { + var d; + if (typeof value === 'string' && + value.slice(0, 5) === 'Date(' && + value.slice(-1) === ')') { + d = new Date(value.slice(5, -1)); + if (d) { + return d; + } + } + return value; + }); + + + This is a reference implementation. You are free to copy, modify, or + redistribute. +*/ + +/*jslint evil: true, regexp: true */ + +/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, + call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, + getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, + lastIndex, length, parse, prototype, push, replace, slice, stringify, + test, toJSON, toString, valueOf +*/ + + +// Create a JSON object only if one does not already exist. We create the +// methods in a closure to avoid creating global variables. + +var JSON; +if (!JSON) { + JSON = {}; +} + +(function () { + 'use strict'; + + function f(n) { + // Format integers to have at least two digits. + return n < 10 ? '0' + n : n; + } + + if (typeof Date.prototype.toJSON !== 'function') { + + Date.prototype.toJSON = function (key) { + + return isFinite(this.valueOf()) + ? this.getUTCFullYear() + '-' + + f(this.getUTCMonth() + 1) + '-' + + f(this.getUTCDate()) + 'T' + + f(this.getUTCHours()) + ':' + + f(this.getUTCMinutes()) + ':' + + f(this.getUTCSeconds()) + 'Z' + : null; + }; + + String.prototype.toJSON = + Number.prototype.toJSON = + Boolean.prototype.toJSON = function (key) { + return this.valueOf(); + }; + } + + var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + gap, + indent, + meta = { // table of character substitutions + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '"' : '\\"', + '\\': '\\\\' + }, + rep; + + + function quote(string) { + +// If the string contains no control characters, no quote characters, and no +// backslash characters, then we can safely slap some quotes around it. +// Otherwise we must also replace the offending characters with safe escape +// sequences. + + escapable.lastIndex = 0; + return escapable.test(string) ? '"' + string.replace(escapable, function (a) { + var c = meta[a]; + return typeof c === 'string' + ? c + : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); + }) + '"' : '"' + string + '"'; + } + + + function str(key, holder) { + +// Produce a string from holder[key]. + + var i, // The loop counter. + k, // The member key. + v, // The member value. + length, + mind = gap, + partial, + value = holder[key]; + +// If the value has a toJSON method, call it to obtain a replacement value. + + if (value && typeof value === 'object' && + typeof value.toJSON === 'function') { + value = value.toJSON(key); + } + +// If we were called with a replacer function, then call the replacer to +// obtain a replacement value. + + if (typeof rep === 'function') { + value = rep.call(holder, key, value); + } + +// What happens next depends on the value's type. + + switch (typeof value) { + case 'string': + return quote(value); + + case 'number': + +// JSON numbers must be finite. Encode non-finite numbers as null. + + return isFinite(value) ? String(value) : 'null'; + + case 'boolean': + case 'null': + +// If the value is a boolean or null, convert it to a string. Note: +// typeof null does not produce 'null'. The case is included here in +// the remote chance that this gets fixed someday. + + return String(value); + +// If the type is 'object', we might be dealing with an object or an array or +// null. + + case 'object': + +// Due to a specification blunder in ECMAScript, typeof null is 'object', +// so watch out for that case. + + if (!value) { + return 'null'; + } + +// Make an array to hold the partial results of stringifying this object value. + + gap += indent; + partial = []; + +// Is the value an array? + + if (Object.prototype.toString.apply(value) === '[object Array]') { + +// The value is an array. Stringify every element. Use null as a placeholder +// for non-JSON values. + + length = value.length; + for (i = 0; i < length; i += 1) { + partial[i] = str(i, value) || 'null'; + } + +// Join all of the elements together, separated with commas, and wrap them in +// brackets. + + v = partial.length === 0 + ? '[]' + : gap + ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' + : '[' + partial.join(',') + ']'; + gap = mind; + return v; + } + +// If the replacer is an array, use it to select the members to be stringified. + + if (rep && typeof rep === 'object') { + length = rep.length; + for (i = 0; i < length; i += 1) { + if (typeof rep[i] === 'string') { + k = rep[i]; + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } else { + +// Otherwise, iterate through all of the keys in the object. + + for (k in value) { + if (Object.prototype.hasOwnProperty.call(value, k)) { + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } + +// Join all of the member texts together, separated with commas, +// and wrap them in braces. + + v = partial.length === 0 + ? '{}' + : gap + ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' + : '{' + partial.join(',') + '}'; + gap = mind; + return v; + } + } + +// If the JSON object does not yet have a stringify method, give it one. + + if (typeof JSON.stringify !== 'function') { + JSON.stringify = function (value, replacer, space) { + +// The stringify method takes a value and an optional replacer, and an optional +// space parameter, and returns a JSON text. The replacer can be a function +// that can replace values, or an array of strings that will select the keys. +// A default replacer method can be provided. Use of the space parameter can +// produce text that is more easily readable. + + var i; + gap = ''; + indent = ''; + +// If the space parameter is a number, make an indent string containing that +// many spaces. + + if (typeof space === 'number') { + for (i = 0; i < space; i += 1) { + indent += ' '; + } + +// If the space parameter is a string, it will be used as the indent string. + + } else if (typeof space === 'string') { + indent = space; + } + +// If there is a replacer, it must be a function or an array. +// Otherwise, throw an error. + + rep = replacer; + if (replacer && typeof replacer !== 'function' && + (typeof replacer !== 'object' || + typeof replacer.length !== 'number')) { + throw new Error('JSON.stringify'); + } + +// Make a fake root object containing our value under the key of ''. +// Return the result of stringifying the value. + + return str('', {'': value}); + }; + } + + +// If the JSON object does not yet have a parse method, give it one. + + if (typeof JSON.parse !== 'function') { + JSON.parse = function (text, reviver) { + +// The parse method takes a text and an optional reviver function, and returns +// a JavaScript value if the text is a valid JSON text. + + var j; + + function walk(holder, key) { + +// The walk method is used to recursively walk the resulting structure so +// that modifications can be made. + + var k, v, value = holder[key]; + if (value && typeof value === 'object') { + for (k in value) { + if (Object.prototype.hasOwnProperty.call(value, k)) { + v = walk(value, k); + if (v !== undefined) { + value[k] = v; + } else { + delete value[k]; + } + } + } + } + return reviver.call(holder, key, value); + } + + +// Parsing happens in four stages. In the first stage, we replace certain +// Unicode characters with escape sequences. JavaScript handles many characters +// incorrectly, either silently deleting them, or treating them as line endings. + + text = String(text); + cx.lastIndex = 0; + if (cx.test(text)) { + text = text.replace(cx, function (a) { + return '\\u' + + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); + }); + } + +// In the second stage, we run the text against regular expressions that look +// for non-JSON patterns. We are especially concerned with '()' and 'new' +// because they can cause invocation, and '=' because it can cause mutation. +// But just to be safe, we want to reject all unexpected forms. + +// We split the second stage into 4 regexp operations in order to work around +// crippling inefficiencies in IE's and Safari's regexp engines. First we +// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we +// replace all simple value tokens with ']' characters. Third, we delete all +// open brackets that follow a colon or comma or that begin the text. Finally, +// we look to see that the remaining characters are only whitespace or ']' or +// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. + + if (/^[\],:{}\s]*$/ + .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') + .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') + .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { + +// In the third stage we use the eval function to compile the text into a +// JavaScript structure. The '{' operator is subject to a syntactic ambiguity +// in JavaScript: it can begin a block or an object literal. We wrap the text +// in parens to eliminate the ambiguity. + + j = eval('(' + text + ')'); + +// In the optional fourth stage, we recursively walk the new structure, passing +// each name/value pair to a reviver function for possible transformation. + + return typeof reviver === 'function' + ? walk({'': j}, '') + : j; + } + +// If the text is not JSON parseable, then a SyntaxError is thrown. + + throw new SyntaxError('JSON.parse'); + }; + } +}()); diff --git a/src/main/webapp/javascripts/libs/qunit-1.10.0.js b/src/main/webapp/javascripts/libs/qunit-1.10.0.js new file mode 100644 index 0000000..d4f17b5 --- /dev/null +++ b/src/main/webapp/javascripts/libs/qunit-1.10.0.js @@ -0,0 +1,1977 @@ +/** + * QUnit v1.10.0 - A JavaScript Unit Testing Framework + * + * http://qunitjs.com + * + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +(function( window ) { + +var QUnit, + config, + onErrorFnPrev, + testId = 0, + fileName = (sourceFromStacktrace( 0 ) || "" ).replace(/(:\d+)+\)?/, "").replace(/.+\//, ""), + toString = Object.prototype.toString, + hasOwn = Object.prototype.hasOwnProperty, + // Keep a local reference to Date (GH-283) + Date = window.Date, + defined = { + setTimeout: typeof window.setTimeout !== "undefined", + sessionStorage: (function() { + var x = "qunit-test-string"; + try { + sessionStorage.setItem( x, x ); + sessionStorage.removeItem( x ); + return true; + } catch( e ) { + return false; + } + }()) +}; + +function Test( settings ) { + extend( this, settings ); + this.assertions = []; + this.testNumber = ++Test.count; +} + +Test.count = 0; + +Test.prototype = { + init: function() { + var a, b, li, + tests = id( "qunit-tests" ); + + if ( tests ) { + b = document.createElement( "strong" ); + b.innerHTML = this.name; + + // `a` initialized at top of scope + a = document.createElement( "a" ); + a.innerHTML = "Rerun"; + a.href = QUnit.url({ testNumber: this.testNumber }); + + li = document.createElement( "li" ); + li.appendChild( b ); + li.appendChild( a ); + li.className = "running"; + li.id = this.id = "qunit-test-output" + testId++; + + tests.appendChild( li ); + } + }, + setup: function() { + if ( this.module !== config.previousModule ) { + if ( config.previousModule ) { + runLoggingCallbacks( "moduleDone", QUnit, { + name: config.previousModule, + failed: config.moduleStats.bad, + passed: config.moduleStats.all - config.moduleStats.bad, + total: config.moduleStats.all + }); + } + config.previousModule = this.module; + config.moduleStats = { all: 0, bad: 0 }; + runLoggingCallbacks( "moduleStart", QUnit, { + name: this.module + }); + } else if ( config.autorun ) { + runLoggingCallbacks( "moduleStart", QUnit, { + name: this.module + }); + } + + config.current = this; + + this.testEnvironment = extend({ + setup: function() {}, + teardown: function() {} + }, this.moduleTestEnvironment ); + + runLoggingCallbacks( "testStart", QUnit, { + name: this.testName, + module: this.module + }); + + // allow utility functions to access the current test environment + // TODO why?? + QUnit.current_testEnvironment = this.testEnvironment; + + if ( !config.pollution ) { + saveGlobal(); + } + if ( config.notrycatch ) { + this.testEnvironment.setup.call( this.testEnvironment ); + return; + } + try { + this.testEnvironment.setup.call( this.testEnvironment ); + } catch( e ) { + QUnit.pushFailure( "Setup failed on " + this.testName + ": " + e.message, extractStacktrace( e, 1 ) ); + } + }, + run: function() { + config.current = this; + + var running = id( "qunit-testresult" ); + + if ( running ) { + running.innerHTML = "Running: <br/>" + this.name; + } + + if ( this.async ) { + QUnit.stop(); + } + + if ( config.notrycatch ) { + this.callback.call( this.testEnvironment, QUnit.assert ); + return; + } + + try { + this.callback.call( this.testEnvironment, QUnit.assert ); + } catch( e ) { + QUnit.pushFailure( "Died on test #" + (this.assertions.length + 1) + " " + this.stack + ": " + e.message, extractStacktrace( e, 0 ) ); + // else next test will carry the responsibility + saveGlobal(); + + // Restart the tests if they're blocking + if ( config.blocking ) { + QUnit.start(); + } + } + }, + teardown: function() { + config.current = this; + if ( config.notrycatch ) { + this.testEnvironment.teardown.call( this.testEnvironment ); + return; + } else { + try { + this.testEnvironment.teardown.call( this.testEnvironment ); + } catch( e ) { + QUnit.pushFailure( "Teardown failed on " + this.testName + ": " + e.message, extractStacktrace( e, 1 ) ); + } + } + checkPollution(); + }, + finish: function() { + config.current = this; + if ( config.requireExpects && this.expected == null ) { + QUnit.pushFailure( "Expected number of assertions to be defined, but expect() was not called.", this.stack ); + } else if ( this.expected != null && this.expected != this.assertions.length ) { + QUnit.pushFailure( "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run", this.stack ); + } else if ( this.expected == null && !this.assertions.length ) { + QUnit.pushFailure( "Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.", this.stack ); + } + + var assertion, a, b, i, li, ol, + test = this, + good = 0, + bad = 0, + tests = id( "qunit-tests" ); + + config.stats.all += this.assertions.length; + config.moduleStats.all += this.assertions.length; + + if ( tests ) { + ol = document.createElement( "ol" ); + + for ( i = 0; i < this.assertions.length; i++ ) { + assertion = this.assertions[i]; + + li = document.createElement( "li" ); + li.className = assertion.result ? "pass" : "fail"; + li.innerHTML = assertion.message || ( assertion.result ? "okay" : "failed" ); + ol.appendChild( li ); + + if ( assertion.result ) { + good++; + } else { + bad++; + config.stats.bad++; + config.moduleStats.bad++; + } + } + + // store result when possible + if ( QUnit.config.reorder && defined.sessionStorage ) { + if ( bad ) { + sessionStorage.setItem( "qunit-test-" + this.module + "-" + this.testName, bad ); + } else { + sessionStorage.removeItem( "qunit-test-" + this.module + "-" + this.testName ); + } + } + + if ( bad === 0 ) { + ol.style.display = "none"; + } + + // `b` initialized at top of scope + b = document.createElement( "strong" ); + b.innerHTML = this.name + " <b class='counts'>(<b class='failed'>" + bad + "</b>, <b class='passed'>" + good + "</b>, " + this.assertions.length + ")</b>"; + + addEvent(b, "click", function() { + var next = b.nextSibling.nextSibling, + display = next.style.display; + next.style.display = display === "none" ? "block" : "none"; + }); + + addEvent(b, "dblclick", function( e ) { + var target = e && e.target ? e.target : window.event.srcElement; + if ( target.nodeName.toLowerCase() == "span" || target.nodeName.toLowerCase() == "b" ) { + target = target.parentNode; + } + if ( window.location && target.nodeName.toLowerCase() === "strong" ) { + window.location = QUnit.url({ testNumber: test.testNumber }); + } + }); + + // `li` initialized at top of scope + li = id( this.id ); + li.className = bad ? "fail" : "pass"; + li.removeChild( li.firstChild ); + a = li.firstChild; + li.appendChild( b ); + li.appendChild ( a ); + li.appendChild( ol ); + + } else { + for ( i = 0; i < this.assertions.length; i++ ) { + if ( !this.assertions[i].result ) { + bad++; + config.stats.bad++; + config.moduleStats.bad++; + } + } + } + + runLoggingCallbacks( "testDone", QUnit, { + name: this.testName, + module: this.module, + failed: bad, + passed: this.assertions.length - bad, + total: this.assertions.length + }); + + QUnit.reset(); + + config.current = undefined; + }, + + queue: function() { + var bad, + test = this; + + synchronize(function() { + test.init(); + }); + function run() { + // each of these can by async + synchronize(function() { + test.setup(); + }); + synchronize(function() { + test.run(); + }); + synchronize(function() { + test.teardown(); + }); + synchronize(function() { + test.finish(); + }); + } + + // `bad` initialized at top of scope + // defer when previous test run passed, if storage is available + bad = QUnit.config.reorder && defined.sessionStorage && + +sessionStorage.getItem( "qunit-test-" + this.module + "-" + this.testName ); + + if ( bad ) { + run(); + } else { + synchronize( run, true ); + } + } +}; + +// Root QUnit object. +// `QUnit` initialized at top of scope +QUnit = { + + // call on start of module test to prepend name to all tests + module: function( name, testEnvironment ) { + config.currentModule = name; + config.currentModuleTestEnvironment = testEnvironment; + config.modules[name] = true; + }, + + asyncTest: function( testName, expected, callback ) { + if ( arguments.length === 2 ) { + callback = expected; + expected = null; + } + + QUnit.test( testName, expected, callback, true ); + }, + + test: function( testName, expected, callback, async ) { + var test, + name = "<span class='test-name'>" + escapeInnerText( testName ) + "</span>"; + + if ( arguments.length === 2 ) { + callback = expected; + expected = null; + } + + if ( config.currentModule ) { + name = "<span class='module-name'>" + config.currentModule + "</span>: " + name; + } + + test = new Test({ + name: name, + testName: testName, + expected: expected, + async: async, + callback: callback, + module: config.currentModule, + moduleTestEnvironment: config.currentModuleTestEnvironment, + stack: sourceFromStacktrace( 2 ) + }); + + if ( !validTest( test ) ) { + return; + } + + test.queue(); + }, + + // Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through. + expect: function( asserts ) { + if (arguments.length === 1) { + config.current.expected = asserts; + } else { + return config.current.expected; + } + }, + + start: function( count ) { + config.semaphore -= count || 1; + // don't start until equal number of stop-calls + if ( config.semaphore > 0 ) { + return; + } + // ignore if start is called more often then stop + if ( config.semaphore < 0 ) { + config.semaphore = 0; + } + // A slight delay, to avoid any current callbacks + if ( defined.setTimeout ) { + window.setTimeout(function() { + if ( config.semaphore > 0 ) { + return; + } + if ( config.timeout ) { + clearTimeout( config.timeout ); + } + + config.blocking = false; + process( true ); + }, 13); + } else { + config.blocking = false; + process( true ); + } + }, + + stop: function( count ) { + config.semaphore += count || 1; + config.blocking = true; + + if ( config.testTimeout && defined.setTimeout ) { + clearTimeout( config.timeout ); + config.timeout = window.setTimeout(function() { + QUnit.ok( false, "Test timed out" ); + config.semaphore = 1; + QUnit.start(); + }, config.testTimeout ); + } + } +}; + +// Asssert helpers +// All of these must call either QUnit.push() or manually do: +// - runLoggingCallbacks( "log", .. ); +// - config.current.assertions.push({ .. }); +QUnit.assert = { + /** + * Asserts rough true-ish result. + * @name ok + * @function + * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" ); + */ + ok: function( result, msg ) { + if ( !config.current ) { + throw new Error( "ok() assertion outside test context, was " + sourceFromStacktrace(2) ); + } + result = !!result; + + var source, + details = { + module: config.current.module, + name: config.current.testName, + result: result, + message: msg + }; + + msg = escapeInnerText( msg || (result ? "okay" : "failed" ) ); + msg = "<span class='test-message'>" + msg + "</span>"; + + if ( !result ) { + source = sourceFromStacktrace( 2 ); + if ( source ) { + details.source = source; + msg += "<table><tr class='test-source'><th>Source: </th><td><pre>" + escapeInnerText( source ) + "</pre></td></tr></table>"; + } + } + runLoggingCallbacks( "log", QUnit, details ); + config.current.assertions.push({ + result: result, + message: msg + }); + }, + + /** + * Assert that the first two arguments are equal, with an optional message. + * Prints out both actual and expected values. + * @name equal + * @function + * @example equal( format( "Received {0} bytes.", 2), "Received 2 bytes.", "format() replaces {0} with next argument" ); + */ + equal: function( actual, expected, message ) { + QUnit.push( expected == actual, actual, expected, message ); + }, + + /** + * @name notEqual + * @function + */ + notEqual: function( actual, expected, message ) { + QUnit.push( expected != actual, actual, expected, message ); + }, + + /** + * @name deepEqual + * @function + */ + deepEqual: function( actual, expected, message ) { + QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); + }, + + /** + * @name notDeepEqual + * @function + */ + notDeepEqual: function( actual, expected, message ) { + QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); + }, + + /** + * @name strictEqual + * @function + */ + strictEqual: function( actual, expected, message ) { + QUnit.push( expected === actual, actual, expected, message ); + }, + + /** + * @name notStrictEqual + * @function + */ + notStrictEqual: function( actual, expected, message ) { + QUnit.push( expected !== actual, actual, expected, message ); + }, + + throws: function( block, expected, message ) { + var actual, + ok = false; + + // 'expected' is optional + if ( typeof expected === "string" ) { + message = expected; + expected = null; + } + + config.current.ignoreGlobalErrors = true; + try { + block.call( config.current.testEnvironment ); + } catch (e) { + actual = e; + } + config.current.ignoreGlobalErrors = false; + + if ( actual ) { + // we don't want to validate thrown error + if ( !expected ) { + ok = true; + // expected is a regexp + } else if ( QUnit.objectType( expected ) === "regexp" ) { + ok = expected.test( actual ); + // expected is a constructor + } else if ( actual instanceof expected ) { + ok = true; + // expected is a validation function which returns true is validation passed + } else if ( expected.call( {}, actual ) === true ) { + ok = true; + } + + QUnit.push( ok, actual, null, message ); + } else { + QUnit.pushFailure( message, null, 'No exception was thrown.' ); + } + } +}; + +/** + * @deprecate since 1.8.0 + * Kept assertion helpers in root for backwards compatibility + */ +extend( QUnit, QUnit.assert ); + +/** + * @deprecated since 1.9.0 + * Kept global "raises()" for backwards compatibility + */ +QUnit.raises = QUnit.assert.throws; + +/** + * @deprecated since 1.0.0, replaced with error pushes since 1.3.0 + * Kept to avoid TypeErrors for undefined methods. + */ +QUnit.equals = function() { + QUnit.push( false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead" ); +}; +QUnit.same = function() { + QUnit.push( false, false, false, "QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead" ); +}; + +// We want access to the constructor's prototype +(function() { + function F() {} + F.prototype = QUnit; + QUnit = new F(); + // Make F QUnit's constructor so that we can add to the prototype later + QUnit.constructor = F; +}()); + +/** + * Config object: Maintain internal state + * Later exposed as QUnit.config + * `config` initialized at top of scope + */ +config = { + // The queue of tests to run + queue: [], + + // block until document ready + blocking: true, + + // when enabled, show only failing tests + // gets persisted through sessionStorage and can be changed in UI via checkbox + hidepassed: false, + + // by default, run previously failed tests first + // very useful in combination with "Hide passed tests" checked + reorder: true, + + // by default, modify document.title when suite is done + altertitle: true, + + // when enabled, all tests must call expect() + requireExpects: false, + + // add checkboxes that are persisted in the query-string + // when enabled, the id is set to `true` as a `QUnit.config` property + urlConfig: [ + { + id: "noglobals", + label: "Check for Globals", + tooltip: "Enabling this will test if any test introduces new properties on the `window` object. Stored as query-strings." + }, + { + id: "notrycatch", + label: "No try-catch", + tooltip: "Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings." + } + ], + + // Set of all modules. + modules: {}, + + // logging callback queues + begin: [], + done: [], + log: [], + testStart: [], + testDone: [], + moduleStart: [], + moduleDone: [] +}; + +// Initialize more QUnit.config and QUnit.urlParams +(function() { + var i, + location = window.location || { search: "", protocol: "file:" }, + params = location.search.slice( 1 ).split( "&" ), + length = params.length, + urlParams = {}, + current; + + if ( params[ 0 ] ) { + for ( i = 0; i < length; i++ ) { + current = params[ i ].split( "=" ); + current[ 0 ] = decodeURIComponent( current[ 0 ] ); + // allow just a key to turn on a flag, e.g., test.html?noglobals + current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true; + urlParams[ current[ 0 ] ] = current[ 1 ]; + } + } + + QUnit.urlParams = urlParams; + + // String search anywhere in moduleName+testName + config.filter = urlParams.filter; + + // Exact match of the module name + config.module = urlParams.module; + + config.testNumber = parseInt( urlParams.testNumber, 10 ) || null; + + // Figure out if we're running the tests from a server or not + QUnit.isLocal = location.protocol === "file:"; +}()); + +// Export global variables, unless an 'exports' object exists, +// in that case we assume we're in CommonJS (dealt with on the bottom of the script) +if ( typeof exports === "undefined" ) { + extend( window, QUnit ); + + // Expose QUnit object + window.QUnit = QUnit; +} + +// Extend QUnit object, +// these after set here because they should not be exposed as global functions +extend( QUnit, { + config: config, + + // Initialize the configuration options + init: function() { + extend( config, { + stats: { all: 0, bad: 0 }, + moduleStats: { all: 0, bad: 0 }, + started: +new Date(), + updateRate: 1000, + blocking: false, + autostart: true, + autorun: false, + filter: "", + queue: [], + semaphore: 0 + }); + + var tests, banner, result, + qunit = id( "qunit" ); + + if ( qunit ) { + qunit.innerHTML = + "<h1 id='qunit-header'>" + escapeInnerText( document.title ) + "</h1>" + + "<h2 id='qunit-banner'></h2>" + + "<div id='qunit-testrunner-toolbar'></div>" + + "<h2 id='qunit-userAgent'></h2>" + + "<ol id='qunit-tests'></ol>"; + } + + tests = id( "qunit-tests" ); + banner = id( "qunit-banner" ); + result = id( "qunit-testresult" ); + + if ( tests ) { + tests.innerHTML = ""; + } + + if ( banner ) { + banner.className = ""; + } + + if ( result ) { + result.parentNode.removeChild( result ); + } + + if ( tests ) { + result = document.createElement( "p" ); + result.id = "qunit-testresult"; + result.className = "result"; + tests.parentNode.insertBefore( result, tests ); + result.innerHTML = "Running...<br/> "; + } + }, + + // Resets the test setup. Useful for tests that modify the DOM. + reset: function() { + var fixture = id( "qunit-fixture" ); + if ( fixture ) { + fixture.innerHTML = config.fixture; + } + }, + + // Trigger an event on an element. + // @example triggerEvent( document.body, "click" ); + triggerEvent: function( elem, type, event ) { + if ( document.createEvent ) { + event = document.createEvent( "MouseEvents" ); + event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView, + 0, 0, 0, 0, 0, false, false, false, false, 0, null); + + elem.dispatchEvent( event ); + } else if ( elem.fireEvent ) { + elem.fireEvent( "on" + type ); + } + }, + + // Safe object type checking + is: function( type, obj ) { + return QUnit.objectType( obj ) == type; + }, + + objectType: function( obj ) { + if ( typeof obj === "undefined" ) { + return "undefined"; + // consider: typeof null === object + } + if ( obj === null ) { + return "null"; + } + + var type = toString.call( obj ).match(/^\[object\s(.*)\]$/)[1] || ""; + + switch ( type ) { + case "Number": + if ( isNaN(obj) ) { + return "nan"; + } + return "number"; + case "String": + case "Boolean": + case "Array": + case "Date": + case "RegExp": + case "Function": + return type.toLowerCase(); + } + if ( typeof obj === "object" ) { + return "object"; + } + return undefined; + }, + + push: function( result, actual, expected, message ) { + if ( !config.current ) { + throw new Error( "assertion outside test context, was " + sourceFromStacktrace() ); + } + + var output, source, + details = { + module: config.current.module, + name: config.current.testName, + result: result, + message: message, + actual: actual, + expected: expected + }; + + message = escapeInnerText( message ) || ( result ? "okay" : "failed" ); + message = "<span class='test-message'>" + message + "</span>"; + output = message; + + if ( !result ) { + expected = escapeInnerText( QUnit.jsDump.parse(expected) ); + actual = escapeInnerText( QUnit.jsDump.parse(actual) ); + output += "<table><tr class='test-expected'><th>Expected: </th><td><pre>" + expected + "</pre></td></tr>"; + + if ( actual != expected ) { + output += "<tr class='test-actual'><th>Result: </th><td><pre>" + actual + "</pre></td></tr>"; + output += "<tr class='test-diff'><th>Diff: </th><td><pre>" + QUnit.diff( expected, actual ) + "</pre></td></tr>"; + } + + source = sourceFromStacktrace(); + + if ( source ) { + details.source = source; + output += "<tr class='test-source'><th>Source: </th><td><pre>" + escapeInnerText( source ) + "</pre></td></tr>"; + } + + output += "</table>"; + } + + runLoggingCallbacks( "log", QUnit, details ); + + config.current.assertions.push({ + result: !!result, + message: output + }); + }, + + pushFailure: function( message, source, actual ) { + if ( !config.current ) { + throw new Error( "pushFailure() assertion outside test context, was " + sourceFromStacktrace(2) ); + } + + var output, + details = { + module: config.current.module, + name: config.current.testName, + result: false, + message: message + }; + + message = escapeInnerText( message ) || "error"; + message = "<span class='test-message'>" + message + "</span>"; + output = message; + + output += "<table>"; + + if ( actual ) { + output += "<tr class='test-actual'><th>Result: </th><td><pre>" + escapeInnerText( actual ) + "</pre></td></tr>"; + } + + if ( source ) { + details.source = source; + output += "<tr class='test-source'><th>Source: </th><td><pre>" + escapeInnerText( source ) + "</pre></td></tr>"; + } + + output += "</table>"; + + runLoggingCallbacks( "log", QUnit, details ); + + config.current.assertions.push({ + result: false, + message: output + }); + }, + + url: function( params ) { + params = extend( extend( {}, QUnit.urlParams ), params ); + var key, + querystring = "?"; + + for ( key in params ) { + if ( !hasOwn.call( params, key ) ) { + continue; + } + querystring += encodeURIComponent( key ) + "=" + + encodeURIComponent( params[ key ] ) + "&"; + } + return window.location.pathname + querystring.slice( 0, -1 ); + }, + + extend: extend, + id: id, + addEvent: addEvent + // load, equiv, jsDump, diff: Attached later +}); + +/** + * @deprecated: Created for backwards compatibility with test runner that set the hook function + * into QUnit.{hook}, instead of invoking it and passing the hook function. + * QUnit.constructor is set to the empty F() above so that we can add to it's prototype here. + * Doing this allows us to tell if the following methods have been overwritten on the actual + * QUnit object. + */ +extend( QUnit.constructor.prototype, { + + // Logging callbacks; all receive a single argument with the listed properties + // run test/logs.html for any related changes + begin: registerLoggingCallback( "begin" ), + + // done: { failed, passed, total, runtime } + done: registerLoggingCallback( "done" ), + + // log: { result, actual, expected, message } + log: registerLoggingCallback( "log" ), + + // testStart: { name } + testStart: registerLoggingCallback( "testStart" ), + + // testDone: { name, failed, passed, total } + testDone: registerLoggingCallback( "testDone" ), + + // moduleStart: { name } + moduleStart: registerLoggingCallback( "moduleStart" ), + + // moduleDone: { name, failed, passed, total } + moduleDone: registerLoggingCallback( "moduleDone" ) +}); + +if ( typeof document === "undefined" || document.readyState === "complete" ) { + config.autorun = true; +} + +QUnit.load = function() { + runLoggingCallbacks( "begin", QUnit, {} ); + + // Initialize the config, saving the execution queue + var banner, filter, i, label, len, main, ol, toolbar, userAgent, val, urlConfigCheckboxes, moduleFilter, + numModules = 0, + moduleFilterHtml = "", + urlConfigHtml = "", + oldconfig = extend( {}, config ); + + QUnit.init(); + extend(config, oldconfig); + + config.blocking = false; + + len = config.urlConfig.length; + + for ( i = 0; i < len; i++ ) { + val = config.urlConfig[i]; + if ( typeof val === "string" ) { + val = { + id: val, + label: val, + tooltip: "[no tooltip available]" + }; + } + config[ val.id ] = QUnit.urlParams[ val.id ]; + urlConfigHtml += "<input id='qunit-urlconfig-" + val.id + "' name='" + val.id + "' type='checkbox'" + ( config[ val.id ] ? " checked='checked'" : "" ) + " title='" + val.tooltip + "'><label for='qunit-urlconfig-" + val.id + "' title='" + val.tooltip + "'>" + val.label + "</label>"; + } + + moduleFilterHtml += "<label for='qunit-modulefilter'>Module: </label><select id='qunit-modulefilter' name='modulefilter'><option value='' " + ( config.module === undefined ? "selected" : "" ) + ">< All Modules ></option>"; + for ( i in config.modules ) { + if ( config.modules.hasOwnProperty( i ) ) { + numModules += 1; + moduleFilterHtml += "<option value='" + encodeURIComponent(i) + "' " + ( config.module === i ? "selected" : "" ) + ">" + i + "</option>"; + } + } + moduleFilterHtml += "</select>"; + + // `userAgent` initialized at top of scope + userAgent = id( "qunit-userAgent" ); + if ( userAgent ) { + userAgent.innerHTML = navigator.userAgent; + } + + // `banner` initialized at top of scope + banner = id( "qunit-header" ); + if ( banner ) { + banner.innerHTML = "<a href='" + QUnit.url({ filter: undefined, module: undefined, testNumber: undefined }) + "'>" + banner.innerHTML + "</a> "; + } + + // `toolbar` initialized at top of scope + toolbar = id( "qunit-testrunner-toolbar" ); + if ( toolbar ) { + // `filter` initialized at top of scope + filter = document.createElement( "input" ); + filter.type = "checkbox"; + filter.id = "qunit-filter-pass"; + + addEvent( filter, "click", function() { + var tmp, + ol = document.getElementById( "qunit-tests" ); + + if ( filter.checked ) { + ol.className = ol.className + " hidepass"; + } else { + tmp = " " + ol.className.replace( /[\n\t\r]/g, " " ) + " "; + ol.className = tmp.replace( / hidepass /, " " ); + } + if ( defined.sessionStorage ) { + if (filter.checked) { + sessionStorage.setItem( "qunit-filter-passed-tests", "true" ); + } else { + sessionStorage.removeItem( "qunit-filter-passed-tests" ); + } + } + }); + + if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem( "qunit-filter-passed-tests" ) ) { + filter.checked = true; + // `ol` initialized at top of scope + ol = document.getElementById( "qunit-tests" ); + ol.className = ol.className + " hidepass"; + } + toolbar.appendChild( filter ); + + // `label` initialized at top of scope + label = document.createElement( "label" ); + label.setAttribute( "for", "qunit-filter-pass" ); + label.setAttribute( "title", "Only show tests and assertons that fail. Stored in sessionStorage." ); + label.innerHTML = "Hide passed tests"; + toolbar.appendChild( label ); + + urlConfigCheckboxes = document.createElement( 'span' ); + urlConfigCheckboxes.innerHTML = urlConfigHtml; + addEvent( urlConfigCheckboxes, "change", function( event ) { + var params = {}; + params[ event.target.name ] = event.target.checked ? true : undefined; + window.location = QUnit.url( params ); + }); + toolbar.appendChild( urlConfigCheckboxes ); + + if (numModules > 1) { + moduleFilter = document.createElement( 'span' ); + moduleFilter.setAttribute( 'id', 'qunit-modulefilter-container' ); + moduleFilter.innerHTML = moduleFilterHtml; + addEvent( moduleFilter, "change", function() { + var selectBox = moduleFilter.getElementsByTagName("select")[0], + selectedModule = decodeURIComponent(selectBox.options[selectBox.selectedIndex].value); + + window.location = QUnit.url( { module: ( selectedModule === "" ) ? undefined : selectedModule } ); + }); + toolbar.appendChild(moduleFilter); + } + } + + // `main` initialized at top of scope + main = id( "qunit-fixture" ); + if ( main ) { + config.fixture = main.innerHTML; + } + + if ( config.autostart ) { + QUnit.start(); + } +}; + +addEvent( window, "load", QUnit.load ); + +// `onErrorFnPrev` initialized at top of scope +// Preserve other handlers +onErrorFnPrev = window.onerror; + +// Cover uncaught exceptions +// Returning true will surpress the default browser handler, +// returning false will let it run. +window.onerror = function ( error, filePath, linerNr ) { + var ret = false; + if ( onErrorFnPrev ) { + ret = onErrorFnPrev( error, filePath, linerNr ); + } + + // Treat return value as window.onerror itself does, + // Only do our handling if not surpressed. + if ( ret !== true ) { + if ( QUnit.config.current ) { + if ( QUnit.config.current.ignoreGlobalErrors ) { + return true; + } + QUnit.pushFailure( error, filePath + ":" + linerNr ); + } else { + QUnit.test( "global failure", extend( function() { + QUnit.pushFailure( error, filePath + ":" + linerNr ); + }, { validTest: validTest } ) ); + } + return false; + } + + return ret; +}; + +function done() { + config.autorun = true; + + // Log the last module results + if ( config.currentModule ) { + runLoggingCallbacks( "moduleDone", QUnit, { + name: config.currentModule, + failed: config.moduleStats.bad, + passed: config.moduleStats.all - config.moduleStats.bad, + total: config.moduleStats.all + }); + } + + var i, key, + banner = id( "qunit-banner" ), + tests = id( "qunit-tests" ), + runtime = +new Date() - config.started, + passed = config.stats.all - config.stats.bad, + html = [ + "Tests completed in ", + runtime, + " milliseconds.<br/>", + "<span class='passed'>", + passed, + "</span> tests of <span class='total'>", + config.stats.all, + "</span> passed, <span class='failed'>", + config.stats.bad, + "</span> failed." + ].join( "" ); + + if ( banner ) { + banner.className = ( config.stats.bad ? "qunit-fail" : "qunit-pass" ); + } + + if ( tests ) { + id( "qunit-testresult" ).innerHTML = html; + } + + if ( config.altertitle && typeof document !== "undefined" && document.title ) { + // show ✖ for good, ✔ for bad suite result in title + // use escape sequences in case file gets loaded with non-utf-8-charset + document.title = [ + ( config.stats.bad ? "\u2716" : "\u2714" ), + document.title.replace( /^[\u2714\u2716] /i, "" ) + ].join( " " ); + } + + // clear own sessionStorage items if all tests passed + if ( config.reorder && defined.sessionStorage && config.stats.bad === 0 ) { + // `key` & `i` initialized at top of scope + for ( i = 0; i < sessionStorage.length; i++ ) { + key = sessionStorage.key( i++ ); + if ( key.indexOf( "qunit-test-" ) === 0 ) { + sessionStorage.removeItem( key ); + } + } + } + + // scroll back to top to show results + if ( window.scrollTo ) { + window.scrollTo(0, 0); + } + + runLoggingCallbacks( "done", QUnit, { + failed: config.stats.bad, + passed: passed, + total: config.stats.all, + runtime: runtime + }); +} + +/** @return Boolean: true if this test should be ran */ +function validTest( test ) { + var include, + filter = config.filter && config.filter.toLowerCase(), + module = config.module && config.module.toLowerCase(), + fullName = (test.module + ": " + test.testName).toLowerCase(); + + // Internally-generated tests are always valid + if ( test.callback && test.callback.validTest === validTest ) { + delete test.callback.validTest; + return true; + } + + if ( config.testNumber ) { + return test.testNumber === config.testNumber; + } + + if ( module && ( !test.module || test.module.toLowerCase() !== module ) ) { + return false; + } + + if ( !filter ) { + return true; + } + + include = filter.charAt( 0 ) !== "!"; + if ( !include ) { + filter = filter.slice( 1 ); + } + + // If the filter matches, we need to honour include + if ( fullName.indexOf( filter ) !== -1 ) { + return include; + } + + // Otherwise, do the opposite + return !include; +} + +// so far supports only Firefox, Chrome and Opera (buggy), Safari (for real exceptions) +// Later Safari and IE10 are supposed to support error.stack as well +// See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack +function extractStacktrace( e, offset ) { + offset = offset === undefined ? 3 : offset; + + var stack, include, i, regex; + + if ( e.stacktrace ) { + // Opera + return e.stacktrace.split( "\n" )[ offset + 3 ]; + } else if ( e.stack ) { + // Firefox, Chrome + stack = e.stack.split( "\n" ); + if (/^error$/i.test( stack[0] ) ) { + stack.shift(); + } + if ( fileName ) { + include = []; + for ( i = offset; i < stack.length; i++ ) { + if ( stack[ i ].indexOf( fileName ) != -1 ) { + break; + } + include.push( stack[ i ] ); + } + if ( include.length ) { + return include.join( "\n" ); + } + } + return stack[ offset ]; + } else if ( e.sourceURL ) { + // Safari, PhantomJS + // hopefully one day Safari provides actual stacktraces + // exclude useless self-reference for generated Error objects + if ( /qunit.js$/.test( e.sourceURL ) ) { + return; + } + // for actual exceptions, this is useful + return e.sourceURL + ":" + e.line; + } +} +function sourceFromStacktrace( offset ) { + try { + throw new Error(); + } catch ( e ) { + return extractStacktrace( e, offset ); + } +} + +function escapeInnerText( s ) { + if ( !s ) { + return ""; + } + s = s + ""; + return s.replace( /[\&<>]/g, function( s ) { + switch( s ) { + case "&": return "&"; + case "<": return "<"; + case ">": return ">"; + default: return s; + } + }); +} + +function synchronize( callback, last ) { + config.queue.push( callback ); + + if ( config.autorun && !config.blocking ) { + process( last ); + } +} + +function process( last ) { + function next() { + process( last ); + } + var start = new Date().getTime(); + config.depth = config.depth ? config.depth + 1 : 1; + + while ( config.queue.length && !config.blocking ) { + if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) { + config.queue.shift()(); + } else { + window.setTimeout( next, 13 ); + break; + } + } + config.depth--; + if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) { + done(); + } +} + +function saveGlobal() { + config.pollution = []; + + if ( config.noglobals ) { + for ( var key in window ) { + // in Opera sometimes DOM element ids show up here, ignore them + if ( !hasOwn.call( window, key ) || /^qunit-test-output/.test( key ) ) { + continue; + } + config.pollution.push( key ); + } + } +} + +function checkPollution( name ) { + var newGlobals, + deletedGlobals, + old = config.pollution; + + saveGlobal(); + + newGlobals = diff( config.pollution, old ); + if ( newGlobals.length > 0 ) { + QUnit.pushFailure( "Introduced global variable(s): " + newGlobals.join(", ") ); + } + + deletedGlobals = diff( old, config.pollution ); + if ( deletedGlobals.length > 0 ) { + QUnit.pushFailure( "Deleted global variable(s): " + deletedGlobals.join(", ") ); + } +} + +// returns a new Array with the elements that are in a but not in b +function diff( a, b ) { + var i, j, + result = a.slice(); + + for ( i = 0; i < result.length; i++ ) { + for ( j = 0; j < b.length; j++ ) { + if ( result[i] === b[j] ) { + result.splice( i, 1 ); + i--; + break; + } + } + } + return result; +} + +function extend( a, b ) { + for ( var prop in b ) { + if ( b[ prop ] === undefined ) { + delete a[ prop ]; + + // Avoid "Member not found" error in IE8 caused by setting window.constructor + } else if ( prop !== "constructor" || a !== window ) { + a[ prop ] = b[ prop ]; + } + } + + return a; +} + +function addEvent( elem, type, fn ) { + if ( elem.addEventListener ) { + elem.addEventListener( type, fn, false ); + } else if ( elem.attachEvent ) { + elem.attachEvent( "on" + type, fn ); + } else { + fn(); + } +} + +function id( name ) { + return !!( typeof document !== "undefined" && document && document.getElementById ) && + document.getElementById( name ); +} + +function registerLoggingCallback( key ) { + return function( callback ) { + config[key].push( callback ); + }; +} + +// Supports deprecated method of completely overwriting logging callbacks +function runLoggingCallbacks( key, scope, args ) { + //debugger; + var i, callbacks; + if ( QUnit.hasOwnProperty( key ) ) { + QUnit[ key ].call(scope, args ); + } else { + callbacks = config[ key ]; + for ( i = 0; i < callbacks.length; i++ ) { + callbacks[ i ].call( scope, args ); + } + } +} + +// Test for equality any JavaScript type. +// Author: Philippe Rathé <prathe@gmail.com> +QUnit.equiv = (function() { + + // Call the o related callback with the given arguments. + function bindCallbacks( o, callbacks, args ) { + var prop = QUnit.objectType( o ); + if ( prop ) { + if ( QUnit.objectType( callbacks[ prop ] ) === "function" ) { + return callbacks[ prop ].apply( callbacks, args ); + } else { + return callbacks[ prop ]; // or undefined + } + } + } + + // the real equiv function + var innerEquiv, + // stack to decide between skip/abort functions + callers = [], + // stack to avoiding loops from circular referencing + parents = [], + + getProto = Object.getPrototypeOf || function ( obj ) { + return obj.__proto__; + }, + callbacks = (function () { + + // for string, boolean, number and null + function useStrictEquality( b, a ) { + if ( b instanceof a.constructor || a instanceof b.constructor ) { + // to catch short annotaion VS 'new' annotation of a + // declaration + // e.g. var i = 1; + // var j = new Number(1); + return a == b; + } else { + return a === b; + } + } + + return { + "string": useStrictEquality, + "boolean": useStrictEquality, + "number": useStrictEquality, + "null": useStrictEquality, + "undefined": useStrictEquality, + + "nan": function( b ) { + return isNaN( b ); + }, + + "date": function( b, a ) { + return QUnit.objectType( b ) === "date" && a.valueOf() === b.valueOf(); + }, + + "regexp": function( b, a ) { + return QUnit.objectType( b ) === "regexp" && + // the regex itself + a.source === b.source && + // and its modifers + a.global === b.global && + // (gmi) ... + a.ignoreCase === b.ignoreCase && + a.multiline === b.multiline && + a.sticky === b.sticky; + }, + + // - skip when the property is a method of an instance (OOP) + // - abort otherwise, + // initial === would have catch identical references anyway + "function": function() { + var caller = callers[callers.length - 1]; + return caller !== Object && typeof caller !== "undefined"; + }, + + "array": function( b, a ) { + var i, j, len, loop; + + // b could be an object literal here + if ( QUnit.objectType( b ) !== "array" ) { + return false; + } + + len = a.length; + if ( len !== b.length ) { + // safe and faster + return false; + } + + // track reference to avoid circular references + parents.push( a ); + for ( i = 0; i < len; i++ ) { + loop = false; + for ( j = 0; j < parents.length; j++ ) { + if ( parents[j] === a[i] ) { + loop = true;// dont rewalk array + } + } + if ( !loop && !innerEquiv(a[i], b[i]) ) { + parents.pop(); + return false; + } + } + parents.pop(); + return true; + }, + + "object": function( b, a ) { + var i, j, loop, + // Default to true + eq = true, + aProperties = [], + bProperties = []; + + // comparing constructors is more strict than using + // instanceof + if ( a.constructor !== b.constructor ) { + // Allow objects with no prototype to be equivalent to + // objects with Object as their constructor. + if ( !(( getProto(a) === null && getProto(b) === Object.prototype ) || + ( getProto(b) === null && getProto(a) === Object.prototype ) ) ) { + return false; + } + } + + // stack constructor before traversing properties + callers.push( a.constructor ); + // track reference to avoid circular references + parents.push( a ); + + for ( i in a ) { // be strict: don't ensures hasOwnProperty + // and go deep + loop = false; + for ( j = 0; j < parents.length; j++ ) { + if ( parents[j] === a[i] ) { + // don't go down the same path twice + loop = true; + } + } + aProperties.push(i); // collect a's properties + + if (!loop && !innerEquiv( a[i], b[i] ) ) { + eq = false; + break; + } + } + + callers.pop(); // unstack, we are done + parents.pop(); + + for ( i in b ) { + bProperties.push( i ); // collect b's properties + } + + // Ensures identical properties name + return eq && innerEquiv( aProperties.sort(), bProperties.sort() ); + } + }; + }()); + + innerEquiv = function() { // can take multiple arguments + var args = [].slice.apply( arguments ); + if ( args.length < 2 ) { + return true; // end transition + } + + return (function( a, b ) { + if ( a === b ) { + return true; // catch the most you can + } else if ( a === null || b === null || typeof a === "undefined" || + typeof b === "undefined" || + QUnit.objectType(a) !== QUnit.objectType(b) ) { + return false; // don't lose time with error prone cases + } else { + return bindCallbacks(a, callbacks, [ b, a ]); + } + + // apply transition with (1..n) arguments + }( args[0], args[1] ) && arguments.callee.apply( this, args.splice(1, args.length - 1 )) ); + }; + + return innerEquiv; +}()); + +/** + * jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | + * http://flesler.blogspot.com Licensed under BSD + * (http://www.opensource.org/licenses/bsd-license.php) Date: 5/15/2008 + * + * @projectDescription Advanced and extensible data dumping for Javascript. + * @version 1.0.0 + * @author Ariel Flesler + * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html} + */ +QUnit.jsDump = (function() { + function quote( str ) { + return '"' + str.toString().replace( /"/g, '\\"' ) + '"'; + } + function literal( o ) { + return o + ""; + } + function join( pre, arr, post ) { + var s = jsDump.separator(), + base = jsDump.indent(), + inner = jsDump.indent(1); + if ( arr.join ) { + arr = arr.join( "," + s + inner ); + } + if ( !arr ) { + return pre + post; + } + return [ pre, inner + arr, base + post ].join(s); + } + function array( arr, stack ) { + var i = arr.length, ret = new Array(i); + this.up(); + while ( i-- ) { + ret[i] = this.parse( arr[i] , undefined , stack); + } + this.down(); + return join( "[", ret, "]" ); + } + + var reName = /^function (\w+)/, + jsDump = { + parse: function( obj, type, stack ) { //type is used mostly internally, you can fix a (custom)type in advance + stack = stack || [ ]; + var inStack, res, + parser = this.parsers[ type || this.typeOf(obj) ]; + + type = typeof parser; + inStack = inArray( obj, stack ); + + if ( inStack != -1 ) { + return "recursion(" + (inStack - stack.length) + ")"; + } + //else + if ( type == "function" ) { + stack.push( obj ); + res = parser.call( this, obj, stack ); + stack.pop(); + return res; + } + // else + return ( type == "string" ) ? parser : this.parsers.error; + }, + typeOf: function( obj ) { + var type; + if ( obj === null ) { + type = "null"; + } else if ( typeof obj === "undefined" ) { + type = "undefined"; + } else if ( QUnit.is( "regexp", obj) ) { + type = "regexp"; + } else if ( QUnit.is( "date", obj) ) { + type = "date"; + } else if ( QUnit.is( "function", obj) ) { + type = "function"; + } else if ( typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined" ) { + type = "window"; + } else if ( obj.nodeType === 9 ) { + type = "document"; + } else if ( obj.nodeType ) { + type = "node"; + } else if ( + // native arrays + toString.call( obj ) === "[object Array]" || + // NodeList objects + ( typeof obj.length === "number" && typeof obj.item !== "undefined" && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === "undefined" ) ) ) + ) { + type = "array"; + } else { + type = typeof obj; + } + return type; + }, + separator: function() { + return this.multiline ? this.HTML ? "<br />" : "\n" : this.HTML ? " " : " "; + }, + indent: function( extra ) {// extra can be a number, shortcut for increasing-calling-decreasing + if ( !this.multiline ) { + return ""; + } + var chr = this.indentChar; + if ( this.HTML ) { + chr = chr.replace( /\t/g, " " ).replace( / /g, " " ); + } + return new Array( this._depth_ + (extra||0) ).join(chr); + }, + up: function( a ) { + this._depth_ += a || 1; + }, + down: function( a ) { + this._depth_ -= a || 1; + }, + setParser: function( name, parser ) { + this.parsers[name] = parser; + }, + // The next 3 are exposed so you can use them + quote: quote, + literal: literal, + join: join, + // + _depth_: 1, + // This is the list of parsers, to modify them, use jsDump.setParser + parsers: { + window: "[Window]", + document: "[Document]", + error: "[ERROR]", //when no parser is found, shouldn"t happen + unknown: "[Unknown]", + "null": "null", + "undefined": "undefined", + "function": function( fn ) { + var ret = "function", + name = "name" in fn ? fn.name : (reName.exec(fn) || [])[1];//functions never have name in IE + + if ( name ) { + ret += " " + name; + } + ret += "( "; + + ret = [ ret, QUnit.jsDump.parse( fn, "functionArgs" ), "){" ].join( "" ); + return join( ret, QUnit.jsDump.parse(fn,"functionCode" ), "}" ); + }, + array: array, + nodelist: array, + "arguments": array, + object: function( map, stack ) { + var ret = [ ], keys, key, val, i; + QUnit.jsDump.up(); + if ( Object.keys ) { + keys = Object.keys( map ); + } else { + keys = []; + for ( key in map ) { + keys.push( key ); + } + } + keys.sort(); + for ( i = 0; i < keys.length; i++ ) { + key = keys[ i ]; + val = map[ key ]; + ret.push( QUnit.jsDump.parse( key, "key" ) + ": " + QUnit.jsDump.parse( val, undefined, stack ) ); + } + QUnit.jsDump.down(); + return join( "{", ret, "}" ); + }, + node: function( node ) { + var a, val, + open = QUnit.jsDump.HTML ? "<" : "<", + close = QUnit.jsDump.HTML ? ">" : ">", + tag = node.nodeName.toLowerCase(), + ret = open + tag; + + for ( a in QUnit.jsDump.DOMAttrs ) { + val = node[ QUnit.jsDump.DOMAttrs[a] ]; + if ( val ) { + ret += " " + a + "=" + QUnit.jsDump.parse( val, "attribute" ); + } + } + return ret + close + open + "/" + tag + close; + }, + functionArgs: function( fn ) {//function calls it internally, it's the arguments part of the function + var args, + l = fn.length; + + if ( !l ) { + return ""; + } + + args = new Array(l); + while ( l-- ) { + args[l] = String.fromCharCode(97+l);//97 is 'a' + } + return " " + args.join( ", " ) + " "; + }, + key: quote, //object calls it internally, the key part of an item in a map + functionCode: "[code]", //function calls it internally, it's the content of the function + attribute: quote, //node calls it internally, it's an html attribute value + string: quote, + date: quote, + regexp: literal, //regex + number: literal, + "boolean": literal + }, + DOMAttrs: { + //attributes to dump from nodes, name=>realName + id: "id", + name: "name", + "class": "className" + }, + HTML: false,//if true, entities are escaped ( <, >, \t, space and \n ) + indentChar: " ",//indentation unit + multiline: true //if true, items in a collection, are separated by a \n, else just a space. + }; + + return jsDump; +}()); + +// from Sizzle.js +function getText( elems ) { + var i, elem, + ret = ""; + + for ( i = 0; elems[i]; i++ ) { + elem = elems[i]; + + // Get the text from text nodes and CDATA nodes + if ( elem.nodeType === 3 || elem.nodeType === 4 ) { + ret += elem.nodeValue; + + // Traverse everything else, except comment nodes + } else if ( elem.nodeType !== 8 ) { + ret += getText( elem.childNodes ); + } + } + + return ret; +} + +// from jquery.js +function inArray( elem, array ) { + if ( array.indexOf ) { + return array.indexOf( elem ); + } + + for ( var i = 0, length = array.length; i < length; i++ ) { + if ( array[ i ] === elem ) { + return i; + } + } + + return -1; +} + +/* + * Javascript Diff Algorithm + * By John Resig (http://ejohn.org/) + * Modified by Chu Alan "sprite" + * + * Released under the MIT license. + * + * More Info: + * http://ejohn.org/projects/javascript-diff-algorithm/ + * + * Usage: QUnit.diff(expected, actual) + * + * QUnit.diff( "the quick brown fox jumped over", "the quick fox jumps over" ) == "the quick <del>brown </del> fox <del>jumped </del><ins>jumps </ins> over" + */ +QUnit.diff = (function() { + function diff( o, n ) { + var i, + ns = {}, + os = {}; + + for ( i = 0; i < n.length; i++ ) { + if ( ns[ n[i] ] == null ) { + ns[ n[i] ] = { + rows: [], + o: null + }; + } + ns[ n[i] ].rows.push( i ); + } + + for ( i = 0; i < o.length; i++ ) { + if ( os[ o[i] ] == null ) { + os[ o[i] ] = { + rows: [], + n: null + }; + } + os[ o[i] ].rows.push( i ); + } + + for ( i in ns ) { + if ( !hasOwn.call( ns, i ) ) { + continue; + } + if ( ns[i].rows.length == 1 && typeof os[i] != "undefined" && os[i].rows.length == 1 ) { + n[ ns[i].rows[0] ] = { + text: n[ ns[i].rows[0] ], + row: os[i].rows[0] + }; + o[ os[i].rows[0] ] = { + text: o[ os[i].rows[0] ], + row: ns[i].rows[0] + }; + } + } + + for ( i = 0; i < n.length - 1; i++ ) { + if ( n[i].text != null && n[ i + 1 ].text == null && n[i].row + 1 < o.length && o[ n[i].row + 1 ].text == null && + n[ i + 1 ] == o[ n[i].row + 1 ] ) { + + n[ i + 1 ] = { + text: n[ i + 1 ], + row: n[i].row + 1 + }; + o[ n[i].row + 1 ] = { + text: o[ n[i].row + 1 ], + row: i + 1 + }; + } + } + + for ( i = n.length - 1; i > 0; i-- ) { + if ( n[i].text != null && n[ i - 1 ].text == null && n[i].row > 0 && o[ n[i].row - 1 ].text == null && + n[ i - 1 ] == o[ n[i].row - 1 ]) { + + n[ i - 1 ] = { + text: n[ i - 1 ], + row: n[i].row - 1 + }; + o[ n[i].row - 1 ] = { + text: o[ n[i].row - 1 ], + row: i - 1 + }; + } + } + + return { + o: o, + n: n + }; + } + + return function( o, n ) { + o = o.replace( /\s+$/, "" ); + n = n.replace( /\s+$/, "" ); + + var i, pre, + str = "", + out = diff( o === "" ? [] : o.split(/\s+/), n === "" ? [] : n.split(/\s+/) ), + oSpace = o.match(/\s+/g), + nSpace = n.match(/\s+/g); + + if ( oSpace == null ) { + oSpace = [ " " ]; + } + else { + oSpace.push( " " ); + } + + if ( nSpace == null ) { + nSpace = [ " " ]; + } + else { + nSpace.push( " " ); + } + + if ( out.n.length === 0 ) { + for ( i = 0; i < out.o.length; i++ ) { + str += "<del>" + out.o[i] + oSpace[i] + "</del>"; + } + } + else { + if ( out.n[0].text == null ) { + for ( n = 0; n < out.o.length && out.o[n].text == null; n++ ) { + str += "<del>" + out.o[n] + oSpace[n] + "</del>"; + } + } + + for ( i = 0; i < out.n.length; i++ ) { + if (out.n[i].text == null) { + str += "<ins>" + out.n[i] + nSpace[i] + "</ins>"; + } + else { + // `pre` initialized at top of scope + pre = ""; + + for ( n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++ ) { + pre += "<del>" + out.o[n] + oSpace[n] + "</del>"; + } + str += " " + out.n[i].text + nSpace[i] + pre; + } + } + } + + return str; + }; +}()); + +// for CommonJS enviroments, export everything +if ( typeof exports !== "undefined" ) { + extend(exports, QUnit); +} + +// get at whatever the global object is, like window in browsers +}( (function() {return this;}.call()) )); diff --git a/src/main/webapp/javascripts/libs/renderTerminator.js b/src/main/webapp/javascripts/libs/renderTerminator.js new file mode 100644 index 0000000..5330a86 --- /dev/null +++ b/src/main/webapp/javascripts/libs/renderTerminator.js @@ -0,0 +1,10 @@ +define ([], function () { + + var renderTerminator = function(parentPanel, selectedTerminator){ + var mainBtn = parentPanel.find('.terminator a.btn'); + mainBtn.html(mainBtn.html().replace(/\[ .+ \]/, '[ ' + selectedTerminator + ' ]')); + parentPanel.find(".terminator").data("statement_separator", selectedTerminator); + } + + return renderTerminator; +}); diff --git a/src/main/webapp/javascripts/libs/underscore.js b/src/main/webapp/javascripts/libs/underscore.js new file mode 100644 index 0000000..a23ef78 --- /dev/null +++ b/src/main/webapp/javascripts/libs/underscore.js @@ -0,0 +1,1082 @@ +// Underscore.js 1.3.3 +// (c) 2009-2012 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() { + + // Baseline setup + // -------------- + + // Establish the root object, `window` in the browser, or `global` on the server. + var root = this; + + // Save the previous value of the `_` variable. + var previousUnderscore = root._; + + // Establish the object that gets returned to break out of a loop iteration. + var breaker = {}; + + // Save bytes in the minified (but not gzipped) version: + var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype; + + // Create quick reference variables for speed access to core prototypes. + var push = ArrayProto.push, + slice = ArrayProto.slice, + unshift = ArrayProto.unshift, + toString = ObjProto.toString, + hasOwnProperty = ObjProto.hasOwnProperty; + + // All **ECMAScript 5** native function implementations that we hope to use + // are declared here. + var + nativeForEach = ArrayProto.forEach, + nativeMap = ArrayProto.map, + nativeReduce = ArrayProto.reduce, + nativeReduceRight = ArrayProto.reduceRight, + nativeFilter = ArrayProto.filter, + nativeEvery = ArrayProto.every, + nativeSome = ArrayProto.some, + nativeIndexOf = ArrayProto.indexOf, + nativeLastIndexOf = ArrayProto.lastIndexOf, + nativeIsArray = Array.isArray, + nativeKeys = Object.keys, + nativeBind = FuncProto.bind; + + // Create a safe reference to the Underscore object for use below. + var _ = function(obj) { return new wrapper(obj); }; + + // Export the Underscore object for **Node.js**, with + // backwards-compatibility for the old `require()` API. If we're in + // the browser, add `_` as a global object via a string identifier, + // for Closure Compiler "advanced" mode. + if (typeof exports !== 'undefined') { + if (typeof module !== 'undefined' && module.exports) { + exports = module.exports = _; + } + exports._ = _; + } else { + root['_'] = _; + } + + // Current version. + _.VERSION = '1.3.3'; + + // Collection Functions + // -------------------- + + // The cornerstone, an `each` implementation, aka `forEach`. + // Handles objects with the built-in `forEach`, arrays, and raw objects. + // Delegates to **ECMAScript 5**'s native `forEach` if available. + var each = _.each = _.forEach = function(obj, iterator, context) { + if (obj == null) return; + if (nativeForEach && obj.forEach === nativeForEach) { + obj.forEach(iterator, context); + } else if (obj.length === +obj.length) { + for (var i = 0, l = obj.length; i < l; i++) { + if (iterator.call(context, obj[i], i, obj) === breaker) return; + } + } else { + for (var key in obj) { + if (_.has(obj, key)) { + if (iterator.call(context, obj[key], key, obj) === breaker) return; + } + } + } + }; + + // Return the results of applying the iterator to each element. + // Delegates to **ECMAScript 5**'s native `map` if available. + _.map = _.collect = function(obj, iterator, context) { + var results = []; + if (obj == null) return results; + if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context); + each(obj, function(value, index, list) { + results[results.length] = iterator.call(context, value, index, list); + }); + return results; + }; + + // **Reduce** builds up a single result from a list of values, aka `inject`, + // or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available. + _.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) { + var initial = arguments.length > 2; + if (obj == null) obj = []; + if (nativeReduce && obj.reduce === nativeReduce) { + if (context) iterator = _.bind(iterator, context); + return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator); + } + each(obj, function(value, index, list) { + if (!initial) { + memo = value; + initial = true; + } else { + memo = iterator.call(context, memo, value, index, list); + } + }); + if (!initial) throw new TypeError('Reduce of empty array with no initial value'); + return memo; + }; + + // The right-associative version of reduce, also known as `foldr`. + // Delegates to **ECMAScript 5**'s native `reduceRight` if available. + _.reduceRight = _.foldr = function(obj, iterator, memo, context) { + var initial = arguments.length > 2; + if (obj == null) obj = []; + if (nativeReduceRight && obj.reduceRight === nativeReduceRight) { + if (context) iterator = _.bind(iterator, context); + return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator); + } + var reversed = _.toArray(obj).reverse(); + if (context && !initial) iterator = _.bind(iterator, context); + return initial ? _.reduce(reversed, iterator, memo, context) : _.reduce(reversed, iterator); + }; + + // Return the first value which passes a truth test. Aliased as `detect`. + _.find = _.detect = function(obj, iterator, context) { + var result; + any(obj, function(value, index, list) { + if (iterator.call(context, value, index, list)) { + result = value; + return true; + } + }); + return result; + }; + + // Return all the elements that pass a truth test. + // Delegates to **ECMAScript 5**'s native `filter` if available. + // Aliased as `select`. + _.filter = _.select = function(obj, iterator, context) { + var results = []; + if (obj == null) return results; + if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context); + each(obj, function(value, index, list) { + if (iterator.call(context, value, index, list)) results[results.length] = value; + }); + return results; + }; + + // Return all the elements for which a truth test fails. + _.reject = function(obj, iterator, context) { + var results = []; + if (obj == null) return results; + each(obj, function(value, index, list) { + if (!iterator.call(context, value, index, list)) results[results.length] = value; + }); + return results; + }; + + // Determine whether all of the elements match a truth test. + // Delegates to **ECMAScript 5**'s native `every` if available. + // Aliased as `all`. + _.every = _.all = function(obj, iterator, context) { + var result = true; + if (obj == null) return result; + if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context); + each(obj, function(value, index, list) { + if (!(result = result && iterator.call(context, value, index, list))) return breaker; + }); + return !!result; + }; + + // Determine if at least one element in the object matches a truth test. + // Delegates to **ECMAScript 5**'s native `some` if available. + // Aliased as `any`. + var any = _.some = _.any = function(obj, iterator, context) { + iterator || (iterator = _.identity); + var result = false; + if (obj == null) return result; + if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context); + each(obj, function(value, index, list) { + if (result || (result = iterator.call(context, value, index, list))) return breaker; + }); + return !!result; + }; + + // Determine if a given value is included in the array or object using `===`. + // Aliased as `contains`. + _.include = _.contains = function(obj, target) { + var found = false; + if (obj == null) return found; + if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1; + found = any(obj, function(value) { + return value === target; + }); + return found; + }; + + // Invoke a method (with arguments) on every item in a collection. + _.invoke = function(obj, method) { + var args = slice.call(arguments, 2); + return _.map(obj, function(value) { + return (_.isFunction(method) ? method : value[method]).apply(value, args); + }); + }; + + // Convenience version of a common use case of `map`: fetching a property. + _.pluck = function(obj, key) { + return _.map(obj, function(value){ return value[key]; }); + }; + + // Return the maximum element or (element-based computation). + // Can't optimize arrays of integers longer than 65,535 elements. + // See: https://bugs.webkit.org/show_bug.cgi?id=80797 + _.max = function(obj, iterator, context) { + if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) { + return Math.max.apply(Math, obj); + } + if (!iterator && _.isEmpty(obj)) return -Infinity; + var result = {computed : -Infinity}; + each(obj, function(value, index, list) { + var computed = iterator ? iterator.call(context, value, index, list) : value; + computed >= result.computed && (result = {value : value, computed : computed}); + }); + return result.value; + }; + + // Return the minimum element (or element-based computation). + _.min = function(obj, iterator, context) { + if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) { + return Math.min.apply(Math, obj); + } + if (!iterator && _.isEmpty(obj)) return Infinity; + var result = {computed : Infinity}; + each(obj, function(value, index, list) { + var computed = iterator ? iterator.call(context, value, index, list) : value; + computed < result.computed && (result = {value : value, computed : computed}); + }); + return result.value; + }; + + // Shuffle an array. + _.shuffle = function(obj) { + var rand; + var index = 0; + var shuffled = []; + each(obj, function(value) { + rand = Math.floor(Math.random() * ++index); + shuffled[index - 1] = shuffled[rand]; + shuffled[rand] = value; + }); + return shuffled; + }; + + // Sort the object's values by a criterion produced by an iterator. + _.sortBy = function(obj, val, context) { + var iterator = _.isFunction(val) ? val : function(obj) { return obj[val]; }; + return _.pluck(_.map(obj, function(value, index, list) { + return { + value : value, + criteria : iterator.call(context, value, index, list) + }; + }).sort(function(left, right) { + var a = left.criteria, b = right.criteria; + if (a === void 0) return 1; + if (b === void 0) return -1; + return a < b ? -1 : a > b ? 1 : 0; + }), 'value'); + }; + + // Groups the object's values by a criterion. Pass either a string attribute + // to group by, or a function that returns the criterion. + _.groupBy = function(obj, val) { + var result = {}; + var iterator = _.isFunction(val) ? val : function(obj) { return obj[val]; }; + each(obj, function(value, index) { + var key = iterator(value, index); + (result[key] || (result[key] = [])).push(value); + }); + return result; + }; + + // Use a comparator function to figure out the smallest index at which + // an object should be inserted so as to maintain order. Uses binary search. + _.sortedIndex = function(array, obj, iterator) { + iterator || (iterator = _.identity); + var value = iterator(obj); + var low = 0, high = array.length; + while (low < high) { + var mid = (low + high) >> 1; + iterator(array[mid]) < value ? low = mid + 1 : high = mid; + } + return low; + }; + + // Safely convert anything iterable into a real, live array. + _.toArray = function(obj) { + if (!obj) return []; + if (_.isArray(obj)) return slice.call(obj); + if (_.isArguments(obj)) return slice.call(obj); + if (obj.toArray && _.isFunction(obj.toArray)) return obj.toArray(); + return _.values(obj); + }; + + // Return the number of elements in an object. + _.size = function(obj) { + return _.isArray(obj) ? obj.length : _.keys(obj).length; + }; + + // Array Functions + // --------------- + + // Get the first element of an array. Passing **n** will return the first N + // values in the array. Aliased as `head` and `take`. The **guard** check + // allows it to work with `_.map`. + _.first = _.head = _.take = function(array, n, guard) { + return (n != null) && !guard ? slice.call(array, 0, n) : array[0]; + }; + + // Returns everything but the last entry of the array. Especially useful on + // the arguments object. Passing **n** will return all the values in + // the array, excluding the last N. The **guard** check allows it to work with + // `_.map`. + _.initial = function(array, n, guard) { + return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n)); + }; + + // Get the last element of an array. Passing **n** will return the last N + // values in the array. The **guard** check allows it to work with `_.map`. + _.last = function(array, n, guard) { + if ((n != null) && !guard) { + return slice.call(array, Math.max(array.length - n, 0)); + } else { + return array[array.length - 1]; + } + }; + + // Returns everything but the first entry of the array. Aliased as `tail`. + // Especially useful on the arguments object. Passing an **index** will return + // the rest of the values in the array from that index onward. The **guard** + // check allows it to work with `_.map`. + _.rest = _.tail = function(array, index, guard) { + return slice.call(array, (index == null) || guard ? 1 : index); + }; + + // Trim out all falsy values from an array. + _.compact = function(array) { + return _.filter(array, function(value){ return !!value; }); + }; + + // Internal implementation of a recursive `flatten` function. + var flatten = function(input, shallow, output) { + each(input, function(value) { + if (_.isArray(value)) { + shallow ? push.apply(output, value) : flatten(value, shallow, output); + } else { + output.push(value); + } + }); + return output; + }; + + // Return a completely flattened version of an array. + _.flatten = function(array, shallow) { + return flatten(array, shallow, []); + }; + + // Return a version of the array that does not contain the specified value(s). + _.without = function(array) { + return _.difference(array, slice.call(arguments, 1)); + }; + + // Produce a duplicate-free version of the array. If the array has already + // been sorted, you have the option of using a faster algorithm. + // Aliased as `unique`. + _.uniq = _.unique = function(array, isSorted, iterator) { + var initial = iterator ? _.map(array, iterator) : array; + var results = []; + _.reduce(initial, function(memo, value, index) { + if (isSorted ? (_.last(memo) !== value || !memo.length) : !_.include(memo, value)) { + memo.push(value); + results.push(array[index]); + } + return memo; + }, []); + return results; + }; + + // Produce an array that contains the union: each distinct element from all of + // the passed-in arrays. + _.union = function() { + return _.uniq(flatten(arguments, true, [])); + }; + + // Produce an array that contains every item shared between all the + // passed-in arrays. + _.intersection = function(array) { + var rest = slice.call(arguments, 1); + return _.filter(_.uniq(array), function(item) { + return _.every(rest, function(other) { + return _.indexOf(other, item) >= 0; + }); + }); + }; + + // Take the difference between one array and a number of other arrays. + // Only the elements present in just the first array will remain. + _.difference = function(array) { + var rest = flatten(slice.call(arguments, 1), true, []); + return _.filter(array, function(value){ return !_.include(rest, value); }); + }; + + // Zip together multiple lists into a single array -- elements that share + // an index go together. + _.zip = function() { + var args = slice.call(arguments); + var length = _.max(_.pluck(args, 'length')); + var results = new Array(length); + for (var i = 0; i < length; i++) { + results[i] = _.pluck(args, "" + i); + } + return results; + }; + + // Zip together two arrays -- an array of keys and an array of values -- into + // a single object. + _.zipObject = function(keys, values) { + var result = {}; + for (var i = 0, l = keys.length; i < l; i++) { + result[keys[i]] = values[i]; + } + return result; + }; + + // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**), + // we need this function. Return the position of the first occurrence of an + // item in an array, or -1 if the item is not included in the array. + // Delegates to **ECMAScript 5**'s native `indexOf` if available. + // If the array is large and already in sort order, pass `true` + // for **isSorted** to use binary search. + _.indexOf = function(array, item, isSorted) { + if (array == null) return -1; + var i, l; + if (isSorted) { + i = _.sortedIndex(array, item); + return array[i] === item ? i : -1; + } + if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item); + for (i = 0, l = array.length; i < l; i++) if (array[i] === item) return i; + return -1; + }; + + // Delegates to **ECMAScript 5**'s native `lastIndexOf` if available. + _.lastIndexOf = function(array, item) { + if (array == null) return -1; + if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) return array.lastIndexOf(item); + var i = array.length; + while (i--) if (array[i] === item) return i; + return -1; + }; + + // Generate an integer Array containing an arithmetic progression. A port of + // the native Python `range()` function. See + // [the Python documentation](http://docs.python.org/library/functions.html#range). + _.range = function(start, stop, step) { + if (arguments.length <= 1) { + stop = start || 0; + start = 0; + } + step = arguments[2] || 1; + + var len = Math.max(Math.ceil((stop - start) / step), 0); + var idx = 0; + var range = new Array(len); + + while(idx < len) { + range[idx++] = start; + start += step; + } + + return range; + }; + + // Function (ahem) Functions + // ------------------ + + // Reusable constructor function for prototype setting. + var ctor = function(){}; + + // Create a function bound to a given object (assigning `this`, and arguments, + // optionally). Binding with arguments is also known as `curry`. + // Delegates to **ECMAScript 5**'s native `Function.bind` if available. + // We check for `func.bind` first, to fail fast when `func` is undefined. + _.bind = function bind(func, context) { + var bound, args; + if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1)); + if (!_.isFunction(func)) throw new TypeError; + args = slice.call(arguments, 2); + return bound = function() { + if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments))); + ctor.prototype = func.prototype; + var self = new ctor; + var result = func.apply(self, args.concat(slice.call(arguments))); + if (Object(result) === result) return result; + return self; + }; + }; + + // Bind all of an object's methods to that object. Useful for ensuring that + // all callbacks defined on an object belong to it. + _.bindAll = function(obj) { + var funcs = slice.call(arguments, 1); + if (funcs.length == 0) funcs = _.functions(obj); + each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); }); + return obj; + }; + + // Memoize an expensive function by storing its results. + _.memoize = function(func, hasher) { + var memo = {}; + hasher || (hasher = _.identity); + return function() { + var key = hasher.apply(this, arguments); + return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments)); + }; + }; + + // Delays a function for the given number of milliseconds, and then calls + // it with the arguments supplied. + _.delay = function(func, wait) { + var args = slice.call(arguments, 2); + return setTimeout(function(){ return func.apply(null, args); }, wait); + }; + + // Defers a function, scheduling it to run after the current call stack has + // cleared. + _.defer = function(func) { + return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1))); + }; + + // Returns a function, that, when invoked, will only be triggered at most once + // during a given window of time. + _.throttle = function(func, wait) { + var context, args, timeout, throttling, more, result; + var whenDone = _.debounce(function(){ more = throttling = false; }, wait); + return function() { + context = this; args = arguments; + var later = function() { + timeout = null; + if (more) func.apply(context, args); + whenDone(); + }; + if (!timeout) timeout = setTimeout(later, wait); + if (throttling) { + more = true; + } else { + throttling = true; + result = func.apply(context, args); + } + whenDone(); + return result; + }; + }; + + // Returns a function, that, as long as it continues to be invoked, will not + // be triggered. The function will be called after it stops being called for + // N milliseconds. If `immediate` is passed, trigger the function on the + // leading edge, instead of the trailing. + _.debounce = function(func, wait, immediate) { + var timeout; + return function() { + var context = this, args = arguments; + var later = function() { + timeout = null; + if (!immediate) func.apply(context, args); + }; + var callNow = immediate && !timeout; + clearTimeout(timeout); + timeout = setTimeout(later, wait); + if (callNow) func.apply(context, args); + }; + }; + + // Returns a function that will be executed at most one time, no matter how + // often you call it. Useful for lazy initialization. + _.once = function(func) { + var ran = false, memo; + return function() { + if (ran) return memo; + ran = true; + return memo = func.apply(this, arguments); + }; + }; + + // Returns the first function passed as an argument to the second, + // allowing you to adjust arguments, run code before and after, and + // conditionally execute the original function. + _.wrap = function(func, wrapper) { + return function() { + var args = [func].concat(slice.call(arguments, 0)); + return wrapper.apply(this, args); + }; + }; + + // Returns a function that is the composition of a list of functions, each + // consuming the return value of the function that follows. + _.compose = function() { + var funcs = arguments; + return function() { + var args = arguments; + for (var i = funcs.length - 1; i >= 0; i--) { + args = [funcs[i].apply(this, args)]; + } + return args[0]; + }; + }; + + // Returns a function that will only be executed after being called N times. + _.after = function(times, func) { + if (times <= 0) return func(); + return function() { + if (--times < 1) { + return func.apply(this, arguments); + } + }; + }; + + // Object Functions + // ---------------- + + // Retrieve the names of an object's properties. + // Delegates to **ECMAScript 5**'s native `Object.keys` + _.keys = nativeKeys || function(obj) { + if (obj !== Object(obj)) throw new TypeError('Invalid object'); + var keys = []; + for (var key in obj) if (_.has(obj, key)) keys[keys.length] = key; + return keys; + }; + + // Retrieve the values of an object's properties. + _.values = function(obj) { + return _.map(obj, _.identity); + }; + + // Return a sorted list of the function names available on the object. + // Aliased as `methods` + _.functions = _.methods = function(obj) { + var names = []; + for (var key in obj) { + if (_.isFunction(obj[key])) names.push(key); + } + return names.sort(); + }; + + // Extend a given object with all the properties in passed-in object(s). + _.extend = function(obj) { + each(slice.call(arguments, 1), function(source) { + for (var prop in source) { + obj[prop] = source[prop]; + } + }); + return obj; + }; + + // Return a copy of the object only containing the whitelisted properties. + _.pick = function(obj) { + var result = {}; + each(flatten(slice.call(arguments, 1), true, []), function(key) { + if (key in obj) result[key] = obj[key]; + }); + return result; + }; + + // Fill in a given object with default properties. + _.defaults = function(obj) { + each(slice.call(arguments, 1), function(source) { + for (var prop in source) { + if (obj[prop] == null) obj[prop] = source[prop]; + } + }); + return obj; + }; + + // Create a (shallow-cloned) duplicate of an object. + _.clone = function(obj) { + if (!_.isObject(obj)) return obj; + return _.isArray(obj) ? obj.slice() : _.extend({}, obj); + }; + + // Invokes interceptor with the obj, and then returns obj. + // The primary purpose of this method is to "tap into" a method chain, in + // order to perform operations on intermediate results within the chain. + _.tap = function(obj, interceptor) { + interceptor(obj); + return obj; + }; + + // Internal recursive comparison function for `isEqual`. + function eq(a, b, stack) { + // Identical objects are equal. `0 === -0`, but they aren't identical. + // See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal. + if (a === b) return a !== 0 || 1 / a == 1 / b; + // A strict comparison is necessary because `null == undefined`. + if (a == null || b == null) return a === b; + // Unwrap any wrapped objects. + if (a._chain) a = a._wrapped; + if (b._chain) b = b._wrapped; + // Invoke a custom `isEqual` method if one is provided. + if (a.isEqual && _.isFunction(a.isEqual)) return a.isEqual(b); + if (b.isEqual && _.isFunction(b.isEqual)) return b.isEqual(a); + // Compare `[[Class]]` names. + var className = toString.call(a); + if (className != toString.call(b)) return false; + switch (className) { + // Strings, numbers, dates, and booleans are compared by value. + case '[object String]': + // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is + // equivalent to `new String("5")`. + return a == String(b); + case '[object Number]': + // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for + // other numeric values. + return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b); + case '[object Date]': + case '[object Boolean]': + // Coerce dates and booleans to numeric primitive values. Dates are compared by their + // millisecond representations. Note that invalid dates with millisecond representations + // of `NaN` are not equivalent. + return +a == +b; + // RegExps are compared by their source patterns and flags. + case '[object RegExp]': + return a.source == b.source && + a.global == b.global && + a.multiline == b.multiline && + a.ignoreCase == b.ignoreCase; + } + if (typeof a != 'object' || typeof b != 'object') return false; + // Assume equality for cyclic structures. The algorithm for detecting cyclic + // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. + var length = stack.length; + while (length--) { + // Linear search. Performance is inversely proportional to the number of + // unique nested structures. + if (stack[length] == a) return true; + } + // Add the first object to the stack of traversed objects. + stack.push(a); + var size = 0, result = true; + // Recursively compare objects and arrays. + if (className == '[object Array]') { + // Compare array lengths to determine if a deep comparison is necessary. + size = a.length; + result = size == b.length; + if (result) { + // Deep compare the contents, ignoring non-numeric properties. + while (size--) { + // Ensure commutative equality for sparse arrays. + if (!(result = size in a == size in b && eq(a[size], b[size], stack))) break; + } + } + } else { + // Objects with different constructors are not equivalent. + if ('constructor' in a != 'constructor' in b || a.constructor != b.constructor) return false; + // Deep compare objects. + for (var key in a) { + if (_.has(a, key)) { + // Count the expected number of properties. + size++; + // Deep compare each member. + if (!(result = _.has(b, key) && eq(a[key], b[key], stack))) break; + } + } + // Ensure that both objects contain the same number of properties. + if (result) { + for (key in b) { + if (_.has(b, key) && !(size--)) break; + } + result = !size; + } + } + // Remove the first object from the stack of traversed objects. + stack.pop(); + return result; + } + + // Perform a deep comparison to check if two objects are equal. + _.isEqual = function(a, b) { + return eq(a, b, []); + }; + + // Is a given array, string, or object empty? + // An "empty" object has no enumerable own-properties. + _.isEmpty = function(obj) { + if (obj == null) return true; + if (_.isArray(obj) || _.isString(obj)) return obj.length === 0; + for (var key in obj) if (_.has(obj, key)) return false; + return true; + }; + + // Is a given value a DOM element? + _.isElement = function(obj) { + return !!(obj && obj.nodeType == 1); + }; + + // Is a given value an array? + // Delegates to ECMA5's native Array.isArray + _.isArray = nativeIsArray || function(obj) { + return toString.call(obj) == '[object Array]'; + }; + + // Is a given variable an object? + _.isObject = function(obj) { + return obj === Object(obj); + }; + + // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp. + each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp'], function(name) { + _['is' + name] = function(obj) { + return toString.call(obj) == '[object ' + name + ']'; + }; + }); + + // Define a fallback version of the method in browsers (ahem, IE), where + // there isn't any inspectable "Arguments" type. + if (!_.isArguments(arguments)) { + _.isArguments = function(obj) { + return !!(obj && _.has(obj, 'callee')); + }; + } + + // Is a given object a finite number? + _.isFinite = function(obj) { + return _.isNumber(obj) && isFinite(obj); + }; + + // Is the given value `NaN`? + _.isNaN = function(obj) { + // `NaN` is the only value for which `===` is not reflexive. + return obj !== obj; + }; + + // Is a given value a boolean? + _.isBoolean = function(obj) { + return obj === true || obj === false || toString.call(obj) == '[object Boolean]'; + }; + + // Is a given value equal to null? + _.isNull = function(obj) { + return obj === null; + }; + + // Is a given variable undefined? + _.isUndefined = function(obj) { + return obj === void 0; + }; + + // Shortcut function for checking if an object has a given property directly + // on itself (in other words, not on a prototype). + _.has = function(obj, key) { + return hasOwnProperty.call(obj, key); + }; + + // Utility Functions + // ----------------- + + // Run Underscore.js in *noConflict* mode, returning the `_` variable to its + // previous owner. Returns a reference to the Underscore object. + _.noConflict = function() { + root._ = previousUnderscore; + return this; + }; + + // Keep the identity function around for default iterators. + _.identity = function(value) { + return value; + }; + + // Run a function **n** times. + _.times = function(n, iterator, context) { + for (var i = 0; i < n; i++) iterator.call(context, i); + }; + + // List of HTML entities for escaping. + var htmlEscapes = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '/': '/' + }; + + // Regex containing the keys listed immediately above. + var htmlEscaper = /[&<>"'\/]/g; + + // Escape a string for HTML interpolation. + _.escape = function(string) { + return ('' + string).replace(htmlEscaper, function(match) { + return htmlEscapes[match]; + }); + }; + + // If the value of the named property is a function then invoke it; + // otherwise, return it. + _.result = function(object, property) { + if (object == null) return null; + var value = object[property]; + return _.isFunction(value) ? value.call(object) : value; + }; + + // Add your own custom functions to the Underscore object, ensuring that + // they're correctly added to the OOP wrapper as well. + _.mixin = function(obj) { + each(_.functions(obj), function(name){ + addToWrapper(name, _[name] = obj[name]); + }); + }; + + // Generate a unique integer id (unique within the entire client session). + // Useful for temporary DOM ids. + var idCounter = 0; + _.uniqueId = function(prefix) { + var id = idCounter++; + return prefix ? prefix + id : id; + }; + + // By default, Underscore uses ERB-style template delimiters, change the + // following template settings to use alternative delimiters. + _.templateSettings = { + evaluate : /<%([\s\S]+?)%>/g, + interpolate : /<%=([\s\S]+?)%>/g, + escape : /<%-([\s\S]+?)%>/g + }; + + // When customizing `templateSettings`, if you don't want to define an + // interpolation, evaluation or escaping regex, we need one that is + // guaranteed not to match. + var noMatch = /.^/; + + // Certain characters need to be escaped so that they can be put into a + // string literal. + var escapes = { + '\\': '\\', + "'": "'", + r: '\r', + n: '\n', + t: '\t', + u2028: '\u2028', + u2029: '\u2029' + }; + + for (var key in escapes) escapes[escapes[key]] = key; + var escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g; + var unescaper = /\\(\\|'|r|n|t|u2028|u2029)/g; + + // Within an interpolation, evaluation, or escaping, remove HTML escaping + // that had been previously added. + var unescape = function(code) { + return code.replace(unescaper, function(match, escape) { + return escapes[escape]; + }); + }; + + // JavaScript micro-templating, similar to John Resig's implementation. + // Underscore templating handles arbitrary delimiters, preserves whitespace, + // and correctly escapes quotes within interpolated code. + _.template = function(text, data, settings) { + settings = _.defaults(settings || {}, _.templateSettings); + + // Compile the template source, taking care to escape characters that + // cannot be included in a string literal and then unescape them in code + // blocks. + var source = "__p+='" + text + .replace(escaper, function(match) { + return '\\' + escapes[match]; + }) + .replace(settings.escape || noMatch, function(match, code) { + return "'+\n((__t=(" + unescape(code) + "))==null?'':_.escape(__t))+\n'"; + }) + .replace(settings.interpolate || noMatch, function(match, code) { + return "'+\n((__t=(" + unescape(code) + "))==null?'':__t)+\n'"; + }) + .replace(settings.evaluate || noMatch, function(match, code) { + return "';\n" + unescape(code) + "\n__p+='"; + }) + "';\n"; + + // If a variable is not specified, place data values in local scope. + if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n'; + + source = "var __t,__p='',__j=Array.prototype.join," + + "print=function(){__p+=__j.call(arguments,'')};\n" + + source + "return __p;\n"; + + var render = new Function(settings.variable || 'obj', '_', source); + if (data) return render(data, _); + var template = function(data) { + return render.call(this, data, _); + }; + + // Provide the compiled function source as a convenience for precompilation. + template.source = 'function(' + (settings.variable || 'obj') + '){\n' + source + '}'; + + return template; + }; + + // Add a "chain" function, which will delegate to the wrapper. + _.chain = function(obj) { + return _(obj).chain(); + }; + + // The OOP Wrapper + // --------------- + + // If Underscore is called as a function, it returns a wrapped object that + // can be used OO-style. This wrapper holds altered versions of all the + // underscore functions. Wrapped objects may be chained. + var wrapper = function(obj) { this._wrapped = obj; }; + + // Expose `wrapper.prototype` as `_.prototype` + _.prototype = wrapper.prototype; + + // Helper function to continue chaining intermediate results. + var result = function(obj, chain) { + return chain ? _(obj).chain() : obj; + }; + + // A method to easily add functions to the OOP wrapper. + var addToWrapper = function(name, func) { + wrapper.prototype[name] = function() { + var args = slice.call(arguments); + unshift.call(args, this._wrapped); + return result(func.apply(_, args), this._chain); + }; + }; + + // Add all of the Underscore functions to the wrapper object. + _.mixin(_); + + // Add all mutator Array functions to the wrapper. + each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) { + var method = ArrayProto[name]; + wrapper.prototype[name] = function() { + var obj = this._wrapped; + method.apply(obj, arguments); + if ((name == 'shift' || name == 'splice') && obj.length === 0) delete obj[0]; + return result(obj, this._chain); + }; + }); + + // Add all accessor Array functions to the wrapper. + each(['concat', 'join', 'slice'], function(name) { + var method = ArrayProto[name]; + wrapper.prototype[name] = function() { + return result(method.apply(this._wrapped, arguments), this._chain); + }; + }); + + // Start chaining a wrapped Underscore object. + wrapper.prototype.chain = function() { + this._chain = true; + return this; + }; + + // Extracts the result from a wrapped and chained object. + wrapper.prototype.value = function() { + return this._wrapped; + }; + +}).call(this); diff --git a/src/main/webapp/javascripts/libs/xplans/mssql.js b/src/main/webapp/javascripts/libs/xplans/mssql.js new file mode 100644 index 0000000..e561424 --- /dev/null +++ b/src/main/webapp/javascripts/libs/xplans/mssql.js @@ -0,0 +1,80 @@ +if (typeof (QP) == "undefined" || !QP) {
+ var QP = {}
+};
+
+(function() {
+ /* Draws the lines linking nodes in query plan diagram.
+ root - The document element in which the diagram is contained. */
+ QP.drawLines = function(root) {
+ if (root === null || root === undefined) {
+ // Try and find it ourselves
+ root = $(".qp-root").parent();
+ } else {
+ // Make sure the object passed is jQuery wrapped
+ root = $(root);
+ }
+ internalDrawLines(root);
+ };
+
+ /* Internal implementaiton of drawLines. */
+ function internalDrawLines(root) {
+ var canvas = getCanvas(root);
+ var canvasElm = canvas[0];
+
+ // Check for browser compatability
+ if (canvasElm.getContext !== null && canvasElm.getContext !== undefined) {
+ // Chrome is usually too quick with document.ready
+ window.setTimeout(function() {
+ var context = canvasElm.getContext("2d");
+
+ // The first root node may be smaller than the full query plan if using overflow
+ var firstNode = $(".qp-tr", root);
+ canvasElm.width = firstNode.outerWidth(true);
+ canvasElm.height = firstNode.outerHeight(true);
+ var offset = canvas.offset();
+
+ $(".qp-tr", root).each(function() {
+ var from = $("> * > .qp-node", $(this));
+ $("> * > .qp-tr > * > .qp-node", $(this)).each(function() {
+ drawLine(context, offset, from, $(this));
+ });
+ });
+ context.stroke();
+ }, 1);
+ }
+ }
+
+ /* Locates or creates the canvas element to use to draw lines for a given root element. */
+ function getCanvas(root) {
+ var returnValue = $("canvas", root);
+ if (returnValue.length == 0) {
+ root.prepend($("<canvas></canvas>")
+ .css("position", "absolute")
+ .css("top", 0).css("left", 0)
+ );
+ returnValue = $("canvas", root);
+ }
+ return returnValue;
+ }
+
+ /* Draws a line between two nodes.
+ context - The canvas context with which to draw.
+ offset - Canvas offset in the document.
+ from - The document jQuery object from which to draw the line.
+ to - The document jQuery object to which to draw the line. */
+ function drawLine(context, offset, from, to) {
+ var fromOffset = from.offset();
+ fromOffset.top += from.outerHeight() / 2;
+ fromOffset.left += from.outerWidth();
+
+ var toOffset = to.offset();
+ toOffset.top += to.outerHeight() / 2;
+
+ var midOffsetLeft = fromOffset.left / 2 + toOffset.left / 2;
+
+ context.moveTo(fromOffset.left - offset.left, fromOffset.top - offset.top);
+ context.lineTo(midOffsetLeft - offset.left, fromOffset.top - offset.top);
+ context.lineTo(midOffsetLeft - offset.left, toOffset.top - offset.top);
+ context.lineTo(toOffset.left - offset.left, toOffset.top - offset.top);
+ }
+})();
\ No newline at end of file diff --git a/src/main/webapp/javascripts/libs/xplans/oracle/flashver.js b/src/main/webapp/javascripts/libs/xplans/oracle/flashver.js new file mode 100644 index 0000000..222850c --- /dev/null +++ b/src/main/webapp/javascripts/libs/xplans/oracle/flashver.js @@ -0,0 +1,299 @@ +var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
+var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
+var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
+
+function ControlVersion()
+{
+ var version;
+ var axo;
+ var e;
+
+ // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
+
+ try
+ {
+ // version will be set for 7.X or greater players
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
+ version = axo.GetVariable("$version");
+ }
+ catch (e)
+ {
+ }
+
+ if (!version)
+ {
+ try
+ {
+ // version will be set for 6.X players only
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
+
+ // installed player is some revision of 6.0
+ // GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
+ // so we have to be careful.
+
+ // default to the first public version
+ version = "WIN 6,0,21,0";
+
+ // throws if AllowScripAccess does not exist (introduced in 6.0r47)
+ axo.AllowScriptAccess = "always";
+
+ // safe to call for 6.0r47 or greater
+ version = axo.GetVariable("$version");
+
+ } catch (e)
+ {
+ }
+ }
+
+ if (!version)
+ {
+ try
+ {
+ // version will be set for 4.X or 5.X player
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
+ version = axo.GetVariable("$version");
+ } catch (e)
+ {
+ }
+ }
+
+ if (!version)
+ {
+ try
+ {
+ // version will be set for 3.X player
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
+ version = "WIN 3,0,18,0";
+ }
+ catch (e)
+ {
+ }
+ }
+
+ if (!version)
+ {
+ try
+ {
+ // version will be set for 2.X player
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
+ version = "WIN 2,0,0,11";
+ }
+ catch (e)
+ {
+ version = -1;
+ }
+ }
+
+ return version;
+}
+
+// JavaScript helper required to detect Flash Player PlugIn version information
+function GetSwfVer()
+{
+ // NS/Opera version >= 3 check for Flash plugin in plugin array
+ var flashVer = -1;
+
+ if (navigator.plugins != null && navigator.plugins.length > 0)
+ {
+ if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"])
+ {
+ var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
+ var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
+ var descArray = flashDescription.split(" ");
+ var tempArrayMajor = descArray[2].split(".");
+ var versionMajor = tempArrayMajor[0];
+ var versionMinor = tempArrayMajor[1];
+ if ( descArray[3] != "" )
+ {
+ tempArrayMinor = descArray[3].split("r");
+ } else
+ {
+ tempArrayMinor = descArray[4].split("r");
+ }
+ var versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
+ var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
+ }
+ }
+ // MSN/WebTV 2.6 supports Flash 4
+ else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1)
+ flashVer = 4;
+ // WebTV 2.5 supports Flash 3
+ else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1)
+ flashVer = 3;
+ // older WebTV supports Flash 2
+ else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1)
+ flashVer = 2;
+ else if ( isIE && isWin && !isOpera )
+ {
+ flashVer = ControlVersion();
+ }
+ return flashVer;
+}
+
+// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
+function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
+{
+ versionStr = GetSwfVer();
+ if (versionStr == -1 )
+ {
+ return false;
+ }
+ else if (versionStr != 0)
+ {
+ if(isIE && isWin && !isOpera)
+ {
+ // Given "WIN 2,0,0,11"
+ tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"]
+ tempString = tempArray[1]; // "2,0,0,11"
+ versionArray = tempString.split(","); // ['2', '0', '0', '11']
+ } else
+ {
+ versionArray = versionStr.split(".");
+ }
+ var versionMajor = versionArray[0];
+ var versionMinor = versionArray[1];
+ var versionRevision = versionArray[2];
+
+ // is the major.revision >= requested major.revision AND the minor version >= requested minor
+ if (versionMajor > parseFloat(reqMajorVer))
+ {
+ return true;
+ } else if (versionMajor == parseFloat(reqMajorVer))
+ {
+ if (versionMinor > parseFloat(reqMinorVer))
+ return true;
+ else if (versionMinor == parseFloat(reqMinorVer))
+ {
+ if (versionRevision >= parseFloat(reqRevision))
+ return true;
+ }
+ }
+ return false;
+ }
+}
+
+function AC_AddExtension(src, ext)
+{
+ if (src.indexOf('?') != -1)
+ return src.replace(/\?/, ext+'?');
+ else
+ return src + ext;
+}
+
+function AC_Generateobj(objAttrs, params, embedAttrs)
+{
+ var str = '';
+ if (isIE && isWin && !isOpera)
+ {
+ str += '<object ';
+ for (var i in objAttrs)
+ str += i + '="' + objAttrs[i] + '" ';
+ for (var i in params)
+ str += '><param name="' + i + '" value="' + params[i] + '" /> ';
+ str += '></object>';
+ } else {
+ str += '<embed ';
+ for (var i in embedAttrs)
+ str += i + '="' + embedAttrs[i] + '" ';
+ str += '> </embed>';
+ }
+
+ //document.write(str); -- original line, commented out by Jake
+ return str; // line added by Jake
+}
+
+function AC_FL_RunContent()
+{
+ var ret =
+ AC_GetArgs
+ ( arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
+ , "application/x-shockwave-flash"
+ );
+ return AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
+}
+
+function AC_GetArgs(args, ext, srcParamName, classid, mimeType)
+{
+ var ret = new Object();
+ ret.embedAttrs = new Object();
+ ret.params = new Object();
+ ret.objAttrs = new Object();
+ for (var i=0; i < args.length; i=i+2)
+ {
+ var currArg = args[i].toLowerCase();
+
+ switch (currArg)
+ {
+ case "classid":
+ break;
+ case "pluginspage":
+ ret.embedAttrs[args[i]] = args[i+1];
+ break;
+ case "src":
+ case "movie":
+ args[i+1] = AC_AddExtension(args[i+1], ext);
+ ret.embedAttrs["src"] = args[i+1];
+ ret.params[srcParamName] = args[i+1];
+ break;
+ case "onafterupdate":
+ case "onbeforeupdate":
+ case "onblur":
+ case "oncellchange":
+ case "onclick":
+ case "ondblClick":
+ case "ondrag":
+ case "ondragend":
+ case "ondragenter":
+ case "ondragleave":
+ case "ondragover":
+ case "ondrop":
+ case "onfinish":
+ case "onfocus":
+ case "onhelp":
+ case "onmousedown":
+ case "onmouseup":
+ case "onmouseover":
+ case "onmousemove":
+ case "onmouseout":
+ case "onkeypress":
+ case "onkeydown":
+ case "onkeyup":
+ case "onload":
+ case "onlosecapture":
+ case "onpropertychange":
+ case "onreadystatechange":
+ case "onrowsdelete":
+ case "onrowenter":
+ case "onrowexit":
+ case "onrowsinserted":
+ case "onstart":
+ case "onscroll":
+ case "onbeforeeditfocus":
+ case "onactivate":
+ case "onbeforedeactivate":
+ case "ondeactivate":
+ case "type":
+ case "codebase":
+ case "id":
+ ret.objAttrs[args[i]] = args[i+1];
+ break;
+ case "width":
+ case "height":
+ case "align":
+ case "vspace":
+ case "hspace":
+ case "class":
+ case "title":
+ case "accesskey":
+ case "name":
+ case "tabindex":
+ ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
+ break;
+ default:
+ ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
+ }
+ }
+ ret.objAttrs["classid"] = classid;
+ if (mimeType) ret.embedAttrs["type"] = mimeType;
+ return ret;
+}
diff --git a/src/main/webapp/javascripts/libs/xplans/oracle/loadswf.js b/src/main/webapp/javascripts/libs/xplans/oracle/loadswf.js new file mode 100644 index 0000000..f87636c --- /dev/null +++ b/src/main/webapp/javascripts/libs/xplans/oracle/loadswf.js @@ -0,0 +1,271 @@ +//
+// This array should be modified everytime a new viewer is supported or when a
+// new version of a viewer is introduced.
+//
+var viewerMap =
+{
+ "sqlmonitor" : [ "11" ], // SQL monitor
+ "sqlpa" : [ "11" ], // SPA
+ "xplan" : [ "11" ], // xplan
+ "sql_detail" : [ "11", "11.2.0.2.0" ], // SQL Details
+ "EmergencyADDM" : [ "11" ], // Emergency ADDM
+ "ComparePeriodReport" : [ "11" ], // Compare Period
+ "AshViewer" : [ "11" ] // ASH Viewer
+
+};
+
+// minimum version of the flash player we need
+var requiredMajorVersion = 10;
+var requiredMinorVersion = 0;
+var requiredRevision = 0;
+
+// detect if flash player is available or not
+var hasProductInstall = DetectFlashVer(6, 0, 65);
+var hasRequestedVersion = DetectFlashVer(requiredMajorVersion,
+ requiredMinorVersion,
+ requiredRevision);
+
+// the foolowing code is to better support browser history
+Vars = function(qStr)
+{
+ this.numVars = 0;
+ if(qStr != null)
+ {
+ var nameValue, name;
+ var pairs = qStr.split('&');
+ var pairLen = pairs.length;
+ for(var i = 0; i < pairLen; i++)
+ {
+ var pair = pairs[i];
+ if( (pair.indexOf('=')!= -1) && (pair.length > 3) )
+ {
+ var nameValue = pair.split('=');
+ var name = nameValue[0];
+ var value = nameValue[1];
+ if(this[name] == null && name.length > 0 && value.length > 0)
+ {
+ this[name] = value;
+ this.numVars++;
+ }
+ }
+ }
+ }
+}
+
+Vars.prototype.toString = function(pre)
+{
+ var result = '';
+ if(pre == null) { pre = ''; }
+ for(var i in this)
+ {
+ if(this[i] != null && typeof(this[i]) != 'object' &&
+ typeof(this[i]) != 'function' && i != 'numVars')
+ {
+ result += pre + i + '=' + this[i] + '&';
+ }
+ }
+ if(result.length > 0)
+ result = result.substr(0, result.length-1);
+
+ return result;
+}
+
+function getSearch(wRef)
+{
+ var searchStr = '';
+ if(wRef.location.search.length > 1)
+ {
+ searchStr = new String(wRef.location.search);
+ searchStr = searchStr.substring(1, searchStr.length);
+ }
+ return searchStr;
+}
+
+
+//
+// parseVersion(): parse a version string assuming that a version has at most 5
+// components (e.g. "11.1.0.0.1"). Missing components are
+// assumed to be 0 (i.e. "11.2" is a shortcut for "11.2.0.0.0").
+//
+// Return an array of 5 numbers, one number per component version
+//
+function parseVersion(vString)
+{
+ // handle buggy values
+ if (typeof(vString) != 'string')
+ return [ 0, 0, 0, 0, 0 ];
+ else
+ {
+ // parse string
+ var x = vString.split('.');
+
+ // parse from string or default to 0 if can't parse.
+ // which is used for tests and maps to latest release
+ var v0 = (x[0] == 'X') ? 999 : (parseInt(x[0]) || 0);
+ var v1 = (x[1] == 'X') ? 999 : (parseInt(x[1]) || 0);
+ var v2 = (x[2] == 'X') ? 999 : (parseInt(x[2]) || 0);
+ var v3 = (x[3] == 'X') ? 999 : (parseInt(x[3]) || 0);
+ var v4 = (x[4] == 'X') ? 999 : (parseInt(x[4]) || 0);
+
+ // return
+ return new Array( v0, v1, v2, v3, v4 );
+ }
+}
+
+//
+// compareVersions(): compare two version strings
+// Return:
+// -1 if v1 > v2
+// 0 if v1 == v2
+// 1 if v1 < v2
+//
+function compareVersions(v1String, v2String)
+{
+ // parse v1 and v2
+ var v1 = parseVersion(v1String);
+ var v2 = parseVersion(v2String);
+
+ // compare the two versions
+ for (var verComp = 0; verComp < 5; verComp++)
+ {
+ if (v1[verComp] < v2[verComp])
+ return 1;
+ else if (v1[verComp] > v2[verComp])
+ return -1;
+ }
+
+ // must be equal
+ return 0;
+}
+
+
+//
+// findViewerFile(viewerName, xmlVersion): given viewer name and xml file
+// version, determine swf source file
+//
+function findViewerFile(viewerName, fileVersion)
+{
+ // determine object for that viewer
+ var viewerVersions = viewerMap[viewerName];
+
+ if (viewerVersions == null)
+ return(false);
+
+ // find appropriate version
+ var nbVersions = viewerVersions.length;
+
+ for (var verNum = 0; verNum < nbVersions; verNum++)
+ {
+ // found right version?
+ if (compareVersions(viewerVersions[verNum], fileVersion) < 0)
+ break;
+
+ }
+
+ if (verNum != 0) // choose the previous viewer version if any
+ verNum--;
+
+ var fileName = "http://download.oracle.com/otn_software/emviewers/" + viewerName + "/" + viewerVersions[verNum] +
+ "/" + viewerName;
+
+ return fileName;
+}
+
+function loadswf(xml){
+
+ // extract db_version and component name from the XML
+ var matchVersion = xml.match(/db_version="([\d\.]*)"/);
+ var matchComponent = xml.match(/orarep\/(\w*)\//);
+
+ // test for null
+ var viewer_component = (matchComponent == null)? '' : matchComponent[1];
+ var viewer_db_version = (matchVersion == null)? '' : matchVersion[1];
+
+ // handle case when the report tag has not available
+ if (viewer_component == '' &&
+ xml.match(/sql_monitor_report/))
+ {
+ // assume first generation SQL monitor report
+ viewer_component = 'sqlmonitor';
+ viewer_db_version = '11';
+ }
+
+ var lc_id = Math.floor(Math.random() * 100000).toString(16);
+ if (this != top)
+ {
+ top.Vars = Vars;
+ top.getSearch = getSearch;
+ top.lc_id = lc_id;
+ }
+
+ var url_xml = 'historyUrl=history.htm%3F&lconid=' + lc_id +
+ '&model='+ encodeURIComponent(xml) +'';
+
+ // main logic
+ if ( hasProductInstall && !hasRequestedVersion )
+ {
+ var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
+ var MMredirectURL = window.location;
+ document.title = document.title.slice(0, 47) +
+ " - Flash Player Installation";
+ var MMdoctitle = document.title;
+ return AC_FL_RunContent(
+ "src", "http://download.oracle.com/otn_software/emviewers/scripts/playerProductInstall",
+ "FlashVars", url_xml,
+ "width", "100%",
+ "height", "100%",
+ "align", "middle",
+ "id", viewer_component,
+ "quality", "high",
+ "bgcolor", "#FFFFFF",
+ "name", viewer_component,
+ "allowScriptAccess","always",
+ "type", "application/x-shockwave-flash",
+ "pluginspage", "http://www.adobe.com/go/getflashplayer"
+ );
+ }
+ else if (hasRequestedVersion)
+ {
+ // determine viewer swf file. Allow one to overwrite default using
+ // viewer_swf variable
+ var viewer_file = (typeof(viewer_swf) == 'string')?
+ viewer_swf : findViewerFile(viewer_component, viewer_db_version);
+
+ // alert('Viewing file with ' + viewer_file);
+
+ if (!viewer_file)
+ {
+ if (viewer_component != '')
+ alert('Sorry, viewer name \"' + viewer_component +
+ '\" is not yet supported...');
+ else
+ alert('Sorry, cannot not display report: unknown report type');
+ }
+ else
+ {
+ return AC_FL_RunContent(
+ "src", viewer_file,
+ "width", "100%",
+ "height", "100%",
+ "align", "middle",
+ "id", viewer_component,
+ "quality", "high",
+ "bgcolor", "#FFFFFF",
+ "name", viewer_component,
+ "flashvars", url_xml,
+ "allowScriptAccess","always",
+ "type", "application/x-shockwave-flash",
+ "pluginspage", "http://www.adobe.com/go/getflashplayer");
+ }
+ }
+ else
+ {
+ var alternateContent = 'Fail to display EM Standalone report. '
+ + 'This content requires the Adobe Flash Player. '
+ + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
+ return alternateContent;
+ }
+
+}
+
+
diff --git a/src/main/webapp/javascripts/main.js b/src/main/webapp/javascripts/main.js new file mode 100644 index 0000000..fa8052a --- /dev/null +++ b/src/main/webapp/javascripts/main.js @@ -0,0 +1,472 @@ + +requirejs.config({ + paths: { + jQuery: 'libs/jquery/jquery', + Underscore: 'libs/underscore', + Backbone: 'libs/backbone', + Bootstrap: 'libs/bootstrap', + Handlebars: 'libs/handlebars-1.0.0.beta.6', + HandlebarsHelpers: 'libs/handlebarsHelpers', + DateFormat: 'libs/date.format', + BrowserEngines: 'libs/browserEngines', + FiddleEditor: 'libs/fiddleEditor', + CodeMirror: 'libs/codemirror/codemirror', + MySQLCodeMirror: 'libs/codemirror/mode/mysql/mysql', + XPlans: 'libs/xplans', + DDLBuilder: 'libs/ddl_builder' + }, + + shim: { + Backbone: { + deps: ['Underscore', 'jQuery', 'libs/json2'], + exports: 'Backbone' + }, + jQuery: { + exports: '$' + }, + Underscore: { + exports: '_' + }, + CodeMirror: { + exports: 'CodeMirror' + }, + Handlebars: { + exports: 'Handlebars' + }, + DateFormat: { + exports: 'dateFormat' + }, + 'XPlans/oracle/loadswf': { + deps: ['XPlans/oracle/flashver'], + exports: "loadswf" + }, + 'XPlans/mssql': { + exports: "QP" + }, + + MySQLCodeMirror : ['CodeMirror'], + 'libs/jquery/jquery.blockUI': ['jQuery'], + 'libs/jquery/jquery.cookie': ['jQuery'], + 'Bootstrap/bootstrap-collapse': ['jQuery'], + 'Bootstrap/bootstrap-tab': ['jQuery'], + 'Bootstrap/bootstrap-dropdown': ['jQuery'], + 'Bootstrap/bootstrap-modal': ['jQuery'], + 'Bootstrap/bootstrap-tooltip': ['jQuery'], + 'Bootstrap/bootstrap-popover': ['jQuery','Bootstrap/bootstrap-tooltip'] + } + +}); + +require([ + 'jQuery', + 'Underscore', + 'dbTypes_cached', + 'fiddle_backbone/app', + 'DDLBuilder/ddl_builder', + 'libs/idselector' + ], + function($, _, dbTypesData, App, ddl_builder) { + + $.blockUI.defaults.overlayCSS.cursor = 'auto'; + $.blockUI.defaults.css.cursor = 'auto'; + + fiddleBackbone = App.initialize(dbTypesData); + + // Now follows miscellaneous UI event bindings + + + + /* MY FIDDLES */ + + $("#userInfo").on("click", "#myFiddles", function (e) { + e.preventDefault(); + + $('#myFiddlesModal').modal('show'); + $('#myFiddlesModal .modal-body').block({ message: "Loading..."}); + + var setupModal = function () { + var thisModal = $(this); + + // make sure the active tab content is shown + $(".tab-pane", this).removeClass("active"); + $($("#myFiddlesTabs li.active a").attr("href")).addClass("active"); + + thisModal.unblock(); + + $(".preview-schema").popover({ + placement: "left", + title: "Schema Structure", + content: function () { + return $(this).closest('td').find('.schemaPreviewWrapper').html(); + } + }); + + $(".preview-ddl").popover({ + placement: "left", + title: "Schema DDL", + content: function () { + return $(this).closest('td').find('.schemaPreviewWrapper').html(); + } + }); + + $(".result-sets").popover({ + placement: "left", + title: "Query Results", + content: function(){ + return $(this).closest('td').find('.resultSetWrapper').html(); + } + }); + + $(".preview-sql").popover({ + placement: "left", + title: "SQL Statements", + content: function () { + return $(this).closest('td').find('.resultSetWrapper').html(); + } + }); + + $(".showAll", this).click(function (e) { + e.preventDefault(); + $("tr.for-schema-" + $(this).closest("tr").attr("id")).show("fast"); + $(this).hide(); + }); + + $(".favorite", this).click(function (e) { + e.preventDefault(); + var thisA = this; + var containing_row = $(this).closest("tr.queryLog"); + $.post( "index.cfm/UserFiddles/setFavorite", + { + schema_def_id: $(this).attr('schema_def_id'), + query_id: $(this).attr('query_id'), + favorite: $(this).attr('href') == '#addFavorite' ? 1 : 0 + }, + function () { + if ($(thisA).attr('href') == '#addFavorite') + { + $(thisA) + .attr('href', '#removeFavorite') + .attr('title', 'Remove from favorites'); + } + else + { + $(thisA) + .attr('href', '#addFavorite') + .attr('title', 'Add to favorites'); + } + $("i", thisA).toggleClass("icon-star-empty icon-star"); + + if ($(thisA).closest('.tab-pane').attr("id") == 'favorites') { + $(".queryLog[schema_def_id=" + $(thisA).attr('schema_def_id') + "][query_id=" + $(thisA).attr('query_id') + "] a.favorite").replaceWith(thisA); + } + + $("#favorites").load("index.cfm/UserFiddles/getFavorites", {tz: (new Date()).getTimezoneOffset()/60}, setupModal); + + }); + }); + + $(".forgetSchema", this).click(function (e) { + e.preventDefault(); + var schema_identifier = $(this).closest("tr.schemaLog").attr("id"); + $.post("index.cfm/UserFiddles/forgetSchema", {schema_def_id: $(this).attr('schema_def_id')}, function () { + $("#" + schema_identifier + ",tr.for-schema-" + schema_identifier, thisModal).remove(); + }); + }); + + $(".forgetQuery", this).click(function (e) { + e.preventDefault(); + var containing_row = $(this).closest("tr.queryLog"); + $.post( "index.cfm/UserFiddles/forgetQuery", + { + schema_def_id: $(this).attr('schema_def_id'), + query_id: $(this).attr('query_id') + }, + function () { + containing_row.remove(); + }); + }); + + $(".forgetOtherQueries", this).click(function (e) { + e.preventDefault(); + var other_rows = $(this).closest("tbody").find('tr.queryLog[schema_def_id="'+ $(this).attr("schema_def_id") +'"][query_id!="'+ $(this).attr("query_id") +'"]'); + $.post( "index.cfm/UserFiddles/forgetOtherQueries", + { + schema_def_id: $(this).attr('schema_def_id'), + query_id: $(this).attr('query_id') + }, + function () { + other_rows.remove(); + }); + }); + + } + + $("#myFiddlesModal .modal-body").load("index.cfm/UserFiddles", {tz: (new Date()).getTimezoneOffset()/60}, setupModal); + }); + + + $("#myFiddlesTabs a").on("click", function (e) { + e.preventDefault(); + $(this).tab('show'); + }); + + $("#myFiddlesModal .modal-body").on("click", 'a', function (e) { + if (!$(this).hasClass('favorite')) + $('#myFiddlesModal').modal('hide'); + }); + + $("#myFiddlesModal").on("hidden", function () { + $(".popover-anchor", this).popover('hide'); + }); + + + /* LOGIN/LOGOUT */ + + // Upload localStorage fiddle history to server to use new mechanism + if ($("#user_choices", this).length) // simple way to detect if we are logged in + { + var fiddleArray = []; + try { + fullHistory = $.parseJSON(localStorage.getItem("fiddleHistory")); + + if (fullHistory.length) { + + fiddleArray = _.map(fullHistory, function(val, key){ + return [val.fragment, dateFormat(val.last_used, "mm/dd/yyyy HH:MM:ss")]; + }); + + $.post("index.cfm/UserFiddles/loadFromLocalStorage", { + localHistory: JSON.stringify(fiddleArray) + }, function(resp){ + var loadedFiddles = $.parseJSON(resp); + + // remove all entries from the local list which have + // been reported as loaded up into the server. + fullHistory = _.reject(fullHistory, function(localFiddle){ + + // look through all the fiddles which have been loaded into the server + return _.find(loadedFiddles, function(serverFiddle){ + + // if we find a match for the current "localFiddle" amongst + // those loaded onto the server, then remove it from the local list + return serverFiddle[0] == localFiddle.fragment; + }); + + }); + + // assuming all went well, this should be setting it to an empty array + localStorage.setItem("fiddleHistory", JSON.stringify(fullHistory)); + }); + } + } + catch (e) { + // something went wrong with our attempt to access localStorage. Maybe it's not available? + } + } + + $("#loginModal form").submit(function () { + $("#hash", this).val(window.location.hash); + }); + + $("#loginModal").on("hidden", function () { + // this fixes a bug with the openid UI staying open even after the login modal has closed. + $("iframe") + .css("display", "none"); + + }); + + $("#userInfo").on("click", "#logout", function (e) { + e.preventDefault(); + + // fun way to modify a link after it's been clicked - change it to a form and attach a hidden input to it. + $("<form>", { action: $(this).attr("href"), method: "GET"}) + .append($("<input>", { type: "hidden", name:"hash", value: window.location.hash})) + .submit(); + }); + + + /* TEXT TO DDL */ + + $("#textToDDLModal .btn").click(function (e){ + e.preventDefault(); + + var builder = new ddl_builder({ + tableName: $("#tableName").val() + }) + .setupForDBType(fiddleBackbone.dbTypes.getSelectedType().get("simple_name"), fiddleBackbone.schemaDef.get('statement_separator')); + + var ddl = builder.parse($("#raw").val()); + + $("#parseResults").text(ddl); + + if ($(this).attr('id') == 'appendDDL') + { + fiddleBackbone.schemaDef.set("ddl", fiddleBackbone.schemaDef.get("ddl") + "\n\n" + ddl); + fiddleBackbone.schemaDef.trigger("reloaded"); + $('#textToDDLModal').modal('hide'); + } + }); + + + /* FULLSCREEN EDITS */ + + function toggleFullscreenNav(option) + { + + if ($("#exit_fullscreen").css('display') == "none") + { + $("body").css("overflow-y", "hidden"); + $(".navbar-fixed-top").css("position", "fixed").css("margin", 0); + + $("#exit_fullscreen").css('display', 'block'); + $("#exit_fullscreen span").text("Exit Fullscreen " + option); + $(".nav-collapse, .btn-navbar, #db_type_label_collapsed .navbar-text").css('display', 'none'); + } + else + { + $("body").css("overflow-y", "auto"); + $("body").css("height", "100%"); + $(".navbar-fixed-top").css("position", "").css("margin", ""); + + $("#exit_fullscreen").css('display', 'none'); + $(".nav-collapse, .btn-navbar, #db_type_label_collapsed .navbar-text").css('display', ''); + } + + } + + $("#exit_fullscreen").on('click', function (e) { + e.preventDefault(); + + fiddleBackbone.schemaDefView.editor.setFullscreen(false); + fiddleBackbone.queryView.editor.setFullscreen(false); + + toggleFullscreenNav(''); + resizeLayout(); + }); + + $("#schemaFullscreen").on('click', function (e) { + e.preventDefault(); + + fiddleBackbone.schemaDefView.editor.setFullscreen(true); + + toggleFullscreenNav('Schema Editor'); + }); + + + $("#queryFullscreen").on('click', function (e) { + e.preventDefault(); + + fiddleBackbone.queryView.editor.setFullscreen(true); + + toggleFullscreenNav('Query Editor'); + }); + + + /* SCHEMA BROWSER */ + + $("#schemaBrowser").on('click', function (e) { + e.preventDefault(); + if (!$(this).attr('disabled')) { + $('#fiddleFormDDL .CodeMirror, .ddl_actions').css('display', 'none'); + $('#browser, .browser_actions').css('display', 'block'); + } + }); + + $("#browser").on('click', '.tables a', function (e) { + e.preventDefault(); + $('i', this).toggleClass("icon-minus icon-plus"); + $(this).siblings('.columns').toggle(); + }); + + $("#ddlEdit").on('click', function (e) { + e.preventDefault(); + $('#fiddleFormDDL .CodeMirror, .ddl_actions').css('display', 'block'); + $('#browser, .browser_actions').css('display', 'none'); + + }) + + + /* RESIZING UI*/ + function resizeLayout(){ + + var wheight = $(window).height() - 165; + if (wheight > 400) { + var container_width = $("#schema-output").width(); + + + $('#schema-output').height((wheight - 10) * 0.7); + $('#output').css("min-height", ((wheight - 10) * 0.3) + "px"); + + + if (!fiddleBackbone.schemaDefView.editor.isFullscreen()) { + $('#fiddleFormDDL .CodeMirror-scroll').css('height', ($('#fiddleFormDDL').height() - (5 + $('#fiddleFormDDL .action_buttons').height())) + "px"); + $('#schema_ddl').css('height', ($('#fiddleFormDDL').height() - (15 + $('#fiddleFormDDL .action_buttons').height())) + "px"); + $('#fiddleFormDDL .CodeMirror-scroll .CodeMirror-gutter').height($('#fiddleFormDDL .CodeMirror-scroll').height() - 2); + } + else { + $('#fiddleFormDDL .CodeMirror-scroll, #schema_ddl').css('height', $(window).height() + "px"); + $('#fiddleFormDDL .CodeMirror-scroll .CodeMirror-gutter').height('height', $(window).height() + "px"); + + } + + // textarea sql + if (!fiddleBackbone.queryView.editor.isFullscreen()) { + $('#fiddleFormSQL .CodeMirror-scroll').css('height', ($('#fiddleFormSQL').height() - (5 + $('#fiddleFormSQL .action_buttons').height())) + "px"); + $('#sql').css('height', ($('#fiddleFormSQL').height() - (15 + $('#fiddleFormSQL .action_buttons').height())) + "px"); + $('#fiddleFormSQL .CodeMirror-scroll .CodeMirror-gutter').height($('#fiddleFormSQL .CodeMirror-scroll').height() - 2); + } + else { + + $('#fiddleFormSQL .CodeMirror-scroll, #sql').css('height', $(window).height() + "px"); + $('#fiddleFormSQL .CodeMirror-scroll .CodeMirror-gutter').css('height', $(window).height() + "px"); + + } + + + // $('#sql').width($('#fiddleFormSQL').width() - 10); + // $('#schema_ddl').width($('#fiddleFormDDL').width() - 10); + + $('#browser').height($('#fiddleFormDDL .CodeMirror-scroll').height()); + + var adjustBlockMsg = function (blockedObj) { + var msgSize = + { + "height": $(".blockMsg", blockedObj).height(), + "width": $(".blockMsg", blockedObj).width() + }; + var objSize = + { + "height": $(blockedObj).height(), + "width": $(blockedObj).width() + }; + + $(".blockMsg", blockedObj) + .css("top", (objSize.height-msgSize.height)/2) + .css("left", (objSize.width-msgSize.width)/2); + + } + + adjustBlockMsg($("div.sql.panel")); + adjustBlockMsg($("#output")); + + fiddleBackbone.schemaDefView.refresh(); + fiddleBackbone.queryView.refresh(); + } + } + + + $(window).bind('resize', resizeLayout); + setTimeout(resizeLayout, 1); + + + /* COLLAPSING NAV (for responsive UI) */ + + $(".nav").on('click', 'a', function (e) { + $(".nav-collapse.in").collapse('hide'); + }); + + + + + +}); diff --git a/src/main/webapp/javascripts/qunit_main.js b/src/main/webapp/javascripts/qunit_main.js new file mode 100644 index 0000000..ed3bbcf --- /dev/null +++ b/src/main/webapp/javascripts/qunit_main.js @@ -0,0 +1,63 @@ + +requirejs.config({ + paths: { + jQuery: 'libs/jquery/jquery', + Underscore: 'libs/underscore', + Backbone: 'libs/backbone', + Bootstrap: 'libs/bootstrap', + Handlebars: 'libs/handlebars-1.0.0.beta.6', + HandlebarsHelpers: 'libs/handlebarsHelpers', + DateFormat: 'libs/date.format', + BrowserEngines: 'libs/browserEngines', + FiddleEditor: 'libs/fiddleEditor', + CodeMirror: 'libs/codemirror/codemirror', + MySQLCodeMirror: 'libs/codemirror/mode/mysql/mysql', + XPlans: 'libs/xplans', + DDLBuilder: 'libs/ddl_builder', + QUnit: 'libs/qunit-1.10.0' + }, + + shim: { + Backbone: { + deps: ['Underscore', 'jQuery', 'libs/json2'], + exports: 'Backbone' + }, + jQuery: { + exports: '$' + }, + Underscore: { + exports: '_' + }, + CodeMirror: { + exports: 'CodeMirror' + }, + Handlebars: { + exports: 'Handlebars' + }, + DateFormat: { + exports: 'dateFormat' + }, + 'XPlans/oracle/loadswf': { + deps: ['XPlans/oracle/flashver'], + exports: "loadswf" + }, + 'XPlans/mssql': { + exports: "QP" + }, + QUnit: { + exports: function () { return { "test": test, "equal": equal, "ok": ok } } + }, + MySQLCodeMirror : ['CodeMirror'], + 'libs/jquery/jquery.blockUI': ['jQuery'], + 'libs/jquery/jquery.cookie': ['jQuery'], + 'Bootstrap/bootstrap-collapse': ['jQuery'], + 'Bootstrap/bootstrap-tab': ['jQuery'], + 'Bootstrap/bootstrap-dropdown': ['jQuery'], + 'Bootstrap/bootstrap-modal': ['jQuery'], + 'Bootstrap/bootstrap-tooltip': ['jQuery'], + 'Bootstrap/bootstrap-popover': ['jQuery','Bootstrap/bootstrap-tooltip'] + } + +}); + +require(['libs/ddl_builder/qunit/main'], function () {}); diff --git a/src/main/webapp/javascripts/text.js b/src/main/webapp/javascripts/text.js new file mode 100644 index 0000000..bf61a3f --- /dev/null +++ b/src/main/webapp/javascripts/text.js @@ -0,0 +1,308 @@ +/** + * @license RequireJS text 2.0.3 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/requirejs/text for details + */ +/*jslint regexp: true */ +/*global require: false, XMLHttpRequest: false, ActiveXObject: false, + define: false, window: false, process: false, Packages: false, + java: false, location: false */ + +define(['module'], function (module) { + 'use strict'; + + var text, fs, + progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'], + xmlRegExp = /^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im, + bodyRegExp = /<body[^>]*>\s*([\s\S]+)\s*<\/body>/im, + hasLocation = typeof location !== 'undefined' && location.href, + defaultProtocol = hasLocation && location.protocol && location.protocol.replace(/\:/, ''), + defaultHostName = hasLocation && location.hostname, + defaultPort = hasLocation && (location.port || undefined), + buildMap = [], + masterConfig = (module.config && module.config()) || {}; + + text = { + version: '2.0.3', + + strip: function (content) { + //Strips <?xml ...?> declarations so that external SVG and XML + //documents can be added to a document without worry. Also, if the string + //is an HTML document, only the part inside the body tag is returned. + if (content) { + content = content.replace(xmlRegExp, ""); + var matches = content.match(bodyRegExp); + if (matches) { + content = matches[1]; + } + } else { + content = ""; + } + return content; + }, + + jsEscape: function (content) { + return content.replace(/(['\\])/g, '\\$1') + .replace(/[\f]/g, "\\f") + .replace(/[\b]/g, "\\b") + .replace(/[\n]/g, "\\n") + .replace(/[\t]/g, "\\t") + .replace(/[\r]/g, "\\r") + .replace(/[\u2028]/g, "\\u2028") + .replace(/[\u2029]/g, "\\u2029"); + }, + + createXhr: masterConfig.createXhr || function () { + //Would love to dump the ActiveX crap in here. Need IE 6 to die first. + var xhr, i, progId; + if (typeof XMLHttpRequest !== "undefined") { + return new XMLHttpRequest(); + } else if (typeof ActiveXObject !== "undefined") { + for (i = 0; i < 3; i += 1) { + progId = progIds[i]; + try { + xhr = new ActiveXObject(progId); + } catch (e) {} + + if (xhr) { + progIds = [progId]; // so faster next time + break; + } + } + } + + return xhr; + }, + + /** + * Parses a resource name into its component parts. Resource names + * look like: module/name.ext!strip, where the !strip part is + * optional. + * @param {String} name the resource name + * @returns {Object} with properties "moduleName", "ext" and "strip" + * where strip is a boolean. + */ + parseName: function (name) { + var strip = false, index = name.indexOf("."), + modName = name.substring(0, index), + ext = name.substring(index + 1, name.length); + + index = ext.indexOf("!"); + if (index !== -1) { + //Pull off the strip arg. + strip = ext.substring(index + 1, ext.length); + strip = strip === "strip"; + ext = ext.substring(0, index); + } + + return { + moduleName: modName, + ext: ext, + strip: strip + }; + }, + + xdRegExp: /^((\w+)\:)?\/\/([^\/\\]+)/, + + /** + * Is an URL on another domain. Only works for browser use, returns + * false in non-browser environments. Only used to know if an + * optimized .js version of a text resource should be loaded + * instead. + * @param {String} url + * @returns Boolean + */ + useXhr: function (url, protocol, hostname, port) { + var uProtocol, uHostName, uPort, + match = text.xdRegExp.exec(url); + if (!match) { + return true; + } + uProtocol = match[2]; + uHostName = match[3]; + + uHostName = uHostName.split(':'); + uPort = uHostName[1]; + uHostName = uHostName[0]; + + return (!uProtocol || uProtocol === protocol) && + (!uHostName || uHostName.toLowerCase() === hostname.toLowerCase()) && + ((!uPort && !uHostName) || uPort === port); + }, + + finishLoad: function (name, strip, content, onLoad) { + content = strip ? text.strip(content) : content; + if (masterConfig.isBuild) { + buildMap[name] = content; + } + onLoad(content); + }, + + load: function (name, req, onLoad, config) { + //Name has format: some.module.filext!strip + //The strip part is optional. + //if strip is present, then that means only get the string contents + //inside a body tag in an HTML string. For XML/SVG content it means + //removing the <?xml ...?> declarations so the content can be inserted + //into the current doc without problems. + + // Do not bother with the work if a build and text will + // not be inlined. + if (config.isBuild && !config.inlineText) { + onLoad(); + return; + } + + masterConfig.isBuild = config.isBuild; + + var parsed = text.parseName(name), + nonStripName = parsed.moduleName + '.' + parsed.ext, + url = req.toUrl(nonStripName), + useXhr = (masterConfig.useXhr) || + text.useXhr; + + //Load the text. Use XHR if possible and in a browser. + if (!hasLocation || useXhr(url, defaultProtocol, defaultHostName, defaultPort)) { + text.get(url, function (content) { + text.finishLoad(name, parsed.strip, content, onLoad); + }, function (err) { + if (onLoad.error) { + onLoad.error(err); + } + }); + } else { + //Need to fetch the resource across domains. Assume + //the resource has been optimized into a JS module. Fetch + //by the module name + extension, but do not include the + //!strip part to avoid file system issues. + req([nonStripName], function (content) { + text.finishLoad(parsed.moduleName + '.' + parsed.ext, + parsed.strip, content, onLoad); + }); + } + }, + + write: function (pluginName, moduleName, write, config) { + if (buildMap.hasOwnProperty(moduleName)) { + var content = text.jsEscape(buildMap[moduleName]); + write.asModule(pluginName + "!" + moduleName, + "define(function () { return '" + + content + + "';});\n"); + } + }, + + writeFile: function (pluginName, moduleName, req, write, config) { + var parsed = text.parseName(moduleName), + nonStripName = parsed.moduleName + '.' + parsed.ext, + //Use a '.js' file name so that it indicates it is a + //script that can be loaded across domains. + fileName = req.toUrl(parsed.moduleName + '.' + + parsed.ext) + '.js'; + + //Leverage own load() method to load plugin value, but only + //write out values that do not have the strip argument, + //to avoid any potential issues with ! in file names. + text.load(nonStripName, req, function (value) { + //Use own write() method to construct full module value. + //But need to create shell that translates writeFile's + //write() to the right interface. + var textWrite = function (contents) { + return write(fileName, contents); + }; + textWrite.asModule = function (moduleName, contents) { + return write.asModule(moduleName, fileName, contents); + }; + + text.write(pluginName, nonStripName, textWrite, config); + }, config); + } + }; + + if (masterConfig.env === 'node' || (!masterConfig.env && + typeof process !== "undefined" && + process.versions && + !!process.versions.node)) { + //Using special require.nodeRequire, something added by r.js. + fs = require.nodeRequire('fs'); + + text.get = function (url, callback) { + var file = fs.readFileSync(url, 'utf8'); + //Remove BOM (Byte Mark Order) from utf8 files if it is there. + if (file.indexOf('\uFEFF') === 0) { + file = file.substring(1); + } + callback(file); + }; + } else if (masterConfig.env === 'xhr' || (!masterConfig.env && + text.createXhr())) { + text.get = function (url, callback, errback) { + var xhr = text.createXhr(); + xhr.open('GET', url, true); + + //Allow overrides specified in config + if (masterConfig.onXhr) { + masterConfig.onXhr(xhr, url); + } + + xhr.onreadystatechange = function (evt) { + var status, err; + //Do not explicitly handle errors, those should be + //visible via console output in the browser. + if (xhr.readyState === 4) { + status = xhr.status; + if (status > 399 && status < 600) { + //An http 4xx or 5xx error. Signal an error. + err = new Error(url + ' HTTP status: ' + status); + err.xhr = xhr; + errback(err); + } else { + callback(xhr.responseText); + } + } + }; + xhr.send(null); + }; + } else if (masterConfig.env === 'rhino' || (!masterConfig.env && + typeof Packages !== 'undefined' && typeof java !== 'undefined')) { + //Why Java, why is this so awkward? + text.get = function (url, callback) { + var stringBuffer, line, + encoding = "utf-8", + file = new java.io.File(url), + lineSeparator = java.lang.System.getProperty("line.separator"), + input = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(file), encoding)), + content = ''; + try { + stringBuffer = new java.lang.StringBuffer(); + line = input.readLine(); + + // Byte Order Mark (BOM) - The Unicode Standard, version 3.0, page 324 + // http://www.unicode.org/faq/utf_bom.html + + // Note that when we use utf-8, the BOM should appear as "EF BB BF", but it doesn't due to this bug in the JDK: + // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058 + if (line && line.length() && line.charAt(0) === 0xfeff) { + // Eat the BOM, since we've already found the encoding on this file, + // and we plan to concatenating this buffer with others; the BOM should + // only appear at the top of a file. + line = line.substring(1); + } + + stringBuffer.append(line); + + while ((line = input.readLine()) !== null) { + stringBuffer.append(lineSeparator); + stringBuffer.append(line); + } + //Make sure we return a JavaScript string and not a Java string. + content = String(stringBuffer.toString()); //String + } finally { + input.close(); + } + callback(content); + }; + } + + return text; +}); diff --git a/src/main/webapp/javascripts_min/.gitignore b/src/main/webapp/javascripts_min/.gitignore new file mode 100644 index 0000000..d770fc1 --- /dev/null +++ b/src/main/webapp/javascripts_min/.gitignore @@ -0,0 +1,2 @@ +
+/dbTypes_cached.js diff --git a/src/main/webapp/javascripts_min/build.txt b/src/main/webapp/javascripts_min/build.txt new file mode 100644 index 0000000..5114a89 --- /dev/null +++ b/src/main/webapp/javascripts_min/build.txt @@ -0,0 +1,57 @@ + +main.js +---------------- +libs/jquery/jquery.js +libs/underscore.js +dbTypes_cached.js +libs/browserEngines/sqlite_driver.js +libs/browserEngines/sqljs_driver.js +libs/browserEngines/websql_driver.js +libs/browserEngines/engines.js +libs/json2.js +libs/backbone.js +fiddle_backbone/models/UsedFiddle.js +fiddle_backbone/models/MyFiddleHistory.js +fiddle_backbone/models/DBType.js +fiddle_backbone/models/DBTypesList.js +fiddle_backbone/models/SchemaDef.js +fiddle_backbone/models/Query.js +libs/handlebars-1.0.0.beta.6.js +text.js +text!fiddle_backbone/templates/dbTypes.html +fiddle_backbone/views/DBTypesList.js +libs/codemirror/codemirror.js +libs/codemirror/mode/mysql/mysql.js +libs/fiddleEditor.js +libs/renderTerminator.js +text!fiddle_backbone/templates/schemaOutput.html +text!fiddle_backbone/templates/schemaBrowser.html +fiddle_backbone/views/SchemaDef.js +libs/xplans/oracle/flashver.js +libs/xplans/oracle/loadswf.js +libs/xplans/mssql.js +text!fiddle_backbone/templates/queryTabularOutput.html +text!fiddle_backbone/templates/queryPlaintextOutput.html +libs/handlebarsHelpers/divider_display.js +libs/handlebarsHelpers/each_simple_value_with_index.js +libs/handlebarsHelpers/each_with_index.js +libs/handlebarsHelpers/result_display_padded.js +libs/handlebarsHelpers/result_display.js +fiddle_backbone/views/Query.js +fiddle_backbone/router.js +libs/jquery/jquery.blockUI.js +libs/jquery/jquery.cookie.js +libs/bootstrap/bootstrap-collapse.js +libs/bootstrap/bootstrap-tab.js +libs/bootstrap/bootstrap-dropdown.js +libs/bootstrap/bootstrap-modal.js +libs/bootstrap/bootstrap-tooltip.js +libs/bootstrap/bootstrap-popover.js +fiddle_backbone/app.js +libs/date.format.js +text!DDLBuilder/templates/generic.sql +text!DDLBuilder/templates/oracle.sql +text!DDLBuilder/templates/sqlite.sql +libs/ddl_builder/ddl_builder.js +libs/idselector.js +main.js diff --git a/src/main/webapp/javascripts_min/fiddle_backbone/app.js b/src/main/webapp/javascripts_min/fiddle_backbone/app.js new file mode 100644 index 0000000..b6fc0ce --- /dev/null +++ b/src/main/webapp/javascripts_min/fiddle_backbone/app.js @@ -0,0 +1 @@ +define(["BrowserEngines/engines","fiddle_backbone/models/UsedFiddle","fiddle_backbone/models/MyFiddleHistory","fiddle_backbone/models/DBTypesList","fiddle_backbone/models/SchemaDef","fiddle_backbone/models/Query","fiddle_backbone/views/DBTypesList","fiddle_backbone/views/SchemaDef","fiddle_backbone/views/Query","fiddle_backbone/router","libs/renderTerminator","libs/jquery/jquery.blockUI","libs/jquery/jquery.cookie","Bootstrap/bootstrap-collapse","Bootstrap/bootstrap-tab","Bootstrap/bootstrap-dropdown","Bootstrap/bootstrap-modal","Bootstrap/bootstrap-tooltip","Bootstrap/bootstrap-popover"],function(e,t,n,r,i,s,o,u,a,f,l){var c=function(c){var h={},p=new n,d=new r,v=new i({browserEngines:e}),m=new s({schemaDef:v}),g=new o({el:$("#db_type_id")[0],collection:d}),y=new u({id:"schema_ddl",model:v,output_el:$("#output"),browser_el:$("#browser")}),b=new a({id:"sql",model:m,output_el:$("#output")});d.on("change",function(){g.render(),v.has("dbType")&&v.set("ready",v.get("dbType").id==this.getSelectedType().id)}),v.on("change",function(){this.hasChanged("ready")&&y.updateDependents(),this.hasChanged("errorMessage")&&y.renderOutput(),this.hasChanged("schema_structure")&&y.renderSchemaBrowser()}),v.on("reloaded",function(){this.set("dbType",d.getSelectedType()),y.render()}),m.on("reloaded",function(){this.set({pendingChanges:!1},{silent:!0}),b.render()}),v.on("built failed",function(){$("#buildSchema label").prop("disabled",!1),$("#buildSchema label").html($("#buildSchema label").data("originalValue")),y.renderOutput(),y.renderSchemaBrowser()}),m.on("change",function(){(this.hasChanged("sql")||this.hasChanged("statement_separator"))&&!this.hasChanged("id")&&!this.get("pendingChanges")&&this.set({pendingChanges:!0},{silent:!0})}),m.on("executed",function(){var e=$(".runQuery");e.prop("disabled",!1),e.html(e.data("originalValue")),this.set({pendingChanges:!1},{silent:!0}),b.renderOutput()}),$("#buildSchema").click(function(e){var t=$("label",this);e.preventDefault();if(t.prop("disabled"))return!1;t.data("originalValue",t.html()),t.prop("disabled",!0).text("Building Schema..."),v.build(d)});var w=function(e){var t=$(".runQuery");e.preventDefault();if(t.prop("disabled"))return!1;t.data("originalValue",t.html()),t.prop("disabled",!0).text("Executing SQL..."),b.checkForSelectedText(),m.execute()};return $(".runQuery").click(w),$(document).keyup(function(e){e.keyCode==116&&(e.preventDefault(),w(e))}),$("#runQueryOptions li a").click(function(e){e.preventDefault(),b.setOutputType(this.id),b.renderOutput()}),$("#queryPrettify").click(function(e){var t=$(this);t.attr("disabled",!0),e.preventDefault(),$.post("index.cfm/proxy/formatSQL",{sql:m.get("sql")},function(e){m.set({sql:e}),m.trigger("reloaded"),m.set({pendingChanges:!0}),t.attr("disabled",!1)})}),$(".terminator .dropdown-menu a").on("click",function(e){e.preventDefault(),l($(this).closest(".panel"),$(this).attr("href")),$(this).closest(".panel").hasClass("schema")?y.handleSchemaChange():m.set({pendingChanges:!0,statement_separator:$(this).attr("href")},{silent:!0})}),$(window).bind("beforeunload",function(){if(m.get("pendingChanges"))return"Warning! You have made changes to your query which will be lost. Continue?'"}),d.on("reset",function(){h=f.initialize(d,v,m,p,g),this.length&&!this.getSelectedType()&&this.setSelectedType(this.first().id,!0),g.render(),y.render(),b.render()}),p.on("change reset remove",function(){localStorage&&localStorage.setItem("fiddleHistory",JSON.stringify(this.toJSON()))}),$("#clear").click(function(e){e.preventDefault(),v.reset(),m.reset(),h.navigate("!"+d.getSelectedType().id,{trigger:!0})}),$("#sample").click(function(e){e.preventDefault(),h.navigate("!"+d.getSelectedType().get("sample_fragment"),{trigger:!0})}),d.on("change",function(){g.render(),m.id&&v.get("short_code").length&&v.get("dbType").id==this.getSelectedType().id?h.navigate("!"+this.getSelectedType().id+"/"+v.get("short_code")+"/"+m.id):v.get("short_code").length&&v.get("dbType").id==this.getSelectedType().id?h.navigate("!"+this.getSelectedType().id+"/"+v.get("short_code")):h.navigate("!"+this.getSelectedType().id)}),v.on("built",function(){p.insert(new t({fragment:"!"+this.get("dbType").id+"/"+this.get("short_code")})),h.navigate("!"+this.get("dbType").id+"/"+this.get("short_code"))}),m.on("executed",function(){var e=this.get("schemaDef");p.insert(new t({fragment:"!"+e.get("dbType").id+"/"+e.get("short_code")+"/"+this.id})),h.navigate("!"+e.get("dbType").id+"/"+e.get("short_code")+"/"+this.id)}),d.reset(c),{dbTypes:d,schemaDef:v,schemaDefView:y,queryView:b}};return{initialize:c}})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/fiddle_backbone/models/DBType.js b/src/main/webapp/javascripts_min/fiddle_backbone/models/DBType.js new file mode 100644 index 0000000..92ade88 --- /dev/null +++ b/src/main/webapp/javascripts_min/fiddle_backbone/models/DBType.js @@ -0,0 +1 @@ +define(["Backbone"],function(e){var t=e.Model.extend({defaults:{sample_fragment:"",notes:"",simple_name:"",full_name:"",selected:!1,context:"host",className:""}});return t})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/fiddle_backbone/models/DBTypesList.js b/src/main/webapp/javascripts_min/fiddle_backbone/models/DBTypesList.js new file mode 100644 index 0000000..47577b0 --- /dev/null +++ b/src/main/webapp/javascripts_min/fiddle_backbone/models/DBTypesList.js @@ -0,0 +1 @@ +define(["Backbone","fiddle_backbone/models/DBType"],function(e,t){var n=e.Collection.extend({model:t,getSelectedType:function(){var e=this.filter(function(e){return e.get("selected")});return e.length?e[0]:!1},setSelectedType:function(e,t){this.each(function(t){t.set({selected:t.id==e},{silent:!0})}),t||this.trigger("change")}});return n})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/fiddle_backbone/models/MyFiddleHistory.js b/src/main/webapp/javascripts_min/fiddle_backbone/models/MyFiddleHistory.js new file mode 100644 index 0000000..37d92b5 --- /dev/null +++ b/src/main/webapp/javascripts_min/fiddle_backbone/models/MyFiddleHistory.js @@ -0,0 +1 @@ +define(["Backbone","fiddle_backbone/models/UsedFiddle"],function(e,t){var n=e.Collection.extend({model:t,comparator:function(e,t){return e.get("last_used")==t.get("last_used")?0:e.get("last_used")>t.get("last_used")?-1:1},insert:function(e){if(!$("#user_choices",this).length){var t=this.find(function(t){return t.get("fragment")==e.get("fragment")});t?(t.set("last_used",e.get("last_used")),this.sort()):this.add(e),this.trigger("change")}},initialize:function(){try{if(localStorage){var e=localStorage.getItem("fiddleHistory");e&&e.length&&this.add($.parseJSON(e))}}catch(t){}}});return n})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/fiddle_backbone/models/Query.js b/src/main/webapp/javascripts_min/fiddle_backbone/models/Query.js new file mode 100644 index 0000000..6125131 --- /dev/null +++ b/src/main/webapp/javascripts_min/fiddle_backbone/models/Query.js @@ -0,0 +1 @@ +define(["jQuery","Backbone"],function(e,t){var n=t.Model.extend({defaults:{id:0,sql:"",sets:[],pendingChanges:!1,statement_separator:";"},reset:function(){this.set(this.defaults),this.trigger("reloaded")},execute:function(){var t=this;if(!this.has("schemaDef")||!this.get("schemaDef").has("dbType")||!this.get("schemaDef").get("ready"))return!1;e.ajax({type:"POST",url:"index.cfm/fiddles/runQuery",data:{db_type_id:this.get("schemaDef").get("dbType").id,schema_short_code:this.get("schemaDef").get("short_code"),statement_separator:this.get("statement_separator"),sql:this.get("sql")},dataType:"json",success:function(e,n,r){t.get("schemaDef").get("dbType").get("context")=="browser"?t.get("schemaDef").get("browserEngines")[t.get("schemaDef").get("dbType").get("className")].executeQuery({sql:t.get("sql"),statement_separator:t.get("statement_separator"),success:function(n){t.set({id:e.ID,sets:n}),t.trigger("executed")},error:function(e){t.set({sets:[{SUCCEEDED:!1,ERRORMESSAGE:e}]}),t.trigger("executed")}}):t.set({id:e.ID,sets:e.sets})},error:function(e,n,r){t.set({sets:[]})},complete:function(e,n){t.trigger("executed")}})}});return n})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/fiddle_backbone/models/SchemaDef.js b/src/main/webapp/javascripts_min/fiddle_backbone/models/SchemaDef.js new file mode 100644 index 0000000..373fcbc --- /dev/null +++ b/src/main/webapp/javascripts_min/fiddle_backbone/models/SchemaDef.js @@ -0,0 +1 @@ +define(["Backbone"],function(e){var t=e.Model.extend({defaults:{ddl:"",short_code:"",simple_name:"",full_name:"",valid:!0,errorMessage:"",loading:!1,ready:!1,schema_structure:[],statement_separator:";",browserEngines:{}},reset:function(){this.set(this.defaults),this.trigger("reloaded")},build:function(e){var t=e.getSelectedType(),n=this;if(!t)return!1;(!this.has("dbType")||this.get("dbType").id!=t.id)&&this.set("dbType",t),$.ajax({type:"POST",url:"index.cfm/fiddles/createSchema",data:{statement_separator:this.get("statement_separator"),db_type_id:this.get("dbType").id,schema_ddl:this.get("ddl")},dataType:"json",success:function(e,r,i){e.short_code?t.get("context")=="browser"?n.get("browserEngines")[t.get("className")].buildSchema({short_code:$.trim(e.short_code),statement_separator:n.get("statement_separator"),ddl:n.get("ddl"),success:function(){n.set({short_code:$.trim(e.short_code),ready:!0,valid:!0,errorMessage:""}),n.get("browserEngines")[t.get("className")].getSchemaStructure({callback:function(e){n.set({schema_structure:e}),n.trigger("built")}})},error:function(t){n.set({short_code:$.trim(e.short_code),ready:!1,valid:!1,errorMessage:t,schema_structure:[]}),n.trigger("failed")}}):(n.set({short_code:$.trim(e.short_code),ready:!0,valid:!0,errorMessage:"",schema_structure:e.schema_structure}),n.trigger("built")):(n.set({short_code:"",ready:!1,valid:!1,errorMessage:e.error,schema_structure:[]}),n.trigger("failed"))},error:function(e,t,r){n.set({short_code:"",ready:!1,valid:!1,errorMessage:r,schema_structure:[]}),n.trigger("failed")}})}});return t})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/fiddle_backbone/models/UsedFiddle.js b/src/main/webapp/javascripts_min/fiddle_backbone/models/UsedFiddle.js new file mode 100644 index 0000000..1c3790c --- /dev/null +++ b/src/main/webapp/javascripts_min/fiddle_backbone/models/UsedFiddle.js @@ -0,0 +1 @@ +define(["Backbone"],function(e){var t=e.Model.extend({defaults:{fragment:"",full_name:"",ddl:"",sql:""},initialize:function(){this.set("last_used",new Date)}});return t})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/fiddle_backbone/router.js b/src/main/webapp/javascripts_min/fiddle_backbone/router.js new file mode 100644 index 0000000..da9b1e0 --- /dev/null +++ b/src/main/webapp/javascripts_min/fiddle_backbone/router.js @@ -0,0 +1 @@ +define(["jQuery","Underscore","Backbone","libs/renderTerminator","fiddle_backbone/models/UsedFiddle"],function(e,t,n,r,i){var s=function(s,o,u,a,f){var l=n.Router.extend({routes:{"!:db_type_id":"DBType","!:db_type_id/:short_code":"SchemaDef","!:db_type_id/:short_code/:query_id":"Query","!:db_type_id/:short_code/:query_id/:set_id":"SetAnchor"},DBType:function(e){s.setSelectedType(e,!0),f.render()},SchemaDef:function(e,t){this.loadContent(e,"!"+e+"/"+t)},Query:function(e,t,n){this.loadContent(e,"!"+e+"/"+t+"/"+n)},SetAnchor:function(n,r,i,a){var f=function(){e("#set_"+a).length&&(window.scrollTo(0,e("#set_"+a).offset().top-50),e("#set_"+a).addClass("highlight"))};!s.getSelectedType()||s.getSelectedType().get("id")!=n||o.get("short_code")!=r||u.get("id")!=i?(u.bind("reloaded",t.once(f)),this.loadContent(n,"!"+n+"/"+r+"/"+i)):(e(".set").removeClass("highlight"),f())},loadContent:function(n,f){this.DBType(n);if(u.get("pendingChanges")&&!confirm("Warning! You have made changes to your query which will be lost. Continue?'"))return!1;o.set("loading",!0),e(".helpTip").css("display","none"),e("body").block({message:"Loading..."}),e.getJSON("index.cfm/fiddles/loadContent",{fragment:f},function(f){o.set("loading",!1);if(f.short_code){var l=s.getSelectedType();l.get("context")=="browser"?(l.get("className")=="sqljs"&&o.get("browserEngines").websql.nativeSQLite&&confirm("Fiddle originally built with SQL.js, but you have WebSQL available - would you like to use that instead (it'll be faster to load)?")&&(s.setSelectedType(e("#db_type_id a:contains('WebSQL')").closest("li").attr("db_type_id")),l=s.getSelectedType(),o.set({ddl:f.ddl,dbType:l,statement_separator:f.schema_statement_separator}),f.sql&&(u.set({schemaDef:o,sql:f.sql,statement_separator:f.query_statement_separator}),o.on("built",t.once(function(){u.execute()}))),o.build(s)),o.get("browserEngines")[l.get("className")].buildSchema({short_code:e.trim(f.short_code),statement_separator:f.schema_statement_separator,ddl:f.ddl,success:function(){o.set({short_code:f.short_code,ddl:f.ddl,ready:!0,valid:!0,errorMessage:"",statement_separator:f.schema_statement_separator,dbType:s.getSelectedType()}),r(e(".panel.schema"),f.schema_statement_separator),f.sql?(a.insert(new i({fragment:"!"+n+"/"+f.short_code+"/"+f.id})),u.set({id:f.id,sql:f.sql,statement_separator:f.query_statement_separator})):a.insert(new i({fragment:"!"+n+"/"+f.short_code})),o.get("browserEngines")[l.get("className")].getSchemaStructure({callback:function(t){o.set({schema_structure:t}),o.trigger("reloaded"),f.sql?o.get("browserEngines")[l.get("className")].executeQuery({sql:f.sql,statement_separator:f.query_statement_separator,success:function(t){u.set({sets:t}),u.trigger("reloaded"),e("body").unblock()},error:function(t){u.set({sets:[]}),u.trigger("reloaded"),e("body").unblock()}}):e("body").unblock()}})},error:function(t){o.set({short_code:f.short_code,ddl:f.ddl,ready:!0,valid:!1,errorMessage:t,dbType:s.getSelectedType(),statement_separator:f.schema_statement_separator,schema_structure:[]}),r(e(".panel.schema"),f.schema_statement_separator),f.sql&&(u.set({id:f.id,sql:f.sql,statement_separator:f.query_statement_separator,schemaDef:o}),u.trigger("reloaded")),o.trigger("failed"),o.trigger("reloaded"),e("body").unblock()}})):(o.set({short_code:f.short_code,ddl:f.ddl,ready:!0,valid:!0,errorMessage:"",statement_separator:f.schema_statement_separator,schema_structure:f.schema_structure}),r(e(".panel.schema"),f.schema_statement_separator),o.trigger("reloaded"),f.sql?(a.insert(new i({fragment:"!"+n+"/"+f.short_code+"/"+f.id})),u.set({id:f.id,sql:f.sql,sets:f.sets,statement_separator:f.query_statement_separator}),u.trigger("reloaded")):a.insert(new i({fragment:"!"+n+"/"+f.short_code})),e("body").unblock())}else e("body").unblock()})}}),c=new l;return n.history.start({pushState:!1}),c};return{initialize:s}})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/fiddle_backbone/templates/dbTypes.html b/src/main/webapp/javascripts_min/fiddle_backbone/templates/dbTypes.html new file mode 100644 index 0000000..e5a4997 --- /dev/null +++ b/src/main/webapp/javascripts_min/fiddle_backbone/templates/dbTypes.html @@ -0,0 +1,8 @@ + <a class="dropdown-toggle" data-toggle="dropdown" href="#"> + {{selectedFullName}} <b class="caret"></b> + </a> + <ul class="dropdown-menu"> + {{#each dbTypes}} + <li db_type_id="{{this.id}}" class="{{this.className}}"><a href="#"><i class="icon-tag"></i>{{this.full_name}}</a></li> + {{/each}} + </ul> diff --git a/src/main/webapp/javascripts_min/fiddle_backbone/templates/queryPlaintextOutput.html b/src/main/webapp/javascripts_min/fiddle_backbone/templates/queryPlaintextOutput.html new file mode 100644 index 0000000..04c04d9 --- /dev/null +++ b/src/main/webapp/javascripts_min/fiddle_backbone/templates/queryPlaintextOutput.html @@ -0,0 +1,50 @@ + {{#if id}} + {{#each_with_index sets}} + <div class="set" id="set_{{index}}"> + {{#if this.RESULTS.DATA.length}} + <pre class="results"> +|{{#each_simple_value_with_index this.RESULTS.COLUMNS}} {{result_display_padded ../this/RESULTS/COLUMNWIDTHS}} |{{/each_simple_value_with_index}} +-{{#each_simple_value_with_index this.RESULTS.COLUMNS}}-{{divider_display ../this/RESULTS/COLUMNWIDTHS}}--{{/each_simple_value_with_index}}{{#each this.RESULTS.DATA}} +|{{#each_simple_value_with_index this}} {{result_display_padded ../../this/RESULTS/COLUMNWIDTHS}} |{{/each_simple_value_with_index}}{{/each}} + </pre> + {{/if}} + {{#if this.SUCCEEDED}} + <div id="messages_{{index}}" class="alert alert-success database-messages"> + <i class="icon-ok"></i> + Record Count: {{this.RESULTS.DATA.length}}; Execution Time: {{this.EXECUTIONTIME}}ms + {{#if this.EXECUTIONPLAN.DATA.length}} + <a href="#executionPlan" class="executionPlanLink"><i class="icon-plus"></i>View Execution Plan</a> + {{/if}} + <a href="#!{{../../schemaDef/dbType/id}}/{{../../schemaDef/short_code}}/{{../../id}}/{{index}}" class="setLink"><i class="icon-share-alt"></i> link</a> + </div> + + {{#if this.EXECUTIONPLAN.DATA.length}} + <table class="executionPlan table table-bordered"> + <tr> + {{#each this.EXECUTIONPLAN.COLUMNS}} + <th>{{this}}</th> + {{/each}} + </tr> + {{#each this.EXECUTIONPLAN.DATA}} + <tr> + {{#each this}} + <td><div style="position:relative">{{{this}}}</div></td> + {{/each}} + </tr> + {{/each}} + + {{#if ../../../schemaDef/dbType/isSQLServer}} + <tr> + <td><a href="index.cfm/Fiddles/getSQLPlan?db_type_id={{../../../../schemaDef/dbType/id}}&short_code={{../../../../schemaDef/short_code}}&query_id={{../../../../id}}&id={{index}}">Download .sqlplan</a></td> + </tr> + {{/if}} + + </table> + {{/if}} + + {{else}} + <div id="messages_{{index}}" class="alert alert-error database-error database-messages"><i class="icon-remove"></i>{{this.ERRORMESSAGE}}</div> + {{/if}} + </div> + {{/each_with_index}} + {{/if}} diff --git a/src/main/webapp/javascripts_min/fiddle_backbone/templates/queryTabularOutput.html b/src/main/webapp/javascripts_min/fiddle_backbone/templates/queryTabularOutput.html new file mode 100644 index 0000000..3670320 --- /dev/null +++ b/src/main/webapp/javascripts_min/fiddle_backbone/templates/queryTabularOutput.html @@ -0,0 +1,59 @@ + {{#if id}} + {{#each_with_index sets}} + <div class="set" id="set_{{index}}"> + {{#if this.RESULTS.DATA.length}} + <table class="results table table-bordered table-striped"> + <tr> + {{#each this.RESULTS.COLUMNS}} + <th>{{this}}</th> + {{/each}} + </tr> + {{#each this.RESULTS.DATA}} + <tr> + {{#each this}} + <td>{{result_display this this}}</td> + {{/each}} + </tr> + {{/each}} + </table> + {{/if}} + {{#if this.SUCCEEDED}} + <div id="messages_{{index}}" class="alert alert-success database-messages"> + <i class="icon-ok"></i> + Record Count: {{this.RESULTS.DATA.length}}; Execution Time: {{this.EXECUTIONTIME}}ms + {{#if this.EXECUTIONPLAN.DATA.length}} + <a href="#executionPlan" class="executionPlanLink"><i class="icon-plus"></i>View Execution Plan</a> + {{/if}} + <a href="#!{{../../schemaDef/dbType/id}}/{{../../schemaDef/short_code}}/{{../../id}}/{{index}}" class="setLink"><i class="icon-share-alt"></i> link</a> + </div> + + {{#if this.EXECUTIONPLAN.DATA.length}} + <table class="executionPlan table table-bordered"> + <tr> + {{#each this.EXECUTIONPLAN.COLUMNS}} + <th>{{this}}</th> + {{/each}} + </tr> + {{#each this.EXECUTIONPLAN.DATA}} + <tr> + {{#each this}} + <td><div style="position:relative">{{{this}}}</div></td> + {{/each}} + </tr> + {{/each}} + + {{#if ../../../schemaDef/dbType/isSQLServer}} + <tr> + <td><a href="index.cfm/Fiddles/getSQLPlan?db_type_id={{../../../../schemaDef/dbType/id}}&short_code={{../../../../schemaDef/short_code}}&query_id={{../../../../id}}&id={{index}}">Download .sqlplan</a> | <a href="http://www.sqlsentry.net/plan-explorer/sql-server-query-view.asp?ad=201208-sqlfiddle-pe" target="_new">Download SQL Sentry Plan Explorer (free)</a></td> + </tr> + {{/if}} + + </table> + {{/if}} + + {{else}} + <div id="messages_{{index}}" class="alert alert-error database-messages"><i class="icon-remove"></i>{{this.ERRORMESSAGE}}</div> + {{/if}} + </div> + {{/each_with_index}} + {{/if}}
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/fiddle_backbone/templates/schemaBrowser.html b/src/main/webapp/javascripts_min/fiddle_backbone/templates/schemaBrowser.html new file mode 100644 index 0000000..cdee721 --- /dev/null +++ b/src/main/webapp/javascripts_min/fiddle_backbone/templates/schemaBrowser.html @@ -0,0 +1,13 @@ + <h3>Schema Browser</h3> + <ul class="tables"> + {{#each objects}} + <li> + <a href="#{{this.table_name}}"><i class="icon-plus"></i> {{this.table_name}}</a> ({{this.table_type}}) + <ul class="columns"> + {{#each this.columns}} + <li>{{name}} {{type}}</li> + {{/each}} + </ul> + </li> + {{/each}} + </ul> diff --git a/src/main/webapp/javascripts_min/fiddle_backbone/templates/schemaOutput.html b/src/main/webapp/javascripts_min/fiddle_backbone/templates/schemaOutput.html new file mode 100644 index 0000000..1cff2a6 --- /dev/null +++ b/src/main/webapp/javascripts_min/fiddle_backbone/templates/schemaOutput.html @@ -0,0 +1,5 @@ + {{#if errorMessage}} + <div class="alert alert-error database-error database-messages"><i class="icon-remove"></i>{{errorMessage}}</div> + {{else}} + <div class="alert alert-success database-messages"><i class="icon-ok"></i>Schema Ready</div> + {{/if}} diff --git a/src/main/webapp/javascripts_min/fiddle_backbone/views/DBTypesList.js b/src/main/webapp/javascripts_min/fiddle_backbone/views/DBTypesList.js new file mode 100644 index 0000000..a9975c2 --- /dev/null +++ b/src/main/webapp/javascripts_min/fiddle_backbone/views/DBTypesList.js @@ -0,0 +1 @@ +define(["jQuery","Backbone","Handlebars","text!fiddle_backbone/templates/dbTypes.html"],function(e,t,n,r){var i=t.View.extend({initialize:function(){this.compiledTemplate=n.compile(r)},events:{"click ul.dropdown-menu li":"clickDBType"},clickDBType:function(t){t.preventDefault(),this.collection.setSelectedType(e(t.currentTarget).attr("db_type_id"))},render:function(){var t=this.collection.getSelectedType();return e(this.el).html(this.compiledTemplate({dbTypes:this.collection.map(function(e){var t=e.toJSON();return t.className=t.selected?"active":"",t}),selectedFullName:t.get("full_name")})),e("#db_type_label_collapsed .navbar-text").text(t.get("full_name")),this}});return i})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/fiddle_backbone/views/Query.js b/src/main/webapp/javascripts_min/fiddle_backbone/views/Query.js new file mode 100644 index 0000000..4b38e73 --- /dev/null +++ b/src/main/webapp/javascripts_min/fiddle_backbone/views/Query.js @@ -0,0 +1 @@ +define(["jQuery","Backbone","Handlebars","FiddleEditor","libs/renderTerminator","XPlans/oracle/loadswf","XPlans/mssql","text!fiddle_backbone/templates/queryTabularOutput.html","text!fiddle_backbone/templates/queryPlaintextOutput.html","HandlebarsHelpers/divider_display","HandlebarsHelpers/each_simple_value_with_index","HandlebarsHelpers/each_with_index","HandlebarsHelpers/result_display_padded","HandlebarsHelpers/result_display"],function(e,t,n,r,i,s,o,u,a){var f=t.View.extend({initialize:function(){this.editor=new r(this.id,this.handleQueryChange,this),this.outputType="tabular",this.compiledOutputTemplate={},this.compiledOutputTemplate.tabular=n.compile(u),this.compiledOutputTemplate.plaintext=n.compile(a)},setOutputType:function(e){this.outputType=e},handleQueryChange:function(){var t=this.model.get("schemaDef");this.model.set({sql:this.editor.getValue()}),e(".sql .helpTip").css("display",!t.get("ready")||t.get("loading")||this.model.get("sql").length?"none":"block")},render:function(){this.editor.setValue(this.model.get("sql")),this.model.id&&this.renderOutput(),i(e(".panel.sql"),this.model.get("statement_separator"))},renderOutput:function(){var t=this.model,n=this.model.toJSON();_.each(n.sets,function(e,t){if(e.RESULTS){var r=_.map(e.RESULTS.COLUMNS,function(e){return e.length});_.each(e.RESULTS.DATA,function(e){r=_.map(e,function(e,t){return _.max([e.toString().length,r[t]])})}),n.sets[t].RESULTS.COLUMNWIDTHS=r}}),n.schemaDef=this.model.get("schemaDef").toJSON(),n.schemaDef.dbType=this.model.get("schemaDef").get("dbType").toJSON(),n.schemaDef.dbType.isSQLServer=this.model.get("schemaDef").get("dbType").get("simple_name")=="SQL Server",this.options.output_el.html(this.compiledOutputTemplate[this.outputType](n)),e("script.oracle_xplan_xml").each(function(){e(this).siblings("div.oracle_xplan").html(s(e(this).text()))}),this.options.output_el.find("a.executionPlanLink").click(function(n){n.preventDefault(),e("i",this).toggleClass("icon-minus icon-plus"),e(this).closest(".set").find(".executionPlan").toggle(),e("i",this).hasClass("icon-minus")&&t.get("schemaDef").get("dbType").get("simple_name")=="SQL Server"&&o.drawLines(e(this).closest(".set").find(".executionPlan div"))})},refresh:function(){this.editor.refresh()},checkForSelectedText:function(){this.editor.somethingSelected()?this.model.set("sql",this.editor.getSelection()):this.model.set("sql",this.editor.getValue())}});return f})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/fiddle_backbone/views/SchemaDef.js b/src/main/webapp/javascripts_min/fiddle_backbone/views/SchemaDef.js new file mode 100644 index 0000000..14c6a90 --- /dev/null +++ b/src/main/webapp/javascripts_min/fiddle_backbone/views/SchemaDef.js @@ -0,0 +1 @@ +define(["jQuery","Backbone","Handlebars","FiddleEditor","libs/renderTerminator","text!fiddle_backbone/templates/schemaOutput.html","text!fiddle_backbone/templates/schemaBrowser.html"],function(e,t,n,r,i,s,o){var u=t.View.extend({initialize:function(){this.editor=new r(this.id,this.handleSchemaChange,this),this.compiledOutputTemplate=n.compile(s),this.compiledSchemaBrowserTemplate=n.compile(o)},handleSchemaChange:function(){if(this.model.get("ddl")!=this.editor.getValue()||this.model.get("statement_separator")!=e(".panel.schema .terminator").data("statement_separator"))this.model.set({ddl:this.editor.getValue(),statement_separator:e(".panel.schema .terminator").data("statement_separator"),ready:!1}),e(".schema .helpTip").css("display",this.model.get("ddl").length?"none":"block"),e(".sql .helpTip").css("display",!this.model.get("ready")||this.model.get("loading")?"none":"block")},render:function(){this.editor.setValue(this.model.get("ddl")),this.updateDependents(),i(e(".panel.schema"),this.model.get("statement_separator"))},renderOutput:function(){this.options.output_el.html(this.compiledOutputTemplate(this.model.toJSON()))},renderSchemaBrowser:function(){this.options.browser_el.html(this.compiledSchemaBrowserTemplate({objects:this.model.get("schema_structure")}))},refresh:function(){this.editor.refresh()},updateDependents:function(){this.model.get("ready")?(e(".needsReadySchema").unblock(),e("#schemaBrowser").attr("disabled",!1),e(".schema .helpTip").css("display","none")):(e(".needsReadySchema").block({message:"Please build schema."}),e("#schemaBrowser").attr("disabled",!0),e(".schema .helpTip").css("display",this.model.get("loading")||this.model.get("ddl").length?"none":"block"))}});return u})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/backbone.js b/src/main/webapp/javascripts_min/libs/backbone.js new file mode 100644 index 0000000..2dff25e --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/backbone.js @@ -0,0 +1,6 @@ +// (c) 2010-2012 Jeremy Ashkenas, DocumentCloud Inc. +// Backbone may be freely distributed under the MIT license. +// For all details and documentation: +// http://backbonejs.org + +(function(){var e=this,t=e.Backbone,n=Array.prototype.splice,r;typeof exports!="undefined"?r=exports:r=e.Backbone={},r.VERSION="0.9.2";var i=e._;!i&&typeof require!="undefined"&&(i=require("underscore")),r.$=e.jQuery||e.Zepto||e.ender,r.noConflict=function(){return e.Backbone=t,this},r.emulateHTTP=!1,r.emulateJSON=!1;var s=/\s+/,o=r.Events={on:function(e,t,n){var r,i,o;if(!t)return this;e=e.split(s),r=this._callbacks||(this._callbacks={});while(i=e.shift())o=r[i]||(r[i]=[]),o.push(t,n);return this},off:function(e,t,n){var r,o,u,a;if(!(o=this._callbacks))return this;if(!(e||t||n))return delete this._callbacks,this;e=e?e.split(s):i.keys(o);while(r=e.shift()){if(!(u=o[r])||!t&&!n){delete o[r];continue}for(a=u.length-2;a>=0;a-=2)t&&u[a]!==t||n&&u[a+1]!==n||u.splice(a,2)}return this},trigger:function(e){var t,n,r,i,o,u,a,f;if(!(n=this._callbacks))return this;f=[],e=e.split(s);for(i=1,o=arguments.length;i<o;i++)f[i-1]=arguments[i];while(t=e.shift()){if(a=n.all)a=a.slice();if(r=n[t])r=r.slice();if(r)for(i=0,o=r.length;i<o;i+=2)r[i].apply(r[i+1]||this,f);if(a){u=[t].concat(f);for(i=0,o=a.length;i<o;i+=2)a[i].apply(a[i+1]||this,u)}}return this}};o.bind=o.on,o.unbind=o.off;var u=r.Model=function(e,t){var n;e||(e={}),t&&t.collection&&(this.collection=t.collection),t&&t.parse&&(e=this.parse(e));if(n=N(this,"defaults"))e=i.extend({},n,e);this.attributes={},this._escapedAttributes={},this.cid=i.uniqueId("c"),this.changed={},this._silent={},this._pending={},this.set(e,{silent:!0}),this.changed={},this._silent={},this._pending={},this._previousAttributes=i.clone(this.attributes),this.initialize.apply(this,arguments)};i.extend(u.prototype,o,{changed:null,_silent:null,_pending:null,idAttribute:"id",initialize:function(){},toJSON:function(e){return i.clone(this.attributes)},sync:function(){return r.sync.apply(this,arguments)},get:function(e){return this.attributes[e]},escape:function(e){var t;if(t=this._escapedAttributes[e])return t;var n=this.get(e);return this._escapedAttributes[e]=i.escape(n==null?"":""+n)},has:function(e){return this.get(e)!=null},set:function(e,t,n){var r,s,o;i.isObject(e)||e==null?(r=e,n=t):(r={},r[e]=t),n||(n={});if(!r)return this;r instanceof u&&(r=r.attributes);if(n.unset)for(s in r)r[s]=void 0;if(!this._validate(r,n))return!1;this.idAttribute in r&&(this.id=r[this.idAttribute]);var a=n.changes={},f=this.attributes,l=this._escapedAttributes,c=this._previousAttributes||{};for(s in r){o=r[s];if(!i.isEqual(f[s],o)||n.unset&&i.has(f,s))delete l[s],(n.silent?this._silent:a)[s]=!0;n.unset?delete f[s]:f[s]=o,!i.isEqual(c[s],o)||i.has(f,s)!=i.has(c,s)?(this.changed[s]=o,n.silent||(this._pending[s]=!0)):(delete this.changed[s],delete this._pending[s])}return n.silent||this.change(n),this},unset:function(e,t){return t=i.extend({},t,{unset:!0}),this.set(e,null,t)},clear:function(e){return e=i.extend({},e,{unset:!0}),this.set(i.clone(this.attributes),e)},fetch:function(e){e=e?i.clone(e):{};var t=this,n=e.success;return e.success=function(r,i,s){if(!t.set(t.parse(r,s),e))return!1;n&&n(t,r,e),t.trigger("sync",t,r,e)},e.error=r.wrapError(e.error,t,e),this.sync("read",this,e)},save:function(e,t,n){var s,o,u;i.isObject(e)||e==null?(s=e,n=t):(s={},s[e]=t),n=n?i.clone(n):{};if(n.wait){if(!this._validate(s,n))return!1;o=i.clone(this.attributes)}var a=i.extend({},n,{silent:!0});if(s&&!this.set(s,n.wait?a:n))return!1;if(!s&&!this.isValid())return!1;var f=this,l=n.success;n.success=function(e,t,r){u=!0;var o=f.parse(e,r);n.wait&&(o=i.extend(s||{},o));if(!f.set(o,n))return!1;l&&l(f,e,n),f.trigger("sync",f,e,n)},n.error=r.wrapError(n.error,f,n);var c=this.sync(this.isNew()?"create":"update",this,n);return!u&&n.wait&&(this.clear(a),this.set(o,a)),c},destroy:function(e){e=e?i.clone(e):{};var t=this,n=e.success,s=function(){t.trigger("destroy",t,t.collection,e)};e.success=function(r){(e.wait||t.isNew())&&s(),n&&n(t,r,e),t.isNew()||t.trigger("sync",t,r,e)};if(this.isNew())return e.success(),!1;e.error=r.wrapError(e.error,t,e);var o=this.sync("delete",this,e);return e.wait||s(),o},url:function(){var e=N(this,"urlRoot")||N(this.collection,"url")||C();return this.isNew()?e:e+(e.charAt(e.length-1)=="/"?"":"/")+encodeURIComponent(this.id)},parse:function(e,t){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return this.id==null},change:function(e){e||(e={});var t=this._changing;this._changing=!0;for(var n in this._silent)this._pending[n]=!0;var r=i.extend({},e.changes,this._silent);this._silent={};for(var n in r)this.trigger("change:"+n,this,this.get(n),e);if(t)return this;while(!i.isEmpty(this._pending)){this._pending={},this.trigger("change",this,e);for(var n in this.changed){if(this._pending[n]||this._silent[n])continue;delete this.changed[n]}this._previousAttributes=i.clone(this.attributes)}return this._changing=!1,this},hasChanged:function(e){return e==null?!i.isEmpty(this.changed):i.has(this.changed,e)},changedAttributes:function(e){if(!e)return this.hasChanged()?i.clone(this.changed):!1;var t,n=!1,r=this._previousAttributes;for(var s in e){if(i.isEqual(r[s],t=e[s]))continue;(n||(n={}))[s]=t}return n},previous:function(e){return e==null||!this._previousAttributes?null:this._previousAttributes[e]},previousAttributes:function(){return i.clone(this._previousAttributes)},isValid:function(){return!this.validate||!this.validate(this.attributes)},_validate:function(e,t){if(t.silent||!this.validate)return!0;e=i.extend({},this.attributes,e);var n=this.validate(e,t);return n?(t&&t.error?t.error(this,n,t):this.trigger("error",this,n,t),!1):!0}});var a=r.Collection=function(e,t){t||(t={}),t.model&&(this.model=t.model),t.comparator!==undefined&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,{silent:!0,parse:t.parse})};i.extend(a.prototype,o,{model:u,initialize:function(){},toJSON:function(e){return this.map(function(t){return t.toJSON(e)})},sync:function(){return r.sync.apply(this,arguments)},add:function(e,t){var r,s,o,u,a,f,l={},c={},h=[];t||(t={}),e=i.isArray(e)?e.slice():[e];for(r=0,o=e.length;r<o;r++){if(!(u=e[r]=this._prepareModel(e[r],t)))throw new Error("Can't add an invalid model to a collection");a=u.cid,f=u.id;if(l[a]||this._byCid[a]||f!=null&&(c[f]||this._byId[f])){h.push(r);continue}l[a]=c[f]=u}r=h.length;while(r--)h[r]=e.splice(h[r],1)[0];for(r=0,o=e.length;r<o;r++)(u=e[r]).on("all",this._onModelEvent,this),this._byCid[u.cid]=u,u.id!=null&&(this._byId[u.id]=u);this.length+=o,s=t.at!=null?t.at:this.models.length,n.apply(this.models,[s,0].concat(e));if(t.merge)for(r=0,o=h.length;r<o;r++)(u=this._byId[h[r].id])&&u.set(h[r],t);this.comparator&&t.at==null&&this.sort({silent:!0});if(t.silent)return this;for(r=0,o=this.models.length;r<o;r++){if(!l[(u=this.models[r]).cid])continue;t.index=r,u.trigger("add",u,this,t)}return this},remove:function(e,t){var n,r,s,o;t||(t={}),e=i.isArray(e)?e.slice():[e];for(n=0,r=e.length;n<r;n++){o=this.getByCid(e[n])||this.get(e[n]);if(!o)continue;delete this._byId[o.id],delete this._byCid[o.cid],s=this.indexOf(o),this.models.splice(s,1),this.length--,t.silent||(t.index=s,o.trigger("remove",o,this,t)),this._removeReference(o)}return this},push:function(e,t){return e=this._prepareModel(e,t),this.add(e,t),e},pop:function(e){var t=this.at(this.length-1);return this.remove(t,e),t},unshift:function(e,t){return e=this._prepareModel(e,t),this.add(e,i.extend({at:0},t)),e},shift:function(e){var t=this.at(0);return this.remove(t,e),t},slice:function(e,t){return this.models.slice(e,t)},get:function(e){return e==null?void 0:this._byId[e.id!=null?e.id:e]},getByCid:function(e){return e&&this._byCid[e.cid||e]},at:function(e){return this.models[e]},where:function(e){return i.isEmpty(e)?[]:this.filter(function(t){for(var n in e)if(e[n]!==t.get(n))return!1;return!0})},sort:function(e){e||(e={});if(!this.comparator)throw new Error("Cannot sort a set without a comparator");var t=i.bind(this.comparator,this);return this.comparator.length==1?this.models=this.sortBy(t):this.models.sort(t),e.silent||this.trigger("reset",this,e),this},pluck:function(e){return i.map(this.models,function(t){return t.get(e)})},reset:function(e,t){e||(e=[]),t||(t={});for(var n=0,r=this.models.length;n<r;n++)this._removeReference(this.models[n]);return this._reset(),this.add(e,i.extend({silent:!0},t)),t.silent||this.trigger("reset",this,t),this},fetch:function(e){e=e?i.clone(e):{},e.parse===undefined&&(e.parse=!0);var t=this,n=e.success;return e.success=function(r,i,s){t[e.add?"add":"reset"](t.parse(r,s),e),n&&n(t,r,e),t.trigger("sync",t,r,e)},e.error=r.wrapError(e.error,t,e),this.sync("read",this,e)},create:function(e,t){var n=this;t=t?i.clone(t):{},e=this._prepareModel(e,t);if(!e)return!1;t.wait||n.add(e,t);var r=t.success;return t.success=function(e,t,i){i.wait&&n.add(e,i),r&&r(e,t,i)},e.save(null,t),e},parse:function(e,t){return e},clone:function(){return new this.constructor(this.models)},chain:function(){return i(this.models).chain()},_reset:function(e){this.length=0,this.models=[],this._byId={},this._byCid={}},_prepareModel:function(e,t){if(e instanceof u)return e.collection||(e.collection=this),e;t||(t={}),t.collection=this;var n=new this.model(e,t);return n._validate(n.attributes,t)?n:!1},_removeReference:function(e){this==e.collection&&delete e.collection,e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,n,r){if((e=="add"||e=="remove")&&n!=this)return;e=="destroy"&&this.remove(t,r),t&&e==="change:"+t.idAttribute&&(delete this._byId[t.previous(t.idAttribute)],t.id!=null&&(this._byId[t.id]=t)),this.trigger.apply(this,arguments)}});var f=["forEach","each","map","reduce","reduceRight","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","sortBy","sortedIndex","toArray","size","first","initial","rest","last","without","indexOf","shuffle","lastIndexOf","isEmpty","groupBy"];i.each(f,function(e){a.prototype[e]=function(){return i[e].apply(i,[this.models].concat(i.toArray(arguments)))}});var l=r.Router=function(e){e||(e={}),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},c=/:\w+/g,h=/\*\w+/g,p=/[-[\]{}()+?.,\\^$|#\s]/g;i.extend(l.prototype,o,{initialize:function(){},route:function(e,t,n){return r.history||(r.history=new d),i.isRegExp(e)||(e=this._routeToRegExp(e)),n||(n=this[t]),r.history.route(e,i.bind(function(i){var s=this._extractParameters(e,i);n&&n.apply(this,s),this.trigger.apply(this,["route:"+t].concat(s)),r.history.trigger("route",this,t,s)},this)),this},navigate:function(e,t){r.history.navigate(e,t)},_bindRoutes:function(){if(!this.routes)return;var e=[];for(var t in this.routes)e.unshift([t,this.routes[t]]);for(var n=0,r=e.length;n<r;n++)this.route(e[n][0],e[n][1],this[e[n][1]])},_routeToRegExp:function(e){return e=e.replace(p,"\\$&").replace(c,"([^/]+)").replace(h,"(.*?)"),new RegExp("^"+e+"$")},_extractParameters:function(e,t){return e.exec(t).slice(1)}});var d=r.History=function(t){this.handlers=[],i.bindAll(this,"checkUrl"),this.location=t&&t.location||e.location,this.history=t&&t.history||e.history},v=/^[#\/]/,m=/msie [\w.]+/,g=/\/$/;d.started=!1,i.extend(d.prototype,o,{interval:50,getHash:function(e){var t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getFragment:function(e,t){if(e==null)if(this._hasPushState||!this._wantsHashChange||t){e=this.location.pathname;var n=this.options.root.replace(g,"");e.indexOf(n)||(e=e.substr(n.length))}else e=this.getHash();return decodeURIComponent(e.replace(v,""))},start:function(e){if(d.started)throw new Error("Backbone.history has already been started");d.started=!0,this.options=i.extend({},{root:"/"},this.options,e),this._wantsHashChange=this.options.hashChange!==!1,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var t=this.getFragment(),n=document.documentMode,s=m.exec(navigator.userAgent.toLowerCase())&&(!n||n<=7);s&&this._wantsHashChange&&(this.iframe=r.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(t)),this._hasPushState?r.$(window).bind("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!s?r.$(window).bind("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=t;var o=this.location,u=o.pathname==this.options.root&&!o.search;if(this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!u)return this.fragment=this.getFragment(null,!0),this.location.replace(this.options.root+this.location.search+"#"+this.fragment),!0;this._wantsPushState&&this._hasPushState&&u&&o.hash&&(this.fragment=this.getHash().replace(v,""),this.history.replaceState({},document.title,o.protocol+"//"+o.host+this.options.root+this.fragment));if(!this.options.silent)return this.loadUrl()},stop:function(){r.$(window).unbind("popstate",this.checkUrl).unbind("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),d.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(e){var t=this.getFragment();t==this.fragment&&this.iframe&&(t=this.getFragment(this.getHash(this.iframe)));if(t==this.fragment)return!1;this.iframe&&this.navigate(t),this.loadUrl()||this.loadUrl(this.getHash())},loadUrl:function(e){var t=this.fragment=this.getFragment(e),n=i.any(this.handlers,function(e){if(e.route.test(t))return e.callback(t),!0});return n},navigate:function(e,t){if(!d.started)return!1;if(!t||t===!0)t={trigger:t};var n=(e||"").replace(v,"");if(this.fragment==n)return;this.fragment=n;var r=(n.indexOf(this.options.root)!=0?this.options.root:"")+n;if(this._hasPushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,r);else{if(!this._wantsHashChange)return this.location.assign(r);this._updateHash(this.location,n,t.replace),this.iframe&&n!=this.getFragment(this.getHash(this.iframe))&&(t.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,n,t.replace))}t.trigger&&this.loadUrl(e)},_updateHash:function(e,t,n){n?e.replace(e.href.replace(/(javascript:|#).*$/,"")+"#"+t):e.hash=t}});var y=r.View=function(e){this.cid=i.uniqueId("view"),this._configure(e||{}),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},b=/^(\S+)\s*(.*)$/,w=["model","collection","el","id","attributes","className","tagName"];i.extend(y.prototype,o,{tagName:"div",$:function(e){return this.$el.find(e)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this},make:function(e,t,n){var i=document.createElement(e);return t&&r.$(i).attr(t),n!=null&&r.$(i).html(n),i},setElement:function(e,t){return this.$el&&this.undelegateEvents(),this.$el=e instanceof r.$?e:r.$(e),this.el=this.$el[0],t!==!1&&this.delegateEvents(),this},delegateEvents:function(e){if(!e&&!(e=N(this,"events")))return;this.undelegateEvents();for(var t in e){var n=e[t];i.isFunction(n)||(n=this[e[t]]);if(!n)throw new Error('Method "'+e[t]+'" does not exist');var r=t.match(b),s=r[1],o=r[2];n=i.bind(n,this),s+=".delegateEvents"+this.cid,o===""?this.$el.bind(s,n):this.$el.delegate(o,s,n)}},undelegateEvents:function(){this.$el.unbind(".delegateEvents"+this.cid)},_configure:function(e){this.options&&(e=i.extend({},this.options,e));for(var t=0,n=w.length;t<n;t++){var r=w[t];e[r]&&(this[r]=e[r])}this.options=e},_ensureElement:function(){if(!this.el){var e=i.extend({},N(this,"attributes"));this.id&&(e.id=this.id),this.className&&(e["class"]=this.className),this.setElement(this.make(N(this,"tagName"),e),!1)}else this.setElement(this.el,!1)}});var E=function(e,t){var n=T(this,e,t);return n.extend=this.extend,n};u.extend=a.extend=l.extend=y.extend=E;var S={create:"POST",update:"PUT","delete":"DELETE",read:"GET"};r.sync=function(e,t,n){var s=S[e];n||(n={});var o={type:s,dataType:"json"};return n.url||(o.url=N(t,"url")||C()),!n.data&&t&&(e=="create"||e=="update")&&(o.contentType="application/json",o.data=JSON.stringify(t)),r.emulateJSON&&(o.contentType="application/x-www-form-urlencoded",o.data=o.data?{model:o.data}:{}),r.emulateHTTP&&(s==="PUT"||s==="DELETE")&&(r.emulateJSON&&(o.data._method=s),o.type="POST",o.beforeSend=function(e){e.setRequestHeader("X-HTTP-Method-Override",s)}),o.type!=="GET"&&!r.emulateJSON&&(o.processData=!1),r.ajax(i.extend(o,n))},r.ajax=function(){return r.$.ajax.apply(r.$,arguments)},r.wrapError=function(e,t,n){return function(r,i){i=r===t?i:r,e?e(t,i,n):t.trigger("error",t,i,n)}};var x=function(){},T=function(e,t,n){var r;return t&&t.hasOwnProperty("constructor")?r=t.constructor:r=function(){e.apply(this,arguments)},i.extend(r,e),x.prototype=e.prototype,r.prototype=new x,t&&i.extend(r.prototype,t),n&&i.extend(r,n),r.prototype.constructor=r,r.__super__=e.prototype,r},N=function(e,t){return!e||!e[t]?null:i.isFunction(e[t])?e[t]():e[t]},C=function(){throw new Error('A "url" property or function must be specified')}}).call(this)
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/bootstrap/bootstrap-collapse.js b/src/main/webapp/javascripts_min/libs/bootstrap/bootstrap-collapse.js new file mode 100644 index 0000000..a98871d --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/bootstrap/bootstrap-collapse.js @@ -0,0 +1,20 @@ +/* ============================================================= + * bootstrap-collapse.js v2.0.4 + * http://twitter.github.com/bootstrap/javascript.html#collapse + * ============================================================= + * Copyright 2012 Twitter, Inc. + * + * 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. + * ============================================================ */ + +!function(e){var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.collapse.defaults,n),this.options.parent&&(this.$parent=e(this.options.parent)),this.options.toggle&&this.toggle()};t.prototype={constructor:t,dimension:function(){var e=this.$element.hasClass("width");return e?"width":"height"},show:function(){var t,n,r,i;if(this.transitioning)return;t=this.dimension(),n=e.camelCase(["scroll",t].join("-")),r=this.$parent&&this.$parent.find("> .accordion-group > .in");if(r&&r.length){i=r.data("collapse");if(i&&i.transitioning)return;r.collapse("hide"),i||r.data("collapse",null)}this.$element[t](0),this.transition("addClass",e.Event("show"),"shown"),this.$element[t](this.$element[0][n])},hide:function(){var t;if(this.transitioning)return;t=this.dimension(),this.reset(this.$element[t]()),this.transition("removeClass",e.Event("hide"),"hidden"),this.$element[t](0)},reset:function(e){var t=this.dimension();return this.$element.removeClass("collapse")[t](e||"auto")[0].offsetWidth,this.$element[e!==null?"addClass":"removeClass"]("collapse"),this},transition:function(t,n,r){var i=this,s=function(){n.type=="show"&&i.reset(),i.transitioning=0,i.$element.trigger(r)};this.$element.trigger(n);if(n.isDefaultPrevented())return;this.transitioning=1,this.$element[t]("in"),e.support.transition&&this.$element.hasClass("collapse")?this.$element.one(e.support.transition.end,s):s()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}},e.fn.collapse=function(n){return this.each(function(){var r=e(this),i=r.data("collapse"),s=typeof n=="object"&&n;i||r.data("collapse",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.collapse.defaults={toggle:!0},e.fn.collapse.Constructor=t,e(function(){e("body").on("click.collapse.data-api","[data-toggle=collapse]",function(t){var n=e(this),r,i=n.attr("data-target")||t.preventDefault()||(r=n.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,""),s=e(i).data("collapse")?"toggle":n.data();e(i).collapse(s)})})}(window.jQuery)
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/bootstrap/bootstrap-dropdown.js b/src/main/webapp/javascripts_min/libs/bootstrap/bootstrap-dropdown.js new file mode 100644 index 0000000..0b5b03f --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/bootstrap/bootstrap-dropdown.js @@ -0,0 +1,20 @@ +/* ============================================================ + * bootstrap-dropdown.js v2.0.4 + * http://twitter.github.com/bootstrap/javascript.html#dropdowns + * ============================================================ + * Copyright 2012 Twitter, Inc. + * + * 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. + * ============================================================ */ + +!function(e){function r(){e(t).parent().removeClass("open")}var t='[data-toggle="dropdown"]',n=function(t){var n=e(t).on("click.dropdown.data-api",this.toggle);e("html").on("click.dropdown.data-api",function(){n.parent().removeClass("open")})};n.prototype={constructor:n,toggle:function(t){var n=e(this),i,s,o;if(n.is(".disabled, :disabled"))return;return s=n.attr("data-target"),s||(s=n.attr("href"),s=s&&s.replace(/.*(?=#[^\s]*$)/,"")),i=e(s),i.length||(i=n.parent()),o=i.hasClass("open"),r(),o||i.toggleClass("open"),!1}},e.fn.dropdown=function(t){return this.each(function(){var r=e(this),i=r.data("dropdown");i||r.data("dropdown",i=new n(this)),typeof t=="string"&&i[t].call(r)})},e.fn.dropdown.Constructor=n,e(function(){e("html").on("click.dropdown.data-api",r),e("body").on("click.dropdown",".dropdown form",function(e){e.stopPropagation()}).on("click.dropdown.data-api",t,n.prototype.toggle)})}(window.jQuery)
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/bootstrap/bootstrap-modal.js b/src/main/webapp/javascripts_min/libs/bootstrap/bootstrap-modal.js new file mode 100644 index 0000000..b32931e --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/bootstrap/bootstrap-modal.js @@ -0,0 +1,20 @@ +/* ========================================================= + * bootstrap-modal.js v2.0.4 + * http://twitter.github.com/bootstrap/javascript.html#modals + * ========================================================= + * Copyright 2012 Twitter, Inc. + * + * 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. + * ========================================================= */ + +!function(e){function n(){var t=this,n=setTimeout(function(){t.$element.off(e.support.transition.end),r.call(t)},500);this.$element.one(e.support.transition.end,function(){clearTimeout(n),r.call(t)})}function r(e){this.$element.hide().trigger("hidden"),i.call(this)}function i(t){var n=this,r=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var i=e.support.transition&&r;this.$backdrop=e('<div class="modal-backdrop '+r+'" />').appendTo(document.body),this.options.backdrop!="static"&&this.$backdrop.click(e.proxy(this.hide,this)),i&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),i?this.$backdrop.one(e.support.transition.end,t):t()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(e.support.transition.end,e.proxy(s,this)):s.call(this)):t&&t()}function s(){this.$backdrop.remove(),this.$backdrop=null}function o(){var t=this;this.isShown&&this.options.keyboard?e(document).on("keyup.dismiss.modal",function(e){e.which==27&&t.hide()}):this.isShown||e(document).off("keyup.dismiss.modal")}var t=function(t,n){this.options=n,this.$element=e(t).delegate('[data-dismiss="modal"]',"click.dismiss.modal",e.proxy(this.hide,this))};t.prototype={constructor:t,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var t=this,n=e.Event("show");this.$element.trigger(n);if(this.isShown||n.isDefaultPrevented())return;e("body").addClass("modal-open"),this.isShown=!0,o.call(this),i.call(this,function(){var n=e.support.transition&&t.$element.hasClass("fade");t.$element.parent().length||t.$element.appendTo(document.body),t.$element.show(),n&&t.$element[0].offsetWidth,t.$element.addClass("in"),n?t.$element.one(e.support.transition.end,function(){t.$element.trigger("shown")}):t.$element.trigger("shown")})},hide:function(t){t&&t.preventDefault();var i=this;t=e.Event("hide"),this.$element.trigger(t);if(!this.isShown||t.isDefaultPrevented())return;this.isShown=!1,e("body").removeClass("modal-open"),o.call(this),this.$element.removeClass("in"),e.support.transition&&this.$element.hasClass("fade")?n.call(this):r.call(this)}},e.fn.modal=function(n){return this.each(function(){var r=e(this),i=r.data("modal"),s=e.extend({},e.fn.modal.defaults,r.data(),typeof n=="object"&&n);i||r.data("modal",i=new t(this,s)),typeof n=="string"?i[n]():s.show&&i.show()})},e.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},e.fn.modal.Constructor=t,e(function(){e("body").on("click.modal.data-api",'[data-toggle="modal"]',function(t){var n=e(this),r,i=e(n.attr("data-target")||(r=n.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,"")),s=i.data("modal")?"toggle":e.extend({},i.data(),n.data());t.preventDefault(),i.modal(s)})})}(window.jQuery)
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/bootstrap/bootstrap-popover.js b/src/main/webapp/javascripts_min/libs/bootstrap/bootstrap-popover.js new file mode 100644 index 0000000..976ad09 --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/bootstrap/bootstrap-popover.js @@ -0,0 +1,20 @@ +/* =========================================================== + * bootstrap-popover.js v2.0.4 + * http://twitter.github.com/bootstrap/javascript.html#popovers + * =========================================================== + * Copyright 2012 Twitter, Inc. + * + * 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. + * =========================================================== */ + +!function(e){var t=function(e,t){this.init("popover",e,t)};t.prototype=e.extend({},e.fn.tooltip.Constructor.prototype,{constructor:t,setContent:function(){var e=this.tip(),t=this.getTitle(),n=this.getContent();e.find(".popover-title")[this.isHTML(t)?"html":"text"](t),e.find(".popover-content > *")[this.isHTML(n)?"html":"text"](n),e.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var e,t=this.$element,n=this.options;return e=t.attr("data-content")||(typeof n.content=="function"?n.content.call(t[0]):n.content),e},tip:function(){return this.$tip||(this.$tip=e(this.options.template)),this.$tip}}),e.fn.popover=function(n){return this.each(function(){var r=e(this),i=r.data("popover"),s=typeof n=="object"&&n;i||r.data("popover",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.popover.Constructor=t,e.fn.popover.defaults=e.extend({},e.fn.tooltip.defaults,{placement:"right",content:"",template:'<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'})}(window.jQuery)
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/bootstrap/bootstrap-tab.js b/src/main/webapp/javascripts_min/libs/bootstrap/bootstrap-tab.js new file mode 100644 index 0000000..6e21ab2 --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/bootstrap/bootstrap-tab.js @@ -0,0 +1,20 @@ +/* ======================================================== + * bootstrap-tab.js v2.0.4 + * http://twitter.github.com/bootstrap/javascript.html#tabs + * ======================================================== + * Copyright 2012 Twitter, Inc. + * + * 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. + * ======================================================== */ + +!function(e){var t=function(t){this.element=e(t)};t.prototype={constructor:t,show:function(){var t=this.element,n=t.closest("ul:not(.dropdown-menu)"),r=t.attr("data-target"),i,s,o;r||(r=t.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,""));if(t.parent("li").hasClass("active"))return;i=n.find(".active a").last()[0],o=e.Event("show",{relatedTarget:i}),t.trigger(o);if(o.isDefaultPrevented())return;s=e(r),this.activate(t.parent("li"),n),this.activate(s,s.parent(),function(){t.trigger({type:"shown",relatedTarget:i})})},activate:function(t,n,r){function o(){i.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),t.addClass("active"),s?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu")&&t.closest("li.dropdown").addClass("active"),r&&r()}var i=n.find("> .active"),s=r&&e.support.transition&&i.hasClass("fade");s?i.one(e.support.transition.end,o):o(),i.removeClass("in")}},e.fn.tab=function(n){return this.each(function(){var r=e(this),i=r.data("tab");i||r.data("tab",i=new t(this)),typeof n=="string"&&i[n]()})},e.fn.tab.Constructor=t,e(function(){e("body").on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(t){t.preventDefault(),e(this).tab("show")})})}(window.jQuery)
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/bootstrap/bootstrap-tooltip.js b/src/main/webapp/javascripts_min/libs/bootstrap/bootstrap-tooltip.js new file mode 100644 index 0000000..0e1e0ad --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/bootstrap/bootstrap-tooltip.js @@ -0,0 +1,21 @@ +/* =========================================================== + * bootstrap-tooltip.js v2.0.4 + * http://twitter.github.com/bootstrap/javascript.html#tooltips + * Inspired by the original jQuery.tipsy by Jason Frame + * =========================================================== + * Copyright 2012 Twitter, Inc. + * + * 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. + * ========================================================== */ + +!function(e){var t=function(e,t){this.init("tooltip",e,t)};t.prototype={constructor:t,init:function(t,n,r){var i,s;this.type=t,this.$element=e(n),this.options=this.getOptions(r),this.enabled=!0,this.options.trigger!="manual"&&(i=this.options.trigger=="hover"?"mouseenter":"focus",s=this.options.trigger=="hover"?"mouseleave":"blur",this.$element.on(i,this.options.selector,e.proxy(this.enter,this)),this.$element.on(s,this.options.selector,e.proxy(this.leave,this))),this.options.selector?this._options=e.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(t){return t=e.extend({},e.fn[this.type].defaults,t,this.$element.data()),t.delay&&typeof t.delay=="number"&&(t.delay={show:t.delay,hide:t.delay}),t},enter:function(t){var n=e(t.currentTarget)[this.type](this._options).data(this.type);if(!n.options.delay||!n.options.delay.show)return n.show();clearTimeout(this.timeout),n.hoverState="in",this.timeout=setTimeout(function(){n.hoverState=="in"&&n.show()},n.options.delay.show)},leave:function(t){var n=e(t.currentTarget)[this.type](this._options).data(this.type);this.timeout&&clearTimeout(this.timeout);if(!n.options.delay||!n.options.delay.hide)return n.hide();n.hoverState="out",this.timeout=setTimeout(function(){n.hoverState=="out"&&n.hide()},n.options.delay.hide)},show:function(){var e,t,n,r,i,s,o;if(this.hasContent()&&this.enabled){e=this.tip(),this.setContent(),this.options.animation&&e.addClass("fade"),s=typeof this.options.placement=="function"?this.options.placement.call(this,e[0],this.$element[0]):this.options.placement,t=/in/.test(s),e.remove().css({top:0,left:0,display:"block"}).appendTo(t?this.$element:document.body),n=this.getPosition(t),r=e[0].offsetWidth,i=e[0].offsetHeight;switch(t?s.split(" ")[1]:s){case"bottom":o={top:n.top+n.height,left:n.left+n.width/2-r/2};break;case"top":o={top:n.top-i,left:n.left+n.width/2-r/2};break;case"left":o={top:n.top+n.height/2-i/2,left:n.left-r};break;case"right":o={top:n.top+n.height/2-i/2,left:n.left+n.width}}e.css(o).addClass(s).addClass("in")}},isHTML:function(e){return typeof e!="string"||e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3||/^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(e)},setContent:function(){var e=this.tip(),t=this.getTitle();e.find(".tooltip-inner")[this.isHTML(t)?"html":"text"](t),e.removeClass("fade in top bottom left right")},hide:function(){function r(){var t=setTimeout(function(){n.off(e.support.transition.end).remove()},500);n.one(e.support.transition.end,function(){clearTimeout(t),n.remove()})}var t=this,n=this.tip();n.removeClass("in"),e.support.transition&&this.$tip.hasClass("fade")?r():n.remove()},fixTitle:function(){var e=this.$element;(e.attr("title")||typeof e.attr("data-original-title")!="string")&&e.attr("data-original-title",e.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(t){return e.extend({},t?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var e,t=this.$element,n=this.options;return e=t.attr("data-original-title")||(typeof n.title=="function"?n.title.call(t[0]):n.title),e},tip:function(){return this.$tip=this.$tip||e(this.options.template)},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(){this[this.tip().hasClass("in")?"hide":"show"]()}},e.fn.tooltip=function(n){return this.each(function(){var r=e(this),i=r.data("tooltip"),s=typeof n=="object"&&n;i||r.data("tooltip",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.tooltip.Constructor=t,e.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover",title:"",delay:0}}(window.jQuery)
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/browserEngines/engines.js b/src/main/webapp/javascripts_min/libs/browserEngines/engines.js new file mode 100644 index 0000000..f5b30d0 --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/browserEngines/engines.js @@ -0,0 +1 @@ +define(["BrowserEngines/sqljs_driver","BrowserEngines/websql_driver"],function(e,t){return{sqljs:new e,websql:new t}})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/browserEngines/sqlite_driver.js b/src/main/webapp/javascripts_min/libs/browserEngines/sqlite_driver.js new file mode 100644 index 0000000..9a986e8 --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/browserEngines/sqlite_driver.js @@ -0,0 +1 @@ +define([],function(){var e=function(){return this};return e.prototype.getSchemaStructure=function(e){var t="select * from sqlite_master where type IN ('table', 'view') and name != '__WebKitDatabaseInfoTable__' order by type,name",n=function(t){var n={},r=[];for(var i in t[0].RESULTS.COLUMNS)n[t[0].RESULTS.COLUMNS[i]]=i;for(var s in t[0].RESULTS.DATA){var o=t[0].RESULTS.DATA[s][n.sql],u=t[0].RESULTS.DATA[s][n.name],a=t[0].RESULTS.DATA[s][n.type],f={table_name:u,table_type:a,columns:[]};if(a=="table"){var l=/^[\s\S]*?\(([\s\S]*)\)$/.exec(o)[1].split(/,\s*/);for(var c in l){var h=l[c].replace(/(^\s*)|(\s*$)/,"").split(/\s+/);f.columns.push({name:h.shift(),type:h.join(" ")})}}r.push(f)}e.callback(r)};this.executeQuery({sql:t,success:n})},e.prototype.splitStatement=function(e,t){t||(t=";");var n=t.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),r=e?e.split(new RegExp(n+"s*\r?(\n|$)")):[];return r},e})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/browserEngines/sqljs_driver.js b/src/main/webapp/javascripts_min/libs/browserEngines/sqljs_driver.js new file mode 100644 index 0000000..f765560 --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/browserEngines/sqljs_driver.js @@ -0,0 +1 @@ +define(["jQuery","BrowserEngines/sqlite_driver"],function(e,t){var n=function(){return this.db=null,this};return e.extend(n.prototype,t.prototype),n.prototype.buildSchema=function(n){var r=this;try{var i=function(){r.db=SQL.open(),e.each(t.prototype.splitStatement.call(this,n.ddl,n.statement_separator),function(e,t){r.db.exec(t)}),n.success()};window.SQL===undefined?e.getScript("javascripts_static/sql.js",function(e,t,n){i()}).fail(function(e,t,r){n.error("Your browser does not work with SQL.js. Try using a different browser (Chrome, Safari, Firefox, IE 10, etc...), or a newer version of your current one.")}):(r.db&&r.db.close(),i())}catch(s){n.error(s)}},n.prototype.executeQuery=function(n){var r=this;try{if(!r.db)throw"Database Schema not available!";var i=[];r.db.exec("BEGIN TRANSACTION"),e.each(t.prototype.splitStatement.call(this,n.sql,n.statement_separator),function(t,n){if(e.trim(n).length){var s=new Date,o=[];try{o=r.db.exec(n);var u={SUCCEEDED:!0,EXECUTIONTIME:new Date-s,RESULTS:{COLUMNS:[],DATA:[]},EXECUTIONPLAN:{COLUMNS:[],DATA:[]}};o.length&&e.each(o,function(t,n){var r=[];e.each(n,function(e,n){t==0&&u.RESULTS.COLUMNS.push(n.column),r.push(n.value)}),u.RESULTS.DATA.push(r)});try{exectionPlanArray=r.db.exec("EXPLAIN QUERY PLAN "+n),exectionPlanArray.length&&e.each(exectionPlanArray,function(t,n){var r=[];e.each(n,function(e,n){t==0&&u.EXECUTIONPLAN.COLUMNS.push(n.column),r.push(n.value)}),u.EXECUTIONPLAN.DATA.push(r)})}catch(a){}i.push(u)}catch(a){var u={SUCCEEDED:!1,EXECUTIONTIME:new Date-s,ERRORMESSAGE:a};return i.push(u),!1}}}),r.db.exec("ROLLBACK TRANSACTION"),n.success(i)}catch(s){n.error(s)}},n})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/browserEngines/websql_driver.js b/src/main/webapp/javascripts_min/libs/browserEngines/websql_driver.js new file mode 100644 index 0000000..d90ead1 --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/browserEngines/websql_driver.js @@ -0,0 +1 @@ +define(["jQuery","BrowserEngines/sqlite_driver"],function(e,t){var n=function(){return this.db=null,this.ddl=[],this.nativeSQLite=window.openDatabase!==undefined,this};return e.extend(n.prototype,t.prototype),n.prototype.buildSchema=function(e){var t=this;try{t.nativeSQLite?(t.db=openDatabase(e.short_code,"1.0",e.short_code,e.ddl.length*1024),t.db.transaction(function(n){var r=t.splitStatement(e.ddl,e.statement_separator);t.ddl=r;var i=0,s=r[i],o=function(t,a){if(i<r.length-1){do i++,s=r[i];while(i<r.length-1&&s.match(/^\s*$/));s.match(/^\s*$/)?(n.executeSql("intentional failure used to rollback transaction"),e.success()):n.executeSql(s,[],o,u)}else n.executeSql("intentional failure used to rollback transaction"),e.success()},u=function(t,n){return n.message!="not an error"?e.error(n.message):e.success(),!0};s?n.executeSql(s,[],o,u):e.success()})):e.error("SQLite (WebSQL) not available in your browser. Try either using a webkit-based browser (such as Safari or Chrome) or using the SQLite (SQL.js) database type.")}catch(n){e.error(n)}},n.prototype.executeQuery=function(t){var n=this;try{if(n.db==null)throw"You need to build the schema before you can run a query.";var r=[];n.db.transaction(function(i){var s=function(e,u){var a={SUCCEEDED:!0,EXECUTIONTIME:new Date-p,RESULTS:{COLUMNS:[],DATA:[]},EXECUTIONPLAN:{COLUMNS:[],DATA:[]}};for(var f=0;f<u.rows.length;f++){var d=[],v=u.rows.item(f);if(f==0)for(col in v)a.RESULTS.COLUMNS.push(col);for(var m=0;m<a.RESULTS.COLUMNS.length;m++)d.push(v[a.RESULTS.COLUMNS[m]]);a.RESULTS.DATA.push(d)}i.executeSql("EXPLAIN QUERY PLAN "+h,[],function(e,u){for(var f=0;f<u.rows.length;f++){var p=[],d=u.rows.item(f);if(f==0)for(col in d)a.EXECUTIONPLAN.COLUMNS.push(col);for(var v=0;v<a.EXECUTIONPLAN.COLUMNS.length;v++)p.push(d[a.EXECUTIONPLAN.COLUMNS[v]]);a.EXECUTIONPLAN.DATA.push(p)}c>n.ddl.length-1&&r.push(a);if(c<l.length-1){do c++,h=l[c];while(c<l.length-1&&h.match(/^\s*$/));h.match(/^\s*$/)?(i.executeSql("intentional failure used to rollback transaction"),t.success(r)):i.executeSql(h,[],s,o)}else i.executeSql("intentional failure used to rollback transaction"),t.success(r)},function(e,u){c>n.ddl.length-1&&r.push(a);if(c<l.length-1){do c++,h=l[c];while(c<l.length-1&&h.match(/^\s*$/));h.match(/^\s*$/)?(i.executeSql("intentional failure used to rollback transaction"),t.success(r)):i.executeSql(h,[],s,o)}else i.executeSql("intentional failure used to rollback transaction"),t.success(r)})},o=function(e,n){if(n.message!="not an error"){var i={SUCCEEDED:!1,EXECUTIONTIME:new Date-p,ERRORMESSAGE:n.message};r.push(i)}return t.success(r),!0},u=[],a,f=!1,l=n.ddl.slice(0);e.each(n.splitStatement(t.sql,t.statement_separator),function(e,t){l.push(t)});var c=0,h=l[c],p=new Date;i.executeSql(h,[],s,o)})}catch(i){t.error(i)}},n})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/codemirror/codemirror.js b/src/main/webapp/javascripts_min/libs/codemirror/codemirror.js new file mode 100644 index 0000000..0a5da03 --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/codemirror/codemirror.js @@ -0,0 +1 @@ +var CodeMirror=function(){function e(r,i){function Kt(e){return e>=0&&e<bt.size}function Gt(e){return E(bt,e)}function Yt(e,t){Bt=!0;var n=t-e.height;for(var r=e;r;r=r.parent)r.height+=n}function Zt(e){var t={line:0,ch:0};mn(t,{line:bt.size-1,ch:Gt(bt.size-1).text.length},ut(e),t,t),Ot=!0}function en(){var e=[];return bt.iter(0,bt.size,function(t){e.push(t.text)}),e.join("\n")}function tn(e){function c(e){var t=Hr(e,!0);if(t&&!Z(t,o)){Et||dn(),o=t,zn(r,t),Ot=!1;var n=Bn();if(t.line>=n.to||t.line<n.from)u=setTimeout(Jr(function(){c(e)}),150)}}function h(e){clearTimeout(u);var t=Hr(e);t&&zn(r,t),L(e),_n(),Ot=!0,p(),f()}Un(D(e,"shiftKey"));for(var t=M(e);t!=y;t=t.parentNode)if(t.parentNode==V&&t!=J)return;for(var t=M(e);t!=y;t=t.parentNode)if(t.parentNode==nt)return s.onGutterClick&&s.onGutterClick(Qt,st(nt.childNodes,t)+It,e),L(e);var r=Hr(e);switch(_(e)){case 3:j&&!n&&Br(e);return;case 2:r&&Vn(r.line,r.ch,!0);return}if(!r){M(e)==z&&L(e);return}Et||dn();var i=+(new Date);if(Nt&&Nt.time>i-400&&Z(Nt.pos,r))return L(e),setTimeout(_n,20),tr(r.line);if(Tt&&Tt.time>i-400&&Z(Tt.pos,r))return Nt={time:i,pos:r},L(e),er(r);Tt={time:i,pos:r};var o=r,u;if(s.dragDrop&&X&&!s.readOnly&&!Z(St.from,St.to)&&!et(r,St.from)&&!et(St.to,r)){R&&(rt.draggable=!0);function a(t){R&&(rt.draggable=!1),kt=!1,f(),l(),Math.abs(e.clientX-t.clientX)+Math.abs(e.clientY-t.clientY)<10&&(L(t),Vn(r.line,r.ch,!0),_n())}var f=P(document,"mouseup",Jr(a),!0),l=P(z,"drop",Jr(a),!0);kt=!0,rt.dragDrop&&rt.dragDrop();return}L(e),Vn(r.line,r.ch,!0);var p=P(document,"mousemove",Jr(function(e){clearTimeout(u),L(e),!F&&!_(e)?h(e):c(e)}),!0),f=P(document,"mouseup",Jr(h),!0)}function nn(e){for(var t=M(e);t!=y;t=t.parentNode)if(t.parentNode==nt)return L(e);var n=Hr(e);if(!n)return;Nt={time:+(new Date),pos:n},L(e),er(n)}function rn(e){if(s.onDragEvent&&s.onDragEvent(Qt,k(e)))return;e.preventDefault();var t=Hr(e,!0),n=e.dataTransfer.files;if(!t||s.readOnly)return;if(n&&n.length&&window.FileReader&&window.File){function r(e,n){var r=new FileReader;r.onload=function(){o[n]=r.result,++u==i&&(t=Jn(t),Jr(function(){var e=En(o.join(""),t,t);zn(t,e)})())},r.readAsText(e)}var i=n.length,o=Array(i),u=0;for(var a=0;a<i;++a)r(n[a],a)}else try{var o=e.dataTransfer.getData("Text");o&&Kr(function(){var e=St.from,n=St.to;zn(t,t),kt&&En("",e,n),Sn(o),_n()})}catch(e){}}function sn(e){var t=Nn();e.dataTransfer.setData("Text",t);if(j||U){var n=document.createElement("img");n.scr="data:image/gif;base64,R0lGODdhAgACAIAAAAAAAP///ywAAAAAAgACAAACAoRRADs=",e.dataTransfer.setDragImage(n,0,0)}}function on(e,t){if(typeof e=="string"){e=u[e];if(!e)return!1}var n=xt;try{s.readOnly&&(At=!0),t&&(xt=null),e(Qt)}catch(r){if(r!=B)throw r;return!1}finally{xt=n,At=!1}return!0}function un(e){function u(){o=!0}var t=f(s.keyMap),n=t.auto;clearTimeout(ln),n&&!c(e)&&(ln=setTimeout(function(){f(s.keyMap)==t&&(s.keyMap=n.call?n.call(null,Qt):n)},50));var r=ft[D(e,"keyCode")],i=!1;if(r==null||e.altGraphKey)return!1;D(e,"altKey")&&(r="Alt-"+r),D(e,"ctrlKey")&&(r="Ctrl-"+r),D(e,"metaKey")&&(r="Cmd-"+r);var o=!1;return D(e,"shiftKey")?i=l("Shift-"+r,s.extraKeys,s.keyMap,function(e){return on(e,!0)},u)||l(r,s.extraKeys,s.keyMap,function(e){if(typeof e=="string"&&/^go[A-Z]/.test(e))return on(e)},u):i=l(r,s.extraKeys,s.keyMap,on,u),o&&(i=!1),i&&(L(e),F&&(e.oldKeyCode=e.keyCode,e.keyCode=0)),i}function an(e,t){var n=l("'"+t+"'",s.extraKeys,s.keyMap,function(e){return on(e,!0)});return n&&L(e),n}function cn(e){Et||dn(),F&&e.keyCode==27&&(e.returnValue=!1),Cn&&On()&&(Cn=!1);if(s.onKeyEvent&&s.onKeyEvent(Qt,k(e)))return;var t=D(e,"keyCode");Un(t==16||D(e,"shiftKey"));var r=un(e);window.opera&&(fn=r?t:null,!r&&t==88&&D(e,n?"metaKey":"ctrlKey")&&Sn(""))}function hn(e){Cn&&On();if(s.onKeyEvent&&s.onKeyEvent(Qt,k(e)))return;var t=D(e,"keyCode"),n=D(e,"charCode");if(window.opera&&t==fn){fn=null,L(e);return}if((window.opera&&!e.which||W)&&un(e))return;var r=String.fromCharCode(n==null?t:n);s.electricChars&&yt.electricChars&&s.smartIndent&&!s.readOnly&&yt.electricChars.indexOf(r)>-1&&setTimeout(Jr(function(){rr(St.to.line,"smart")}),75);if(an(e,r))return;Ln()}function pn(e){if(s.onKeyEvent&&s.onKeyEvent(Qt,k(e)))return;D(e,"keyCode")==16&&(xt=null)}function dn(){if(s.readOnly=="nocursor")return;Et||(s.onFocus&&s.onFocus(Qt),Et=!0,y.className.search(/\bCodeMirror-focused\b/)==-1&&(y.className+=" CodeMirror-focused"),Ht||Mn(!0)),kn(),jr()}function vn(){Et&&(s.onBlur&&s.onBlur(Qt),Et=!1,Ut&&Jr(function(){Ut&&(Ut(),Ut=null)})(),y.className=y.className.replace(" CodeMirror-focused","")),clearInterval(gt),setTimeout(function(){Et||(xt=null)},150)}function mn(e,t,n,r,i){if(At)return;if(Vt){var o=[];bt.iter(e.line,t.line+1,function(e){o.push(e.text)}),Vt.addChange(e.line,n.length,o);while(Vt.done.length>s.undoDepth)Vt.done.shift()}wn(e,t,n,r,i)}function gn(e,t){if(!e.length)return;var n=e.pop(),r=[];for(var i=n.length-1;i>=0;i-=1){var s=n[i],o=[],u=s.start+s.added;bt.iter(s.start,u,function(e){o.push(e.text)}),r.push({start:s.start,added:s.old.length,old:o});var a=Jn({line:s.start+s.old.length-1,ch:it(o[o.length-1],s.old[s.old.length-1])});wn({line:s.start,ch:0},{line:u-1,ch:Gt(u-1).text.length},s.old,a,a)}Ot=!0,t.push(r)}function yn(){gn(Vt.done,Vt.undone)}function bn(){gn(Vt.undone,Vt.done)}function wn(e,t,n,r,i){function T(e){return e<=Math.min(t.line,t.line+y)?e:e+y}if(At)return;var o=!1,u=zt.length;s.lineWrapping||bt.iter(e.line,t.line+1,function(e){if(e.text.length==u)return o=!0,!0});if(e.line!=t.line||n.length>1)Bt=!0;var a=t.line-e.line,f=Gt(e.line),l=Gt(t.line);if(e.ch==0&&t.ch==0&&n[n.length-1]==""){var c=[],h=null;e.line?(h=Gt(e.line-1),h.fixMarkEnds(l)):l.fixMarkStarts();for(var p=0,d=n.length-1;p<d;++p)c.push(g.inheritMarks(n[p],h));a&&bt.remove(e.line,a,jt),c.length&&bt.insert(e.line,c)}else if(f==l)if(n.length==1)f.replace(e.ch,t.ch,n[0]);else{l=f.split(t.ch,n[n.length-1]),f.replace(e.ch,null,n[0]),f.fixMarkEnds(l);var c=[];for(var p=1,d=n.length-1;p<d;++p)c.push(g.inheritMarks(n[p],f));c.push(l),bt.insert(e.line+1,c)}else if(n.length==1)f.replace(e.ch,null,n[0]),l.replace(null,t.ch,""),f.append(l),bt.remove(e.line+1,a,jt);else{var c=[];f.replace(e.ch,null,n[0]),l.replace(null,t.ch,n[n.length-1]),f.fixMarkEnds(l);for(var p=1,d=n.length-1;p<d;++p)c.push(g.inheritMarks(n[p],f));a>1&&bt.remove(e.line+1,a-1,jt),bt.insert(e.line+1,c)}if(s.lineWrapping){var v=Math.max(5,z.clientWidth/_r()-3);bt.iter(e.line,e.line+n.length,function(e){if(e.hidden)return;var t=Math.ceil(e.text.length/v)||1;t!=e.height&&Yt(e,t)})}else bt.iter(e.line,e.line+n.length,function(e){var t=e.text;t.length>u&&(zt=t,u=t.length,Wt=null,o=!1)}),o&&(u=0,zt="",Wt=null,bt.iter(0,bt.size,function(e){var t=e.text;t.length>u&&(u=t.length,zt=t)}));var m=[],y=n.length-a-1;for(var p=0,b=wt.length;p<b;++p){var w=wt[p];w<e.line?m.push(w):w>t.line&&m.push(w+y)}var E=e.line+Math.min(n.length,500);Ur(e.line,E),m.push(E),wt=m,Wr(100),_t.push({from:e.line,to:t.line+1,diff:y});var S={from:e,to:t,text:n};if(Dt){for(var x=Dt;x.next;x=x.next);x.next=S}else Dt=S;Wn(r,i,T(St.from.line),T(St.to.line)),z.clientHeight&&(V.style.height=bt.height*Ar()+2*Dr()+"px")}function En(e,t,n){function r(r){if(et(r,t))return r;if(!et(n,r))return i;var s=r.line+e.length-(n.line-t.line)-1,o=r.ch;return r.line==n.line&&(o+=e[e.length-1].length-(n.ch-(n.line==t.line?t.ch:0))),{line:s,ch:o}}t=Jn(t),n?n=Jn(n):n=t,e=ut(e);var i;return xn(e,t,n,function(e){return i=e,{from:r(St.from),to:r(St.to)}}),i}function Sn(e,t){xn(ut(e),St.from,St.to,function(e){return t=="end"?{from:e,to:e}:t=="start"?{from:St.from,to:St.from}:{from:St.from,to:e}})}function xn(e,t,n,r){var i=e.length==1?e[0].length+t.ch:e[e.length-1].length,s=r({line:t.line+e.length-1,ch:i});mn(t,n,e,s.from,s.to)}function Tn(e,t){var n=e.line,r=t.line;if(n==r)return Gt(n).text.slice(e.ch,t.ch);var i=[Gt(n).text.slice(e.ch)];return bt.iter(n+1,r,function(e){i.push(e.text)}),i.push(Gt(r).text.slice(0,t.ch)),i.join("\n")}function Nn(){return Tn(St.from,St.to)}function kn(){if(Cn)return;vt.set(s.pollInterval,function(){Xr(),On(),Et&&kn(),Vr()})}function Ln(){function t(){Xr();var n=On();!n&&!e?(e=!0,vt.set(60,t)):(Cn=!1,kn()),Vr()}var e=!1;Cn=!0,vt.set(20,t)}function On(){if(Ht||!Et||at(A)||s.readOnly)return!1;var e=A.value;if(e==An)return!1;xt=null;var t=0,n=Math.min(An.length,e.length);while(t<n&&An[t]==e[t])++t;return t<An.length?St.from={line:St.from.line,ch:St.from.ch-(An.length-t)}:Lt&&Z(St.from,St.to)&&(St.to={line:St.to.line,ch:Math.min(Gt(St.to.line).text.length,St.to.ch+(e.length-t))}),Sn(e.slice(t),"end"),An=e,!0}function Mn(e){Z(St.from,St.to)?e&&(An=A.value=""):(An="",A.value=Nn(),Y(A))}function _n(){s.readOnly!="nocursor"&&A.focus()}function Dn(){if(!ct.getBoundingClientRect)return;var e=ct.getBoundingClientRect();if(F&&e.top==e.bottom)return;var t=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(e.top<0||e.bottom>t)&&ct.scrollIntoView()}function Pn(){var e=xr(St.inverted?St.from:St.to),t=s.lineWrapping?Math.min(e.x,rt.offsetWidth):e.x;return Hn(t,e.y,t,e.yBot)}function Hn(e,t,n,r){var i=Pr(),o=Dr();t+=o,r+=o,e+=i,n+=i;var u=z.clientHeight,a=z.scrollTop,f=!1,l=!0;t<a?(z.scrollTop=Math.max(0,t),f=!0):r>a+u&&(z.scrollTop=r-u,f=!0);var c=z.clientWidth,h=z.scrollLeft,p=s.fixedGutter?K.clientWidth:0,d=e<p+i+10;return e<h+p||d?(d&&(e=0),z.scrollLeft=Math.max(0,e-10-p),f=!0):n>c+h-3&&(z.scrollLeft=n+10-c,f=!0,n>V.clientWidth&&(l=!1)),f&&s.onScroll&&s.onScroll(Qt),l}function Bn(){var e=Ar(),t=z.scrollTop-Dr(),n=Math.max(0,Math.floor(t/e)),r=Math.ceil((t+z.clientHeight)/e);return{from:x(bt,n),to:x(bt,r)}}function jn(e,t){function p(){Wt=z.clientWidth;var e=pt.firstChild,t=!1;return bt.iter(It,qt,function(n){if(!n.hidden){var r=Math.round(e.offsetHeight/l)||1;n.height!=r&&(Yt(n,r),Bt=t=!0)}e=e.nextSibling}),t&&(V.style.height=bt.height*l+2*Dr()+"px"),t}if(!z.clientWidth){It=qt=Ft=0;return}var n=Bn();if(e!==!0&&e.length==0&&n.from>It&&n.to<qt)return;var r=Math.max(n.from-100,0),i=Math.min(bt.size,n.to+100);It<r&&r-It<20&&(r=It),qt>i&&qt-i<20&&(i=Math.min(bt.size,qt));var o=e===!0?[]:Fn([{from:It,to:qt,domStart:0}],e),u=0;for(var a=0;a<o.length;++a){var f=o[a];f.from<r&&(f.domStart+=r-f.from,f.from=r),f.to>i&&(f.to=i),f.from>=f.to?o.splice(a--,1):u+=f.to-f.from}if(u==i-r&&r==It&&i==qt)return;o.sort(function(e,t){return e.domStart-t.domStart});var l=Ar(),c=K.style.display;pt.style.display="none",In(r,i,o),pt.style.display=K.style.display="";var h=r!=It||i!=qt||Rt!=z.clientHeight+l;h&&(Rt=z.clientHeight+l),It=r,qt=i,Ft=T(bt,r),J.style.top=Ft*l+"px",z.clientHeight&&(V.style.height=bt.height*l+2*Dr()+"px");if(pt.childNodes.length!=qt-It)throw new Error("BAD PATCH! "+JSON.stringify(o)+" size="+(qt-It)+" nodes="+pt.childNodes.length);return s.lineWrapping?p():(Wt==null&&(Wt=br(zt)),Wt>z.clientWidth?(rt.style.width=Wt+"px",V.style.width="",V.style.width=z.scrollWidth+"px"):rt.style.width=V.style.width=""),K.style.display=c,(h||Bt)&&qn()&&s.lineWrapping&&p()&&qn(),Rn(),!t&&s.onUpdate&&s.onUpdate(Qt),!0}function Fn(e,t){for(var n=0,r=t.length||0;n<r;++n){var i=t[n],s=[],o=i.diff||0;for(var u=0,a=e.length;u<a;++u){var f=e[u];i.to<=f.from&&i.diff?s.push({from:f.from+o,to:f.to+o,domStart:f.domStart}):i.to<=f.from||i.from>=f.to?s.push(f):(i.from>f.from&&s.push({from:f.from,to:i.from,domStart:f.domStart}),i.to<f.to&&s.push({from:i.to+o,to:f.to+o,domStart:f.domStart+(i.to-f.from)}))}e=s}return e}function In(e,t,n){if(!n.length)pt.innerHTML="";else{function r(e){var t=e.nextSibling;return e.parentNode.removeChild(e),t}var i=0,s=pt.firstChild,o;for(var u=0;u<n.length;++u){var a=n[u];while(a.domStart>i)s=r(s),i++;for(var f=0,l=a.to-a.from;f<l;++f)s=s.nextSibling,i++}while(s)s=r(s)}var c=n.shift(),s=pt.firstChild,f=e,h=document.createElement("div");bt.iter(e,t,function(e){c&&c.to==f&&(c=n.shift());if(!c||c.from>f){if(e.hidden)var t=h.innerHTML="<pre></pre>";else{var t="<pre"+(e.className?' class="'+e.className+'"':"")+">"+e.getHTML(ur)+"</pre>";e.bgClassName&&(t='<div style="position: relative"><pre class="'+e.bgClassName+'" style="position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: -2"> </pre>'+t+"</div>")}h.innerHTML=t,pt.insertBefore(h.firstChild,s)}else s=s.nextSibling;++f})}function qn(){if(!s.gutter&&!s.lineNumbers)return;var e=J.offsetHeight,t=z.clientHeight;K.style.height=(e-t<2?t:e)+"px";var n=[],r=It,i;bt.iter(It,Math.max(qt,It+1),function(e){if(e.hidden)n.push("<pre></pre>");else{var t=e.gutterMarker,o=s.lineNumbers?r+s.firstLineNumber:null;t&&t.text?o=t.text.replace("%N%",o!=null?o:""):o==null&&(o=" "),n.push(t&&t.style?'<pre class="'+t.style+'">':"<pre>",o);for(var u=1;u<e.height;++u)n.push("<br/> ");n.push("</pre>"),t||(i=r)}++r}),K.style.display="none",nt.innerHTML=n.join("");if(i!=null){var o=nt.childNodes[i-It],u=String(bt.size).length,a=G(o),f="";while(a.length+f.length<u)f+=" ";f&&o.insertBefore(document.createTextNode(f),o.firstChild)}K.style.display="";var l=Math.abs((parseInt(rt.style.marginLeft)||0)-K.offsetWidth)>2;return rt.style.marginLeft=K.offsetWidth+"px",Bt=!1,l}function Rn(){var e=Z(St.from,St.to),t=xr(St.from,!0),n=e?t:xr(St.to,!0),r=St.inverted?t:n,i=Ar(),o=Q(y),u=Q(pt);C.style.top=Math.max(0,Math.min(z.offsetHeight,r.y+u.top-o.top))+"px",C.style.left=Math.max(0,Math.min(z.offsetWidth,r.x+u.left-o.left))+"px";if(e)ct.style.top=r.y+"px",ct.style.left=(s.lineWrapping?Math.min(r.x,rt.offsetWidth):r.x)+"px",ct.style.display="",ht.style.display="none";else{var a=t.y==n.y,f="",l=rt.clientWidth||rt.offsetWidth,c=rt.clientHeight||rt.offsetHeight;function h(e,t,n,r){var i=q?"width: "+(n?l-n-e:l)+"px":"right: "+n+"px";f+='<div class="CodeMirror-selected" style="position: absolute; left: '+e+"px; top: "+t+"px; "+i+"; height: "+r+'px"></div>'}if(St.from.ch&&t.y>=0){var p=a?l-n.x:0;h(t.x,t.y,p,i)}var d=Math.max(0,t.y+(St.from.ch?i:0)),v=Math.min(n.y,c)-d;v>.2*i&&h(0,d,0,v),(!a||!St.from.ch)&&n.y<c-.5*i&&h(0,n.y,l-n.x,i),ht.innerHTML=f,ct.style.display="none",ht.style.display=""}}function Un(e){e?xt=xt||(St.inverted?St.to:St.from):xt=null}function zn(e,t){var n=xt&&Jn(xt);n&&(et(n,e)?e=n:et(t,n)&&(t=n)),Wn(e,t),Mt=!0}function Wn(e,t,n,r){Yn=null,n==null&&(n=St.from.line,r=St.to.line);if(Z(St.from,e)&&Z(St.to,t))return;if(et(t,e)){var i=t;t=e,e=i}if(e.line!=n){var o=Xn(e,n,St.from.ch);o?e=o:gr(e.line,!1)}t.line!=r&&(t=Xn(t,r,St.to.ch)),Z(e,t)?St.inverted=!1:Z(e,St.to)?St.inverted=!1:Z(t,St.from)&&(St.inverted=!0);if(s.autoClearEmptyLines&&Z(St.from,St.to)){var u=St.inverted?e:t;if(u.line!=St.from.line&&St.from.line<bt.size){var a=Gt(St.from.line);/^\s+$/.test(a.text)&&setTimeout(Jr(function(){if(a.parent&&/^\s+$/.test(a.text)){var e=S(a);En("",{line:e,ch:0},{line:e,ch:a.text.length})}},10))}}St.from=e,St.to=t,Pt=!0}function Xn(e,t,n){function r(t){var r=e.line+t,i=t==1?bt.size:-1;while(r!=i){var o=Gt(r);if(!o.hidden){var u=e.ch;if(s||u>n||u>o.text.length)u=o.text.length;return{line:r,ch:u}}r+=t}}var i=Gt(e.line),s=e.ch==i.text.length&&e.ch!=n;return i.hidden?e.line>=t?r(1)||r(-1):r(-1)||r(1):e}function Vn(e,t,n){var r=Jn({line:e,ch:t||0});(n?zn:Wn)(r,r)}function $n(e){return Math.max(0,Math.min(e,bt.size-1))}function Jn(e){if(e.line<0)return{line:0,ch:0};if(e.line>=bt.size)return{line:bt.size-1,ch:Gt(bt.size-1).text.length};var t=e.ch,n=Gt(e.line).text.length;return t==null||t>n?{line:e.line,ch:n}:t<0?{line:e.line,ch:0}:e}function Kn(e,t){function o(){for(var t=r+e,n=e<0?-1:bt.size;t!=n;t+=e){var i=Gt(t);if(!i.hidden)return r=t,s=i,!0}}function u(t){if(i==(e<0?0:s.text.length)){if(!!t||!o())return!1;i=e<0?s.text.length:0}else i+=e;return!0}var n=St.inverted?St.from:St.to,r=n.line,i=n.ch,s=Gt(r);if(t=="char")u();else if(t=="column")u(!0);else if(t=="word"){var a=!1;for(;;){if(e<0&&!u())break;if(ot(s.text.charAt(i)))a=!0;else if(a){e<0&&(e=1,u());break}if(e>0&&!u())break}}return{line:r,ch:i}}function Qn(e,t){var n=e<0?St.from:St.to;if(xt||Z(St.from,St.to))n=Kn(e,t);Vn(n.line,n.ch,!0)}function Gn(e,t){Z(St.from,St.to)?e<0?En("",Kn(e,t),St.to):En("",St.from,Kn(e,t)):En("",St.from,St.to),Mt=!0}function Zn(e,t){var n=0,r=xr(St.inverted?St.from:St.to,!0);Yn!=null&&(r.x=Yn),t=="page"?n=Math.min(z.clientHeight,window.innerHeight||document.documentElement.clientHeight):t=="line"&&(n=Ar());var i=Tr(r.x,r.y+n*e+2);t=="page"&&(z.scrollTop+=xr(i,!0).y-r.y),Vn(i.line,i.ch,!0),Yn=r.x}function er(e){var t=Gt(e.line).text,n=e.ch,r=e.ch;while(n>0&&ot(t.charAt(n-1)))--n;while(r<t.length&&ot(t.charAt(r)))++r;zn({line:e.line,ch:n},{line:e.line,ch:r})}function tr(e){zn({line:e,ch:0},Jn({line:e+1,ch:0}))}function nr(e){if(Z(St.from,St.to))return rr(St.from.line,e);var t=St.to.line-(St.to.ch?0:1);for(var n=St.from.line;n<=t;++n)rr(n,e)}function rr(e,t){t||(t="add");if(t=="smart")if(!yt.indent)t="prev";else var n=Rr(e);var r=Gt(e),i=r.indentation(s.tabSize),o=r.text.match(/^\s*/)[0],u;t=="prev"?e?u=Gt(e-1).indentation(s.tabSize):u=0:t=="smart"?u=yt.indent(n,r.text.slice(o.length),r.text):t=="add"?u=i+s.indentUnit:t=="subtract"&&(u=i-s.indentUnit),u=Math.max(0,u);var a=u-i;if(!a){if(St.from.line!=e&&St.to.line!=e)return;var f=o}else{var f="",l=0;if(s.indentWithTabs)for(var c=Math.floor(u/s.tabSize);c;--c)l+=s.tabSize,f+=" ";while(l<u)++l,f+=" "}En(f,{line:e,ch:0},{line:e,ch:o.length})}function ir(){yt=e.getMode(s,s.mode),bt.iter(0,bt.size,function(e){e.stateAfter=null}),wt=[0],Wr()}function sr(){var e=s.gutter||s.lineNumbers;K.style.display=e?"":"none",e?Bt=!0:pt.parentNode.style.marginLeft=0}function or(e,t){if(s.lineWrapping){y.className+=" CodeMirror-wrap";var n=z.clientWidth/_r()-3;bt.iter(0,bt.size,function(e){if(e.hidden)return;var t=Math.ceil(e.text.length/n)||1;t!=1&&Yt(e,t)}),rt.style.width=V.style.width=""}else y.className=y.className.replace(" CodeMirror-wrap",""),Wt=null,zt="",bt.iter(0,bt.size,function(e){e.height!=1&&!e.hidden&&Yt(e,1),e.text.length>zt.length&&(zt=e.text)});_t.push({from:0,to:bt.size})}function ur(e){var t=s.tabSize-e%s.tabSize,n=Xt[t];if(n)return n;for(var r='<span class="cm-tab">',i=0;i<t;++i)r+=" ";return Xt[t]={html:r+"</span>",width:t}}function ar(){z.className=z.className.replace(/\s*cm-s-\S+/g,"")+s.theme.replace(/(^|\s)\s*/g," cm-s-")}function fr(){this.set=[]}function lr(e,t,n){function i(e,t,n,i){Gt(e).addMark(new v(t,n,i,r))}e=Jn(e),t=Jn(t);var r=new fr;if(!et(e,t))return r;if(e.line==t.line)i(e.line,e.ch,t.ch,n);else{i(e.line,e.ch,null,n);for(var s=e.line+1,o=t.line;s<o;++s)i(s,null,null,n);i(t.line,null,t.ch,n)}return _t.push({from:e.line,to:t.line+1}),r}function cr(e){e=Jn(e);var t=new m(e.ch);return Gt(e.line).addMark(t),t}function hr(e){e=Jn(e);var t=[],n=Gt(e.line).marked;if(!n)return t;for(var r=0,i=n.length;r<i;++r){var s=n[r];(s.from==null||s.from<=e.ch)&&(s.to==null||s.to>=e.ch)&&t.push(s.marker||s)}return t}function pr(e,t,n){return typeof e=="number"&&(e=Gt($n(e))),e.gutterMarker={text:t,style:n},Bt=!0,e}function dr(e){typeof e=="number"&&(e=Gt($n(e))),e.gutterMarker=null,Bt=!0}function vr(e,t){var n=e,r=e;return typeof e=="number"?r=Gt($n(e)):n=S(e),n==null?null:t(r,n)?(_t.push({from:n,to:n+1}),r):null}function mr(e,t,n){return vr(e,function(e){if(e.className!=t||e.bgClassName!=n)return e.className=t,e.bgClassName=n,!0})}function gr(e,t){return vr(e,function(e,n){if(e.hidden!=t){e.hidden=t,Yt(e,t?0:1);var r=St.from.line,i=St.to.line;if(t&&(r==n||i==n)){var s=r==n?Xn({line:r,ch:0},r,0):St.from,o=i==n?Xn({line:i,ch:0},i,0):St.to;if(!o)return;Wn(s,o)}return Bt=!0}})}function yr(e){if(typeof e=="number"){if(!Kt(e))return null;var t=e;e=Gt(e);if(!e)return null}else{var t=S(e);if(t==null)return null}var n=e.gutterMarker;return{line:t,handle:e,text:e.text,markerText:n&&n.text,markerClass:n&&n.style,lineClass:e.className,bgClass:e.bgClassName}}function br(e){return lt.innerHTML="<pre><span>x</span></pre>",lt.firstChild.firstChild.firstChild.nodeValue=e,lt.firstChild.firstChild.offsetWidth||10}function wr(e,t){function i(e){return Sr(n,e).left}if(t<=0)return 0;var n=Gt(e),r=n.text,s=0,o=0,u=r.length,a,f=Math.min(u,Math.ceil(t/_r()));for(;;){var l=i(f);if(!(l<=t&&f<u)){a=l,u=f;break}f=Math.min(u,Math.ceil(f*1.2))}if(t>a)return u;f=Math.floor(u*.8),l=i(f),l<t&&(s=f,o=l);for(;;){if(u-s<=1)return a-t>t-o?s:u;var c=Math.ceil((s+u)/2),h=i(c);h>t?(u=c,a=h):(s=c,o=h)}}function Sr(e,t){if(t==0)return{top:0,left:0};var n=s.lineWrapping&&t<e.text.length&&$.test(e.text.slice(t-1,t+1));lt.innerHTML="<pre>"+e.getHTML(ur,t,Er,n)+"</pre>";var r=document.getElementById(Er),i=r.offsetTop,o=r.offsetLeft;if(F&&i==0&&o==0){var u=document.createElement("span");u.innerHTML="x",r.parentNode.insertBefore(u,r.nextSibling),i=u.offsetTop}return{top:i,left:o}}function xr(e,t){var n,r=Ar(),i=r*(T(bt,e.line)-(t?Ft:0));if(e.ch==0)n=0;else{var o=Sr(Gt(e.line),e.ch);n=o.left,s.lineWrapping&&(i+=Math.max(0,o.top))}return{x:n,y:i,yBot:i+r}}function Tr(e,t){function c(e){var t=Sr(u,e);if(f){var r=Math.round(t.top/n);return Math.max(0,t.left+(r-l)*z.clientWidth)}return t.left}t<0&&(t=0);var n=Ar(),r=_r(),i=Ft+Math.floor(t/n),o=x(bt,i);if(o>=bt.size)return{line:bt.size-1,ch:Gt(bt.size-1).text.length};var u=Gt(o),a=u.text,f=s.lineWrapping,l=f?i-T(bt,o):0;if(e<=0&&l==0)return{line:o,ch:0};var h=0,p=0,d=a.length,v,m=Math.min(d,Math.ceil((e+l*z.clientWidth*.9)/r));for(;;){var g=c(m);if(!(g<=e&&m<d)){v=g,d=m;break}m=Math.min(d,Math.ceil(m*1.2))}if(e>v)return{line:o,ch:d};m=Math.floor(d*.8),g=c(m),g<e&&(h=m,p=g);for(;;){if(d-h<=1)return{line:o,ch:v-e>e-p?h:d};var y=Math.ceil((h+d)/2),b=c(y);b>e?(d=y,v=b):(h=y,p=b)}}function Nr(e){var t=xr(e,!0),n=Q(rt);return{x:n.left+t.x,y:n.top+t.y,yBot:n.top+t.yBot}}function Ar(){if(Lr==null){Lr="<pre>";for(var e=0;e<49;++e)Lr+="x<br/>";Lr+="x</pre>"}var t=pt.clientHeight;return t==kr?Cr:(kr=t,lt.innerHTML=Lr,Cr=lt.firstChild.offsetHeight/50||1,lt.innerHTML="",Cr)}function _r(){return z.clientWidth==Mr?Or:(Mr=z.clientWidth,Or=br("x"))}function Dr(){return rt.offsetTop}function Pr(){return rt.offsetLeft}function Hr(e,t){var n=Q(z,!0),r,i;try{r=e.clientX,i=e.clientY}catch(e){return null}if(!t&&(r-n.left>z.clientWidth||i-n.top>z.clientHeight))return null;var s=Q(rt,!0);return Tr(r-s.left,i-s.top)}function Br(e){function s(){var e=ut(A.value).join("\n");e!=i&&Jr(Sn)(e,"end"),C.style.position="relative",A.style.cssText=r,I&&(z.scrollTop=n),Ht=!1,Mn(!0),kn()}var t=Hr(e),n=z.scrollTop;if(!t||window.opera)return;(Z(St.from,St.to)||et(t,St.from)||!et(t,St.to))&&Jr(Vn)(t.line,t.ch);var r=A.style.cssText;C.style.position="absolute",A.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: white; "+"border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",Ht=!0;var i=A.value=Nn();_n(),Y(A);if(j){O(e);var o=P(window,"mouseup",function(){o(),setTimeout(s,20)},!0)}else setTimeout(s,50)}function jr(){clearInterval(gt);var e=!0;ct.style.visibility="",gt=setInterval(function(){ct.style.visibility=(e=!e)?"":"hidden"},650)}function Ir(e){function v(e,t,n){if(!e.text)return;var r=e.styles,i=o?0:e.text.length-1,s;for(var a=o?0:r.length-2,f=o?r.length:-2;a!=f;a+=2*u){var l=r[a];if(r[a+1]!=null&&r[a+1]!=h){i+=u*l.length;continue}for(var c=o?0:l.length-1,v=o?l.length:-1;c!=v;c+=u,i+=u)if(i>=t&&i<n&&d.test(s=l.charAt(c))){var m=Fr[s];if(m.charAt(1)==">"==o)p.push(s);else{if(p.pop()!=m.charAt(0))return{pos:i,match:!1};if(!p.length)return{pos:i,match:!0}}}}}var t=St.inverted?St.from:St.to,n=Gt(t.line),r=t.ch-1,i=r>=0&&Fr[n.text.charAt(r)]||Fr[n.text.charAt(++r)];if(!i)return;var s=i.charAt(0),o=i.charAt(1)==">",u=o?1:-1,a=n.styles;for(var f=r+1,l=0,c=a.length;l<c;l+=2)if((f-=a[l].length)<=0){var h=a[l+1];break}var p=[n.text.charAt(r)],d=/[(){}[\]]/;for(var l=t.line,c=o?Math.min(l+100,bt.size):Math.max(-1,l-100);l!=c;l+=u){var n=Gt(l),m=l==t.line,g=v(n,m&&o?r+1:0,m&&!o?r:n.text.length);if(g)break}g||(g={pos:null,match:!1});var h=g.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",y=lr({line:t.line,ch:r},{line:t.line,ch:r+1},h),b=g.pos!=null&&lr({line:l,ch:g.pos},{line:l,ch:g.pos+1},h),w=Jr(function(){y.clear(),b&&b.clear()});e?setTimeout(w,800):Ut=w}function qr(e){var t,n;for(var r=e,i=e-40;r>i;--r){if(r==0)return 0;var o=Gt(r-1);if(o.stateAfter)return r;var u=o.indentation(s.tabSize);if(n==null||t>u)n=r-1,t=u}return n}function Rr(e){var t=qr(e),n=t&&Gt(t-1).stateAfter;return n?n=h(yt,n):n=p(yt),bt.iter(t,e,function(e){e.highlight(yt,n,s.tabSize),e.stateAfter=h(yt,n)}),t<e&&_t.push({from:t,to:e}),e<bt.size&&!Gt(e).stateAfter&&wt.push(e),n}function Ur(e,t){var n=Rr(e);bt.iter(e,t,function(e){e.highlight(yt,n,s.tabSize),e.stateAfter=h(yt,n)})}function zr(){var e=+(new Date)+s.workTime,t=wt.length;while(wt.length){if(!Gt(It).stateAfter)var n=It;else var n=wt.pop();if(n>=bt.size)continue;var r=qr(n),i=r&&Gt(r-1).stateAfter;i?i=h(yt,i):i=p(yt);var o=0,u=yt.compareStates,a=!1,f=r,l=!1;bt.iter(f,bt.size,function(t){var r=t.stateAfter;if(+(new Date)>e)return wt.push(f),Wr(s.workDelay),a&&_t.push({from:n,to:f+1}),l=!0;var c=t.highlight(yt,i,s.tabSize);c&&(a=!0),t.stateAfter=h(yt,i);var p=null;if(u){var d=r&&u(r,i);d!=B&&(p=!!d)}p==null&&(c!==!1||!r?o=0:++o>3&&(!yt.indent||yt.indent(r,"")==yt.indent(i,""))&&(p=!0));if(p)return!0;++f});if(l)return;a&&_t.push({from:n,to:f+1})}t&&s.onHighlightComplete&&s.onHighlightComplete(Qt)}function Wr(e){if(!wt.length)return;mt.set(e,Jr(zr))}function Xr(){Ot=Mt=Dt=null,_t=[],Pt=!1,jt=[]}function Vr(){var e=!1,t;Pt&&(e=!Pn()),_t.length?t=jn(_t,!0):(Pt&&Rn(),Bt&&qn()),e&&Pn(),Pt&&(Dn(),jr()),Et&&!Ht&&(Ot===!0||Ot!==!1&&Pt)&&Mn(Mt),Pt&&s.matchBrackets&&setTimeout(Jr(function(){Ut&&(Ut(),Ut=null),Z(St.from,St.to)&&Ir(!1)}),20);var n=Dt,r=jt;Pt&&s.onCursorActivity&&s.onCursorActivity(Qt),n&&s.onChange&&Qt&&s.onChange(Qt,n);for(var i=0;i<r.length;++i)r[i](Qt);t&&s.onUpdate&&s.onUpdate(Qt)}function Jr(e){return function(){$r++||Xr();try{var t=e.apply(this,arguments)}finally{--$r||Vr()}return t}}function Kr(e){Vt.startCompound();try{return e()}finally{Vt.endCompound()}}var s={},a=e.defaults;for(var d in a)a.hasOwnProperty(d)&&(s[d]=(i&&i.hasOwnProperty(d)?i:a)[d]);var y=document.createElement("div");y.className="CodeMirror"+(s.lineWrapping?" CodeMirror-wrap":""),y.innerHTML='<div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll" tabindex="-1"><div style="position: relative"><div style="position: relative"><div class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div style="position: relative; z-index: 0"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden;"></div><pre class="CodeMirror-cursor"> </pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div>',r.appendChild?r.appendChild(y):r(y);var C=y.firstChild,A=C.firstChild,z=y.lastChild,V=z.firstChild,J=V.firstChild,K=J.firstChild,nt=K.firstChild,rt=K.nextSibling.firstChild,lt=rt.firstChild,ct=lt.nextSibling,ht=ct.nextSibling,pt=ht.nextSibling;ar(),t&&(A.style.width="0px"),R||(rt.draggable=!0),rt.style.outline="none",s.tabindex!=null&&(A.tabIndex=s.tabindex),s.autofocus&&_n(),!s.gutter&&!s.lineNumbers&&(K.style.display="none"),W&&(C.style.height="1px",C.style.position="absolute");try{br("x")}catch(dt){throw dt.message.match(/runtime/i)&&(dt=new Error("A CodeMirror inside a P-style element does not work in Internet Explorer. (innerHTML bug)")),dt}var vt=new H,mt=new H,gt,yt,bt=new w([new b([new g("")])]),wt,Et;ir();var St={from:{line:0,ch:0},to:{line:0,ch:0},inverted:!1},xt,Tt,Nt,Ct=0,kt,Lt=!1,At=!1,Ot,Mt,_t,Dt,Pt,Ht,Bt,jt,Ft=0,It=0,qt=0,Rt=0,Ut,zt="",Wt,Xt={};Jr(function(){Zt(s.value||""),Ot=!1})();var Vt=new N;P(z,"mousedown",Jr(tn)),P(z,"dblclick",Jr(nn)),P(rt,"selectstart",L),j||P(z,"contextmenu",Br),P(z,"scroll",function(){Ct=z.scrollTop,jn([]),s.fixedGutter&&(K.style.left=z.scrollLeft+"px"),s.onScroll&&s.onScroll(Qt)}),P(window,"resize",function(){jn(!0)}),P(A,"keyup",Jr(pn)),P(A,"input",Ln),P(A,"keydown",Jr(cn)),P(A,"keypress",Jr(hn)),P(A,"focus",dn),P(A,"blur",vn);if(s.dragDrop){P(rt,"dragstart",sn);function $t(e){if(s.onDragEvent&&s.onDragEvent(Qt,k(e)))return;O(e)}P(z,"dragenter",$t),P(z,"dragover",$t),P(z,"drop",Jr(rn))}P(z,"paste",function(){_n(),Ln()}),P(A,"paste",Ln),P(A,"cut",Jr(function(){s.readOnly||Sn("")})),W&&P(V,"mouseup",function(){document.activeElement==A&&A.blur(),_n()});var Jt;try{Jt=document.activeElement==A}catch(dt){}Jt||s.autofocus?setTimeout(dn,20):vn();var Qt=y.CodeMirror={getValue:en,setValue:Jr(Zt),getSelection:Nn,replaceSelection:Jr(Sn),focus:function(){window.focus(),_n(),dn(),Ln()},setOption:function(e,t){var n=s[e];s[e]=t,e=="mode"||e=="indentUnit"?ir():e=="readOnly"&&t=="nocursor"?(vn(),A.blur()):e=="readOnly"&&!t?Mn(!0):e=="theme"?ar():e=="lineWrapping"&&n!=t?Jr(or)():e=="tabSize"&&jn(!0);if(e=="lineNumbers"||e=="gutter"||e=="firstLineNumber"||e=="theme")sr(),jn(!0)},getOption:function(e){return s[e]},undo:Jr(yn),redo:Jr(bn),indentLine:Jr(function(e,t){typeof t!="string"&&(t==null?t=s.smartIndent?"smart":"prev":t=t?"add":"subtract"),Kt(e)&&rr(e,t)}),indentSelection:Jr(nr),historySize:function(){return{undo:Vt.done.length,redo:Vt.undone.length}},clearHistory:function(){Vt=new N},matchBrackets:Jr(function(){Ir(!0)}),getTokenAt:Jr(function(e){return e=Jn(e),Gt(e.line).getTokenAt(yt,Rr(e.line),e.ch)}),getStateAfter:function(e){return e=$n(e==null?bt.size-1:e),Rr(e+1)},cursorCoords:function(e,t){return e==null&&(e=St.inverted),this.charCoords(e?St.from:St.to,t)},charCoords:function(e,t){return e=Jn(e),t=="local"?xr(e,!1):t=="div"?xr(e,!0):Nr(e)},coordsChar:function(e){var t=Q(rt);return Tr(e.x-t.left,e.y-t.top)},markText:Jr(lr),setBookmark:cr,findMarksAt:hr,setMarker:Jr(pr),clearMarker:Jr(dr),setLineClass:Jr(mr),hideLine:Jr(function(e){return gr(e,!0)}),showLine:Jr(function(e){return gr(e,!1)}),onDeleteLine:function(e,t){if(typeof e=="number"){if(!Kt(e))return null;e=Gt(e)}return(e.handlers||(e.handlers=[])).push(t),e},lineInfo:yr,addWidget:function(e,t,n,r,i){e=xr(Jn(e));var s=e.yBot,o=e.x;t.style.position="absolute",V.appendChild(t);if(r=="over")s=e.y;else if(r=="near"){var u=Math.max(z.offsetHeight,bt.height*Ar()),a=Math.max(V.clientWidth,rt.clientWidth)-Pr();e.yBot+t.offsetHeight>u&&e.y>t.offsetHeight&&(s=e.y-t.offsetHeight),o+t.offsetWidth>a&&(o=a-t.offsetWidth)}t.style.top=s+Dr()+"px",t.style.left=t.style.right="",i=="right"?(o=V.clientWidth-t.offsetWidth,t.style.right="0px"):(i=="left"?o=0:i=="middle"&&(o=(V.clientWidth-t.offsetWidth)/2),t.style.left=o+Pr()+"px"),n&&Hn(o,s,o+t.offsetWidth,s+t.offsetHeight)},lineCount:function(){return bt.size},clipPos:Jn,getCursor:function(e){return e==null&&(e=St.inverted),tt(e?St.from:St.to)},somethingSelected:function(){return!Z(St.from,St.to)},setCursor:Jr(function(e,t,n){t==null&&typeof e.line=="number"?Vn(e.line,e.ch,n):Vn(e,t,n)}),setSelection:Jr(function(e,t,n){(n?zn:Wn)(Jn(e),Jn(t||e))}),getLine:function(e){if(Kt(e))return Gt(e).text},getLineHandle:function(e){if(Kt(e))return Gt(e)},setLine:Jr(function(e,t){Kt(e)&&En(t,{line:e,ch:0},{line:e,ch:Gt(e).text.length})}),removeLine:Jr(function(e){Kt(e)&&En("",{line:e,ch:0},Jn({line:e+1,ch:0}))}),replaceRange:Jr(En),getRange:function(e,t){return Tn(Jn(e),Jn(t))},triggerOnKeyDown:Jr(cn),execCommand:function(e){return u[e](Qt)},moveH:Jr(Qn),deleteH:Jr(Gn),moveV:Jr(Zn),toggleOverwrite:function(){Lt?(Lt=!1,ct.className=ct.className.replace(" CodeMirror-overwrite","")):(Lt=!0,ct.className+=" CodeMirror-overwrite")},posFromIndex:function(e){var t=0,n;return bt.iter(0,bt.size,function(r){var i=r.text.length+1;if(i>e)return n=e,!0;e-=i,++t}),Jn({line:t,ch:n})},indexFromPos:function(e){if(e.line<0||e.ch<0)return 0;var t=e.ch;return bt.iter(0,e.line,function(e){t+=e.text.length+1}),t},scrollTo:function(e,t){e!=null&&(z.scrollLeft=e),t!=null&&(z.scrollTop=t),jn([])},operation:function(e){return Jr(e)()},compoundChange:function(e){return Kr(e)},refresh:function(){jn(!0),z.scrollHeight>Ct&&(z.scrollTop=Ct)},getInputField:function(){return A},getWrapperElement:function(){return y},getScrollerElement:function(){return z},getGutterElement:function(){return K}},fn=null,ln,Cn=!1,An="",Yn=null;fr.prototype.clear=Jr(function(){var e=Infinity,t=-Infinity;for(var n=0,r=this.set.length;n<r;++n){var i=this.set[n],s=i.marked;if(!s||!i.parent)continue;var o=S(i);e=Math.min(e,o),t=Math.max(t,o);for(var u=0;u<s.length;++u)s[u].marker==this&&s.splice(u--,1)}e!=Infinity&&_t.push({from:e,to:t+1})}),fr.prototype.find=function(){var e,t;for(var n=0,r=this.set.length;n<r;++n){var i=this.set[n],s=i.marked;for(var o=0;o<s.length;++o){var u=s[o];if(u.marker==this)if(u.from!=null||u.to!=null){var a=S(i);a!=null&&(u.from!=null&&(e={line:a,ch:u.from}),u.to!=null&&(t={line:a,ch:u.to}))}}}return{from:e,to:t}};var Er="CodeMirror-temp-"+Math.floor(Math.random()*16777215).toString(16),Cr,kr,Lr,Or,Mr=0,Fr={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},$r=0;for(var Qr in o)o.propertyIsEnumerable(Qr)&&!Qt.propertyIsEnumerable(Qr)&&(Qt[Qr]=o[Qr]);return Qt}function f(e){return typeof e=="string"?a[e]:e}function l(e,t,n,r,i){function s(t){t=f(t);var n=t[e];if(n!=null&&r(n))return!0;if(t.nofallthrough)return i&&i(),!0;var o=t.fallthrough;if(o==null)return!1;if(Object.prototype.toString.call(o)!="[object Array]")return s(o);for(var u=0,a=o.length;u<a;++u)if(s(o[u]))return!0;return!1}return t&&s(t)?!0:s(n)}function c(e){var t=ft[D(e,"keyCode")];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function h(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function p(e,t,n){return e.startState?e.startState(t,n):!0}function d(e,t){this.pos=this.start=0,this.string=e,this.tabSize=t||8}function v(e,t,n,r){this.from=e,this.to=t,this.style=n,this.marker=r}function m(e){this.from=e,this.to=e,this.line=null}function g(e,t){this.styles=t||[e,null],this.text=e,this.height=1,this.marked=this.gutterMarker=this.className=this.bgClassName=this.handlers=null,this.stateAfter=this.parent=this.hidden=null}function y(e,t,n,r){for(var i=0,s=0,o=0;s<t;i+=2){var u=n[i],a=s+u.length;o==0?(a>e&&r.push(u.slice(e-s,Math.min(u.length,t-s)),n[i+1]),a>=e&&(o=1)):o==1&&(a>t?r.push(u.slice(0,t-s),n[i+1]):r.push(u,n[i+1])),s=a}}function b(e){this.lines=e,this.parent=null;for(var t=0,n=e.length,r=0;t<n;++t)e[t].parent=this,r+=e[t].height;this.height=r}function w(e){this.children=e;var t=0,n=0;for(var r=0,i=e.length;r<i;++r){var s=e[r];t+=s.chunkSize(),n+=s.height,s.parent=this}this.size=t,this.height=n,this.parent=null}function E(e,t){while(!e.lines)for(var n=0;;++n){var r=e.children[n],i=r.chunkSize();if(t<i){e=r;break}t-=i}return e.lines[t]}function S(e){if(e.parent==null)return null;var t=e.parent,n=st(t.lines,e);for(var r=t.parent;r;t=r,r=r.parent)for(var i=0,s=r.children.length;;++i){if(r.children[i]==t)break;n+=r.children[i].chunkSize()}return n}function x(e,t){var n=0;e:do{for(var r=0,i=e.children.length;r<i;++r){var s=e.children[r],o=s.height;if(t<o){e=s;continue e}t-=o,n+=s.chunkSize()}return n}while(!e.lines);for(var r=0,i=e.lines.length;r<i;++r){var u=e.lines[r],a=u.height;if(t<a)break;t-=a}return n+r}function T(e,t){var n=0;e:do{for(var r=0,i=e.children.length;r<i;++r){var s=e.children[r],o=s.chunkSize();if(t<o){e=s;continue e}t-=o,n+=s.height}return n}while(!e.lines);for(var r=0;r<t;++r)n+=e.lines[r].height;return n}function N(){this.time=0,this.done=[],this.undone=[],this.compound=0,this.closed=!1}function C(){O(this)}function k(e){return e.stop||(e.stop=C),e}function L(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function A(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function O(e){L(e),A(e)}function M(e){return e.target||e.srcElement}function _(e){if(e.which)return e.which;if(e.button&1)return 1;if(e.button&2)return 3;if(e.button&4)return 2}function D(e,t){var n=e.override&&e.override.hasOwnProperty(t);return n?e.override[t]:e[t]}function P(e,t,n,r){if(typeof e.addEventListener=="function"){e.addEventListener(t,n,!1);if(r)return function(){e.removeEventListener(t,n,!1)}}else{var i=function(e){n(e||window.event)};e.attachEvent("on"+t,i);if(r)return function(){e.detachEvent("on"+t,i)}}}function H(){this.id=null}function J(e,t,n){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var r=0,i=0;r<t;++r)e.charAt(r)==" "?i+=n-i%n:++i;return i}function K(e){return e.currentStyle?e.currentStyle:window.getComputedStyle(e,null)}function Q(e,t){var n=e.ownerDocument.body,r=0,i=0,s=!1;for(var o=e;o;o=o.offsetParent){var u=o.offsetLeft,a=o.offsetTop;o==n?(r+=Math.abs(u),i+=Math.abs(a)):(r+=u,i+=a),t&&K(o).position=="fixed"&&(s=!0)}var f=t&&!s?null:n;for(var o=e.parentNode;o!=f;o=o.parentNode)o.scrollLeft!=null&&(r-=o.scrollLeft,i-=o.scrollTop);return{left:r,top:i}}function G(e){return e.textContent||e.innerText||e.nodeValue||""}function Y(e){t?(e.selectionStart=0,e.selectionEnd=e.value.length):e.select()}function Z(e,t){return e.line==t.line&&e.ch==t.ch}function et(e,t){return e.line<t.line||e.line==t.line&&e.ch<t.ch}function tt(e){return{line:e.line,ch:e.ch}}function rt(e){return nt.textContent=e,nt.innerHTML}function it(e,t){if(!t)return 0;if(!e)return t.length;for(var n=e.length,r=t.length;n>=0&&r>=0;--n,--r)if(e.charAt(n)!=t.charAt(r))break;return r+1}function st(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;++n)if(e[n]==t)return n;return-1}function ot(e){return/\w/.test(e)||e.toUpperCase()!=e.toLowerCase()}e.defaults={value:"",mode:null,theme:"default",indentUnit:2,indentWithTabs:!1,smartIndent:!0,tabSize:4,keyMap:"default",extraKeys:null,electricChars:!0,autoClearEmptyLines:!1,onKeyEvent:null,onDragEvent:null,lineWrapping:!1,lineNumbers:!1,gutter:!1,fixedGutter:!1,firstLineNumber:1,readOnly:!1,dragDrop:!0,onChange:null,onCursorActivity:null,onGutterClick:null,onHighlightComplete:null,onUpdate:null,onFocus:null,onBlur:null,onScroll:null,matchBrackets:!1,workTime:100,workDelay:200,pollInterval:100,undoDepth:40,tabindex:null,autofocus:null};var t=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),n=t||/Mac/.test(navigator.platform),r=/Win/.test(navigator.platform),i=e.modes={},s=e.mimeModes={};e.defineMode=function(t,n){!e.defaults.mode&&t!="null"&&(e.defaults.mode=t);if(arguments.length>2){n.dependencies=[];for(var r=2;r<arguments.length;++r)n.dependencies.push(arguments[r])}i[t]=n},e.defineMIME=function(e,t){s[e]=t},e.resolveMode=function(t){if(typeof t=="string"&&s.hasOwnProperty(t))t=s[t];else if(typeof t=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return typeof t=="string"?{name:t}:t||{name:"null"}},e.getMode=function(t,n){var n=e.resolveMode(n),r=i[n.name];return r?r(t,n):e.getMode(t,"text/plain")},e.listModes=function(){var e=[];for(var t in i)i.propertyIsEnumerable(t)&&e.push(t);return e},e.listMIMEs=function(){var e=[];for(var t in s)s.propertyIsEnumerable(t)&&e.push({mime:t,mode:s[t]});return e};var o=e.extensions={};e.defineExtension=function(e,t){o[e]=t};var u=e.commands={selectAll:function(e){e.setSelection({line:0,ch:0},{line:e.lineCount()-1})},killLine:function(e){var t=e.getCursor(!0),n=e.getCursor(!1),r=!Z(t,n);!r&&e.getLine(t.line).length==t.ch?e.replaceRange("",t,{line:t.line+1,ch:0}):e.replaceRange("",t,r?n:{line:t.line})},deleteLine:function(e){var t=e.getCursor().line;e.replaceRange("",{line:t,ch:0},{line:t})},undo:function(e){e.undo()},redo:function(e){e.redo()},goDocStart:function(e){e.setCursor(0,0,!0)},goDocEnd:function(e){e.setSelection({line:e.lineCount()-1},null,!0)},goLineStart:function(e){e.setCursor(e.getCursor().line,0,!0)},goLineStartSmart:function(e){var t=e.getCursor(),n=e.getLine(t.line),r=Math.max(0,n.search(/\S/));e.setCursor(t.line,t.ch<=r&&t.ch?0:r,!0)},goLineEnd:function(e){e.setSelection({line:e.getCursor().line},null,!0)},goLineUp:function(e){e.moveV(-1,"line")},goLineDown:function(e){e.moveV(1,"line")},goPageUp:function(e){e.moveV(-1,"page")},goPageDown:function(e){e.moveV(1,"page")},goCharLeft:function(e){e.moveH(-1,"char")},goCharRight:function(e){e.moveH(1,"char")},goColumnLeft:function(e){e.moveH(-1,"column")},goColumnRight:function(e){e.moveH(1,"column")},goWordLeft:function(e){e.moveH(-1,"word")},goWordRight:function(e){e.moveH(1,"word")},delCharLeft:function(e){e.deleteH(-1,"char")},delCharRight:function(e){e.deleteH(1,"char")},delWordLeft:function(e){e.deleteH(-1,"word")},delWordRight:function(e){e.deleteH(1,"word")},indentAuto:function(e){e.indentSelection("smart")},indentMore:function(e){e.indentSelection("add")},indentLess:function(e){e.indentSelection("subtract")},insertTab:function(e){e.replaceSelection(" ","end")},transposeChars:function(e){var t=e.getCursor(),n=e.getLine(t.line);t.ch>0&&t.ch<n.length-1&&e.replaceRange(n.charAt(t.ch)+n.charAt(t.ch-1),{line:t.line,ch:t.ch-1},{line:t.line,ch:t.ch+1})},newlineAndIndent:function(e){e.replaceSelection("\n","end"),e.indentLine(e.getCursor().line)},toggleOverwrite:function(e){e.toggleOverwrite()}},a=e.keyMap={};a.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharRight",Backspace:"delCharLeft",Tab:"insertTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite"},a.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Alt-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","Ctrl-Left":"goWordLeft","Ctrl-Right":"goWordRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delWordLeft","Ctrl-Delete":"delWordRight","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore",fallthrough:"basic"},a.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goWordLeft","Alt-Right":"goWordRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","Alt-Backspace":"delWordLeft","Ctrl-Alt-Backspace":"delWordRight","Alt-Delete":"delWordRight","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore",fallthrough:["basic","emacsy"]},a["default"]=n?a.macDefault:a.pcDefault,a.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageUp","Shift-Ctrl-V":"goPageDown","Ctrl-D":"delCharRight","Ctrl-H":"delCharLeft","Alt-D":"delWordRight","Alt-Backspace":"delWordLeft","Ctrl-K":"killLine","Ctrl-T":"transposeChars"},e.fromTextArea=function(t,n){function r(){t.value=u.getValue()}n||(n={}),n.value=t.value,!n.tabindex&&t.tabindex&&(n.tabindex=t.tabindex),n.autofocus==null&&t.getAttribute("autofocus")!=null&&(n.autofocus=!0);if(t.form){var i=P(t.form,"submit",r,!0);if(typeof t.form.submit=="function"){var s=t.form.submit;function o(){r(),t.form.submit=s,t.form.submit(),t.form.submit=o}t.form.submit=o}}t.style.display="none";var u=e(function(e){t.parentNode.insertBefore(e,t.nextSibling)},n);return u.save=r,u.getTextArea=function(){return t},u.toTextArea=function(){r(),t.parentNode.removeChild(u.getWrapperElement()),t.style.display="",t.form&&(i(),typeof t.form.submit=="function"&&(t.form.submit=s))},u},e.copyState=h,e.startState=p,d.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==0},peek:function(){return this.string.charAt(this.pos)},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(e){var t=this.string.charAt(this.pos);if(typeof e=="string")var n=t==e;else var n=t&&(e.test?e.test(t):e(t));if(n)return++this.pos,t},eatWhile:function(e){var t=this.pos;while(this.eat(e));return this.pos>t},eatSpace:function(){var e=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},backUp:function(e){this.pos-=e},column:function(){return J(this.string,this.start,this.tabSize)},indentation:function(){return J(this.string,null,this.tabSize)},match:function(e,t,n){if(typeof e!="string"){var i=this.string.slice(this.pos).match(e);return i&&t!==!1&&(this.pos+=i[0].length),i}function r(e){return n?e.toLowerCase():e}if(r(this.string).indexOf(r(e),this.pos)==this.pos)return t!==!1&&(this.pos+=e.length),!0},current:function(){return this.string.slice(this.start,this.pos)}},e.StringStream=d,v.prototype={attach:function(e){this.marker.set.push(e)},detach:function(e){var t=st(this.marker.set,e);t>-1&&this.marker.set.splice(t,1)},split:function(e,t){if(this.to<=e&&this.to!=null)return null;var n=this.from<e||this.from==null?null:this.from-e+t,r=this.to==null?null:this.to-e+t;return new v(n,r,this.style,this.marker)},dup:function(){return new v(null,null,this.style,this.marker)},clipTo:function(e,t,n,r,i){e&&r>this.from&&(r<this.to||this.to==null)?this.from=null:this.from!=null&&this.from>=t&&(this.from=Math.max(r,this.from)+i),n&&(t<this.to||this.to==null)&&(t>this.from||this.from==null)?this.to=null:this.to!=null&&this.to>t&&(this.to=r<this.to?this.to+i:t)},isDead:function(){return this.from!=null&&this.to!=null&&this.from>=this.to},sameSet:function(e){return this.marker==e.marker}},m.prototype={attach:function(e){this.line=e},detach:function(e){this.line==e&&(this.line=null)},split:function(e,t){if(e<this.from)return this.from=this.to=this.from-e+t,this},isDead:function(){return this.from>this.to},clipTo:function(e,t,n,r,i){(e||t<this.from)&&(n||r>this.to)?(this.from=0,this.to=-1):this.from>t&&(this.from=this.to=Math.max(r,this.from)+i)},sameSet:function(e){return!1},find:function(){return!this.line||!this.line.parent?null:{line:S(this.line),ch:this.from}},clear:function(){if(this.line){var e=st(this.line.marked,this);e!=-1&&this.line.marked.splice(e,1),this.line=null}}},g.inheritMarks=function(e,t){var n=new g(e),r=t&&t.marked;if(r)for(var i=0;i<r.length;++i)if(r[i].to==null&&r[i].style){var s=n.marked||(n.marked=[]),o=r[i],u=o.dup();s.push(u),u.attach(n)}return n},g.prototype={replace:function(e,t,n){var r=[],i=this.marked,s=t==null?this.text.length:t;y(0,e,this.styles,r),n&&r.push(n,null),y(s,this.text.length,this.styles,r),this.styles=r,this.text=this.text.slice(0,e)+n+this.text.slice(s),this.stateAfter=null;if(i){var o=n.length-(s-e);for(var u=0;u<i.length;++u){var a=i[u];a.clipTo(e==null,e||0,t==null,s,o),a.isDead()&&(a.detach(this),i.splice(u--,1))}}},split:function(e,t){var n=[t,null],r=this.marked;y(e,this.text.length,this.styles,n);var i=new g(t+this.text.slice(e),n);if(r)for(var s=0;s<r.length;++s){var o=r[s],u=o.split(e,t.length);u&&(i.marked||(i.marked=[]),i.marked.push(u),u.attach(i),u==o&&r.splice(s--,1))}return i},append:function(e){var t=this.text.length,n=e.marked,r=this.marked;this.text+=e.text,y(0,e.text.length,e.styles,this.styles);if(r)for(var i=0;i<r.length;++i)r[i].to==null&&(r[i].to=t);if(n&&n.length){r||(this.marked=r=[]);e:for(var i=0;i<n.length;++i){var s=n[i];if(!s.from)for(var o=0;o<r.length;++o){var u=r[o];if(u.to==t&&u.sameSet(s)){u.to=s.to==null?null:s.to+t,u.isDead()&&(u.detach(this),n.splice(i--,1));continue e}}r.push(s),s.attach(this),s.from+=t,s.to!=null&&(s.to+=t)}}},fixMarkEnds:function(e){var t=this.marked,n=e.marked;if(!t)return;for(var r=0;r<t.length;++r){var i=t[r],s=i.to==null;if(s&&n)for(var o=0;o<n.length;++o)if(n[o].sameSet(i)){s=!1;break}s&&(i.to=this.text.length)}},fixMarkStarts:function(){var e=this.marked;if(!e)return;for(var t=0;t<e.length;++t)e[t].from==null&&(e[t].from=0)},addMark:function(e){e.attach(this),this.marked==null&&(this.marked=[]),this.marked.push(e),this.marked.sort(function(e,t){return(e.from||0)-(t.from||0)})},highlight:function(e,t,n){var r=new d(this.text,n),i=this.styles,s=0,o=!1,u=i[0],a;this.text==""&&e.blankLine&&e.blankLine(t);while(!r.eol()){var f=e.token(r,t),l=this.text.slice(r.start,r.pos);r.start=r.pos,s&&i[s-1]==f?i[s-2]+=l:l&&(!o&&(i[s+1]!=f||s&&i[s-2]!=a)&&(o=!0),i[s++]=l,i[s++]=f,a=u,u=i[s]);if(r.pos>5e3){i[s++]=this.text.slice(r.pos),i[s++]=null;break}}return i.length!=s&&(i.length=s,o=!0),s&&i[s-2]!=a&&(o=!0),o||(i.length<5&&this.text.length<10?null:!1)},getTokenAt:function(e,t,n){var r=this.text,i=new d(r);while(i.pos<n&&!i.eol()){i.start=i.pos;var s=e.token(i,t)}return{start:i.start,end:i.pos,string:i.current(),className:s||null,state:t}},indentation:function(e){return J(this.text,null,e)},getHTML:function(e,t,n,r){function u(t,n){if(!t)return;s&&F&&t.charAt(0)==" "&&(t=" "+t.slice(1)),s=!1;if(t.indexOf(" ")==-1){o+=t.length;var r=rt(t)}else{var r="";for(var u=0;;){var a=t.indexOf(" ",u);if(a==-1){r+=rt(t.slice(u)),o+=t.length-u;break}o+=a-u;var f=e(o);r+=rt(t.slice(u,a))+f.html,o+=f.width,u=a+1}}n?i.push('<span class="',n,'">',r,"</span>"):i.push(r)}function v(e){return e?"cm-"+e.replace(/ +/g," cm-"):null}var i=[],s=!0,o=0,a=u;if(t!=null){var f=0,l='<span id="'+n+'">';a=function(e,n){var s=e.length;t>=f&&t<f+s?(t>f&&(u(e.slice(0,t-f),n),r&&i.push("<wbr>")),i.push(l),u(e.slice(t-f),n),i.push("</span>"),t--,f+=s):(f+=s,u(e,n),f==t&&f==d?i.push(l+"</span>"):f>t+10&&/\s/.test(e)&&(a=function(){}))}}var c=this.styles,h=this.text,p=this.marked,d=h.length;if(!h&&t==null)a(" ");else if(!p||!p.length)for(var m=0,g=0;g<d;m+=2){var y=c[m],b=c[m+1],w=y.length;g+w>d&&(y=y.slice(0,d-g)),g+=w,a(y,v(b))}else{var E=0,m=0,S="",b,x=0,T=p[0].from||0,N=[],C=0;function k(){var e;while(C<p.length&&((e=p[C]).from==E||e.from==null))e.style!=null&&N.push(e),++C;T=C<p.length?p[C].from:Infinity;for(var t=0;t<N.length;++t){var n=N[t].to||Infinity;n==E?N.splice(t--,1):T=Math.min(n,T)}}var L=0;while(E<d){T==E&&k();var A=Math.min(d,T);for(;;){if(S){var O=E+S.length,M=b;for(var _=0;_<N.length;++_)M=(M?M+" ":"")+N[_].style;a(O>A?S.slice(0,A-E):S,M);if(O>=A){S=S.slice(A-E),E=A;break}E=O}S=c[m++],b=v(c[m++])}}}return i.join("")},cleanUp:function(){this.parent=null;if(this.marked)for(var e=0,t=this.marked.length;e<t;++e)this.marked[e].detach(this)}},b.prototype={chunkSize:function(){return this.lines.length},remove:function(e,t,n){for(var r=e,i=e+t;r<i;++r){var s=this.lines[r];this.height-=s.height,s.cleanUp();if(s.handlers)for(var o=0;o<s.handlers.length;++o)n.push(s.handlers[o])}this.lines.splice(e,t)},collapse:function(e){e.splice.apply(e,[e.length,0].concat(this.lines))},insertHeight:function(e,t,n){this.height+=n,F?this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e)):this.lines.splice.apply(this.lines,[e,0].concat(t));for(var r=0,i=t.length;r<i;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}},w.prototype={chunkSize:function(){return this.size},remove:function(e,t,n){this.size-=t;for(var r=0;r<this.children.length;++r){var i=this.children[r],s=i.chunkSize();if(e<s){var o=Math.min(t,s-e),u=i.height;i.remove(e,o,n),this.height-=u-i.height,s==o&&(this.children.splice(r--,1),i.parent=null);if((t-=o)==0)break;e=0}else e-=s}if(this.size-t<25){var a=[];this.collapse(a),this.children=[new b(a)],this.children[0].parent=this}},collapse:function(e){for(var t=0,n=this.children.length;t<n;++t)this.children[t].collapse(e)},insert:function(e,t){var n=0;for(var r=0,i=t.length;r<i;++r)n+=t[r].height;this.insertHeight(e,t,n)},insertHeight:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0,i=this.children.length;r<i;++r){var s=this.children[r],o=s.chunkSize();if(e<=o){s.insertHeight(e,t,n);if(s.lines&&s.lines.length>50){while(s.lines.length>50){var u=s.lines.splice(s.lines.length-25,25),a=new b(u);s.height-=a.height,this.children.splice(r+1,0,a),a.parent=this}this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new w(t);if(!e.parent){var r=new w(e.children);r.parent=e,e.children=[r,n],e=r}else{e.size-=n.size,e.height-=n.height;var i=st(e.parent.children,e);e.parent.children.splice(i+1,0,n)}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iter:function(e,t,n){this.iterN(e,t-e,n)},iterN:function(e,t,n){for(var r=0,i=this.children.length;r<i;++r){var s=this.children[r],o=s.chunkSize();if(e<o){var u=Math.min(t,o-e);if(s.iterN(e,u,n))return!0;if((t-=u)==0)break;e=0}else e-=o}}},N.prototype={addChange:function(e,t,n){this.undone.length=0;var r=+(new Date),i=this.done[this.done.length-1],s=i&&i[i.length-1],o=r-this.time;if(this.compound&&i&&!this.closed)i.push({start:e,added:t,old:n});else if(o>400||!s||this.closed||s.start>e+n.length||s.start+s.added<e)this.done.push([{start:e,added:t,old:n}]),this.closed=!1;else{var u=Math.max(0,s.start-e),a=Math.max(0,e+n.length-(s.start+s.added));for(var f=u;f>0;--f)s.old.unshift(n[f-1]);for(var f=a;f>0;--f)s.old.push(n[n.length-f]);u&&(s.start=e),s.added+=t-(n.length-u-a)}this.time=r},startCompound:function(){this.compound++||(this.closed=!0)},endCompound:function(){--this.compound||(this.closed=!0)}},e.e_stop=O,e.e_preventDefault=L,e.e_stopPropagation=A,e.connect=P,H.prototype={set:function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)}};var B=e.Pass={toString:function(){return"CodeMirror.Pass"}},j=/gecko\/\d{7}/i.test(navigator.userAgent),F=/MSIE \d/.test(navigator.userAgent),I=/MSIE [1-8]\b/.test(navigator.userAgent),q=F&&document.documentMode==5,R=/WebKit\//.test(navigator.userAgent),U=/Chrome\//.test(navigator.userAgent),z=/Apple Computer/.test(navigator.vendor),W=/KHTML\//.test(navigator.userAgent),X=function(){if(I)return!1;var e=document.createElement("div");return"draggable"in e||"dragDrop"in e}(),V=function(){var e=document.createElement("textarea");return e.value="foo\nbar",e.value.indexOf("\r")>-1?"\r\n":"\n"}(),$=/^$/;j?$=/$'/:z?$=/\-[^ \-?]|\?[^ !'\"\),.\-\/:;\?\]\}]/:U&&($=/\-[^ \-\.?]|\?[^ \-\.?\]\}:;!'\"\),\/]|[\.!\"#&%\)*+,:;=>\]|\}~][\(\{\[<]|\$'/),document.documentElement.getBoundingClientRect!=null&&(Q=function(e,t){try{var n=e.getBoundingClientRect();n={top:n.top,left:n.left}}catch(r){n={top:0,left:0}}if(!t)if(window.pageYOffset==null){var i=document.documentElement||document.body.parentNode;i.scrollTop==null&&(i=document.body),n.top+=i.scrollTop,n.left+=i.scrollLeft}else n.top+=window.pageYOffset,n.left+=window.pageXOffset;return n});var nt=document.createElement("pre");rt("a")=="\na"?rt=function(e){return nt.textContent=e,nt.innerHTML.slice(1)}:rt(" ")!=" "&&(rt=function(e){return nt.innerHTML="",nt.appendChild(document.createTextNode(e)),nt.innerHTML}),e.htmlEscape=rt;var ut="\n\nb".split(/\n/).length!=3?function(e){var t=0,n,r=[];while((n=e.indexOf("\n",t))>-1)r.push(e.slice(t,e.charAt(n-1)=="\r"?n-1:n)),t=n+1;return r.push(e.slice(t)),r}:function(e){return e.split(/\r?\n/)};e.splitLines=ut;var at=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0};e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var ft={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",91:"Mod",92:"Mod",93:"Mod",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};return e.keyNames=ft,function(){for(var e=0;e<10;e++)ft[e+48]=String(e);for(var e=65;e<=90;e++)ft[e]=String.fromCharCode(e);for(var e=1;e<=12;e++)ft[e+111]=ft[e+63235]="F"+e}(),e}()
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/codemirror/mode/mysql/mysql.js b/src/main/webapp/javascripts_min/libs/codemirror/mode/mysql/mysql.js new file mode 100644 index 0000000..dcaf25f --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/codemirror/mode/mysql/mysql.js @@ -0,0 +1 @@ +CodeMirror.defineMode("mysql",function(e){function r(e){return new RegExp("^(?:"+e.join("|")+")$","i")}function u(e,t){var r=e.next();n=null;if(r=="$"||r=="?")return e.match(/^[\w\d]*/),"variable-2";if(r=="<"&&!e.match(/^[\s\u00a0=]/,!1))return e.match(/^[^\s\u00a0>]*>?/),"atom";if(r=='"'||r=="'")return t.tokenize=a(r),t.tokenize(e,t);if(r=="`")return t.tokenize=f(r),t.tokenize(e,t);if(/[{}\(\),\.;\[\]]/.test(r))return n=r,null;if(r!="-"){if(o.test(r))return e.eatWhile(o),null;if(r==":")return e.eatWhile(/[\w\d\._\-]/),"atom";e.eatWhile(/[_\w\d]/);if(e.eat(":"))return e.eatWhile(/[\w\d_\-]/),"atom";var u=e.current(),l;return i.test(u)?null:s.test(u)?"keyword":"variable"}ch2=e.next();if(ch2=="-")return e.skipToEnd(),"comment"}function a(e){return function(t,n){var r=!1,i;while((i=t.next())!=null){if(i==e&&!r){n.tokenize=u;break}r=!r&&i=="\\"}return"string"}}function f(e){return function(t,n){var r=!1,i;while((i=t.next())!=null){if(i==e&&!r){n.tokenize=u;break}r=!r&&i=="\\"}return"variable-2"}}function l(e,t,n){e.context={prev:e.context,indent:e.indent,col:n,type:t}}function c(e){e.indent=e.context.indent,e.context=e.context.prev}var t=e.indentUnit,n,i=r(["str","lang","langmatches","datatype","bound","sameterm","isiri","isuri","isblank","isliteral","union","a"]),s=r(["ACCESSIBLE","ALTER","AS","BEFORE","BINARY","BY","CASE","CHARACTER","COLUMN","CONTINUE","CROSS","CURRENT_TIMESTAMP","DATABASE","DAY_MICROSECOND","DEC","DEFAULT","DESC","DISTINCT","DOUBLE","EACH","ENCLOSED","EXIT","FETCH","FLOAT8","FOREIGN","GRANT","HIGH_PRIORITY","HOUR_SECOND","IN","INNER","INSERT","INT2","INT8","INTO","JOIN","KILL","LEFT","LINEAR","LOCALTIME","LONG","LOOP","MATCH","MEDIUMTEXT","MINUTE_SECOND","NATURAL","NULL","OPTIMIZE","OR","OUTER","PRIMARY","RANGE","READ_WRITE","REGEXP","REPEAT","RESTRICT","RIGHT","SCHEMAS","SENSITIVE","SHOW","SPECIFIC","SQLSTATE","SQL_CALC_FOUND_ROWS","STARTING","TERMINATED","TINYINT","TRAILING","UNDO","UNLOCK","USAGE","UTC_DATE","VALUES","VARCHARACTER","WHERE","WRITE","ZEROFILL","ALL","AND","ASENSITIVE","BIGINT","BOTH","CASCADE","CHAR","COLLATE","CONSTRAINT","CREATE","CURRENT_TIME","CURSOR","DAY_HOUR","DAY_SECOND","DECLARE","DELETE","DETERMINISTIC","DIV","DUAL","ELSEIF","EXISTS","FALSE","FLOAT4","FORCE","FULLTEXT","HAVING","HOUR_MINUTE","IGNORE","INFILE","INSENSITIVE","INT1","INT4","INTERVAL","ITERATE","KEYS","LEAVE","LIMIT","LOAD","LOCK","LONGTEXT","MASTER_SSL_VERIFY_SERVER_CERT","MEDIUMINT","MINUTE_MICROSECOND","MODIFIES","NO_WRITE_TO_BINLOG","ON","OPTIONALLY","OUT","PRECISION","PURGE","READS","REFERENCES","RENAME","REQUIRE","REVOKE","SCHEMA","SELECT","SET","SPATIAL","SQLEXCEPTION","SQL_BIG_RESULT","SSL","TABLE","TINYBLOB","TO","TRUE","UNIQUE","UPDATE","USING","UTC_TIMESTAMP","VARCHAR","WHEN","WITH","YEAR_MONTH","ADD","ANALYZE","ASC","BETWEEN","BLOB","CALL","CHANGE","CHECK","CONDITION","CONVERT","CURRENT_DATE","CURRENT_USER","DATABASES","DAY_MINUTE","DECIMAL","DELAYED","DESCRIBE","DISTINCTROW","DROP","ELSE","ESCAPED","EXPLAIN","FLOAT","FOR","FROM","GROUP","HOUR_MICROSECOND","IF","INDEX","INOUT","INT","INT3","INTEGER","IS","KEY","LEADING","LIKE","LINES","LOCALTIMESTAMP","LONGBLOB","LOW_PRIORITY","MEDIUMBLOB","MIDDLEINT","MOD","NOT","NUMERIC","OPTION","ORDER","OUTFILE","PROCEDURE","READ","REAL","RELEASE","REPLACE","RETURN","RLIKE","SECOND_MICROSECOND","SEPARATOR","SMALLINT","SQL","SQLWARNING","SQL_SMALL_RESULT","STRAIGHT_JOIN","THEN","TINYTEXT","TRIGGER","UNION","UNSIGNED","USE","UTC_TIME","VARBINARY","VARYING","WHILE","XOR","FULL","COLUMNS","MIN","MAX","STDEV","COUNT"]),o=/[*+\-<>=&|]/;return{startState:function(e){return{tokenize:u,context:null,indent:0,col:0}},token:function(e,t){e.sol()&&(t.context&&t.context.align==null&&(t.context.align=!1),t.indent=e.indentation());if(e.eatSpace())return null;var r=t.tokenize(e,t);r!="comment"&&t.context&&t.context.align==null&&t.context.type!="pattern"&&(t.context.align=!0);if(n=="(")l(t,")",e.column());else if(n=="[")l(t,"]",e.column());else if(n=="{")l(t,"}",e.column());else if(/[\]\}\)]/.test(n)){while(t.context&&t.context.type=="pattern")c(t);t.context&&n==t.context.type&&c(t)}else n=="."&&t.context&&t.context.type=="pattern"?c(t):/atom|string|variable/.test(r)&&t.context&&(/[\}\]]/.test(t.context.type)?l(t,"pattern",e.column()):t.context.type=="pattern"&&!t.context.align&&(t.context.align=!0,t.context.col=e.column()));return r},indent:function(e,n){var r=n&&n.charAt(0),i=e.context;if(/[\]\}]/.test(r))while(i&&i.type=="pattern")i=i.prev;var s=i&&r==i.type;return i?i.type=="pattern"?i.col:i.align?i.col+(s?0:1):i.indent+(s?0:t):0}}}),CodeMirror.defineMIME("text/x-mysql","mysql")
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/codemirror/mode/plsql/plsql.js b/src/main/webapp/javascripts_min/libs/codemirror/mode/plsql/plsql.js new file mode 100644 index 0000000..f1195d1 --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/codemirror/mode/plsql/plsql.js @@ -0,0 +1 @@ +CodeMirror.defineMode("plsql",function(e,t){function f(e,t,n){return t.tokenize=n,n(e,t)}function c(e,t){return l=e,t}function h(e,t){var n=e.next();return n=='"'||n=="'"?f(e,t,p(n)):/[\[\]{}\(\),;\.]/.test(n)?c(n):/\d/.test(n)?(e.eatWhile(/[\w\.]/),c("number","number")):n=="/"?e.eat("*")?f(e,t,d):(e.eatWhile(a),c("operator","operator")):n=="-"?e.eat("-")?(e.skipToEnd(),c("comment","comment")):(e.eatWhile(a),c("operator","operator")):n=="@"||n=="$"?(e.eatWhile(/[\w\d\$_]/),c("word","variable")):a.test(n)?(e.eatWhile(a),c("operator","operator")):(e.eatWhile(/[\w\$_]/),r&&r.propertyIsEnumerable(e.current().toLowerCase())?c("keyword","keyword"):i&&i.propertyIsEnumerable(e.current().toLowerCase())?c("keyword","builtin"):s&&s.propertyIsEnumerable(e.current().toLowerCase())?c("keyword","variable-2"):o&&o.propertyIsEnumerable(e.current().toLowerCase())?c("keyword","variable-3"):c("word","plsql-word"))}function p(e){return function(t,n){var r=!1,i,s=!1;while((i=t.next())!=null){if(i==e&&!r){s=!0;break}r=!r&&i=="\\"}if(s||!r&&!u)n.tokenize=h;return c("string","plsql-string")}}function d(e,t){var n=!1,r;while(r=e.next()){if(r=="/"&&n){t.tokenize=h;break}n=r=="*"}return c("comment","plsql-comment")}var n=e.indentUnit,r=t.keywords,i=t.functions,s=t.types,o=t.sqlplus,u=t.multiLineStrings,a=/[+\-*&%=<>!?:\/|]/,l;return{startState:function(e){return{tokenize:h,startOfLine:!0}},token:function(e,t){if(e.eatSpace())return null;var n=t.tokenize(e,t);return n}}}),function(){function e(e){var t={},n=e.split(" ");for(var r=0;r<n.length;++r)t[n[r]]=!0;return t}var t="abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work",n="abs acos add_months ascii asin atan atan2 average bfilename ceil chartorowid chr concat convert cos cosh count decode deref dual dump dup_val_on_index empty error exp false floor found glb greatest hextoraw initcap instr instrb isopen last_day least lenght lenghtb ln lower lpad ltrim lub make_ref max min mod months_between new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null nvl others power rawtohex reftohex round rowcount rowidtochar rpad rtrim sign sin sinh soundex sqlcode sqlerrm sqrt stddev substr substrb sum sysdate tan tanh to_char to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid upper user userenv variance vsize",r="bfile blob character clob dec float int integer mlslabel natural naturaln nchar nclob number numeric nvarchar2 real rowtype signtype smallint string varchar varchar2",i="appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap";CodeMirror.defineMIME("text/x-plsql",{name:"plsql",keywords:e(t),functions:e(n),types:e(r),sqlplus:e(i)})}()
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/date.format.js b/src/main/webapp/javascripts_min/libs/date.format.js new file mode 100644 index 0000000..1579f91 --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/date.format.js @@ -0,0 +1,15 @@ +/* + * Date Format 1.2.3 + * (c) 2007-2009 Steven Levithan <stevenlevithan.com> + * MIT license + * + * Includes enhancements by Scott Trenda <scott.trenda.net> + * and Kris Kowal <cixar.com/~kris.kowal/> + * + * Accepts a date, a mask, or a date and a mask. + * Returns a formatted version of the given date. + * The date defaults to the current date/time. + * The mask defaults to dateFormat.masks.default. + */ + +var dateFormat=function(){var e=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,t=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,n=/[^-+\dA-Z]/g,r=function(e,t){e=String(e),t=t||2;while(e.length<t)e="0"+e;return e};return function(i,s,o){var u=dateFormat;arguments.length==1&&Object.prototype.toString.call(i)=="[object String]"&&!/\d/.test(i)&&(s=i,i=undefined),i=i?new Date(i):new Date;if(isNaN(i))throw SyntaxError("invalid date");s=String(u.masks[s]||s||u.masks["default"]),s.slice(0,4)=="UTC:"&&(s=s.slice(4),o=!0);var a=o?"getUTC":"get",f=i[a+"Date"](),l=i[a+"Day"](),c=i[a+"Month"](),h=i[a+"FullYear"](),p=i[a+"Hours"](),d=i[a+"Minutes"](),v=i[a+"Seconds"](),m=i[a+"Milliseconds"](),g=o?0:i.getTimezoneOffset(),y={d:f,dd:r(f),ddd:u.i18n.dayNames[l],dddd:u.i18n.dayNames[l+7],m:c+1,mm:r(c+1),mmm:u.i18n.monthNames[c],mmmm:u.i18n.monthNames[c+12],yy:String(h).slice(2),yyyy:h,h:p%12||12,hh:r(p%12||12),H:p,HH:r(p),M:d,MM:r(d),s:v,ss:r(v),l:r(m,3),L:r(m>99?Math.round(m/10):m),t:p<12?"a":"p",tt:p<12?"am":"pm",T:p<12?"A":"P",TT:p<12?"AM":"PM",Z:o?"UTC":(String(i).match(t)||[""]).pop().replace(n,""),o:(g>0?"-":"+")+r(Math.floor(Math.abs(g)/60)*100+Math.abs(g)%60,4),S:["th","st","nd","rd"][f%10>3?0:(f%100-f%10!=10)*f%10]};return s.replace(e,function(e){return e in y?y[e]:e.slice(1,e.length-1)})}}();dateFormat.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"},dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]},Date.prototype.format=function(e,t){return dateFormat(this,e,t)}
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/ddl_builder/ddl_builder.js b/src/main/webapp/javascripts_min/libs/ddl_builder/ddl_builder.js new file mode 100644 index 0000000..19dd7ae --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/ddl_builder/ddl_builder.js @@ -0,0 +1,9 @@ +/* + * DDL Builder + * Copyright Jake Feasel, 2012 + * Released under MIT license + * For questions email admin at sqlfiddle dot com + * http://github.com/jakefeasel/DDLBuilder + */ + +define(["jQuery","Handlebars","DateFormat","text!./templates/generic.sql","text!./templates/oracle.sql","text!./templates/sqlite.sql","HandlebarsHelpers/each_with_index"],function(e,t,n,r,i,s){return ddl_builder=function(e){return e||(e={}),this.fieldPrefix="",this.fieldSuffix="",this.tablePrefix="",this.tableSuffix="",this.dateFormatMask="yyyy-mm-dd HH:MM:ss",this.charType="varchar",this.intType="int",this.floatType="numeric",this.dateType="datetime",this.valueSeparator="",this.column_count=0,this.definition={tableName:"Table1",columns:[],data:[]},this.ddlTemplate=r,this.compiledTemplate=t.compile(this.ddlTemplate),this.setup(e),this},ddl_builder.prototype.setup=function(e){for(var n in e)this[n]=e[n];return e.ddlTemplate&&(this.compiledTemplate=t.compile(this.ddlTemplate)),e.tableName&&(this.definition.tableName=e.tableName),this},ddl_builder.prototype.setupForDBType=function(e,t){switch(e){case"SQL Server":this.setup({statement_separator:t,fieldPrefix:"[",fieldSuffix:"]",tablePrefix:"[",tableSuffix:"]"});break;case"MySQL":this.setup({statement_separator:t,fieldPrefix:"`",fieldSuffix:"`",tablePrefix:"`",tableSuffix:"`"});break;case"PostgreSQL":this.setup({statement_separator:t,dateType:"timestamp",fieldPrefix:'"',fieldSuffix:'"'});break;case"Oracle":var n=i;this.setup({dateFormatMask:"dd-mmm-yyyy hh:MM:ss TT",statement_separator:t,ddlTemplate:n,dateType:"timestamp",charType:"varchar2",fieldPrefix:'"',fieldSuffix:'"'});break;case"SQLite":var n=s;this.setup({fieldPrefix:'"',fieldSuffix:'"',tablePrefix:'"',tableSuffix:'"',statement_separator:t,ddlTemplate:n,dateType:"DATE",charType:"TEXT",intType:"INTEGER",floatType:"REAL"})}return this},ddl_builder.prototype.populateDBTypes=function(){for(var e=0;e<this.definition.columns.length;e++)this.definition.columns[e].type=="charType"?this.definition.columns[e].db_type=this[this.definition.columns[e].type]+"("+this.definition.columns[e].length+")":this.definition.columns[e].db_type=this[this.definition.columns[e].type];this.definition.dateFormatMask=this.dateFormatMask},ddl_builder.prototype.populateWrappers=function(){this.definition.fieldPrefix=this.fieldPrefix,this.definition.fieldSuffix=this.fieldSuffix},ddl_builder.prototype.guessValueSeparator=function(t){var n=t.split("\n"),r=!1,i=0,s="";for(var o=0;o<n.length;o++)if(n[o].search(/[A-Z0-9_]/i)!=-1&&!r){var u=e.trim(n[o]).match(/([A-Z0-9_]+ ?)+([^A-Z0-9_]*)/gi);u.length==1&&(u=e.trim(n[o]).match(/([A-Z0-9_]+ ?)+?([^A-Z0-9_]*)/gi)),r=!0;for(var a=0;a<u.length;a++){var f=u[a].match(/[A-Z0-9_]+([^A-Z0-9_]*)$/i).pop();f.search(/^\s\s+$/)!=-1?f=new RegExp("\\s\\s+"):f.search(/^\t+$/)!=-1?f=new RegExp("\\t+"):f.search(/^\s+$/)!=-1?f=new RegExp("\\s+"):f=e.trim(f);if(f instanceof RegExp||f.length)if(s instanceof RegExp||!!s.length){if(s.toString()!=f.toString())return{status:!1,message:"Unable to find consistent column separator in header row"}}else s=f;else!(f instanceof RegExp)&&!(s instanceof RegExp)&&!s.length&&(s="\n")}s instanceof RegExp||s.length?i=e.trim(n[o]).split(s).length:i=1}else if(n[o].search(/[A-Z0-9_]/i)!=-1&&e.trim(n[o]).split(s).length!=i&&(s.toString()!=/\s\s+/.toString()||e.trim(n[o]).split(/\s+/).length!=i))return{status:!1,message:"Line "+o+' does not have the same number of columns as the header, based on separator "'+s+'".'};return{status:!0,separator:s,column_count:i}},ddl_builder.prototype.parse=function(t){if(!this.valueSeparator.length){var n=this.guessValueSeparator(t);if(!n.status)return"ERROR! "+n.message;this.column_count=n.column_count,this.valueSeparator=n.separator}var r=t.split("\n");for(var i=0;i<r.length;i++){var s=e.trim(r[i]).split(this.valueSeparator);if(e.trim(r[i]).length&&(s.length==this.column_count||this.valueSeparator.toString()==/\s\s+/.toString()&&(s=e.trim(r[i]).split(/\s+/)).length==this.column_count))if(!this.definition.columns.length)for(var o=0;o<s.length;o++){var u=e.trim(s[o]);u.length?this.definition.columns.push({name:u}):this.definition.columns.push(!1)}else{var a=[];for(var o=0;o<s.length;o++)if(this.definition.columns[o]!==!1){var u=e.trim(s[o]).replace(/'/g,"''");isNaN(u)||this.definition.columns[o].type=="dateType"||this.definition.columns[o].type=="charType"?this.definition.columns[o].type!="charType"&&!isNaN(Date.parse(u))?this.definition.columns[o].type="dateType":this.definition.columns[o].type="charType":this.definition.columns[o].type!="floatType"&&u%1!=0?this.definition.columns[o].type="floatType":this.definition.columns[o].type="intType";if(!this.definition.columns[o].length||u.length>this.definition.columns[o].length)this.definition.columns[o].length=u.length;a.push({v:u})}this.definition.data.push({r:a})}}return this.populateDBTypes(),this.populateWrappers(),this.render()},t.registerHelper("formatted_field",function(e){var r="",i=-1;for(var s=0;s<e.columns.length;s++){e.columns[s]&&i++;if(i==this.index){r=e.columns[s].type;break}}return!this.v.length||this.v.toUpperCase()=="NULL"?"NULL":r=="charType"?new t.SafeString("'"+this.v.replace(/'/g,"''")+"'"):r=="dateType"?new t.SafeString("'"+n(this.v,e.dateFormatMask)+"'"):this.v}),t.registerHelper("column_name_for_index",function(e){return e.columns[this.index].name}),ddl_builder.prototype.render=function(){return this.compiledTemplate(e.extend(this.definition,{separator:this.statement_separator}))},ddl_builder})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/ddl_builder/qunit/columnTypes.js b/src/main/webapp/javascripts_min/libs/ddl_builder/qunit/columnTypes.js new file mode 100644 index 0000000..7c6c11d --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/ddl_builder/qunit/columnTypes.js @@ -0,0 +1 @@ +define(["jQuery","QUnit","DDLBuilder/ddl_builder"],function(e,t,n){return function(r,i){var s=new n({ddlTemplate:"{{#each_with_index columns}}{{#if index}},{{/if}}{{db_type}}{{/each_with_index}}}"});t.equal(s.parse(e("#"+r).html()),i,"Column types")}})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/ddl_builder/qunit/fixture.html b/src/main/webapp/javascripts_min/libs/ddl_builder/qunit/fixture.html new file mode 100644 index 0000000..d2d5d40 --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/ddl_builder/qunit/fixture.html @@ -0,0 +1,106 @@ +<div id="ddlInputText"> + <span id="simplestFormattedCSV" types="int,int" valueSeparator="," headers="a,b" recordCount="1"> + a,b + 1,2 + </span> + <span id="twoColumnFixedWidth" types="int,varchar(5)" valueSeparator="/\s\s+/" headers="Period,Result" recordCount="13"> + Period Result + 1 Green + 1 Blue + 1 Blue + 1 Red + 1 Blue + 1 Blue + 1 Blue + 2 Green + 2 Green + 2 Green + 2 Blue + 2 Red + 2 Red + </span> + <span id="fixedWidthDates" types="datetime,datetime,int,int,varchar(7)" valueSeparator="/\s\s+/" headers="date_due,date_paid,amount_due,amount_paid,category_type" recordCount="4"> + date_due date_paid amount_due amount_paid category_type + 2012-08-12 2012-08-12 500 450 Income + 2012-08-13 2012-08-17 200 300 Expense + 2012-09-15 2012-09-13 300 300 Income + 2012-09-17 2012-09-16 100 100 Income + </span> + <span id="centeredPipes" types="varchar(1),int" valueSeparator="|" headers="L,N" recordCount="9"> + L | N + ------------------- + A | 1 + A | 3 + A | 5 + B | 5 + B | 7 + B | 9 + C | 1 + C | 2 + C | 3 + </span> + <span id="ASCII_bordered" types="int,int,datetime,int" valueSeparator="|" headers="IdPayment,Costs_IdCost,Date,Amount" recordCount="3"> + +-----------+--------------+----------+--------+ + | IdPayment | Costs_IdCost | Date | Amount | + +-----------+--------------+----------+--------+ + | 1 | 2 |2012/09/10| 1000 | + +-----------+--------------+----------+--------+ + | 2 | 2 |2012/09/20| 3000 | + +-----------+--------------+----------+--------+ + | 3 | 2 |2012/10/01| 5000 | + +-----------+--------------+----------+--------+ + </span> + <span id="fixedWidthWithSpaces" types="varchar(6),varchar(13)" valueSeparator="/\s\s+/" headers="Cul 1,Cul 2" recordCount="8"> + Cul 1 Cul 2 + ===================== + A10000 Test + A10001 Test 123 + A20000 Test 1 + A20001 Test 999 + A30000 Test 2 + A30002 Test 5555 + A40000 Test 3 + A40006 Test 84384848 + </span> + <span id="pipedColumns" types="varchar(8),int,numeric" valueSeparator="|" headers="Scoreband,TotalNoOfPeople,AvgScore" recordCount="4"> + Scoreband| TotalNoOfPeople | AvgScore + -------------------------------- + -5 to 0 | 2 | -2 + 0 to 5 | 3 | 2 + 5 to 10 | 2 | 8 + 10 to 15 | 3 | 13.3 + </span> + <span id="variableSpaceDelimited" types="varchar(3),varchar(4),varchar(5)" valueSeparator="/\s\s+/" headers="c1,c2,c3" recordCount="4"> + c1 c2 c3 + 1A2 cat black + 1G2 dog red + B11 frog green + 1G2 girl red + </span> + <span id="bracketHeaders" types="int,varchar(3),datetime" valueSeparator="/\s\s+/" headers="Serial Number,LID,Last Updated Date" recordCount="12"> +[Serial Number] [LID] [Last Updated Date] +-------------------------------------- +123456 AAA 2012-09-24 +123456 AAA 2012-09-23 +123456 AAA 2012-09-22 +123456 AAA 2012-09-21 +123456 BBB 2012-09-20 +123456 BBB 2012-09-19 +123456 AAA 2012-09-18 +123456 AAA 2012-09-17 +123456 AAA 2012-09-16 +234567 BBB 2012-09-24 +234567 BBB 2012-09-23 +234567 AAA 2012-09-22 + </span> + <span id="singleSpacedColumnNames" types="int,int,int,int,int" valueSeparator="/\s+/" headers="customdata,check,service,loc,value" recordCount="6"> +customdata check service loc value + 101 0 0 4 4 + 101 0 0 3 3 + 101 5 4 4 3 + 102 0 0 1 2 + 102 4 4 3 3 + 103 0 0 4 4 + </span> + +</div> diff --git a/src/main/webapp/javascripts_min/libs/ddl_builder/qunit/guessValueSeparators.js b/src/main/webapp/javascripts_min/libs/ddl_builder/qunit/guessValueSeparators.js new file mode 100644 index 0000000..c18954a --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/ddl_builder/qunit/guessValueSeparators.js @@ -0,0 +1 @@ +define(["jQuery","QUnit","DDLBuilder/ddl_builder"],function(e,t,n){return function(r,i){var s=new n,o=s.guessValueSeparator(e("#"+r).html());o.separator?t.equal(s.guessValueSeparator(e("#"+r).html()).separator.toString(),i.toString(),"Guessing Value Separators"):t.ok(!1,"Guessing value separators failed with message:"+o.message)}})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/ddl_builder/qunit/headerNames.js b/src/main/webapp/javascripts_min/libs/ddl_builder/qunit/headerNames.js new file mode 100644 index 0000000..44bca5e --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/ddl_builder/qunit/headerNames.js @@ -0,0 +1 @@ +define(["jQuery","QUnit","DDLBuilder/ddl_builder"],function(e,t,n){return function(r,i){var s=new n({ddlTemplate:"{{#each_with_index columns}}{{#if index}},{{/if}}{{name}}{{/each_with_index}}}"});t.equal(s.parse(e("#"+r).html()),i,"Finding header names")}})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/ddl_builder/qunit/main.js b/src/main/webapp/javascripts_min/libs/ddl_builder/qunit/main.js new file mode 100644 index 0000000..9e97a9d --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/ddl_builder/qunit/main.js @@ -0,0 +1 @@ +define(["jQuery","QUnit","text!./fixture.html","./columnTypes","./guessValueSeparators","./headerNames","./recordCount"],function(e,t,n,r,i,s,o){e("#qunit-fixture").append(n),e("#qunit-fixture #ddlInputText span").each(function(){var n=e(this);t.test("Parsing "+n.attr("id"),function(){r(n.attr("id"),n.attr("types")),i(n.attr("id"),n.attr("valueSeparator")),s(n.attr("id"),n.attr("headers")),o(n.attr("id"),n.attr("recordCount"))})})})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/ddl_builder/qunit/recordCount.js b/src/main/webapp/javascripts_min/libs/ddl_builder/qunit/recordCount.js new file mode 100644 index 0000000..8075b59 --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/ddl_builder/qunit/recordCount.js @@ -0,0 +1 @@ +define(["jQuery","QUnit","DDLBuilder/ddl_builder"],function(e,t,n){return function(r,i){var s=new n({ddlTemplate:"[{{#each_with_index data}}{{#if index}},{{/if}}}{{index}}{{/each_with_index}}}]"}),o=s.parse(e("#"+r).html()),u=!1;try{u=e.parseJSON(o)}catch(a){}u?t.equal(u.length,i,"Getting Record Count"):t.ok(!1,"Getting Record Count failed: Unable to parse result to JSON array ("+o+")")}})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/ddl_builder/templates/generic.sql b/src/main/webapp/javascripts_min/libs/ddl_builder/templates/generic.sql new file mode 100644 index 0000000..f7a4f5f --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/ddl_builder/templates/generic.sql @@ -0,0 +1,10 @@ +CREATE TABLE {{{tablePrefix}}}{{tableName}}{{{tableSuffix}}} + ({{#each_with_index columns}}{{#if index}}, {{/if}}{{{../fieldPrefix}}}{{name}}{{{../fieldSuffix}}} {{db_type}}{{/each_with_index}}) +{{separator}} + +INSERT INTO {{{tablePrefix}}}{{tableName}}{{{tableSuffix}}} + ({{#each_with_index columns}}{{#if index}}, {{/if}}{{{../fieldPrefix}}}{{name}}{{{../fieldSuffix}}}{{/each_with_index}}) +VALUES + {{#each_with_index data}}{{#if index}}, + {{/if}}({{#each_with_index r}}{{#if index}}, {{/if}}{{formatted_field ../..}}{{/each_with_index}}){{/each_with_index}} +{{separator}} diff --git a/src/main/webapp/javascripts_min/libs/ddl_builder/templates/oracle.sql b/src/main/webapp/javascripts_min/libs/ddl_builder/templates/oracle.sql new file mode 100644 index 0000000..8180cf0 --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/ddl_builder/templates/oracle.sql @@ -0,0 +1,9 @@ +CREATE TABLE {{{tablePrefix}}}{{tableName}}{{{tableSuffix}}} + ({{#each_with_index columns}}{{#if index}}, {{/if}}{{{../fieldPrefix}}}{{name}}{{{../fieldSuffix}}} {{db_type}}{{/each_with_index}}) +{{separator}} + +INSERT ALL {{#each_with_index data}} + INTO {{{../tablePrefix}}}{{../tableName}}{{{../tableSuffix}}} ({{#each_with_index r}}{{#if index}}, {{/if}}{{{../../fieldPrefix}}}{{column_name_for_index ../..}}{{{../../fieldSuffix}}}{{/each_with_index}}) + VALUES ({{#each_with_index r}}{{#if index}}, {{/if}}{{formatted_field ../..}}{{/each_with_index}}){{/each_with_index}} +SELECT * FROM dual +{{separator}}
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/ddl_builder/templates/sqlite.sql b/src/main/webapp/javascripts_min/libs/ddl_builder/templates/sqlite.sql new file mode 100644 index 0000000..4de3c7e --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/ddl_builder/templates/sqlite.sql @@ -0,0 +1,12 @@ +CREATE TABLE {{tablePrefix}}{{tableName}}{{tableSuffix}} + ({{#each_with_index columns}}{{#if index}}, {{/if}}{{{../fieldPrefix}}}{{name}}{{{../fieldSuffix}}} {{db_type}}{{/each_with_index}}) +{{separator}} + +{{#each_with_index data}} +INSERT INTO {{tablePrefix}}{{../tableName}}{{tableSuffix}} + ({{#each_with_index ../columns}}{{#if index}}, {{/if}}{{{../../fieldPrefix}}}{{name}}{{{../../fieldSuffix}}}{{/each_with_index}}) +VALUES + ({{#each_with_index r}}{{#if index}}, {{/if}}{{formatted_field ../..}}{{/each_with_index}}) +{{../separator}} + +{{/each_with_index}}
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/fiddleEditor.js b/src/main/webapp/javascripts_min/libs/fiddleEditor.js new file mode 100644 index 0000000..6a8c773 --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/fiddleEditor.js @@ -0,0 +1 @@ +define(["CodeMirror","MySQLCodeMirror"],function(e,t){var n=function(t,n,r){return this.codeMirrorSupported=!/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent),this.codeMirrorSupported?this.codeMirror=e.fromTextArea(document.getElementById(t),{mode:"mysql",extraKeys:{Tab:"indentMore"},lineNumbers:!0,onChange:function(){n.call(r)}}):(this.textArea=document.getElementById(t),$(this.textArea).on("change",function(){n.call(r)}),$(this.textArea).on("keyup",function(){n.call(r)}),$(this.textArea).attr("fullscreen",!1)),this};return n.prototype.getValue=function(){return this.codeMirrorSupported?this.codeMirror.getValue():this.textArea.value},n.prototype.setValue=function(e){this.codeMirrorSupported?this.codeMirror.setValue(e):(this.textArea.value=e,$(this.textArea).trigger("change"))},n.prototype.refresh=function(){this.codeMirrorSupported&&this.codeMirror.refresh()},n.prototype.somethingSelected=function(){return this.codeMirrorSupported?this.codeMirror.somethingSelected():!1},n.prototype.getSelection=function(){return this.codeMirrorSupported?this.codeMirror.getSelection():this.textArea.value},n.prototype.getScrollerElement=function(){return this.codeMirrorSupported?this.codeMirror.getScrollerElement():null},n.prototype.getGutterElement=function(){return this.codeMirrorSupported?this.codeMirror.getGutterElement():null},n.prototype.isFullscreen=function(){return this.codeMirrorSupported?$(this.codeMirror.getScrollerElement()).hasClass("CodeMirror-fullscreen"):$(this.textArea).attr("fullscreen")==1},n.prototype.setFullscreen=function(e){if(e){var t=$(window).height()-40;this.codeMirrorSupported?($(this.codeMirror.getScrollerElement()).addClass("CodeMirror-fullscreen").height(t),$(this.codeMirror.getGutterElement()).height(t)):($(this.textArea).addClass("fullscreen"),$(this.textArea).height(t),$(this.textArea).attr("fullscreen",e))}else this.codeMirrorSupported?($(this.codeMirror.getScrollerElement()).removeClass("CodeMirror-fullscreen"),$(this.codeMirror.getGutterElement()).css("height","auto"),$(this.codeMirror.getScrollerElement()).css("height","200px")):($(this.textArea).removeClass("fullscreen"),$(this.textArea).height(100),$(this.textArea).attr("fullscreen",e))},n})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/handlebars-1.0.0.beta.6.js b/src/main/webapp/javascripts_min/libs/handlebars-1.0.0.beta.6.js new file mode 100644 index 0000000..bd8326d --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/handlebars-1.0.0.beta.6.js @@ -0,0 +1 @@ +var Handlebars={};Handlebars.VERSION="1.0.beta.6",Handlebars.helpers={},Handlebars.partials={},Handlebars.registerHelper=function(e,t,n){n&&(t.not=n),this.helpers[e]=t},Handlebars.registerPartial=function(e,t){this.partials[e]=t},Handlebars.registerHelper("helperMissing",function(e){if(arguments.length===2)return undefined;throw new Error("Could not find property '"+e+"'")});var toString=Object.prototype.toString,functionType="[object Function]";Handlebars.registerHelper("blockHelperMissing",function(e,t){var n=t.inverse||function(){},r=t.fn,i="",s=toString.call(e);s===functionType&&(e=e.call(this));if(e===!0)return r(this);if(e===!1||e==null)return n(this);if(s==="[object Array]"){if(e.length>0)for(var o=0,u=e.length;o<u;o++)i+=r(e[o]);else i=n(this);return i}return r(e)}),Handlebars.registerHelper("each",function(e,t){var n=t.fn,r=t.inverse,i="";if(e&&e.length>0)for(var s=0,o=e.length;s<o;s++)i+=n(e[s]);else i=r(this);return i}),Handlebars.registerHelper("if",function(e,t){var n=toString.call(e);return n===functionType&&(e=e.call(this)),!e||Handlebars.Utils.isEmpty(e)?t.inverse(this):t.fn(this)}),Handlebars.registerHelper("unless",function(e,t){var n=t.fn,r=t.inverse;return t.fn=r,t.inverse=n,Handlebars.helpers["if"].call(this,e,t)}),Handlebars.registerHelper("with",function(e,t){return t.fn(e)}),Handlebars.registerHelper("log",function(e){Handlebars.log(e)});var handlebars=function(){var e={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,statements:6,simpleInverse:7,statement:8,openInverse:9,closeBlock:10,openBlock:11,mustache:12,partial:13,CONTENT:14,COMMENT:15,OPEN_BLOCK:16,inMustache:17,CLOSE:18,OPEN_INVERSE:19,OPEN_ENDBLOCK:20,path:21,OPEN:22,OPEN_UNESCAPED:23,OPEN_PARTIAL:24,params:25,hash:26,param:27,STRING:28,INTEGER:29,BOOLEAN:30,hashSegments:31,hashSegment:32,ID:33,EQUALS:34,pathSegments:35,SEP:36,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"OPEN_PARTIAL",28:"STRING",29:"INTEGER",30:"BOOLEAN",33:"ID",34:"EQUALS",36:"SEP"},productions_:[0,[3,2],[4,3],[4,1],[4,0],[6,1],[6,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[7,2],[17,3],[17,2],[17,2],[17,1],[25,2],[25,1],[27,1],[27,1],[27,1],[27,1],[26,1],[31,2],[31,1],[32,3],[32,3],[32,3],[32,3],[21,1],[35,3],[35,1]],performAction:function(t,n,r,i,s,o,u){var a=o.length-1;switch(s){case 1:return o[a-1];case 2:this.$=new i.ProgramNode(o[a-2],o[a]);break;case 3:this.$=new i.ProgramNode(o[a]);break;case 4:this.$=new i.ProgramNode([]);break;case 5:this.$=[o[a]];break;case 6:o[a-1].push(o[a]),this.$=o[a-1];break;case 7:this.$=new i.InverseNode(o[a-2],o[a-1],o[a]);break;case 8:this.$=new i.BlockNode(o[a-2],o[a-1],o[a]);break;case 9:this.$=o[a];break;case 10:this.$=o[a];break;case 11:this.$=new i.ContentNode(o[a]);break;case 12:this.$=new i.CommentNode(o[a]);break;case 13:this.$=new i.MustacheNode(o[a-1][0],o[a-1][1]);break;case 14:this.$=new i.MustacheNode(o[a-1][0],o[a-1][1]);break;case 15:this.$=o[a-1];break;case 16:this.$=new i.MustacheNode(o[a-1][0],o[a-1][1]);break;case 17:this.$=new i.MustacheNode(o[a-1][0],o[a-1][1],!0);break;case 18:this.$=new i.PartialNode(o[a-1]);break;case 19:this.$=new i.PartialNode(o[a-2],o[a-1]);break;case 20:break;case 21:this.$=[[o[a-2]].concat(o[a-1]),o[a]];break;case 22:this.$=[[o[a-1]].concat(o[a]),null];break;case 23:this.$=[[o[a-1]],o[a]];break;case 24:this.$=[[o[a]],null];break;case 25:o[a-1].push(o[a]),this.$=o[a-1];break;case 26:this.$=[o[a]];break;case 27:this.$=o[a];break;case 28:this.$=new i.StringNode(o[a]);break;case 29:this.$=new i.IntegerNode(o[a]);break;case 30:this.$=new i.BooleanNode(o[a]);break;case 31:this.$=new i.HashNode(o[a]);break;case 32:o[a-1].push(o[a]),this.$=o[a-1];break;case 33:this.$=[o[a]];break;case 34:this.$=[o[a-2],o[a]];break;case 35:this.$=[o[a-2],new i.StringNode(o[a])];break;case 36:this.$=[o[a-2],new i.IntegerNode(o[a])];break;case 37:this.$=[o[a-2],new i.BooleanNode(o[a])];break;case 38:this.$=new i.IdNode(o[a]);break;case 39:o[a-2].push(o[a]),this.$=o[a-2];break;case 40:this.$=[o[a]]}},table:[{3:1,4:2,5:[2,4],6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{1:[3]},{5:[1,16]},{5:[2,3],7:17,8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,19],20:[2,3],22:[1,13],23:[1,14],24:[1,15]},{5:[2,5],14:[2,5],15:[2,5],16:[2,5],19:[2,5],20:[2,5],22:[2,5],23:[2,5],24:[2,5]},{4:20,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{4:21,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{17:22,21:23,33:[1,25],35:24},{17:26,21:23,33:[1,25],35:24},{17:27,21:23,33:[1,25],35:24},{17:28,21:23,33:[1,25],35:24},{21:29,33:[1,25],35:24},{1:[2,1]},{6:30,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{5:[2,6],14:[2,6],15:[2,6],16:[2,6],19:[2,6],20:[2,6],22:[2,6],23:[2,6],24:[2,6]},{17:22,18:[1,31],21:23,33:[1,25],35:24},{10:32,20:[1,33]},{10:34,20:[1,33]},{18:[1,35]},{18:[2,24],21:40,25:36,26:37,27:38,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,38],28:[2,38],29:[2,38],30:[2,38],33:[2,38],36:[1,46]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],36:[2,40]},{18:[1,47]},{18:[1,48]},{18:[1,49]},{18:[1,50],21:51,33:[1,25],35:24},{5:[2,2],8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,2],22:[1,13],23:[1,14],24:[1,15]},{14:[2,20],15:[2,20],16:[2,20],19:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,7],14:[2,7],15:[2,7],16:[2,7],19:[2,7],20:[2,7],22:[2,7],23:[2,7],24:[2,7]},{21:52,33:[1,25],35:24},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{18:[2,22],21:40,26:53,27:54,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,23]},{18:[2,26],28:[2,26],29:[2,26],30:[2,26],33:[2,26]},{18:[2,31],32:55,33:[1,56]},{18:[2,27],28:[2,27],29:[2,27],30:[2,27],33:[2,27]},{18:[2,28],28:[2,28],29:[2,28],30:[2,28],33:[2,28]},{18:[2,29],28:[2,29],29:[2,29],30:[2,29],33:[2,29]},{18:[2,30],28:[2,30],29:[2,30],30:[2,30],33:[2,30]},{18:[2,33],33:[2,33]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],34:[1,57],36:[2,40]},{33:[1,58]},{14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,17],14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],24:[2,17]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]},{18:[1,59]},{18:[1,60]},{18:[2,21]},{18:[2,25],28:[2,25],29:[2,25],30:[2,25],33:[2,25]},{18:[2,32],33:[2,32]},{34:[1,57]},{21:61,28:[1,62],29:[1,63],30:[1,64],33:[1,25],35:24},{18:[2,39],28:[2,39],29:[2,39],30:[2,39],33:[2,39],36:[2,39]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{18:[2,34],33:[2,34]},{18:[2,35],33:[2,35]},{18:[2,36],33:[2,36]},{18:[2,37],33:[2,37]}],defaultActions:{16:[2,1],37:[2,23],53:[2,21]},parseError:function(t,n){throw new Error(t)},parse:function(t){function d(e){r.length=r.length-2*e,i.length=i.length-e,s.length=s.length-e}function v(){var e;return e=n.lexer.lex()||1,typeof e!="number"&&(e=n.symbols_[e]||e),e}var n=this,r=[0],i=[null],s=[],o=this.table,u="",a=0,f=0,l=0,c=2,h=1;this.lexer.setInput(t),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,typeof this.lexer.yylloc=="undefined"&&(this.lexer.yylloc={});var p=this.lexer.yylloc;s.push(p),typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);var m,g,y,b,w,E,S={},x,T,N,C;for(;;){y=r[r.length-1],this.defaultActions[y]?b=this.defaultActions[y]:(m==null&&(m=v()),b=o[y]&&o[y][m]);if(typeof b=="undefined"||!b.length||!b[0])if(!l){C=[];for(x in o[y])this.terminals_[x]&&x>2&&C.push("'"+this.terminals_[x]+"'");var k="";this.lexer.showPosition?k="Parse error on line "+(a+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+C.join(", ")+", got '"+this.terminals_[m]+"'":k="Parse error on line "+(a+1)+": Unexpected "+(m==1?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(k,{text:this.lexer.match,token:this.terminals_[m]||m,line:this.lexer.yylineno,loc:p,expected:C})}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+y+", token: "+m);switch(b[0]){case 1:r.push(m),i.push(this.lexer.yytext),s.push(this.lexer.yylloc),r.push(b[1]),m=null,g?(m=g,g=null):(f=this.lexer.yyleng,u=this.lexer.yytext,a=this.lexer.yylineno,p=this.lexer.yylloc,l>0&&l--);break;case 2:T=this.productions_[b[1]][1],S.$=i[i.length-T],S._$={first_line:s[s.length-(T||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(T||1)].first_column,last_column:s[s.length-1].last_column},E=this.performAction.call(S,u,f,a,this.yy,b[1],i,s);if(typeof E!="undefined")return E;T&&(r=r.slice(0,-1*T*2),i=i.slice(0,-1*T),s=s.slice(0,-1*T)),r.push(this.productions_[b[1]][0]),i.push(S.$),s.push(S._$),N=o[r[r.length-2]][r[r.length-1]],r.push(N);break;case 3:return!0}}return!0}},t=function(){var e={EOF:1,parseError:function(t,n){if(!this.yy.parseError)throw new Error(t);this.yy.parseError(t,n)},setInput:function(e){return this._input=e,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this},input:function(){var e=this._input[0];this.yytext+=e,this.yyleng++,this.match+=e,this.matched+=e;var t=e.match(/\n/);return t&&this.yylineno++,this._input=this._input.slice(1),e},unput:function(e){return this._input=e+this._input,this},more:function(){return this._more=!0,this},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=(new Array(e.length+1)).join("-");return e+this.upcomingInput()+"\n"+t+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var e,t,n,r;this._more||(this.yytext="",this.match="");var i=this._currentRules();for(var s=0;s<i.length;s++){t=this._input.match(this.rules[i[s]]);if(t){r=t[0].match(/\n.*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-1:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this._more=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],e=this.performAction.call(this,this.yy,this,i[s],this.conditionStack[this.conditionStack.length-1]);if(e)return e;return}}if(this._input==="")return this.EOF;this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return typeof t!="undefined"?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)}};return e.performAction=function(t,n,r,i){var s=i;switch(r){case 0:n.yytext.slice(-1)!=="\\"&&this.begin("mu"),n.yytext.slice(-1)==="\\"&&(n.yytext=n.yytext.substr(0,n.yyleng-1),this.begin("emu"));if(n.yytext)return 14;break;case 1:return 14;case 2:return this.popState(),14;case 3:return 24;case 4:return 16;case 5:return 20;case 6:return 19;case 7:return 19;case 8:return 23;case 9:return 23;case 10:return n.yytext=n.yytext.substr(3,n.yyleng-5),this.popState(),15;case 11:return 22;case 12:return 34;case 13:return 33;case 14:return 33;case 15:return 36;case 16:break;case 17:return this.popState(),18;case 18:return this.popState(),18;case 19:return n.yytext=n.yytext.substr(1,n.yyleng-2).replace(/\\"/g,'"'),28;case 20:return 30;case 21:return 30;case 22:return 29;case 23:return 33;case 24:return n.yytext=n.yytext.substr(1,n.yyleng-2),33;case 25:return"INVALID";case 26:return 5}},e.rules=[/^[^\x00]*?(?=(\{\{))/,/^[^\x00]+/,/^[^\x00]{2,}?(?=(\{\{))/,/^\{\{>/,/^\{\{#/,/^\{\{\//,/^\{\{\^/,/^\{\{\s*else\b/,/^\{\{\{/,/^\{\{&/,/^\{\{![\s\S]*?\}\}/,/^\{\{/,/^=/,/^\.(?=[} ])/,/^\.\./,/^[\/.]/,/^\s+/,/^\}\}\}/,/^\}\}/,/^"(\\["]|[^"])*"/,/^true(?=[}\s])/,/^false(?=[}\s])/,/^[0-9]+(?=[}\s])/,/^[a-zA-Z0-9_$-]+(?=[=}\s\/.])/,/^\[[^\]]*\]/,/^./,/^$/],e.conditions={mu:{rules:[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26],inclusive:!1},emu:{rules:[2],inclusive:!1},INITIAL:{rules:[0,1,26],inclusive:!0}},e}();return e.lexer=t,e}();typeof require!="undefined"&&typeof exports!="undefined"&&(exports.parser=handlebars,exports.parse=function(){return handlebars.parse.apply(handlebars,arguments)},exports.main=function(t){if(!t[1])throw new Error("Usage: "+t[0]+" FILE");if(typeof process!="undefined")var n=require("fs").readFileSync(require("path").join(process.cwd(),t[1]),"utf8");else var r=require("file").path(require("file").cwd()),n=r.join(t[1]).read({charset:"utf-8"});return exports.parser.parse(n)},typeof module!="undefined"&&require.main===module&&exports.main(typeof process!="undefined"?process.argv.slice(1):require("system").args)),Handlebars.Parser=handlebars,Handlebars.parse=function(e){return Handlebars.Parser.yy=Handlebars.AST,Handlebars.Parser.parse(e)},Handlebars.print=function(e){return(new Handlebars.PrintVisitor).accept(e)},Handlebars.logger={DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(e,t){}},Handlebars.log=function(e,t){Handlebars.logger.log(e,t)},function(){Handlebars.AST={},Handlebars.AST.ProgramNode=function(e,t){this.type="program",this.statements=e,t&&(this.inverse=new Handlebars.AST.ProgramNode(t))},Handlebars.AST.MustacheNode=function(e,t,n){this.type="mustache",this.id=e[0],this.params=e.slice(1),this.hash=t,this.escaped=!n},Handlebars.AST.PartialNode=function(e,t){this.type="partial",this.id=e,this.context=t};var e=function(e,t){if(e.original!==t.original)throw new Handlebars.Exception(e.original+" doesn't match "+t.original)};Handlebars.AST.BlockNode=function(t,n,r){e(t.id,r),this.type="block",this.mustache=t,this.program=n},Handlebars.AST.InverseNode=function(t,n,r){e(t.id,r),this.type="inverse",this.mustache=t,this.program=n},Handlebars.AST.ContentNode=function(e){this.type="content",this.string=e},Handlebars.AST.HashNode=function(e){this.type="hash",this.pairs=e},Handlebars.AST.IdNode=function(e){this.type="ID",this.original=e.join(".");var t=[],n=0;for(var r=0,i=e.length;r<i;r++){var s=e[r];s===".."?n++:s==="."||s==="this"?this.isScoped=!0:t.push(s)}this.parts=t,this.string=t.join("."),this.depth=n,this.isSimple=t.length===1&&n===0},Handlebars.AST.StringNode=function(e){this.type="STRING",this.string=e},Handlebars.AST.IntegerNode=function(e){this.type="INTEGER",this.integer=e},Handlebars.AST.BooleanNode=function(e){this.type="BOOLEAN",this.bool=e},Handlebars.AST.CommentNode=function(e){this.type="comment",this.comment=e}}(),Handlebars.Exception=function(e){var t=Error.prototype.constructor.apply(this,arguments);for(var n in t)t.hasOwnProperty(n)&&(this[n]=t[n]);this.message=t.message},Handlebars.Exception.prototype=new Error,Handlebars.SafeString=function(e){this.string=e},Handlebars.SafeString.prototype.toString=function(){return this.string.toString()},function(){var e={"<":"<",">":">",'"':""","'":"'","`":"`"},t=/&(?!\w+;)|[<>"'`]/g,n=/[&<>"'`]/,r=function(t){return e[t]||"&"};Handlebars.Utils={escapeExpression:function(e){return e instanceof Handlebars.SafeString?e.toString():e==null||e===!1?"":n.test(e)?e.replace(t,r):e},isEmpty:function(e){return typeof e=="undefined"?!0:e===null?!0:e===!1?!0:Object.prototype.toString.call(e)==="[object Array]"&&e.length===0?!0:!1}}}(),Handlebars.Compiler=function(){},Handlebars.JavaScriptCompiler=function(){},function(e,t){e.OPCODE_MAP={appendContent:1,getContext:2,lookupWithHelpers:3,lookup:4,append:5,invokeMustache:6,appendEscaped:7,pushString:8,truthyOrFallback:9,functionOrFallback:10,invokeProgram:11,invokePartial:12,push:13,assignToHash:15,pushStringParam:16},e.MULTI_PARAM_OPCODES={appendContent:1,getContext:1,lookupWithHelpers:2,lookup:1,invokeMustache:3,pushString:1,truthyOrFallback:1,functionOrFallback:1,invokeProgram:3,invokePartial:1,push:1,assignToHash:1,pushStringParam:1},e.DISASSEMBLE_MAP={};for(var n in e.OPCODE_MAP){var r=e.OPCODE_MAP[n];e.DISASSEMBLE_MAP[r]=n}e.multiParamSize=function(t){return e.MULTI_PARAM_OPCODES[e.DISASSEMBLE_MAP[t]]},e.prototype={compiler:e,disassemble:function(){var t=this.opcodes,n,r,i=[],s,o,u;for(var a=0,f=t.length;a<f;a++){n=t[a];if(n==="DECLARE")o=t[++a],u=t[++a],i.push("DECLARE "+o+" = "+u);else{s=e.DISASSEMBLE_MAP[n];var l=e.multiParamSize(n),c=[];for(var h=0;h<l;h++)r=t[++a],typeof r=="string"&&(r='"'+r.replace("\n","\\n")+'"'),c.push(r);s=s+" "+c.join(" "),i.push(s)}}return i.join("\n")},guid:0,compile:function(e,t){this.children=[],this.depths={list:[]},this.options=t;var n=this.options.knownHelpers;this.options.knownHelpers={helperMissing:!0,blockHelperMissing:!0,each:!0,"if":!0,unless:!0,"with":!0,log:!0};if(n)for(var r in n)this.options.knownHelpers[r]=n[r];return this.program(e)},accept:function(e){return this[e.type](e)},program:function(e){var t=e.statements,n;this.opcodes=[];for(var r=0,i=t.length;r<i;r++)n=t[r],this[n.type](n);return this.isSimple=i===1,this.depths.list=this.depths.list.sort(function(e,t){return e-t}),this},compileProgram:function(e){var t=(new this.compiler).compile(e,this.options),n=this.guid++;this.usePartial=this.usePartial||t.usePartial,this.children[n]=t;for(var r=0,i=t.depths.list.length;r<i;r++){depth=t.depths.list[r];if(depth<2)continue;this.addDepth(depth-1)}return n},block:function(e){var t=e.mustache,n,r,i,s,o=this.setupStackForMustache(t),u=this.compileProgram(e.program);e.program.inverse&&(s=this.compileProgram(e.program.inverse),this.declare("inverse",s)),this.opcode("invokeProgram",u,o.length,!!t.hash),this.declare("inverse",null),this.opcode("append")},inverse:function(e){var t=this.setupStackForMustache(e.mustache),n=this.compileProgram(e.program);this.declare("inverse",n),this.opcode("invokeProgram",null,t.length,!!e.mustache.hash),this.declare("inverse",null),this.opcode("append")},hash:function(e){var t=e.pairs,n,r;this.opcode("push","{}");for(var i=0,s=t.length;i<s;i++)n=t[i],r=n[1],this.accept(r),this.opcode("assignToHash",n[0])},partial:function(e){var t=e.id;this.usePartial=!0,e.context?this.ID(e.context):this.opcode("push","depth0"),this.opcode("invokePartial",t.original),this.opcode("append")},content:function(e){this.opcode("appendContent",e.string)},mustache:function(e){var t=this.setupStackForMustache(e);this.opcode("invokeMustache",t.length,e.id.original,!!e.hash),e.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},ID:function(e){this.addDepth(e.depth),this.opcode("getContext",e.depth),this.opcode("lookupWithHelpers",e.parts[0]||null,e.isScoped||!1);for(var t=1,n=e.parts.length;t<n;t++)this.opcode("lookup",e.parts[t])},STRING:function(e){this.opcode("pushString",e.string)},INTEGER:function(e){this.opcode("push",e.integer)},BOOLEAN:function(e){this.opcode("push",e.bool)},comment:function(){},pushParams:function(e){var t=e.length,n;while(t--)n=e[t],this.options.stringParams?(n.depth&&this.addDepth(n.depth),this.opcode("getContext",n.depth||0),this.opcode("pushStringParam",n.string)):this[n.type](n)},opcode:function(t,n,r,i){this.opcodes.push(e.OPCODE_MAP[t]),n!==undefined&&this.opcodes.push(n),r!==undefined&&this.opcodes.push(r),i!==undefined&&this.opcodes.push(i)},declare:function(e,t){this.opcodes.push("DECLARE"),this.opcodes.push(e),this.opcodes.push(t)},addDepth:function(e){if(e===0)return;this.depths[e]||(this.depths[e]=!0,this.depths.list.push(e))},setupStackForMustache:function(e){var t=e.params;return this.pushParams(t),e.hash&&this.hash(e.hash),this.ID(e.id),t}},t.prototype={nameLookup:function(e,n,r){return/^[0-9]+$/.test(n)?e+"["+n+"]":t.isValidJavaScriptVariableName(n)?e+"."+n:e+"['"+n+"']"},appendToBuffer:function(e){return this.environment.isSimple?"return "+e+";":"buffer += "+e+";"},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(e,t,n,r){this.environment=e,this.options=t||{},this.name=this.environment.name,this.isChild=!!n,this.context=n||{programs:[],aliases:{self:"this"},registers:{list:[]}},this.preamble(),this.stackSlot=0,this.stackVars=[],this.compileChildren(e,t);var i=e.opcodes,s;this.i=0;for(u=i.length;this.i<u;this.i++)s=this.nextOpcode(0),s[0]==="DECLARE"?(this.i=this.i+2,this[s[1]]=s[2]):(this.i=this.i+s[1].length,this[s[0]].apply(this,s[1]));return this.createFunctionContext(r)},nextOpcode:function(t){var n=this.environment.opcodes,r=n[this.i+t],i,s,o,u;if(r==="DECLARE")return i=n[this.i+1],s=n[this.i+2],["DECLARE",i,s];i=e.DISASSEMBLE_MAP[r],o=e.multiParamSize(r),u=[];for(var a=0;a<o;a++)u.push(n[this.i+a+1+t]);return[i,u]},eat:function(e){this.i=this.i+e.length},preamble:function(){var e=[];this.useRegister("foundHelper");if(!this.isChild){var t=this.namespace,n="helpers = helpers || "+t+".helpers;";this.environment.usePartial&&(n=n+" partials = partials || "+t+".partials;"),e.push(n)}else e.push("");this.environment.isSimple?e.push(""):e.push(", buffer = "+this.initializeBuffer()),this.lastContext=0,this.source=e},createFunctionContext:function(e){var t=this.stackVars;this.isChild||(t=t.concat(this.context.registers.list)),t.length>0&&(this.source[1]=this.source[1]+", "+t.join(", "));if(!this.isChild){var n=[];for(var r in this.context.aliases)this.source[1]=this.source[1]+", "+r+"="+this.context.aliases[r]}this.source[1]&&(this.source[1]="var "+this.source[1].substring(2)+";"),this.isChild||(this.source[1]+="\n"+this.context.programs.join("\n")+"\n"),this.environment.isSimple||this.source.push("return buffer;");var i=this.isChild?["depth0","data"]:["Handlebars","depth0","helpers","partials","data"];for(var s=0,o=this.environment.depths.list.length;s<o;s++)i.push("depth"+this.environment.depths.list[s]);if(e)return i.push(this.source.join("\n ")),Function.apply(this,i);var u="function "+(this.name||"")+"("+i.join(",")+") {\n "+this.source.join("\n ")+"}";return Handlebars.log(Handlebars.logger.DEBUG,u+"\n\n"),u},appendContent:function(e){this.source.push(this.appendToBuffer(this.quotedString(e)))},append:function(){var e=this.popStack();this.source.push("if("+e+" || "+e+" === 0) { "+this.appendToBuffer(e)+" }"),this.environment.isSimple&&this.source.push("else { "+this.appendToBuffer("''")+" }")},appendEscaped:function(){var e=this.nextOpcode(1),t="";this.context.aliases.escapeExpression="this.escapeExpression",e[0]==="appendContent"&&(t=" + "+this.quotedString(e[1][0]),this.eat(e)),this.source.push(this.appendToBuffer("escapeExpression("+this.popStack()+")"+t))},getContext:function(e){this.lastContext!==e&&(this.lastContext=e)},lookupWithHelpers:function(e,t){if(e){var n=this.nextStack();this.usingKnownHelper=!1;var r;!t&&this.options.knownHelpers[e]?(r=n+" = "+this.nameLookup("helpers",e,"helper"),this.usingKnownHelper=!0):t||this.options.knownHelpersOnly?r=n+" = "+this.nameLookup("depth"+this.lastContext,e,"context"):(this.register("foundHelper",this.nameLookup("helpers",e,"helper")),r=n+" = foundHelper || "+this.nameLookup("depth"+this.lastContext,e,"context")),r+=";",this.source.push(r)}else this.pushStack("depth"+this.lastContext)},lookup:function(e){var t=this.topStack();this.source.push(t+" = ("+t+" === null || "+t+" === undefined || "+t+" === false ? "+t+" : "+this.nameLookup(t,e,"context")+");")},pushStringParam:function(e){this.pushStack("depth"+this.lastContext),this.pushString(e)},pushString:function(e){this.pushStack(this.quotedString(e))},push:function(e){this.pushStack(e)},invokeMustache:function(e,t,n){this.populateParams(e,this.quotedString(t),"{}",null,n,function(e,t,n){this.usingKnownHelper||(this.context.aliases.helperMissing="helpers.helperMissing",this.context.aliases.undef="void 0",this.source.push("else if("+n+"=== undef) { "+e+" = helperMissing.call("+t+"); }"),e!==n&&this.source.push("else { "+e+" = "+n+"; }"))})},invokeProgram:function(e,t,n){var r=this.programExpression(this.inverse),i=this.programExpression(e);this.populateParams(t,null,i,r,n,function(e,t,n){this.usingKnownHelper||(this.context.aliases.blockHelperMissing="helpers.blockHelperMissing",this.source.push("else { "+e+" = blockHelperMissing.call("+t+"); }"))})},populateParams:function(e,t,n,r,i,s){var o=i||this.options.stringParams||r||this.options.data,u=this.popStack(),a,f=[],l,c,h;o?(this.register("tmp1",n),h="tmp1"):h="{ hash: {} }";if(o){var p=i?this.popStack():"{}";this.source.push("tmp1.hash = "+p+";")}this.options.stringParams&&this.source.push("tmp1.contexts = [];");for(var d=0;d<e;d++)l=this.popStack(),f.push(l),this.options.stringParams&&this.source.push("tmp1.contexts.push("+this.popStack()+");");r&&(this.source.push("tmp1.fn = tmp1;"),this.source.push("tmp1.inverse = "+r+";")),this.options.data&&this.source.push("tmp1.data = data;"),f.push(h),this.populateCall(f,u,t||u,s,n!=="{}")},populateCall:function(e,t,n,r,i){var s=["depth0"].concat(e).join(", "),o=["depth0"].concat(n).concat(e).join(", "),u=this.nextStack();if(this.usingKnownHelper)this.source.push(u+" = "+t+".call("+s+");");else{this.context.aliases.functionType='"function"';var a=i?"foundHelper && ":"";this.source.push("if("+a+"typeof "+t+" === functionType) { "+u+" = "+t+".call("+s+"); }")}r.call(this,u,o,t),this.usingKnownHelper=!1},invokePartial:function(e){params=[this.nameLookup("partials",e,"partial"),"'"+e+"'",this.popStack(),"helpers","partials"],this.options.data&¶ms.push("data"),this.pushStack("self.invokePartial("+params.join(", ")+");")},assignToHash:function(e){var t=this.popStack(),n=this.topStack();this.source.push(n+"['"+e+"'] = "+t+";")},compiler:t,compileChildren:function(e,t){var n=e.children,r,i;for(var s=0,o=n.length;s<o;s++){r=n[s],i=new this.compiler,this.context.programs.push("");var u=this.context.programs.length;r.index=u,r.name="program"+u,this.context.programs[u]=i.compile(r,t,this.context)}},programExpression:function(e){if(e==null)return"self.noop";var t=this.environment.children[e],n=t.depths.list,r=[t.index,t.name,"data"];for(var i=0,s=n.length;i<s;i++)depth=n[i],depth===1?r.push("depth0"):r.push("depth"+(depth-1));return n.length===0?"self.program("+r.join(", ")+")":(r.shift(),"self.programWithDepth("+r.join(", ")+")")},register:function(e,t){this.useRegister(e),this.source.push(e+" = "+t+";")},useRegister:function(e){this.context.registers[e]||(this.context.registers[e]=!0,this.context.registers.list.push(e))},pushStack:function(e){return this.source.push(this.nextStack()+" = "+e+";"),"stack"+this.stackSlot},nextStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),"stack"+this.stackSlot},popStack:function(){return"stack"+this.stackSlot--},topStack:function(){return"stack"+this.stackSlot},quotedString:function(e){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")+'"'}};var i="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "),s=t.RESERVED_WORDS={};for(var o=0,u=i.length;o<u;o++)s[i[o]]=!0;t.isValidJavaScriptVariableName=function(e){return!t.RESERVED_WORDS[e]&&/^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(e)?!0:!1}}(Handlebars.Compiler,Handlebars.JavaScriptCompiler),Handlebars.precompile=function(e,t){t=t||{};var n=Handlebars.parse(e),r=(new Handlebars.Compiler).compile(n,t);return(new Handlebars.JavaScriptCompiler).compile(r,t)},Handlebars.compile=function(e,t){function r(){var n=Handlebars.parse(e),r=(new Handlebars.Compiler).compile(n,t),i=(new Handlebars.JavaScriptCompiler).compile(r,t,undefined,!0);return Handlebars.template(i)}t=t||{};var n;return function(e,t){return n||(n=r()),n.call(this,e,t)}},Handlebars.VM={template:function(e){var t={escapeExpression:Handlebars.Utils.escapeExpression,invokePartial:Handlebars.VM.invokePartial,programs:[],program:function(e,t,n){var r=this.programs[e];return n?Handlebars.VM.program(t,n):r?r:(r=this.programs[e]=Handlebars.VM.program(t),r)},programWithDepth:Handlebars.VM.programWithDepth,noop:Handlebars.VM.noop};return function(n,r){return r=r||{},e.call(t,Handlebars,n,r.helpers,r.partials,r.data)}},programWithDepth:function(e,t,n){var r=Array.prototype.slice.call(arguments,2);return function(n,i){return i=i||{},e.apply(this,[n,i.data||t].concat(r))}},program:function(e,t){return function(n,r){return r=r||{},e(n,r.data||t)}},noop:function(){return""},invokePartial:function(e,t,n,r,i,s){options={helpers:r,partials:i,data:s};if(e===undefined)throw new Handlebars.Exception("The partial "+t+" could not be found");if(e instanceof Function)return e(n,options);if(!Handlebars.compile)throw new Handlebars.Exception("The partial "+t+" could not be compiled when running in runtime-only mode");return i[t]=Handlebars.compile(e),i[t](n,options)}},Handlebars.template=Handlebars.VM.template
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/handlebarsHelpers/divider_display.js b/src/main/webapp/javascripts_min/libs/handlebarsHelpers/divider_display.js new file mode 100644 index 0000000..219dd20 --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/handlebarsHelpers/divider_display.js @@ -0,0 +1 @@ +define(["Handlebars"],function(e){e.registerHelper("divider_display",function(e){var t=[];return t.length=e[this.index]+1,t.join("-")})})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/handlebarsHelpers/each_simple_value_with_index.js b/src/main/webapp/javascripts_min/libs/handlebarsHelpers/each_simple_value_with_index.js new file mode 100644 index 0000000..3b0c397 --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/handlebarsHelpers/each_simple_value_with_index.js @@ -0,0 +1 @@ +define(["Handlebars"],function(e){e.registerHelper("each_simple_value_with_index",function(e,t){var n="";k=0;for(var r=0,i=e.length;r<i;r++){var s={value:e[r]};s.index=k,s.first=k==0,s.last=k==e.length,n+=t(s),k++}return n})})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/handlebarsHelpers/each_with_index.js b/src/main/webapp/javascripts_min/libs/handlebarsHelpers/each_with_index.js new file mode 100644 index 0000000..39c76f6 --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/handlebarsHelpers/each_with_index.js @@ -0,0 +1 @@ +define(["Handlebars"],function(e){e.registerHelper("each_with_index",function(e,t){var n="",r=0;for(var i=0,s=e.length;i<s;i++)if(e[i]){var o=e[i];o.index=r,o.first=r==0,o.last=r==e.length,n+=t(o),r++}return n})})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/handlebarsHelpers/result_display.js b/src/main/webapp/javascripts_min/libs/handlebarsHelpers/result_display.js new file mode 100644 index 0000000..68219f2 --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/handlebarsHelpers/result_display.js @@ -0,0 +1 @@ +define(["jQuery","Handlebars"],function(e,t){t.registerHelper("result_display",function(n){var r=/\b((?:https?:\/\/|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?������]))/ig;return e.isPlainObject(n)?JSON.stringify(n):n==null?"(null)":n===!1?"false":typeof n=="string"&&n.match(r)&&t.Utils.escapeExpression(n)==n?new t.SafeString(n.replace(r,"<a href='$1' target='_new'>$1</a>")):n})})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/handlebarsHelpers/result_display_padded.js b/src/main/webapp/javascripts_min/libs/handlebarsHelpers/result_display_padded.js new file mode 100644 index 0000000..8ccfdc8 --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/handlebarsHelpers/result_display_padded.js @@ -0,0 +1 @@ +define(["Handlebars"],function(e){e.registerHelper("result_display_padded",function(e){var t=[];return t.length=e[this.index]-this.value.toString().length+1,t.join(" ")+this.value.toString()})})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/idselector.js b/src/main/webapp/javascripts_min/libs/idselector.js new file mode 100644 index 0000000..1359d9f --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/idselector.js @@ -0,0 +1 @@ +(function(){function e(){function t(e){window.console&&window.console.log("ID Selector: "+e)}function n(e){var t=e+"=",n=document.cookie.split(";");for(var r=0;r<n.length;r++){var i=n[r];while(i.charAt(0)==" ")i=i.substring(1,i.length);if(i.indexOf(t)==0)return decodeURIComponent(i.substring(t.length,i.length))}return null}function k(e,t){this.grid=e,this.idx=t;var n=this.td=y.createElement("td");o=n.style,o.fontWeight="bold",o.padding="4px",o.verticalAlign="middle",o.cursor="pointer";var r=this;n.onmouseover=function(){r.onMouseOver()},n.onmouseout=function(){r.onMouseOut()},n.onclick=function(){r.onClick()};var i=u[t],s=y.createElement("img");s.src=i?"https://www.idselector.com/static/opicons/"+i.icon:"https://www.idselector.com/images/openid.ico",s.style.width="16px",s.style.height="16px",s.style.verticalAlign="middle",n.appendChild(s),n.appendChild(y.createTextNode(" ")),n.appendChild(y.createTextNode(i?i.shortname:"Other OpenID")),this.selected=!1}function L(){this.table=y.createElement("table"),this.table.style.backgroundColor="#FFF",this.table.style.width="100%",this.table.style.border="1px solid #6e91af",this.tbody=y.createElement("tbody"),this.table.appendChild(this.tbody),this.maxOffset=(Math.ceil(u.length/12)-1)*12,this.cells=[];for(var e=0;e<u.length;e++)this.cells[e]=new k(this,e);this.rows=[y.createElement("tr"),y.createElement("tr"),y.createElement("tr"),y.createElement("tr")],this.otherCell=new k(this,-1);var t=y.createElement("td");t.style.padding="4px",t.style.textAlign="right",t.style.verticalAlign="middle",t.colSpan=2,t.innerHTML='<a href="http://openid.net/" style="color:#6e91af;" target="_blank">Help</a>';var n=y.createElement("tr");n.style.borderTop="1px solid #AAA",n.appendChild(this.otherCell.td),n.appendChild(t);for(var r=0;r<4;r++)this.tbody.appendChild(this.rows[r]);this.tbody.appendChild(n),this.offset=0}function O(){var t=window.ActiveXObject?e?document.body.scrollLeft:document.documentElement.scrollLeft:window.pageXOffset,n=e?document.body.clientWidth:document.documentElement.clientWidth,r=n+t-401,i=f.offsetLeft,s=f.offsetTop;if(f.clientTop)s+=f.clientTop;else if(document.defaultView&&document.defaultView.getComputedStyle){var o=document.defaultView.getComputedStyle(f,"");s+=parseInt(o.getPropertyValue("border-top-width")),s+=parseInt(o.getPropertyValue("border-bottom-width"))}var u=f.offsetParent;while(u){i+=u.offsetLeft,s+=u.offsetTop;if(u.clientLeft)i+=u.clientLeft,s+=u.clientTop;else if(document.defaultView&&document.defaultView.getComputedStyle){var o=document.defaultView.getComputedStyle(u,"");s+=parseInt(o.getPropertyValue("border-top-width")),i+=parseInt(o.getPropertyValue("border-left-width"))}u=u.offsetParent}s+=f.offsetHeight,i=Math.max(Math.min(i,r),0);var a=v.style;a.left=i+"px",a.top=s+"px",a.display="block",a.height=b.offsetHeight+2+"px";var l=document.body.parentNode}function M(){v.style.display="none"}function _(e){if(e.isTextEdit){var t=e.createTextRange();t&&(t.move("character",e.value.length),t.select())}}function D(){f.value=="Click to Sign In"&&(f.value="http://"),_(f),O()}function B(e,t,n){if(n){var r=new Date;r.setTime(r.getTime()+n*24*60*60*1e3);var i="; expires="+r.toGMTString()}else var i="";document.cookie=e+"="+encodeURIComponent(t)+i+"; path=/"}var e=document.compatMode!="CSS1Compat",r=n("__openid_selector_openid"),i=n("__openid_selector_op_id"),s=n("__openid_selector_uname"),o,u=[{shortname:"myOpenID",url_suffix:".myopenid.com/",openid1:!0,openid2:!0,id:8,icon:"myopenid.ico",url_prefix:"http://",website:"https://www.myopenid.com/",longname:"myOpenID",usercalled:"username"},{shortname:"claimID",url_suffix:"",openid1:!0,openid2:!1,id:4,icon:"claimid.ico",url_prefix:"http://claimid.com/",website:"http://claimid.com/",longname:"claimID",usercalled:"username"},{shortname:"Clickpass",url_suffix:"",openid1:!0,openid2:!0,id:5,icon:"clickpass.ico",url_prefix:"http://clickpass.com/public/",website:"http://www.clickpass.com/",longname:"Clickpass",usercalled:"username"},{shortname:"Wordpress",url_suffix:".wordpress.com/",openid1:!0,openid2:!1,id:14,icon:"wordpress.ico",url_prefix:"http://",website:"http://www.wordpress.com/",longname:"Wordpress",usercalled:"username"},{shortname:"Blogger",url_suffix:".blogspot.com/",openid1:!0,openid2:!1,id:2,icon:"blogger.ico",url_prefix:"http://",website:"http://www.blogger.com/",longname:"Google Blogger",usercalled:"blog name"},{shortname:"Livejournal",url_suffix:".livejournal.com/",openid1:!0,openid2:!1,id:7,icon:"lj.ico",url_prefix:"http://",website:"http://www.livejournal.com/",longname:"Livejournal",usercalled:"username"},{shortname:"Technorati",url_suffix:"",openid1:!0,openid2:!1,id:10,icon:"technorati.ico",url_prefix:"http://technorati.com/people/technorati/",website:"http://www.technorati.com/",longname:"Technorati",usercalled:"username"},{shortname:"Flickr",url_suffix:"",openid1:!1,openid2:!0,id:6,icon:"flickr.ico",url_prefix:"http://www.flickr.com/photos/",website:"http://www.flickr.com/",longname:"Flickr",usercalled:"username"},{shortname:"Identity.net",url_suffix:".identity.net/",openid1:!0,openid2:!0,id:23,icon:"identity.ico",url_prefix:"http://",website:"http://identity.net/",longname:"Identity.net",usercalled:"username"},{shortname:"Google",url_suffix:"",openid1:!1,openid2:!0,id:26,icon:"google.ico",url_prefix:"",website:"https://www.google.com/accounts/o8/id",longname:"Google",usercalled:"username"},{shortname:"Yahoo!",url_suffix:"",openid1:!1,openid2:!0,id:15,icon:"yahoo.ico",url_prefix:"http://me.yahoo.com/",website:"http://yahoo.com/",longname:"Yahoo!",usercalled:"yahoo id"},{shortname:"AOL",url_suffix:"",openid1:!0,openid2:!1,id:1,icon:"aol.ico",url_prefix:"http://openid.aol.com/",website:"http://www.aol.com/",longname:"America Online/AIM",usercalled:"screenname"}],a=window.idselector_input_id?window.idselector_input_id:"openid_identifier",f=document.getElementById(a);if(f==null){t("couldn't find openid input box with id = "+a);for(H=0;!f&&H<document.forms.length;H++)f=document.forms[H].openid_identifier;for(H=0;!f&&H<document.forms.length;H++)f=document.forms[H].openid_url}if(f==null){t("couldn't find openid input box");return}var l=f.value,c=document.createElement("img");o=c.style,o.width="16px",o.height="16px",o.verticalAlign="middle",o.padding="0px",o.border="0px",o.margin="0px",o.display="inline";var h=document.createElement("div");h.innerHTML='<button type="button"></button>';var p=document.createElement("img");p.src="https://www.idselector.com/images/arrow.gif",p.style.display="inline";var d=h.firstChild;h.removeChild(d),d.id="__idselector_button",d.style.cursor="pointer",d.appendChild(c),d.appendChild(document.createTextNode(" ")),d.appendChild(p);var v=document.createElement("iframe");v.frameBorder=0,v.scrolling="no",o=v.style,o.display="none",o.position="absolute",o.width="400px",o.height="0px",o.margin="0px",o.padding="0px",o.zIndex=1e4,o.border="0px";var m=f.parentNode,g=null;window.idselector_target_id&&(g=document.getElementById(window.idselector_target_id),g||t("couldn't find element with id "+window.idselector_target_id)),g?g.insertBefore(d,g.firstChild):(m.insertBefore(d,f.nextSibling),m.insertBefore(document.createTextNode(" "),d)),document.body.appendChild(v);var y=v.contentWindow.document;y.open(),y.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>ID Selector</title><style type="text/css">html{color:#000;background:#6e91af;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:\'\';}abbr,acronym {border:0;font-variant:normal;}sup {vertical-align:text-top;}sub {vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}body {border:1px solid #6e91af;font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}table {font-size:inherit;font:100%;}pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%;}</style></head><body></body></html>'),y.close();var b=y.body,w=y.createElement("img");w.style.verticalAlign="middle",w.style.cursor="pointer",w.src="https://www.idselector.com/images/arrow_white_back.png";var E=y.createElement("img");E.style.verticalAlign="middle",E.style.cursor="pointer",E.src="https://www.idselector.com/images/arrow_white_forward.png";var S=y.createElement("div");S.style[document.all?"styleFloat":"cssFloat"]="right",S.innerHTML='<a href="https://www.myopenid.com/signup?affiliate_id=21239" style="color:#fff;" target="_blank">Get an OpenID</a>';var x=y.createElement("div");o=x.style,o.fontWeight="bold",o.color="#fff",o.padding="2px 8px 2px 8px",x.appendChild(S),x.appendChild(y.createTextNode("Sign in with OpenID using"));var T=y.createElement("span");T.appendChild(y.createTextNode("xxx:"));var N=y.createElement("input");N.type="text",N.size=20,o=N.style,o.verticalAlign="middle",o.padding="2px 2px 2px 20px",o.backgroundRepeat="no-repeat",o.backgroundPosition="2px 2px";var C=y.createElement("div");o=C.style,o.color="#fff",o.padding="2px 8px 2px 8px",o.textAlign="right",o.position="relative",C.appendChild(T),C.appendChild(y.createTextNode(" ")),C.appendChild(N),_id=k.prototype={},_id.onMouseOver=function(){this.selected||(this.td.style.backgroundColor="#eee")},_id.onMouseOut=function(){this.selected||(this.td.style.backgroundColor="")},_id.onClick=function(){this.grid.select(this),provider=u[this.idx],this.idx==-1?(f.value="http://",f.focus()):provider.openid2&&!provider.openid1?(f.focus(),setTimeout(M,1)):(N.focus(),N.select())},_id.setSelected=function(e){this.td.style.backgroundColor=e?"#c6d9e8":"",this.selected=e},_id=L.prototype={},_id.forward=function(){this.offset=Math.min(this.offset+12,this.maxOffset),this.gen()},_id.back=function(){this.offset=Math.max(this.offset-12,0),this.gen()},_id.gen=function(){for(var e=0;e<4;e++){var t=this.rows[e];while(t.firstChild)t.removeChild(t.firstChild)}for(var e=0;e<12;e++){var t=this.rows[Math.floor(e/3)],n=this.cells[this.offset+e];n?t.appendChild(n.td):t.appendChild(y.createElement("td"))}E.style.visibility=this.offset==this.maxOffset?"hidden":"",w.style.visibility=this.offset==0?"hidden":"",v.style.height=b.offsetHeight+2+"px"},_id.select=function(e){this.curr&&this.curr.setSelected(!1),this.curr=e,e.setSelected(!0);if(e.idx>-1){var t=u[e.idx];if(t.openid2&&!t.openid1)T.style.visibility="hidden",N.style.visibility="hidden",f.value=t.website;else{T.style.visibility="",N.style.visibility="",T.removeChild(T.firstChild);var n=y.createTextNode(t.longname+" "+t.usercalled+":");T.appendChild(n),N.style.backgroundImage="url(https://www.idselector.com/static/opicons/"+t.icon+")",f.value=t.url_prefix+"username"+t.url_suffix,N.value="username"}c.src="https://www.idselector.com/static/opicons/"+t.icon}else T.style.visibility="hidden",N.style.visibility="hidden",c.src="https://www.idselector.com/images/openid.ico"},_id.setName=function(e){var t=u[this.curr.idx];f.value=t.url_prefix+e+t.url_suffix};var A=new L;A.gen(),b.appendChild(x),b.appendChild(A.table),b.appendChild(C),d.onclick=function(e){return v.style.display=="none"?O():M(),e&&(e.cancelBubble=!0),!1},d.onfocus=function(){d.blur()},E.onclick=function(){A.forward()},w.onclick=function(){A.back()},f.onkeypress=function(e){var t;window.event?t=window.event.keyCode:e.which&&(t=e.which),t!=13&&t!=9&&A.select(A.otherCell)},N.onkeydown=function(e){var t;v.contentWindow.event?t=v.contentWindow.event.keyCode:e.which&&(t=e.which),(t==13||t==9)&&setTimeout(function(){f.onfocus=D,f.focus(),setTimeout(M,1)},1)},N.onkeyup=function(){var e=this.value;e||(e="username",this.value=e,this.select()),A.setName(e)},oldOnResize=window.onresize,window.onresize=function(e){try{v.style.display=="block"&&O()}finally{oldOnResize&&oldOnResize(e)}},oldOnScroll=window.onscroll,window.onscroll=function(e){try{v.style.display=="block"&&O()}finally{oldOnScroll&&oldOnScroll(e)}};if(i){var P=null;for(var H=0;H<u.length;H++)u[H].id==i&&(P=A.cells[H]);P&&(A.select(P),N.value=s)}A.curr||A.select(A.otherCell),r?f.value=r:l.length==0&&(f.value="Click to Sign In"),f.onfocus=D;var j=null;m=f.parentNode;while(m&&m.nodeType==1){if(m.nodeName=="FORM"){j=m;break}m=m.parentNode}if(j){var F=j.onsubmit;j.onsubmit=function(e){try{B("__openid_selector_openid",f.value,365);if(A.curr.idx>-1){var t=u[A.curr.idx].id;B("__openid_selector_op_id",t,365),B("__openid_selector_uname",N.value,365)}else B("__openid_selector_op_id","",-1),B("__openid_selector_uname","",-1)}finally{if(F)return F(e)}}}window.ActiveXObject?document.body.parentNode.attachEvent("onclick",function(){window.event.srcElement!=f&&window.event.srcElement!=d&&M()}):document.body.parentNode.addEventListener("click",function(e){e.target!=f&&e.target!=d&&M()},!1)}var t=window.onload;window.onload=function(n){try{e()}finally{return t&&t(n)}}})()
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/jquery/jquery.blockUI.js b/src/main/webapp/javascripts_min/libs/jquery/jquery.blockUI.js new file mode 100644 index 0000000..fe38b99 --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/jquery/jquery.blockUI.js @@ -0,0 +1,15 @@ +/*! + * jQuery blockUI plugin + * Version 2.39 (23-MAY-2011) + * @requires jQuery v1.2.3 or later + * + * Examples at: http://malsup.com/jquery/block/ + * Copyright (c) 2007-2010 M. Alsup + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + * Thanks to Amir-Hossein Sobhi for some excellent contributions! + */ + +(function(e){function u(n,u){var f=n==window,c=u&&u.message!==undefined?u.message:undefined;u=e.extend({},e.blockUI.defaults,u||{}),u.overlayCSS=e.extend({},e.blockUI.defaults.overlayCSS,u.overlayCSS||{});var v=e.extend({},e.blockUI.defaults.css,u.css||{}),m=e.extend({},e.blockUI.defaults.themedCSS,u.themedCSS||{});c=c===undefined?u.message:c,f&&s&&a(window,{fadeOut:0});if(c&&typeof c!="string"&&(c.parentNode||c.jquery)){var g=c.jquery?c[0]:c,y={};e(n).data("blockUI.history",y),y.el=g,y.parent=g.parentNode,y.display=g.style.display,y.position=g.style.position,y.parent&&y.parent.removeChild(g)}e(n).data("blockUI.onUnblock",u.onUnblock);var b=u.baseZ,w=e.browser.msie||u.forceIframe?e('<iframe class="blockUI" style="z-index:'+b++ +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+u.iframeSrc+'"></iframe>'):e('<div class="blockUI" style="display:none"></div>'),E=u.theme?e('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+b++ +';display:none"></div>'):e('<div class="blockUI blockOverlay" style="z-index:'+b++ +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>'),S,x;u.theme&&f?x='<div class="blockUI '+u.blockMsgClass+' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(b+10)+';display:none;position:fixed">'+'<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(u.title||" ")+"</div>"+'<div class="ui-widget-content ui-dialog-content"></div>'+"</div>":u.theme?x='<div class="blockUI '+u.blockMsgClass+' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(b+10)+';display:none;position:absolute">'+'<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(u.title||" ")+"</div>"+'<div class="ui-widget-content ui-dialog-content"></div>'+"</div>":f?x='<div class="blockUI '+u.blockMsgClass+' blockPage" style="z-index:'+(b+10)+';display:none;position:fixed"></div>':x='<div class="blockUI '+u.blockMsgClass+' blockElement" style="z-index:'+(b+10)+';display:none;position:absolute"></div>',S=e(x),c&&(u.theme?(S.css(m),S.addClass("ui-widget-content")):S.css(v)),!u.theme&&(!u.applyPlatformOpacityRules||!e.browser.mozilla||!/Linux/.test(navigator.platform))&&E.css(u.overlayCSS),E.css("position",f?"fixed":"absolute"),(e.browser.msie||u.forceIframe)&&w.css("opacity",0);var T=[w,E,S],N=f?e("body"):e(n);e.each(T,function(){this.appendTo(N)}),u.theme&&u.draggable&&e.fn.draggable&&S.draggable({handle:".ui-dialog-titlebar",cancel:"li"});var C=r&&(!e.boxModel||e("object,embed",f?null:n).length>0);if(i||C){f&&u.allowBodyStretch&&e.boxModel&&e("html,body").css("height","100%");if((i||!e.boxModel)&&!f)var k=d(n,"borderTopWidth"),L=d(n,"borderLeftWidth"),A=k?"(0 - "+k+")":0,O=L?"(0 - "+L+")":0;e.each([w,E,S],function(e,t){var n=t[0].style;n.position="absolute";if(e<2)f?n.setExpression("height","Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:"+u.quirksmodeOffsetHack+') + "px"'):n.setExpression("height",'this.parentNode.offsetHeight + "px"'),f?n.setExpression("width",'jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'):n.setExpression("width",'this.parentNode.offsetWidth + "px"'),O&&n.setExpression("left",O),A&&n.setExpression("top",A);else if(u.centerY)f&&n.setExpression("top",'(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'),n.marginTop=0;else if(!u.centerY&&f){var r=u.css&&u.css.top?parseInt(u.css.top):0,i="((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "+r+') + "px"';n.setExpression("top",i)}})}c&&(u.theme?S.find(".ui-widget-content").append(c):S.append(c),(c.jquery||c.nodeType)&&e(c).show()),(e.browser.msie||u.forceIframe)&&u.showOverlay&&w.show();if(u.fadeIn){var M=u.onBlock?u.onBlock:t,_=u.showOverlay&&!c?M:t,D=c?M:t;u.showOverlay&&E._fadeIn(u.fadeIn,_),c&&S._fadeIn(u.fadeIn,D)}else u.showOverlay&&E.show(),c&&S.show(),u.onBlock&&u.onBlock();l(1,n,u),f?(s=S[0],o=e(":input:enabled:visible",s),u.focusInput&&setTimeout(h,20)):p(S[0],u.centerX,u.centerY);if(u.timeout){var P=setTimeout(function(){f?e.unblockUI(u):e(n).unblock(u)},u.timeout);e(n).data("blockUI.timeout",P)}}function a(t,n){var r=t==window,i=e(t),u=i.data("blockUI.history"),a=i.data("blockUI.timeout");a&&(clearTimeout(a),i.removeData("blockUI.timeout")),n=e.extend({},e.blockUI.defaults,n||{}),l(0,t,n),n.onUnblock===null&&(n.onUnblock=i.data("blockUI.onUnblock"),i.removeData("blockUI.onUnblock"));var c;r?c=e("body").children().filter(".blockUI").add("body > .blockUI"):c=e(".blockUI",t),r&&(s=o=null),n.fadeOut?(c.fadeOut(n.fadeOut),setTimeout(function(){f(c,u,n,t)},n.fadeOut)):f(c,u,n,t)}function f(t,n,r,i){t.each(function(e,t){this.parentNode&&this.parentNode.removeChild(this)}),n&&n.el&&(n.el.style.display=n.display,n.el.style.position=n.position,n.parent&&n.parent.appendChild(n.el),e(i).removeData("blockUI.history")),typeof r.onUnblock=="function"&&r.onUnblock(i,r)}function l(t,n,r){var i=n==window,o=e(n);if(!t&&(i&&!s||!i&&!o.data("blockUI.isBlocked")))return;i||o.data("blockUI.isBlocked",t);if(!r.bindEvents||t&&!r.showOverlay)return;var u="mousedown mouseup keydown keypress";t?e(document).bind(u,r,c):e(document).unbind(u,c)}function c(t){if(t.keyCode&&t.keyCode==9&&s&&t.data.constrainTabKey){var n=o,r=!t.shiftKey&&t.target===n[n.length-1],i=t.shiftKey&&t.target===n[0];if(r||i)return setTimeout(function(){h(i)},10),!1}var u=t.data;return e(t.target).parents("div."+u.blockMsgClass).length>0?!0:e(t.target).parents().children().filter("div.blockUI").length==0}function h(e){if(!o)return;var t=o[e===!0?o.length-1:0];t&&t.focus()}function p(e,t,n){var r=e.parentNode,i=e.style,s=(r.offsetWidth-e.offsetWidth)/2-d(r,"borderLeftWidth"),o=(r.offsetHeight-e.offsetHeight)/2-d(r,"borderTopWidth");t&&(i.left=s>0?s+"px":"0"),n&&(i.top=o>0?o+"px":"0")}function d(t,n){return parseInt(e.css(t,n))||0}if(/1\.(0|1|2)\.(0|1|2)/.test(e.fn.jquery)||/^1.1/.test(e.fn.jquery)){alert("blockUI requires jQuery v1.2.3 or later! You are using v"+e.fn.jquery);return}e.fn._fadeIn=e.fn.fadeIn;var t=function(){},n=document.documentMode||0,r=e.browser.msie&&(e.browser.version<8&&!n||n<8),i=e.browser.msie&&/MSIE 6.0/.test(navigator.userAgent)&&!n;e.blockUI=function(e){u(window,e)},e.unblockUI=function(e){a(window,e)},e.growlUI=function(t,n,r,i){var s=e('<div class="growlUI"></div>');t&&s.append("<h1>"+t+"</h1>"),n&&s.append("<h2>"+n+"</h2>"),r==undefined&&(r=3e3),e.blockUI({message:s,fadeIn:700,fadeOut:1e3,centerY:!1,timeout:r,showOverlay:!1,onUnblock:i,css:e.blockUI.defaults.growlCSS})},e.fn.block=function(t){return this.unblock({fadeOut:0}).each(function(){e.css(this,"position")=="static"&&(this.style.position="relative"),e.browser.msie&&(this.style.zoom=1),u(this,t)})},e.fn.unblock=function(e){return this.each(function(){a(this,e)})},e.blockUI.version=2.39,e.blockUI.defaults={message:"<h1>Please wait...</h1>",title:null,draggable:!0,theme:!1,css:{padding:0,margin:0,width:"30%",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"3px solid #aaa",backgroundColor:"#fff",cursor:"wait"},themedCSS:{width:"30%",top:"40%",left:"35%"},overlayCSS:{backgroundColor:"#000",opacity:.6,cursor:"wait"},growlCSS:{width:"350px",top:"10px",left:"",right:"10px",border:"none",padding:"5px",opacity:.6,cursor:"default",color:"#fff",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px","border-radius":"10px"},iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank",forceIframe:!1,baseZ:1e3,centerX:!0,centerY:!0,allowBodyStretch:!0,bindEvents:!0,constrainTabKey:!0,fadeIn:200,fadeOut:400,timeout:0,showOverlay:!0,focusInput:!0,applyPlatformOpacityRules:!0,onBlock:null,onUnblock:null,quirksmodeOffsetHack:4,blockMsgClass:"blockMsg"};var s=null,o=[]})(jQuery)
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/jquery/jquery.cookie.js b/src/main/webapp/javascripts_min/libs/jquery/jquery.cookie.js new file mode 100644 index 0000000..a7177f0 --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/jquery/jquery.cookie.js @@ -0,0 +1,11 @@ +/*! + * jQuery Cookie Plugin + * https://github.com/carhartl/jquery-cookie + * + * Copyright 2011, Klaus Hartl + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://www.opensource.org/licenses/mit-license.php + * http://www.opensource.org/licenses/GPL-2.0 + */ + +(function(e){e.cookie=function(t,n,r){if(arguments.length>1&&(!/Object/.test(Object.prototype.toString.call(n))||n===null||n===undefined)){r=e.extend({},r);if(n===null||n===undefined)r.expires=-1;if(typeof r.expires=="number"){var i=r.expires,s=r.expires=new Date;s.setDate(s.getDate()+i)}return n=String(n),document.cookie=[encodeURIComponent(t),"=",r.raw?n:encodeURIComponent(n),r.expires?"; expires="+r.expires.toUTCString():"",r.path?"; path="+r.path:"",r.domain?"; domain="+r.domain:"",r.secure?"; secure":""].join("")}r=n||{};var o=r.raw?function(e){return e}:decodeURIComponent,u=document.cookie.split("; ");for(var a=0,f;f=u[a]&&u[a].split("=");a++)if(o(f[0])===t)return o(f[1]||"");return null}})(jQuery)
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/jquery/jquery.js b/src/main/webapp/javascripts_min/libs/jquery/jquery.js new file mode 100644 index 0000000..d477b5b --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/jquery/jquery.js @@ -0,0 +1,24 @@ +/*! + * jQuery JavaScript Library v1.7.2 + * http://jquery.com/ + * + * Copyright 2011, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Wed Mar 21 12:46:34 2012 -0700 + */ + +/*! + * Sizzle CSS Selector Engine + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ + +(function(e,t){function u(e){var t=o[e]={},n,r;e=e.split(/\s+/);for(n=0,r=e.length;n<r;n++)t[e[n]]=!0;return t}function c(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(l,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:s.isNumeric(r)?+r:f.test(r)?s.parseJSON(r):r}catch(o){}s.data(e,n,r)}else r=t}return r}function h(e){for(var t in e){if(t==="data"&&s.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function p(e,t,n){var r=t+"defer",i=t+"queue",o=t+"mark",u=s._data(e,r);u&&(n==="queue"||!s._data(e,i))&&(n==="mark"||!s._data(e,o))&&setTimeout(function(){!s._data(e,i)&&!s._data(e,o)&&(s.removeData(e,r,!0),u.fire())},0)}function H(){return!1}function B(){return!0}function W(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function X(e,t,n){t=t||0;if(s.isFunction(t))return s.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return s.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=s.grep(e,function(e){return e.nodeType===1});if(q.test(t))return s.filter(t,r,!n);t=s.filter(t,r)}return s.grep(e,function(e,r){return s.inArray(e,t)>=0===n})}function V(e){var t=$.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function at(e,t){return s.nodeName(e,"table")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function ft(e,t){if(t.nodeType!==1||!s.hasData(e))return;var n,r,i,o=s._data(e),u=s._data(t,o),a=o.events;if(a){delete u.handle,u.events={};for(n in a)for(r=0,i=a[n].length;r<i;r++)s.event.add(t,n,a[n][r])}u.data&&(u.data=s.extend({},u.data))}function lt(e,t){var n;if(t.nodeType!==1)return;t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),n=t.nodeName.toLowerCase(),n==="object"?t.outerHTML=e.outerHTML:n!=="input"||e.type!=="checkbox"&&e.type!=="radio"?n==="option"?t.selected=e.defaultSelected:n==="input"||n==="textarea"?t.defaultValue=e.defaultValue:n==="script"&&t.text!==e.text&&(t.text=e.text):(e.checked&&(t.defaultChecked=t.checked=e.checked),t.value!==e.value&&(t.value=e.value)),t.removeAttribute(s.expando),t.removeAttribute("_submit_attached"),t.removeAttribute("_change_attached")}function ct(e){return typeof e.getElementsByTagName!="undefined"?e.getElementsByTagName("*"):typeof e.querySelectorAll!="undefined"?e.querySelectorAll("*"):[]}function ht(e){if(e.type==="checkbox"||e.type==="radio")e.defaultChecked=e.checked}function pt(e){var t=(e.nodeName||"").toLowerCase();t==="input"?ht(e):t!=="script"&&typeof e.getElementsByTagName!="undefined"&&s.grep(e.getElementsByTagName("input"),ht)}function dt(e){var t=n.createElement("div");return ut.appendChild(t),t.innerHTML=e.outerHTML,t.firstChild}function kt(e,t,n){var r=t==="width"?e.offsetWidth:e.offsetHeight,i=t==="width"?1:0,o=4;if(r>0){if(n!=="border")for(;i<o;i+=2)n||(r-=parseFloat(s.css(e,"padding"+xt[i]))||0),n==="margin"?r+=parseFloat(s.css(e,n+xt[i]))||0:r-=parseFloat(s.css(e,"border"+xt[i]+"Width"))||0;return r+"px"}r=Tt(e,t);if(r<0||r==null)r=e.style[t];if(bt.test(r))return r;r=parseFloat(r)||0;if(n)for(;i<o;i+=2)r+=parseFloat(s.css(e,"padding"+xt[i]))||0,n!=="padding"&&(r+=parseFloat(s.css(e,"border"+xt[i]+"Width"))||0),n==="margin"&&(r+=parseFloat(s.css(e,n+xt[i]))||0);return r+"px"}function Qt(e){return function(t,n){typeof t!="string"&&(n=t,t="*");if(s.isFunction(n)){var r=t.toLowerCase().split(qt),i=0,o=r.length,u,a,f;for(;i<o;i++)u=r[i],f=/^\+/.test(u),f&&(u=u.substr(1)||"*"),a=e[u]=e[u]||[],a[f?"unshift":"push"](n)}}}function Gt(e,n,r,i,s,o){s=s||n.dataTypes[0],o=o||{},o[s]=!0;var u=e[s],a=0,f=u?u.length:0,l=e===Wt,c;for(;a<f&&(l||!c);a++)c=u[a](n,r,i),typeof c=="string"&&(!l||o[c]?c=t:(n.dataTypes.unshift(c),c=Gt(e,n,r,i,c,o)));return(l||!c)&&!o["*"]&&(c=Gt(e,n,r,i,"*",o)),c}function Yt(e,n){var r,i,o=s.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((o[r]?e:i||(i={}))[r]=n[r]);i&&s.extend(!0,e,i)}function Zt(e,t,n,r){if(s.isArray(t))s.each(t,function(t,i){n||At.test(e)?r(e,i):Zt(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&s.type(t)==="object")for(var i in t)Zt(e+"["+i+"]",t[i],n,r);else r(e,t)}function en(e,n,r){var i=e.contents,s=e.dataTypes,o=e.responseFields,u,a,f,l;for(a in o)a in r&&(n[o[a]]=r[a]);while(s[0]==="*")s.shift(),u===t&&(u=e.mimeType||n.getResponseHeader("content-type"));if(u)for(a in i)if(i[a]&&i[a].test(u)){s.unshift(a);break}if(s[0]in r)f=s[0];else{for(a in r){if(!s[0]||e.converters[a+" "+s[0]]){f=a;break}l||(l=a)}f=f||l}if(f)return f!==s[0]&&s.unshift(f),r[f]}function tn(e,n){e.dataFilter&&(n=e.dataFilter(n,e.dataType));var r=e.dataTypes,i={},o,u,a=r.length,f,l=r[0],c,h,p,d,v;for(o=1;o<a;o++){if(o===1)for(u in e.converters)typeof u=="string"&&(i[u.toLowerCase()]=e.converters[u]);c=l,l=r[o];if(l==="*")l=c;else if(c!=="*"&&c!==l){h=c+" "+l,p=i[h]||i["* "+l];if(!p){v=t;for(d in i){f=d.split(" ");if(f[0]===c||f[0]==="*"){v=i[f[1]+" "+l];if(v){d=i[d],d===!0?p=v:v===!0&&(p=d);break}}}}!p&&!v&&s.error("No conversion from "+h.replace(" "," to ")),p!==!0&&(n=p?p(n):v(d(n)))}}return n}function an(){try{return new e.XMLHttpRequest}catch(t){}}function fn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function yn(){return setTimeout(bn,0),gn=s.now()}function bn(){gn=t}function wn(e,t){var n={};return s.each(mn.concat.apply([],mn.slice(0,t)),function(){n[this]=e}),n}function En(e){if(!ln[e]){var t=n.body,r=s("<"+e+">").appendTo(t),i=r.css("display");r.remove();if(i==="none"||i===""){cn||(cn=n.createElement("iframe"),cn.frameBorder=cn.width=cn.height=0),t.appendChild(cn);if(!hn||!cn.createElement)hn=(cn.contentWindow||cn.contentDocument).document,hn.write((s.support.boxModel?"<!doctype html>":"")+"<html><body>"),hn.close();r=hn.createElement(e),hn.body.appendChild(r),i=s.css(r,"display"),t.removeChild(cn)}ln[e]=i}return ln[e]}function Nn(e){return s.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:!1}var n=e.document,r=e.navigator,i=e.location,s=function(){function H(){if(i.isReady)return;try{n.documentElement.doScroll("left")}catch(e){setTimeout(H,1);return}i.ready()}var i=function(e,t){return new i.fn.init(e,t,u)},s=e.jQuery,o=e.$,u,a=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,f=/\S/,l=/^\s+/,c=/\s+$/,h=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,p=/^[\],:{}\s]*$/,d=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,v=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,m=/(?:^|:|,)(?:\s*\[)+/g,g=/(webkit)[ \/]([\w.]+)/,y=/(opera)(?:.*version)?[ \/]([\w.]+)/,b=/(msie) ([\w.]+)/,w=/(mozilla)(?:.*? rv:([\w.]+))?/,E=/-([a-z]|[0-9])/ig,S=/^-ms-/,x=function(e,t){return(t+"").toUpperCase()},T=r.userAgent,N,C,k,L=Object.prototype.toString,A=Object.prototype.hasOwnProperty,O=Array.prototype.push,M=Array.prototype.slice,_=String.prototype.trim,D=Array.prototype.indexOf,P={};return i.fn=i.prototype={constructor:i,init:function(e,r,s){var o,u,f,l;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(e==="body"&&!r&&n.body)return this.context=n,this[0]=n.body,this.selector=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?o=[null,e,null]:o=a.exec(e);if(o&&(o[1]||!r)){if(o[1])return r=r instanceof i?r[0]:r,l=r?r.ownerDocument||r:n,f=h.exec(e),f?i.isPlainObject(r)?(e=[n.createElement(f[1])],i.fn.attr.call(e,r,!0)):e=[l.createElement(f[1])]:(f=i.buildFragment([o[1]],[l]),e=(f.cacheable?i.clone(f.fragment):f.fragment).childNodes),i.merge(this,e);u=n.getElementById(o[2]);if(u&&u.parentNode){if(u.id!==o[2])return s.find(e);this.length=1,this[0]=u}return this.context=n,this.selector=e,this}return!r||r.jquery?(r||s).find(e):this.constructor(r).find(e)}return i.isFunction(e)?s.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),i.makeArray(e,this))},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return M.call(this,0)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=this.constructor();return i.isArray(e)?O.apply(r,e):i.merge(r,e),r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return i.each(this,e,t)},ready:function(e){return i.bindReady(),C.add(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(M.apply(this,arguments),"slice",M.call(arguments).join(","))},map:function(e){return this.pushStack(i.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:O,sort:[].sort,splice:[].splice},i.fn.init.prototype=i.fn,i.extend=i.fn.extend=function(){var e,n,r,s,o,u,a=arguments[0]||{},f=1,l=arguments.length,c=!1;typeof a=="boolean"&&(c=a,a=arguments[1]||{},f=2),typeof a!="object"&&!i.isFunction(a)&&(a={}),l===f&&(a=this,--f);for(;f<l;f++)if((e=arguments[f])!=null)for(n in e){r=a[n],s=e[n];if(a===s)continue;c&&s&&(i.isPlainObject(s)||(o=i.isArray(s)))?(o?(o=!1,u=r&&i.isArray(r)?r:[]):u=r&&i.isPlainObject(r)?r:{},a[n]=i.extend(c,u,s)):s!==t&&(a[n]=s)}return a},i.extend({noConflict:function(t){return e.$===i&&(e.$=o),t&&e.jQuery===i&&(e.jQuery=s),i},isReady:!1,readyWait:1,holdReady:function(e){e?i.readyWait++:i.ready(!0)},ready:function(e){if(e===!0&&!--i.readyWait||e!==!0&&!i.isReady){if(!n.body)return setTimeout(i.ready,1);i.isReady=!0;if(e!==!0&&--i.readyWait>0)return;C.fireWith(n,[i]),i.fn.trigger&&i(n).trigger("ready").off("ready")}},bindReady:function(){if(C)return;C=i.Callbacks("once memory");if(n.readyState==="complete")return setTimeout(i.ready,1);if(n.addEventListener)n.addEventListener("DOMContentLoaded",k,!1),e.addEventListener("load",i.ready,!1);else if(n.attachEvent){n.attachEvent("onreadystatechange",k),e.attachEvent("onload",i.ready);var t=!1;try{t=e.frameElement==null}catch(r){}n.documentElement.doScroll&&t&&H()}},isFunction:function(e){return i.type(e)==="function"},isArray:Array.isArray||function(e){return i.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):P[L.call(e)]||"object"},isPlainObject:function(e){if(!e||i.type(e)!=="object"||e.nodeType||i.isWindow(e))return!1;try{if(e.constructor&&!A.call(e,"constructor")&&!A.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||A.call(e,r)},isEmptyObject:function(e){for(var t in e)return!1;return!0},error:function(e){throw new Error(e)},parseJSON:function(t){if(typeof t!="string"||!t)return null;t=i.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(p.test(t.replace(d,"@").replace(v,"]").replace(m,"")))return(new Function("return "+t))();i.error("Invalid JSON: "+t)},parseXML:function(n){if(typeof n!="string"||!n)return null;var r,s;try{e.DOMParser?(s=new DOMParser,r=s.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&i.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&f.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(S,"ms-").replace(E,x)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toUpperCase()===t.toUpperCase()},each:function(e,n,r){var s,o=0,u=e.length,a=u===t||i.isFunction(e);if(r){if(a){for(s in e)if(n.apply(e[s],r)===!1)break}else for(;o<u;)if(n.apply(e[o++],r)===!1)break}else if(a){for(s in e)if(n.call(e[s],s,e[s])===!1)break}else for(;o<u;)if(n.call(e[o],o,e[o++])===!1)break;return e},trim:_?function(e){return e==null?"":_.call(e)}:function(e){return e==null?"":e.toString().replace(l,"").replace(c,"")},makeArray:function(e,t){var n=t||[];if(e!=null){var r=i.type(e);e.length==null||r==="string"||r==="function"||r==="regexp"||i.isWindow(e)?O.call(n,e):i.merge(n,e)}return n},inArray:function(e,t,n){var r;if(t){if(D)return D.call(t,e,n);r=t.length,n=n?n<0?Math.max(0,r+n):n:0;for(;n<r;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=e.length,i=0;if(typeof n.length=="number")for(var s=n.length;i<s;i++)e[r++]=n[i];else while(n[i]!==t)e[r++]=n[i++];return e.length=r,e},grep:function(e,t,n){var r=[],i;n=!!n;for(var s=0,o=e.length;s<o;s++)i=!!t(e[s],s),n!==i&&r.push(e[s]);return r},map:function(e,n,r){var s,o,u=[],a=0,f=e.length,l=e instanceof i||f!==t&&typeof f=="number"&&(f>0&&e[0]&&e[f-1]||f===0||i.isArray(e));if(l)for(;a<f;a++)s=n(e[a],a,r),s!=null&&(u[u.length]=s);else for(o in e)s=n(e[o],o,r),s!=null&&(u[u.length]=s);return u.concat.apply([],u)},guid:1,proxy:function(e,n){if(typeof n=="string"){var r=e[n];n=e,e=r}if(!i.isFunction(e))return t;var s=M.call(arguments,2),o=function(){return e.apply(n,s.concat(M.call(arguments)))};return o.guid=e.guid=e.guid||o.guid||i.guid++,o},access:function(e,n,r,s,o,u,a){var f,l=r==null,c=0,h=e.length;if(r&&typeof r=="object"){for(c in r)i.access(e,n,c,r[c],1,u,s);o=1}else if(s!==t){f=a===t&&i.isFunction(s),l&&(f?(f=n,n=function(e,t,n){return f.call(i(e),n)}):(n.call(e,s),n=null));if(n)for(;c<h;c++)n(e[c],r,f?s.call(e[c],c,n(e[c],r)):s,a);o=1}return o?e:l?n.call(e):h?n(e[0],r):u},now:function(){return(new Date).getTime()},uaMatch:function(e){e=e.toLowerCase();var t=g.exec(e)||y.exec(e)||b.exec(e)||e.indexOf("compatible")<0&&w.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},sub:function(){function e(t,n){return new e.fn.init(t,n)}i.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(r,s){return s&&s instanceof i&&!(s instanceof e)&&(s=e(s)),i.fn.init.call(this,r,s,t)},e.fn.init.prototype=e.fn;var t=e(n);return e},browser:{}}),i.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){P["[object "+t+"]"]=t.toLowerCase()}),N=i.uaMatch(T),N.browser&&(i.browser[N.browser]=!0,i.browser.version=N.version),i.browser.webkit&&(i.browser.safari=!0),f.test(" ")&&(l=/^[\s\xA0]+/,c=/[\s\xA0]+$/),u=i(n),n.addEventListener?k=function(){n.removeEventListener("DOMContentLoaded",k,!1),i.ready()}:n.attachEvent&&(k=function(){n.readyState==="complete"&&(n.detachEvent("onreadystatechange",k),i.ready())}),i}(),o={};s.Callbacks=function(e){e=e?o[e]||u(e):{};var n=[],r=[],i,a,f,l,c,h,p=function(t){var r,i,o,u,a;for(r=0,i=t.length;r<i;r++)o=t[r],u=s.type(o),u==="array"?p(o):u==="function"&&(!e.unique||!v.has(o))&&n.push(o)},d=function(t,s){s=s||[],i=!e.memory||[t,s],a=!0,f=!0,h=l||0,l=0,c=n.length;for(;n&&h<c;h++)if(n[h].apply(t,s)===!1&&e.stopOnFalse){i=!0;break}f=!1,n&&(e.once?i===!0?v.disable():n=[]:r&&r.length&&(i=r.shift(),v.fireWith(i[0],i[1])))},v={add:function(){if(n){var e=n.length;p(arguments),f?c=n.length:i&&i!==!0&&(l=e,d(i[0],i[1]))}return this},remove:function(){if(n){var t=arguments,r=0,i=t.length;for(;r<i;r++)for(var s=0;s<n.length;s++)if(t[r]===n[s]){f&&s<=c&&(c--,s<=h&&h--),n.splice(s--,1);if(e.unique)break}}return this},has:function(e){if(n){var t=0,r=n.length;for(;t<r;t++)if(e===n[t])return!0}return!1},empty:function(){return n=[],this},disable:function(){return n=r=i=t,this},disabled:function(){return!n},lock:function(){return r=t,(!i||i===!0)&&v.disable(),this},locked:function(){return!r},fireWith:function(t,n){return r&&(f?e.once||r.push([t,n]):(!e.once||!i)&&d(t,n)),this},fire:function(){return v.fireWith(this,arguments),this},fired:function(){return!!a}};return v};var a=[].slice;s.extend({Deferred:function(e){var t=s.Callbacks("once memory"),n=s.Callbacks("once memory"),r=s.Callbacks("memory"),i="pending",o={resolve:t,reject:n,notify:r},u={done:t.add,fail:n.add,progress:r.add,state:function(){return i},isResolved:t.fired,isRejected:n.fired,then:function(e,t,n){return a.done(e).fail(t).progress(n),this},always:function(){return a.done.apply(a,arguments).fail.apply(a,arguments),this},pipe:function(e,t,n){return s.Deferred(function(r){s.each({done:[e,"resolve"],fail:[t,"reject"],progress:[n,"notify"]},function(e,t){var n=t[0],i=t[1],o;s.isFunction(n)?a[e](function(){o=n.apply(this,arguments),o&&s.isFunction(o.promise)?o.promise().then(r.resolve,r.reject,r.notify):r[i+"With"](this===a?r:this,[o])}):a[e](r[i])})}).promise()},promise:function(e){if(e==null)e=u;else for(var t in u)e[t]=u[t];return e}},a=u.promise({}),f;for(f in o)a[f]=o[f].fire,a[f+"With"]=o[f].fireWith;return a.done(function(){i="resolved"},n.disable,r.lock).fail(function(){i="rejected"},t.disable,r.lock),e&&e.call(a,a),a},when:function(e){function c(e){return function(n){t[e]=arguments.length>1?a.call(arguments,0):n,--o||f.resolveWith(f,t)}}function h(e){return function(t){i[e]=arguments.length>1?a.call(arguments,0):t,f.notifyWith(l,i)}}var t=a.call(arguments,0),n=0,r=t.length,i=new Array(r),o=r,u=r,f=r<=1&&e&&s.isFunction(e.promise)?e:s.Deferred(),l=f.promise();if(r>1){for(;n<r;n++)t[n]&&t[n].promise&&s.isFunction(t[n].promise)?t[n].promise().then(c(n),f.reject,h(n)):--o;o||f.resolveWith(f,t)}else f!==e&&f.resolveWith(f,r?[e]:[]);return l}}),s.support=function(){var t,r,i,o,u,a,f,l,c,h,p,d,v=n.createElement("div"),m=n.documentElement;v.setAttribute("className","t"),v.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",r=v.getElementsByTagName("*"),i=v.getElementsByTagName("a")[0];if(!r||!r.length||!i)return{};o=n.createElement("select"),u=o.appendChild(n.createElement("option")),a=v.getElementsByTagName("input")[0],t={leadingWhitespace:v.firstChild.nodeType===3,tbody:!v.getElementsByTagName("tbody").length,htmlSerialize:!!v.getElementsByTagName("link").length,style:/top/.test(i.getAttribute("style")),hrefNormalized:i.getAttribute("href")==="/a",opacity:/^0.55/.test(i.style.opacity),cssFloat:!!i.style.cssFloat,checkOn:a.value==="on",optSelected:u.selected,getSetAttribute:v.className!=="t",enctype:!!n.createElement("form").enctype,html5Clone:n.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},s.boxModel=t.boxModel=n.compatMode==="CSS1Compat",a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,o.disabled=!0,t.optDisabled=!u.disabled;try{delete v.test}catch(g){t.deleteExpando=!1}!v.addEventListener&&v.attachEvent&&v.fireEvent&&(v.attachEvent("onclick",function(){t.noCloneEvent=!1}),v.cloneNode(!0).fireEvent("onclick")),a=n.createElement("input"),a.value="t",a.setAttribute("type","radio"),t.radioValue=a.value==="t",a.setAttribute("checked","checked"),a.setAttribute("name","t"),v.appendChild(a),f=n.createDocumentFragment(),f.appendChild(v.lastChild),t.checkClone=f.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=a.checked,f.removeChild(a),f.appendChild(v);if(v.attachEvent)for(p in{submit:1,change:1,focusin:1})h="on"+p,d=h in v,d||(v.setAttribute(h,"return;"),d=typeof v[h]=="function"),t[p+"Bubbles"]=d;return f.removeChild(v),f=o=u=v=a=null,s(function(){var r,i,o,u,a,f,c,h,p,m,g,y,b,w=n.getElementsByTagName("body")[0];if(!w)return;h=1,b="padding:0;margin:0;border:",g="position:absolute;top:0;left:0;width:1px;height:1px;",y=b+"0;visibility:hidden;",p="style='"+g+b+"5px solid #000;",m="<div "+p+"display:block;'><div style='"+b+"0;display:block;overflow:hidden;'></div></div>"+"<table "+p+"' cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",r=n.createElement("div"),r.style.cssText=y+"width:0;height:0;position:static;top:0;margin-top:"+h+"px",w.insertBefore(r,w.firstChild),v=n.createElement("div"),r.appendChild(v),v.innerHTML="<table><tr><td style='"+b+"0;display:none'></td><td>t</td></tr></table>",l=v.getElementsByTagName("td"),d=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",t.reliableHiddenOffsets=d&&l[0].offsetHeight===0,e.getComputedStyle&&(v.innerHTML="",c=n.createElement("div"),c.style.width="0",c.style.marginRight="0",v.style.width="2px",v.appendChild(c),t.reliableMarginRight=(parseInt((e.getComputedStyle(c,null)||{marginRight:0}).marginRight,10)||0)===0),typeof v.style.zoom!="undefined"&&(v.innerHTML="",v.style.width=v.style.padding="1px",v.style.border=0,v.style.overflow="hidden",v.style.display="inline",v.style.zoom=1,t.inlineBlockNeedsLayout=v.offsetWidth===3,v.style.display="block",v.style.overflow="visible",v.innerHTML="<div style='width:5px;'></div>",t.shrinkWrapBlocks=v.offsetWidth!==3),v.style.cssText=g+y,v.innerHTML=m,i=v.firstChild,o=i.firstChild,a=i.nextSibling.firstChild.firstChild,f={doesNotAddBorder:o.offsetTop!==5,doesAddBorderForTableAndCells:a.offsetTop===5},o.style.position="fixed",o.style.top="20px",f.fixedPosition=o.offsetTop===20||o.offsetTop===15,o.style.position=o.style.top="",i.style.overflow="hidden",i.style.position="relative",f.subtractsBorderForOverflowNotVisible=o.offsetTop===-5,f.doesNotIncludeMarginInBodyOffset=w.offsetTop!==h,e.getComputedStyle&&(v.style.marginTop="1%",t.pixelMargin=(e.getComputedStyle(v,null)||{marginTop:0}).marginTop!=="1%"),typeof r.style.zoom!="undefined"&&(r.style.zoom=1),w.removeChild(r),c=v=r=null,s.extend(t,f)}),t}();var f=/^(?:\{.*\}|\[.*\])$/,l=/([A-Z])/g;s.extend({cache:{},uuid:0,expando:"jQuery"+(s.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?s.cache[e[s.expando]]:e[s.expando],!!e&&!h(e)},data:function(e,n,r,i){if(!s.acceptData(e))return;var o,u,a,f=s.expando,l=typeof n=="string",c=e.nodeType,h=c?s.cache:e,p=c?e[f]:e[f]&&f,d=n==="events";if((!p||!h[p]||!d&&!i&&!h[p].data)&&l&&r===t)return;p||(c?e[f]=p=++s.uuid:p=f),h[p]||(h[p]={},c||(h[p].toJSON=s.noop));if(typeof n=="object"||typeof n=="function")i?h[p]=s.extend(h[p],n):h[p].data=s.extend(h[p].data,n);return o=u=h[p],i||(u.data||(u.data={}),u=u.data),r!==t&&(u[s.camelCase(n)]=r),d&&!u[n]?o.events:(l?(a=u[n],a==null&&(a=u[s.camelCase(n)])):a=u,a)},removeData:function(e,t,n){if(!s.acceptData(e))return;var r,i,o,u=s.expando,a=e.nodeType,f=a?s.cache:e,l=a?e[u]:u;if(!f[l])return;if(t){r=n?f[l]:f[l].data;if(r){s.isArray(t)||(t in r?t=[t]:(t=s.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,o=t.length;i<o;i++)delete r[t[i]];if(!(n?h:s.isEmptyObject)(r))return}}if(!n){delete f[l].data;if(!h(f[l]))return}s.support.deleteExpando||!f.setInterval?delete f[l]:f[l]=null,a&&(s.support.deleteExpando?delete e[u]:e.removeAttribute?e.removeAttribute(u):e[u]=null)},_data:function(e,t,n){return s.data(e,t,n,!0)},acceptData:function(e){if(e.nodeName){var t=s.noData[e.nodeName.toLowerCase()];if(t)return t!==!0&&e.getAttribute("classid")===t}return!0}}),s.fn.extend({data:function(e,n){var r,i,o,u,a,f=this[0],l=0,h=null;if(e===t){if(this.length){h=s.data(f);if(f.nodeType===1&&!s._data(f,"parsedAttrs")){o=f.attributes;for(a=o.length;l<a;l++)u=o[l].name,u.indexOf("data-")===0&&(u=s.camelCase(u.substring(5)),c(f,u,h[u]));s._data(f,"parsedAttrs",!0)}}return h}return typeof e=="object"?this.each(function(){s.data(this,e)}):(r=e.split(".",2),r[1]=r[1]?"."+r[1]:"",i=r[1]+"!",s.access(this,function(n){if(n===t)return h=this.triggerHandler("getData"+i,[r[0]]),h===t&&f&&(h=s.data(f,e),h=c(f,e,h)),h===t&&r[1]?this.data(r[0]):h;r[1]=n,this.each(function(){var t=s(this);t.triggerHandler("setData"+i,r),s.data(this,e,n),t.triggerHandler("changeData"+i,r)})},null,n,arguments.length>1,null,!1))},removeData:function(e){return this.each(function(){s.removeData(this,e)})}}),s.extend({_mark:function(e,t){e&&(t=(t||"fx")+"mark",s._data(e,t,(s._data(e,t)||0)+1))},_unmark:function(e,t,n){e!==!0&&(n=t,t=e,e=!1);if(t){n=n||"fx";var r=n+"mark",i=e?0:(s._data(t,r)||1)-1;i?s._data(t,r,i):(s.removeData(t,r,!0),p(t,n,"mark"))}},queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=s._data(e,t),n&&(!r||s.isArray(n)?r=s._data(e,t,s.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=s.queue(e,t),r=n.shift(),i={};r==="inprogress"&&(r=n.shift()),r&&(t==="fx"&&n.unshift("inprogress"),s._data(e,t+".run",i),r.call(e,function(){s.dequeue(e,t)},i)),n.length||(s.removeData(e,t+"queue "+t+".run",!0),p(e,t,"queue"))}}),s.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length<r?s.queue(this[0],e):n===t?this:this.each(function(){var t=s.queue(this,e,n);e==="fx"&&t[0]!=="inprogress"&&s.dequeue(this,e)})},dequeue:function(e){return this.each(function(){s.dequeue(this,e)})},delay:function(e,t){return e=s.fx?s.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){function h(){--u||r.resolveWith(i,[i])}typeof e!="string"&&(n=e,e=t),e=e||"fx";var r=s.Deferred(),i=this,o=i.length,u=1,a=e+"defer",f=e+"queue",l=e+"mark",c;while(o--)if(c=s.data(i[o],a,t,!0)||(s.data(i[o],f,t,!0)||s.data(i[o],l,t,!0))&&s.data(i[o],a,s.Callbacks("once memory"),!0))u++,c.add(h);return h(),r.promise(n)}});var d=/[\n\t\r]/g,v=/\s+/,m=/\r/g,g=/^(?:button|input)$/i,y=/^(?:button|input|object|select|textarea)$/i,b=/^a(?:rea)?$/i,w=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,E=s.support.getSetAttribute,S,x,T;s.fn.extend({attr:function(e,t){return s.access(this,s.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){s.removeAttr(this,e)})},prop:function(e,t){return s.access(this,s.prop,e,t,arguments.length>1)},removeProp:function(e){return e=s.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,u,a;if(s.isFunction(e))return this.each(function(t){s(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(v);for(n=0,r=this.length;n<r;n++){i=this[n];if(i.nodeType===1)if(!i.className&&t.length===1)i.className=e;else{o=" "+i.className+" ";for(u=0,a=t.length;u<a;u++)~o.indexOf(" "+t[u]+" ")||(o+=t[u]+" ");i.className=s.trim(o)}}}return this},removeClass:function(e){var n,r,i,o,u,a,f;if(s.isFunction(e))return this.each(function(t){s(this).removeClass(e.call(this,t,this.className))});if(e&&typeof e=="string"||e===t){n=(e||"").split(v);for(r=0,i=this.length;r<i;r++){o=this[r];if(o.nodeType===1&&o.className)if(e){u=(" "+o.className+" ").replace(d," ");for(a=0,f=n.length;a<f;a++)u=u.replace(" "+n[a]+" "," ");o.className=s.trim(u)}else o.className=""}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return s.isFunction(e)?this.each(function(n){s(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,o=0,u=s(this),a=t,f=e.split(v);while(i=f[o++])a=r?a:!u.hasClass(i),u[a?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&s._data(this,"__className__",this.className),this.className=this.className||e===!1?"":s._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n<r;n++)if(this[n].nodeType===1&&(" "+this[n].className+" ").replace(d," ").indexOf(t)>-1)return!0;return!1},val:function(e){var n,r,i,o=this[0];if(!arguments.length){if(o)return n=s.valHooks[o.type]||s.valHooks[o.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(o,"value"))!==t?r:(r=o.value,typeof r=="string"?r.replace(m,""):r==null?"":r);return}return i=s.isFunction(e),this.each(function(r){var o=s(this),u;if(this.nodeType!==1)return;i?u=e.call(this,r,o.val()):u=e,u==null?u="":typeof u=="number"?u+="":s.isArray(u)&&(u=s.map(u,function(e){return e==null?"":e+""})),n=s.valHooks[this.type]||s.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,u,"value")===t)this.value=u})}}),s.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r,i,o=e.selectedIndex,u=[],a=e.options,f=e.type==="select-one";if(o<0)return null;n=f?o:0,r=f?o+1:a.length;for(;n<r;n++){i=a[n];if(i.selected&&(s.support.optDisabled?!i.disabled:i.getAttribute("disabled")===null)&&(!i.parentNode.disabled||!s.nodeName(i.parentNode,"optgroup"))){t=s(i).val();if(f)return t;u.push(t)}}return f&&!u.length&&a.length?s(a[o]).val():u},set:function(e,t){var n=s.makeArray(t);return s(e).find("option").each(function(){this.selected=s.inArray(s(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(e,n,r,i){var o,u,a,f=e.nodeType;if(!e||f===3||f===8||f===2)return;if(i&&n in s.attrFn)return s(e)[n](r);if(typeof e.getAttribute=="undefined")return s.prop(e,n,r);a=f!==1||!s.isXMLDoc(e),a&&(n=n.toLowerCase(),u=s.attrHooks[n]||(w.test(n)?x:S));if(r!==t){if(r===null){s.removeAttr(e,n);return}return u&&"set"in u&&a&&(o=u.set(e,r,n))!==t?o:(e.setAttribute(n,""+r),r)}return u&&"get"in u&&a&&(o=u.get(e,n))!==null?o:(o=e.getAttribute(n),o===null?t:o)},removeAttr:function(e,t){var n,r,i,o,u,a=0;if(t&&e.nodeType===1){r=t.toLowerCase().split(v),o=r.length;for(;a<o;a++)i=r[a],i&&(n=s.propFix[i]||i,u=w.test(i),u||s.attr(e,i,""),e.removeAttribute(E?i:n),u&&n in e&&(e[n]=!1))}},attrHooks:{type:{set:function(e,t){if(g.test(e.nodeName)&&e.parentNode)s.error("type property can't be changed");else if(!s.support.radioValue&&t==="radio"&&s.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}},value:{get:function(e,t){return S&&s.nodeName(e,"button")?S.get(e,t):t in e?e.value:null},set:function(e,t,n){if(S&&s.nodeName(e,"button"))return S.set(e,t,n);e.value=t}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;return u=a!==1||!s.isXMLDoc(e),u&&(n=s.propFix[n]||n,o=s.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&(i=o.get(e,n))!==null?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):y.test(e.nodeName)||b.test(e.nodeName)&&e.href?0:t}}}}),s.attrHooks.tabindex=s.propHooks.tabIndex,x={get:function(e,n){var r,i=s.prop(e,n);return i===!0||typeof i!="boolean"&&(r=e.getAttributeNode(n))&&r.nodeValue!==!1?n.toLowerCase():t},set:function(e,t,n){var r;return t===!1?s.removeAttr(e,n):(r=s.propFix[n]||n,r in e&&(e[r]=!0),e.setAttribute(n,n.toLowerCase())),n}},E||(T={name:!0,id:!0,coords:!0},S=s.valHooks.button={get:function(e,n){var r;return r=e.getAttributeNode(n),r&&(T[n]?r.nodeValue!=="":r.specified)?r.nodeValue:t},set:function(e,t,r){var i=e.getAttributeNode(r);return i||(i=n.createAttribute(r),e.setAttributeNode(i)),i.nodeValue=t+""}},s.attrHooks.tabindex.set=S.set,s.each(["width","height"],function(e,t){s.attrHooks[t]=s.extend(s.attrHooks[t],{set:function(e,n){if(n==="")return e.setAttribute(t,"auto"),n}})}),s.attrHooks.contenteditable={get:S.get,set:function(e,t,n){t===""&&(t="false"),S.set(e,t,n)}}),s.support.hrefNormalized||s.each(["href","src","width","height"],function(e,n){s.attrHooks[n]=s.extend(s.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return r===null?t:r}})}),s.support.style||(s.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||t},set:function(e,t){return e.style.cssText=""+t}}),s.support.optSelected||(s.propHooks.selected=s.extend(s.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),s.support.enctype||(s.propFix.enctype="encoding"),s.support.checkOn||s.each(["radio","checkbox"],function(){s.valHooks[this]={get:function(e){return e.getAttribute("value")===null?"on":e.value}}}),s.each(["radio","checkbox"],function(){s.valHooks[this]=s.extend(s.valHooks[this],{set:function(e,t){if(s.isArray(t))return e.checked=s.inArray(s(e).val(),t)>=0}})});var N=/^(?:textarea|input|select)$/i,C=/^([^\.]*)?(?:\.(.+))?$/,k=/(?:^|\s)hover(\.\S+)?\b/,L=/^key/,A=/^(?:mouse|contextmenu)|click/,O=/^(?:focusinfocus|focusoutblur)$/,M=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,_=function(e){var t=M.exec(e);return t&&(t[1]=(t[1]||"").toLowerCase(),t[3]=t[3]&&new RegExp("(?:^|\\s)"+t[3]+"(?:\\s|$)")),t},D=function(e,t){var n=e.attributes||{};return(!t[1]||e.nodeName.toLowerCase()===t[1])&&(!t[2]||(n.id||{}).value===t[2])&&(!t[3]||t[3].test((n["class"]||{}).value))},P=function(e){return s.event.special.hover?e:e.replace(k,"mouseenter$1 mouseleave$1")};s.event={add:function(e,n,r,i,o){var u,a,f,l,c,h,p,d,v,m,g,y;if(e.nodeType===3||e.nodeType===8||!n||!r||!(u=s._data(e)))return;r.handler&&(v=r,r=v.handler,o=v.selector),r.guid||(r.guid=s.guid++),f=u.events,f||(u.events=f={}),a=u.handle,a||(u.handle=a=function(e){return typeof s=="undefined"||!!e&&s.event.triggered===e.type?t:s.event.dispatch.apply(a.elem,arguments)},a.elem=e),n=s.trim(P(n)).split(" ");for(l=0;l<n.length;l++){c=C.exec(n[l])||[],h=c[1],p=(c[2]||"").split(".").sort(),y=s.event.special[h]||{},h=(o?y.delegateType:y.bindType)||h,y=s.event.special[h]||{},d=s.extend({type:h,origType:c[1],data:i,handler:r,guid:r.guid,selector:o,quick:o&&_(o),namespace:p.join(".")},v),g=f[h];if(!g){g=f[h]=[],g.delegateCount=0;if(!y.setup||y.setup.call(e,i,p,a)===!1)e.addEventListener?e.addEventListener(h,a,!1):e.attachEvent&&e.attachEvent("on"+h,a)}y.add&&(y.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),o?g.splice(g.delegateCount++,0,d):g.push(d),s.event.global[h]=!0}e=null},global:{},remove:function(e,t,n,r,i){var o=s.hasData(e)&&s._data(e),u,a,f,l,c,h,p,d,v,m,g,y;if(!o||!(d=o.events))return;t=s.trim(P(t||"")).split(" ");for(u=0;u<t.length;u++){a=C.exec(t[u])||[],f=l=a[1],c=a[2];if(!f){for(f in d)s.event.remove(e,f+t[u],n,r,!0);continue}v=s.event.special[f]||{},f=(r?v.delegateType:v.bindType)||f,g=d[f]||[],h=g.length,c=c?new RegExp("(^|\\.)"+c.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(p=0;p<g.length;p++)y=g[p],(i||l===y.origType)&&(!n||n.guid===y.guid)&&(!c||c.test(y.namespace))&&(!r||r===y.selector||r==="**"&&y.selector)&&(g.splice(p--,1),y.selector&&g.delegateCount--,v.remove&&v.remove.call(e,y));g.length===0&&h!==g.length&&((!v.teardown||v.teardown.call(e,c)===!1)&&s.removeEvent(e,f,o.handle),delete d[f])}s.isEmptyObject(d)&&(m=o.handle,m&&(m.elem=null),s.removeData(e,["events","handle"],!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(n,r,i,o){if(!i||i.nodeType!==3&&i.nodeType!==8){var u=n.type||n,a=[],f,l,c,h,p,d,v,m,g,y;if(O.test(u+s.event.triggered))return;u.indexOf("!")>=0&&(u=u.slice(0,-1),l=!0),u.indexOf(".")>=0&&(a=u.split("."),u=a.shift(),a.sort());if((!i||s.event.customEvent[u])&&!s.event.global[u])return;n=typeof n=="object"?n[s.expando]?n:new s.Event(u,n):new s.Event(u),n.type=u,n.isTrigger=!0,n.exclusive=l,n.namespace=a.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+a.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,d=u.indexOf(":")<0?"on"+u:"";if(!i){f=s.cache;for(c in f)f[c].events&&f[c].events[u]&&s.event.trigger(n,r,f[c].handle.elem,!0);return}n.result=t,n.target||(n.target=i),r=r!=null?s.makeArray(r):[],r.unshift(n),v=s.event.special[u]||{};if(v.trigger&&v.trigger.apply(i,r)===!1)return;g=[[i,v.bindType||u]];if(!o&&!v.noBubble&&!s.isWindow(i)){y=v.delegateType||u,h=O.test(y+u)?i:i.parentNode,p=null;for(;h;h=h.parentNode)g.push([h,y]),p=h;p&&p===i.ownerDocument&&g.push([p.defaultView||p.parentWindow||e,y])}for(c=0;c<g.length&&!n.isPropagationStopped();c++)h=g[c][0],n.type=g[c][1],m=(s._data(h,"events")||{})[n.type]&&s._data(h,"handle"),m&&m.apply(h,r),m=d&&h[d],m&&s.acceptData(h)&&m.apply(h,r)===!1&&n.preventDefault();return n.type=u,!o&&!n.isDefaultPrevented()&&(!v._default||v._default.apply(i.ownerDocument,r)===!1)&&(u!=="click"||!s.nodeName(i,"a"))&&s.acceptData(i)&&d&&i[u]&&(u!=="focus"&&u!=="blur"||n.target.offsetWidth!==0)&&!s.isWindow(i)&&(p=i[d],p&&(i[d]=null),s.event.triggered=u,i[u](),s.event.triggered=t,p&&(i[d]=p)),n.result}return},dispatch:function(n){n=s.event.fix(n||e.event);var r=(s._data(this,"events")||{})[n.type]||[],i=r.delegateCount,o=[].slice.call(arguments,0),u=!n.exclusive&&!n.namespace,a=s.event.special[n.type]||{},f=[],l,c,h,p,d,v,m,g,y,b,w;o[0]=n,n.delegateTarget=this;if(a.preDispatch&&a.preDispatch.call(this,n)===!1)return;if(i&&(!n.button||n.type!=="click")){p=s(this),p.context=this.ownerDocument||this;for(h=n.target;h!=this;h=h.parentNode||this)if(h.disabled!==!0){v={},g=[],p[0]=h;for(l=0;l<i;l++)y=r[l],b=y.selector,v[b]===t&&(v[b]=y.quick?D(h,y.quick):p.is(b)),v[b]&&g.push(y);g.length&&f.push({elem:h,matches:g})}}r.length>i&&f.push({elem:this,matches:r.slice(i)});for(l=0;l<f.length&&!n.isPropagationStopped();l++){m=f[l],n.currentTarget=m.elem;for(c=0;c<m.matches.length&&!n.isImmediatePropagationStopped();c++){y=m.matches[c];if(u||!n.namespace&&!y.namespace||n.namespace_re&&n.namespace_re.test(y.namespace))n.data=y.data,n.handleObj=y,d=((s.event.special[y.origType]||{}).handle||y.handler).apply(m.elem,o),d!==t&&(n.result=d,d===!1&&(n.preventDefault(),n.stopPropagation()))}}return a.postDispatch&&a.postDispatch.call(this,n),n.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return e.which==null&&(e.which=t.charCode!=null?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,r){var i,s,o,u=r.button,a=r.fromElement;return e.pageX==null&&r.clientX!=null&&(i=e.target.ownerDocument||n,s=i.documentElement,o=i.body,e.pageX=r.clientX+(s&&s.scrollLeft||o&&o.scrollLeft||0)-(s&&s.clientLeft||o&&o.clientLeft||0),e.pageY=r.clientY+(s&&s.scrollTop||o&&o.scrollTop||0)-(s&&s.clientTop||o&&o.clientTop||0)),!e.relatedTarget&&a&&(e.relatedTarget=a===e.target?r.toElement:a),!e.which&&u!==t&&(e.which=u&1?1:u&2?3:u&4?2:0),e}},fix:function(e){if(e[s.expando])return e;var r,i,o=e,u=s.event.fixHooks[e.type]||{},a=u.props?this.props.concat(u.props):this.props;e=s.Event(o);for(r=a.length;r;)i=a[--r],e[i]=o[i];return e.target||(e.target=o.srcElement||n),e.target.nodeType===3&&(e.target=e.target.parentNode),e.metaKey===t&&(e.metaKey=e.ctrlKey),u.filter?u.filter(e,o):e},special:{ready:{setup:s.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(e,t,n){s.isWindow(this)&&(this.onbeforeunload=n)},teardown:function(e,t){this.onbeforeunload===t&&(this.onbeforeunload=null)}}},simulate:function(e,t,n,r){var i=s.extend(new s.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?s.event.trigger(i,null,t):s.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},s.event.handle=s.event.dispatch,s.removeEvent=n.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){e.detachEvent&&e.detachEvent("on"+t,n)},s.Event=function(e,t){if(!(this instanceof s.Event))return new s.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?B:H):this.type=e,t&&s.extend(this,t),this.timeStamp=e&&e.timeStamp||s.now(),this[s.expando]=!0},s.Event.prototype={preventDefault:function(){this.isDefaultPrevented=B;var e=this.originalEvent;if(!e)return;e.preventDefault?e.preventDefault():e.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=B;var e=this.originalEvent;if(!e)return;e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=B,this.stopPropagation()},isDefaultPrevented:H,isPropagationStopped:H,isImmediatePropagationStopped:H},s.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){s.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n=this,r=e.relatedTarget,i=e.handleObj,o=i.selector,u;if(!r||r!==n&&!s.contains(n,r))e.type=i.origType,u=i.handler.apply(this,arguments),e.type=t;return u}}}),s.support.submitBubbles||(s.event.special.submit={setup:function(){if(s.nodeName(this,"form"))return!1;s.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=s.nodeName(n,"input")||s.nodeName(n,"button")?n.form:t;r&&!r._submit_attached&&(s.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),r._submit_attached=!0)})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&s.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){if(s.nodeName(this,"form"))return!1;s.event.remove(this,"._submit")}}),s.support.changeBubbles||(s.event.special.change={setup:function(){if(N.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")s.event.add(this,"propertychange._change",function(e){e.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),s.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1,s.event.simulate("change",this,e,!0))});return!1}s.event.add(this,"beforeactivate._change",function(e){var t=e.target;N.test(t.nodeName)&&!t._change_attached&&(s.event.add(t,"change._change",function(e){this.parentNode&&!e.isSimulated&&!e.isTrigger&&s.event.simulate("change",this.parentNode,e,!0)}),t._change_attached=!0)})},handle:function(e){var t=e.target;if(this!==t||e.isSimulated||e.isTrigger||t.type!=="radio"&&t.type!=="checkbox")return e.handleObj.handler.apply(this,arguments)},teardown:function(){return s.event.remove(this,"._change"),N.test(this.nodeName)}}),s.support.focusinBubbles||s.each({focus:"focusin",blur:"focusout"},function(e,t){var r=0,i=function(e){s.event.simulate(t,e.target,s.event.fix(e),!0)};s.event.special[t]={setup:function(){r++===0&&n.addEventListener(e,i,!0)},teardown:function(){--r===0&&n.removeEventListener(e,i,!0)}}}),s.fn.extend({on:function(e,n,r,i,o){var u,a;if(typeof e=="object"){typeof n!="string"&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}r==null&&i==null?(i=n,r=n=t):i==null&&(typeof n=="string"?(i=r,r=t):(i=r,r=n,n=t));if(i===!1)i=H;else if(!i)return this;return o===1&&(u=i,i=function(e){return s().off(e),u.apply(this,arguments)},i.guid=u.guid||(u.guid=s.guid++)),this.each(function(){s.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){if(e&&e.preventDefault&&e.handleObj){var i=e.handleObj;return s(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this}if(typeof e=="object"){for(var o in e)this.off(o,n,e[o]);return this}if(n===!1||typeof n=="function")r=n,n=t;return r===!1&&(r=H),this.each(function(){s.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},live:function(e,t,n){return s(this.context).on(e,this.selector,t,n),this},die:function(e,t){return s(this.context).off(e,this.selector||"**",t),this},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return arguments.length==1?this.off(e,"**"):this.off(t,e,n)},trigger:function(e,t){return this.each(function(){s.event.trigger(e,t,this)})},triggerHandler:function(e,t){if(this[0])return s.event.trigger(e,t,this[0],!0)},toggle:function(e){var t=arguments,n=e.guid||s.guid++,r=0,i=function(n){var i=(s._data(this,"lastToggle"+e.guid)||0)%r;return s._data(this,"lastToggle"+e.guid,i+1),n.preventDefault(),t[i].apply(this,arguments)||!1};i.guid=n;while(r<t.length)t[r++].guid=n;return this.click(i)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),s.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){s.fn[t]=function(e,n){return n==null&&(n=e,e=null),arguments.length>0?this.on(t,null,e,n):this.trigger(t)},s.attrFn&&(s.attrFn[t]=!0),L.test(t)&&(s.event.fixHooks[t]=s.event.keyHooks),A.test(t)&&(s.event.fixHooks[t]=s.event.mouseHooks)}),function(){function S(e,t,n,i,s,o){for(var u=0,a=i.length;u<a;u++){var f=i[u];if(f){var l=!1;f=f[e];while(f){if(f[r]===n){l=i[f.sizset];break}f.nodeType===1&&!o&&(f[r]=n,f.sizset=u);if(f.nodeName.toLowerCase()===t){l=f;break}f=f[e]}i[u]=l}}}function x(e,t,n,i,s,o){for(var u=0,a=i.length;u<a;u++){var f=i[u];if(f){var l=!1;f=f[e];while(f){if(f[r]===n){l=i[f.sizset];break}if(f.nodeType===1){o||(f[r]=n,f.sizset=u);if(typeof t!="string"){if(f===t){l=!0;break}}else if(h.filter(t,[f]).length>0){l=f;break}}f=f[e]}i[u]=l}}}var e=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,r="sizcache"+(Math.random()+"").replace(".",""),i=0,o=Object.prototype.toString,u=!1,a=!0,f=/\\/g,l=/\r\n/g,c=/\W/;[0,0].sort(function(){return a=!1,0});var h=function(t,r,i,s){i=i||[],r=r||n;var u=r;if(r.nodeType!==1&&r.nodeType!==9)return[];if(!t||typeof t!="string")return i;var a,f,l,c,p,m,g,b,w=!0,E=h.isXML(r),S=[],x=t;do{e.exec(""),a=e.exec(x);if(a){x=a[3],S.push(a[1]);if(a[2]){c=a[3];break}}}while(a);if(S.length>1&&v.exec(t))if(S.length===2&&d.relative[S[0]])f=T(S[0]+S[1],r,s);else{f=d.relative[S[0]]?[r]:h(S.shift(),r);while(S.length)t=S.shift(),d.relative[t]&&(t+=S.shift()),f=T(t,f,s)}else{!s&&S.length>1&&r.nodeType===9&&!E&&d.match.ID.test(S[0])&&!d.match.ID.test(S[S.length-1])&&(p=h.find(S.shift(),r,E),r=p.expr?h.filter(p.expr,p.set)[0]:p.set[0]);if(r){p=s?{expr:S.pop(),set:y(s)}:h.find(S.pop(),S.length!==1||S[0]!=="~"&&S[0]!=="+"||!r.parentNode?r:r.parentNode,E),f=p.expr?h.filter(p.expr,p.set):p.set,S.length>0?l=y(f):w=!1;while(S.length)m=S.pop(),g=m,d.relative[m]?g=S.pop():m="",g==null&&(g=r),d.relative[m](l,g,E)}else l=S=[]}l||(l=f),l||h.error(m||t);if(o.call(l)==="[object Array]")if(!w)i.push.apply(i,l);else if(r&&r.nodeType===1)for(b=0;l[b]!=null;b++)l[b]&&(l[b]===!0||l[b].nodeType===1&&h.contains(r,l[b]))&&i.push(f[b]);else for(b=0;l[b]!=null;b++)l[b]&&l[b].nodeType===1&&i.push(f[b]);else y(l,i);return c&&(h(c,u,i,s),h.uniqueSort(i)),i};h.uniqueSort=function(e){if(w){u=a,e.sort(w);if(u)for(var t=1;t<e.length;t++)e[t]===e[t-1]&&e.splice(t--,1)}return e},h.matches=function(e,t){return h(e,null,null,t)},h.matchesSelector=function(e,t){return h(t,null,null,[e]).length>0},h.find=function(e,t,n){var r,i,s,o,u,a;if(!e)return[];for(i=0,s=d.order.length;i<s;i++){u=d.order[i];if(o=d.leftMatch[u].exec(e)){a=o[1],o.splice(1,1);if(a.substr(a.length-1)!=="\\"){o[1]=(o[1]||"").replace(f,""),r=d.find[u](o,t,n);if(r!=null){e=e.replace(d.match[u],"");break}}}}return r||(r=typeof t.getElementsByTagName!="undefined"?t.getElementsByTagName("*"):[]),{set:r,expr:e}},h.filter=function(e,n,r,i){var s,o,u,a,f,l,c,p,v,m=e,g=[],y=n,b=n&&n[0]&&h.isXML(n[0]);while(e&&n.length){for(u in d.filter)if((s=d.leftMatch[u].exec(e))!=null&&s[2]){l=d.filter[u],c=s[1],o=!1,s.splice(1,1);if(c.substr(c.length-1)==="\\")continue;y===g&&(g=[]);if(d.preFilter[u]){s=d.preFilter[u](s,y,r,g,i,b);if(!s)o=a=!0;else if(s===!0)continue}if(s)for(p=0;(f=y[p])!=null;p++)f&&(a=l(f,s,p,y),v=i^a,r&&a!=null?v?o=!0:y[p]=!1:v&&(g.push(f),o=!0));if(a!==t){r||(y=g),e=e.replace(d.match[u],"");if(!o)return[];break}}if(e===m){if(o!=null)break;h.error(e)}m=e}return y},h.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)};var p=h.getText=function(e){var t,n,r=e.nodeType,i="";if(r){if(r===1||r===9||r===11){if(typeof e.textContent=="string")return e.textContent;if(typeof e.innerText=="string")return e.innerText.replace(l,"");for(e=e.firstChild;e;e=e.nextSibling)i+=p(e)}else if(r===3||r===4)return e.nodeValue}else for(t=0;n=e[t];t++)n.nodeType!==8&&(i+=p(n));return i},d=h.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")},type:function(e){return e.getAttribute("type")}},relative:{"+":function(e,t){var n=typeof t=="string",r=n&&!c.test(t),i=n&&!r;r&&(t=t.toLowerCase());for(var s=0,o=e.length,u;s<o;s++)if(u=e[s]){while((u=u.previousSibling)&&u.nodeType!==1);e[s]=i||u&&u.nodeName.toLowerCase()===t?u||!1:u===t}i&&h.filter(t,e,!0)},">":function(e,t){var n,r=typeof t=="string",i=0,s=e.length;if(r&&!c.test(t)){t=t.toLowerCase();for(;i<s;i++){n=e[i];if(n){var o=n.parentNode;e[i]=o.nodeName.toLowerCase()===t?o:!1}}}else{for(;i<s;i++)n=e[i],n&&(e[i]=r?n.parentNode:n.parentNode===t);r&&h.filter(t,e,!0)}},"":function(e,t,n){var r,s=i++,o=x;typeof t=="string"&&!c.test(t)&&(t=t.toLowerCase(),r=t,o=S),o("parentNode",t,s,e,r,n)},"~":function(e,t,n){var r,s=i++,o=x;typeof t=="string"&&!c.test(t)&&(t=t.toLowerCase(),r=t,o=S),o("previousSibling",t,s,e,r,n)}},find:{ID:function(e,t,n){if(typeof t.getElementById!="undefined"&&!n){var r=t.getElementById(e[1]);return r&&r.parentNode?[r]:[]}},NAME:function(e,t){if(typeof t.getElementsByName!="undefined"){var n=[],r=t.getElementsByName(e[1]);for(var i=0,s=r.length;i<s;i++)r[i].getAttribute("name")===e[1]&&n.push(r[i]);return n.length===0?null:n}},TAG:function(e,t){if(typeof t.getElementsByTagName!="undefined")return t.getElementsByTagName(e[1])}},preFilter:{CLASS:function(e,t,n,r,i,s){e=" "+e[1].replace(f,"")+" ";if(s)return e;for(var o=0,u;(u=t[o])!=null;o++)u&&(i^(u.className&&(" "+u.className+" ").replace(/[\t\n\r]/g," ").indexOf(e)>=0)?n||r.push(u):n&&(t[o]=!1));return!1},ID:function(e){return e[1].replace(f,"")},TAG:function(e,t){return e[1].replace(f,"").toLowerCase()},CHILD:function(e){if(e[1]==="nth"){e[2]||h.error(e[0]),e[2]=e[2].replace(/^\+|\s*/g,"");var t=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=t[1]+(t[2]||1)-0,e[3]=t[3]-0}else e[2]&&h.error(e[0]);return e[0]=i++,e},ATTR:function(e,t,n,r,i,s){var o=e[1]=e[1].replace(f,"");return!s&&d.attrMap[o]&&(e[1]=d.attrMap[o]),e[4]=(e[4]||e[5]||"").replace(f,""),e[2]==="~="&&(e[4]=" "+e[4]+" "),e},PSEUDO:function(t,n,r,i,s){if(t[1]==="not"){if(!((e.exec(t[3])||"").length>1||/^\w/.test(t[3]))){var o=h.filter(t[3],n,r,!0^s);return r||i.push.apply(i,o),!1}t[3]=h(t[3],null,null,n)}else if(d.match.POS.test(t[0])||d.match.CHILD.test(t[0]))return!0;return t},POS:function(e){return e.unshift(!0),e}},filters:{enabled:function(e){return e.disabled===!1&&e.type!=="hidden"},disabled:function(e){return e.disabled===!0},checked:function(e){return e.checked===!0},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!!e.firstChild},empty:function(e){return!e.firstChild},has:function(e,t,n){return!!h(n[3],e).length},header:function(e){return/h\d/i.test(e.nodeName)},text:function(e){var t=e.getAttribute("type"),n=e.type;return e.nodeName.toLowerCase()==="input"&&"text"===n&&(t===n||t===null)},radio:function(e){return e.nodeName.toLowerCase()==="input"&&"radio"===e.type},checkbox:function(e){return e.nodeName.toLowerCase()==="input"&&"checkbox"===e.type},file:function(e){return e.nodeName.toLowerCase()==="input"&&"file"===e.type},password:function(e){return e.nodeName.toLowerCase()==="input"&&"password"===e.type},submit:function(e){var t=e.nodeName.toLowerCase();return(t==="input"||t==="button")&&"submit"===e.type},image:function(e){return e.nodeName.toLowerCase()==="input"&&"image"===e.type},reset:function(e){var t=e.nodeName.toLowerCase();return(t==="input"||t==="button")&&"reset"===e.type},button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&"button"===e.type||t==="button"},input:function(e){return/input|select|textarea|button/i.test(e.nodeName)},focus:function(e){return e===e.ownerDocument.activeElement}},setFilters:{first:function(e,t){return t===0},last:function(e,t,n,r){return t===r.length-1},even:function(e,t){return t%2===0},odd:function(e,t){return t%2===1},lt:function(e,t,n){return t<n[3]-0},gt:function(e,t,n){return t>n[3]-0},nth:function(e,t,n){return n[3]-0===t},eq:function(e,t,n){return n[3]-0===t}},filter:{PSEUDO:function(e,t,n,r){var i=t[1],s=d.filters[i];if(s)return s(e,n,t,r);if(i==="contains")return(e.textContent||e.innerText||p([e])||"").indexOf(t[3])>=0;if(i==="not"){var o=t[3];for(var u=0,a=o.length;u<a;u++)if(o[u]===e)return!1;return!0}h.error(i)},CHILD:function(e,t){var n,i,s,o,u,a,f,l=t[1],c=e;switch(l){case"only":case"first":while(c=c.previousSibling)if(c.nodeType===1)return!1;if(l==="first")return!0;c=e;case"last":while(c=c.nextSibling)if(c.nodeType===1)return!1;return!0;case"nth":n=t[2],i=t[3];if(n===1&&i===0)return!0;s=t[0],o=e.parentNode;if(o&&(o[r]!==s||!e.nodeIndex)){a=0;for(c=o.firstChild;c;c=c.nextSibling)c.nodeType===1&&(c.nodeIndex=++a);o[r]=s}return f=e.nodeIndex-i,n===0?f===0:f%n===0&&f/n>=0}},ID:function(e,t){return e.nodeType===1&&e.getAttribute("id")===t},TAG:function(e,t){return t==="*"&&e.nodeType===1||!!e.nodeName&&e.nodeName.toLowerCase()===t},CLASS:function(e,t){return(" "+(e.className||e.getAttribute("class"))+" ").indexOf(t)>-1},ATTR:function(e,t){var n=t[1],r=h.attr?h.attr(e,n):d.attrHandle[n]?d.attrHandle[n](e):e[n]!=null?e[n]:e.getAttribute(n),i=r+"",s=t[2],o=t[4];return r==null?s==="!=":!s&&h.attr?r!=null:s==="="?i===o:s==="*="?i.indexOf(o)>=0:s==="~="?(" "+i+" ").indexOf(o)>=0:o?s==="!="?i!==o:s==="^="?i.indexOf(o)===0:s==="$="?i.substr(i.length-o.length)===o:s==="|="?i===o||i.substr(0,o.length+1)===o+"-":!1:i&&r!==!1},POS:function(e,t,n,r){var i=t[2],s=d.setFilters[i];if(s)return s(e,n,t,r)}}},v=d.match.POS,m=function(e,t){return"\\"+(t-0+1)};for(var g in d.match)d.match[g]=new RegExp(d.match[g].source+/(?![^\[]*\])(?![^\(]*\))/.source),d.leftMatch[g]=new RegExp(/(^(?:.|\r|\n)*?)/.source+d.match[g].source.replace(/\\(\d+)/g,m));d.match.globalPOS=v;var y=function(e,t){return e=Array.prototype.slice.call(e,0),t?(t.push.apply(t,e),t):e};try{Array.prototype.slice.call(n.documentElement.childNodes,0)[0].nodeType}catch(b){y=function(e,t){var n=0,r=t||[];if(o.call(e)==="[object Array]")Array.prototype.push.apply(r,e);else if(typeof e.length=="number")for(var i=e.length;n<i;n++)r.push(e[n]);else for(;e[n];n++)r.push(e[n]);return r}}var w,E;n.documentElement.compareDocumentPosition?w=function(e,t){return e===t?(u=!0,0):!e.compareDocumentPosition||!t.compareDocumentPosition?e.compareDocumentPosition?-1:1:e.compareDocumentPosition(t)&4?-1:1}:(w=function(e,t){if(e===t)return u=!0,0;if(e.sourceIndex&&t.sourceIndex)return e.sourceIndex-t.sourceIndex;var n,r,i=[],s=[],o=e.parentNode,a=t.parentNode,f=o;if(o===a)return E(e,t);if(!o)return-1;if(!a)return 1;while(f)i.unshift(f),f=f.parentNode;f=a;while(f)s.unshift(f),f=f.parentNode;n=i.length,r=s.length;for(var l=0;l<n&&l<r;l++)if(i[l]!==s[l])return E(i[l],s[l]);return l===n?E(e,s[l],-1):E(i[l],t,1)},E=function(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}),function(){var e=n.createElement("div"),r="script"+(new Date).getTime(),i=n.documentElement;e.innerHTML="<a name='"+r+"'/>",i.insertBefore(e,i.firstChild),n.getElementById(r)&&(d.find.ID=function(e,n,r){if(typeof n.getElementById!="undefined"&&!r){var i=n.getElementById(e[1]);return i?i.id===e[1]||typeof i.getAttributeNode!="undefined"&&i.getAttributeNode("id").nodeValue===e[1]?[i]:t:[]}},d.filter.ID=function(e,t){var n=typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id");return e.nodeType===1&&n&&n.nodeValue===t}),i.removeChild(e),i=e=null}(),function(){var e=n.createElement("div");e.appendChild(n.createComment("")),e.getElementsByTagName("*").length>0&&(d.find.TAG=function(e,t){var n=t.getElementsByTagName(e[1]);if(e[1]==="*"){var r=[];for(var i=0;n[i];i++)n[i].nodeType===1&&r.push(n[i]);n=r}return n}),e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!="undefined"&&e.firstChild.getAttribute("href")!=="#"&&(d.attrHandle.href=function(e){return e.getAttribute("href",2)}),e=null}(),n.querySelectorAll&&function(){var e=h,t=n.createElement("div"),r="__sizzle__";t.innerHTML="<p class='TEST'></p>";if(t.querySelectorAll&&t.querySelectorAll(".TEST").length===0)return;h=function(t,i,s,o){i=i||n;if(!o&&!h.isXML(i)){var u=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(t);if(u&&(i.nodeType===1||i.nodeType===9)){if(u[1])return y(i.getElementsByTagName(t),s);if(u[2]&&d.find.CLASS&&i.getElementsByClassName)return y(i.getElementsByClassName(u[2]),s)}if(i.nodeType===9){if(t==="body"&&i.body)return y([i.body],s);if(u&&u[3]){var a=i.getElementById(u[3]);if(!a||!a.parentNode)return y([],s);if(a.id===u[3])return y([a],s)}try{return y(i.querySelectorAll(t),s)}catch(f){}}else if(i.nodeType===1&&i.nodeName.toLowerCase()!=="object"){var l=i,c=i.getAttribute("id"),p=c||r,v=i.parentNode,m=/^\s*[+~]/.test(t);c?p=p.replace(/'/g,"\\$&"):i.setAttribute("id",p),m&&v&&(i=i.parentNode);try{if(!m||v)return y(i.querySelectorAll("[id='"+p+"'] "+t),s)}catch(g){}finally{c||l.removeAttribute("id")}}}return e(t,i,s,o)};for(var i in e)h[i]=e[i];t=null}(),function(){var e=n.documentElement,t=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.msMatchesSelector;if(t){var r=!t.call(n.createElement("div"),"div"),i=!1;try{t.call(n.documentElement,"[test!='']:sizzle")}catch(s){i=!0}h.matchesSelector=function(e,n){n=n.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!h.isXML(e))try{if(i||!d.match.PSEUDO.test(n)&&!/!=/.test(n)){var s=t.call(e,n);if(s||!r||e.document&&e.document.nodeType!==11)return s}}catch(o){}return h(n,null,null,[e]).length>0}}}(),function(){var e=n.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0)return;e.lastChild.className="e";if(e.getElementsByClassName("e").length===1)return;d.order.splice(1,0,"CLASS"),d.find.CLASS=function(e,t,n){if(typeof t.getElementsByClassName!="undefined"&&!n)return t.getElementsByClassName(e[1])},e=null}(),n.documentElement.contains?h.contains=function(e,t){return e!==t&&(e.contains?e.contains(t):!0)}:n.documentElement.compareDocumentPosition?h.contains=function(e,t){return!!(e.compareDocumentPosition(t)&16)}:h.contains=function(){return!1},h.isXML=function(e){var t=(e?e.ownerDocument||e:0).documentElement;return t?t.nodeName!=="HTML":!1};var T=function(e,t,n){var r,i=[],s="",o=t.nodeType?[t]:t;while(r=d.match.PSEUDO.exec(e))s+=r[0],e=e.replace(d.match.PSEUDO,"");e=d.relative[e]?e+"*":e;for(var u=0,a=o.length;u<a;u++)h(e,o[u],i,n);return h.filter(s,i)};h.attr=s.attr,h.selectors.attrMap={},s.find=h,s.expr=h.selectors,s.expr[":"]=s.expr.filters,s.unique=h.uniqueSort,s.text=h.getText,s.isXMLDoc=h.isXML,s.contains=h.contains}();var j=/Until$/,F=/^(?:parents|prevUntil|prevAll)/,I=/,/,q=/^.[^:#\[\.,]*$/,R=Array.prototype.slice,U=s.expr.match.globalPOS,z={children:!0,contents:!0,next:!0,prev:!0};s.fn.extend({find:function(e){var t=this,n,r;if(typeof e!="string")return s(e).filter(function(){for(n=0,r=t.length;n<r;n++)if(s.contains(t[n],this))return!0});var i=this.pushStack("","find",e),o,u,a;for(n=0,r=this.length;n<r;n++){o=i.length,s.find(e,this[n],i);if(n>0)for(u=o;u<i.length;u++)for(a=0;a<o;a++)if(i[a]===i[u]){i.splice(u--,1);break}}return i},has:function(e){var t=s(e);return this.filter(function(){for(var e=0,n=t.length;e<n;e++)if(s.contains(this,t[e]))return!0})},not:function(e){return this.pushStack(X(this,e,!1),"not",e)},filter:function(e){return this.pushStack(X(this,e,!0),"filter",e)},is:function(e){return!!e&&(typeof e=="string"?U.test(e)?s(e,this.context).index(this[0])>=0:s.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n=[],r,i,o=this[0];if(s.isArray(e)){var u=1;while(o&&o.ownerDocument&&o!==t){for(r=0;r<e.length;r++)s(o).is(e[r])&&n.push({selector:e[r],elem:o,level:u});o=o.parentNode,u++}return n}var a=U.test(e)||typeof e!="string"?s(e,t||this.context):0;for(r=0,i=this.length;r<i;r++){o=this[r];while(o){if(a?a.index(o)>-1:s.find.matchesSelector(o,e)){n.push(o);break}o=o.parentNode;if(!o||!o.ownerDocument||o===t||o.nodeType===11)break}}return n=n.length>1?s.unique(n):n,this.pushStack(n,"closest",e)},index:function(e){return e?typeof e=="string"?s.inArray(this[0],s(e)):s.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?s(e,t):s.makeArray(e&&e.nodeType?[e]:e),r=s.merge(this.get(),n);return this.pushStack(W(n[0])||W(r[0])?r:s.unique(r))},andSelf:function(){return this.add(this.prevObject)}}),s.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return s.dir(e,"parentNode")},parentsUntil:function(e,t,n){return s.dir(e,"parentNode",n)},next:function(e){return s.nth(e,2,"nextSibling")},prev:function(e){return s.nth(e,2,"previousSibling")},nextAll:function(e){return s.dir(e,"nextSibling")},prevAll:function(e){return s.dir(e,"previousSibling")},nextUntil:function(e,t,n){return s.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return s.dir(e,"previousSibling",n)},siblings:function(e){return s.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return s.sibling(e.firstChild)},contents:function(e){return s.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:s.makeArray(e.childNodes)}},function(e,t){s.fn[e]=function(n,r){var i=s.map(this,t,n);return j.test(e)||(r=n),r&&typeof r=="string"&&(i=s.filter(r,i)),i=this.length>1&&!z[e]?s.unique(i):i,(this.length>1||I.test(r))&&F.test(e)&&(i=i.reverse()),this.pushStack(i,e,R.call(arguments).join(","))}}),s.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?s.find.matchesSelector(t[0],e)?[t[0]]:[]:s.find.matches(e,t)},dir:function(e,n,r){var i=[],o=e[n];while(o&&o.nodeType!==9&&(r===t||o.nodeType!==1||!s(o).is(r)))o.nodeType===1&&i.push(o),o=o[n];return i},nth:function(e,t,n,r){t=t||1;var i=0;for(;e;e=e[n])if(e.nodeType===1&&++i===t)break;return e},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var $="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",J=/ jQuery\d+="(?:\d+|null)"/g,K=/^\s+/,Q=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,G=/<([\w:]+)/,Y=/<tbody/i,Z=/<|&#?\w+;/,et=/<(?:script|style)/i,tt=/<(?:script|object|embed|option|style)/i,nt=new RegExp("<(?:"+$+")[\\s/>]","i"),rt=/checked\s*(?:[^=]|=\s*.checked.)/i,it=/\/(java|ecma)script/i,st=/^\s*<!(?:\[CDATA\[|\-\-)/,ot={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},ut=V(n);ot.optgroup=ot.option,ot.tbody=ot.tfoot=ot.colgroup=ot.caption=ot.thead,ot.th=ot.td,s.support.htmlSerialize||(ot._default=[1,"div<div>","</div>"]),s.fn.extend({text:function(e){return s.access(this,function(e){return e===t?s.text(this):this.empty().append((this[0]&&this[0].ownerDocument||n).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(s.isFunction(e))return this.each(function(t){s(this).wrapAll(e.call(this,t))});if(this[0]){var t=s(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return s.isFunction(e)?this.each(function(t){s(this).wrapInner(e.call(this,t))}):this.each(function(){var t=s(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=s.isFunction(e);return this.each(function(n){s(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){s.nodeName(this,"body")||s(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){this.nodeType===1&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){this.nodeType===1&&this.insertBefore(e,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=s.clean(arguments);return e.push.apply(e,this.toArray()),this.pushStack(e,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=this.pushStack(this,"after",arguments);return e.push.apply(e,s.clean(arguments)),e}},remove:function(e,t){for(var n=0,r;(r=this[n])!=null;n++)if(!e||s.filter(e,[r]).length)!t&&r.nodeType===1&&(s.cleanData(r.getElementsByTagName("*")),s.cleanData([r])),r.parentNode&&r.parentNode.removeChild(r);return this},empty:function(){for(var e=0,t;(t=this[e])!=null;e++){t.nodeType===1&&s.cleanData(t.getElementsByTagName("*"));while(t.firstChild)t.removeChild(t.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return s.clone(this,e,t)})},html:function(e){return s.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(J,""):null;if(typeof e=="string"&&!et.test(e)&&(s.support.leadingWhitespace||!K.test(e))&&!ot[(G.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(Q,"<$1></$2>");try{for(;r<i;r++)n=this[r]||{},n.nodeType===1&&(s.cleanData(n.getElementsByTagName("*")),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){return this[0]&&this[0].parentNode?s.isFunction(e)?this.each(function(t){var n=s(this),r=n.html();n.replaceWith(e.call(this,t,r))}):(typeof e!="string"&&(e=s(e).detach()),this.each(function(){var t=this.nextSibling,n=this.parentNode;s(this).remove(),t?s(t).before(e):s(n).append(e)})):this.length?this.pushStack(s(s.isFunction(e)?e():e),"replaceWith",e):this},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){var i,o,u,a,f=e[0],l=[];if(!s.support.checkClone&&arguments.length===3&&typeof f=="string"&&rt.test(f))return this.each(function(){s(this).domManip(e,n,r,!0)});if(s.isFunction(f))return this.each(function(i){var o=s(this);e[0]=f.call(this,i,n?o.html():t),o.domManip(e,n,r)});if(this[0]){a=f&&f.parentNode,s.support.parentNode&&a&&a.nodeType===11&&a.childNodes.length===this.length?i={fragment:a}:i=s.buildFragment(e,this,l),u=i.fragment,u.childNodes.length===1?o=u=u.firstChild:o=u.firstChild;if(o){n=n&&s.nodeName(o,"tr");for(var c=0,h=this.length,p=h-1;c<h;c++)r.call(n?at(this[c],o):this[c],i.cacheable||h>1&&c<p?s.clone(u,!0,!0):u)}l.length&&s.each(l,function(e,t){t.src?s.ajax({type:"GET",global:!1,url:t.src,async:!1,dataType:"script"}):s.globalEval((t.text||t.textContent||t.innerHTML||"").replace(st,"/*$0*/")),t.parentNode&&t.parentNode.removeChild(t)})}return this}}),s.buildFragment=function(e,t,r){var i,o,u,a,f=e[0];return t&&t[0]&&(a=t[0].ownerDocument||t[0]),a.createDocumentFragment||(a=n),e.length===1&&typeof f=="string"&&f.length<512&&a===n&&f.charAt(0)==="<"&&!tt.test(f)&&(s.support.checkClone||!rt.test(f))&&(s.support.html5Clone||!nt.test(f))&&(o=!0,u=s.fragments[f],u&&u!==1&&(i=u)),i||(i=a.createDocumentFragment(),s.clean(e,a,i,r)),o&&(s.fragments[f]=u?i:1),{fragment:i,cacheable:o}},s.fragments={},s.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){s.fn[e]=function(n){var r=[],i=s(n),o=this.length===1&&this[0].parentNode;if(o&&o.nodeType===11&&o.childNodes.length===1&&i.length===1)return i[t](this[0]),this;for(var u=0,a=i.length;u<a;u++){var f=(u>0?this.clone(!0):this).get();s(i[u])[t](f),r=r.concat(f)}return this.pushStack(r,e,i.selector)}}),s.extend({clone:function(e,t,n){var r,i,o,u=s.support.html5Clone||s.isXMLDoc(e)||!nt.test("<"+e.nodeName+">")?e.cloneNode(!0):dt(e);if((!s.support.noCloneEvent||!s.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!s.isXMLDoc(e)){lt(e,u),r=ct(e),i=ct(u);for(o=0;r[o];++o)i[o]&<(r[o],i[o])}if(t){ft(e,u);if(n){r=ct(e),i=ct(u);for(o=0;r[o];++o)ft(r[o],i[o])}}return r=i=null,u},clean:function(e,t,r,i){var o,u,a,f=[];t=t||n,typeof t.createElement=="undefined"&&(t=t.ownerDocument||t[0]&&t[0].ownerDocument||n);for(var l=0,c;(c=e[l])!=null;l++){typeof c=="number"&&(c+="");if(!c)continue;if(typeof c=="string")if(!Z.test(c))c=t.createTextNode(c);else{c=c.replace(Q,"<$1></$2>");var h=(G.exec(c)||["",""])[1].toLowerCase(),p=ot[h]||ot._default,d=p[0],v=t.createElement("div"),m=ut.childNodes,g;t===n?ut.appendChild(v):V(t).appendChild(v),v.innerHTML=p[1]+c+p[2];while(d--)v=v.lastChild;if(!s.support.tbody){var y=Y.test(c),b=h==="table"&&!y?v.firstChild&&v.firstChild.childNodes:p[1]==="<table>"&&!y?v.childNodes:[];for(a=b.length-1;a>=0;--a)s.nodeName(b[a],"tbody")&&!b[a].childNodes.length&&b[a].parentNode.removeChild(b[a])}!s.support.leadingWhitespace&&K.test(c)&&v.insertBefore(t.createTextNode(K.exec(c)[0]),v.firstChild),c=v.childNodes,v&&(v.parentNode.removeChild(v),m.length>0&&(g=m[m.length-1],g&&g.parentNode&&g.parentNode.removeChild(g)))}var w;if(!s.support.appendChecked)if(c[0]&&typeof (w=c.length)=="number")for(a=0;a<w;a++)pt(c[a]);else pt(c);c.nodeType?f.push(c):f=s.merge(f,c)}if(r){o=function(e){return!e.type||it.test(e.type)};for(l=0;f[l];l++){u=f[l];if(i&&s.nodeName(u,"script")&&(!u.type||it.test(u.type)))i.push(u.parentNode?u.parentNode.removeChild(u):u);else{if(u.nodeType===1){var E=s.grep(u.getElementsByTagName("script"),o);f.splice.apply(f,[l+1,0].concat(E))}r.appendChild(u)}}}return f},cleanData:function(e){var t,n,r=s.cache,i=s.event.special,o=s.support.deleteExpando;for(var u=0,a;(a=e[u])!=null;u++){if(a.nodeName&&s.noData[a.nodeName.toLowerCase()])continue;n=a[s.expando];if(n){t=r[n];if(t&&t.events){for(var f in t.events)i[f]?s.event.remove(a,f):s.removeEvent(a,f,t.handle);t.handle&&(t.handle.elem=null)}o?delete a[s.expando]:a.removeAttribute&&a.removeAttribute(s.expando),delete r[n]}}}});var vt=/alpha\([^)]*\)/i,mt=/opacity=([^)]*)/,gt=/([A-Z]|^ms)/g,yt=/^[\-+]?(?:\d*\.)?\d+$/i,bt=/^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,wt=/^([\-+])=([\-+.\de]+)/,Et=/^margin/,St={position:"absolute",visibility:"hidden",display:"block"},xt=["Top","Right","Bottom","Left"],Tt,Nt,Ct;s.fn.css=function(e,n){return s.access(this,function(e,n,r){return r!==t?s.style(e,n,r):s.css(e,n)},e,n,arguments.length>1)},s.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Tt(e,"opacity");return n===""?"1":n}return e.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":s.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var o,u,a=s.camelCase(n),f=e.style,l=s.cssHooks[a];n=s.cssProps[a]||a;if(r===t)return l&&"get"in l&&(o=l.get(e,!1,i))!==t?o:f[n];u=typeof r,u==="string"&&(o=wt.exec(r))&&(r=+(o[1]+1)*+o[2]+parseFloat(s.css(e,n)),u="number");if(r==null||u==="number"&&isNaN(r))return;u==="number"&&!s.cssNumber[a]&&(r+="px");if(!l||!("set"in l)||(r=l.set(e,r))!==t)try{f[n]=r}catch(c){}},css:function(e,n,r){var i,o;n=s.camelCase(n),o=s.cssHooks[n],n=s.cssProps[n]||n,n==="cssFloat"&&(n="float");if(o&&"get"in o&&(i=o.get(e,!0,r))!==t)return i;if(Tt)return Tt(e,n)},swap:function(e,t,n){var r={},i,s;for(s in t)r[s]=e.style[s],e.style[s]=t[s];i=n.call(e);for(s in t)e.style[s]=r[s];return i}}),s.curCSS=s.css,n.defaultView&&n.defaultView.getComputedStyle&&(Nt=function(e,t){var n,r,i,o,u=e.style;return t=t.replace(gt,"-$1").toLowerCase(),(r=e.ownerDocument.defaultView)&&(i=r.getComputedStyle(e,null))&&(n=i.getPropertyValue(t),n===""&&!s.contains(e.ownerDocument.documentElement,e)&&(n=s.style(e,t))),!s.support.pixelMargin&&i&&Et.test(t)&&bt.test(n)&&(o=u.width,u.width=n,n=i.width,u.width=o),n}),n.documentElement.currentStyle&&(Ct=function(e,t){var n,r,i,s=e.currentStyle&&e.currentStyle[t],o=e.style;return s==null&&o&&(i=o[t])&&(s=i),bt.test(s)&&(n=o.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),o.left=t==="fontSize"?"1em":s,s=o.pixelLeft+"px",o.left=n,r&&(e.runtimeStyle.left=r)),s===""?"auto":s}),Tt=Nt||Ct,s.each(["height","width"],function(e,t){s.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth!==0?kt(e,t,r):s.swap(e,St,function(){return kt(e,t,r)})},set:function(e,t){return yt.test(t)?t+"px":t}}}),s.support.opacity||(s.cssHooks.opacity={get:function(e,t){return mt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?parseFloat(RegExp.$1)/100+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=s.isNumeric(t)?"alpha(opacity="+t*100+")":"",o=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&s.trim(o.replace(vt,""))===""){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=vt.test(o)?o.replace(vt,i):o+" "+i}}),s(function(){s.support.reliableMarginRight||(s.cssHooks.marginRight={get:function(e,t){return s.swap(e,{display:"inline-block"},function(){return t?Tt(e,"margin-right"):e.style.marginRight})}})}),s.expr&&s.expr.filters&&(s.expr.filters.hidden=function(e){var t=e.offsetWidth,n=e.offsetHeight;return t===0&&n===0||!s.support.reliableHiddenOffsets&&(e.style&&e.style.display||s.css(e,"display"))==="none"},s.expr.filters.visible=function(e){return!s.expr.filters.hidden(e)}),s.each({margin:"",padding:"",border:"Width"},function(e,t){s.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+xt[r]+t]=i[r]||i[r-2]||i[0];return s}}});var Lt=/%20/g,At=/\[\]$/,Ot=/\r?\n/g,Mt=/#.*$/,_t=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,Dt=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,Pt=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,Ht=/^(?:GET|HEAD)$/,Bt=/^\/\//,jt=/\?/,Ft=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,It=/^(?:select|textarea)/i,qt=/\s+/,Rt=/([?&])_=[^&]*/,Ut=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,zt=s.fn.load,Wt={},Xt={},Vt,$t,Jt=["*/"]+["*"];try{Vt=i.href}catch(Kt){Vt=n.createElement("a"),Vt.href="",Vt=Vt.href}$t=Ut.exec(Vt.toLowerCase())||[],s.fn.extend({load:function(e,n,r){if(typeof e!="string"&&zt)return zt.apply(this,arguments);if(!this.length)return this;var i=e.indexOf(" ");if(i>=0){var o=e.slice(i,e.length);e=e.slice(0,i)}var u="GET";n&&(s.isFunction(n)?(r=n,n=t):typeof n=="object"&&(n=s.param(n,s.ajaxSettings.traditional),u="POST"));var a=this;return s.ajax({url:e,type:u,dataType:"html",data:n,complete:function(e,t,n){n=e.responseText,e.isResolved()&&(e.done(function(e){n=e}),a.html(o?s("<div>").append(n.replace(Ft,"")).find(o):n)),r&&a.each(r,[n,t,e])}}),this},serialize:function(){return s.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?s.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||It.test(this.nodeName)||Dt.test(this.type))}).map(function(e,t){var n=s(this).val();return n==null?null:s.isArray(n)?s.map(n,function(e,n){return{name:t.name,value:e.replace(Ot,"\r\n")}}):{name:t.name,value:n.replace(Ot,"\r\n")}}).get()}}),s.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){s.fn[t]=function(e){return this.on(t,e)}}),s.each(["get","post"],function(e,n){s[n]=function(e,r,i,o){return s.isFunction(r)&&(o=o||i,i=r,r=t),s.ajax({type:n,url:e,data:r,success:i,dataType:o})}}),s.extend({getScript:function(e,n){return s.get(e,t,n,"script")},getJSON:function(e,t,n){return s.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?Yt(e,s.ajaxSettings):(t=e,e=s.ajaxSettings),Yt(e,t),e},ajaxSettings:{url:Vt,isLocal:Pt.test($t[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Jt},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":s.parseJSON,"text xml":s.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:Qt(Wt),ajaxTransport:Qt(Xt),ajax:function(e,n){function S(e,n,c,h){if(y===2)return;y=2,m&&clearTimeout(m),v=t,p=h||"",E.readyState=e>0?4:0;var d,g,w,S=n,x=c?en(r,E,c):t,T,N;if(e>=200&&e<300||e===304){if(r.ifModified){if(T=E.getResponseHeader("Last-Modified"))s.lastModified[l]=T;if(N=E.getResponseHeader("Etag"))s.etag[l]=N}if(e===304)S="notmodified",d=!0;else try{g=tn(r,x),S="success",d=!0}catch(C){S="parsererror",w=C}}else{w=S;if(!S||e)S="error",e<0&&(e=0)}E.status=e,E.statusText=""+(n||S),d?u.resolveWith(i,[g,S,E]):u.rejectWith(i,[E,S,w]),E.statusCode(f),f=t,b&&o.trigger("ajax"+(d?"Success":"Error"),[E,r,d?g:w]),a.fireWith(i,[E,S]),b&&(o.trigger("ajaxComplete",[E,r]),--s.active||s.event.trigger("ajaxStop"))}typeof e=="object"&&(n=e,e=t),n=n||{};var r=s.ajaxSetup({},n),i=r.context||r,o=i!==r&&(i.nodeType||i instanceof s)?s(i):s.event,u=s.Deferred(),a=s.Callbacks("once memory"),f=r.statusCode||{},l,c={},h={},p,d,v,m,g,y=0,b,w,E={readyState:0,setRequestHeader:function(e,t){if(!y){var n=e.toLowerCase();e=h[n]=h[n]||e,c[e]=t}return this},getAllResponseHeaders:function(){return y===2?p:null},getResponseHeader:function(e){var n;if(y===2){if(!d){d={};while(n=_t.exec(p))d[n[1].toLowerCase()]=n[2]}n=d[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return y||(r.mimeType=e),this},abort:function(e){return e=e||"abort",v&&v.abort(e),S(0,e),this}};u.promise(E),E.success=E.done,E.error=E.fail,E.complete=a.add,E.statusCode=function(e){if(e){var t;if(y<2)for(t in e)f[t]=[f[t],e[t]];else t=e[E.status],E.then(t,t)}return this},r.url=((e||r.url)+"").replace(Mt,"").replace(Bt,$t[1]+"//"),r.dataTypes=s.trim(r.dataType||"*").toLowerCase().split(qt),r.crossDomain==null&&(g=Ut.exec(r.url.toLowerCase()),r.crossDomain=!(!g||g[1]==$t[1]&&g[2]==$t[2]&&(g[3]||(g[1]==="http:"?80:443))==($t[3]||($t[1]==="http:"?80:443)))),r.data&&r.processData&&typeof r.data!="string"&&(r.data=s.param(r.data,r.traditional)),Gt(Wt,r,n,E);if(y===2)return!1;b=r.global,r.type=r.type.toUpperCase(),r.hasContent=!Ht.test(r.type),b&&s.active++===0&&s.event.trigger("ajaxStart");if(!r.hasContent){r.data&&(r.url+=(jt.test(r.url)?"&":"?")+r.data,delete r.data),l=r.url;if(r.cache===!1){var x=s.now(),T=r.url.replace(Rt,"$1_="+x);r.url=T+(T===r.url?(jt.test(r.url)?"&":"?")+"_="+x:"")}}(r.data&&r.hasContent&&r.contentType!==!1||n.contentType)&&E.setRequestHeader("Content-Type",r.contentType),r.ifModified&&(l=l||r.url,s.lastModified[l]&&E.setRequestHeader("If-Modified-Since",s.lastModified[l]),s.etag[l]&&E.setRequestHeader("If-None-Match",s.etag[l])),E.setRequestHeader("Accept",r.dataTypes[0]&&r.accepts[r.dataTypes[0]]?r.accepts[r.dataTypes[0]]+(r.dataTypes[0]!=="*"?", "+Jt+"; q=0.01":""):r.accepts["*"]);for(w in r.headers)E.setRequestHeader(w,r.headers[w]);if(!r.beforeSend||r.beforeSend.call(i,E,r)!==!1&&y!==2){for(w in{success:1,error:1,complete:1})E[w](r[w]);v=Gt(Xt,r,n,E);if(!v)S(-1,"No Transport");else{E.readyState=1,b&&o.trigger("ajaxSend",[E,r]),r.async&&r.timeout>0&&(m=setTimeout(function(){E.abort("timeout")},r.timeout));try{y=1,v.send(c,S)}catch(N){if(!(y<2))throw N;S(-1,N)}}return E}return E.abort(),!1},param:function(e,n){var r=[],i=function(e,t){t=s.isFunction(t)?t():t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=s.ajaxSettings.traditional);if(s.isArray(e)||e.jquery&&!s.isPlainObject(e))s.each(e,function(){i(this.name,this.value)});else for(var o in e)Zt(o,e[o],n,i);return r.join("&").replace(Lt,"+")}}),s.extend({active:0,lastModified:{},etag:{}});var nn=s.now(),rn=/(\=)\?(&|$)|\?\?/i;s.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return s.expando+"_"+nn++}}),s.ajaxPrefilter("json jsonp",function(t,n,r){var i=typeof t.data=="string"&&/^application\/x\-www\-form\-urlencoded/.test(t.contentType);if(t.dataTypes[0]==="jsonp"||t.jsonp!==!1&&(rn.test(t.url)||i&&rn.test(t.data))){var o,u=t.jsonpCallback=s.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,a=e[u],f=t.url,l=t.data,c="$1"+u+"$2";return t.jsonp!==!1&&(f=f.replace(rn,c),t.url===f&&(i&&(l=l.replace(rn,c)),t.data===l&&(f+=(/\?/.test(f)?"&":"?")+t.jsonp+"="+u))),t.url=f,t.data=l,e[u]=function(e){o=[e]},r.always(function(){e[u]=a,o&&s.isFunction(a)&&e[u](o[0])}),t.converters["script json"]=function(){return o||s.error(u+" was not called"),o[0]},t.dataTypes[0]="json","script"}}),s.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return s.globalEval(e),e}}}),s.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),s.ajaxTransport("script",function(e){if(e.crossDomain){var r,i=n.head||n.getElementsByTagName("head")[0]||n.documentElement;return{send:function(s,o){r=n.createElement("script"),r.async="async",e.scriptCharset&&(r.charset=e.scriptCharset),r.src=e.url,r.onload=r.onreadystatechange=function(e,n){if(n||!r.readyState||/loaded|complete/.test(r.readyState))r.onload=r.onreadystatechange=null,i&&r.parentNode&&i.removeChild(r),r=t,n||o(200,"success")},i.insertBefore(r,i.firstChild)},abort:function(){r&&r.onload(0,1)}}}});var sn=e.ActiveXObject?function(){for(var e in un)un[e](0,1)}:!1,on=0,un;s.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&an()||fn()}:an,function(e){s.extend(s.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(s.ajaxSettings.xhr()),s.support.ajax&&s.ajaxTransport(function(n){if(!n.crossDomain||s.support.cors){var r;return{send:function(i,o){var u=n.xhr(),a,f;n.username?u.open(n.type,n.url,n.async,n.username,n.password):u.open(n.type,n.url,n.async);if(n.xhrFields)for(f in n.xhrFields)u[f]=n.xhrFields[f];n.mimeType&&u.overrideMimeType&&u.overrideMimeType(n.mimeType),!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(f in i)u.setRequestHeader(f,i[f])}catch(l){}u.send(n.hasContent&&n.data||null),r=function(e,i){var f,l,c,h,p;try{if(r&&(i||u.readyState===4)){r=t,a&&(u.onreadystatechange=s.noop,sn&&delete un[a]);if(i)u.readyState!==4&&u.abort();else{f=u.status,c=u.getAllResponseHeaders(),h={},p=u.responseXML,p&&p.documentElement&&(h.xml=p);try{h.text=u.responseText}catch(e){}try{l=u.statusText}catch(d){l=""}!f&&n.isLocal&&!n.crossDomain?f=h.text?200:404:f===1223&&(f=204)}}}catch(v){i||o(-1,v)}h&&o(f,l,h,c)},!n.async||u.readyState===4?r():(a=++on,sn&&(un||(un={},s(e).unload(sn)),un[a]=r),u.onreadystatechange=r)},abort:function(){r&&r(0,1)}}}});var ln={},cn,hn,pn=/^(?:toggle|show|hide)$/,dn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,vn,mn=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],gn;s.fn.extend({show:function(e,t,n){var r,i;if(e||e===0)return this.animate(wn("show",3),e,t,n);for(var o=0,u=this.length;o<u;o++)r=this[o],r.style&&(i=r.style.display,!s._data(r,"olddisplay")&&i==="none"&&(i=r.style.display=""),(i===""&&s.css(r,"display")==="none"||!s.contains(r.ownerDocument.documentElement,r))&&s._data(r,"olddisplay",En(r.nodeName)));for(o=0;o<u;o++){r=this[o];if(r.style){i=r.style.display;if(i===""||i==="none")r.style.display=s._data(r,"olddisplay")||""}}return this},hide:function(e,t,n){if(e||e===0)return this.animate(wn("hide",3),e,t,n);var r,i,o=0,u=this.length;for(;o<u;o++)r=this[o],r.style&&(i=s.css(r,"display"),i!=="none"&&!s._data(r,"olddisplay")&&s._data(r,"olddisplay",i));for(o=0;o<u;o++)this[o].style&&(this[o].style.display="none");return this},_toggle:s.fn.toggle,toggle:function(e,t,n){var r=typeof e=="boolean";return s.isFunction(e)&&s.isFunction(t)?this._toggle.apply(this,arguments):e==null||r?this.each(function(){var t=r?e:s(this).is(":hidden");s(this)[t?"show":"hide"]()}):this.animate(wn("toggle",3),e,t,n),this},fadeTo:function(e,t,n,r){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){function o(){i.queue===!1&&s._mark(this);var t=s.extend({},i),n=this.nodeType===1,r=n&&s(this).is(":hidden"),o,u,a,f,l,c,h,p,d,v,m;t.animatedProperties={};for(a in e){o=s.camelCase(a),a!==o&&(e[o]=e[a],delete e[a]);if((l=s.cssHooks[o])&&"expand"in l){c=l.expand(e[o]),delete e[o];for(a in c)a in e||(e[a]=c[a])}}for(o in e){u=e[o],s.isArray(u)?(t.animatedProperties[o]=u[1],u=e[o]=u[0]):t.animatedProperties[o]=t.specialEasing&&t.specialEasing[o]||t.easing||"swing";if(u==="hide"&&r||u==="show"&&!r)return t.complete.call(this);n&&(o==="height"||o==="width")&&(t.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],s.css(this,"display")==="inline"&&s.css(this,"float")==="none"&&(!s.support.inlineBlockNeedsLayout||En(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}t.overflow!=null&&(this.style.overflow="hidden");for(a in e)f=new s.fx(this,t,a),u=e[a],pn.test(u)?(m=s._data(this,"toggle"+a)||(u==="toggle"?r?"show":"hide":0),m?(s._data(this,"toggle"+a,m==="show"?"hide":"show"),f[m]()):f[u]()):(h=dn.exec(u),p=f.cur(),h?(d=parseFloat(h[2]),v=h[3]||(s.cssNumber[a]?"":"px"),v!=="px"&&(s.style(this,a,(d||1)+v),p=(d||1)/f.cur()*p,s.style(this,a,p+v)),h[1]&&(d=(h[1]==="-="?-1:1)*d+p),f.custom(p,d,v)):f.custom(p,u,""));return!0}var i=s.speed(t,n,r);return s.isEmptyObject(e)?this.each(i.complete,[!1]):(e=s.extend({},e),i.queue===!1?this.each(o):this.queue(i.queue,o))},stop:function(e,n,r){return typeof e!="string"&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){function u(e,t,n){var i=t[n];s.removeData(e,n,!0),i.stop(r)}var t,n=!1,i=s.timers,o=s._data(this);r||s._unmark(!0,this);if(e==null)for(t in o)o[t]&&o[t].stop&&t.indexOf(".run")===t.length-4&&u(this,o,t);else o[t=e+".run"]&&o[t].stop&&u(this,o,t);for(t=i.length;t--;)i[t].elem===this&&(e==null||i[t].queue===e)&&(r?i[t](!0):i[t].saveState(),n=!0,i.splice(t,1));(!r||!n)&&s.dequeue(this,e)})}}),s.each({slideDown:wn("show",1),slideUp:wn("hide",1),slideToggle:wn("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){s.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),s.extend({speed:function(e,t,n){var r=e&&typeof e=="object"?s.extend({},e):{complete:n||!n&&t||s.isFunction(e)&&e,duration:e,easing:n&&t||t&&!s.isFunction(t)&&t};r.duration=s.fx.off?0:typeof r.duration=="number"?r.duration:r.duration in s.fx.speeds?s.fx.speeds[r.duration]:s.fx.speeds._default;if(r.queue==null||r.queue===!0)r.queue="fx";return r.old=r.complete,r.complete=function(e){s.isFunction(r.old)&&r.old.call(this),r.queue?s.dequeue(this,r.queue):e!==!1&&s._unmark(this)},r},easing:{linear:function(e){return e},swing:function(e){return-Math.cos(e*Math.PI)/2+.5}},timers:[],fx:function(e,t,n){this.options=t,this.elem=e,this.prop=n,t.orig=t.orig||{}}}),s.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(s.fx.step[this.prop]||s.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]==null||!!this.elem.style&&this.elem.style[this.prop]!=null){var e,t=s.css(this.elem,this.prop);return isNaN(e=parseFloat(t))?!t||t==="auto"?0:t:e}return this.elem[this.prop]},custom:function(e,n,r){function u(e){return i.step(e)}var i=this,o=s.fx;this.startTime=gn||yn(),this.end=n,this.now=this.start=e,this.pos=this.state=0,this.unit=r||this.unit||(s.cssNumber[this.prop]?"":"px"),u.queue=this.options.queue,u.elem=this.elem,u.saveState=function(){s._data(i.elem,"fxshow"+i.prop)===t&&(i.options.hide?s._data(i.elem,"fxshow"+i.prop,i.start):i.options.show&&s._data(i.elem,"fxshow"+i.prop,i.end))},u()&&s.timers.push(u)&&!vn&&(vn=setInterval(o.tick,o.interval))},show:function(){var e=s._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=e||s.style(this.elem,this.prop),this.options.show=!0,e!==t?this.custom(this.cur(),e):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),s(this.elem).show()},hide:function(){this.options.orig[this.prop]=s._data(this.elem,"fxshow"+this.prop)||s.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(e){var t,n,r,i=gn||yn(),o=!0,u=this.elem,a=this.options;if(e||i>=a.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),a.animatedProperties[this.prop]=!0;for(t in a.animatedProperties)a.animatedProperties[t]!==!0&&(o=!1);if(o){a.overflow!=null&&!s.support.shrinkWrapBlocks&&s.each(["","X","Y"],function(e,t){u.style["overflow"+t]=a.overflow[e]}),a.hide&&s(u).hide();if(a.hide||a.show)for(t in a.animatedProperties)s.style(u,t,a.orig[t]),s.removeData(u,"fxshow"+t,!0),s.removeData(u,"toggle"+t,!0);r=a.complete,r&&(a.complete=!1,r.call(u))}return!1}return a.duration==Infinity?this.now=i:(n=i-this.startTime,this.state=n/a.duration,this.pos=s.easing[a.animatedProperties[this.prop]](this.state,n,0,1,a.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update(),!0}},s.extend(s.fx,{tick:function(){var e,t=s.timers,n=0;for(;n<t.length;n++)e=t[n],!e()&&t[n]===e&&t.splice(n--,1);t.length||s.fx.stop()},interval:13,stop:function(){clearInterval(vn),vn=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(e){s.style(e.elem,"opacity",e.now)},_default:function(e){e.elem.style&&e.elem.style[e.prop]!=null?e.elem.style[e.prop]=e.now+e.unit:e.elem[e.prop]=e.now}}}),s.each(mn.concat.apply([],mn),function(e,t){t.indexOf("margin")&&(s.fx.step[t]=function(e){s.style(e.elem,t,Math.max(0,e.now)+e.unit)})}),s.expr&&s.expr.filters&&(s.expr.filters.animated=function(e){return s.grep(s.timers,function(t){return e===t.elem}).length});var Sn,xn=/^t(?:able|d|h)$/i,Tn=/^(?:body|html)$/i;"getBoundingClientRect"in n.documentElement?Sn=function(e,t,n,r){try{r=e.getBoundingClientRect()}catch(i){}if(!r||!s.contains(n,e))return r?{top:r.top,left:r.left}:{top:0,left:0};var o=t.body,u=Nn(t),a=n.clientTop||o.clientTop||0,f=n.clientLeft||o.clientLeft||0,l=u.pageYOffset||s.support.boxModel&&n.scrollTop||o.scrollTop,c=u.pageXOffset||s.support.boxModel&&n.scrollLeft||o.scrollLeft,h=r.top+l-a,p=r.left+c-f;return{top:h,left:p}}:Sn=function(e,t,n){var r,i=e.offsetParent,o=e,u=t.body,a=t.defaultView,f=a?a.getComputedStyle(e,null):e.currentStyle,l=e.offsetTop,c=e.offsetLeft;while((e=e.parentNode)&&e!==u&&e!==n){if(s.support.fixedPosition&&f.position==="fixed")break;r=a?a.getComputedStyle(e,null):e.currentStyle,l-=e.scrollTop,c-=e.scrollLeft,e===i&&(l+=e.offsetTop,c+=e.offsetLeft,s.support.doesNotAddBorder&&(!s.support.doesAddBorderForTableAndCells||!xn.test(e.nodeName))&&(l+=parseFloat(r.borderTopWidth)||0,c+=parseFloat(r.borderLeftWidth)||0),o=i,i=e.offsetParent),s.support.subtractsBorderForOverflowNotVisible&&r.overflow!=="visible"&&(l+=parseFloat(r.borderTopWidth)||0,c+=parseFloat(r.borderLeftWidth)||0),f=r}if(f.position==="relative"||f.position==="static")l+=u.offsetTop,c+=u.offsetLeft;return s.support.fixedPosition&&f.position==="fixed"&&(l+=Math.max(n.scrollTop,u.scrollTop),c+=Math.max(n.scrollLeft,u.scrollLeft)),{top:l,left:c}},s.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){s.offset.setOffset(this,e,t)});var n=this[0],r=n&&n.ownerDocument;return r?n===r.body?s.offset.bodyOffset(n):Sn(n,r,r.documentElement):null},s.offset={bodyOffset:function(e){var t=e.offsetTop,n=e.offsetLeft;return s.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(s.css(e,"marginTop"))||0,n+=parseFloat(s.css(e,"marginLeft"))||0),{top:t,left:n}},setOffset:function(e,t,n){var r=s.css(e,"position");r==="static"&&(e.style.position="relative");var i=s(e),o=i.offset(),u=s.css(e,"top"),a=s.css(e,"left"),f=(r==="absolute"||r==="fixed")&&s.inArray("auto",[u,a])>-1,l={},c={},h,p;f?(c=i.position(),h=c.top,p=c.left):(h=parseFloat(u)||0,p=parseFloat(a)||0),s.isFunction(t)&&(t=t.call(e,n,o)),t.top!=null&&(l.top=t.top-o.top+h),t.left!=null&&(l.left=t.left-o.left+p),"using"in t?t.using.call(e,l):i.css(l)}},s.fn.extend({position:function(){if(!this[0])return null;var e=this[0],t=this.offsetParent(),n=this.offset(),r=Tn.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(s.css(e,"marginTop"))||0,n.left-=parseFloat(s.css(e,"marginLeft"))||0,r.top+=parseFloat(s.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(s.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||n.body;while(e&&!Tn.test(e.nodeName)&&s.css(e,"position")==="static")e=e.offsetParent;return e})}}),s.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);s.fn[e]=function(i){return s.access(this,function(e,i,o){var u=Nn(e);if(o===t)return u?n in u?u[n]:s.support.boxModel&&u.document.documentElement[i]||u.document.body[i]:e[i];u?u.scrollTo(r?s(u).scrollLeft():o,r?o:s(u).scrollTop()):e[i]=o},e,i,arguments.length,null)}}),s.each({Height:"height",Width:"width"},function(e,n){var r="client"+e,i="scroll"+e,o="offset"+e;s.fn["inner"+e]=function(){var e=this[0];return e?e.style?parseFloat(s.css(e,n,"padding")):this[n]():null},s.fn["outer"+e]=function(e){var t=this[0];return t?t.style?parseFloat(s.css(t,n,e?"margin":"border")):this[n]():null},s.fn[n]=function(e){return s.access(this,function(e,n,u){var a,f,l,c;if(s.isWindow(e))return a=e.document,f=a.documentElement[r],s.support.boxModel&&f||a.body&&a.body[r]||f;if(e.nodeType===9)return a=e.documentElement,a[r]>=a[i]?a[r]:Math.max(e.body[i],a[i],e.body[o],a[o]);if(u===t)return l=s.css(e,n),c=parseFloat(l),s.isNumeric(c)?c:l;s(e).css(n,u)},n,e,arguments.length,null)}}),e.jQuery=e.$=s,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return s})})(window)
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/json2.js b/src/main/webapp/javascripts_min/libs/json2.js new file mode 100644 index 0000000..b37c5f8 --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/json2.js @@ -0,0 +1 @@ +var JSON;JSON||(JSON={}),function(){function f(e){return e<10?"0"+e:e}function quote(e){return escapable.lastIndex=0,escapable.test(e)?'"'+e.replace(escapable,function(e){var t=meta[e];return typeof t=="string"?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var n,r,i,s,o=gap,u,a=t[e];a&&typeof a=="object"&&typeof a.toJSON=="function"&&(a=a.toJSON(e)),typeof rep=="function"&&(a=rep.call(t,e,a));switch(typeof a){case"string":return quote(a);case"number":return isFinite(a)?String(a):"null";case"boolean":case"null":return String(a);case"object":if(!a)return"null";gap+=indent,u=[];if(Object.prototype.toString.apply(a)==="[object Array]"){s=a.length;for(n=0;n<s;n+=1)u[n]=str(n,a)||"null";return i=u.length===0?"[]":gap?"[\n"+gap+u.join(",\n"+gap)+"\n"+o+"]":"["+u.join(",")+"]",gap=o,i}if(rep&&typeof rep=="object"){s=rep.length;for(n=0;n<s;n+=1)typeof rep[n]=="string"&&(r=rep[n],i=str(r,a),i&&u.push(quote(r)+(gap?": ":":")+i))}else for(r in a)Object.prototype.hasOwnProperty.call(a,r)&&(i=str(r,a),i&&u.push(quote(r)+(gap?": ":":")+i));return i=u.length===0?"{}":gap?"{\n"+gap+u.join(",\n"+gap)+"\n"+o+"}":"{"+u.join(",")+"}",gap=o,i}}typeof Date.prototype.toJSON!="function"&&(Date.prototype.toJSON=function(e){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(e){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;typeof JSON.stringify!="function"&&(JSON.stringify=function(e,t,n){var r;gap="",indent="";if(typeof n=="number")for(r=0;r<n;r+=1)indent+=" ";else typeof n=="string"&&(indent=n);rep=t;if(!t||typeof t=="function"||typeof t=="object"&&typeof t.length=="number")return str("",{"":e});throw new Error("JSON.stringify")}),typeof JSON.parse!="function"&&(JSON.parse=function(text,reviver){function walk(e,t){var n,r,i=e[t];if(i&&typeof i=="object")for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(r=walk(i,n),r!==undefined?i[n]=r:delete i[n]);return reviver.call(e,t,i)}var j;text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),typeof reviver=="function"?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}()
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/qunit-1.10.0.js b/src/main/webapp/javascripts_min/libs/qunit-1.10.0.js new file mode 100644 index 0000000..b917673 --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/qunit-1.10.0.js @@ -0,0 +1,37 @@ +/** + * QUnit v1.10.0 - A JavaScript Unit Testing Framework + * + * http://qunitjs.com + * + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +/** + * jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | + * http://flesler.blogspot.com Licensed under BSD + * (http://www.opensource.org/licenses/bsd-license.php) Date: 5/15/2008 + * + * @projectDescription Advanced and extensible data dumping for Javascript. + * @version 1.0.0 + * @author Ariel Flesler + * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html} + */ + +/* + * Javascript Diff Algorithm + * By John Resig (http://ejohn.org/) + * Modified by Chu Alan "sprite" + * + * Released under the MIT license. + * + * More Info: + * http://ejohn.org/projects/javascript-diff-algorithm/ + * + * Usage: QUnit.diff(expected, actual) + * + * QUnit.diff( "the quick brown fox jumped over", "the quick fox jumps over" ) == "the quick <del>brown </del> fox <del>jumped </del><ins>jumps </ins> over" + */ + +(function(e){function l(e){E(this,e),this.assertions=[],this.testNumber=++l.count}function c(){n.autorun=!0,n.currentModule&&N("moduleDone",t,{name:n.currentModule,failed:n.moduleStats.bad,passed:n.moduleStats.all-n.moduleStats.bad,total:n.moduleStats.all});var r,i,s=x("qunit-banner"),o=x("qunit-tests"),u=+(new a)-n.started,l=n.stats.all-n.stats.bad,c=["Tests completed in ",u," milliseconds.<br/>","<span class='passed'>",l,"</span> tests of <span class='total'>",n.stats.all,"</span> passed, <span class='failed'>",n.stats.bad,"</span> failed."].join("");s&&(s.className=n.stats.bad?"qunit-fail":"qunit-pass"),o&&(x("qunit-testresult").innerHTML=c),n.altertitle&&typeof document!="undefined"&&document.title&&(document.title=[n.stats.bad?"✖":"✔",document.title.replace(/^[\u2714\u2716] /i,"")].join(" "));if(n.reorder&&f.sessionStorage&&n.stats.bad===0)for(r=0;r<sessionStorage.length;r++)i=sessionStorage.key(r++),i.indexOf("qunit-test-")===0&&sessionStorage.removeItem(i);e.scrollTo&&e.scrollTo(0,0),N("done",t,{failed:n.stats.bad,passed:l,total:n.stats.all,runtime:u})}function h(e){var t,r=n.filter&&n.filter.toLowerCase(),i=n.module&&n.module.toLowerCase(),s=(e.module+": "+e.testName).toLowerCase();return e.callback&&e.callback.validTest===h?(delete e.callback.validTest,!0):n.testNumber?e.testNumber===n.testNumber:i&&(!e.module||e.module.toLowerCase()!==i)?!1:r?(t=r.charAt(0)!=="!",t||(r=r.slice(1)),s.indexOf(r)!==-1?t:!t):!0}function p(e,t){t=t===undefined?3:t;var n,r,i,o;if(e.stacktrace)return e.stacktrace.split("\n")[t+3];if(e.stack){n=e.stack.split("\n"),/^error$/i.test(n[0])&&n.shift();if(s){r=[];for(i=t;i<n.length;i++){if(n[i].indexOf(s)!=-1)break;r.push(n[i])}if(r.length)return r.join("\n")}return n[t]}if(e.sourceURL){if(/qunit.js$/.test(e.sourceURL))return;return e.sourceURL+":"+e.line}}function d(e){try{throw new Error}catch(t){return p(t,e)}}function v(e){return e?(e+="",e.replace(/[\&<>]/g,function(e){switch(e){case"&":return"&";case"<":return"<";case">":return">";default:return e}})):""}function m(e,t){n.queue.push(e),n.autorun&&!n.blocking&&g(t)}function g(t){function r(){g(t)}var i=(new a).getTime();n.depth=n.depth?n.depth+1:1;while(n.queue.length&&!n.blocking){if(!(!f.setTimeout||n.updateRate<=0||(new a).getTime()-i<n.updateRate)){e.setTimeout(r,13);break}n.queue.shift()()}n.depth--,t&&!n.blocking&&!n.queue.length&&n.depth===0&&c()}function y(){n.pollution=[];if(n.noglobals)for(var t in e){if(!u.call(e,t)||/^qunit-test-output/.test(t))continue;n.pollution.push(t)}}function b(e){var r,i,s=n.pollution;y(),r=w(n.pollution,s),r.length>0&&t.pushFailure("Introduced global variable(s): "+r.join(", ")),i=w(s,n.pollution),i.length>0&&t.pushFailure("Deleted global variable(s): "+i.join(", "))}function w(e,t){var n,r,i=e.slice();for(n=0;n<i.length;n++)for(r=0;r<t.length;r++)if(i[n]===t[r]){i.splice(n,1),n--;break}return i}function E(t,n){for(var r in n)if(n[r]===undefined)delete t[r];else if(r!=="constructor"||t!==e)t[r]=n[r];return t}function S(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent?e.attachEvent("on"+t,n):n()}function x(e){return typeof document!="undefined"&&!!document&&!!document.getElementById&&document.getElementById(e)}function T(e){return function(t){n[e].push(t)}}function N(e,r,i){var s,o;if(t.hasOwnProperty(e))t[e].call(r,i);else{o=n[e];for(s=0;s<o.length;s++)o[s].call(r,i)}}function C(e){var t,n,r="";for(t=0;e[t];t++)n=e[t],n.nodeType===3||n.nodeType===4?r+=n.nodeValue:n.nodeType!==8&&(r+=C(n.childNodes));return r}function k(e,t){if(t.indexOf)return t.indexOf(e);for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1}var t,n,r,i=0,s=(d(0)||"").replace(/(:\d+)+\)?/,"").replace(/.+\//,""),o=Object.prototype.toString,u=Object.prototype.hasOwnProperty,a=e.Date,f={setTimeout:typeof e.setTimeout!="undefined",sessionStorage:function(){var e="qunit-test-string";try{return sessionStorage.setItem(e,e),sessionStorage.removeItem(e),!0}catch(t){return!1}}()};l.count=0,l.prototype={init:function(){var e,n,r,s=x("qunit-tests");s&&(n=document.createElement("strong"),n.innerHTML=this.name,e=document.createElement("a"),e.innerHTML="Rerun",e.href=t.url({testNumber:this.testNumber}),r=document.createElement("li"),r.appendChild(n),r.appendChild(e),r.className="running",r.id=this.id="qunit-test-output"+i++,s.appendChild(r))},setup:function(){this.module!==n.previousModule?(n.previousModule&&N("moduleDone",t,{name:n.previousModule,failed:n.moduleStats.bad,passed:n.moduleStats.all-n.moduleStats.bad,total:n.moduleStats.all}),n.previousModule=this.module,n.moduleStats={all:0,bad:0},N("moduleStart",t,{name:this.module})):n.autorun&&N("moduleStart",t,{name:this.module}),n.current=this,this.testEnvironment=E({setup:function(){},teardown:function(){}},this.moduleTestEnvironment),N("testStart",t,{name:this.testName,module:this.module}),t.current_testEnvironment=this.testEnvironment,n.pollution||y();if(n.notrycatch){this.testEnvironment.setup.call(this.testEnvironment);return}try{this.testEnvironment.setup.call(this.testEnvironment)}catch(e){t.pushFailure("Setup failed on "+this.testName+": "+e.message,p(e,1))}},run:function(){n.current=this;var e=x("qunit-testresult");e&&(e.innerHTML="Running: <br/>"+this.name),this.async&&t.stop();if(n.notrycatch){this.callback.call(this.testEnvironment,t.assert);return}try{this.callback.call(this.testEnvironment,t.assert)}catch(r){t.pushFailure("Died on test #"+(this.assertions.length+1)+" "+this.stack+": "+r.message,p(r,0)),y(),n.blocking&&t.start()}},teardown:function(){n.current=this;if(n.notrycatch){this.testEnvironment.teardown.call(this.testEnvironment);return}try{this.testEnvironment.teardown.call(this.testEnvironment)}catch(e){t.pushFailure("Teardown failed on "+this.testName+": "+e.message,p(e,1))}b()},finish:function(){n.current=this,n.requireExpects&&this.expected==null?t.pushFailure("Expected number of assertions to be defined, but expect() was not called.",this.stack):this.expected!=null&&this.expected!=this.assertions.length?t.pushFailure("Expected "+this.expected+" assertions, but "+this.assertions.length+" were run",this.stack):this.expected==null&&!this.assertions.length&&t.pushFailure("Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.",this.stack);var r,i,s,o,u,a,l=this,c=0,h=0,p=x("qunit-tests");n.stats.all+=this.assertions.length,n.moduleStats.all+=this.assertions.length;if(p){a=document.createElement("ol");for(o=0;o<this.assertions.length;o++)r=this.assertions[o],u=document.createElement("li"),u.className=r.result?"pass":"fail",u.innerHTML=r.message||(r.result?"okay":"failed"),a.appendChild(u),r.result?c++:(h++,n.stats.bad++,n.moduleStats.bad++);t.config.reorder&&f.sessionStorage&&(h?sessionStorage.setItem("qunit-test-"+this.module+"-"+this.testName,h):sessionStorage.removeItem("qunit-test-"+this.module+"-"+this.testName)),h===0&&(a.style.display="none"),s=document.createElement("strong"),s.innerHTML=this.name+" <b class='counts'>(<b class='failed'>"+h+"</b>, <b class='passed'>"+c+"</b>, "+this.assertions.length+")</b>",S(s,"click",function(){var e=s.nextSibling.nextSibling,t=e.style.display;e.style.display=t==="none"?"block":"none"}),S(s,"dblclick",function(n){var r=n&&n.target?n.target:e.event.srcElement;if(r.nodeName.toLowerCase()=="span"||r.nodeName.toLowerCase()=="b")r=r.parentNode;e.location&&r.nodeName.toLowerCase()==="strong"&&(e.location=t.url({testNumber:l.testNumber}))}),u=x(this.id),u.className=h?"fail":"pass",u.removeChild(u.firstChild),i=u.firstChild,u.appendChild(s),u.appendChild(i),u.appendChild(a)}else for(o=0;o<this.assertions.length;o++)this.assertions[o].result||(h++,n.stats.bad++,n.moduleStats.bad++);N("testDone",t,{name:this.testName,module:this.module,failed:h,passed:this.assertions.length-h,total:this.assertions.length}),t.reset(),n.current=undefined},queue:function(){function r(){m(function(){n.setup()}),m(function(){n.run()}),m(function(){n.teardown()}),m(function(){n.finish()})}var e,n=this;m(function(){n.init()}),e=t.config.reorder&&f.sessionStorage&&+sessionStorage.getItem("qunit-test-"+this.module+"-"+this.testName),e?r():m(r,!0)}},t={module:function(e,t){n.currentModule=e,n.currentModuleTestEnvironment=t,n.modules[e]=!0},asyncTest:function(e,n,r){arguments.length===2&&(r=n,n=null),t.test(e,n,r,!0)},test:function(e,t,r,i){var s,o="<span class='test-name'>"+v(e)+"</span>";arguments.length===2&&(r=t,t=null),n.currentModule&&(o="<span class='module-name'>"+n.currentModule+"</span>: "+o),s=new l({name:o,testName:e,expected:t,async:i,callback:r,module:n.currentModule,moduleTestEnvironment:n.currentModuleTestEnvironment,stack:d(2)});if(!h(s))return;s.queue()},expect:function(e){if(arguments.length!==1)return n.current.expected;n.current.expected=e},start:function(t){n.semaphore-=t||1;if(n.semaphore>0)return;n.semaphore<0&&(n.semaphore=0),f.setTimeout?e.setTimeout(function(){if(n.semaphore>0)return;n.timeout&&clearTimeout(n.timeout),n.blocking=!1,g(!0)},13):(n.blocking=!1,g(!0))},stop:function(r){n.semaphore+=r||1,n.blocking=!0,n.testTimeout&&f.setTimeout&&(clearTimeout(n.timeout),n.timeout=e.setTimeout(function(){t.ok(!1,"Test timed out"),n.semaphore=1,t.start()},n.testTimeout))}},t.assert={ok:function(e,r){if(!n.current)throw new Error("ok() assertion outside test context, was "+d(2));e=!!e;var i,s={module:n.current.module,name:n.current.testName,result:e,message:r};r=v(r||(e?"okay":"failed")),r="<span class='test-message'>"+r+"</span>",e||(i=d(2),i&&(s.source=i,r+="<table><tr class='test-source'><th>Source: </th><td><pre>"+v(i)+"</pre></td></tr></table>")),N("log",t,s),n.current.assertions.push({result:e,message:r})},equal:function(e,n,r){t.push(n==e,e,n,r)},notEqual:function(e,n,r){t.push(n!=e,e,n,r)},deepEqual:function(e,n,r){t.push(t.equiv(e,n),e,n,r)},notDeepEqual:function(e,n,r){t.push(!t.equiv(e,n),e,n,r)},strictEqual:function(e,n,r){t.push(n===e,e,n,r)},notStrictEqual:function(e,n,r){t.push(n!==e,e,n,r)},"throws":function(e,r,i){var s,o=!1;typeof r=="string"&&(i=r,r=null),n.current.ignoreGlobalErrors=!0;try{e.call(n.current.testEnvironment)}catch(u){s=u}n.current.ignoreGlobalErrors=!1,s?(r?t.objectType(r)==="regexp"?o=r.test(s):s instanceof r?o=!0:r.call({},s)===!0&&(o=!0):o=!0,t.push(o,s,null,i)):t.pushFailure(i,null,"No exception was thrown.")}},E(t,t.assert),t.raises=t.assert.throws,t.equals=function(){t.push(!1,!1,!1,"QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead")},t.same=function(){t.push(!1,!1,!1,"QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead")},function(){function e(){}e.prototype=t,t=new e,t.constructor=e}(),n={queue:[],blocking:!0,hidepassed:!1,reorder:!0,altertitle:!0,requireExpects:!1,urlConfig:[{id:"noglobals",label:"Check for Globals",tooltip:"Enabling this will test if any test introduces new properties on the `window` object. Stored as query-strings."},{id:"notrycatch",label:"No try-catch",tooltip:"Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings."}],modules:{},begin:[],done:[],log:[],testStart:[],testDone:[],moduleStart:[],moduleDone:[]},function(){var r,i=e.location||{search:"",protocol:"file:"},s=i.search.slice(1).split("&"),o=s.length,u={},a;if(s[0])for(r=0;r<o;r++)a=s[r].split("="),a[0]=decodeURIComponent(a[0]),a[1]=a[1]?decodeURIComponent(a[1]):!0,u[a[0]]=a[1];t.urlParams=u,n.filter=u.filter,n.module=u.module,n.testNumber=parseInt(u.testNumber,10)||null,t.isLocal=i.protocol==="file:"}(),typeof exports=="undefined"&&(E(e,t),e.QUnit=t),E(t,{config:n,init:function(){E(n,{stats:{all:0,bad:0},moduleStats:{all:0,bad:0},started:+(new a),updateRate:1e3,blocking:!1,autostart:!0,autorun:!1,filter:"",queue:[],semaphore:0});var e,t,r,i=x("qunit");i&&(i.innerHTML="<h1 id='qunit-header'>"+v(document.title)+"</h1>"+"<h2 id='qunit-banner'></h2>"+"<div id='qunit-testrunner-toolbar'></div>"+"<h2 id='qunit-userAgent'></h2>"+"<ol id='qunit-tests'></ol>"),e=x("qunit-tests"),t=x("qunit-banner"),r=x("qunit-testresult"),e&&(e.innerHTML=""),t&&(t.className=""),r&&r.parentNode.removeChild(r),e&&(r=document.createElement("p"),r.id="qunit-testresult",r.className="result",e.parentNode.insertBefore(r,e),r.innerHTML="Running...<br/> ")},reset:function(){var e=x("qunit-fixture");e&&(e.innerHTML=n.fixture)},triggerEvent:function(e,t,n){document.createEvent?(n=document.createEvent("MouseEvents"),n.initMouseEvent(t,!0,!0,e.ownerDocument.defaultView,0,0,0,0,0,!1,!1,!1,!1,0,null),e.dispatchEvent(n)):e.fireEvent&&e.fireEvent("on"+t)},is:function(e,n){return t.objectType(n)==e},objectType:function(e){if(typeof e=="undefined")return"undefined";if(e===null)return"null";var t=o.call(e).match(/^\[object\s(.*)\]$/)[1]||"";switch(t){case"Number":if(isNaN(e))return"nan";return"number";case"String":case"Boolean":case"Array":case"Date":case"RegExp":case"Function":return t.toLowerCase()}return typeof e=="object"?"object":undefined},push:function(e,r,i,s){if(!n.current)throw new Error("assertion outside test context, was "+d());var o,u,a={module:n.current.module,name:n.current.testName,result:e,message:s,actual:r,expected:i};s=v(s)||(e?"okay":"failed"),s="<span class='test-message'>"+s+"</span>",o=s,e||(i=v(t.jsDump.parse(i)),r=v(t.jsDump.parse(r)),o+="<table><tr class='test-expected'><th>Expected: </th><td><pre>"+i+"</pre></td></tr>",r!=i&&(o+="<tr class='test-actual'><th>Result: </th><td><pre>"+r+"</pre></td></tr>",o+="<tr class='test-diff'><th>Diff: </th><td><pre>"+t.diff(i,r)+"</pre></td></tr>"),u=d(),u&&(a.source=u,o+="<tr class='test-source'><th>Source: </th><td><pre>"+v(u)+"</pre></td></tr>"),o+="</table>"),N("log",t,a),n.current.assertions.push({result:!!e,message:o})},pushFailure:function(e,r,i){if(!n.current)throw new Error("pushFailure() assertion outside test context, was "+d(2));var s,o={module:n.current.module,name:n.current.testName,result:!1,message:e};e=v(e)||"error",e="<span class='test-message'>"+e+"</span>",s=e,s+="<table>",i&&(s+="<tr class='test-actual'><th>Result: </th><td><pre>"+v(i)+"</pre></td></tr>"),r&&(o.source=r,s+="<tr class='test-source'><th>Source: </th><td><pre>"+v(r)+"</pre></td></tr>"),s+="</table>",N("log",t,o),n.current.assertions.push({result:!1,message:s})},url:function(n){n=E(E({},t.urlParams),n);var r,i="?";for(r in n){if(!u.call(n,r))continue;i+=encodeURIComponent(r)+"="+encodeURIComponent(n[r])+"&"}return e.location.pathname+i.slice(0,-1)},extend:E,id:x,addEvent:S}),E(t.constructor.prototype,{begin:T("begin"),done:T("done"),log:T("log"),testStart:T("testStart"),testDone:T("testDone"),moduleStart:T("moduleStart"),moduleDone:T("moduleDone")});if(typeof document=="undefined"||document.readyState==="complete")n.autorun=!0;t.load=function(){N("begin",t,{});var r,i,s,o,u,a,l,c,h,p,d,v,m=0,g="",y="",b=E({},n);t.init(),E(n,b),n.blocking=!1,u=n.urlConfig.length;for(s=0;s<u;s++)p=n.urlConfig[s],typeof p=="string"&&(p={id:p,label:p,tooltip:"[no tooltip available]"}),n[p.id]=t.urlParams[p.id],y+="<input id='qunit-urlconfig-"+p.id+"' name='"+p.id+"' type='checkbox'"+(n[p.id]?" checked='checked'":"")+" title='"+p.tooltip+"'><label for='qunit-urlconfig-"+p.id+"' title='"+p.tooltip+"'>"+p.label+"</label>";g+="<label for='qunit-modulefilter'>Module: </label><select id='qunit-modulefilter' name='modulefilter'><option value='' "+(n.module===undefined?"selected":"")+">< All Modules ></option>";for(s in n.modules)n.modules.hasOwnProperty(s)&&(m+=1,g+="<option value='"+encodeURIComponent(s)+"' "+(n.module===s?"selected":"")+">"+s+"</option>");g+="</select>",h=x("qunit-userAgent"),h&&(h.innerHTML=navigator.userAgent),r=x("qunit-header"),r&&(r.innerHTML="<a href='"+t.url({filter:undefined,module:undefined,testNumber:undefined})+"'>"+r.innerHTML+"</a> "),c=x("qunit-testrunner-toolbar");if(c){i=document.createElement("input"),i.type="checkbox",i.id="qunit-filter-pass",S(i,"click",function(){var e,t=document.getElementById("qunit-tests");i.checked?t.className=t.className+" hidepass":(e=" "+t.className.replace(/[\n\t\r]/g," ")+" ",t.className=e.replace(/ hidepass /," ")),f.sessionStorage&&(i.checked?sessionStorage.setItem("qunit-filter-passed-tests","true"):sessionStorage.removeItem("qunit-filter-passed-tests"))});if(n.hidepassed||f.sessionStorage&&sessionStorage.getItem("qunit-filter-passed-tests"))i.checked=!0,l=document.getElementById("qunit-tests"),l.className=l.className+" hidepass";c.appendChild(i),o=document.createElement("label"),o.setAttribute("for","qunit-filter-pass"),o.setAttribute("title","Only show tests and assertons that fail. Stored in sessionStorage."),o.innerHTML="Hide passed tests",c.appendChild(o),d=document.createElement("span"),d.innerHTML=y,S(d,"change",function(n){var r={};r[n.target.name]=n.target.checked?!0:undefined,e.location=t.url(r)}),c.appendChild(d),m>1&&(v=document.createElement("span"),v.setAttribute("id","qunit-modulefilter-container"),v.innerHTML=g,S(v,"change",function(){var n=v.getElementsByTagName("select")[0],r=decodeURIComponent(n.options[n.selectedIndex].value);e.location=t.url({module:r===""?undefined:r})}),c.appendChild(v))}a=x("qunit-fixture"),a&&(n.fixture=a.innerHTML),n.autostart&&t.start()},S(e,"load",t.load),r=e.onerror,e.onerror=function(e,n,i){var s=!1;r&&(s=r(e,n,i));if(s!==!0){if(t.config.current){if(t.config.current.ignoreGlobalErrors)return!0;t.pushFailure(e,n+":"+i)}else t.test("global failure",E(function(){t.pushFailure(e,n+":"+i)},{validTest:h}));return!1}return s},t.equiv=function(){function e(e,n,r){var i=t.objectType(e);if(i)return t.objectType(n[i])==="function"?n[i].apply(n,r):n[i]}var n,r=[],i=[],s=Object.getPrototypeOf||function(e){return e.__proto__},o=function(){function e(e,t){return e instanceof t.constructor||t instanceof e.constructor?t==e:t===e}return{string:e,"boolean":e,number:e,"null":e,"undefined":e,nan:function(e){return isNaN(e)},date:function(e,n){return t.objectType(e)==="date"&&n.valueOf()===e.valueOf()},regexp:function(e,n){return t.objectType(e)==="regexp"&&n.source===e.source&&n.global===e.global&&n.ignoreCase===e.ignoreCase&&n.multiline===e.multiline&&n.sticky===e.sticky},"function":function(){var e=r[r.length-1];return e!==Object&&typeof e!="undefined"},array:function(e,r){var s,o,u,a;if(t.objectType(e)!=="array")return!1;u=r.length;if(u!==e.length)return!1;i.push(r);for(s=0;s<u;s++){a=!1;for(o=0;o<i.length;o++)i[o]===r[s]&&(a=!0);if(!a&&!n(r[s],e[s]))return i.pop(),!1}return i.pop(),!0},object:function(e,t){var o,u,a,f=!0,l=[],c=[];if(t.constructor===e.constructor||s(t)===null&&s(e)===Object.prototype||s(e)===null&&s(t)===Object.prototype){r.push(t.constructor),i.push(t);for(o in t){a=!1;for(u=0;u<i.length;u++)i[u]===t[o]&&(a=!0);l.push(o);if(!a&&!n(t[o],e[o])){f=!1;break}}r.pop(),i.pop();for(o in e)c.push(o);return f&&n(l.sort(),c.sort())}return!1}}}();return n=function(){var n=[].slice.apply(arguments);return n.length<2?!0:function(n,r){return n===r?!0:n===null||r===null||typeof n=="undefined"||typeof r=="undefined"||t.objectType(n)!==t.objectType(r)?!1:e(n,o,[r,n])}(n[0],n[1])&&arguments.callee.apply(this,n.splice(1,n.length-1))},n}(),t.jsDump=function(){function e(e){return'"'+e.toString().replace(/"/g,'\\"')+'"'}function n(e){return e+""}function r(e,t,n){var r=u.separator(),i=u.indent(),s=u.indent(1);return t.join&&(t=t.join(","+r+s)),t?[e,s+t,i+n].join(r):e+n}function i(e,t){var n=e.length,i=new Array(n);this.up();while(n--)i[n]=this.parse(e[n],undefined,t);return this.down(),r("[",i,"]")}var s=/^function (\w+)/,u={parse:function(e,t,n){n=n||[];var r,i,s=this.parsers[t||this.typeOf(e)];return t=typeof s,r=k(e,n),r!=-1?"recursion("+(r-n.length)+")":t=="function"?(n.push(e),i=s.call(this,e,n),n.pop(),i):t=="string"?s:this.parsers.error},typeOf:function(e){var n;return e===null?n="null":typeof e=="undefined"?n="undefined":t.is("regexp",e)?n="regexp":t.is("date",e)?n="date":t.is("function",e)?n="function":typeof e.setInterval!==undefined&&typeof e.document!="undefined"&&typeof e.nodeType=="undefined"?n="window":e.nodeType===9?n="document":e.nodeType?n="node":o.call(e)==="[object Array]"||typeof e.length=="number"&&typeof e.item!="undefined"&&(e.length?e.item(0)===e[0]:e.item(0)===null&&typeof e[0]=="undefined")?n="array":n=typeof e,n},separator:function(){return this.multiline?this.HTML?"<br />":"\n":this.HTML?" ":" "},indent:function(e){if(!this.multiline)return"";var t=this.indentChar;return this.HTML&&(t=t.replace(/\t/g," ").replace(/ /g," ")),(new Array(this._depth_+(e||0))).join(t)},up:function(e){this._depth_+=e||1},down:function(e){this._depth_-=e||1},setParser:function(e,t){this.parsers[e]=t},quote:e,literal:n,join:r,_depth_:1,parsers:{window:"[Window]",document:"[Document]",error:"[ERROR]",unknown:"[Unknown]","null":"null","undefined":"undefined","function":function(e){var n="function",i="name"in e?e.name:(s.exec(e)||[])[1];return i&&(n+=" "+i),n+="( ",n=[n,t.jsDump.parse(e,"functionArgs"),"){"].join(""),r(n,t.jsDump.parse(e,"functionCode"),"}")},array:i,nodelist:i,arguments:i,object:function(e,n){var i=[],s,o,u,a;t.jsDump.up();if(Object.keys)s=Object.keys(e);else{s=[];for(o in e)s.push(o)}s.sort();for(a=0;a<s.length;a++)o=s[a],u=e[o],i.push(t.jsDump.parse(o,"key")+": "+t.jsDump.parse(u,undefined,n));return t.jsDump.down(),r("{",i,"}")},node:function(e){var n,r,i=t.jsDump.HTML?"<":"<",s=t.jsDump.HTML?">":">",o=e.nodeName.toLowerCase(),u=i+o;for(n in t.jsDump.DOMAttrs)r=e[t.jsDump.DOMAttrs[n]],r&&(u+=" "+n+"="+t.jsDump.parse(r,"attribute"));return u+s+i+"/"+o+s},functionArgs:function(e){var t,n=e.length;if(!n)return"";t=new Array(n);while(n--)t[n]=String.fromCharCode(97+n);return" "+t.join(", ")+" "},key:e,functionCode:"[code]",attribute:e,string:e,date:e,regexp:n,number:n,"boolean":n},DOMAttrs:{id:"id",name:"name","class":"className"},HTML:!1,indentChar:" ",multiline:!0};return u}(),t.diff=function(){function e(e,t){var n,r={},i={};for(n=0;n<t.length;n++)r[t[n]]==null&&(r[t[n]]={rows:[],o:null}),r[t[n]].rows.push(n);for(n=0;n<e.length;n++)i[e[n]]==null&&(i[e[n]]={rows:[],n:null}),i[e[n]].rows.push(n);for(n in r){if(!u.call(r,n))continue;r[n].rows.length==1&&typeof i[n]!="undefined"&&i[n].rows.length==1&&(t[r[n].rows[0]]={text:t[r[n].rows[0]],row:i[n].rows[0]},e[i[n].rows[0]]={text:e[i[n].rows[0]],row:r[n].rows[0]})}for(n=0;n<t.length-1;n++)t[n].text!=null&&t[n+1].text==null&&t[n].row+1<e.length&&e[t[n].row+1].text==null&&t[n+1]==e[t[n].row+1]&&(t[n+1]={text:t[n+1],row:t[n].row+1},e[t[n].row+1]={text:e[t[n].row+1],row:n+1});for(n=t.length-1;n>0;n--)t[n].text!=null&&t[n-1].text==null&&t[n].row>0&&e[t[n].row-1].text==null&&t[n-1]==e[t[n].row-1]&&(t[n-1]={text:t[n-1],row:t[n].row-1},e[t[n].row-1]={text:e[t[n].row-1],row:n-1});return{o:e,n:t}}return function(t,n){t=t.replace(/\s+$/,""),n=n.replace(/\s+$/,"");var r,i,s="",o=e(t===""?[]:t.split(/\s+/),n===""?[]:n.split(/\s+/)),u=t.match(/\s+/g),a=n.match(/\s+/g);u==null?u=[" "]:u.push(" "),a==null?a=[" "]:a.push(" ");if(o.n.length===0)for(r=0;r<o.o.length;r++)s+="<del>"+o.o[r]+u[r]+"</del>";else{if(o.n[0].text==null)for(n=0;n<o.o.length&&o.o[n].text==null;n++)s+="<del>"+o.o[n]+u[n]+"</del>";for(r=0;r<o.n.length;r++)if(o.n[r].text==null)s+="<ins>"+o.n[r]+a[r]+"</ins>";else{i="";for(n=o.n[r].row+1;n<o.o.length&&o.o[n].text==null;n++)i+="<del>"+o.o[n]+u[n]+"</del>";s+=" "+o.n[r].text+a[r]+i}}return s}}(),typeof exports!="undefined"&&E(exports,t)})(function(){return this}.call())
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/renderTerminator.js b/src/main/webapp/javascripts_min/libs/renderTerminator.js new file mode 100644 index 0000000..6cde68b --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/renderTerminator.js @@ -0,0 +1 @@ +define([],function(){var e=function(e,t){var n=e.find(".terminator a.btn");n.html(n.html().replace(/\[ .+ \]/,"[ "+t+" ]")),e.find(".terminator").data("statement_separator",t)};return e})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/underscore.js b/src/main/webapp/javascripts_min/libs/underscore.js new file mode 100644 index 0000000..74339e6 --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/underscore.js @@ -0,0 +1,9 @@ +// Underscore.js 1.3.3 +// (c) 2009-2012 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(){function L(e,t,n){if(e===t)return e!==0||1/e==1/t;if(e==null||t==null)return e===t;e._chain&&(e=e._wrapped),t._chain&&(t=t._wrapped);if(e.isEqual&&x.isFunction(e.isEqual))return e.isEqual(t);if(t.isEqual&&x.isFunction(t.isEqual))return t.isEqual(e);var r=f.call(e);if(r!=f.call(t))return!1;switch(r){case"[object String]":return e==String(t);case"[object Number]":return e!=+e?t!=+t:e==0?1/e==1/t:e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if(typeof e!="object"||typeof t!="object")return!1;var i=n.length;while(i--)if(n[i]==e)return!0;n.push(e);var s=0,o=!0;if(r=="[object Array]"){s=e.length,o=s==t.length;if(o)while(s--)if(!(o=s in e==s in t&&L(e[s],t[s],n)))break}else{if("constructor"in e!="constructor"in t||e.constructor!=t.constructor)return!1;for(var u in e)if(x.has(e,u)){s++;if(!(o=x.has(t,u)&&L(e[u],t[u],n)))break}if(o){for(u in t)if(x.has(t,u)&&!(s--))break;o=!s}}return n.pop(),o}var e=this,t=e._,n={},r=Array.prototype,i=Object.prototype,s=Function.prototype,o=r.push,u=r.slice,a=r.unshift,f=i.toString,l=i.hasOwnProperty,c=r.forEach,h=r.map,p=r.reduce,d=r.reduceRight,v=r.filter,m=r.every,g=r.some,y=r.indexOf,b=r.lastIndexOf,w=Array.isArray,E=Object.keys,S=s.bind,x=function(e){return new F(e)};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=x),exports._=x):e._=x,x.VERSION="1.3.3";var T=x.each=x.forEach=function(e,t,r){if(e==null)return;if(c&&e.forEach===c)e.forEach(t,r);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(t.call(r,e[i],i,e)===n)return}else for(var o in e)if(x.has(e,o)&&t.call(r,e[o],o,e)===n)return};x.map=x.collect=function(e,t,n){var r=[];return e==null?r:h&&e.map===h?e.map(t,n):(T(e,function(e,i,s){r[r.length]=t.call(n,e,i,s)}),r)},x.reduce=x.foldl=x.inject=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(p&&e.reduce===p)return r&&(t=x.bind(t,r)),i?e.reduce(t,n):e.reduce(t);T(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)});if(!i)throw new TypeError("Reduce of empty array with no initial value");return n},x.reduceRight=x.foldr=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(d&&e.reduceRight===d)return r&&(t=x.bind(t,r)),i?e.reduceRight(t,n):e.reduceRight(t);var s=x.toArray(e).reverse();return r&&!i&&(t=x.bind(t,r)),i?x.reduce(s,t,n,r):x.reduce(s,t)},x.find=x.detect=function(e,t,n){var r;return N(e,function(e,i,s){if(t.call(n,e,i,s))return r=e,!0}),r},x.filter=x.select=function(e,t,n){var r=[];return e==null?r:v&&e.filter===v?e.filter(t,n):(T(e,function(e,i,s){t.call(n,e,i,s)&&(r[r.length]=e)}),r)},x.reject=function(e,t,n){var r=[];return e==null?r:(T(e,function(e,i,s){t.call(n,e,i,s)||(r[r.length]=e)}),r)},x.every=x.all=function(e,t,r){var i=!0;return e==null?i:m&&e.every===m?e.every(t,r):(T(e,function(e,s,o){if(!(i=i&&t.call(r,e,s,o)))return n}),!!i)};var N=x.some=x.any=function(e,t,r){t||(t=x.identity);var i=!1;return e==null?i:g&&e.some===g?e.some(t,r):(T(e,function(e,s,o){if(i||(i=t.call(r,e,s,o)))return n}),!!i)};x.include=x.contains=function(e,t){var n=!1;return e==null?n:y&&e.indexOf===y?e.indexOf(t)!=-1:(n=N(e,function(e){return e===t}),n)},x.invoke=function(e,t){var n=u.call(arguments,2);return x.map(e,function(e){return(x.isFunction(t)?t:e[t]).apply(e,n)})},x.pluck=function(e,t){return x.map(e,function(e){return e[t]})},x.max=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!t&&x.isEmpty(e))return-Infinity;var r={computed:-Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o>=r.computed&&(r={value:e,computed:o})}),r.value},x.min=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!t&&x.isEmpty(e))return Infinity;var r={computed:Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o<r.computed&&(r={value:e,computed:o})}),r.value},x.shuffle=function(e){var t,n=0,r=[];return T(e,function(e){t=Math.floor(Math.random()*++n),r[n-1]=r[t],r[t]=e}),r},x.sortBy=function(e,t,n){var r=x.isFunction(t)?t:function(e){return e[t]};return x.pluck(x.map(e,function(e,t,i){return{value:e,criteria:r.call(n,e,t,i)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;return n===void 0?1:r===void 0?-1:n<r?-1:n>r?1:0}),"value")},x.groupBy=function(e,t){var n={},r=x.isFunction(t)?t:function(e){return e[t]};return T(e,function(e,t){var i=r(e,t);(n[i]||(n[i]=[])).push(e)}),n},x.sortedIndex=function(e,t,n){n||(n=x.identity);var r=n(t),i=0,s=e.length;while(i<s){var o=i+s>>1;n(e[o])<r?i=o+1:s=o}return i},x.toArray=function(e){return e?x.isArray(e)?u.call(e):x.isArguments(e)?u.call(e):e.toArray&&x.isFunction(e.toArray)?e.toArray():x.values(e):[]},x.size=function(e){return x.isArray(e)?e.length:x.keys(e).length},x.first=x.head=x.take=function(e,t,n){return t!=null&&!n?u.call(e,0,t):e[0]},x.initial=function(e,t,n){return u.call(e,0,e.length-(t==null||n?1:t))},x.last=function(e,t,n){return t!=null&&!n?u.call(e,Math.max(e.length-t,0)):e[e.length-1]},x.rest=x.tail=function(e,t,n){return u.call(e,t==null||n?1:t)},x.compact=function(e){return x.filter(e,function(e){return!!e})};var C=function(e,t,n){return T(e,function(e){x.isArray(e)?t?o.apply(n,e):C(e,t,n):n.push(e)}),n};x.flatten=function(e,t){return C(e,t,[])},x.without=function(e){return x.difference(e,u.call(arguments,1))},x.uniq=x.unique=function(e,t,n){var r=n?x.map(e,n):e,i=[];return x.reduce(r,function(n,r,s){if(t?x.last(n)!==r||!n.length:!x.include(n,r))n.push(r),i.push(e[s]);return n},[]),i},x.union=function(){return x.uniq(C(arguments,!0,[]))},x.intersection=function(e){var t=u.call(arguments,1);return x.filter(x.uniq(e),function(e){return x.every(t,function(t){return x.indexOf(t,e)>=0})})},x.difference=function(e){var t=C(u.call(arguments,1),!0,[]);return x.filter(e,function(e){return!x.include(t,e)})},x.zip=function(){var e=u.call(arguments),t=x.max(x.pluck(e,"length")),n=new Array(t);for(var r=0;r<t;r++)n[r]=x.pluck(e,""+r);return n},x.zipObject=function(e,t){var n={};for(var r=0,i=e.length;r<i;r++)n[e[r]]=t[r];return n},x.indexOf=function(e,t,n){if(e==null)return-1;var r,i;if(n)return r=x.sortedIndex(e,t),e[r]===t?r:-1;if(y&&e.indexOf===y)return e.indexOf(t);for(r=0,i=e.length;r<i;r++)if(e[r]===t)return r;return-1},x.lastIndexOf=function(e,t){if(e==null)return-1;if(b&&e.lastIndexOf===b)return e.lastIndexOf(t);var n=e.length;while(n--)if(e[n]===t)return n;return-1},x.range=function(e,t,n){arguments.length<=1&&(t=e||0,e=0),n=arguments[2]||1;var r=Math.max(Math.ceil((t-e)/n),0),i=0,s=new Array(r);while(i<r)s[i++]=e,e+=n;return s};var k=function(){};x.bind=function(t,n){var r,i;if(t.bind===S&&S)return S.apply(t,u.call(arguments,1));if(!x.isFunction(t))throw new TypeError;return i=u.call(arguments,2),r=function(){if(this instanceof r){k.prototype=t.prototype;var e=new k,s=t.apply(e,i.concat(u.call(arguments)));return Object(s)===s?s:e}return t.apply(n,i.concat(u.call(arguments)))}},x.bindAll=function(e){var t=u.call(arguments,1);return t.length==0&&(t=x.functions(e)),T(t,function(t){e[t]=x.bind(e[t],e)}),e},x.memoize=function(e,t){var n={};return t||(t=x.identity),function(){var r=t.apply(this,arguments);return x.has(n,r)?n[r]:n[r]=e.apply(this,arguments)}},x.delay=function(e,t){var n=u.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},x.defer=function(e){return x.delay.apply(x,[e,1].concat(u.call(arguments,1)))},x.throttle=function(e,t){var n,r,i,s,o,u,a=x.debounce(function(){o=s=!1},t);return function(){n=this,r=arguments;var f=function(){i=null,o&&e.apply(n,r),a()};return i||(i=setTimeout(f,t)),s?o=!0:(s=!0,u=e.apply(n,r)),a(),u}},x.debounce=function(e,t,n){var r;return function(){var i=this,s=arguments,o=function(){r=null,n||e.apply(i,s)},u=n&&!r;clearTimeout(r),r=setTimeout(o,t),u&&e.apply(i,s)}},x.once=function(e){var t=!1,n;return function(){return t?n:(t=!0,n=e.apply(this,arguments))}},x.wrap=function(e,t){return function(){var n=[e].concat(u.call(arguments,0));return t.apply(this,n)}},x.compose=function(){var e=arguments;return function(){var t=arguments;for(var n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},x.after=function(e,t){return e<=0?t():function(){if(--e<1)return t.apply(this,arguments)}},x.keys=E||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)x.has(e,n)&&(t[t.length]=n);return t},x.values=function(e){return x.map(e,x.identity)},x.functions=x.methods=function(e){var t=[];for(var n in e)x.isFunction(e[n])&&t.push(n);return t.sort()},x.extend=function(e){return T(u.call(arguments,1),function(t){for(var n in t)e[n]=t[n]}),e},x.pick=function(e){var t={};return T(C(u.call(arguments,1),!0,[]),function(n){n in e&&(t[n]=e[n])}),t},x.defaults=function(e){return T(u.call(arguments,1),function(t){for(var n in t)e[n]==null&&(e[n]=t[n])}),e},x.clone=function(e){return x.isObject(e)?x.isArray(e)?e.slice():x.extend({},e):e},x.tap=function(e,t){return t(e),e},x.isEqual=function(e,t){return L(e,t,[])},x.isEmpty=function(e){if(e==null)return!0;if(x.isArray(e)||x.isString(e))return e.length===0;for(var t in e)if(x.has(e,t))return!1;return!0},x.isElement=function(e){return!!e&&e.nodeType==1},x.isArray=w||function(e){return f.call(e)=="[object Array]"},x.isObject=function(e){return e===Object(e)},T(["Arguments","Function","String","Number","Date","RegExp"],function(e){x["is"+e]=function(t){return f.call(t)=="[object "+e+"]"}}),x.isArguments(arguments)||(x.isArguments=function(e){return!!e&&!!x.has(e,"callee")}),x.isFinite=function(e){return x.isNumber(e)&&isFinite(e)},x.isNaN=function(e){return e!==e},x.isBoolean=function(e){return e===!0||e===!1||f.call(e)=="[object Boolean]"},x.isNull=function(e){return e===null},x.isUndefined=function(e){return e===void 0},x.has=function(e,t){return l.call(e,t)},x.noConflict=function(){return e._=t,this},x.identity=function(e){return e},x.times=function(e,t,n){for(var r=0;r<e;r++)t.call(n,r)};var A={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},O=/[&<>"'\/]/g;x.escape=function(e){return(""+e).replace(O,function(e){return A[e]})},x.result=function(e,t){if(e==null)return null;var n=e[t];return x.isFunction(n)?n.call(e):n},x.mixin=function(e){T(x.functions(e),function(t){q(t,x[t]=e[t])})};var M=0;x.uniqueId=function(e){var t=M++;return e?e+t:t},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var _=/.^/,D={"\\":"\\","'":"'",r:"\r",n:"\n",t:" ",u2028:"\u2028",u2029:"\u2029"};for(var P in D)D[D[P]]=P;var H=/\\|'|\r|\n|\t|\u2028|\u2029/g,B=/\\(\\|'|r|n|t|u2028|u2029)/g,j=function(e){return e.replace(B,function(e,t){return D[t]})};x.template=function(e,t,n){n=x.defaults(n||{},x.templateSettings);var r="__p+='"+e.replace(H,function(e){return"\\"+D[e]}).replace(n.escape||_,function(e,t){return"'+\n((__t=("+j(t)+"))==null?'':_.escape(__t))+\n'"}).replace(n.interpolate||_,function(e,t){return"'+\n((__t=("+j(t)+"))==null?'':__t)+\n'"}).replace(n.evaluate||_,function(e,t){return"';\n"+j(t)+"\n__p+='"})+"';\n";n.variable||(r="with(obj||{}){\n"+r+"}\n"),r="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'')};\n"+r+"return __p;\n";var i=new Function(n.variable||"obj","_",r);if(t)return i(t,x);var s=function(e){return i.call(this,e,x)};return s.source="function("+(n.variable||"obj")+"){\n"+r+"}",s},x.chain=function(e){return x(e).chain()};var F=function(e){this._wrapped=e};x.prototype=F.prototype;var I=function(e,t){return t?x(e).chain():e},q=function(e,t){F.prototype[e]=function(){var e=u.call(arguments);return a.call(e,this._wrapped),I(t.apply(x,e),this._chain)}};x.mixin(x),T(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=r[e];F.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),(e=="shift"||e=="splice")&&n.length===0&&delete n[0],I(n,this._chain)}}),T(["concat","join","slice"],function(e){var t=r[e];F.prototype[e]=function(){return I(t.apply(this._wrapped,arguments),this._chain)}}),F.prototype.chain=function(){return this._chain=!0,this},F.prototype.value=function(){return this._wrapped}}).call(this)
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/xplans/mssql.js b/src/main/webapp/javascripts_min/libs/xplans/mssql.js new file mode 100644 index 0000000..5a58c2f --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/xplans/mssql.js @@ -0,0 +1 @@ +if(typeof QP=="undefined"||!QP)var QP={};(function(){function e(e){var r=t(e),i=r[0];i.getContext!==null&&i.getContext!==undefined&&window.setTimeout(function(){var t=i.getContext("2d"),s=$(".qp-tr",e);i.width=s.outerWidth(!0),i.height=s.outerHeight(!0);var o=r.offset();$(".qp-tr",e).each(function(){var e=$("> * > .qp-node",$(this));$("> * > .qp-tr > * > .qp-node",$(this)).each(function(){n(t,o,e,$(this))})}),t.stroke()},1)}function t(e){var t=$("canvas",e);return t.length==0&&(e.prepend($("<canvas></canvas>").css("position","absolute").css("top",0).css("left",0)),t=$("canvas",e)),t}function n(e,t,n,r){var i=n.offset();i.top+=n.outerHeight()/2,i.left+=n.outerWidth();var s=r.offset();s.top+=r.outerHeight()/2;var o=i.left/2+s.left/2;e.moveTo(i.left-t.left,i.top-t.top),e.lineTo(o-t.left,i.top-t.top),e.lineTo(o-t.left,s.top-t.top),e.lineTo(s.left-t.left,s.top-t.top)}QP.drawLines=function(t){t===null||t===undefined?t=$(".qp-root").parent():t=$(t),e(t)}})()
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/xplans/oracle/flashver.js b/src/main/webapp/javascripts_min/libs/xplans/oracle/flashver.js new file mode 100644 index 0000000..b32522f --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/xplans/oracle/flashver.js @@ -0,0 +1 @@ +function ControlVersion(){var e,t,n;try{t=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"),e=t.GetVariable("$version")}catch(n){}if(!e)try{t=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"),e="WIN 6,0,21,0",t.AllowScriptAccess="always",e=t.GetVariable("$version")}catch(n){}if(!e)try{t=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"),e=t.GetVariable("$version")}catch(n){}if(!e)try{t=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"),e="WIN 3,0,18,0"}catch(n){}if(!e)try{t=new ActiveXObject("ShockwaveFlash.ShockwaveFlash"),e="WIN 2,0,0,11"}catch(n){e=-1}return e}function GetSwfVer(){var e=-1;if(navigator.plugins!=null&&navigator.plugins.length>0){if(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]){var t=navigator.plugins["Shockwave Flash 2.0"]?" 2.0":"",n=navigator.plugins["Shockwave Flash"+t].description,r=n.split(" "),i=r[2].split("."),s=i[0],o=i[1];r[3]!=""?tempArrayMinor=r[3].split("r"):tempArrayMinor=r[4].split("r");var u=tempArrayMinor[1]>0?tempArrayMinor[1]:0,e=s+"."+o+"."+u}}else navigator.userAgent.toLowerCase().indexOf("webtv/2.6")!=-1?e=4:navigator.userAgent.toLowerCase().indexOf("webtv/2.5")!=-1?e=3:navigator.userAgent.toLowerCase().indexOf("webtv")!=-1?e=2:isIE&&isWin&&!isOpera&&(e=ControlVersion());return e}function DetectFlashVer(e,t,n){versionStr=GetSwfVer();if(versionStr==-1)return!1;if(versionStr!=0){isIE&&isWin&&!isOpera?(tempArray=versionStr.split(" "),tempString=tempArray[1],versionArray=tempString.split(",")):versionArray=versionStr.split(".");var r=versionArray[0],i=versionArray[1],s=versionArray[2];if(r>parseFloat(e))return!0;if(r==parseFloat(e)){if(i>parseFloat(t))return!0;if(i==parseFloat(t)&&s>=parseFloat(n))return!0}return!1}}function AC_AddExtension(e,t){return e.indexOf("?")!=-1?e.replace(/\?/,t+"?"):e+t}function AC_Generateobj(e,t,n){var r="";if(isIE&&isWin&&!isOpera){r+="<object ";for(var i in e)r+=i+'="'+e[i]+'" ';for(var i in t)r+='><param name="'+i+'" value="'+t[i]+'" /> ';r+="></object>"}else{r+="<embed ";for(var i in n)r+=i+'="'+n[i]+'" ';r+="> </embed>"}return r}function AC_FL_RunContent(){var e=AC_GetArgs(arguments,".swf","movie","clsid:d27cdb6e-ae6d-11cf-96b8-444553540000","application/x-shockwave-flash");return AC_Generateobj(e.objAttrs,e.params,e.embedAttrs)}function AC_GetArgs(e,t,n,r,i){var s=new Object;s.embedAttrs=new Object,s.params=new Object,s.objAttrs=new Object;for(var o=0;o<e.length;o+=2){var u=e[o].toLowerCase();switch(u){case"classid":break;case"pluginspage":s.embedAttrs[e[o]]=e[o+1];break;case"src":case"movie":e[o+1]=AC_AddExtension(e[o+1],t),s.embedAttrs.src=e[o+1],s.params[n]=e[o+1];break;case"onafterupdate":case"onbeforeupdate":case"onblur":case"oncellchange":case"onclick":case"ondblClick":case"ondrag":case"ondragend":case"ondragenter":case"ondragleave":case"ondragover":case"ondrop":case"onfinish":case"onfocus":case"onhelp":case"onmousedown":case"onmouseup":case"onmouseover":case"onmousemove":case"onmouseout":case"onkeypress":case"onkeydown":case"onkeyup":case"onload":case"onlosecapture":case"onpropertychange":case"onreadystatechange":case"onrowsdelete":case"onrowenter":case"onrowexit":case"onrowsinserted":case"onstart":case"onscroll":case"onbeforeeditfocus":case"onactivate":case"onbeforedeactivate":case"ondeactivate":case"type":case"codebase":case"id":s.objAttrs[e[o]]=e[o+1];break;case"width":case"height":case"align":case"vspace":case"hspace":case"class":case"title":case"accesskey":case"name":case"tabindex":s.embedAttrs[e[o]]=s.objAttrs[e[o]]=e[o+1];break;default:s.embedAttrs[e[o]]=s.params[e[o]]=e[o+1]}}return s.objAttrs.classid=r,i&&(s.embedAttrs.type=i),s}var isIE=navigator.appVersion.indexOf("MSIE")!=-1?!0:!1,isWin=navigator.appVersion.toLowerCase().indexOf("win")!=-1?!0:!1,isOpera=navigator.userAgent.indexOf("Opera")!=-1?!0:!1
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/libs/xplans/oracle/loadswf.js b/src/main/webapp/javascripts_min/libs/xplans/oracle/loadswf.js new file mode 100644 index 0000000..91506dd --- /dev/null +++ b/src/main/webapp/javascripts_min/libs/xplans/oracle/loadswf.js @@ -0,0 +1 @@ +function getSearch(e){var t="";return e.location.search.length>1&&(t=new String(e.location.search),t=t.substring(1,t.length)),t}function parseVersion(e){if(typeof e!="string")return[0,0,0,0,0];var t=e.split("."),n=t[0]=="X"?999:parseInt(t[0])||0,r=t[1]=="X"?999:parseInt(t[1])||0,i=t[2]=="X"?999:parseInt(t[2])||0,s=t[3]=="X"?999:parseInt(t[3])||0,o=t[4]=="X"?999:parseInt(t[4])||0;return new Array(n,r,i,s,o)}function compareVersions(e,t){var n=parseVersion(e),r=parseVersion(t);for(var i=0;i<5;i++){if(n[i]<r[i])return 1;if(n[i]>r[i])return-1}return 0}function findViewerFile(e,t){var n=viewerMap[e];if(n==null)return!1;var r=n.length;for(var i=0;i<r;i++)if(compareVersions(n[i],t)<0)break;i!=0&&i--;var s="http://download.oracle.com/otn_software/emviewers/"+e+"/"+n[i]+"/"+e;return s}function loadswf(e){var t=e.match(/db_version="([\d\.]*)"/),n=e.match(/orarep\/(\w*)\//),r=n==null?"":n[1],i=t==null?"":t[1];r==""&&e.match(/sql_monitor_report/)&&(r="sqlmonitor",i="11");var s=Math.floor(Math.random()*1e5).toString(16);this!=top&&(top.Vars=Vars,top.getSearch=getSearch,top.lc_id=s);var o="historyUrl=history.htm%3F&lconid="+s+"&model="+encodeURIComponent(e)+"";if(hasProductInstall&&!hasRequestedVersion){var u=isIE==1?"ActiveX":"PlugIn",a=window.location;document.title=document.title.slice(0,47)+" - Flash Player Installation";var f=document.title;return AC_FL_RunContent("src","http://download.oracle.com/otn_software/emviewers/scripts/playerProductInstall","FlashVars",o,"width","100%","height","100%","align","middle","id",r,"quality","high","bgcolor","#FFFFFF","name",r,"allowScriptAccess","always","type","application/x-shockwave-flash","pluginspage","http://www.adobe.com/go/getflashplayer")}if(!hasRequestedVersion){var c="Fail to display EM Standalone report. This content requires the Adobe Flash Player. <a href=http://www.adobe.com/go/getflash/>Get Flash</a>";return c}var l=typeof viewer_swf=="string"?viewer_swf:findViewerFile(r,i);if(!!l)return AC_FL_RunContent("src",l,"width","100%","height","100%","align","middle","id",r,"quality","high","bgcolor","#FFFFFF","name",r,"flashvars",o,"allowScriptAccess","always","type","application/x-shockwave-flash","pluginspage","http://www.adobe.com/go/getflashplayer");r!=""?alert('Sorry, viewer name "'+r+'" is not yet supported...'):alert("Sorry, cannot not display report: unknown report type")}var viewerMap={sqlmonitor:["11"],sqlpa:["11"],xplan:["11"],sql_detail:["11","11.2.0.2.0"],EmergencyADDM:["11"],ComparePeriodReport:["11"],AshViewer:["11"]},requiredMajorVersion=10,requiredMinorVersion=0,requiredRevision=0,hasProductInstall=DetectFlashVer(6,0,65),hasRequestedVersion=DetectFlashVer(requiredMajorVersion,requiredMinorVersion,requiredRevision);Vars=function(e){this.numVars=0;if(e!=null){var t,n,r=e.split("&"),i=r.length;for(var s=0;s<i;s++){var o=r[s];if(o.indexOf("=")!=-1&&o.length>3){var t=o.split("="),n=t[0],u=t[1];this[n]==null&&n.length>0&&u.length>0&&(this[n]=u,this.numVars++)}}}},Vars.prototype.toString=function(e){var t="";e==null&&(e="");for(var n in this)this[n]!=null&&typeof this[n]!="object"&&typeof this[n]!="function"&&n!="numVars"&&(t+=e+n+"="+this[n]+"&");return t.length>0&&(t=t.substr(0,t.length-1)),t}
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/main.js b/src/main/webapp/javascripts_min/main.js new file mode 100644 index 0000000..ac234d2 --- /dev/null +++ b/src/main/webapp/javascripts_min/main.js @@ -0,0 +1,204 @@ +/*! + * jQuery JavaScript Library v1.7.2 + * http://jquery.com/ + * + * Copyright 2011, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Wed Mar 21 12:46:34 2012 -0700 + */ + +/*! + * Sizzle CSS Selector Engine + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ + +// Underscore.js 1.3.3 +// (c) 2009-2012 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 + +// (c) 2010-2012 Jeremy Ashkenas, DocumentCloud Inc. +// Backbone may be freely distributed under the MIT license. +// For all details and documentation: +// http://backbonejs.org + +/** + * @license RequireJS text 2.0.3 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/requirejs/text for details + */ + +/*! + * jQuery blockUI plugin + * Version 2.39 (23-MAY-2011) + * @requires jQuery v1.2.3 or later + * + * Examples at: http://malsup.com/jquery/block/ + * Copyright (c) 2007-2010 M. Alsup + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + * Thanks to Amir-Hossein Sobhi for some excellent contributions! + */ + +/*! + * jQuery Cookie Plugin + * https://github.com/carhartl/jquery-cookie + * + * Copyright 2011, Klaus Hartl + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://www.opensource.org/licenses/mit-license.php + * http://www.opensource.org/licenses/GPL-2.0 + */ + +/* ============================================================= + * bootstrap-collapse.js v2.0.4 + * http://twitter.github.com/bootstrap/javascript.html#collapse + * ============================================================= + * Copyright 2012 Twitter, Inc. + * + * 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. + * ============================================================ */ + +/* ======================================================== + * bootstrap-tab.js v2.0.4 + * http://twitter.github.com/bootstrap/javascript.html#tabs + * ======================================================== + * Copyright 2012 Twitter, Inc. + * + * 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. + * ======================================================== */ + +/* ============================================================ + * bootstrap-dropdown.js v2.0.4 + * http://twitter.github.com/bootstrap/javascript.html#dropdowns + * ============================================================ + * Copyright 2012 Twitter, Inc. + * + * 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. + * ============================================================ */ + +/* ========================================================= + * bootstrap-modal.js v2.0.4 + * http://twitter.github.com/bootstrap/javascript.html#modals + * ========================================================= + * Copyright 2012 Twitter, Inc. + * + * 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. + * ========================================================= */ + +/* =========================================================== + * bootstrap-tooltip.js v2.0.4 + * http://twitter.github.com/bootstrap/javascript.html#tooltips + * Inspired by the original jQuery.tipsy by Jason Frame + * =========================================================== + * Copyright 2012 Twitter, Inc. + * + * 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. + * ========================================================== */ + +/* =========================================================== + * bootstrap-popover.js v2.0.4 + * http://twitter.github.com/bootstrap/javascript.html#popovers + * =========================================================== + * Copyright 2012 Twitter, Inc. + * + * 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. + * =========================================================== */ + +/* + * Date Format 1.2.3 + * (c) 2007-2009 Steven Levithan <stevenlevithan.com> + * MIT license + * + * Includes enhancements by Scott Trenda <scott.trenda.net> + * and Kris Kowal <cixar.com/~kris.kowal/> + * + * Accepts a date, a mask, or a date and a mask. + * Returns a formatted version of the given date. + * The date defaults to the current date/time. + * The mask defaults to dateFormat.masks.default. + */ + +/* + * DDL Builder + * Copyright Jake Feasel, 2012 + * Released under MIT license + * For questions email admin at sqlfiddle dot com + * http://github.com/jakefeasel/DDLBuilder + */ + +function ControlVersion(){var e,t,n;try{t=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"),e=t.GetVariable("$version")}catch(n){}if(!e)try{t=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"),e="WIN 6,0,21,0",t.AllowScriptAccess="always",e=t.GetVariable("$version")}catch(n){}if(!e)try{t=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"),e=t.GetVariable("$version")}catch(n){}if(!e)try{t=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"),e="WIN 3,0,18,0"}catch(n){}if(!e)try{t=new ActiveXObject("ShockwaveFlash.ShockwaveFlash"),e="WIN 2,0,0,11"}catch(n){e=-1}return e}function GetSwfVer(){var e=-1;if(navigator.plugins!=null&&navigator.plugins.length>0){if(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]){var t=navigator.plugins["Shockwave Flash 2.0"]?" 2.0":"",n=navigator.plugins["Shockwave Flash"+t].description,r=n.split(" "),i=r[2].split("."),s=i[0],o=i[1];r[3]!=""?tempArrayMinor=r[3].split("r"):tempArrayMinor=r[4].split("r");var u=tempArrayMinor[1]>0?tempArrayMinor[1]:0,e=s+"."+o+"."+u}}else navigator.userAgent.toLowerCase().indexOf("webtv/2.6")!=-1?e=4:navigator.userAgent.toLowerCase().indexOf("webtv/2.5")!=-1?e=3:navigator.userAgent.toLowerCase().indexOf("webtv")!=-1?e=2:isIE&&isWin&&!isOpera&&(e=ControlVersion());return e}function DetectFlashVer(e,t,n){versionStr=GetSwfVer();if(versionStr==-1)return!1;if(versionStr!=0){isIE&&isWin&&!isOpera?(tempArray=versionStr.split(" "),tempString=tempArray[1],versionArray=tempString.split(",")):versionArray=versionStr.split(".");var r=versionArray[0],i=versionArray[1],s=versionArray[2];if(r>parseFloat(e))return!0;if(r==parseFloat(e)){if(i>parseFloat(t))return!0;if(i==parseFloat(t)&&s>=parseFloat(n))return!0}return!1}}function AC_AddExtension(e,t){return e.indexOf("?")!=-1?e.replace(/\?/,t+"?"):e+t}function AC_Generateobj(e,t,n){var r="";if(isIE&&isWin&&!isOpera){r+="<object ";for(var i in e)r+=i+'="'+e[i]+'" ';for(var i in t)r+='><param name="'+i+'" value="'+t[i]+'" /> ';r+="></object>"}else{r+="<embed ";for(var i in n)r+=i+'="'+n[i]+'" ';r+="> </embed>"}return r}function AC_FL_RunContent(){var e=AC_GetArgs(arguments,".swf","movie","clsid:d27cdb6e-ae6d-11cf-96b8-444553540000","application/x-shockwave-flash");return AC_Generateobj(e.objAttrs,e.params,e.embedAttrs)}function AC_GetArgs(e,t,n,r,i){var s=new Object;s.embedAttrs=new Object,s.params=new Object,s.objAttrs=new Object;for(var o=0;o<e.length;o+=2){var u=e[o].toLowerCase();switch(u){case"classid":break;case"pluginspage":s.embedAttrs[e[o]]=e[o+1];break;case"src":case"movie":e[o+1]=AC_AddExtension(e[o+1],t),s.embedAttrs.src=e[o+1],s.params[n]=e[o+1];break;case"onafterupdate":case"onbeforeupdate":case"onblur":case"oncellchange":case"onclick":case"ondblClick":case"ondrag":case"ondragend":case"ondragenter":case"ondragleave":case"ondragover":case"ondrop":case"onfinish":case"onfocus":case"onhelp":case"onmousedown":case"onmouseup":case"onmouseover":case"onmousemove":case"onmouseout":case"onkeypress":case"onkeydown":case"onkeyup":case"onload":case"onlosecapture":case"onpropertychange":case"onreadystatechange":case"onrowsdelete":case"onrowenter":case"onrowexit":case"onrowsinserted":case"onstart":case"onscroll":case"onbeforeeditfocus":case"onactivate":case"onbeforedeactivate":case"ondeactivate":case"type":case"codebase":case"id":s.objAttrs[e[o]]=e[o+1];break;case"width":case"height":case"align":case"vspace":case"hspace":case"class":case"title":case"accesskey":case"name":case"tabindex":s.embedAttrs[e[o]]=s.objAttrs[e[o]]=e[o+1];break;default:s.embedAttrs[e[o]]=s.params[e[o]]=e[o+1]}}return s.objAttrs.classid=r,i&&(s.embedAttrs.type=i),s}function getSearch(e){var t="";return e.location.search.length>1&&(t=new String(e.location.search),t=t.substring(1,t.length)),t}function parseVersion(e){if(typeof e!="string")return[0,0,0,0,0];var t=e.split("."),n=t[0]=="X"?999:parseInt(t[0])||0,r=t[1]=="X"?999:parseInt(t[1])||0,i=t[2]=="X"?999:parseInt(t[2])||0,s=t[3]=="X"?999:parseInt(t[3])||0,o=t[4]=="X"?999:parseInt(t[4])||0;return new Array(n,r,i,s,o)}function compareVersions(e,t){var n=parseVersion(e),r=parseVersion(t);for(var i=0;i<5;i++){if(n[i]<r[i])return 1;if(n[i]>r[i])return-1}return 0}function findViewerFile(e,t){var n=viewerMap[e];if(n==null)return!1;var r=n.length;for(var i=0;i<r;i++)if(compareVersions(n[i],t)<0)break;i!=0&&i--;var s="http://download.oracle.com/otn_software/emviewers/"+e+"/"+n[i]+"/"+e;return s}function loadswf(e){var t=e.match(/db_version="([\d\.]*)"/),n=e.match(/orarep\/(\w*)\//),r=n==null?"":n[1],i=t==null?"":t[1];r==""&&e.match(/sql_monitor_report/)&&(r="sqlmonitor",i="11");var s=Math.floor(Math.random()*1e5).toString(16);this!=top&&(top.Vars=Vars,top.getSearch=getSearch,top.lc_id=s);var o="historyUrl=history.htm%3F&lconid="+s+"&model="+encodeURIComponent(e)+"";if(hasProductInstall&&!hasRequestedVersion){var u=isIE==1?"ActiveX":"PlugIn",a=window.location;document.title=document.title.slice(0,47)+" - Flash Player Installation";var f=document.title;return AC_FL_RunContent("src","http://download.oracle.com/otn_software/emviewers/scripts/playerProductInstall","FlashVars",o,"width","100%","height","100%","align","middle","id",r,"quality","high","bgcolor","#FFFFFF","name",r,"allowScriptAccess","always","type","application/x-shockwave-flash","pluginspage","http://www.adobe.com/go/getflashplayer")}if(!hasRequestedVersion){var c="Fail to display EM Standalone report. This content requires the Adobe Flash Player. <a href=http://www.adobe.com/go/getflash/>Get Flash</a>";return c}var l=typeof viewer_swf=="string"?viewer_swf:findViewerFile(r,i);if(!!l)return AC_FL_RunContent("src",l,"width","100%","height","100%","align","middle","id",r,"quality","high","bgcolor","#FFFFFF","name",r,"flashvars",o,"allowScriptAccess","always","type","application/x-shockwave-flash","pluginspage","http://www.adobe.com/go/getflashplayer");r!=""?alert('Sorry, viewer name "'+r+'" is not yet supported...'):alert("Sorry, cannot not display report: unknown report type")}(function(e,t){function u(e){var t=o[e]={},n,r;e=e.split(/\s+/);for(n=0,r=e.length;n<r;n++)t[e[n]]=!0;return t}function c(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(l,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:s.isNumeric(r)?+r:f.test(r)?s.parseJSON(r):r}catch(o){}s.data(e,n,r)}else r=t}return r}function h(e){for(var t in e){if(t==="data"&&s.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function p(e,t,n){var r=t+"defer",i=t+"queue",o=t+"mark",u=s._data(e,r);u&&(n==="queue"||!s._data(e,i))&&(n==="mark"||!s._data(e,o))&&setTimeout(function(){!s._data(e,i)&&!s._data(e,o)&&(s.removeData(e,r,!0),u.fire())},0)}function H(){return!1}function B(){return!0}function W(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function X(e,t,n){t=t||0;if(s.isFunction(t))return s.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return s.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=s.grep(e,function(e){return e.nodeType===1});if(q.test(t))return s.filter(t,r,!n);t=s.filter(t,r)}return s.grep(e,function(e,r){return s.inArray(e,t)>=0===n})}function V(e){var t=$.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function at(e,t){return s.nodeName(e,"table")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function ft(e,t){if(t.nodeType!==1||!s.hasData(e))return;var n,r,i,o=s._data(e),u=s._data(t,o),a=o.events;if(a){delete u.handle,u.events={};for(n in a)for(r=0,i=a[n].length;r<i;r++)s.event.add(t,n,a[n][r])}u.data&&(u.data=s.extend({},u.data))}function lt(e,t){var n;if(t.nodeType!==1)return;t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),n=t.nodeName.toLowerCase(),n==="object"?t.outerHTML=e.outerHTML:n!=="input"||e.type!=="checkbox"&&e.type!=="radio"?n==="option"?t.selected=e.defaultSelected:n==="input"||n==="textarea"?t.defaultValue=e.defaultValue:n==="script"&&t.text!==e.text&&(t.text=e.text):(e.checked&&(t.defaultChecked=t.checked=e.checked),t.value!==e.value&&(t.value=e.value)),t.removeAttribute(s.expando),t.removeAttribute("_submit_attached"),t.removeAttribute("_change_attached")}function ct(e){return typeof e.getElementsByTagName!="undefined"?e.getElementsByTagName("*"):typeof e.querySelectorAll!="undefined"?e.querySelectorAll("*"):[]}function ht(e){if(e.type==="checkbox"||e.type==="radio")e.defaultChecked=e.checked}function pt(e){var t=(e.nodeName||"").toLowerCase();t==="input"?ht(e):t!=="script"&&typeof e.getElementsByTagName!="undefined"&&s.grep(e.getElementsByTagName("input"),ht)}function dt(e){var t=n.createElement("div");return ut.appendChild(t),t.innerHTML=e.outerHTML,t.firstChild}function kt(e,t,n){var r=t==="width"?e.offsetWidth:e.offsetHeight,i=t==="width"?1:0,o=4;if(r>0){if(n!=="border")for(;i<o;i+=2)n||(r-=parseFloat(s.css(e,"padding"+xt[i]))||0),n==="margin"?r+=parseFloat(s.css(e,n+xt[i]))||0:r-=parseFloat(s.css(e,"border"+xt[i]+"Width"))||0;return r+"px"}r=Tt(e,t);if(r<0||r==null)r=e.style[t];if(bt.test(r))return r;r=parseFloat(r)||0;if(n)for(;i<o;i+=2)r+=parseFloat(s.css(e,"padding"+xt[i]))||0,n!=="padding"&&(r+=parseFloat(s.css(e,"border"+xt[i]+"Width"))||0),n==="margin"&&(r+=parseFloat(s.css(e,n+xt[i]))||0);return r+"px"}function Qt(e){return function(t,n){typeof t!="string"&&(n=t,t="*");if(s.isFunction(n)){var r=t.toLowerCase().split(qt),i=0,o=r.length,u,a,f;for(;i<o;i++)u=r[i],f=/^\+/.test(u),f&&(u=u.substr(1)||"*"),a=e[u]=e[u]||[],a[f?"unshift":"push"](n)}}}function Gt(e,n,r,i,s,o){s=s||n.dataTypes[0],o=o||{},o[s]=!0;var u=e[s],a=0,f=u?u.length:0,l=e===Wt,c;for(;a<f&&(l||!c);a++)c=u[a](n,r,i),typeof c=="string"&&(!l||o[c]?c=t:(n.dataTypes.unshift(c),c=Gt(e,n,r,i,c,o)));return(l||!c)&&!o["*"]&&(c=Gt(e,n,r,i,"*",o)),c}function Yt(e,n){var r,i,o=s.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((o[r]?e:i||(i={}))[r]=n[r]);i&&s.extend(!0,e,i)}function Zt(e,t,n,r){if(s.isArray(t))s.each(t,function(t,i){n||At.test(e)?r(e,i):Zt(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&s.type(t)==="object")for(var i in t)Zt(e+"["+i+"]",t[i],n,r);else r(e,t)}function en(e,n,r){var i=e.contents,s=e.dataTypes,o=e.responseFields,u,a,f,l;for(a in o)a in r&&(n[o[a]]=r[a]);while(s[0]==="*")s.shift(),u===t&&(u=e.mimeType||n.getResponseHeader("content-type"));if(u)for(a in i)if(i[a]&&i[a].test(u)){s.unshift(a);break}if(s[0]in r)f=s[0];else{for(a in r){if(!s[0]||e.converters[a+" "+s[0]]){f=a;break}l||(l=a)}f=f||l}if(f)return f!==s[0]&&s.unshift(f),r[f]}function tn(e,n){e.dataFilter&&(n=e.dataFilter(n,e.dataType));var r=e.dataTypes,i={},o,u,a=r.length,f,l=r[0],c,h,p,d,v;for(o=1;o<a;o++){if(o===1)for(u in e.converters)typeof u=="string"&&(i[u.toLowerCase()]=e.converters[u]);c=l,l=r[o];if(l==="*")l=c;else if(c!=="*"&&c!==l){h=c+" "+l,p=i[h]||i["* "+l];if(!p){v=t;for(d in i){f=d.split(" ");if(f[0]===c||f[0]==="*"){v=i[f[1]+" "+l];if(v){d=i[d],d===!0?p=v:v===!0&&(p=d);break}}}}!p&&!v&&s.error("No conversion from "+h.replace(" "," to ")),p!==!0&&(n=p?p(n):v(d(n)))}}return n}function an(){try{return new e.XMLHttpRequest}catch(t){}}function fn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function yn(){return setTimeout(bn,0),gn=s.now()}function bn(){gn=t}function wn(e,t){var n={};return s.each(mn.concat.apply([],mn.slice(0,t)),function(){n[this]=e}),n}function En(e){if(!ln[e]){var t=n.body,r=s("<"+e+">").appendTo(t),i=r.css("display");r.remove();if(i==="none"||i===""){cn||(cn=n.createElement("iframe"),cn.frameBorder=cn.width=cn.height=0),t.appendChild(cn);if(!hn||!cn.createElement)hn=(cn.contentWindow||cn.contentDocument).document,hn.write((s.support.boxModel?"<!doctype html>":"")+"<html><body>"),hn.close();r=hn.createElement(e),hn.body.appendChild(r),i=s.css(r,"display"),t.removeChild(cn)}ln[e]=i}return ln[e]}function Nn(e){return s.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:!1}var n=e.document,r=e.navigator,i=e.location,s=function(){function H(){if(i.isReady)return;try{n.documentElement.doScroll("left")}catch(e){setTimeout(H,1);return}i.ready()}var i=function(e,t){return new i.fn.init(e,t,u)},s=e.jQuery,o=e.$,u,a=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,f=/\S/,l=/^\s+/,c=/\s+$/,h=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,p=/^[\],:{}\s]*$/,d=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,v=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,m=/(?:^|:|,)(?:\s*\[)+/g,g=/(webkit)[ \/]([\w.]+)/,y=/(opera)(?:.*version)?[ \/]([\w.]+)/,b=/(msie) ([\w.]+)/,w=/(mozilla)(?:.*? rv:([\w.]+))?/,E=/-([a-z]|[0-9])/ig,S=/^-ms-/,x=function(e,t){return(t+"").toUpperCase()},T=r.userAgent,N,C,k,L=Object.prototype.toString,A=Object.prototype.hasOwnProperty,O=Array.prototype.push,M=Array.prototype.slice,_=String.prototype.trim,D=Array.prototype.indexOf,P={};return i.fn=i.prototype={constructor:i,init:function(e,r,s){var o,u,f,l;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(e==="body"&&!r&&n.body)return this.context=n,this[0]=n.body,this.selector=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?o=[null,e,null]:o=a.exec(e);if(o&&(o[1]||!r)){if(o[1])return r=r instanceof i?r[0]:r,l=r?r.ownerDocument||r:n,f=h.exec(e),f?i.isPlainObject(r)?(e=[n.createElement(f[1])],i.fn.attr.call(e,r,!0)):e=[l.createElement(f[1])]:(f=i.buildFragment([o[1]],[l]),e=(f.cacheable?i.clone(f.fragment):f.fragment).childNodes),i.merge(this,e);u=n.getElementById(o[2]);if(u&&u.parentNode){if(u.id!==o[2])return s.find(e);this.length=1,this[0]=u}return this.context=n,this.selector=e,this}return!r||r.jquery?(r||s).find(e):this.constructor(r).find(e)}return i.isFunction(e)?s.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),i.makeArray(e,this))},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return M.call(this,0)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=this.constructor();return i.isArray(e)?O.apply(r,e):i.merge(r,e),r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return i.each(this,e,t)},ready:function(e){return i.bindReady(),C.add(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(M.apply(this,arguments),"slice",M.call(arguments).join(","))},map:function(e){return this.pushStack(i.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:O,sort:[].sort,splice:[].splice},i.fn.init.prototype=i.fn,i.extend=i.fn.extend=function(){var e,n,r,s,o,u,a=arguments[0]||{},f=1,l=arguments.length,c=!1;typeof a=="boolean"&&(c=a,a=arguments[1]||{},f=2),typeof a!="object"&&!i.isFunction(a)&&(a={}),l===f&&(a=this,--f);for(;f<l;f++)if((e=arguments[f])!=null)for(n in e){r=a[n],s=e[n];if(a===s)continue;c&&s&&(i.isPlainObject(s)||(o=i.isArray(s)))?(o?(o=!1,u=r&&i.isArray(r)?r:[]):u=r&&i.isPlainObject(r)?r:{},a[n]=i.extend(c,u,s)):s!==t&&(a[n]=s)}return a},i.extend({noConflict:function(t){return e.$===i&&(e.$=o),t&&e.jQuery===i&&(e.jQuery=s),i},isReady:!1,readyWait:1,holdReady:function(e){e?i.readyWait++:i.ready(!0)},ready:function(e){if(e===!0&&!--i.readyWait||e!==!0&&!i.isReady){if(!n.body)return setTimeout(i.ready,1);i.isReady=!0;if(e!==!0&&--i.readyWait>0)return;C.fireWith(n,[i]),i.fn.trigger&&i(n).trigger("ready").off("ready")}},bindReady:function(){if(C)return;C=i.Callbacks("once memory");if(n.readyState==="complete")return setTimeout(i.ready,1);if(n.addEventListener)n.addEventListener("DOMContentLoaded",k,!1),e.addEventListener("load",i.ready,!1);else if(n.attachEvent){n.attachEvent("onreadystatechange",k),e.attachEvent("onload",i.ready);var t=!1;try{t=e.frameElement==null}catch(r){}n.documentElement.doScroll&&t&&H()}},isFunction:function(e){return i.type(e)==="function"},isArray:Array.isArray||function(e){return i.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):P[L.call(e)]||"object"},isPlainObject:function(e){if(!e||i.type(e)!=="object"||e.nodeType||i.isWindow(e))return!1;try{if(e.constructor&&!A.call(e,"constructor")&&!A.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||A.call(e,r)},isEmptyObject:function(e){for(var t in e)return!1;return!0},error:function(e){throw new Error(e)},parseJSON:function(t){if(typeof t!="string"||!t)return null;t=i.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(p.test(t.replace(d,"@").replace(v,"]").replace(m,"")))return(new Function("return "+t))();i.error("Invalid JSON: "+t)},parseXML:function(n){if(typeof n!="string"||!n)return null;var r,s;try{e.DOMParser?(s=new DOMParser,r=s.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&i.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&f.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(S,"ms-").replace(E,x)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toUpperCase()===t.toUpperCase()},each:function(e,n,r){var s,o=0,u=e.length,a=u===t||i.isFunction(e);if(r){if(a){for(s in e)if(n.apply(e[s],r)===!1)break}else for(;o<u;)if(n.apply(e[o++],r)===!1)break}else if(a){for(s in e)if(n.call(e[s],s,e[s])===!1)break}else for(;o<u;)if(n.call(e[o],o,e[o++])===!1)break;return e},trim:_?function(e){return e==null?"":_.call(e)}:function(e){return e==null?"":e.toString().replace(l,"").replace(c,"")},makeArray:function(e,t){var n=t||[];if(e!=null){var r=i.type(e);e.length==null||r==="string"||r==="function"||r==="regexp"||i.isWindow(e)?O.call(n,e):i.merge(n,e)}return n},inArray:function(e,t,n){var r;if(t){if(D)return D.call(t,e,n);r=t.length,n=n?n<0?Math.max(0,r+n):n:0;for(;n<r;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=e.length,i=0;if(typeof n.length=="number")for(var s=n.length;i<s;i++)e[r++]=n[i];else while(n[i]!==t)e[r++]=n[i++];return e.length=r,e},grep:function(e,t,n){var r=[],i;n=!!n;for(var s=0,o=e.length;s<o;s++)i=!!t(e[s],s),n!==i&&r.push(e[s]);return r},map:function(e,n,r){var s,o,u=[],a=0,f=e.length,l=e instanceof i||f!==t&&typeof f=="number"&&(f>0&&e[0]&&e[f-1]||f===0||i.isArray(e));if(l)for(;a<f;a++)s=n(e[a],a,r),s!=null&&(u[u.length]=s);else for(o in e)s=n(e[o],o,r),s!=null&&(u[u.length]=s);return u.concat.apply([],u)},guid:1,proxy:function(e,n){if(typeof n=="string"){var r=e[n];n=e,e=r}if(!i.isFunction(e))return t;var s=M.call(arguments,2),o=function(){return e.apply(n,s.concat(M.call(arguments)))};return o.guid=e.guid=e.guid||o.guid||i.guid++,o},access:function(e,n,r,s,o,u,a){var f,l=r==null,c=0,h=e.length;if(r&&typeof r=="object"){for(c in r)i.access(e,n,c,r[c],1,u,s);o=1}else if(s!==t){f=a===t&&i.isFunction(s),l&&(f?(f=n,n=function(e,t,n){return f.call(i(e),n)}):(n.call(e,s),n=null));if(n)for(;c<h;c++)n(e[c],r,f?s.call(e[c],c,n(e[c],r)):s,a);o=1}return o?e:l?n.call(e):h?n(e[0],r):u},now:function(){return(new Date).getTime()},uaMatch:function(e){e=e.toLowerCase();var t=g.exec(e)||y.exec(e)||b.exec(e)||e.indexOf("compatible")<0&&w.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},sub:function(){function e(t,n){return new e.fn.init(t,n)}i.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(r,s){return s&&s instanceof i&&!(s instanceof e)&&(s=e(s)),i.fn.init.call(this,r,s,t)},e.fn.init.prototype=e.fn;var t=e(n);return e},browser:{}}),i.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){P["[object "+t+"]"]=t.toLowerCase()}),N=i.uaMatch(T),N.browser&&(i.browser[N.browser]=!0,i.browser.version=N.version),i.browser.webkit&&(i.browser.safari=!0),f.test(" ")&&(l=/^[\s\xA0]+/,c=/[\s\xA0]+$/),u=i(n),n.addEventListener?k=function(){n.removeEventListener("DOMContentLoaded",k,!1),i.ready()}:n.attachEvent&&(k=function(){n.readyState==="complete"&&(n.detachEvent("onreadystatechange",k),i.ready())}),i}(),o={};s.Callbacks=function(e){e=e?o[e]||u(e):{};var n=[],r=[],i,a,f,l,c,h,p=function(t){var r,i,o,u,a;for(r=0,i=t.length;r<i;r++)o=t[r],u=s.type(o),u==="array"?p(o):u==="function"&&(!e.unique||!v.has(o))&&n.push(o)},d=function(t,s){s=s||[],i=!e.memory||[t,s],a=!0,f=!0,h=l||0,l=0,c=n.length;for(;n&&h<c;h++)if(n[h].apply(t,s)===!1&&e.stopOnFalse){i=!0;break}f=!1,n&&(e.once?i===!0?v.disable():n=[]:r&&r.length&&(i=r.shift(),v.fireWith(i[0],i[1])))},v={add:function(){if(n){var e=n.length;p(arguments),f?c=n.length:i&&i!==!0&&(l=e,d(i[0],i[1]))}return this},remove:function(){if(n){var t=arguments,r=0,i=t.length;for(;r<i;r++)for(var s=0;s<n.length;s++)if(t[r]===n[s]){f&&s<=c&&(c--,s<=h&&h--),n.splice(s--,1);if(e.unique)break}}return this},has:function(e){if(n){var t=0,r=n.length;for(;t<r;t++)if(e===n[t])return!0}return!1},empty:function(){return n=[],this},disable:function(){return n=r=i=t,this},disabled:function(){return!n},lock:function(){return r=t,(!i||i===!0)&&v.disable(),this},locked:function(){return!r},fireWith:function(t,n){return r&&(f?e.once||r.push([t,n]):(!e.once||!i)&&d(t,n)),this},fire:function(){return v.fireWith(this,arguments),this},fired:function(){return!!a}};return v};var a=[].slice;s.extend({Deferred:function(e){var t=s.Callbacks("once memory"),n=s.Callbacks("once memory"),r=s.Callbacks("memory"),i="pending",o={resolve:t,reject:n,notify:r},u={done:t.add,fail:n.add,progress:r.add,state:function(){return i},isResolved:t.fired,isRejected:n.fired,then:function(e,t,n){return a.done(e).fail(t).progress(n),this},always:function(){return a.done.apply(a,arguments).fail.apply(a,arguments),this},pipe:function(e,t,n){return s.Deferred(function(r){s.each({done:[e,"resolve"],fail:[t,"reject"],progress:[n,"notify"]},function(e,t){var n=t[0],i=t[1],o;s.isFunction(n)?a[e](function(){o=n.apply(this,arguments),o&&s.isFunction(o.promise)?o.promise().then(r.resolve,r.reject,r.notify):r[i+"With"](this===a?r:this,[o])}):a[e](r[i])})}).promise()},promise:function(e){if(e==null)e=u;else for(var t in u)e[t]=u[t];return e}},a=u.promise({}),f;for(f in o)a[f]=o[f].fire,a[f+"With"]=o[f].fireWith;return a.done(function(){i="resolved"},n.disable,r.lock).fail(function(){i="rejected"},t.disable,r.lock),e&&e.call(a,a),a},when:function(e){function c(e){return function(n){t[e]=arguments.length>1?a.call(arguments,0):n,--o||f.resolveWith(f,t)}}function h(e){return function(t){i[e]=arguments.length>1?a.call(arguments,0):t,f.notifyWith(l,i)}}var t=a.call(arguments,0),n=0,r=t.length,i=new Array(r),o=r,u=r,f=r<=1&&e&&s.isFunction(e.promise)?e:s.Deferred(),l=f.promise();if(r>1){for(;n<r;n++)t[n]&&t[n].promise&&s.isFunction(t[n].promise)?t[n].promise().then(c(n),f.reject,h(n)):--o;o||f.resolveWith(f,t)}else f!==e&&f.resolveWith(f,r?[e]:[]);return l}}),s.support=function(){var t,r,i,o,u,a,f,l,c,h,p,d,v=n.createElement("div"),m=n.documentElement;v.setAttribute("className","t"),v.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",r=v.getElementsByTagName("*"),i=v.getElementsByTagName("a")[0];if(!r||!r.length||!i)return{};o=n.createElement("select"),u=o.appendChild(n.createElement("option")),a=v.getElementsByTagName("input")[0],t={leadingWhitespace:v.firstChild.nodeType===3,tbody:!v.getElementsByTagName("tbody").length,htmlSerialize:!!v.getElementsByTagName("link").length,style:/top/.test(i.getAttribute("style")),hrefNormalized:i.getAttribute("href")==="/a",opacity:/^0.55/.test(i.style.opacity),cssFloat:!!i.style.cssFloat,checkOn:a.value==="on",optSelected:u.selected,getSetAttribute:v.className!=="t",enctype:!!n.createElement("form").enctype,html5Clone:n.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},s.boxModel=t.boxModel=n.compatMode==="CSS1Compat",a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,o.disabled=!0,t.optDisabled=!u.disabled;try{delete v.test}catch(g){t.deleteExpando=!1}!v.addEventListener&&v.attachEvent&&v.fireEvent&&(v.attachEvent("onclick",function(){t.noCloneEvent=!1}),v.cloneNode(!0).fireEvent("onclick")),a=n.createElement("input"),a.value="t",a.setAttribute("type","radio"),t.radioValue=a.value==="t",a.setAttribute("checked","checked"),a.setAttribute("name","t"),v.appendChild(a),f=n.createDocumentFragment(),f.appendChild(v.lastChild),t.checkClone=f.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=a.checked,f.removeChild(a),f.appendChild(v);if(v.attachEvent)for(p in{submit:1,change:1,focusin:1})h="on"+p,d=h in v,d||(v.setAttribute(h,"return;"),d=typeof v[h]=="function"),t[p+"Bubbles"]=d;return f.removeChild(v),f=o=u=v=a=null,s(function(){var r,i,o,u,a,f,c,h,p,m,g,y,b,w=n.getElementsByTagName("body")[0];if(!w)return;h=1,b="padding:0;margin:0;border:",g="position:absolute;top:0;left:0;width:1px;height:1px;",y=b+"0;visibility:hidden;",p="style='"+g+b+"5px solid #000;",m="<div "+p+"display:block;'><div style='"+b+"0;display:block;overflow:hidden;'></div></div>"+"<table "+p+"' cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",r=n.createElement("div"),r.style.cssText=y+"width:0;height:0;position:static;top:0;margin-top:"+h+"px",w.insertBefore(r,w.firstChild),v=n.createElement("div"),r.appendChild(v),v.innerHTML="<table><tr><td style='"+b+"0;display:none'></td><td>t</td></tr></table>",l=v.getElementsByTagName("td"),d=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",t.reliableHiddenOffsets=d&&l[0].offsetHeight===0,e.getComputedStyle&&(v.innerHTML="",c=n.createElement("div"),c.style.width="0",c.style.marginRight="0",v.style.width="2px",v.appendChild(c),t.reliableMarginRight=(parseInt((e.getComputedStyle(c,null)||{marginRight:0}).marginRight,10)||0)===0),typeof v.style.zoom!="undefined"&&(v.innerHTML="",v.style.width=v.style.padding="1px",v.style.border=0,v.style.overflow="hidden",v.style.display="inline",v.style.zoom=1,t.inlineBlockNeedsLayout=v.offsetWidth===3,v.style.display="block",v.style.overflow="visible",v.innerHTML="<div style='width:5px;'></div>",t.shrinkWrapBlocks=v.offsetWidth!==3),v.style.cssText=g+y,v.innerHTML=m,i=v.firstChild,o=i.firstChild,a=i.nextSibling.firstChild.firstChild,f={doesNotAddBorder:o.offsetTop!==5,doesAddBorderForTableAndCells:a.offsetTop===5},o.style.position="fixed",o.style.top="20px",f.fixedPosition=o.offsetTop===20||o.offsetTop===15,o.style.position=o.style.top="",i.style.overflow="hidden",i.style.position="relative",f.subtractsBorderForOverflowNotVisible=o.offsetTop===-5,f.doesNotIncludeMarginInBodyOffset=w.offsetTop!==h,e.getComputedStyle&&(v.style.marginTop="1%",t.pixelMargin=(e.getComputedStyle(v,null)||{marginTop:0}).marginTop!=="1%"),typeof r.style.zoom!="undefined"&&(r.style.zoom=1),w.removeChild(r),c=v=r=null,s.extend(t,f)}),t}();var f=/^(?:\{.*\}|\[.*\])$/,l=/([A-Z])/g;s.extend({cache:{},uuid:0,expando:"jQuery"+(s.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?s.cache[e[s.expando]]:e[s.expando],!!e&&!h(e)},data:function(e,n,r,i){if(!s.acceptData(e))return;var o,u,a,f=s.expando,l=typeof n=="string",c=e.nodeType,h=c?s.cache:e,p=c?e[f]:e[f]&&f,d=n==="events";if((!p||!h[p]||!d&&!i&&!h[p].data)&&l&&r===t)return;p||(c?e[f]=p=++s.uuid:p=f),h[p]||(h[p]={},c||(h[p].toJSON=s.noop));if(typeof n=="object"||typeof n=="function")i?h[p]=s.extend(h[p],n):h[p].data=s.extend(h[p].data,n);return o=u=h[p],i||(u.data||(u.data={}),u=u.data),r!==t&&(u[s.camelCase(n)]=r),d&&!u[n]?o.events:(l?(a=u[n],a==null&&(a=u[s.camelCase(n)])):a=u,a)},removeData:function(e,t,n){if(!s.acceptData(e))return;var r,i,o,u=s.expando,a=e.nodeType,f=a?s.cache:e,l=a?e[u]:u;if(!f[l])return;if(t){r=n?f[l]:f[l].data;if(r){s.isArray(t)||(t in r?t=[t]:(t=s.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,o=t.length;i<o;i++)delete r[t[i]];if(!(n?h:s.isEmptyObject)(r))return}}if(!n){delete f[l].data;if(!h(f[l]))return}s.support.deleteExpando||!f.setInterval?delete f[l]:f[l]=null,a&&(s.support.deleteExpando?delete e[u]:e.removeAttribute?e.removeAttribute(u):e[u]=null)},_data:function(e,t,n){return s.data(e,t,n,!0)},acceptData:function(e){if(e.nodeName){var t=s.noData[e.nodeName.toLowerCase()];if(t)return t!==!0&&e.getAttribute("classid")===t}return!0}}),s.fn.extend({data:function(e,n){var r,i,o,u,a,f=this[0],l=0,h=null;if(e===t){if(this.length){h=s.data(f);if(f.nodeType===1&&!s._data(f,"parsedAttrs")){o=f.attributes;for(a=o.length;l<a;l++)u=o[l].name,u.indexOf("data-")===0&&(u=s.camelCase(u.substring(5)),c(f,u,h[u]));s._data(f,"parsedAttrs",!0)}}return h}return typeof e=="object"?this.each(function(){s.data(this,e)}):(r=e.split(".",2),r[1]=r[1]?"."+r[1]:"",i=r[1]+"!",s.access(this,function(n){if(n===t)return h=this.triggerHandler("getData"+i,[r[0]]),h===t&&f&&(h=s.data(f,e),h=c(f,e,h)),h===t&&r[1]?this.data(r[0]):h;r[1]=n,this.each(function(){var t=s(this);t.triggerHandler("setData"+i,r),s.data(this,e,n),t.triggerHandler("changeData"+i,r)})},null,n,arguments.length>1,null,!1))},removeData:function(e){return this.each(function(){s.removeData(this,e)})}}),s.extend({_mark:function(e,t){e&&(t=(t||"fx")+"mark",s._data(e,t,(s._data(e,t)||0)+1))},_unmark:function(e,t,n){e!==!0&&(n=t,t=e,e=!1);if(t){n=n||"fx";var r=n+"mark",i=e?0:(s._data(t,r)||1)-1;i?s._data(t,r,i):(s.removeData(t,r,!0),p(t,n,"mark"))}},queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=s._data(e,t),n&&(!r||s.isArray(n)?r=s._data(e,t,s.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=s.queue(e,t),r=n.shift(),i={};r==="inprogress"&&(r=n.shift()),r&&(t==="fx"&&n.unshift("inprogress"),s._data(e,t+".run",i),r.call(e,function(){s.dequeue(e,t)},i)),n.length||(s.removeData(e,t+"queue "+t+".run",!0),p(e,t,"queue"))}}),s.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length<r?s.queue(this[0],e):n===t?this:this.each(function(){var t=s.queue(this,e,n);e==="fx"&&t[0]!=="inprogress"&&s.dequeue(this,e)})},dequeue:function(e){return this.each(function(){s.dequeue(this,e)})},delay:function(e,t){return e=s.fx?s.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){function h(){--u||r.resolveWith(i,[i])}typeof e!="string"&&(n=e,e=t),e=e||"fx";var r=s.Deferred(),i=this,o=i.length,u=1,a=e+"defer",f=e+"queue",l=e+"mark",c;while(o--)if(c=s.data(i[o],a,t,!0)||(s.data(i[o],f,t,!0)||s.data(i[o],l,t,!0))&&s.data(i[o],a,s.Callbacks("once memory"),!0))u++,c.add(h);return h(),r.promise(n)}});var d=/[\n\t\r]/g,v=/\s+/,m=/\r/g,g=/^(?:button|input)$/i,y=/^(?:button|input|object|select|textarea)$/i,b=/^a(?:rea)?$/i,w=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,E=s.support.getSetAttribute,S,x,T;s.fn.extend({attr:function(e,t){return s.access(this,s.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){s.removeAttr(this,e)})},prop:function(e,t){return s.access(this,s.prop,e,t,arguments.length>1)},removeProp:function(e){return e=s.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,u,a;if(s.isFunction(e))return this.each(function(t){s(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(v);for(n=0,r=this.length;n<r;n++){i=this[n];if(i.nodeType===1)if(!i.className&&t.length===1)i.className=e;else{o=" "+i.className+" ";for(u=0,a=t.length;u<a;u++)~o.indexOf(" "+t[u]+" ")||(o+=t[u]+" ");i.className=s.trim(o)}}}return this},removeClass:function(e){var n,r,i,o,u,a,f;if(s.isFunction(e))return this.each(function(t){s(this).removeClass(e.call(this,t,this.className))});if(e&&typeof e=="string"||e===t){n=(e||"").split(v);for(r=0,i=this.length;r<i;r++){o=this[r];if(o.nodeType===1&&o.className)if(e){u=(" "+o.className+" ").replace(d," ");for(a=0,f=n.length;a<f;a++)u=u.replace(" "+n[a]+" "," ");o.className=s.trim(u)}else o.className=""}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return s.isFunction(e)?this.each(function(n){s(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,o=0,u=s(this),a=t,f=e.split(v);while(i=f[o++])a=r?a:!u.hasClass(i),u[a?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&s._data(this,"__className__",this.className),this.className=this.className||e===!1?"":s._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n<r;n++)if(this[n].nodeType===1&&(" "+this[n].className+" ").replace(d," ").indexOf(t)>-1)return!0;return!1},val:function(e){var n,r,i,o=this[0];if(!arguments.length){if(o)return n=s.valHooks[o.type]||s.valHooks[o.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(o,"value"))!==t?r:(r=o.value,typeof r=="string"?r.replace(m,""):r==null?"":r);return}return i=s.isFunction(e),this.each(function(r){var o=s(this),u;if(this.nodeType!==1)return;i?u=e.call(this,r,o.val()):u=e,u==null?u="":typeof u=="number"?u+="":s.isArray(u)&&(u=s.map(u,function(e){return e==null?"":e+""})),n=s.valHooks[this.type]||s.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,u,"value")===t)this.value=u})}}),s.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r,i,o=e.selectedIndex,u=[],a=e.options,f=e.type==="select-one";if(o<0)return null;n=f?o:0,r=f?o+1:a.length;for(;n<r;n++){i=a[n];if(i.selected&&(s.support.optDisabled?!i.disabled:i.getAttribute("disabled")===null)&&(!i.parentNode.disabled||!s.nodeName(i.parentNode,"optgroup"))){t=s(i).val();if(f)return t;u.push(t)}}return f&&!u.length&&a.length?s(a[o]).val():u},set:function(e,t){var n=s.makeArray(t);return s(e).find("option").each(function(){this.selected=s.inArray(s(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(e,n,r,i){var o,u,a,f=e.nodeType;if(!e||f===3||f===8||f===2)return;if(i&&n in s.attrFn)return s(e)[n](r);if(typeof e.getAttribute=="undefined")return s.prop(e,n,r);a=f!==1||!s.isXMLDoc(e),a&&(n=n.toLowerCase(),u=s.attrHooks[n]||(w.test(n)?x:S));if(r!==t){if(r===null){s.removeAttr(e,n);return}return u&&"set"in u&&a&&(o=u.set(e,r,n))!==t?o:(e.setAttribute(n,""+r),r)}return u&&"get"in u&&a&&(o=u.get(e,n))!==null?o:(o=e.getAttribute(n),o===null?t:o)},removeAttr:function(e,t){var n,r,i,o,u,a=0;if(t&&e.nodeType===1){r=t.toLowerCase().split(v),o=r.length;for(;a<o;a++)i=r[a],i&&(n=s.propFix[i]||i,u=w.test(i),u||s.attr(e,i,""),e.removeAttribute(E?i:n),u&&n in e&&(e[n]=!1))}},attrHooks:{type:{set:function(e,t){if(g.test(e.nodeName)&&e.parentNode)s.error("type property can't be changed");else if(!s.support.radioValue&&t==="radio"&&s.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}},value:{get:function(e,t){return S&&s.nodeName(e,"button")?S.get(e,t):t in e?e.value:null},set:function(e,t,n){if(S&&s.nodeName(e,"button"))return S.set(e,t,n);e.value=t}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;return u=a!==1||!s.isXMLDoc(e),u&&(n=s.propFix[n]||n,o=s.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&(i=o.get(e,n))!==null?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):y.test(e.nodeName)||b.test(e.nodeName)&&e.href?0:t}}}}),s.attrHooks.tabindex=s.propHooks.tabIndex,x={get:function(e,n){var r,i=s.prop(e,n);return i===!0||typeof i!="boolean"&&(r=e.getAttributeNode(n))&&r.nodeValue!==!1?n.toLowerCase():t},set:function(e,t,n){var r;return t===!1?s.removeAttr(e,n):(r=s.propFix[n]||n,r in e&&(e[r]=!0),e.setAttribute(n,n.toLowerCase())),n}},E||(T={name:!0,id:!0,coords:!0},S=s.valHooks.button={get:function(e,n){var r;return r=e.getAttributeNode(n),r&&(T[n]?r.nodeValue!=="":r.specified)?r.nodeValue:t},set:function(e,t,r){var i=e.getAttributeNode(r);return i||(i=n.createAttribute(r),e.setAttributeNode(i)),i.nodeValue=t+""}},s.attrHooks.tabindex.set=S.set,s.each(["width","height"],function(e,t){s.attrHooks[t]=s.extend(s.attrHooks[t],{set:function(e,n){if(n==="")return e.setAttribute(t,"auto"),n}})}),s.attrHooks.contenteditable={get:S.get,set:function(e,t,n){t===""&&(t="false"),S.set(e,t,n)}}),s.support.hrefNormalized||s.each(["href","src","width","height"],function(e,n){s.attrHooks[n]=s.extend(s.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return r===null?t:r}})}),s.support.style||(s.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||t},set:function(e,t){return e.style.cssText=""+t}}),s.support.optSelected||(s.propHooks.selected=s.extend(s.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),s.support.enctype||(s.propFix.enctype="encoding"),s.support.checkOn||s.each(["radio","checkbox"],function(){s.valHooks[this]={get:function(e){return e.getAttribute("value")===null?"on":e.value}}}),s.each(["radio","checkbox"],function(){s.valHooks[this]=s.extend(s.valHooks[this],{set:function(e,t){if(s.isArray(t))return e.checked=s.inArray(s(e).val(),t)>=0}})});var N=/^(?:textarea|input|select)$/i,C=/^([^\.]*)?(?:\.(.+))?$/,k=/(?:^|\s)hover(\.\S+)?\b/,L=/^key/,A=/^(?:mouse|contextmenu)|click/,O=/^(?:focusinfocus|focusoutblur)$/,M=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,_=function(e){var t=M.exec(e);return t&&(t[1]=(t[1]||"").toLowerCase(),t[3]=t[3]&&new RegExp("(?:^|\\s)"+t[3]+"(?:\\s|$)")),t},D=function(e,t){var n=e.attributes||{};return(!t[1]||e.nodeName.toLowerCase()===t[1])&&(!t[2]||(n.id||{}).value===t[2])&&(!t[3]||t[3].test((n["class"]||{}).value))},P=function(e){return s.event.special.hover?e:e.replace(k,"mouseenter$1 mouseleave$1")};s.event={add:function(e,n,r,i,o){var u,a,f,l,c,h,p,d,v,m,g,y;if(e.nodeType===3||e.nodeType===8||!n||!r||!(u=s._data(e)))return;r.handler&&(v=r,r=v.handler,o=v.selector),r.guid||(r.guid=s.guid++),f=u.events,f||(u.events=f={}),a=u.handle,a||(u.handle=a=function(e){return typeof s=="undefined"||!!e&&s.event.triggered===e.type?t:s.event.dispatch.apply(a.elem,arguments)},a.elem=e),n=s.trim(P(n)).split(" ");for(l=0;l<n.length;l++){c=C.exec(n[l])||[],h=c[1],p=(c[2]||"").split(".").sort(),y=s.event.special[h]||{},h=(o?y.delegateType:y.bindType)||h,y=s.event.special[h]||{},d=s.extend({type:h,origType:c[1],data:i,handler:r,guid:r.guid,selector:o,quick:o&&_(o),namespace:p.join(".")},v),g=f[h];if(!g){g=f[h]=[],g.delegateCount=0;if(!y.setup||y.setup.call(e,i,p,a)===!1)e.addEventListener?e.addEventListener(h,a,!1):e.attachEvent&&e.attachEvent("on"+h,a)}y.add&&(y.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),o?g.splice(g.delegateCount++,0,d):g.push(d),s.event.global[h]=!0}e=null},global:{},remove:function(e,t,n,r,i){var o=s.hasData(e)&&s._data(e),u,a,f,l,c,h,p,d,v,m,g,y;if(!o||!(d=o.events))return;t=s.trim(P(t||"")).split(" ");for(u=0;u<t.length;u++){a=C.exec(t[u])||[],f=l=a[1],c=a[2];if(!f){for(f in d)s.event.remove(e,f+t[u],n,r,!0);continue}v=s.event.special[f]||{},f=(r?v.delegateType:v.bindType)||f,g=d[f]||[],h=g.length,c=c?new RegExp("(^|\\.)"+c.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(p=0;p<g.length;p++)y=g[p],(i||l===y.origType)&&(!n||n.guid===y.guid)&&(!c||c.test(y.namespace))&&(!r||r===y.selector||r==="**"&&y.selector)&&(g.splice(p--,1),y.selector&&g.delegateCount--,v.remove&&v.remove.call(e,y));g.length===0&&h!==g.length&&((!v.teardown||v.teardown.call(e,c)===!1)&&s.removeEvent(e,f,o.handle),delete d[f])}s.isEmptyObject(d)&&(m=o.handle,m&&(m.elem=null),s.removeData(e,["events","handle"],!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(n,r,i,o){if(!i||i.nodeType!==3&&i.nodeType!==8){var u=n.type||n,a=[],f,l,c,h,p,d,v,m,g,y;if(O.test(u+s.event.triggered))return;u.indexOf("!")>=0&&(u=u.slice(0,-1),l=!0),u.indexOf(".")>=0&&(a=u.split("."),u=a.shift(),a.sort());if((!i||s.event.customEvent[u])&&!s.event.global[u])return;n=typeof n=="object"?n[s.expando]?n:new s.Event(u,n):new s.Event(u),n.type=u,n.isTrigger=!0,n.exclusive=l,n.namespace=a.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+a.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,d=u.indexOf(":")<0?"on"+u:"";if(!i){f=s.cache;for(c in f)f[c].events&&f[c].events[u]&&s.event.trigger(n,r,f[c].handle.elem,!0);return}n.result=t,n.target||(n.target=i),r=r!=null?s.makeArray(r):[],r.unshift(n),v=s.event.special[u]||{};if(v.trigger&&v.trigger.apply(i,r)===!1)return;g=[[i,v.bindType||u]];if(!o&&!v.noBubble&&!s.isWindow(i)){y=v.delegateType||u,h=O.test(y+u)?i:i.parentNode,p=null;for(;h;h=h.parentNode)g.push([h,y]),p=h;p&&p===i.ownerDocument&&g.push([p.defaultView||p.parentWindow||e,y])}for(c=0;c<g.length&&!n.isPropagationStopped();c++)h=g[c][0],n.type=g[c][1],m=(s._data(h,"events")||{})[n.type]&&s._data(h,"handle"),m&&m.apply(h,r),m=d&&h[d],m&&s.acceptData(h)&&m.apply(h,r)===!1&&n.preventDefault();return n.type=u,!o&&!n.isDefaultPrevented()&&(!v._default||v._default.apply(i.ownerDocument,r)===!1)&&(u!=="click"||!s.nodeName(i,"a"))&&s.acceptData(i)&&d&&i[u]&&(u!=="focus"&&u!=="blur"||n.target.offsetWidth!==0)&&!s.isWindow(i)&&(p=i[d],p&&(i[d]=null),s.event.triggered=u,i[u](),s.event.triggered=t,p&&(i[d]=p)),n.result}return},dispatch:function(n){n=s.event.fix(n||e.event);var r=(s._data(this,"events")||{})[n.type]||[],i=r.delegateCount,o=[].slice.call(arguments,0),u=!n.exclusive&&!n.namespace,a=s.event.special[n.type]||{},f=[],l,c,h,p,d,v,m,g,y,b,w;o[0]=n,n.delegateTarget=this;if(a.preDispatch&&a.preDispatch.call(this,n)===!1)return;if(i&&(!n.button||n.type!=="click")){p=s(this),p.context=this.ownerDocument||this;for(h=n.target;h!=this;h=h.parentNode||this)if(h.disabled!==!0){v={},g=[],p[0]=h;for(l=0;l<i;l++)y=r[l],b=y.selector,v[b]===t&&(v[b]=y.quick?D(h,y.quick):p.is(b)),v[b]&&g.push(y);g.length&&f.push({elem:h,matches:g})}}r.length>i&&f.push({elem:this,matches:r.slice(i)});for(l=0;l<f.length&&!n.isPropagationStopped();l++){m=f[l],n.currentTarget=m.elem;for(c=0;c<m.matches.length&&!n.isImmediatePropagationStopped();c++){y=m.matches[c];if(u||!n.namespace&&!y.namespace||n.namespace_re&&n.namespace_re.test(y.namespace))n.data=y.data,n.handleObj=y,d=((s.event.special[y.origType]||{}).handle||y.handler).apply(m.elem,o),d!==t&&(n.result=d,d===!1&&(n.preventDefault(),n.stopPropagation()))}}return a.postDispatch&&a.postDispatch.call(this,n),n.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return e.which==null&&(e.which=t.charCode!=null?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,r){var i,s,o,u=r.button,a=r.fromElement;return e.pageX==null&&r.clientX!=null&&(i=e.target.ownerDocument||n,s=i.documentElement,o=i.body,e.pageX=r.clientX+(s&&s.scrollLeft||o&&o.scrollLeft||0)-(s&&s.clientLeft||o&&o.clientLeft||0),e.pageY=r.clientY+(s&&s.scrollTop||o&&o.scrollTop||0)-(s&&s.clientTop||o&&o.clientTop||0)),!e.relatedTarget&&a&&(e.relatedTarget=a===e.target?r.toElement:a),!e.which&&u!==t&&(e.which=u&1?1:u&2?3:u&4?2:0),e}},fix:function(e){if(e[s.expando])return e;var r,i,o=e,u=s.event.fixHooks[e.type]||{},a=u.props?this.props.concat(u.props):this.props;e=s.Event(o);for(r=a.length;r;)i=a[--r],e[i]=o[i];return e.target||(e.target=o.srcElement||n),e.target.nodeType===3&&(e.target=e.target.parentNode),e.metaKey===t&&(e.metaKey=e.ctrlKey),u.filter?u.filter(e,o):e},special:{ready:{setup:s.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(e,t,n){s.isWindow(this)&&(this.onbeforeunload=n)},teardown:function(e,t){this.onbeforeunload===t&&(this.onbeforeunload=null)}}},simulate:function(e,t,n,r){var i=s.extend(new s.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?s.event.trigger(i,null,t):s.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},s.event.handle=s.event.dispatch,s.removeEvent=n.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){e.detachEvent&&e.detachEvent("on"+t,n)},s.Event=function(e,t){if(!(this instanceof s.Event))return new s.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?B:H):this.type=e,t&&s.extend(this,t),this.timeStamp=e&&e.timeStamp||s.now(),this[s.expando]=!0},s.Event.prototype={preventDefault:function(){this.isDefaultPrevented=B;var e=this.originalEvent;if(!e)return;e.preventDefault?e.preventDefault():e.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=B;var e=this.originalEvent;if(!e)return;e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=B,this.stopPropagation()},isDefaultPrevented:H,isPropagationStopped:H,isImmediatePropagationStopped:H},s.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){s.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n=this,r=e.relatedTarget,i=e.handleObj,o=i.selector,u;if(!r||r!==n&&!s.contains(n,r))e.type=i.origType,u=i.handler.apply(this,arguments),e.type=t;return u}}}),s.support.submitBubbles||(s.event.special.submit={setup:function(){if(s.nodeName(this,"form"))return!1;s.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=s.nodeName(n,"input")||s.nodeName(n,"button")?n.form:t;r&&!r._submit_attached&&(s.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),r._submit_attached=!0)})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&s.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){if(s.nodeName(this,"form"))return!1;s.event.remove(this,"._submit")}}),s.support.changeBubbles||(s.event.special.change={setup:function(){if(N.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")s.event.add(this,"propertychange._change",function(e){e.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),s.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1,s.event.simulate("change",this,e,!0))});return!1}s.event.add(this,"beforeactivate._change",function(e){var t=e.target;N.test(t.nodeName)&&!t._change_attached&&(s.event.add(t,"change._change",function(e){this.parentNode&&!e.isSimulated&&!e.isTrigger&&s.event.simulate("change",this.parentNode,e,!0)}),t._change_attached=!0)})},handle:function(e){var t=e.target;if(this!==t||e.isSimulated||e.isTrigger||t.type!=="radio"&&t.type!=="checkbox")return e.handleObj.handler.apply(this,arguments)},teardown:function(){return s.event.remove(this,"._change"),N.test(this.nodeName)}}),s.support.focusinBubbles||s.each({focus:"focusin",blur:"focusout"},function(e,t){var r=0,i=function(e){s.event.simulate(t,e.target,s.event.fix(e),!0)};s.event.special[t]={setup:function(){r++===0&&n.addEventListener(e,i,!0)},teardown:function(){--r===0&&n.removeEventListener(e,i,!0)}}}),s.fn.extend({on:function(e,n,r,i,o){var u,a;if(typeof e=="object"){typeof n!="string"&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}r==null&&i==null?(i=n,r=n=t):i==null&&(typeof n=="string"?(i=r,r=t):(i=r,r=n,n=t));if(i===!1)i=H;else if(!i)return this;return o===1&&(u=i,i=function(e){return s().off(e),u.apply(this,arguments)},i.guid=u.guid||(u.guid=s.guid++)),this.each(function(){s.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){if(e&&e.preventDefault&&e.handleObj){var i=e.handleObj;return s(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this}if(typeof e=="object"){for(var o in e)this.off(o,n,e[o]);return this}if(n===!1||typeof n=="function")r=n,n=t;return r===!1&&(r=H),this.each(function(){s.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},live:function(e,t,n){return s(this.context).on(e,this.selector,t,n),this},die:function(e,t){return s(this.context).off(e,this.selector||"**",t),this},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return arguments.length==1?this.off(e,"**"):this.off(t,e,n)},trigger:function(e,t){return this.each(function(){s.event.trigger(e,t,this)})},triggerHandler:function(e,t){if(this[0])return s.event.trigger(e,t,this[0],!0)},toggle:function(e){var t=arguments,n=e.guid||s.guid++,r=0,i=function(n){var i=(s._data(this,"lastToggle"+e.guid)||0)%r;return s._data(this,"lastToggle"+e.guid,i+1),n.preventDefault(),t[i].apply(this,arguments)||!1};i.guid=n;while(r<t.length)t[r++].guid=n;return this.click(i)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),s.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){s.fn[t]=function(e,n){return n==null&&(n=e,e=null),arguments.length>0?this.on(t,null,e,n):this.trigger(t)},s.attrFn&&(s.attrFn[t]=!0),L.test(t)&&(s.event.fixHooks[t]=s.event.keyHooks),A.test(t)&&(s.event.fixHooks[t]=s.event.mouseHooks)}),function(){function S(e,t,n,i,s,o){for(var u=0,a=i.length;u<a;u++){var f=i[u];if(f){var l=!1;f=f[e];while(f){if(f[r]===n){l=i[f.sizset];break}f.nodeType===1&&!o&&(f[r]=n,f.sizset=u);if(f.nodeName.toLowerCase()===t){l=f;break}f=f[e]}i[u]=l}}}function x(e,t,n,i,s,o){for(var u=0,a=i.length;u<a;u++){var f=i[u];if(f){var l=!1;f=f[e];while(f){if(f[r]===n){l=i[f.sizset];break}if(f.nodeType===1){o||(f[r]=n,f.sizset=u);if(typeof t!="string"){if(f===t){l=!0;break}}else if(h.filter(t,[f]).length>0){l=f;break}}f=f[e]}i[u]=l}}}var e=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,r="sizcache"+(Math.random()+"").replace(".",""),i=0,o=Object.prototype.toString,u=!1,a=!0,f=/\\/g,l=/\r\n/g,c=/\W/;[0,0].sort(function(){return a=!1,0});var h=function(t,r,i,s){i=i||[],r=r||n;var u=r;if(r.nodeType!==1&&r.nodeType!==9)return[];if(!t||typeof t!="string")return i;var a,f,l,c,p,m,g,b,w=!0,E=h.isXML(r),S=[],x=t;do{e.exec(""),a=e.exec(x);if(a){x=a[3],S.push(a[1]);if(a[2]){c=a[3];break}}}while(a);if(S.length>1&&v.exec(t))if(S.length===2&&d.relative[S[0]])f=T(S[0]+S[1],r,s);else{f=d.relative[S[0]]?[r]:h(S.shift(),r);while(S.length)t=S.shift(),d.relative[t]&&(t+=S.shift()),f=T(t,f,s)}else{!s&&S.length>1&&r.nodeType===9&&!E&&d.match.ID.test(S[0])&&!d.match.ID.test(S[S.length-1])&&(p=h.find(S.shift(),r,E),r=p.expr?h.filter(p.expr,p.set)[0]:p.set[0]);if(r){p=s?{expr:S.pop(),set:y(s)}:h.find(S.pop(),S.length!==1||S[0]!=="~"&&S[0]!=="+"||!r.parentNode?r:r.parentNode,E),f=p.expr?h.filter(p.expr,p.set):p.set,S.length>0?l=y(f):w=!1;while(S.length)m=S.pop(),g=m,d.relative[m]?g=S.pop():m="",g==null&&(g=r),d.relative[m](l,g,E)}else l=S=[]}l||(l=f),l||h.error(m||t);if(o.call(l)==="[object Array]")if(!w)i.push.apply(i,l);else if(r&&r.nodeType===1)for(b=0;l[b]!=null;b++)l[b]&&(l[b]===!0||l[b].nodeType===1&&h.contains(r,l[b]))&&i.push(f[b]);else for(b=0;l[b]!=null;b++)l[b]&&l[b].nodeType===1&&i.push(f[b]);else y(l,i);return c&&(h(c,u,i,s),h.uniqueSort(i)),i};h.uniqueSort=function(e){if(w){u=a,e.sort(w);if(u)for(var t=1;t<e.length;t++)e[t]===e[t-1]&&e.splice(t--,1)}return e},h.matches=function(e,t){return h(e,null,null,t)},h.matchesSelector=function(e,t){return h(t,null,null,[e]).length>0},h.find=function(e,t,n){var r,i,s,o,u,a;if(!e)return[];for(i=0,s=d.order.length;i<s;i++){u=d.order[i];if(o=d.leftMatch[u].exec(e)){a=o[1],o.splice(1,1);if(a.substr(a.length-1)!=="\\"){o[1]=(o[1]||"").replace(f,""),r=d.find[u](o,t,n);if(r!=null){e=e.replace(d.match[u],"");break}}}}return r||(r=typeof t.getElementsByTagName!="undefined"?t.getElementsByTagName("*"):[]),{set:r,expr:e}},h.filter=function(e,n,r,i){var s,o,u,a,f,l,c,p,v,m=e,g=[],y=n,b=n&&n[0]&&h.isXML(n[0]);while(e&&n.length){for(u in d.filter)if((s=d.leftMatch[u].exec(e))!=null&&s[2]){l=d.filter[u],c=s[1],o=!1,s.splice(1,1);if(c.substr(c.length-1)==="\\")continue;y===g&&(g=[]);if(d.preFilter[u]){s=d.preFilter[u](s,y,r,g,i,b);if(!s)o=a=!0;else if(s===!0)continue}if(s)for(p=0;(f=y[p])!=null;p++)f&&(a=l(f,s,p,y),v=i^a,r&&a!=null?v?o=!0:y[p]=!1:v&&(g.push(f),o=!0));if(a!==t){r||(y=g),e=e.replace(d.match[u],"");if(!o)return[];break}}if(e===m){if(o!=null)break;h.error(e)}m=e}return y},h.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)};var p=h.getText=function(e){var t,n,r=e.nodeType,i="";if(r){if(r===1||r===9||r===11){if(typeof e.textContent=="string")return e.textContent;if(typeof e.innerText=="string")return e.innerText.replace(l,"");for(e=e.firstChild;e;e=e.nextSibling)i+=p(e)}else if(r===3||r===4)return e.nodeValue}else for(t=0;n=e[t];t++)n.nodeType!==8&&(i+=p(n));return i},d=h.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")},type:function(e){return e.getAttribute("type")}},relative:{"+":function(e,t){var n=typeof t=="string",r=n&&!c.test(t),i=n&&!r;r&&(t=t.toLowerCase());for(var s=0,o=e.length,u;s<o;s++)if(u=e[s]){while((u=u.previousSibling)&&u.nodeType!==1);e[s]=i||u&&u.nodeName.toLowerCase()===t?u||!1:u===t}i&&h.filter(t,e,!0)},">":function(e,t){var n,r=typeof t=="string",i=0,s=e.length;if(r&&!c.test(t)){t=t.toLowerCase();for(;i<s;i++){n=e[i];if(n){var o=n.parentNode;e[i]=o.nodeName.toLowerCase()===t?o:!1}}}else{for(;i<s;i++)n=e[i],n&&(e[i]=r?n.parentNode:n.parentNode===t);r&&h.filter(t,e,!0)}},"":function(e,t,n){var r,s=i++,o=x;typeof t=="string"&&!c.test(t)&&(t=t.toLowerCase(),r=t,o=S),o("parentNode",t,s,e,r,n)},"~":function(e,t,n){var r,s=i++,o=x;typeof t=="string"&&!c.test(t)&&(t=t.toLowerCase(),r=t,o=S),o("previousSibling",t,s,e,r,n)}},find:{ID:function(e,t,n){if(typeof t.getElementById!="undefined"&&!n){var r=t.getElementById(e[1]);return r&&r.parentNode?[r]:[]}},NAME:function(e,t){if(typeof t.getElementsByName!="undefined"){var n=[],r=t.getElementsByName(e[1]);for(var i=0,s=r.length;i<s;i++)r[i].getAttribute("name")===e[1]&&n.push(r[i]);return n.length===0?null:n}},TAG:function(e,t){if(typeof t.getElementsByTagName!="undefined")return t.getElementsByTagName(e[1])}},preFilter:{CLASS:function(e,t,n,r,i,s){e=" "+e[1].replace(f,"")+" ";if(s)return e;for(var o=0,u;(u=t[o])!=null;o++)u&&(i^(u.className&&(" "+u.className+" ").replace(/[\t\n\r]/g," ").indexOf(e)>=0)?n||r.push(u):n&&(t[o]=!1));return!1},ID:function(e){return e[1].replace(f,"")},TAG:function(e,t){return e[1].replace(f,"").toLowerCase()},CHILD:function(e){if(e[1]==="nth"){e[2]||h.error(e[0]),e[2]=e[2].replace(/^\+|\s*/g,"");var t=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=t[1]+(t[2]||1)-0,e[3]=t[3]-0}else e[2]&&h.error(e[0]);return e[0]=i++,e},ATTR:function(e,t,n,r,i,s){var o=e[1]=e[1].replace(f,"");return!s&&d.attrMap[o]&&(e[1]=d.attrMap[o]),e[4]=(e[4]||e[5]||"").replace(f,""),e[2]==="~="&&(e[4]=" "+e[4]+" "),e},PSEUDO:function(t,n,r,i,s){if(t[1]==="not"){if(!((e.exec(t[3])||"").length>1||/^\w/.test(t[3]))){var o=h.filter(t[3],n,r,!0^s);return r||i.push.apply(i,o),!1}t[3]=h(t[3],null,null,n)}else if(d.match.POS.test(t[0])||d.match.CHILD.test(t[0]))return!0;return t},POS:function(e){return e.unshift(!0),e}},filters:{enabled:function(e){return e.disabled===!1&&e.type!=="hidden"},disabled:function(e){return e.disabled===!0},checked:function(e){return e.checked===!0},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!!e.firstChild},empty:function(e){return!e.firstChild},has:function(e,t,n){return!!h(n[3],e).length},header:function(e){return/h\d/i.test(e.nodeName)},text:function(e){var t=e.getAttribute("type"),n=e.type;return e.nodeName.toLowerCase()==="input"&&"text"===n&&(t===n||t===null)},radio:function(e){return e.nodeName.toLowerCase()==="input"&&"radio"===e.type},checkbox:function(e){return e.nodeName.toLowerCase()==="input"&&"checkbox"===e.type},file:function(e){return e.nodeName.toLowerCase()==="input"&&"file"===e.type},password:function(e){return e.nodeName.toLowerCase()==="input"&&"password"===e.type},submit:function(e){var t=e.nodeName.toLowerCase();return(t==="input"||t==="button")&&"submit"===e.type},image:function(e){return e.nodeName.toLowerCase()==="input"&&"image"===e.type},reset:function(e){var t=e.nodeName.toLowerCase();return(t==="input"||t==="button")&&"reset"===e.type},button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&"button"===e.type||t==="button"},input:function(e){return/input|select|textarea|button/i.test(e.nodeName)},focus:function(e){return e===e.ownerDocument.activeElement}},setFilters:{first:function(e,t){return t===0},last:function(e,t,n,r){return t===r.length-1},even:function(e,t){return t%2===0},odd:function(e,t){return t%2===1},lt:function(e,t,n){return t<n[3]-0},gt:function(e,t,n){return t>n[3]-0},nth:function(e,t,n){return n[3]-0===t},eq:function(e,t,n){return n[3]-0===t}},filter:{PSEUDO:function(e,t,n,r){var i=t[1],s=d.filters[i];if(s)return s(e,n,t,r);if(i==="contains")return(e.textContent||e.innerText||p([e])||"").indexOf(t[3])>=0;if(i==="not"){var o=t[3];for(var u=0,a=o.length;u<a;u++)if(o[u]===e)return!1;return!0}h.error(i)},CHILD:function(e,t){var n,i,s,o,u,a,f,l=t[1],c=e;switch(l){case"only":case"first":while(c=c.previousSibling)if(c.nodeType===1)return!1;if(l==="first")return!0;c=e;case"last":while(c=c.nextSibling)if(c.nodeType===1)return!1;return!0;case"nth":n=t[2],i=t[3];if(n===1&&i===0)return!0;s=t[0],o=e.parentNode;if(o&&(o[r]!==s||!e.nodeIndex)){a=0;for(c=o.firstChild;c;c=c.nextSibling)c.nodeType===1&&(c.nodeIndex=++a);o[r]=s}return f=e.nodeIndex-i,n===0?f===0:f%n===0&&f/n>=0}},ID:function(e,t){return e.nodeType===1&&e.getAttribute("id")===t},TAG:function(e,t){return t==="*"&&e.nodeType===1||!!e.nodeName&&e.nodeName.toLowerCase()===t},CLASS:function(e,t){return(" "+(e.className||e.getAttribute("class"))+" ").indexOf(t)>-1},ATTR:function(e,t){var n=t[1],r=h.attr?h.attr(e,n):d.attrHandle[n]?d.attrHandle[n](e):e[n]!=null?e[n]:e.getAttribute(n),i=r+"",s=t[2],o=t[4];return r==null?s==="!=":!s&&h.attr?r!=null:s==="="?i===o:s==="*="?i.indexOf(o)>=0:s==="~="?(" "+i+" ").indexOf(o)>=0:o?s==="!="?i!==o:s==="^="?i.indexOf(o)===0:s==="$="?i.substr(i.length-o.length)===o:s==="|="?i===o||i.substr(0,o.length+1)===o+"-":!1:i&&r!==!1},POS:function(e,t,n,r){var i=t[2],s=d.setFilters[i];if(s)return s(e,n,t,r)}}},v=d.match.POS,m=function(e,t){return"\\"+(t-0+1)};for(var g in d.match)d.match[g]=new RegExp(d.match[g].source+/(?![^\[]*\])(?![^\(]*\))/.source),d.leftMatch[g]=new RegExp(/(^(?:.|\r|\n)*?)/.source+d.match[g].source.replace(/\\(\d+)/g,m));d.match.globalPOS=v;var y=function(e,t){return e=Array.prototype.slice.call(e,0),t?(t.push.apply(t,e),t):e};try{Array.prototype.slice.call(n.documentElement.childNodes,0)[0].nodeType}catch(b){y=function(e,t){var n=0,r=t||[];if(o.call(e)==="[object Array]")Array.prototype.push.apply(r,e);else if(typeof e.length=="number")for(var i=e.length;n<i;n++)r.push(e[n]);else for(;e[n];n++)r.push(e[n]);return r}}var w,E;n.documentElement.compareDocumentPosition?w=function(e,t){return e===t?(u=!0,0):!e.compareDocumentPosition||!t.compareDocumentPosition?e.compareDocumentPosition?-1:1:e.compareDocumentPosition(t)&4?-1:1}:(w=function(e,t){if(e===t)return u=!0,0;if(e.sourceIndex&&t.sourceIndex)return e.sourceIndex-t.sourceIndex;var n,r,i=[],s=[],o=e.parentNode,a=t.parentNode,f=o;if(o===a)return E(e,t);if(!o)return-1;if(!a)return 1;while(f)i.unshift(f),f=f.parentNode;f=a;while(f)s.unshift(f),f=f.parentNode;n=i.length,r=s.length;for(var l=0;l<n&&l<r;l++)if(i[l]!==s[l])return E(i[l],s[l]);return l===n?E(e,s[l],-1):E(i[l],t,1)},E=function(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}),function(){var e=n.createElement("div"),r="script"+(new Date).getTime(),i=n.documentElement;e.innerHTML="<a name='"+r+"'/>",i.insertBefore(e,i.firstChild),n.getElementById(r)&&(d.find.ID=function(e,n,r){if(typeof n.getElementById!="undefined"&&!r){var i=n.getElementById(e[1]);return i?i.id===e[1]||typeof i.getAttributeNode!="undefined"&&i.getAttributeNode("id").nodeValue===e[1]?[i]:t:[]}},d.filter.ID=function(e,t){var n=typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id");return e.nodeType===1&&n&&n.nodeValue===t}),i.removeChild(e),i=e=null}(),function(){var e=n.createElement("div");e.appendChild(n.createComment("")),e.getElementsByTagName("*").length>0&&(d.find.TAG=function(e,t){var n=t.getElementsByTagName(e[1]);if(e[1]==="*"){var r=[];for(var i=0;n[i];i++)n[i].nodeType===1&&r.push(n[i]);n=r}return n}),e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!="undefined"&&e.firstChild.getAttribute("href")!=="#"&&(d.attrHandle.href=function(e){return e.getAttribute("href",2)}),e=null}(),n.querySelectorAll&&function(){var e=h,t=n.createElement("div"),r="__sizzle__";t.innerHTML="<p class='TEST'></p>";if(t.querySelectorAll&&t.querySelectorAll(".TEST").length===0)return;h=function(t,i,s,o){i=i||n;if(!o&&!h.isXML(i)){var u=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(t);if(u&&(i.nodeType===1||i.nodeType===9)){if(u[1])return y(i.getElementsByTagName(t),s);if(u[2]&&d.find.CLASS&&i.getElementsByClassName)return y(i.getElementsByClassName(u[2]),s)}if(i.nodeType===9){if(t==="body"&&i.body)return y([i.body],s);if(u&&u[3]){var a=i.getElementById(u[3]);if(!a||!a.parentNode)return y([],s);if(a.id===u[3])return y([a],s)}try{return y(i.querySelectorAll(t),s)}catch(f){}}else if(i.nodeType===1&&i.nodeName.toLowerCase()!=="object"){var l=i,c=i.getAttribute("id"),p=c||r,v=i.parentNode,m=/^\s*[+~]/.test(t);c?p=p.replace(/'/g,"\\$&"):i.setAttribute("id",p),m&&v&&(i=i.parentNode);try{if(!m||v)return y(i.querySelectorAll("[id='"+p+"'] "+t),s)}catch(g){}finally{c||l.removeAttribute("id")}}}return e(t,i,s,o)};for(var i in e)h[i]=e[i];t=null}(),function(){var e=n.documentElement,t=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.msMatchesSelector;if(t){var r=!t.call(n.createElement("div"),"div"),i=!1;try{t.call(n.documentElement,"[test!='']:sizzle")}catch(s){i=!0}h.matchesSelector=function(e,n){n=n.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!h.isXML(e))try{if(i||!d.match.PSEUDO.test(n)&&!/!=/.test(n)){var s=t.call(e,n);if(s||!r||e.document&&e.document.nodeType!==11)return s}}catch(o){}return h(n,null,null,[e]).length>0}}}(),function(){var e=n.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0)return;e.lastChild.className="e";if(e.getElementsByClassName("e").length===1)return;d.order.splice(1,0,"CLASS"),d.find.CLASS=function(e,t,n){if(typeof t.getElementsByClassName!="undefined"&&!n)return t.getElementsByClassName(e[1])},e=null}(),n.documentElement.contains?h.contains=function(e,t){return e!==t&&(e.contains?e.contains(t):!0)}:n.documentElement.compareDocumentPosition?h.contains=function(e,t){return!!(e.compareDocumentPosition(t)&16)}:h.contains=function(){return!1},h.isXML=function(e){var t=(e?e.ownerDocument||e:0).documentElement;return t?t.nodeName!=="HTML":!1};var T=function(e,t,n){var r,i=[],s="",o=t.nodeType?[t]:t;while(r=d.match.PSEUDO.exec(e))s+=r[0],e=e.replace(d.match.PSEUDO,"");e=d.relative[e]?e+"*":e;for(var u=0,a=o.length;u<a;u++)h(e,o[u],i,n);return h.filter(s,i)};h.attr=s.attr,h.selectors.attrMap={},s.find=h,s.expr=h.selectors,s.expr[":"]=s.expr.filters,s.unique=h.uniqueSort,s.text=h.getText,s.isXMLDoc=h.isXML,s.contains=h.contains}();var j=/Until$/,F=/^(?:parents|prevUntil|prevAll)/,I=/,/,q=/^.[^:#\[\.,]*$/,R=Array.prototype.slice,U=s.expr.match.globalPOS,z={children:!0,contents:!0,next:!0,prev:!0};s.fn.extend({find:function(e){var t=this,n,r;if(typeof e!="string")return s(e).filter(function(){for(n=0,r=t.length;n<r;n++)if(s.contains(t[n],this))return!0});var i=this.pushStack("","find",e),o,u,a;for(n=0,r=this.length;n<r;n++){o=i.length,s.find(e,this[n],i);if(n>0)for(u=o;u<i.length;u++)for(a=0;a<o;a++)if(i[a]===i[u]){i.splice(u--,1);break}}return i},has:function(e){var t=s(e);return this.filter(function(){for(var e=0,n=t.length;e<n;e++)if(s.contains(this,t[e]))return!0})},not:function(e){return this.pushStack(X(this,e,!1),"not",e)},filter:function(e){return this.pushStack(X(this,e,!0),"filter",e)},is:function(e){return!!e&&(typeof e=="string"?U.test(e)?s(e,this.context).index(this[0])>=0:s.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n=[],r,i,o=this[0];if(s.isArray(e)){var u=1;while(o&&o.ownerDocument&&o!==t){for(r=0;r<e.length;r++)s(o).is(e[r])&&n.push({selector:e[r],elem:o,level:u});o=o.parentNode,u++}return n}var a=U.test(e)||typeof e!="string"?s(e,t||this.context):0;for(r=0,i=this.length;r<i;r++){o=this[r];while(o){if(a?a.index(o)>-1:s.find.matchesSelector(o,e)){n.push(o);break}o=o.parentNode;if(!o||!o.ownerDocument||o===t||o.nodeType===11)break}}return n=n.length>1?s.unique(n):n,this.pushStack(n,"closest",e)},index:function(e){return e?typeof e=="string"?s.inArray(this[0],s(e)):s.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?s(e,t):s.makeArray(e&&e.nodeType?[e]:e),r=s.merge(this.get(),n);return this.pushStack(W(n[0])||W(r[0])?r:s.unique(r))},andSelf:function(){return this.add(this.prevObject)}}),s.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return s.dir(e,"parentNode")},parentsUntil:function(e,t,n){return s.dir(e,"parentNode",n)},next:function(e){return s.nth(e,2,"nextSibling")},prev:function(e){return s.nth(e,2,"previousSibling")},nextAll:function(e){return s.dir(e,"nextSibling")},prevAll:function(e){return s.dir(e,"previousSibling")},nextUntil:function(e,t,n){return s.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return s.dir(e,"previousSibling",n)},siblings:function(e){return s.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return s.sibling(e.firstChild)},contents:function(e){return s.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:s.makeArray(e.childNodes)}},function(e,t){s.fn[e]=function(n,r){var i=s.map(this,t,n);return j.test(e)||(r=n),r&&typeof r=="string"&&(i=s.filter(r,i)),i=this.length>1&&!z[e]?s.unique(i):i,(this.length>1||I.test(r))&&F.test(e)&&(i=i.reverse()),this.pushStack(i,e,R.call(arguments).join(","))}}),s.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?s.find.matchesSelector(t[0],e)?[t[0]]:[]:s.find.matches(e,t)},dir:function(e,n,r){var i=[],o=e[n];while(o&&o.nodeType!==9&&(r===t||o.nodeType!==1||!s(o).is(r)))o.nodeType===1&&i.push(o),o=o[n];return i},nth:function(e,t,n,r){t=t||1;var i=0;for(;e;e=e[n])if(e.nodeType===1&&++i===t)break;return e},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var $="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",J=/ jQuery\d+="(?:\d+|null)"/g,K=/^\s+/,Q=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,G=/<([\w:]+)/,Y=/<tbody/i,Z=/<|&#?\w+;/,et=/<(?:script|style)/i,tt=/<(?:script|object|embed|option|style)/i,nt=new RegExp("<(?:"+$+")[\\s/>]","i"),rt=/checked\s*(?:[^=]|=\s*.checked.)/i,it=/\/(java|ecma)script/i,st=/^\s*<!(?:\[CDATA\[|\-\-)/,ot={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},ut=V(n);ot.optgroup=ot.option,ot.tbody=ot.tfoot=ot.colgroup=ot.caption=ot.thead,ot.th=ot.td,s.support.htmlSerialize||(ot._default=[1,"div<div>","</div>"]),s.fn.extend({text:function(e){return s.access(this,function(e){return e===t?s.text(this):this.empty().append((this[0]&&this[0].ownerDocument||n).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(s.isFunction(e))return this.each(function(t){s(this).wrapAll(e.call(this,t))});if(this[0]){var t=s(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return s.isFunction(e)?this.each(function(t){s(this).wrapInner(e.call(this,t))}):this.each(function(){var t=s(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=s.isFunction(e);return this.each(function(n){s(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){s.nodeName(this,"body")||s(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){this.nodeType===1&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){this.nodeType===1&&this.insertBefore(e,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=s.clean(arguments);return e.push.apply(e,this.toArray()),this.pushStack(e,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=this.pushStack(this,"after",arguments);return e.push.apply(e,s.clean(arguments)),e}},remove:function(e,t){for(var n=0,r;(r=this[n])!=null;n++)if(!e||s.filter(e,[r]).length)!t&&r.nodeType===1&&(s.cleanData(r.getElementsByTagName("*")),s.cleanData([r])),r.parentNode&&r.parentNode.removeChild(r);return this},empty:function(){for(var e=0,t;(t=this[e])!=null;e++){t.nodeType===1&&s.cleanData(t.getElementsByTagName("*"));while(t.firstChild)t.removeChild(t.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return s.clone(this,e,t)})},html:function(e){return s.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(J,""):null;if(typeof e=="string"&&!et.test(e)&&(s.support.leadingWhitespace||!K.test(e))&&!ot[(G.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(Q,"<$1></$2>");try{for(;r<i;r++)n=this[r]||{},n.nodeType===1&&(s.cleanData(n.getElementsByTagName("*")),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){return this[0]&&this[0].parentNode?s.isFunction(e)?this.each(function(t){var n=s(this),r=n.html();n.replaceWith(e.call(this,t,r))}):(typeof e!="string"&&(e=s(e).detach()),this.each(function(){var t=this.nextSibling,n=this.parentNode;s(this).remove(),t?s(t).before(e):s(n).append(e)})):this.length?this.pushStack(s(s.isFunction(e)?e():e),"replaceWith",e):this},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){var i,o,u,a,f=e[0],l=[];if(!s.support.checkClone&&arguments.length===3&&typeof f=="string"&&rt.test(f))return this.each(function(){s(this).domManip(e,n,r,!0)});if(s.isFunction(f))return this.each(function(i){var o=s(this);e[0]=f.call(this,i,n?o.html():t),o.domManip(e,n,r)});if(this[0]){a=f&&f.parentNode,s.support.parentNode&&a&&a.nodeType===11&&a.childNodes.length===this.length?i={fragment:a}:i=s.buildFragment(e,this,l),u=i.fragment,u.childNodes.length===1?o=u=u.firstChild:o=u.firstChild;if(o){n=n&&s.nodeName(o,"tr");for(var c=0,h=this.length,p=h-1;c<h;c++)r.call(n?at(this[c],o):this[c],i.cacheable||h>1&&c<p?s.clone(u,!0,!0):u)}l.length&&s.each(l,function(e,t){t.src?s.ajax({type:"GET",global:!1,url:t.src,async:!1,dataType:"script"}):s.globalEval((t.text||t.textContent||t.innerHTML||"").replace(st,"/*$0*/")),t.parentNode&&t.parentNode.removeChild(t)})}return this}}),s.buildFragment=function(e,t,r){var i,o,u,a,f=e[0];return t&&t[0]&&(a=t[0].ownerDocument||t[0]),a.createDocumentFragment||(a=n),e.length===1&&typeof f=="string"&&f.length<512&&a===n&&f.charAt(0)==="<"&&!tt.test(f)&&(s.support.checkClone||!rt.test(f))&&(s.support.html5Clone||!nt.test(f))&&(o=!0,u=s.fragments[f],u&&u!==1&&(i=u)),i||(i=a.createDocumentFragment(),s.clean(e,a,i,r)),o&&(s.fragments[f]=u?i:1),{fragment:i,cacheable:o}},s.fragments={},s.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){s.fn[e]=function(n){var r=[],i=s(n),o=this.length===1&&this[0].parentNode;if(o&&o.nodeType===11&&o.childNodes.length===1&&i.length===1)return i[t](this[0]),this;for(var u=0,a=i.length;u<a;u++){var f=(u>0?this.clone(!0):this).get();s(i[u])[t](f),r=r.concat(f)}return this.pushStack(r,e,i.selector)}}),s.extend({clone:function(e,t,n){var r,i,o,u=s.support.html5Clone||s.isXMLDoc(e)||!nt.test("<"+e.nodeName+">")?e.cloneNode(!0):dt(e);if((!s.support.noCloneEvent||!s.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!s.isXMLDoc(e)){lt(e,u),r=ct(e),i=ct(u);for(o=0;r[o];++o)i[o]&<(r[o],i[o])}if(t){ft(e,u);if(n){r=ct(e),i=ct(u);for(o=0;r[o];++o)ft(r[o],i[o])}}return r=i=null,u},clean:function(e,t,r,i){var o,u,a,f=[];t=t||n,typeof t.createElement=="undefined"&&(t=t.ownerDocument||t[0]&&t[0].ownerDocument||n);for(var l=0,c;(c=e[l])!=null;l++){typeof c=="number"&&(c+="");if(!c)continue;if(typeof c=="string")if(!Z.test(c))c=t.createTextNode(c);else{c=c.replace(Q,"<$1></$2>");var h=(G.exec(c)||["",""])[1].toLowerCase(),p=ot[h]||ot._default,d=p[0],v=t.createElement("div"),m=ut.childNodes,g;t===n?ut.appendChild(v):V(t).appendChild(v),v.innerHTML=p[1]+c+p[2];while(d--)v=v.lastChild;if(!s.support.tbody){var y=Y.test(c),b=h==="table"&&!y?v.firstChild&&v.firstChild.childNodes:p[1]==="<table>"&&!y?v.childNodes:[];for(a=b.length-1;a>=0;--a)s.nodeName(b[a],"tbody")&&!b[a].childNodes.length&&b[a].parentNode.removeChild(b[a])}!s.support.leadingWhitespace&&K.test(c)&&v.insertBefore(t.createTextNode(K.exec(c)[0]),v.firstChild),c=v.childNodes,v&&(v.parentNode.removeChild(v),m.length>0&&(g=m[m.length-1],g&&g.parentNode&&g.parentNode.removeChild(g)))}var w;if(!s.support.appendChecked)if(c[0]&&typeof (w=c.length)=="number")for(a=0;a<w;a++)pt(c[a]);else pt(c);c.nodeType?f.push(c):f=s.merge(f,c)}if(r){o=function(e){return!e.type||it.test(e.type)};for(l=0;f[l];l++){u=f[l];if(i&&s.nodeName(u,"script")&&(!u.type||it.test(u.type)))i.push(u.parentNode?u.parentNode.removeChild(u):u);else{if(u.nodeType===1){var E=s.grep(u.getElementsByTagName("script"),o);f.splice.apply(f,[l+1,0].concat(E))}r.appendChild(u)}}}return f},cleanData:function(e){var t,n,r=s.cache,i=s.event.special,o=s.support.deleteExpando;for(var u=0,a;(a=e[u])!=null;u++){if(a.nodeName&&s.noData[a.nodeName.toLowerCase()])continue;n=a[s.expando];if(n){t=r[n];if(t&&t.events){for(var f in t.events)i[f]?s.event.remove(a,f):s.removeEvent(a,f,t.handle);t.handle&&(t.handle.elem=null)}o?delete a[s.expando]:a.removeAttribute&&a.removeAttribute(s.expando),delete r[n]}}}});var vt=/alpha\([^)]*\)/i,mt=/opacity=([^)]*)/,gt=/([A-Z]|^ms)/g,yt=/^[\-+]?(?:\d*\.)?\d+$/i,bt=/^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,wt=/^([\-+])=([\-+.\de]+)/,Et=/^margin/,St={position:"absolute",visibility:"hidden",display:"block"},xt=["Top","Right","Bottom","Left"],Tt,Nt,Ct;s.fn.css=function(e,n){return s.access(this,function(e,n,r){return r!==t?s.style(e,n,r):s.css(e,n)},e,n,arguments.length>1)},s.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Tt(e,"opacity");return n===""?"1":n}return e.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":s.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var o,u,a=s.camelCase(n),f=e.style,l=s.cssHooks[a];n=s.cssProps[a]||a;if(r===t)return l&&"get"in l&&(o=l.get(e,!1,i))!==t?o:f[n];u=typeof r,u==="string"&&(o=wt.exec(r))&&(r=+(o[1]+1)*+o[2]+parseFloat(s.css(e,n)),u="number");if(r==null||u==="number"&&isNaN(r))return;u==="number"&&!s.cssNumber[a]&&(r+="px");if(!l||!("set"in l)||(r=l.set(e,r))!==t)try{f[n]=r}catch(c){}},css:function(e,n,r){var i,o;n=s.camelCase(n),o=s.cssHooks[n],n=s.cssProps[n]||n,n==="cssFloat"&&(n="float");if(o&&"get"in o&&(i=o.get(e,!0,r))!==t)return i;if(Tt)return Tt(e,n)},swap:function(e,t,n){var r={},i,s;for(s in t)r[s]=e.style[s],e.style[s]=t[s];i=n.call(e);for(s in t)e.style[s]=r[s];return i}}),s.curCSS=s.css,n.defaultView&&n.defaultView.getComputedStyle&&(Nt=function(e,t){var n,r,i,o,u=e.style;return t=t.replace(gt,"-$1").toLowerCase(),(r=e.ownerDocument.defaultView)&&(i=r.getComputedStyle(e,null))&&(n=i.getPropertyValue(t),n===""&&!s.contains(e.ownerDocument.documentElement,e)&&(n=s.style(e,t))),!s.support.pixelMargin&&i&&Et.test(t)&&bt.test(n)&&(o=u.width,u.width=n,n=i.width,u.width=o),n}),n.documentElement.currentStyle&&(Ct=function(e,t){var n,r,i,s=e.currentStyle&&e.currentStyle[t],o=e.style;return s==null&&o&&(i=o[t])&&(s=i),bt.test(s)&&(n=o.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),o.left=t==="fontSize"?"1em":s,s=o.pixelLeft+"px",o.left=n,r&&(e.runtimeStyle.left=r)),s===""?"auto":s}),Tt=Nt||Ct,s.each(["height","width"],function(e,t){s.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth!==0?kt(e,t,r):s.swap(e,St,function(){return kt(e,t,r)})},set:function(e,t){return yt.test(t)?t+"px":t}}}),s.support.opacity||(s.cssHooks.opacity={get:function(e,t){return mt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?parseFloat(RegExp.$1)/100+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=s.isNumeric(t)?"alpha(opacity="+t*100+")":"",o=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&s.trim(o.replace(vt,""))===""){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=vt.test(o)?o.replace(vt,i):o+" "+i}}),s(function(){s.support.reliableMarginRight||(s.cssHooks.marginRight={get:function(e,t){return s.swap(e,{display:"inline-block"},function(){return t?Tt(e,"margin-right"):e.style.marginRight})}})}),s.expr&&s.expr.filters&&(s.expr.filters.hidden=function(e){var t=e.offsetWidth,n=e.offsetHeight;return t===0&&n===0||!s.support.reliableHiddenOffsets&&(e.style&&e.style.display||s.css(e,"display"))==="none"},s.expr.filters.visible=function(e){return!s.expr.filters.hidden(e)}),s.each({margin:"",padding:"",border:"Width"},function(e,t){s.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+xt[r]+t]=i[r]||i[r-2]||i[0];return s}}});var Lt=/%20/g,At=/\[\]$/,Ot=/\r?\n/g,Mt=/#.*$/,_t=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,Dt=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,Pt=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,Ht=/^(?:GET|HEAD)$/,Bt=/^\/\//,jt=/\?/,Ft=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,It=/^(?:select|textarea)/i,qt=/\s+/,Rt=/([?&])_=[^&]*/,Ut=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,zt=s.fn.load,Wt={},Xt={},Vt,$t,Jt=["*/"]+["*"];try{Vt=i.href}catch(Kt){Vt=n.createElement("a"),Vt.href="",Vt=Vt.href}$t=Ut.exec(Vt.toLowerCase())||[],s.fn.extend({load:function(e,n,r){if(typeof e!="string"&&zt)return zt.apply(this,arguments);if(!this.length)return this;var i=e.indexOf(" ");if(i>=0){var o=e.slice(i,e.length);e=e.slice(0,i)}var u="GET";n&&(s.isFunction(n)?(r=n,n=t):typeof n=="object"&&(n=s.param(n,s.ajaxSettings.traditional),u="POST"));var a=this;return s.ajax({url:e,type:u,dataType:"html",data:n,complete:function(e,t,n){n=e.responseText,e.isResolved()&&(e.done(function(e){n=e}),a.html(o?s("<div>").append(n.replace(Ft,"")).find(o):n)),r&&a.each(r,[n,t,e])}}),this},serialize:function(){return s.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?s.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||It.test(this.nodeName)||Dt.test(this.type))}).map(function(e,t){var n=s(this).val();return n==null?null:s.isArray(n)?s.map(n,function(e,n){return{name:t.name,value:e.replace(Ot,"\r\n")}}):{name:t.name,value:n.replace(Ot,"\r\n")}}).get()}}),s.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){s.fn[t]=function(e){return this.on(t,e)}}),s.each(["get","post"],function(e,n){s[n]=function(e,r,i,o){return s.isFunction(r)&&(o=o||i,i=r,r=t),s.ajax({type:n,url:e,data:r,success:i,dataType:o})}}),s.extend({getScript:function(e,n){return s.get(e,t,n,"script")},getJSON:function(e,t,n){return s.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?Yt(e,s.ajaxSettings):(t=e,e=s.ajaxSettings),Yt(e,t),e},ajaxSettings:{url:Vt,isLocal:Pt.test($t[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Jt},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":s.parseJSON,"text xml":s.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:Qt(Wt),ajaxTransport:Qt(Xt),ajax:function(e,n){function S(e,n,c,h){if(y===2)return;y=2,m&&clearTimeout(m),v=t,p=h||"",E.readyState=e>0?4:0;var d,g,w,S=n,x=c?en(r,E,c):t,T,N;if(e>=200&&e<300||e===304){if(r.ifModified){if(T=E.getResponseHeader("Last-Modified"))s.lastModified[l]=T;if(N=E.getResponseHeader("Etag"))s.etag[l]=N}if(e===304)S="notmodified",d=!0;else try{g=tn(r,x),S="success",d=!0}catch(C){S="parsererror",w=C}}else{w=S;if(!S||e)S="error",e<0&&(e=0)}E.status=e,E.statusText=""+(n||S),d?u.resolveWith(i,[g,S,E]):u.rejectWith(i,[E,S,w]),E.statusCode(f),f=t,b&&o.trigger("ajax"+(d?"Success":"Error"),[E,r,d?g:w]),a.fireWith(i,[E,S]),b&&(o.trigger("ajaxComplete",[E,r]),--s.active||s.event.trigger("ajaxStop"))}typeof e=="object"&&(n=e,e=t),n=n||{};var r=s.ajaxSetup({},n),i=r.context||r,o=i!==r&&(i.nodeType||i instanceof s)?s(i):s.event,u=s.Deferred(),a=s.Callbacks("once memory"),f=r.statusCode||{},l,c={},h={},p,d,v,m,g,y=0,b,w,E={readyState:0,setRequestHeader:function(e,t){if(!y){var n=e.toLowerCase();e=h[n]=h[n]||e,c[e]=t}return this},getAllResponseHeaders:function(){return y===2?p:null},getResponseHeader:function(e){var n;if(y===2){if(!d){d={};while(n=_t.exec(p))d[n[1].toLowerCase()]=n[2]}n=d[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return y||(r.mimeType=e),this},abort:function(e){return e=e||"abort",v&&v.abort(e),S(0,e),this}};u.promise(E),E.success=E.done,E.error=E.fail,E.complete=a.add,E.statusCode=function(e){if(e){var t;if(y<2)for(t in e)f[t]=[f[t],e[t]];else t=e[E.status],E.then(t,t)}return this},r.url=((e||r.url)+"").replace(Mt,"").replace(Bt,$t[1]+"//"),r.dataTypes=s.trim(r.dataType||"*").toLowerCase().split(qt),r.crossDomain==null&&(g=Ut.exec(r.url.toLowerCase()),r.crossDomain=!(!g||g[1]==$t[1]&&g[2]==$t[2]&&(g[3]||(g[1]==="http:"?80:443))==($t[3]||($t[1]==="http:"?80:443)))),r.data&&r.processData&&typeof r.data!="string"&&(r.data=s.param(r.data,r.traditional)),Gt(Wt,r,n,E);if(y===2)return!1;b=r.global,r.type=r.type.toUpperCase(),r.hasContent=!Ht.test(r.type),b&&s.active++===0&&s.event.trigger("ajaxStart");if(!r.hasContent){r.data&&(r.url+=(jt.test(r.url)?"&":"?")+r.data,delete r.data),l=r.url;if(r.cache===!1){var x=s.now(),T=r.url.replace(Rt,"$1_="+x);r.url=T+(T===r.url?(jt.test(r.url)?"&":"?")+"_="+x:"")}}(r.data&&r.hasContent&&r.contentType!==!1||n.contentType)&&E.setRequestHeader("Content-Type",r.contentType),r.ifModified&&(l=l||r.url,s.lastModified[l]&&E.setRequestHeader("If-Modified-Since",s.lastModified[l]),s.etag[l]&&E.setRequestHeader("If-None-Match",s.etag[l])),E.setRequestHeader("Accept",r.dataTypes[0]&&r.accepts[r.dataTypes[0]]?r.accepts[r.dataTypes[0]]+(r.dataTypes[0]!=="*"?", "+Jt+"; q=0.01":""):r.accepts["*"]);for(w in r.headers)E.setRequestHeader(w,r.headers[w]);if(!r.beforeSend||r.beforeSend.call(i,E,r)!==!1&&y!==2){for(w in{success:1,error:1,complete:1})E[w](r[w]);v=Gt(Xt,r,n,E);if(!v)S(-1,"No Transport");else{E.readyState=1,b&&o.trigger("ajaxSend",[E,r]),r.async&&r.timeout>0&&(m=setTimeout(function(){E.abort("timeout")},r.timeout));try{y=1,v.send(c,S)}catch(N){if(!(y<2))throw N;S(-1,N)}}return E}return E.abort(),!1},param:function(e,n){var r=[],i=function(e,t){t=s.isFunction(t)?t():t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=s.ajaxSettings.traditional);if(s.isArray(e)||e.jquery&&!s.isPlainObject(e))s.each(e,function(){i(this.name,this.value)});else for(var o in e)Zt(o,e[o],n,i);return r.join("&").replace(Lt,"+")}}),s.extend({active:0,lastModified:{},etag:{}});var nn=s.now(),rn=/(\=)\?(&|$)|\?\?/i;s.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return s.expando+"_"+nn++}}),s.ajaxPrefilter("json jsonp",function(t,n,r){var i=typeof t.data=="string"&&/^application\/x\-www\-form\-urlencoded/.test(t.contentType);if(t.dataTypes[0]==="jsonp"||t.jsonp!==!1&&(rn.test(t.url)||i&&rn.test(t.data))){var o,u=t.jsonpCallback=s.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,a=e[u],f=t.url,l=t.data,c="$1"+u+"$2";return t.jsonp!==!1&&(f=f.replace(rn,c),t.url===f&&(i&&(l=l.replace(rn,c)),t.data===l&&(f+=(/\?/.test(f)?"&":"?")+t.jsonp+"="+u))),t.url=f,t.data=l,e[u]=function(e){o=[e]},r.always(function(){e[u]=a,o&&s.isFunction(a)&&e[u](o[0])}),t.converters["script json"]=function(){return o||s.error(u+" was not called"),o[0]},t.dataTypes[0]="json","script"}}),s.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return s.globalEval(e),e}}}),s.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),s.ajaxTransport("script",function(e){if(e.crossDomain){var r,i=n.head||n.getElementsByTagName("head")[0]||n.documentElement;return{send:function(s,o){r=n.createElement("script"),r.async="async",e.scriptCharset&&(r.charset=e.scriptCharset),r.src=e.url,r.onload=r.onreadystatechange=function(e,n){if(n||!r.readyState||/loaded|complete/.test(r.readyState))r.onload=r.onreadystatechange=null,i&&r.parentNode&&i.removeChild(r),r=t,n||o(200,"success")},i.insertBefore(r,i.firstChild)},abort:function(){r&&r.onload(0,1)}}}});var sn=e.ActiveXObject?function(){for(var e in un)un[e](0,1)}:!1,on=0,un;s.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&an()||fn()}:an,function(e){s.extend(s.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(s.ajaxSettings.xhr()),s.support.ajax&&s.ajaxTransport(function(n){if(!n.crossDomain||s.support.cors){var r;return{send:function(i,o){var u=n.xhr(),a,f;n.username?u.open(n.type,n.url,n.async,n.username,n.password):u.open(n.type,n.url,n.async);if(n.xhrFields)for(f in n.xhrFields)u[f]=n.xhrFields[f];n.mimeType&&u.overrideMimeType&&u.overrideMimeType(n.mimeType),!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(f in i)u.setRequestHeader(f,i[f])}catch(l){}u.send(n.hasContent&&n.data||null),r=function(e,i){var f,l,c,h,p;try{if(r&&(i||u.readyState===4)){r=t,a&&(u.onreadystatechange=s.noop,sn&&delete un[a]);if(i)u.readyState!==4&&u.abort();else{f=u.status,c=u.getAllResponseHeaders(),h={},p=u.responseXML,p&&p.documentElement&&(h.xml=p);try{h.text=u.responseText}catch(e){}try{l=u.statusText}catch(d){l=""}!f&&n.isLocal&&!n.crossDomain?f=h.text?200:404:f===1223&&(f=204)}}}catch(v){i||o(-1,v)}h&&o(f,l,h,c)},!n.async||u.readyState===4?r():(a=++on,sn&&(un||(un={},s(e).unload(sn)),un[a]=r),u.onreadystatechange=r)},abort:function(){r&&r(0,1)}}}});var ln={},cn,hn,pn=/^(?:toggle|show|hide)$/,dn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,vn,mn=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],gn;s.fn.extend({show:function(e,t,n){var r,i;if(e||e===0)return this.animate(wn("show",3),e,t,n);for(var o=0,u=this.length;o<u;o++)r=this[o],r.style&&(i=r.style.display,!s._data(r,"olddisplay")&&i==="none"&&(i=r.style.display=""),(i===""&&s.css(r,"display")==="none"||!s.contains(r.ownerDocument.documentElement,r))&&s._data(r,"olddisplay",En(r.nodeName)));for(o=0;o<u;o++){r=this[o];if(r.style){i=r.style.display;if(i===""||i==="none")r.style.display=s._data(r,"olddisplay")||""}}return this},hide:function(e,t,n){if(e||e===0)return this.animate(wn("hide",3),e,t,n);var r,i,o=0,u=this.length;for(;o<u;o++)r=this[o],r.style&&(i=s.css(r,"display"),i!=="none"&&!s._data(r,"olddisplay")&&s._data(r,"olddisplay",i));for(o=0;o<u;o++)this[o].style&&(this[o].style.display="none");return this},_toggle:s.fn.toggle,toggle:function(e,t,n){var r=typeof e=="boolean";return s.isFunction(e)&&s.isFunction(t)?this._toggle.apply(this,arguments):e==null||r?this.each(function(){var t=r?e:s(this).is(":hidden");s(this)[t?"show":"hide"]()}):this.animate(wn("toggle",3),e,t,n),this},fadeTo:function(e,t,n,r){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){function o(){i.queue===!1&&s._mark(this);var t=s.extend({},i),n=this.nodeType===1,r=n&&s(this).is(":hidden"),o,u,a,f,l,c,h,p,d,v,m;t.animatedProperties={};for(a in e){o=s.camelCase(a),a!==o&&(e[o]=e[a],delete e[a]);if((l=s.cssHooks[o])&&"expand"in l){c=l.expand(e[o]),delete e[o];for(a in c)a in e||(e[a]=c[a])}}for(o in e){u=e[o],s.isArray(u)?(t.animatedProperties[o]=u[1],u=e[o]=u[0]):t.animatedProperties[o]=t.specialEasing&&t.specialEasing[o]||t.easing||"swing";if(u==="hide"&&r||u==="show"&&!r)return t.complete.call(this);n&&(o==="height"||o==="width")&&(t.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],s.css(this,"display")==="inline"&&s.css(this,"float")==="none"&&(!s.support.inlineBlockNeedsLayout||En(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}t.overflow!=null&&(this.style.overflow="hidden");for(a in e)f=new s.fx(this,t,a),u=e[a],pn.test(u)?(m=s._data(this,"toggle"+a)||(u==="toggle"?r?"show":"hide":0),m?(s._data(this,"toggle"+a,m==="show"?"hide":"show"),f[m]()):f[u]()):(h=dn.exec(u),p=f.cur(),h?(d=parseFloat(h[2]),v=h[3]||(s.cssNumber[a]?"":"px"),v!=="px"&&(s.style(this,a,(d||1)+v),p=(d||1)/f.cur()*p,s.style(this,a,p+v)),h[1]&&(d=(h[1]==="-="?-1:1)*d+p),f.custom(p,d,v)):f.custom(p,u,""));return!0}var i=s.speed(t,n,r);return s.isEmptyObject(e)?this.each(i.complete,[!1]):(e=s.extend({},e),i.queue===!1?this.each(o):this.queue(i.queue,o))},stop:function(e,n,r){return typeof e!="string"&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){function u(e,t,n){var i=t[n];s.removeData(e,n,!0),i.stop(r)}var t,n=!1,i=s.timers,o=s._data(this);r||s._unmark(!0,this);if(e==null)for(t in o)o[t]&&o[t].stop&&t.indexOf(".run")===t.length-4&&u(this,o,t);else o[t=e+".run"]&&o[t].stop&&u(this,o,t);for(t=i.length;t--;)i[t].elem===this&&(e==null||i[t].queue===e)&&(r?i[t](!0):i[t].saveState(),n=!0,i.splice(t,1));(!r||!n)&&s.dequeue(this,e)})}}),s.each({slideDown:wn("show",1),slideUp:wn("hide",1),slideToggle:wn("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){s.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),s.extend({speed:function(e,t,n){var r=e&&typeof e=="object"?s.extend({},e):{complete:n||!n&&t||s.isFunction(e)&&e,duration:e,easing:n&&t||t&&!s.isFunction(t)&&t};r.duration=s.fx.off?0:typeof r.duration=="number"?r.duration:r.duration in s.fx.speeds?s.fx.speeds[r.duration]:s.fx.speeds._default;if(r.queue==null||r.queue===!0)r.queue="fx";return r.old=r.complete,r.complete=function(e){s.isFunction(r.old)&&r.old.call(this),r.queue?s.dequeue(this,r.queue):e!==!1&&s._unmark(this)},r},easing:{linear:function(e){return e},swing:function(e){return-Math.cos(e*Math.PI)/2+.5}},timers:[],fx:function(e,t,n){this.options=t,this.elem=e,this.prop=n,t.orig=t.orig||{}}}),s.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(s.fx.step[this.prop]||s.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]==null||!!this.elem.style&&this.elem.style[this.prop]!=null){var e,t=s.css(this.elem,this.prop);return isNaN(e=parseFloat(t))?!t||t==="auto"?0:t:e}return this.elem[this.prop]},custom:function(e,n,r){function u(e){return i.step(e)}var i=this,o=s.fx;this.startTime=gn||yn(),this.end=n,this.now=this.start=e,this.pos=this.state=0,this.unit=r||this.unit||(s.cssNumber[this.prop]?"":"px"),u.queue=this.options.queue,u.elem=this.elem,u.saveState=function(){s._data(i.elem,"fxshow"+i.prop)===t&&(i.options.hide?s._data(i.elem,"fxshow"+i.prop,i.start):i.options.show&&s._data(i.elem,"fxshow"+i.prop,i.end))},u()&&s.timers.push(u)&&!vn&&(vn=setInterval(o.tick,o.interval))},show:function(){var e=s._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=e||s.style(this.elem,this.prop),this.options.show=!0,e!==t?this.custom(this.cur(),e):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),s(this.elem).show()},hide:function(){this.options.orig[this.prop]=s._data(this.elem,"fxshow"+this.prop)||s.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(e){var t,n,r,i=gn||yn(),o=!0,u=this.elem,a=this.options;if(e||i>=a.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),a.animatedProperties[this.prop]=!0;for(t in a.animatedProperties)a.animatedProperties[t]!==!0&&(o=!1);if(o){a.overflow!=null&&!s.support.shrinkWrapBlocks&&s.each(["","X","Y"],function(e,t){u.style["overflow"+t]=a.overflow[e]}),a.hide&&s(u).hide();if(a.hide||a.show)for(t in a.animatedProperties)s.style(u,t,a.orig[t]),s.removeData(u,"fxshow"+t,!0),s.removeData(u,"toggle"+t,!0);r=a.complete,r&&(a.complete=!1,r.call(u))}return!1}return a.duration==Infinity?this.now=i:(n=i-this.startTime,this.state=n/a.duration,this.pos=s.easing[a.animatedProperties[this.prop]](this.state,n,0,1,a.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update(),!0}},s.extend(s.fx,{tick:function(){var e,t=s.timers,n=0;for(;n<t.length;n++)e=t[n],!e()&&t[n]===e&&t.splice(n--,1);t.length||s.fx.stop()},interval:13,stop:function(){clearInterval(vn),vn=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(e){s.style(e.elem,"opacity",e.now)},_default:function(e){e.elem.style&&e.elem.style[e.prop]!=null?e.elem.style[e.prop]=e.now+e.unit:e.elem[e.prop]=e.now}}}),s.each(mn.concat.apply([],mn),function(e,t){t.indexOf("margin")&&(s.fx.step[t]=function(e){s.style(e.elem,t,Math.max(0,e.now)+e.unit)})}),s.expr&&s.expr.filters&&(s.expr.filters.animated=function(e){return s.grep(s.timers,function(t){return e===t.elem}).length});var Sn,xn=/^t(?:able|d|h)$/i,Tn=/^(?:body|html)$/i;"getBoundingClientRect"in n.documentElement?Sn=function(e,t,n,r){try{r=e.getBoundingClientRect()}catch(i){}if(!r||!s.contains(n,e))return r?{top:r.top,left:r.left}:{top:0,left:0};var o=t.body,u=Nn(t),a=n.clientTop||o.clientTop||0,f=n.clientLeft||o.clientLeft||0,l=u.pageYOffset||s.support.boxModel&&n.scrollTop||o.scrollTop,c=u.pageXOffset||s.support.boxModel&&n.scrollLeft||o.scrollLeft,h=r.top+l-a,p=r.left+c-f;return{top:h,left:p}}:Sn=function(e,t,n){var r,i=e.offsetParent,o=e,u=t.body,a=t.defaultView,f=a?a.getComputedStyle(e,null):e.currentStyle,l=e.offsetTop,c=e.offsetLeft;while((e=e.parentNode)&&e!==u&&e!==n){if(s.support.fixedPosition&&f.position==="fixed")break;r=a?a.getComputedStyle(e,null):e.currentStyle,l-=e.scrollTop,c-=e.scrollLeft,e===i&&(l+=e.offsetTop,c+=e.offsetLeft,s.support.doesNotAddBorder&&(!s.support.doesAddBorderForTableAndCells||!xn.test(e.nodeName))&&(l+=parseFloat(r.borderTopWidth)||0,c+=parseFloat(r.borderLeftWidth)||0),o=i,i=e.offsetParent),s.support.subtractsBorderForOverflowNotVisible&&r.overflow!=="visible"&&(l+=parseFloat(r.borderTopWidth)||0,c+=parseFloat(r.borderLeftWidth)||0),f=r}if(f.position==="relative"||f.position==="static")l+=u.offsetTop,c+=u.offsetLeft;return s.support.fixedPosition&&f.position==="fixed"&&(l+=Math.max(n.scrollTop,u.scrollTop),c+=Math.max(n.scrollLeft,u.scrollLeft)),{top:l,left:c}},s.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){s.offset.setOffset(this,e,t)});var n=this[0],r=n&&n.ownerDocument;return r?n===r.body?s.offset.bodyOffset(n):Sn(n,r,r.documentElement):null},s.offset={bodyOffset:function(e){var t=e.offsetTop,n=e.offsetLeft;return s.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(s.css(e,"marginTop"))||0,n+=parseFloat(s.css(e,"marginLeft"))||0),{top:t,left:n}},setOffset:function(e,t,n){var r=s.css(e,"position");r==="static"&&(e.style.position="relative");var i=s(e),o=i.offset(),u=s.css(e,"top"),a=s.css(e,"left"),f=(r==="absolute"||r==="fixed")&&s.inArray("auto",[u,a])>-1,l={},c={},h,p;f?(c=i.position(),h=c.top,p=c.left):(h=parseFloat(u)||0,p=parseFloat(a)||0),s.isFunction(t)&&(t=t.call(e,n,o)),t.top!=null&&(l.top=t.top-o.top+h),t.left!=null&&(l.left=t.left-o.left+p),"using"in t?t.using.call(e,l):i.css(l)}},s.fn.extend({position:function(){if(!this[0])return null;var e=this[0],t=this.offsetParent(),n=this.offset(),r=Tn.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(s.css(e,"marginTop"))||0,n.left-=parseFloat(s.css(e,"marginLeft"))||0,r.top+=parseFloat(s.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(s.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||n.body;while(e&&!Tn.test(e.nodeName)&&s.css(e,"position")==="static")e=e.offsetParent;return e})}}),s.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);s.fn[e]=function(i){return s.access(this,function(e,i,o){var u=Nn(e);if(o===t)return u?n in u?u[n]:s.support.boxModel&&u.document.documentElement[i]||u.document.body[i]:e[i];u?u.scrollTo(r?s(u).scrollLeft():o,r?o:s(u).scrollTop()):e[i]=o},e,i,arguments.length,null)}}),s.each({Height:"height",Width:"width"},function(e,n){var r="client"+e,i="scroll"+e,o="offset"+e;s.fn["inner"+e]=function(){var e=this[0];return e?e.style?parseFloat(s.css(e,n,"padding")):this[n]():null},s.fn["outer"+e]=function(e){var t=this[0];return t?t.style?parseFloat(s.css(t,n,e?"margin":"border")):this[n]():null},s.fn[n]=function(e){return s.access(this,function(e,n,u){var a,f,l,c;if(s.isWindow(e))return a=e.document,f=a.documentElement[r],s.support.boxModel&&f||a.body&&a.body[r]||f;if(e.nodeType===9)return a=e.documentElement,a[r]>=a[i]?a[r]:Math.max(e.body[i],a[i],e.body[o],a[o]);if(u===t)return l=s.css(e,n),c=parseFloat(l),s.isNumeric(c)?c:l;s(e).css(n,u)},n,e,arguments.length,null)}}),e.jQuery=e.$=s,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return s})})(window),define("jQuery",function(e){return function(){return e.$}}(this)),function(){function L(e,t,n){if(e===t)return e!==0||1/e==1/t;if(e==null||t==null)return e===t;e._chain&&(e=e._wrapped),t._chain&&(t=t._wrapped);if(e.isEqual&&x.isFunction(e.isEqual))return e.isEqual(t);if(t.isEqual&&x.isFunction(t.isEqual))return t.isEqual(e);var r=f.call(e);if(r!=f.call(t))return!1;switch(r){case"[object String]":return e==String(t);case"[object Number]":return e!=+e?t!=+t:e==0?1/e==1/t:e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if(typeof e!="object"||typeof t!="object")return!1;var i=n.length;while(i--)if(n[i]==e)return!0;n.push(e);var s=0,o=!0;if(r=="[object Array]"){s=e.length,o=s==t.length;if(o)while(s--)if(!(o=s in e==s in t&&L(e[s],t[s],n)))break}else{if("constructor"in e!="constructor"in t||e.constructor!=t.constructor)return!1;for(var u in e)if(x.has(e,u)){s++;if(!(o=x.has(t,u)&&L(e[u],t[u],n)))break}if(o){for(u in t)if(x.has(t,u)&&!(s--))break;o=!s}}return n.pop(),o}var e=this,t=e._,n={},r=Array.prototype,i=Object.prototype,s=Function.prototype,o=r.push,u=r.slice,a=r.unshift,f=i.toString,l=i.hasOwnProperty,c=r.forEach,h=r.map,p=r.reduce,d=r.reduceRight,v=r.filter,m=r.every,g=r.some,y=r.indexOf,b=r.lastIndexOf,w=Array.isArray,E=Object.keys,S=s.bind,x=function(e){return new F(e)};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=x),exports._=x):e._=x,x.VERSION="1.3.3";var T=x.each=x.forEach=function(e,t,r){if(e==null)return;if(c&&e.forEach===c)e.forEach(t,r);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(t.call(r,e[i],i,e)===n)return}else for(var o in e)if(x.has(e,o)&&t.call(r,e[o],o,e)===n)return};x.map=x.collect=function(e,t,n){var r=[];return e==null?r:h&&e.map===h?e.map(t,n):(T(e,function(e,i,s){r[r.length]=t.call(n,e,i,s)}),r)},x.reduce=x.foldl=x.inject=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(p&&e.reduce===p)return r&&(t=x.bind(t,r)),i?e.reduce(t,n):e.reduce(t);T(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)});if(!i)throw new TypeError("Reduce of empty array with no initial value");return n},x.reduceRight=x.foldr=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(d&&e.reduceRight===d)return r&&(t=x.bind(t,r)),i?e.reduceRight(t,n):e.reduceRight(t);var s=x.toArray(e).reverse();return r&&!i&&(t=x.bind(t,r)),i?x.reduce(s,t,n,r):x.reduce(s,t)},x.find=x.detect=function(e,t,n){var r;return N(e,function(e,i,s){if(t.call(n,e,i,s))return r=e,!0}),r},x.filter=x.select=function(e,t,n){var r=[];return e==null?r:v&&e.filter===v?e.filter(t,n):(T(e,function(e,i,s){t.call(n,e,i,s)&&(r[r.length]=e)}),r)},x.reject=function(e,t,n){var r=[];return e==null?r:(T(e,function(e,i,s){t.call(n,e,i,s)||(r[r.length]=e)}),r)},x.every=x.all=function(e,t,r){var i=!0;return e==null?i:m&&e.every===m?e.every(t,r):(T(e,function(e,s,o){if(!(i=i&&t.call(r,e,s,o)))return n}),!!i)};var N=x.some=x.any=function(e,t,r){t||(t=x.identity);var i=!1;return e==null?i:g&&e.some===g?e.some(t,r):(T(e,function(e,s,o){if(i||(i=t.call(r,e,s,o)))return n}),!!i)};x.include=x.contains=function(e,t){var n=!1;return e==null?n:y&&e.indexOf===y?e.indexOf(t)!=-1:(n=N(e,function(e){return e===t}),n)},x.invoke=function(e,t){var n=u.call(arguments,2);return x.map(e,function(e){return(x.isFunction(t)?t:e[t]).apply(e,n)})},x.pluck=function(e,t){return x.map(e,function(e){return e[t]})},x.max=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!t&&x.isEmpty(e))return-Infinity;var r={computed:-Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o>=r.computed&&(r={value:e,computed:o})}),r.value},x.min=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!t&&x.isEmpty(e))return Infinity;var r={computed:Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o<r.computed&&(r={value:e,computed:o})}),r.value},x.shuffle=function(e){var t,n=0,r=[];return T(e,function(e){t=Math.floor(Math.random()*++n),r[n-1]=r[t],r[t]=e}),r},x.sortBy=function(e,t,n){var r=x.isFunction(t)?t:function(e){return e[t]};return x.pluck(x.map(e,function(e,t,i){return{value:e,criteria:r.call(n,e,t,i)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;return n===void 0?1:r===void 0?-1:n<r?-1:n>r?1:0}),"value")},x.groupBy=function(e,t){var n={},r=x.isFunction(t)?t:function(e){return e[t]};return T(e,function(e,t){var i=r(e,t);(n[i]||(n[i]=[])).push(e)}),n},x.sortedIndex=function(e,t,n){n||(n=x.identity);var r=n(t),i=0,s=e.length;while(i<s){var o=i+s>>1;n(e[o])<r?i=o+1:s=o}return i},x.toArray=function(e){return e?x.isArray(e)?u.call(e):x.isArguments(e)?u.call(e):e.toArray&&x.isFunction(e.toArray)?e.toArray():x.values(e):[]},x.size=function(e){return x.isArray(e)?e.length:x.keys(e).length},x.first=x.head=x.take=function(e,t,n){return t!=null&&!n?u.call(e,0,t):e[0]},x.initial=function(e,t,n){return u.call(e,0,e.length-(t==null||n?1:t))},x.last=function(e,t,n){return t!=null&&!n?u.call(e,Math.max(e.length-t,0)):e[e.length-1]},x.rest=x.tail=function(e,t,n){return u.call(e,t==null||n?1:t)},x.compact=function(e){return x.filter(e,function(e){return!!e})};var C=function(e,t,n){return T(e,function(e){x.isArray(e)?t?o.apply(n,e):C(e,t,n):n.push(e)}),n};x.flatten=function(e,t){return C(e,t,[])},x.without=function(e){return x.difference(e,u.call(arguments,1))},x.uniq=x.unique=function(e,t,n){var r=n?x.map(e,n):e,i=[];return x.reduce(r,function(n,r,s){if(t?x.last(n)!==r||!n.length:!x.include(n,r))n.push(r),i.push(e[s]);return n},[]),i},x.union=function(){return x.uniq(C(arguments,!0,[]))},x.intersection=function(e){var t=u.call(arguments,1);return x.filter(x.uniq(e),function(e){return x.every(t,function(t){return x.indexOf(t,e)>=0})})},x.difference=function(e){var t=C(u.call(arguments,1),!0,[]);return x.filter(e,function(e){return!x.include(t,e)})},x.zip=function(){var e=u.call(arguments),t=x.max(x.pluck(e,"length")),n=new Array(t);for(var r=0;r<t;r++)n[r]=x.pluck(e,""+r);return n},x.zipObject=function(e,t){var n={};for(var r=0,i=e.length;r<i;r++)n[e[r]]=t[r];return n},x.indexOf=function(e,t,n){if(e==null)return-1;var r,i;if(n)return r=x.sortedIndex(e,t),e[r]===t?r:-1;if(y&&e.indexOf===y)return e.indexOf(t);for(r=0,i=e.length;r<i;r++)if(e[r]===t)return r;return-1},x.lastIndexOf=function(e,t){if(e==null)return-1;if(b&&e.lastIndexOf===b)return e.lastIndexOf(t);var n=e.length;while(n--)if(e[n]===t)return n;return-1},x.range=function(e,t,n){arguments.length<=1&&(t=e||0,e=0),n=arguments[2]||1;var r=Math.max(Math.ceil((t-e)/n),0),i=0,s=new Array(r);while(i<r)s[i++]=e,e+=n;return s};var k=function(){};x.bind=function(t,n){var r,i;if(t.bind===S&&S)return S.apply(t,u.call(arguments,1));if(!x.isFunction(t))throw new TypeError;return i=u.call(arguments,2),r=function(){if(this instanceof r){k.prototype=t.prototype;var e=new k,s=t.apply(e,i.concat(u.call(arguments)));return Object(s)===s?s:e}return t.apply(n,i.concat(u.call(arguments)))}},x.bindAll=function(e){var t=u.call(arguments,1);return t.length==0&&(t=x.functions(e)),T(t,function(t){e[t]=x.bind(e[t],e)}),e},x.memoize=function(e,t){var n={};return t||(t=x.identity),function(){var r=t.apply(this,arguments);return x.has(n,r)?n[r]:n[r]=e.apply(this,arguments)}},x.delay=function(e,t){var n=u.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},x.defer=function(e){return x.delay.apply(x,[e,1].concat(u.call(arguments,1)))},x.throttle=function(e,t){var n,r,i,s,o,u,a=x.debounce(function(){o=s=!1},t);return function(){n=this,r=arguments;var f=function(){i=null,o&&e.apply(n,r),a()};return i||(i=setTimeout(f,t)),s?o=!0:(s=!0,u=e.apply(n,r)),a(),u}},x.debounce=function(e,t,n){var r;return function(){var i=this,s=arguments,o=function(){r=null,n||e.apply(i,s)},u=n&&!r;clearTimeout(r),r=setTimeout(o,t),u&&e.apply(i,s)}},x.once=function(e){var t=!1,n;return function(){return t?n:(t=!0,n=e.apply(this,arguments))}},x.wrap=function(e,t){return function(){var n=[e].concat(u.call(arguments,0));return t.apply(this,n)}},x.compose=function(){var e=arguments;return function(){var t=arguments;for(var n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},x.after=function(e,t){return e<=0?t():function(){if(--e<1)return t.apply(this,arguments)}},x.keys=E||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)x.has(e,n)&&(t[t.length]=n);return t},x.values=function(e){return x.map(e,x.identity)},x.functions=x.methods=function(e){var t=[];for(var n in e)x.isFunction(e[n])&&t.push(n);return t.sort()},x.extend=function(e){return T(u.call(arguments,1),function(t){for(var n in t)e[n]=t[n]}),e},x.pick=function(e){var t={};return T(C(u.call(arguments,1),!0,[]),function(n){n in e&&(t[n]=e[n])}),t},x.defaults=function(e){return T(u.call(arguments,1),function(t){for(var n in t)e[n]==null&&(e[n]=t[n])}),e},x.clone=function(e){return x.isObject(e)?x.isArray(e)?e.slice():x.extend({},e):e},x.tap=function(e,t){return t(e),e},x.isEqual=function(e,t){return L(e,t,[])},x.isEmpty=function(e){if(e==null)return!0;if(x.isArray(e)||x.isString(e))return e.length===0;for(var t in e)if(x.has(e,t))return!1;return!0},x.isElement=function(e){return!!e&&e.nodeType==1},x.isArray=w||function(e){return f.call(e)=="[object Array]"},x.isObject=function(e){return e===Object(e)},T(["Arguments","Function","String","Number","Date","RegExp"],function(e){x["is"+e]=function(t){return f.call(t)=="[object "+e+"]"}}),x.isArguments(arguments)||(x.isArguments=function(e){return!!e&&!!x.has(e,"callee")}),x.isFinite=function(e){return x.isNumber(e)&&isFinite(e)},x.isNaN=function(e){return e!==e},x.isBoolean=function(e){return e===!0||e===!1||f.call(e)=="[object Boolean]"},x.isNull=function(e){return e===null},x.isUndefined=function(e){return e===void 0},x.has=function(e,t){return l.call(e,t)},x.noConflict=function(){return e._=t,this},x.identity=function(e){return e},x.times=function(e,t,n){for(var r=0;r<e;r++)t.call(n,r)};var A={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},O=/[&<>"'\/]/g;x.escape=function(e){return(""+e).replace(O,function(e){return A[e]})},x.result=function(e,t){if(e==null)return null;var n=e[t];return x.isFunction(n)?n.call(e):n},x.mixin=function(e){T(x.functions(e),function(t){q(t,x[t]=e[t])})};var M=0;x.uniqueId=function(e){var t=M++;return e?e+t:t},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var _=/.^/,D={"\\":"\\","'":"'",r:"\r",n:"\n",t:" ",u2028:"\u2028",u2029:"\u2029"};for(var P in D)D[D[P]]=P;var H=/\\|'|\r|\n|\t|\u2028|\u2029/g,B=/\\(\\|'|r|n|t|u2028|u2029)/g,j=function(e){return e.replace(B,function(e,t){return D[t]})};x.template=function(e,t,n){n=x.defaults(n||{},x.templateSettings);var r="__p+='"+e.replace(H,function(e){return"\\"+D[e]}).replace(n.escape||_,function(e,t){return"'+\n((__t=("+j(t)+"))==null?'':_.escape(__t))+\n'"}).replace(n.interpolate||_,function(e,t){return"'+\n((__t=("+j(t)+"))==null?'':__t)+\n'"}).replace(n.evaluate||_,function(e,t){return"';\n"+j(t)+"\n__p+='"})+"';\n";n.variable||(r="with(obj||{}){\n"+r+"}\n"),r="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'')};\n"+r+"return __p;\n";var i=new Function(n.variable||"obj","_",r);if(t)return i(t,x);var s=function(e){return i.call(this,e,x)};return s.source="function("+(n.variable||"obj")+"){\n"+r+"}",s},x.chain=function(e){return x(e).chain()};var F=function(e){this._wrapped=e};x.prototype=F.prototype;var I=function(e,t){return t?x(e).chain():e},q=function(e,t){F.prototype[e]=function(){var e=u.call(arguments);return a.call(e,this._wrapped),I(t.apply(x,e),this._chain)}};x.mixin(x),T(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=r[e];F.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),(e=="shift"||e=="splice")&&n.length===0&&delete n[0],I(n,this._chain)}}),T(["concat","join","slice"],function(e){var t=r[e];F.prototype[e]=function(){return I(t.apply(this._wrapped,arguments),this._chain)}}),F.prototype.chain=function(){return this._chain=!0,this},F.prototype.value=function(){return this._wrapped}}.call(this),define("Underscore",function(e){return function(){return e._}}(this)),define("dbTypes_cached",[],function(){return[{id:2,className:"org.gjt.mm.mysql.Driver",context:"host",sample_fragment:"2/a2581/1",simple_name:"MySQL",notes:"Separate multiple statements in MySQL by terminating each one with a semicolon.",full_name:"MySQL 5.5.27"},{id:9,className:"org.gjt.mm.mysql.Driver",context:"host",sample_fragment:"9/a2581/1",simple_name:"MySQL",notes:"",full_name:"MySQL 5.6.6 m9"},{id:8,className:"org.gjt.mm.mysql.Driver",context:"host",sample_fragment:"8/a2581/1",simple_name:"MySQL",notes:"",full_name:"MySQL 5.1.61"},{id:4,className:"oracle.jdbc.OracleDriver",context:"host",sample_fragment:"4/ee7da/596",simple_name:"Oracle",notes:"Oracle does not support multiple statements in batch. Separate each statement with a line consisting of a single /, and do not terminate statements with semicolons.",full_name:"Oracle 11g R2"},{id:1,className:"org.postgresql.Driver",context:"host",sample_fragment:"1/6ccc5/2",simple_name:"PostgreSQL",notes:"Separate multiple statements in PostgreSQL by terminating each one with a semicolon.",full_name:"PostgreSQL 9.1.6"},{id:12,className:"org.postgresql.Driver",context:"host",sample_fragment:"12/6d80e/1",simple_name:"PostgreSQL",notes:"",full_name:"PostgreSQL 9.2.1"},{id:11,className:"org.postgresql.Driver",context:"host",sample_fragment:"11/6d80e/1",simple_name:"PostgreSQL",notes:"",full_name:"PostgreSQL 8.4.12"},{id:10,className:"org.postgresql.Driver",context:"host",sample_fragment:"10/f9585/1",simple_name:"PostgreSQL",notes:"",full_name:"PostgreSQL 8.3.20"},{id:7,className:"websql",context:"browser",sample_fragment:"7/04eca/1",simple_name:"SQLite",notes:"",full_name:"SQLite (WebSQL)"},{id:5,className:"sqljs",context:"browser",sample_fragment:"5/781d4/2",simple_name:"SQLite",notes:"",full_name:"SQLite (SQL.js)"},{id:6,className:"net.sourceforge.jtds.jdbc.Driver",context:"host",sample_fragment:"6/189a3/1",simple_name:"SQL Server",notes:"",full_name:"MS SQL Server 2012"},{id:3,className:"net.sourceforge.jtds.jdbc.Driver",context:"host",sample_fragment:"3/1fa93/1",simple_name:"SQL Server",notes:"SQL Server supports multiple statements in a batch separated by semicolons. Separate statement batches with a line consisting of a single GO command, as needed.",full_name:"MS SQL Server 2008"}]}),define("BrowserEngines/sqlite_driver",[],function(){var e=function(){return this};return e.prototype.getSchemaStructure=function(e){var t="select * from sqlite_master where type IN ('table', 'view') and name != '__WebKitDatabaseInfoTable__' order by type,name",n=function(t){var n={},r=[];for(var i in t[0].RESULTS.COLUMNS)n[t[0].RESULTS.COLUMNS[i]]=i;for(var s in t[0].RESULTS.DATA){var o=t[0].RESULTS.DATA[s][n.sql],u=t[0].RESULTS.DATA[s][n.name],a=t[0].RESULTS.DATA[s][n.type],f={table_name:u,table_type:a,columns:[]};if(a=="table"){var l=/^[\s\S]*?\(([\s\S]*)\)$/.exec(o)[1].split(/,\s*/);for(var c in l){var h=l[c].replace(/(^\s*)|(\s*$)/,"").split(/\s+/);f.columns.push({name:h.shift(),type:h.join(" ")})}}r.push(f)}e.callback(r)};this.executeQuery({sql:t,success:n})},e.prototype.splitStatement=function(e,t){t||(t=";");var n=t.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),r=e?e.split(new RegExp(n+"s*\r?(\n|$)")):[];return r},e}),define("BrowserEngines/sqljs_driver",["jQuery","BrowserEngines/sqlite_driver"],function(e,t){var n=function(){return this.db=null,this};return e.extend(n.prototype,t.prototype),n.prototype.buildSchema=function(n){var r=this;try{var i=function(){r.db=SQL.open(),e.each(t.prototype.splitStatement.call(this,n.ddl,n.statement_separator),function(e,t){r.db.exec(t)}),n.success()};window.SQL===undefined?e.getScript("javascripts_static/sql.js",function(e,t,n){i()}).fail(function(e,t,r){n.error("Your browser does not work with SQL.js. Try using a different browser (Chrome, Safari, Firefox, IE 10, etc...), or a newer version of your current one.")}):(r.db&&r.db.close(),i())}catch(s){n.error(s)}},n.prototype.executeQuery=function(n){var r=this;try{if(!r.db)throw"Database Schema not available!";var i=[];r.db.exec("BEGIN TRANSACTION"),e.each(t.prototype.splitStatement.call(this,n.sql,n.statement_separator),function(t,n){if(e.trim(n).length){var s=new Date,o=[];try{o=r.db.exec(n);var u={SUCCEEDED:!0,EXECUTIONTIME:new Date-s,RESULTS:{COLUMNS:[],DATA:[]},EXECUTIONPLAN:{COLUMNS:[],DATA:[]}};o.length&&e.each(o,function(t,n){var r=[];e.each(n,function(e,n){t==0&&u.RESULTS.COLUMNS.push(n.column),r.push(n.value)}),u.RESULTS.DATA.push(r)});try{exectionPlanArray=r.db.exec("EXPLAIN QUERY PLAN "+n),exectionPlanArray.length&&e.each(exectionPlanArray,function(t,n){var r=[];e.each(n,function(e,n){t==0&&u.EXECUTIONPLAN.COLUMNS.push(n.column),r.push(n.value)}),u.EXECUTIONPLAN.DATA.push(r)})}catch(a){}i.push(u)}catch(a){var u={SUCCEEDED:!1,EXECUTIONTIME:new Date-s,ERRORMESSAGE:a};return i.push(u),!1}}}),r.db.exec("ROLLBACK TRANSACTION"),n.success(i)}catch(s){n.error(s)}},n}),define("BrowserEngines/websql_driver",["jQuery","BrowserEngines/sqlite_driver"],function(e,t){var n=function(){return this.db=null,this.ddl=[],this.nativeSQLite=window.openDatabase!==undefined,this};return e.extend(n.prototype,t.prototype),n.prototype.buildSchema=function(e){var t=this;try{t.nativeSQLite?(t.db=openDatabase(e.short_code,"1.0",e.short_code,e.ddl.length*1024),t.db.transaction(function(n){var r=t.splitStatement(e.ddl,e.statement_separator);t.ddl=r;var i=0,s=r[i],o=function(t,a){if(i<r.length-1){do i++,s=r[i];while(i<r.length-1&&s.match(/^\s*$/));s.match(/^\s*$/)?(n.executeSql("intentional failure used to rollback transaction"),e.success()):n.executeSql(s,[],o,u)}else n.executeSql("intentional failure used to rollback transaction"),e.success()},u=function(t,n){return n.message!="not an error"?e.error(n.message):e.success(),!0};s?n.executeSql(s,[],o,u):e.success()})):e.error("SQLite (WebSQL) not available in your browser. Try either using a webkit-based browser (such as Safari or Chrome) or using the SQLite (SQL.js) database type.")}catch(n){e.error(n)}},n.prototype.executeQuery=function(t){var n=this;try{if(n.db==null)throw"You need to build the schema before you can run a query.";var r=[];n.db.transaction(function(i){var s=function(e,u){var a={SUCCEEDED:!0,EXECUTIONTIME:new Date-p,RESULTS:{COLUMNS:[],DATA:[]},EXECUTIONPLAN:{COLUMNS:[],DATA:[]}};for(var f=0;f<u.rows.length;f++){var d=[],v=u.rows.item(f);if(f==0)for(col in v)a.RESULTS.COLUMNS.push(col);for(var m=0;m<a.RESULTS.COLUMNS.length;m++)d.push(v[a.RESULTS.COLUMNS[m]]);a.RESULTS.DATA.push(d)}i.executeSql("EXPLAIN QUERY PLAN "+h,[],function(e,u){for(var f=0;f<u.rows.length;f++){var p=[],d=u.rows.item(f);if(f==0)for(col in d)a.EXECUTIONPLAN.COLUMNS.push(col);for(var v=0;v<a.EXECUTIONPLAN.COLUMNS.length;v++)p.push(d[a.EXECUTIONPLAN.COLUMNS[v]]);a.EXECUTIONPLAN.DATA.push(p)}c>n.ddl.length-1&&r.push(a);if(c<l.length-1){do c++,h=l[c];while(c<l.length-1&&h.match(/^\s*$/));h.match(/^\s*$/)?(i.executeSql("intentional failure used to rollback transaction"),t.success(r)):i.executeSql(h,[],s,o)}else i.executeSql("intentional failure used to rollback transaction"),t.success(r)},function(e,u){c>n.ddl.length-1&&r.push(a);if(c<l.length-1){do c++,h=l[c];while(c<l.length-1&&h.match(/^\s*$/));h.match(/^\s*$/)?(i.executeSql("intentional failure used to rollback transaction"),t.success(r)):i.executeSql(h,[],s,o)}else i.executeSql("intentional failure used to rollback transaction"),t.success(r)})},o=function(e,n){if(n.message!="not an error"){var i={SUCCEEDED:!1,EXECUTIONTIME:new Date-p,ERRORMESSAGE:n.message};r.push(i)}return t.success(r),!0},u=[],a,f=!1,l=n.ddl.slice(0);e.each(n.splitStatement(t.sql,t.statement_separator),function(e,t){l.push(t)});var c=0,h=l[c],p=new Date;i.executeSql(h,[],s,o)})}catch(i){t.error(i)}},n}),define("BrowserEngines/engines",["BrowserEngines/sqljs_driver","BrowserEngines/websql_driver"],function(e,t){return{sqljs:new e,websql:new t}});var JSON;JSON||(JSON={}),function(){function f(e){return e<10?"0"+e:e}function quote(e){return escapable.lastIndex=0,escapable.test(e)?'"'+e.replace(escapable,function(e){var t=meta[e];return typeof t=="string"?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var n,r,i,s,o=gap,u,a=t[e];a&&typeof a=="object"&&typeof a.toJSON=="function"&&(a=a.toJSON(e)),typeof rep=="function"&&(a=rep.call(t,e,a));switch(typeof a){case"string":return quote(a);case"number":return isFinite(a)?String(a):"null";case"boolean":case"null":return String(a);case"object":if(!a)return"null";gap+=indent,u=[];if(Object.prototype.toString.apply(a)==="[object Array]"){s=a.length;for(n=0;n<s;n+=1)u[n]=str(n,a)||"null";return i=u.length===0?"[]":gap?"[\n"+gap+u.join(",\n"+gap)+"\n"+o+"]":"["+u.join(",")+"]",gap=o,i}if(rep&&typeof rep=="object"){s=rep.length;for(n=0;n<s;n+=1)typeof rep[n]=="string"&&(r=rep[n],i=str(r,a),i&&u.push(quote(r)+(gap?": ":":")+i))}else for(r in a)Object.prototype.hasOwnProperty.call(a,r)&&(i=str(r,a),i&&u.push(quote(r)+(gap?": ":":")+i));return i=u.length===0?"{}":gap?"{\n"+gap+u.join(",\n"+gap)+"\n"+o+"}":"{"+u.join(",")+"}",gap=o,i}}typeof Date.prototype.toJSON!="function"&&(Date.prototype.toJSON=function(e){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(e){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;typeof JSON.stringify!="function"&&(JSON.stringify=function(e,t,n){var r;gap="",indent="";if(typeof n=="number")for(r=0;r<n;r+=1)indent+=" ";else typeof n=="string"&&(indent=n);rep=t;if(!t||typeof t=="function"||typeof t=="object"&&typeof t.length=="number")return str("",{"":e});throw new Error("JSON.stringify")}),typeof JSON.parse!="function"&&(JSON.parse=function(text,reviver){function walk(e,t){var n,r,i=e[t];if(i&&typeof i=="object")for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(r=walk(i,n),r!==undefined?i[n]=r:delete i[n]);return reviver.call(e,t,i)}var j;text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),typeof reviver=="function"?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}(),define("libs/json2",function(){}),function(){var e=this,t=e.Backbone,n=Array.prototype.splice,r;typeof exports!="undefined"?r=exports:r=e.Backbone={},r.VERSION="0.9.2";var i=e._;!i&&typeof require!="undefined"&&(i=require("underscore")),r.$=e.jQuery||e.Zepto||e.ender,r.noConflict=function(){return e.Backbone=t,this},r.emulateHTTP=!1,r.emulateJSON=!1;var s=/\s+/,o=r.Events={on:function(e,t,n){var r,i,o;if(!t)return this;e=e.split(s),r=this._callbacks||(this._callbacks={});while(i=e.shift())o=r[i]||(r[i]=[]),o.push(t,n);return this},off:function(e,t,n){var r,o,u,a;if(!(o=this._callbacks))return this;if(!(e||t||n))return delete this._callbacks,this;e=e?e.split(s):i.keys(o);while(r=e.shift()){if(!(u=o[r])||!t&&!n){delete o[r];continue}for(a=u.length-2;a>=0;a-=2)t&&u[a]!==t||n&&u[a+1]!==n||u.splice(a,2)}return this},trigger:function(e){var t,n,r,i,o,u,a,f;if(!(n=this._callbacks))return this;f=[],e=e.split(s);for(i=1,o=arguments.length;i<o;i++)f[i-1]=arguments[i];while(t=e.shift()){if(a=n.all)a=a.slice();if(r=n[t])r=r.slice();if(r)for(i=0,o=r.length;i<o;i+=2)r[i].apply(r[i+1]||this,f);if(a){u=[t].concat(f);for(i=0,o=a.length;i<o;i+=2)a[i].apply(a[i+1]||this,u)}}return this}};o.bind=o.on,o.unbind=o.off;var u=r.Model=function(e,t){var n;e||(e={}),t&&t.collection&&(this.collection=t.collection),t&&t.parse&&(e=this.parse(e));if(n=N(this,"defaults"))e=i.extend({},n,e);this.attributes={},this._escapedAttributes={},this.cid=i.uniqueId("c"),this.changed={},this._silent={},this._pending={},this.set(e,{silent:!0}),this.changed={},this._silent={},this._pending={},this._previousAttributes=i.clone(this.attributes),this.initialize.apply(this,arguments)};i.extend(u.prototype,o,{changed:null,_silent:null,_pending:null,idAttribute:"id",initialize:function(){},toJSON:function(e){return i.clone(this.attributes)},sync:function(){return r.sync.apply(this,arguments)},get:function(e){return this.attributes[e]},escape:function(e){var t;if(t=this._escapedAttributes[e])return t;var n=this.get(e);return this._escapedAttributes[e]=i.escape(n==null?"":""+n)},has:function(e){return this.get(e)!=null},set:function(e,t,n){var r,s,o;i.isObject(e)||e==null?(r=e,n=t):(r={},r[e]=t),n||(n={});if(!r)return this;r instanceof u&&(r=r.attributes);if(n.unset)for(s in r)r[s]=void 0;if(!this._validate(r,n))return!1;this.idAttribute in r&&(this.id=r[this.idAttribute]);var a=n.changes={},f=this.attributes,l=this._escapedAttributes,c=this._previousAttributes||{};for(s in r){o=r[s];if(!i.isEqual(f[s],o)||n.unset&&i.has(f,s))delete l[s],(n.silent?this._silent:a)[s]=!0;n.unset?delete f[s]:f[s]=o,!i.isEqual(c[s],o)||i.has(f,s)!=i.has(c,s)?(this.changed[s]=o,n.silent||(this._pending[s]=!0)):(delete this.changed[s],delete this._pending[s])}return n.silent||this.change(n),this},unset:function(e,t){return t=i.extend({},t,{unset:!0}),this.set(e,null,t)},clear:function(e){return e=i.extend({},e,{unset:!0}),this.set(i.clone(this.attributes),e)},fetch:function(e){e=e?i.clone(e):{};var t=this,n=e.success;return e.success=function(r,i,s){if(!t.set(t.parse(r,s),e))return!1;n&&n(t,r,e),t.trigger("sync",t,r,e)},e.error=r.wrapError(e.error,t,e),this.sync("read",this,e)},save:function(e,t,n){var s,o,u;i.isObject(e)||e==null?(s=e,n=t):(s={},s[e]=t),n=n?i.clone(n):{};if(n.wait){if(!this._validate(s,n))return!1;o=i.clone(this.attributes)}var a=i.extend({},n,{silent:!0});if(s&&!this.set(s,n.wait?a:n))return!1;if(!s&&!this.isValid())return!1;var f=this,l=n.success;n.success=function(e,t,r){u=!0;var o=f.parse(e,r);n.wait&&(o=i.extend(s||{},o));if(!f.set(o,n))return!1;l&&l(f,e,n),f.trigger("sync",f,e,n)},n.error=r.wrapError(n.error,f,n);var c=this.sync(this.isNew()?"create":"update",this,n);return!u&&n.wait&&(this.clear(a),this.set(o,a)),c},destroy:function(e){e=e?i.clone(e):{};var t=this,n=e.success,s=function(){t.trigger("destroy",t,t.collection,e)};e.success=function(r){(e.wait||t.isNew())&&s(),n&&n(t,r,e),t.isNew()||t.trigger("sync",t,r,e)};if(this.isNew())return e.success(),!1;e.error=r.wrapError(e.error,t,e);var o=this.sync("delete",this,e);return e.wait||s(),o},url:function(){var e=N(this,"urlRoot")||N(this.collection,"url")||C();return this.isNew()?e:e+(e.charAt(e.length-1)=="/"?"":"/")+encodeURIComponent(this.id)},parse:function(e,t){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return this.id==null},change:function(e){e||(e={});var t=this._changing;this._changing=!0;for(var n in this._silent)this._pending[n]=!0;var r=i.extend({},e.changes,this._silent);this._silent={};for(var n in r)this.trigger("change:"+n,this,this.get(n),e);if(t)return this;while(!i.isEmpty(this._pending)){this._pending={},this.trigger("change",this,e);for(var n in this.changed){if(this._pending[n]||this._silent[n])continue;delete this.changed[n]}this._previousAttributes=i.clone(this.attributes)}return this._changing=!1,this},hasChanged:function(e){return e==null?!i.isEmpty(this.changed):i.has(this.changed,e)},changedAttributes:function(e){if(!e)return this.hasChanged()?i.clone(this.changed):!1;var t,n=!1,r=this._previousAttributes;for(var s in e){if(i.isEqual(r[s],t=e[s]))continue;(n||(n={}))[s]=t}return n},previous:function(e){return e==null||!this._previousAttributes?null:this._previousAttributes[e]},previousAttributes:function(){return i.clone(this._previousAttributes)},isValid:function(){return!this.validate||!this.validate(this.attributes)},_validate:function(e,t){if(t.silent||!this.validate)return!0;e=i.extend({},this.attributes,e);var n=this.validate(e,t);return n?(t&&t.error?t.error(this,n,t):this.trigger("error",this,n,t),!1):!0}});var a=r.Collection=function(e,t){t||(t={}),t.model&&(this.model=t.model),t.comparator!==undefined&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,{silent:!0,parse:t.parse})};i.extend(a.prototype,o,{model:u,initialize:function(){},toJSON:function(e){return this.map(function(t){return t.toJSON(e)})},sync:function(){return r.sync.apply(this,arguments)},add:function(e,t){var r,s,o,u,a,f,l={},c={},h=[];t||(t={}),e=i.isArray(e)?e.slice():[e];for(r=0,o=e.length;r<o;r++){if(!(u=e[r]=this._prepareModel(e[r],t)))throw new Error("Can't add an invalid model to a collection");a=u.cid,f=u.id;if(l[a]||this._byCid[a]||f!=null&&(c[f]||this._byId[f])){h.push(r);continue}l[a]=c[f]=u}r=h.length;while(r--)h[r]=e.splice(h[r],1)[0];for(r=0,o=e.length;r<o;r++)(u=e[r]).on("all",this._onModelEvent,this),this._byCid[u.cid]=u,u.id!=null&&(this._byId[u.id]=u);this.length+=o,s=t.at!=null?t.at:this.models.length,n.apply(this.models,[s,0].concat(e));if(t.merge)for(r=0,o=h.length;r<o;r++)(u=this._byId[h[r].id])&&u.set(h[r],t);this.comparator&&t.at==null&&this.sort({silent:!0});if(t.silent)return this;for(r=0,o=this.models.length;r<o;r++){if(!l[(u=this.models[r]).cid])continue;t.index=r,u.trigger("add",u,this,t)}return this},remove:function(e,t){var n,r,s,o;t||(t={}),e=i.isArray(e)?e.slice():[e];for(n=0,r=e.length;n<r;n++){o=this.getByCid(e[n])||this.get(e[n]);if(!o)continue;delete this._byId[o.id],delete this._byCid[o.cid],s=this.indexOf(o),this.models.splice(s,1),this.length--,t.silent||(t.index=s,o.trigger("remove",o,this,t)),this._removeReference(o)}return this},push:function(e,t){return e=this._prepareModel(e,t),this.add(e,t),e},pop:function(e){var t=this.at(this.length-1);return this.remove(t,e),t},unshift:function(e,t){return e=this._prepareModel(e,t),this.add(e,i.extend({at:0},t)),e},shift:function(e){var t=this.at(0);return this.remove(t,e),t},slice:function(e,t){return this.models.slice(e,t)},get:function(e){return e==null?void 0:this._byId[e.id!=null?e.id:e]},getByCid:function(e){return e&&this._byCid[e.cid||e]},at:function(e){return this.models[e]},where:function(e){return i.isEmpty(e)?[]:this.filter(function(t){for(var n in e)if(e[n]!==t.get(n))return!1;return!0})},sort:function(e){e||(e={});if(!this.comparator)throw new Error("Cannot sort a set without a comparator");var t=i.bind(this.comparator,this);return this.comparator.length==1?this.models=this.sortBy(t):this.models.sort(t),e.silent||this.trigger("reset",this,e),this},pluck:function(e){return i.map(this.models,function(t){return t.get(e)})},reset:function(e,t){e||(e=[]),t||(t={});for(var n=0,r=this.models.length;n<r;n++)this._removeReference(this.models[n]);return this._reset(),this.add(e,i.extend({silent:!0},t)),t.silent||this.trigger("reset",this,t),this},fetch:function(e){e=e?i.clone(e):{},e.parse===undefined&&(e.parse=!0);var t=this,n=e.success;return e.success=function(r,i,s){t[e.add?"add":"reset"](t.parse(r,s),e),n&&n(t,r,e),t.trigger("sync",t,r,e)},e.error=r.wrapError(e.error,t,e),this.sync("read",this,e)},create:function(e,t){var n=this;t=t?i.clone(t):{},e=this._prepareModel(e,t);if(!e)return!1;t.wait||n.add(e,t);var r=t.success;return t.success=function(e,t,i){i.wait&&n.add(e,i),r&&r(e,t,i)},e.save(null,t),e},parse:function(e,t){return e},clone:function(){return new this.constructor(this.models)},chain:function(){return i(this.models).chain()},_reset:function(e){this.length=0,this.models=[],this._byId={},this._byCid={}},_prepareModel:function(e,t){if(e instanceof u)return e.collection||(e.collection=this),e;t||(t={}),t.collection=this;var n=new this.model(e,t);return n._validate(n.attributes,t)?n:!1},_removeReference:function(e){this==e.collection&&delete e.collection,e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,n,r){if((e=="add"||e=="remove")&&n!=this)return;e=="destroy"&&this.remove(t,r),t&&e==="change:"+t.idAttribute&&(delete this._byId[t.previous(t.idAttribute)],t.id!=null&&(this._byId[t.id]=t)),this.trigger.apply(this,arguments)}});var f=["forEach","each","map","reduce","reduceRight","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","sortBy","sortedIndex","toArray","size","first","initial","rest","last","without","indexOf","shuffle","lastIndexOf","isEmpty","groupBy"];i.each(f,function(e){a.prototype[e]=function(){return i[e].apply(i,[this.models].concat(i.toArray(arguments)))}});var l=r.Router=function(e){e||(e={}),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},c=/:\w+/g,h=/\*\w+/g,p=/[-[\]{}()+?.,\\^$|#\s]/g;i.extend(l.prototype,o,{initialize:function(){},route:function(e,t,n){return r.history||(r.history=new d),i.isRegExp(e)||(e=this._routeToRegExp(e)),n||(n=this[t]),r.history.route(e,i.bind(function(i){var s=this._extractParameters(e,i);n&&n.apply(this,s),this.trigger.apply(this,["route:"+t].concat(s)),r.history.trigger("route",this,t,s)},this)),this},navigate:function(e,t){r.history.navigate(e,t)},_bindRoutes:function(){if(!this.routes)return;var e=[];for(var t in this.routes)e.unshift([t,this.routes[t]]);for(var n=0,r=e.length;n<r;n++)this.route(e[n][0],e[n][1],this[e[n][1]])},_routeToRegExp:function(e){return e=e.replace(p,"\\$&").replace(c,"([^/]+)").replace(h,"(.*?)"),new RegExp("^"+e+"$")},_extractParameters:function(e,t){return e.exec(t).slice(1)}});var d=r.History=function(t){this.handlers=[],i.bindAll(this,"checkUrl"),this.location=t&&t.location||e.location,this.history=t&&t.history||e.history},v=/^[#\/]/,m=/msie [\w.]+/,g=/\/$/;d.started=!1,i.extend(d.prototype,o,{interval:50,getHash:function(e){var t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getFragment:function(e,t){if(e==null)if(this._hasPushState||!this._wantsHashChange||t){e=this.location.pathname;var n=this.options.root.replace(g,"");e.indexOf(n)||(e=e.substr(n.length))}else e=this.getHash();return decodeURIComponent(e.replace(v,""))},start:function(e){if(d.started)throw new Error("Backbone.history has already been started");d.started=!0,this.options=i.extend({},{root:"/"},this.options,e),this._wantsHashChange=this.options.hashChange!==!1,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var t=this.getFragment(),n=document.documentMode,s=m.exec(navigator.userAgent.toLowerCase())&&(!n||n<=7);s&&this._wantsHashChange&&(this.iframe=r.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(t)),this._hasPushState?r.$(window).bind("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!s?r.$(window).bind("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=t;var o=this.location,u=o.pathname==this.options.root&&!o.search;if(this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!u)return this.fragment=this.getFragment(null,!0),this.location.replace(this.options.root+this.location.search+"#"+this.fragment),!0;this._wantsPushState&&this._hasPushState&&u&&o.hash&&(this.fragment=this.getHash().replace(v,""),this.history.replaceState({},document.title,o.protocol+"//"+o.host+this.options.root+this.fragment));if(!this.options.silent)return this.loadUrl()},stop:function(){r.$(window).unbind("popstate",this.checkUrl).unbind("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),d.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(e){var t=this.getFragment();t==this.fragment&&this.iframe&&(t=this.getFragment(this.getHash(this.iframe)));if(t==this.fragment)return!1;this.iframe&&this.navigate(t),this.loadUrl()||this.loadUrl(this.getHash())},loadUrl:function(e){var t=this.fragment=this.getFragment(e),n=i.any(this.handlers,function(e){if(e.route.test(t))return e.callback(t),!0});return n},navigate:function(e,t){if(!d.started)return!1;if(!t||t===!0)t={trigger:t};var n=(e||"").replace(v,"");if(this.fragment==n)return;this.fragment=n;var r=(n.indexOf(this.options.root)!=0?this.options.root:"")+n;if(this._hasPushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,r);else{if(!this._wantsHashChange)return this.location.assign(r);this._updateHash(this.location,n,t.replace),this.iframe&&n!=this.getFragment(this.getHash(this.iframe))&&(t.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,n,t.replace))}t.trigger&&this.loadUrl(e)},_updateHash:function(e,t,n){n?e.replace(e.href.replace(/(javascript:|#).*$/,"")+"#"+t):e.hash=t}});var y=r.View=function(e){this.cid=i.uniqueId("view"),this._configure(e||{}),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},b=/^(\S+)\s*(.*)$/,w=["model","collection","el","id","attributes","className","tagName"];i.extend(y.prototype,o,{tagName:"div",$:function(e){return this.$el.find(e)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this},make:function(e,t,n){var i=document.createElement(e);return t&&r.$(i).attr(t),n!=null&&r.$(i).html(n),i},setElement:function(e,t){return this.$el&&this.undelegateEvents(),this.$el=e instanceof r.$?e:r.$(e),this.el=this.$el[0],t!==!1&&this.delegateEvents(),this},delegateEvents:function(e){if(!e&&!(e=N(this,"events")))return;this.undelegateEvents();for(var t in e){var n=e[t];i.isFunction(n)||(n=this[e[t]]);if(!n)throw new Error('Method "'+e[t]+'" does not exist');var r=t.match(b),s=r[1],o=r[2];n=i.bind(n,this),s+=".delegateEvents"+this.cid,o===""?this.$el.bind(s,n):this.$el.delegate(o,s,n)}},undelegateEvents:function(){this.$el.unbind(".delegateEvents"+this.cid)},_configure:function(e){this.options&&(e=i.extend({},this.options,e));for(var t=0,n=w.length;t<n;t++){var r=w[t];e[r]&&(this[r]=e[r])}this.options=e},_ensureElement:function(){if(!this.el){var e=i.extend({},N(this,"attributes"));this.id&&(e.id=this.id),this.className&&(e["class"]=this.className),this.setElement(this.make(N(this,"tagName"),e),!1)}else this.setElement(this.el,!1)}});var E=function(e,t){var n=T(this,e,t);return n.extend=this.extend,n};u.extend=a.extend=l.extend=y.extend=E;var S={create:"POST",update:"PUT","delete":"DELETE",read:"GET"};r.sync=function(e,t,n){var s=S[e];n||(n={});var o={type:s,dataType:"json"};return n.url||(o.url=N(t,"url")||C()),!n.data&&t&&(e=="create"||e=="update")&&(o.contentType="application/json",o.data=JSON.stringify(t)),r.emulateJSON&&(o.contentType="application/x-www-form-urlencoded",o.data=o.data?{model:o.data}:{}),r.emulateHTTP&&(s==="PUT"||s==="DELETE")&&(r.emulateJSON&&(o.data._method=s),o.type="POST",o.beforeSend=function(e){e.setRequestHeader("X-HTTP-Method-Override",s)}),o.type!=="GET"&&!r.emulateJSON&&(o.processData=!1),r.ajax(i.extend(o,n))},r.ajax=function(){return r.$.ajax.apply(r.$,arguments)},r.wrapError=function(e,t,n){return function(r,i){i=r===t?i:r,e?e(t,i,n):t.trigger("error",t,i,n)}};var x=function(){},T=function(e,t,n){var r;return t&&t.hasOwnProperty("constructor")?r=t.constructor:r=function(){e.apply(this,arguments)},i.extend(r,e),x.prototype=e.prototype,r.prototype=new x,t&&i.extend(r.prototype,t),n&&i.extend(r,n),r.prototype.constructor=r,r.__super__=e.prototype,r},N=function(e,t){return!e||!e[t]?null:i.isFunction(e[t])?e[t]():e[t]},C=function(){throw new Error('A "url" property or function must be specified')}}.call(this),define("Backbone",["Underscore","jQuery","libs/json2"],function(e){return function(){return e.Backbone}}(this)),define("fiddle_backbone/models/UsedFiddle",["Backbone"],function(e){var t=e.Model.extend({defaults:{fragment:"",full_name:"",ddl:"",sql:""},initialize:function(){this.set("last_used",new Date)}});return t}),define("fiddle_backbone/models/MyFiddleHistory",["Backbone","fiddle_backbone/models/UsedFiddle"],function(e,t){var n=e.Collection.extend({model:t,comparator:function(e,t){return e.get("last_used")==t.get("last_used")?0:e.get("last_used")>t.get("last_used")?-1:1},insert:function(e){if(!$("#user_choices",this).length){var t=this.find(function(t){return t.get("fragment")==e.get("fragment")});t?(t.set("last_used",e.get("last_used")),this.sort()):this.add(e),this.trigger("change")}},initialize:function(){try{if(localStorage){var e=localStorage.getItem("fiddleHistory");e&&e.length&&this.add($.parseJSON(e))}}catch(t){}}});return n}),define("fiddle_backbone/models/DBType",["Backbone"],function(e){var t=e.Model.extend({defaults:{sample_fragment:"",notes:"",simple_name:"",full_name:"",selected:!1,context:"host",className:""}});return t}),define("fiddle_backbone/models/DBTypesList",["Backbone","fiddle_backbone/models/DBType"],function(e,t){var n=e.Collection.extend({model:t,getSelectedType:function(){var e=this.filter(function(e){return e.get("selected")});return e.length?e[0]:!1},setSelectedType:function(e,t){this.each(function(t){t.set({selected:t.id==e},{silent:!0})}),t||this.trigger("change")}});return n}),define("fiddle_backbone/models/SchemaDef",["Backbone"],function(e){var t=e.Model.extend({defaults:{ddl:"",short_code:"",simple_name:"",full_name:"",valid:!0,errorMessage:"",loading:!1,ready:!1,schema_structure:[],statement_separator:";",browserEngines:{}},reset:function(){this.set(this.defaults),this.trigger("reloaded")},build:function(e){var t=e.getSelectedType(),n=this;if(!t)return!1;(!this.has("dbType")||this.get("dbType").id!=t.id)&&this.set("dbType",t),$.ajax({type:"POST",url:"index.cfm/fiddles/createSchema",data:{statement_separator:this.get("statement_separator"),db_type_id:this.get("dbType").id,schema_ddl:this.get("ddl")},dataType:"json",success:function(e,r,i){e.short_code?t.get("context")=="browser"?n.get("browserEngines")[t.get("className")].buildSchema({short_code:$.trim(e.short_code),statement_separator:n.get("statement_separator"),ddl:n.get("ddl"),success:function(){n.set({short_code:$.trim(e.short_code),ready:!0,valid:!0,errorMessage:""}),n.get("browserEngines")[t.get("className")].getSchemaStructure({callback:function(e){n.set({schema_structure:e}),n.trigger("built")}})},error:function(t){n.set({short_code:$.trim(e.short_code),ready:!1,valid:!1,errorMessage:t,schema_structure:[]}),n.trigger("failed")}}):(n.set({short_code:$.trim(e.short_code),ready:!0,valid:!0,errorMessage:"",schema_structure:e.schema_structure}),n.trigger("built")):(n.set({short_code:"",ready:!1,valid:!1,errorMessage:e.error,schema_structure:[]}),n.trigger("failed"))},error:function(e,t,r){n.set({short_code:"",ready:!1,valid:!1,errorMessage:r,schema_structure:[]}),n.trigger("failed")}})}});return t}),define("fiddle_backbone/models/Query",["jQuery","Backbone"],function(e,t){var n=t.Model.extend({defaults:{id:0,sql:"",sets:[],pendingChanges:!1,statement_separator:";"},reset:function(){this.set(this.defaults),this.trigger("reloaded")},execute:function(){var t=this;if(!this.has("schemaDef")||!this.get("schemaDef").has("dbType")||!this.get("schemaDef").get("ready"))return!1;e.ajax({type:"POST",url:"index.cfm/fiddles/runQuery",data:{db_type_id:this.get("schemaDef").get("dbType").id,schema_short_code:this.get("schemaDef").get("short_code"),statement_separator:this.get("statement_separator"),sql:this.get("sql")},dataType:"json",success:function(e,n,r){t.get("schemaDef").get("dbType").get("context")=="browser"?t.get("schemaDef").get("browserEngines")[t.get("schemaDef").get("dbType").get("className")].executeQuery({sql:t.get("sql"),statement_separator:t.get("statement_separator"),success:function(n){t.set({id:e.ID,sets:n}),t.trigger("executed")},error:function(e){t.set({sets:[{SUCCEEDED:!1,ERRORMESSAGE:e}]}),t.trigger("executed")}}):t.set({id:e.ID,sets:e.sets})},error:function(e,n,r){t.set({sets:[]})},complete:function(e,n){t.trigger("executed")}})}});return n});var Handlebars={};Handlebars.VERSION="1.0.beta.6",Handlebars.helpers={},Handlebars.partials={},Handlebars.registerHelper=function(e,t,n){n&&(t.not=n),this.helpers[e]=t},Handlebars.registerPartial=function(e,t){this.partials[e]=t},Handlebars.registerHelper("helperMissing",function(e){if(arguments.length===2)return undefined;throw new Error("Could not find property '"+e+"'")});var toString=Object.prototype.toString,functionType="[object Function]";Handlebars.registerHelper("blockHelperMissing",function(e,t){var n=t.inverse||function(){},r=t.fn,i="",s=toString.call(e);s===functionType&&(e=e.call(this));if(e===!0)return r(this);if(e===!1||e==null)return n(this);if(s==="[object Array]"){if(e.length>0)for(var o=0,u=e.length;o<u;o++)i+=r(e[o]);else i=n(this);return i}return r(e)}),Handlebars.registerHelper("each",function(e,t){var n=t.fn,r=t.inverse,i="";if(e&&e.length>0)for(var s=0,o=e.length;s<o;s++)i+=n(e[s]);else i=r(this);return i}),Handlebars.registerHelper("if",function(e,t){var n=toString.call(e);return n===functionType&&(e=e.call(this)),!e||Handlebars.Utils.isEmpty(e)?t.inverse(this):t.fn(this)}),Handlebars.registerHelper("unless",function(e,t){var n=t.fn,r=t.inverse;return t.fn=r,t.inverse=n,Handlebars.helpers["if"].call(this,e,t)}),Handlebars.registerHelper("with",function(e,t){return t.fn(e)}),Handlebars.registerHelper("log",function(e){Handlebars.log(e)});var handlebars=function(){var e={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,statements:6,simpleInverse:7,statement:8,openInverse:9,closeBlock:10,openBlock:11,mustache:12,partial:13,CONTENT:14,COMMENT:15,OPEN_BLOCK:16,inMustache:17,CLOSE:18,OPEN_INVERSE:19,OPEN_ENDBLOCK:20,path:21,OPEN:22,OPEN_UNESCAPED:23,OPEN_PARTIAL:24,params:25,hash:26,param:27,STRING:28,INTEGER:29,BOOLEAN:30,hashSegments:31,hashSegment:32,ID:33,EQUALS:34,pathSegments:35,SEP:36,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"OPEN_PARTIAL",28:"STRING",29:"INTEGER",30:"BOOLEAN",33:"ID",34:"EQUALS",36:"SEP"},productions_:[0,[3,2],[4,3],[4,1],[4,0],[6,1],[6,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[7,2],[17,3],[17,2],[17,2],[17,1],[25,2],[25,1],[27,1],[27,1],[27,1],[27,1],[26,1],[31,2],[31,1],[32,3],[32,3],[32,3],[32,3],[21,1],[35,3],[35,1]],performAction:function(t,n,r,i,s,o,u){var a=o.length-1;switch(s){case 1:return o[a-1];case 2:this.$=new i.ProgramNode(o[a-2],o[a]);break;case 3:this.$=new i.ProgramNode(o[a]);break;case 4:this.$=new i.ProgramNode([]);break;case 5:this.$=[o[a]];break;case 6:o[a-1].push(o[a]),this.$=o[a-1];break;case 7:this.$=new i.InverseNode(o[a-2],o[a-1],o[a]);break;case 8:this.$=new i.BlockNode(o[a-2],o[a-1],o[a]);break;case 9:this.$=o[a];break;case 10:this.$=o[a];break;case 11:this.$=new i.ContentNode(o[a]);break;case 12:this.$=new i.CommentNode(o[a]);break;case 13:this.$=new i.MustacheNode(o[a-1][0],o[a-1][1]);break;case 14:this.$=new i.MustacheNode(o[a-1][0],o[a-1][1]);break;case 15:this.$=o[a-1];break;case 16:this.$=new i.MustacheNode(o[a-1][0],o[a-1][1]);break;case 17:this.$=new i.MustacheNode(o[a-1][0],o[a-1][1],!0);break;case 18:this.$=new i.PartialNode(o[a-1]);break;case 19:this.$=new i.PartialNode(o[a-2],o[a-1]);break;case 20:break;case 21:this.$=[[o[a-2]].concat(o[a-1]),o[a]];break;case 22:this.$=[[o[a-1]].concat(o[a]),null];break;case 23:this.$=[[o[a-1]],o[a]];break;case 24:this.$=[[o[a]],null];break;case 25:o[a-1].push(o[a]),this.$=o[a-1];break;case 26:this.$=[o[a]];break;case 27:this.$=o[a];break;case 28:this.$=new i.StringNode(o[a]);break;case 29:this.$=new i.IntegerNode(o[a]);break;case 30:this.$=new i.BooleanNode(o[a]);break;case 31:this.$=new i.HashNode(o[a]);break;case 32:o[a-1].push(o[a]),this.$=o[a-1];break;case 33:this.$=[o[a]];break;case 34:this.$=[o[a-2],o[a]];break;case 35:this.$=[o[a-2],new i.StringNode(o[a])];break;case 36:this.$=[o[a-2],new i.IntegerNode(o[a])];break;case 37:this.$=[o[a-2],new i.BooleanNode(o[a])];break;case 38:this.$=new i.IdNode(o[a]);break;case 39:o[a-2].push(o[a]),this.$=o[a-2];break;case 40:this.$=[o[a]]}},table:[{3:1,4:2,5:[2,4],6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{1:[3]},{5:[1,16]},{5:[2,3],7:17,8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,19],20:[2,3],22:[1,13],23:[1,14],24:[1,15]},{5:[2,5],14:[2,5],15:[2,5],16:[2,5],19:[2,5],20:[2,5],22:[2,5],23:[2,5],24:[2,5]},{4:20,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{4:21,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{17:22,21:23,33:[1,25],35:24},{17:26,21:23,33:[1,25],35:24},{17:27,21:23,33:[1,25],35:24},{17:28,21:23,33:[1,25],35:24},{21:29,33:[1,25],35:24},{1:[2,1]},{6:30,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{5:[2,6],14:[2,6],15:[2,6],16:[2,6],19:[2,6],20:[2,6],22:[2,6],23:[2,6],24:[2,6]},{17:22,18:[1,31],21:23,33:[1,25],35:24},{10:32,20:[1,33]},{10:34,20:[1,33]},{18:[1,35]},{18:[2,24],21:40,25:36,26:37,27:38,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,38],28:[2,38],29:[2,38],30:[2,38],33:[2,38],36:[1,46]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],36:[2,40]},{18:[1,47]},{18:[1,48]},{18:[1,49]},{18:[1,50],21:51,33:[1,25],35:24},{5:[2,2],8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,2],22:[1,13],23:[1,14],24:[1,15]},{14:[2,20],15:[2,20],16:[2,20],19:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,7],14:[2,7],15:[2,7],16:[2,7],19:[2,7],20:[2,7],22:[2,7],23:[2,7],24:[2,7]},{21:52,33:[1,25],35:24},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{18:[2,22],21:40,26:53,27:54,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,23]},{18:[2,26],28:[2,26],29:[2,26],30:[2,26],33:[2,26]},{18:[2,31],32:55,33:[1,56]},{18:[2,27],28:[2,27],29:[2,27],30:[2,27],33:[2,27]},{18:[2,28],28:[2,28],29:[2,28],30:[2,28],33:[2,28]},{18:[2,29],28:[2,29],29:[2,29],30:[2,29],33:[2,29]},{18:[2,30],28:[2,30],29:[2,30],30:[2,30],33:[2,30]},{18:[2,33],33:[2,33]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],34:[1,57],36:[2,40]},{33:[1,58]},{14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,17],14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],24:[2,17]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]},{18:[1,59]},{18:[1,60]},{18:[2,21]},{18:[2,25],28:[2,25],29:[2,25],30:[2,25],33:[2,25]},{18:[2,32],33:[2,32]},{34:[1,57]},{21:61,28:[1,62],29:[1,63],30:[1,64],33:[1,25],35:24},{18:[2,39],28:[2,39],29:[2,39],30:[2,39],33:[2,39],36:[2,39]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{18:[2,34],33:[2,34]},{18:[2,35],33:[2,35]},{18:[2,36],33:[2,36]},{18:[2,37],33:[2,37]}],defaultActions:{16:[2,1],37:[2,23],53:[2,21]},parseError:function(t,n){throw new Error(t)},parse:function(t){function d(e){r.length=r.length-2*e,i.length=i.length-e,s.length=s.length-e}function v(){var e;return e=n.lexer.lex()||1,typeof e!="number"&&(e=n.symbols_[e]||e),e}var n=this,r=[0],i=[null],s=[],o=this.table,u="",a=0,f=0,l=0,c=2,h=1;this.lexer.setInput(t),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,typeof this.lexer.yylloc=="undefined"&&(this.lexer.yylloc={});var p=this.lexer.yylloc;s.push(p),typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);var m,g,y,b,w,E,S={},x,T,N,C;for(;;){y=r[r.length-1],this.defaultActions[y]?b=this.defaultActions[y]:(m==null&&(m=v()),b=o[y]&&o[y][m]);if(typeof b=="undefined"||!b.length||!b[0])if(!l){C=[];for(x in o[y])this.terminals_[x]&&x>2&&C.push("'"+this.terminals_[x]+"'");var k="";this.lexer.showPosition?k="Parse error on line "+(a+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+C.join(", ")+", got '"+this.terminals_[m]+"'":k="Parse error on line "+(a+1)+": Unexpected "+(m==1?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(k,{text:this.lexer.match,token:this.terminals_[m]||m,line:this.lexer.yylineno,loc:p,expected:C})}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+y+", token: "+m);switch(b[0]){case 1:r.push(m),i.push(this.lexer.yytext),s.push(this.lexer.yylloc),r.push(b[1]),m=null,g?(m=g,g=null):(f=this.lexer.yyleng,u=this.lexer.yytext,a=this.lexer.yylineno,p=this.lexer.yylloc,l>0&&l--);break;case 2:T=this.productions_[b[1]][1],S.$=i[i.length-T],S._$={first_line:s[s.length-(T||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(T||1)].first_column,last_column:s[s.length-1].last_column},E=this.performAction.call(S,u,f,a,this.yy,b[1],i,s);if(typeof E!="undefined")return E;T&&(r=r.slice(0,-1*T*2),i=i.slice(0,-1*T),s=s.slice(0,-1*T)),r.push(this.productions_[b[1]][0]),i.push(S.$),s.push(S._$),N=o[r[r.length-2]][r[r.length-1]],r.push(N);break;case 3:return!0}}return!0}},t=function(){var e={EOF:1,parseError:function(t,n){if(!this.yy.parseError)throw new Error(t);this.yy.parseError(t,n)},setInput:function(e){return this._input=e,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this},input:function(){var e=this._input[0];this.yytext+=e,this.yyleng++,this.match+=e,this.matched+=e;var t=e.match(/\n/);return t&&this.yylineno++,this._input=this._input.slice(1),e},unput:function(e){return this._input=e+this._input,this},more:function(){return this._more=!0,this},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=(new Array(e.length+1)).join("-");return e+this.upcomingInput()+"\n"+t+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var e,t,n,r;this._more||(this.yytext="",this.match="");var i=this._currentRules();for(var s=0;s<i.length;s++){t=this._input.match(this.rules[i[s]]);if(t){r=t[0].match(/\n.*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-1:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this._more=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],e=this.performAction.call(this,this.yy,this,i[s],this.conditionStack[this.conditionStack.length-1]);if(e)return e;return}}if(this._input==="")return this.EOF;this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return typeof t!="undefined"?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)}};return e.performAction=function(t,n,r,i){var s=i;switch(r){case 0:n.yytext.slice(-1)!=="\\"&&this.begin("mu"),n.yytext.slice(-1)==="\\"&&(n.yytext=n.yytext.substr(0,n.yyleng-1),this.begin("emu"));if(n.yytext)return 14;break;case 1:return 14;case 2:return this.popState(),14;case 3:return 24;case 4:return 16;case 5:return 20;case 6:return 19;case 7:return 19;case 8:return 23;case 9:return 23;case 10:return n.yytext=n.yytext.substr(3,n.yyleng-5),this.popState(),15;case 11:return 22;case 12:return 34;case 13:return 33;case 14:return 33;case 15:return 36;case 16:break;case 17:return this.popState(),18;case 18:return this.popState(),18;case 19:return n.yytext=n.yytext.substr(1,n.yyleng-2).replace(/\\"/g,'"'),28;case 20:return 30;case 21:return 30;case 22:return 29;case 23:return 33;case 24:return n.yytext=n.yytext.substr(1,n.yyleng-2),33;case 25:return"INVALID";case 26:return 5}},e.rules=[/^[^\x00]*?(?=(\{\{))/,/^[^\x00]+/,/^[^\x00]{2,}?(?=(\{\{))/,/^\{\{>/,/^\{\{#/,/^\{\{\//,/^\{\{\^/,/^\{\{\s*else\b/,/^\{\{\{/,/^\{\{&/,/^\{\{![\s\S]*?\}\}/,/^\{\{/,/^=/,/^\.(?=[} ])/,/^\.\./,/^[\/.]/,/^\s+/,/^\}\}\}/,/^\}\}/,/^"(\\["]|[^"])*"/,/^true(?=[}\s])/,/^false(?=[}\s])/,/^[0-9]+(?=[}\s])/,/^[a-zA-Z0-9_$-]+(?=[=}\s\/.])/,/^\[[^\]]*\]/,/^./,/^$/],e.conditions={mu:{rules:[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26],inclusive:!1},emu:{rules:[2],inclusive:!1},INITIAL:{rules:[0,1,26],inclusive:!0}},e}();return e.lexer=t,e}();typeof require!="undefined"&&typeof exports!="undefined"&&(exports.parser=handlebars,exports.parse=function(){return handlebars.parse.apply(handlebars,arguments)},exports.main=function(t){if(!t[1])throw new Error("Usage: "+t[0]+" FILE");if(typeof process!="undefined")var n=require("fs").readFileSync(require("path").join(process.cwd(),t[1]),"utf8");else var r=require("file").path(require("file").cwd()),n=r.join(t[1]).read({charset:"utf-8"});return exports.parser.parse(n)},typeof module!="undefined"&&require.main===module&&exports.main(typeof process!="undefined"?process.argv.slice(1):require("system").args)),Handlebars.Parser=handlebars,Handlebars.parse=function(e){return Handlebars.Parser.yy=Handlebars.AST,Handlebars.Parser.parse(e)},Handlebars.print=function(e){return(new Handlebars.PrintVisitor).accept(e)},Handlebars.logger={DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(e,t){}},Handlebars.log=function(e,t){Handlebars.logger.log(e,t)},function(){Handlebars.AST={},Handlebars.AST.ProgramNode=function(e,t){this.type="program",this.statements=e,t&&(this.inverse=new Handlebars.AST.ProgramNode(t))},Handlebars.AST.MustacheNode=function(e,t,n){this.type="mustache",this.id=e[0],this.params=e.slice(1),this.hash=t,this.escaped=!n},Handlebars.AST.PartialNode=function(e,t){this.type="partial",this.id=e,this.context=t};var e=function(e,t){if(e.original!==t.original)throw new Handlebars.Exception(e.original+" doesn't match "+t.original)};Handlebars.AST.BlockNode=function(t,n,r){e(t.id,r),this.type="block",this.mustache=t,this.program=n},Handlebars.AST.InverseNode=function(t,n,r){e(t.id,r),this.type="inverse",this.mustache=t,this.program=n},Handlebars.AST.ContentNode=function(e){this.type="content",this.string=e},Handlebars.AST.HashNode=function(e){this.type="hash",this.pairs=e},Handlebars.AST.IdNode=function(e){this.type="ID",this.original=e.join(".");var t=[],n=0;for(var r=0,i=e.length;r<i;r++){var s=e[r];s===".."?n++:s==="."||s==="this"?this.isScoped=!0:t.push(s)}this.parts=t,this.string=t.join("."),this.depth=n,this.isSimple=t.length===1&&n===0},Handlebars.AST.StringNode=function(e){this.type="STRING",this.string=e},Handlebars.AST.IntegerNode=function(e){this.type="INTEGER",this.integer=e},Handlebars.AST.BooleanNode=function(e){this.type="BOOLEAN",this.bool=e},Handlebars.AST.CommentNode=function(e){this.type="comment",this.comment=e}}(),Handlebars.Exception=function(e){var t=Error.prototype.constructor.apply(this,arguments);for(var n in t)t.hasOwnProperty(n)&&(this[n]=t[n]);this.message=t.message},Handlebars.Exception.prototype=new Error,Handlebars.SafeString=function(e){this.string=e},Handlebars.SafeString.prototype.toString=function(){return this.string.toString()},function(){var e={"<":"<",">":">",'"':""","'":"'","`":"`"},t=/&(?!\w+;)|[<>"'`]/g,n=/[&<>"'`]/,r=function(t){return e[t]||"&"};Handlebars.Utils={escapeExpression:function(e){return e instanceof Handlebars.SafeString?e.toString():e==null||e===!1?"":n.test(e)?e.replace(t,r):e},isEmpty:function(e){return typeof e=="undefined"?!0:e===null?!0:e===!1?!0:Object.prototype.toString.call(e)==="[object Array]"&&e.length===0?!0:!1}}}(),Handlebars.Compiler=function(){},Handlebars.JavaScriptCompiler=function(){},function(e,t){e.OPCODE_MAP={appendContent:1,getContext:2,lookupWithHelpers:3,lookup:4,append:5,invokeMustache:6,appendEscaped:7,pushString:8,truthyOrFallback:9,functionOrFallback:10,invokeProgram:11,invokePartial:12,push:13,assignToHash:15,pushStringParam:16},e.MULTI_PARAM_OPCODES={appendContent:1,getContext:1,lookupWithHelpers:2,lookup:1,invokeMustache:3,pushString:1,truthyOrFallback:1,functionOrFallback:1,invokeProgram:3,invokePartial:1,push:1,assignToHash:1,pushStringParam:1},e.DISASSEMBLE_MAP={};for(var n in e.OPCODE_MAP){var r=e.OPCODE_MAP[n];e.DISASSEMBLE_MAP[r]=n}e.multiParamSize=function(t){return e.MULTI_PARAM_OPCODES[e.DISASSEMBLE_MAP[t]]},e.prototype={compiler:e,disassemble:function(){var t=this.opcodes,n,r,i=[],s,o,u;for(var a=0,f=t.length;a<f;a++){n=t[a];if(n==="DECLARE")o=t[++a],u=t[++a],i.push("DECLARE "+o+" = "+u);else{s=e.DISASSEMBLE_MAP[n];var l=e.multiParamSize(n),c=[];for(var h=0;h<l;h++)r=t[++a],typeof r=="string"&&(r='"'+r.replace("\n","\\n")+'"'),c.push(r);s=s+" "+c.join(" "),i.push(s)}}return i.join("\n")},guid:0,compile:function(e,t){this.children=[],this.depths={list:[]},this.options=t;var n=this.options.knownHelpers;this.options.knownHelpers={helperMissing:!0,blockHelperMissing:!0,each:!0,"if":!0,unless:!0,"with":!0,log:!0};if(n)for(var r in n)this.options.knownHelpers[r]=n[r];return this.program(e)},accept:function(e){return this[e.type](e)},program:function(e){var t=e.statements,n;this.opcodes=[];for(var r=0,i=t.length;r<i;r++)n=t[r],this[n.type](n);return this.isSimple=i===1,this.depths.list=this.depths.list.sort(function(e,t){return e-t}),this},compileProgram:function(e){var t=(new this.compiler).compile(e,this.options),n=this.guid++;this.usePartial=this.usePartial||t.usePartial,this.children[n]=t;for(var r=0,i=t.depths.list.length;r<i;r++){depth=t.depths.list[r];if(depth<2)continue;this.addDepth(depth-1)}return n},block:function(e){var t=e.mustache,n,r,i,s,o=this.setupStackForMustache(t),u=this.compileProgram(e.program);e.program.inverse&&(s=this.compileProgram(e.program.inverse),this.declare("inverse",s)),this.opcode("invokeProgram",u,o.length,!!t.hash),this.declare("inverse",null),this.opcode("append")},inverse:function(e){var t=this.setupStackForMustache(e.mustache),n=this.compileProgram(e.program);this.declare("inverse",n),this.opcode("invokeProgram",null,t.length,!!e.mustache.hash),this.declare("inverse",null),this.opcode("append")},hash:function(e){var t=e.pairs,n,r;this.opcode("push","{}");for(var i=0,s=t.length;i<s;i++)n=t[i],r=n[1],this.accept(r),this.opcode("assignToHash",n[0])},partial:function(e){var t=e.id;this.usePartial=!0,e.context?this.ID(e.context):this.opcode("push","depth0"),this.opcode("invokePartial",t.original),this.opcode("append")},content:function(e){this.opcode("appendContent",e.string)},mustache:function(e){var t=this.setupStackForMustache(e);this.opcode("invokeMustache",t.length,e.id.original,!!e.hash),e.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},ID:function(e){this.addDepth(e.depth),this.opcode("getContext",e.depth),this.opcode("lookupWithHelpers",e.parts[0]||null,e.isScoped||!1);for(var t=1,n=e.parts.length;t<n;t++)this.opcode("lookup",e.parts[t])},STRING:function(e){this.opcode("pushString",e.string)},INTEGER:function(e){this.opcode("push",e.integer)},BOOLEAN:function(e){this.opcode("push",e.bool)},comment:function(){},pushParams:function(e){var t=e.length,n;while(t--)n=e[t],this.options.stringParams?(n.depth&&this.addDepth(n.depth),this.opcode("getContext",n.depth||0),this.opcode("pushStringParam",n.string)):this[n.type](n)},opcode:function(t,n,r,i){this.opcodes.push(e.OPCODE_MAP[t]),n!==undefined&&this.opcodes.push(n),r!==undefined&&this.opcodes.push(r),i!==undefined&&this.opcodes.push(i)},declare:function(e,t){this.opcodes.push("DECLARE"),this.opcodes.push(e),this.opcodes.push(t)},addDepth:function(e){if(e===0)return;this.depths[e]||(this.depths[e]=!0,this.depths.list.push(e))},setupStackForMustache:function(e){var t=e.params;return this.pushParams(t),e.hash&&this.hash(e.hash),this.ID(e.id),t}},t.prototype={nameLookup:function(e,n,r){return/^[0-9]+$/.test(n)?e+"["+n+"]":t.isValidJavaScriptVariableName(n)?e+"."+n:e+"['"+n+"']"},appendToBuffer:function(e){return this.environment.isSimple?"return "+e+";":"buffer += "+e+";"},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(e,t,n,r){this.environment=e,this.options=t||{},this.name=this.environment.name,this.isChild=!!n,this.context=n||{programs:[],aliases:{self:"this"},registers:{list:[]}},this.preamble(),this.stackSlot=0,this.stackVars=[],this.compileChildren(e,t);var i=e.opcodes,s;this.i=0;for(u=i.length;this.i<u;this.i++)s=this.nextOpcode(0),s[0]==="DECLARE"?(this.i=this.i+2,this[s[1]]=s[2]):(this.i=this.i+s[1].length,this[s[0]].apply(this,s[1]));return this.createFunctionContext(r)},nextOpcode:function(t){var n=this.environment.opcodes,r=n[this.i+t],i,s,o,u;if(r==="DECLARE")return i=n[this.i+1],s=n[this.i+2],["DECLARE",i,s];i=e.DISASSEMBLE_MAP[r],o=e.multiParamSize(r),u=[];for(var a=0;a<o;a++)u.push(n[this.i+a+1+t]);return[i,u]},eat:function(e){this.i=this.i+e.length},preamble:function(){var e=[];this.useRegister("foundHelper");if(!this.isChild){var t=this.namespace,n="helpers = helpers || "+t+".helpers;";this.environment.usePartial&&(n=n+" partials = partials || "+t+".partials;"),e.push(n)}else e.push("");this.environment.isSimple?e.push(""):e.push(", buffer = "+this.initializeBuffer()),this.lastContext=0,this.source=e},createFunctionContext:function(e){var t=this.stackVars;this.isChild||(t=t.concat(this.context.registers.list)),t.length>0&&(this.source[1]=this.source[1]+", "+t.join(", "));if(!this.isChild){var n=[];for(var r in this.context.aliases)this.source[1]=this.source[1]+", "+r+"="+this.context.aliases[r]}this.source[1]&&(this.source[1]="var "+this.source[1].substring(2)+";"),this.isChild||(this.source[1]+="\n"+this.context.programs.join("\n")+"\n"),this.environment.isSimple||this.source.push("return buffer;");var i=this.isChild?["depth0","data"]:["Handlebars","depth0","helpers","partials","data"];for(var s=0,o=this.environment.depths.list.length;s<o;s++)i.push("depth"+this.environment.depths.list[s]);if(e)return i.push(this.source.join("\n ")),Function.apply(this,i);var u="function "+(this.name||"")+"("+i.join(",")+") {\n "+this.source.join("\n ")+"}";return Handlebars.log(Handlebars.logger.DEBUG,u+"\n\n"),u},appendContent:function(e){this.source.push(this.appendToBuffer(this.quotedString(e)))},append:function(){var e=this.popStack();this.source.push("if("+e+" || "+e+" === 0) { "+this.appendToBuffer(e)+" }"),this.environment.isSimple&&this.source.push("else { "+this.appendToBuffer("''")+" }")},appendEscaped:function(){var e=this.nextOpcode(1),t="";this.context.aliases.escapeExpression="this.escapeExpression",e[0]==="appendContent"&&(t=" + "+this.quotedString(e[1][0]),this.eat(e)),this.source.push(this.appendToBuffer("escapeExpression("+this.popStack()+")"+t))},getContext:function(e){this.lastContext!==e&&(this.lastContext=e)},lookupWithHelpers:function(e,t){if(e){var n=this.nextStack();this.usingKnownHelper=!1;var r;!t&&this.options.knownHelpers[e]?(r=n+" = "+this.nameLookup("helpers",e,"helper"),this.usingKnownHelper=!0):t||this.options.knownHelpersOnly?r=n+" = "+this.nameLookup("depth"+this.lastContext,e,"context"):(this.register("foundHelper",this.nameLookup("helpers",e,"helper")),r=n+" = foundHelper || "+this.nameLookup("depth"+this.lastContext,e,"context")),r+=";",this.source.push(r)}else this.pushStack("depth"+this.lastContext)},lookup:function(e){var t=this.topStack();this.source.push(t+" = ("+t+" === null || "+t+" === undefined || "+t+" === false ? "+t+" : "+this.nameLookup(t,e,"context")+");")},pushStringParam:function(e){this.pushStack("depth"+this.lastContext),this.pushString(e)},pushString:function(e){this.pushStack(this.quotedString(e))},push:function(e){this.pushStack(e)},invokeMustache:function(e,t,n){this.populateParams(e,this.quotedString(t),"{}",null,n,function(e,t,n){this.usingKnownHelper||(this.context.aliases.helperMissing="helpers.helperMissing",this.context.aliases.undef="void 0",this.source.push("else if("+n+"=== undef) { "+e+" = helperMissing.call("+t+"); }"),e!==n&&this.source.push("else { "+e+" = "+n+"; }"))})},invokeProgram:function(e,t,n){var r=this.programExpression(this.inverse),i=this.programExpression(e);this.populateParams(t,null,i,r,n,function(e,t,n){this.usingKnownHelper||(this.context.aliases.blockHelperMissing="helpers.blockHelperMissing",this.source.push("else { "+e+" = blockHelperMissing.call("+t+"); }"))})},populateParams:function(e,t,n,r,i,s){var o=i||this.options.stringParams||r||this.options.data,u=this.popStack(),a,f=[],l,c,h;o?(this.register("tmp1",n),h="tmp1"):h="{ hash: {} }";if(o){var p=i?this.popStack():"{}";this.source.push("tmp1.hash = "+p+";")}this.options.stringParams&&this.source.push("tmp1.contexts = [];");for(var d=0;d<e;d++)l=this.popStack(),f.push(l),this.options.stringParams&&this.source.push("tmp1.contexts.push("+this.popStack()+");");r&&(this.source.push("tmp1.fn = tmp1;"),this.source.push("tmp1.inverse = "+r+";")),this.options.data&&this.source.push("tmp1.data = data;"),f.push(h),this.populateCall(f,u,t||u,s,n!=="{}")},populateCall:function(e,t,n,r,i){var s=["depth0"].concat(e).join(", "),o=["depth0"].concat(n).concat(e).join(", "),u=this.nextStack();if(this.usingKnownHelper)this.source.push(u+" = "+t+".call("+s+");");else{this.context.aliases.functionType='"function"';var a=i?"foundHelper && ":"";this.source.push("if("+a+"typeof "+t+" === functionType) { "+u+" = "+t+".call("+s+"); }")}r.call(this,u,o,t),this.usingKnownHelper=!1},invokePartial:function(e){params=[this.nameLookup("partials",e,"partial"),"'"+e+"'",this.popStack(),"helpers","partials"],this.options.data&¶ms.push("data"),this.pushStack("self.invokePartial("+params.join(", ")+");")},assignToHash:function(e){var t=this.popStack(),n=this.topStack();this.source.push(n+"['"+e+"'] = "+t+";")},compiler:t,compileChildren:function(e,t){var n=e.children,r,i;for(var s=0,o=n.length;s<o;s++){r=n[s],i=new this.compiler,this.context.programs.push("");var u=this.context.programs.length;r.index=u,r.name="program"+u,this.context.programs[u]=i.compile(r,t,this.context)}},programExpression:function(e){if(e==null)return"self.noop";var t=this.environment.children[e],n=t.depths.list,r=[t.index,t.name,"data"];for(var i=0,s=n.length;i<s;i++)depth=n[i],depth===1?r.push("depth0"):r.push("depth"+(depth-1));return n.length===0?"self.program("+r.join(", ")+")":(r.shift(),"self.programWithDepth("+r.join(", ")+")")},register:function(e,t){this.useRegister(e),this.source.push(e+" = "+t+";")},useRegister:function(e){this.context.registers[e]||(this.context.registers[e]=!0,this.context.registers.list.push(e))},pushStack:function(e){return this.source.push(this.nextStack()+" = "+e+";"),"stack"+this.stackSlot},nextStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),"stack"+this.stackSlot},popStack:function(){return"stack"+this.stackSlot--},topStack:function(){return"stack"+this.stackSlot},quotedString:function(e){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")+'"'}};var i="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "),s=t.RESERVED_WORDS={};for(var o=0,u=i.length;o<u;o++)s[i[o]]=!0;t.isValidJavaScriptVariableName=function(e){return!t.RESERVED_WORDS[e]&&/^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(e)?!0:!1}}(Handlebars.Compiler,Handlebars.JavaScriptCompiler),Handlebars.precompile=function(e,t){t=t||{};var n=Handlebars.parse(e),r=(new Handlebars.Compiler).compile(n,t);return(new Handlebars.JavaScriptCompiler).compile(r,t)},Handlebars.compile=function(e,t){function r(){var n=Handlebars.parse(e),r=(new Handlebars.Compiler).compile(n,t),i=(new Handlebars.JavaScriptCompiler).compile(r,t,undefined,!0);return Handlebars.template(i)}t=t||{};var n;return function(e,t){return n||(n=r()),n.call(this,e,t)}},Handlebars.VM={template:function(e){var t={escapeExpression:Handlebars.Utils.escapeExpression,invokePartial:Handlebars.VM.invokePartial,programs:[],program:function(e,t,n){var r=this.programs[e];return n?Handlebars.VM.program(t,n):r?r:(r=this.programs[e]=Handlebars.VM.program(t),r)},programWithDepth:Handlebars.VM.programWithDepth,noop:Handlebars.VM.noop};return function(n,r){return r=r||{},e.call(t,Handlebars,n,r.helpers,r.partials,r.data)}},programWithDepth:function(e,t,n){var r=Array.prototype.slice.call(arguments,2);return function(n,i){return i=i||{},e.apply(this,[n,i.data||t].concat(r))}},program:function(e,t){return function(n,r){return r=r||{},e(n,r.data||t)}},noop:function(){return""},invokePartial:function(e,t,n,r,i,s){options={helpers:r,partials:i,data:s};if(e===undefined)throw new Handlebars.Exception("The partial "+t+" could not be found");if(e instanceof Function)return e(n,options);if(!Handlebars.compile)throw new Handlebars.Exception("The partial "+t+" could not be compiled when running in runtime-only mode");return i[t]=Handlebars.compile(e),i[t](n,options)}},Handlebars.template=Handlebars.VM.template,define("Handlebars",function(e){return function(){return e.Handlebars}}(this)),define("text",["module"],function(e){var t,n,r=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],i=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,s=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,o=typeof location!="undefined"&&location.href,u=o&&location.protocol&&location.protocol.replace(/\:/,""),a=o&&location.hostname,f=o&&(location.port||undefined),l=[],c=e.config&&e.config()||{};t={version:"2.0.3",strip:function(e){if(e){e=e.replace(i,"");var t=e.match(s);t&&(e=t[1])}else e="";return e},jsEscape:function(e){return e.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:c.createXhr||function(){var e,t,n;if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;if(typeof ActiveXObject!="undefined")for(t=0;t<3;t+=1){n=r[t];try{e=new ActiveXObject(n)}catch(i){}if(e){r=[n];break}}return e},parseName:function(e){var t=!1,n=e.indexOf("."),r=e.substring(0,n),i=e.substring(n+1,e.length);return n=i.indexOf("!"),n!==-1&&(t=i.substring(n+1,i.length),t=t==="strip",i=i.substring(0,n)),{moduleName:r,ext:i,strip:t}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(e,n,r,i){var s,o,u,a=t.xdRegExp.exec(e);return a?(s=a[2],o=a[3],o=o.split(":"),u=o[1],o=o[0],(!s||s===n)&&(!o||o.toLowerCase()===r.toLowerCase())&&(!u&&!o||u===i)):!0},finishLoad:function(e,n,r,i){r=n?t.strip(r):r,c.isBuild&&(l[e]=r),i(r)},load:function(e,n,r,i){if(i.isBuild&&!i.inlineText){r();return}c.isBuild=i.isBuild;var s=t.parseName(e),l=s.moduleName+"."+s.ext,h=n.toUrl(l),p=c.useXhr||t.useXhr;!o||p(h,u,a,f)?t.get(h,function(n){t.finishLoad(e,s.strip,n,r)},function(e){r.error&&r.error(e)}):n([l],function(e){t.finishLoad(s.moduleName+"."+s.ext,s.strip,e,r)})},write:function(e,n,r,i){if(l.hasOwnProperty(n)){var s=t.jsEscape(l[n]);r.asModule(e+"!"+n,"define(function () { return '"+s+"';});\n")}},writeFile:function(e,n,r,i,s){var o=t.parseName(n),u=o.moduleName+"."+o.ext,a=r.toUrl(o.moduleName+"."+o.ext)+".js";t.load(u,r,function(n){var r=function(e){return i(a,e)};r.asModule=function(e,t){return i.asModule(e,a,t)},t.write(e,u,r,s)},s)}};if(c.env==="node"||!c.env&&typeof process!="undefined"&&process.versions&&!!process.versions.node)n=require.nodeRequire("fs"),t.get=function(e,t){var r=n.readFileSync(e,"utf8");r.indexOf("")===0&&(r=r.substring(1)),t(r)};else if(c.env==="xhr"||!c.env&&t.createXhr())t.get=function(e,n,r){var i=t.createXhr();i.open("GET",e,!0),c.onXhr&&c.onXhr(i,e),i.onreadystatechange=function(t){var s,o;i.readyState===4&&(s=i.status,s>399&&s<600?(o=new Error(e+" HTTP status: "+s),o.xhr=i,r(o)):n(i.responseText))},i.send(null)};else if(c.env==="rhino"||!c.env&&typeof Packages!="undefined"&&typeof java!="undefined")t.get=function(e,t){var n,r,i="utf-8",s=new java.io.File(e),o=java.lang.System.getProperty("line.separator"),u=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(s),i)),a="";try{n=new java.lang.StringBuffer,r=u.readLine(),r&&r.length()&&r.charAt(0)===65279&&(r=r.substring(1)),n.append(r);while((r=u.readLine())!==null)n.append(o),n.append(r);a=String(n.toString())}finally{u.close()}t(a)};return t}),define("text!fiddle_backbone/templates/dbTypes.html",[],function(){return' <a class="dropdown-toggle" data-toggle="dropdown" href="#">\n {{selectedFullName}} <b class="caret"></b>\n </a>\n <ul class="dropdown-menu">\n {{#each dbTypes}}\n <li db_type_id="{{this.id}}" class="{{this.className}}"><a href="#"><i class="icon-tag"></i>{{this.full_name}}</a></li>\n {{/each}}\n </ul>'}),define("fiddle_backbone/views/DBTypesList",["jQuery","Backbone","Handlebars","text!fiddle_backbone/templates/dbTypes.html"],function(e,t,n,r){var i=t.View.extend({initialize:function(){this.compiledTemplate=n.compile(r)},events:{"click ul.dropdown-menu li":"clickDBType"},clickDBType:function(t){t.preventDefault(),this.collection.setSelectedType(e(t.currentTarget).attr("db_type_id"))},render:function(){var t=this.collection.getSelectedType();return e(this.el).html(this.compiledTemplate({dbTypes:this.collection.map(function(e){var t=e.toJSON();return t.className=t.selected?"active":"",t}),selectedFullName:t.get("full_name")})),e("#db_type_label_collapsed .navbar-text").text(t.get("full_name")),this}});return i});var CodeMirror=function(){function e(r,i){function Kt(e){return e>=0&&e<bt.size}function Gt(e){return E(bt,e)}function Yt(e,t){Bt=!0;var n=t-e.height;for(var r=e;r;r=r.parent)r.height+=n}function Zt(e){var t={line:0,ch:0};mn(t,{line:bt.size-1,ch:Gt(bt.size-1).text.length},ut(e),t,t),Ot=!0}function en(){var e=[];return bt.iter(0,bt.size,function(t){e.push(t.text)}),e.join("\n")}function tn(e){function c(e){var t=Hr(e,!0);if(t&&!Z(t,o)){Et||dn(),o=t,zn(r,t),Ot=!1;var n=Bn();if(t.line>=n.to||t.line<n.from)u=setTimeout(Jr(function(){c(e)}),150)}}function h(e){clearTimeout(u);var t=Hr(e);t&&zn(r,t),L(e),_n(),Ot=!0,p(),f()}Un(D(e,"shiftKey"));for(var t=M(e);t!=y;t=t.parentNode)if(t.parentNode==V&&t!=J)return;for(var t=M(e);t!=y;t=t.parentNode)if(t.parentNode==nt)return s.onGutterClick&&s.onGutterClick(Qt,st(nt.childNodes,t)+It,e),L(e);var r=Hr(e);switch(_(e)){case 3:j&&!n&&Br(e);return;case 2:r&&Vn(r.line,r.ch,!0);return}if(!r){M(e)==z&&L(e);return}Et||dn();var i=+(new Date);if(Nt&&Nt.time>i-400&&Z(Nt.pos,r))return L(e),setTimeout(_n,20),tr(r.line);if(Tt&&Tt.time>i-400&&Z(Tt.pos,r))return Nt={time:i,pos:r},L(e),er(r);Tt={time:i,pos:r};var o=r,u;if(s.dragDrop&&X&&!s.readOnly&&!Z(St.from,St.to)&&!et(r,St.from)&&!et(St.to,r)){R&&(rt.draggable=!0);function a(t){R&&(rt.draggable=!1),kt=!1,f(),l(),Math.abs(e.clientX-t.clientX)+Math.abs(e.clientY-t.clientY)<10&&(L(t),Vn(r.line,r.ch,!0),_n())}var f=P(document,"mouseup",Jr(a),!0),l=P(z,"drop",Jr(a),!0);kt=!0,rt.dragDrop&&rt.dragDrop();return}L(e),Vn(r.line,r.ch,!0);var p=P(document,"mousemove",Jr(function(e){clearTimeout(u),L(e),!F&&!_(e)?h(e):c(e)}),!0),f=P(document,"mouseup",Jr(h),!0)}function nn(e){for(var t=M(e);t!=y;t=t.parentNode)if(t.parentNode==nt)return L(e);var n=Hr(e);if(!n)return;Nt={time:+(new Date),pos:n},L(e),er(n)}function rn(e){if(s.onDragEvent&&s.onDragEvent(Qt,k(e)))return;e.preventDefault();var t=Hr(e,!0),n=e.dataTransfer.files;if(!t||s.readOnly)return;if(n&&n.length&&window.FileReader&&window.File){function r(e,n){var r=new FileReader;r.onload=function(){o[n]=r.result,++u==i&&(t=Jn(t),Jr(function(){var e=En(o.join(""),t,t);zn(t,e)})())},r.readAsText(e)}var i=n.length,o=Array(i),u=0;for(var a=0;a<i;++a)r(n[a],a)}else try{var o=e.dataTransfer.getData("Text");o&&Kr(function(){var e=St.from,n=St.to;zn(t,t),kt&&En("",e,n),Sn(o),_n()})}catch(e){}}function sn(e){var t=Nn();e.dataTransfer.setData("Text",t);if(j||U){var n=document.createElement("img");n.scr="data:image/gif;base64,R0lGODdhAgACAIAAAAAAAP///ywAAAAAAgACAAACAoRRADs=",e.dataTransfer.setDragImage(n,0,0)}}function on(e,t){if(typeof e=="string"){e=u[e];if(!e)return!1}var n=xt;try{s.readOnly&&(At=!0),t&&(xt=null),e(Qt)}catch(r){if(r!=B)throw r;return!1}finally{xt=n,At=!1}return!0}function un(e){function u(){o=!0}var t=f(s.keyMap),n=t.auto;clearTimeout(ln),n&&!c(e)&&(ln=setTimeout(function(){f(s.keyMap)==t&&(s.keyMap=n.call?n.call(null,Qt):n)},50));var r=ft[D(e,"keyCode")],i=!1;if(r==null||e.altGraphKey)return!1;D(e,"altKey")&&(r="Alt-"+r),D(e,"ctrlKey")&&(r="Ctrl-"+r),D(e,"metaKey")&&(r="Cmd-"+r);var o=!1;return D(e,"shiftKey")?i=l("Shift-"+r,s.extraKeys,s.keyMap,function(e){return on(e,!0)},u)||l(r,s.extraKeys,s.keyMap,function(e){if(typeof e=="string"&&/^go[A-Z]/.test(e))return on(e)},u):i=l(r,s.extraKeys,s.keyMap,on,u),o&&(i=!1),i&&(L(e),F&&(e.oldKeyCode=e.keyCode,e.keyCode=0)),i}function an(e,t){var n=l("'"+t+"'",s.extraKeys,s.keyMap,function(e){return on(e,!0)});return n&&L(e),n}function cn(e){Et||dn(),F&&e.keyCode==27&&(e.returnValue=!1),Cn&&On()&&(Cn=!1);if(s.onKeyEvent&&s.onKeyEvent(Qt,k(e)))return;var t=D(e,"keyCode");Un(t==16||D(e,"shiftKey"));var r=un(e);window.opera&&(fn=r?t:null,!r&&t==88&&D(e,n?"metaKey":"ctrlKey")&&Sn(""))}function hn(e){Cn&&On();if(s.onKeyEvent&&s.onKeyEvent(Qt,k(e)))return;var t=D(e,"keyCode"),n=D(e,"charCode");if(window.opera&&t==fn){fn=null,L(e);return}if((window.opera&&!e.which||W)&&un(e))return;var r=String.fromCharCode(n==null?t:n);s.electricChars&&yt.electricChars&&s.smartIndent&&!s.readOnly&&yt.electricChars.indexOf(r)>-1&&setTimeout(Jr(function(){rr(St.to.line,"smart")}),75);if(an(e,r))return;Ln()}function pn(e){if(s.onKeyEvent&&s.onKeyEvent(Qt,k(e)))return;D(e,"keyCode")==16&&(xt=null)}function dn(){if(s.readOnly=="nocursor")return;Et||(s.onFocus&&s.onFocus(Qt),Et=!0,y.className.search(/\bCodeMirror-focused\b/)==-1&&(y.className+=" CodeMirror-focused"),Ht||Mn(!0)),kn(),jr()}function vn(){Et&&(s.onBlur&&s.onBlur(Qt),Et=!1,Ut&&Jr(function(){Ut&&(Ut(),Ut=null)})(),y.className=y.className.replace(" CodeMirror-focused","")),clearInterval(gt),setTimeout(function(){Et||(xt=null)},150)}function mn(e,t,n,r,i){if(At)return;if(Vt){var o=[];bt.iter(e.line,t.line+1,function(e){o.push(e.text)}),Vt.addChange(e.line,n.length,o);while(Vt.done.length>s.undoDepth)Vt.done.shift()}wn(e,t,n,r,i)}function gn(e,t){if(!e.length)return;var n=e.pop(),r=[];for(var i=n.length-1;i>=0;i-=1){var s=n[i],o=[],u=s.start+s.added;bt.iter(s.start,u,function(e){o.push(e.text)}),r.push({start:s.start,added:s.old.length,old:o});var a=Jn({line:s.start+s.old.length-1,ch:it(o[o.length-1],s.old[s.old.length-1])});wn({line:s.start,ch:0},{line:u-1,ch:Gt(u-1).text.length},s.old,a,a)}Ot=!0,t.push(r)}function yn(){gn(Vt.done,Vt.undone)}function bn(){gn(Vt.undone,Vt.done)}function wn(e,t,n,r,i){function T(e){return e<=Math.min(t.line,t.line+y)?e:e+y}if(At)return;var o=!1,u=zt.length;s.lineWrapping||bt.iter(e.line,t.line+1,function(e){if(e.text.length==u)return o=!0,!0});if(e.line!=t.line||n.length>1)Bt=!0;var a=t.line-e.line,f=Gt(e.line),l=Gt(t.line);if(e.ch==0&&t.ch==0&&n[n.length-1]==""){var c=[],h=null;e.line?(h=Gt(e.line-1),h.fixMarkEnds(l)):l.fixMarkStarts();for(var p=0,d=n.length-1;p<d;++p)c.push(g.inheritMarks(n[p],h));a&&bt.remove(e.line,a,jt),c.length&&bt.insert(e.line,c)}else if(f==l)if(n.length==1)f.replace(e.ch,t.ch,n[0]);else{l=f.split(t.ch,n[n.length-1]),f.replace(e.ch,null,n[0]),f.fixMarkEnds(l);var c=[];for(var p=1,d=n.length-1;p<d;++p)c.push(g.inheritMarks(n[p],f));c.push(l),bt.insert(e.line+1,c)}else if(n.length==1)f.replace(e.ch,null,n[0]),l.replace(null,t.ch,""),f.append(l),bt.remove(e.line+1,a,jt);else{var c=[];f.replace(e.ch,null,n[0]),l.replace(null,t.ch,n[n.length-1]),f.fixMarkEnds(l);for(var p=1,d=n.length-1;p<d;++p)c.push(g.inheritMarks(n[p],f));a>1&&bt.remove(e.line+1,a-1,jt),bt.insert(e.line+1,c)}if(s.lineWrapping){var v=Math.max(5,z.clientWidth/_r()-3);bt.iter(e.line,e.line+n.length,function(e){if(e.hidden)return;var t=Math.ceil(e.text.length/v)||1;t!=e.height&&Yt(e,t)})}else bt.iter(e.line,e.line+n.length,function(e){var t=e.text;t.length>u&&(zt=t,u=t.length,Wt=null,o=!1)}),o&&(u=0,zt="",Wt=null,bt.iter(0,bt.size,function(e){var t=e.text;t.length>u&&(u=t.length,zt=t)}));var m=[],y=n.length-a-1;for(var p=0,b=wt.length;p<b;++p){var w=wt[p];w<e.line?m.push(w):w>t.line&&m.push(w+y)}var E=e.line+Math.min(n.length,500);Ur(e.line,E),m.push(E),wt=m,Wr(100),_t.push({from:e.line,to:t.line+1,diff:y});var S={from:e,to:t,text:n};if(Dt){for(var x=Dt;x.next;x=x.next);x.next=S}else Dt=S;Wn(r,i,T(St.from.line),T(St.to.line)),z.clientHeight&&(V.style.height=bt.height*Ar()+2*Dr()+"px")}function En(e,t,n){function r(r){if(et(r,t))return r;if(!et(n,r))return i;var s=r.line+e.length-(n.line-t.line)-1,o=r.ch;return r.line==n.line&&(o+=e[e.length-1].length-(n.ch-(n.line==t.line?t.ch:0))),{line:s,ch:o}}t=Jn(t),n?n=Jn(n):n=t,e=ut(e);var i;return xn(e,t,n,function(e){return i=e,{from:r(St.from),to:r(St.to)}}),i}function Sn(e,t){xn(ut(e),St.from,St.to,function(e){return t=="end"?{from:e,to:e}:t=="start"?{from:St.from,to:St.from}:{from:St.from,to:e}})}function xn(e,t,n,r){var i=e.length==1?e[0].length+t.ch:e[e.length-1].length,s=r({line:t.line+e.length-1,ch:i});mn(t,n,e,s.from,s.to)}function Tn(e,t){var n=e.line,r=t.line;if(n==r)return Gt(n).text.slice(e.ch,t.ch);var i=[Gt(n).text.slice(e.ch)];return bt.iter(n+1,r,function(e){i.push(e.text)}),i.push(Gt(r).text.slice(0,t.ch)),i.join("\n")}function Nn(){return Tn(St.from,St.to)}function kn(){if(Cn)return;vt.set(s.pollInterval,function(){Xr(),On(),Et&&kn(),Vr()})}function Ln(){function t(){Xr();var n=On();!n&&!e?(e=!0,vt.set(60,t)):(Cn=!1,kn()),Vr()}var e=!1;Cn=!0,vt.set(20,t)}function On(){if(Ht||!Et||at(A)||s.readOnly)return!1;var e=A.value;if(e==An)return!1;xt=null;var t=0,n=Math.min(An.length,e.length);while(t<n&&An[t]==e[t])++t;return t<An.length?St.from={line:St.from.line,ch:St.from.ch-(An.length-t)}:Lt&&Z(St.from,St.to)&&(St.to={line:St.to.line,ch:Math.min(Gt(St.to.line).text.length,St.to.ch+(e.length-t))}),Sn(e.slice(t),"end"),An=e,!0}function Mn(e){Z(St.from,St.to)?e&&(An=A.value=""):(An="",A.value=Nn(),Y(A))}function _n(){s.readOnly!="nocursor"&&A.focus()}function Dn(){if(!ct.getBoundingClientRect)return;var e=ct.getBoundingClientRect();if(F&&e.top==e.bottom)return;var t=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(e.top<0||e.bottom>t)&&ct.scrollIntoView()}function Pn(){var e=xr(St.inverted?St.from:St.to),t=s.lineWrapping?Math.min(e.x,rt.offsetWidth):e.x;return Hn(t,e.y,t,e.yBot)}function Hn(e,t,n,r){var i=Pr(),o=Dr();t+=o,r+=o,e+=i,n+=i;var u=z.clientHeight,a=z.scrollTop,f=!1,l=!0;t<a?(z.scrollTop=Math.max(0,t),f=!0):r>a+u&&(z.scrollTop=r-u,f=!0);var c=z.clientWidth,h=z.scrollLeft,p=s.fixedGutter?K.clientWidth:0,d=e<p+i+10;return e<h+p||d?(d&&(e=0),z.scrollLeft=Math.max(0,e-10-p),f=!0):n>c+h-3&&(z.scrollLeft=n+10-c,f=!0,n>V.clientWidth&&(l=!1)),f&&s.onScroll&&s.onScroll(Qt),l}function Bn(){var e=Ar(),t=z.scrollTop-Dr(),n=Math.max(0,Math.floor(t/e)),r=Math.ceil((t+z.clientHeight)/e);return{from:x(bt,n),to:x(bt,r)}}function jn(e,t){function p(){Wt=z.clientWidth;var e=pt.firstChild,t=!1;return bt.iter(It,qt,function(n){if(!n.hidden){var r=Math.round(e.offsetHeight/l)||1;n.height!=r&&(Yt(n,r),Bt=t=!0)}e=e.nextSibling}),t&&(V.style.height=bt.height*l+2*Dr()+"px"),t}if(!z.clientWidth){It=qt=Ft=0;return}var n=Bn();if(e!==!0&&e.length==0&&n.from>It&&n.to<qt)return;var r=Math.max(n.from-100,0),i=Math.min(bt.size,n.to+100);It<r&&r-It<20&&(r=It),qt>i&&qt-i<20&&(i=Math.min(bt.size,qt));var o=e===!0?[]:Fn([{from:It,to:qt,domStart:0}],e),u=0;for(var a=0;a<o.length;++a){var f=o[a];f.from<r&&(f.domStart+=r-f.from,f.from=r),f.to>i&&(f.to=i),f.from>=f.to?o.splice(a--,1):u+=f.to-f.from}if(u==i-r&&r==It&&i==qt)return;o.sort(function(e,t){return e.domStart-t.domStart});var l=Ar(),c=K.style.display;pt.style.display="none",In(r,i,o),pt.style.display=K.style.display="";var h=r!=It||i!=qt||Rt!=z.clientHeight+l;h&&(Rt=z.clientHeight+l),It=r,qt=i,Ft=T(bt,r),J.style.top=Ft*l+"px",z.clientHeight&&(V.style.height=bt.height*l+2*Dr()+"px");if(pt.childNodes.length!=qt-It)throw new Error("BAD PATCH! "+JSON.stringify(o)+" size="+(qt-It)+" nodes="+pt.childNodes.length);return s.lineWrapping?p():(Wt==null&&(Wt=br(zt)),Wt>z.clientWidth?(rt.style.width=Wt+"px",V.style.width="",V.style.width=z.scrollWidth+"px"):rt.style.width=V.style.width=""),K.style.display=c,(h||Bt)&&qn()&&s.lineWrapping&&p()&&qn(),Rn(),!t&&s.onUpdate&&s.onUpdate(Qt),!0}function Fn(e,t){for(var n=0,r=t.length||0;n<r;++n){var i=t[n],s=[],o=i.diff||0;for(var u=0,a=e.length;u<a;++u){var f=e[u];i.to<=f.from&&i.diff?s.push({from:f.from+o,to:f.to+o,domStart:f.domStart}):i.to<=f.from||i.from>=f.to?s.push(f):(i.from>f.from&&s.push({from:f.from,to:i.from,domStart:f.domStart}),i.to<f.to&&s.push({from:i.to+o,to:f.to+o,domStart:f.domStart+(i.to-f.from)}))}e=s}return e}function In(e,t,n){if(!n.length)pt.innerHTML="";else{function r(e){var t=e.nextSibling;return e.parentNode.removeChild(e),t}var i=0,s=pt.firstChild,o;for(var u=0;u<n.length;++u){var a=n[u];while(a.domStart>i)s=r(s),i++;for(var f=0,l=a.to-a.from;f<l;++f)s=s.nextSibling,i++}while(s)s=r(s)}var c=n.shift(),s=pt.firstChild,f=e,h=document.createElement("div");bt.iter(e,t,function(e){c&&c.to==f&&(c=n.shift());if(!c||c.from>f){if(e.hidden)var t=h.innerHTML="<pre></pre>";else{var t="<pre"+(e.className?' class="'+e.className+'"':"")+">"+e.getHTML(ur)+"</pre>";e.bgClassName&&(t='<div style="position: relative"><pre class="'+e.bgClassName+'" style="position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: -2"> </pre>'+t+"</div>")}h.innerHTML=t,pt.insertBefore(h.firstChild,s)}else s=s.nextSibling;++f})}function qn(){if(!s.gutter&&!s.lineNumbers)return;var e=J.offsetHeight,t=z.clientHeight;K.style.height=(e-t<2?t:e)+"px";var n=[],r=It,i;bt.iter(It,Math.max(qt,It+1),function(e){if(e.hidden)n.push("<pre></pre>");else{var t=e.gutterMarker,o=s.lineNumbers?r+s.firstLineNumber:null;t&&t.text?o=t.text.replace("%N%",o!=null?o:""):o==null&&(o=" "),n.push(t&&t.style?'<pre class="'+t.style+'">':"<pre>",o);for(var u=1;u<e.height;++u)n.push("<br/> ");n.push("</pre>"),t||(i=r)}++r}),K.style.display="none",nt.innerHTML=n.join("");if(i!=null){var o=nt.childNodes[i-It],u=String(bt.size).length,a=G(o),f="";while(a.length+f.length<u)f+=" ";f&&o.insertBefore(document.createTextNode(f),o.firstChild)}K.style.display="";var l=Math.abs((parseInt(rt.style.marginLeft)||0)-K.offsetWidth)>2;return rt.style.marginLeft=K.offsetWidth+"px",Bt=!1,l}function Rn(){var e=Z(St.from,St.to),t=xr(St.from,!0),n=e?t:xr(St.to,!0),r=St.inverted?t:n,i=Ar(),o=Q(y),u=Q(pt);C.style.top=Math.max(0,Math.min(z.offsetHeight,r.y+u.top-o.top))+"px",C.style.left=Math.max(0,Math.min(z.offsetWidth,r.x+u.left-o.left))+"px";if(e)ct.style.top=r.y+"px",ct.style.left=(s.lineWrapping?Math.min(r.x,rt.offsetWidth):r.x)+"px",ct.style.display="",ht.style.display="none";else{var a=t.y==n.y,f="",l=rt.clientWidth||rt.offsetWidth,c=rt.clientHeight||rt.offsetHeight;function h(e,t,n,r){var i=q?"width: "+(n?l-n-e:l)+"px":"right: "+n+"px";f+='<div class="CodeMirror-selected" style="position: absolute; left: '+e+"px; top: "+t+"px; "+i+"; height: "+r+'px"></div>'}if(St.from.ch&&t.y>=0){var p=a?l-n.x:0;h(t.x,t.y,p,i)}var d=Math.max(0,t.y+(St.from.ch?i:0)),v=Math.min(n.y,c)-d;v>.2*i&&h(0,d,0,v),(!a||!St.from.ch)&&n.y<c-.5*i&&h(0,n.y,l-n.x,i),ht.innerHTML=f,ct.style.display="none",ht.style.display=""}}function Un(e){e?xt=xt||(St.inverted?St.to:St.from):xt=null}function zn(e,t){var n=xt&&Jn(xt);n&&(et(n,e)?e=n:et(t,n)&&(t=n)),Wn(e,t),Mt=!0}function Wn(e,t,n,r){Yn=null,n==null&&(n=St.from.line,r=St.to.line);if(Z(St.from,e)&&Z(St.to,t))return;if(et(t,e)){var i=t;t=e,e=i}if(e.line!=n){var o=Xn(e,n,St.from.ch);o?e=o:gr(e.line,!1)}t.line!=r&&(t=Xn(t,r,St.to.ch)),Z(e,t)?St.inverted=!1:Z(e,St.to)?St.inverted=!1:Z(t,St.from)&&(St.inverted=!0);if(s.autoClearEmptyLines&&Z(St.from,St.to)){var u=St.inverted?e:t;if(u.line!=St.from.line&&St.from.line<bt.size){var a=Gt(St.from.line);/^\s+$/.test(a.text)&&setTimeout(Jr(function(){if(a.parent&&/^\s+$/.test(a.text)){var e=S(a);En("",{line:e,ch:0},{line:e,ch:a.text.length})}},10))}}St.from=e,St.to=t,Pt=!0}function Xn(e,t,n){function r(t){var r=e.line+t,i=t==1?bt.size:-1;while(r!=i){var o=Gt(r);if(!o.hidden){var u=e.ch;if(s||u>n||u>o.text.length)u=o.text.length;return{line:r,ch:u}}r+=t}}var i=Gt(e.line),s=e.ch==i.text.length&&e.ch!=n;return i.hidden?e.line>=t?r(1)||r(-1):r(-1)||r(1):e}function Vn(e,t,n){var r=Jn({line:e,ch:t||0});(n?zn:Wn)(r,r)}function $n(e){return Math.max(0,Math.min(e,bt.size-1))}function Jn(e){if(e.line<0)return{line:0,ch:0};if(e.line>=bt.size)return{line:bt.size-1,ch:Gt(bt.size-1).text.length};var t=e.ch,n=Gt(e.line).text.length;return t==null||t>n?{line:e.line,ch:n}:t<0?{line:e.line,ch:0}:e}function Kn(e,t){function o(){for(var t=r+e,n=e<0?-1:bt.size;t!=n;t+=e){var i=Gt(t);if(!i.hidden)return r=t,s=i,!0}}function u(t){if(i==(e<0?0:s.text.length)){if(!!t||!o())return!1;i=e<0?s.text.length:0}else i+=e;return!0}var n=St.inverted?St.from:St.to,r=n.line,i=n.ch,s=Gt(r);if(t=="char")u();else if(t=="column")u(!0);else if(t=="word"){var a=!1;for(;;){if(e<0&&!u())break;if(ot(s.text.charAt(i)))a=!0;else if(a){e<0&&(e=1,u());break}if(e>0&&!u())break}}return{line:r,ch:i}}function Qn(e,t){var n=e<0?St.from:St.to;if(xt||Z(St.from,St.to))n=Kn(e,t);Vn(n.line,n.ch,!0)}function Gn(e,t){Z(St.from,St.to)?e<0?En("",Kn(e,t),St.to):En("",St.from,Kn(e,t)):En("",St.from,St.to),Mt=!0}function Zn(e,t){var n=0,r=xr(St.inverted?St.from:St.to,!0);Yn!=null&&(r.x=Yn),t=="page"?n=Math.min(z.clientHeight,window.innerHeight||document.documentElement.clientHeight):t=="line"&&(n=Ar());var i=Tr(r.x,r.y+n*e+2);t=="page"&&(z.scrollTop+=xr(i,!0).y-r.y),Vn(i.line,i.ch,!0),Yn=r.x}function er(e){var t=Gt(e.line).text,n=e.ch,r=e.ch;while(n>0&&ot(t.charAt(n-1)))--n;while(r<t.length&&ot(t.charAt(r)))++r;zn({line:e.line,ch:n},{line:e.line,ch:r})}function tr(e){zn({line:e,ch:0},Jn({line:e+1,ch:0}))}function nr(e){if(Z(St.from,St.to))return rr(St.from.line,e);var t=St.to.line-(St.to.ch?0:1);for(var n=St.from.line;n<=t;++n)rr(n,e)}function rr(e,t){t||(t="add");if(t=="smart")if(!yt.indent)t="prev";else var n=Rr(e);var r=Gt(e),i=r.indentation(s.tabSize),o=r.text.match(/^\s*/)[0],u;t=="prev"?e?u=Gt(e-1).indentation(s.tabSize):u=0:t=="smart"?u=yt.indent(n,r.text.slice(o.length),r.text):t=="add"?u=i+s.indentUnit:t=="subtract"&&(u=i-s.indentUnit),u=Math.max(0,u);var a=u-i;if(!a){if(St.from.line!=e&&St.to.line!=e)return;var f=o}else{var f="",l=0;if(s.indentWithTabs)for(var c=Math.floor(u/s.tabSize);c;--c)l+=s.tabSize,f+=" ";while(l<u)++l,f+=" "}En(f,{line:e,ch:0},{line:e,ch:o.length})}function ir(){yt=e.getMode(s,s.mode),bt.iter(0,bt.size,function(e){e.stateAfter=null}),wt=[0],Wr()}function sr(){var e=s.gutter||s.lineNumbers;K.style.display=e?"":"none",e?Bt=!0:pt.parentNode.style.marginLeft=0}function or(e,t){if(s.lineWrapping){y.className+=" CodeMirror-wrap";var n=z.clientWidth/_r()-3;bt.iter(0,bt.size,function(e){if(e.hidden)return;var t=Math.ceil(e.text.length/n)||1;t!=1&&Yt(e,t)}),rt.style.width=V.style.width=""}else y.className=y.className.replace(" CodeMirror-wrap",""),Wt=null,zt="",bt.iter(0,bt.size,function(e){e.height!=1&&!e.hidden&&Yt(e,1),e.text.length>zt.length&&(zt=e.text)});_t.push({from:0,to:bt.size})}function ur(e){var t=s.tabSize-e%s.tabSize,n=Xt[t];if(n)return n;for(var r='<span class="cm-tab">',i=0;i<t;++i)r+=" ";return Xt[t]={html:r+"</span>",width:t}}function ar(){z.className=z.className.replace(/\s*cm-s-\S+/g,"")+s.theme.replace(/(^|\s)\s*/g," cm-s-")}function fr(){this.set=[]}function lr(e,t,n){function i(e,t,n,i){Gt(e).addMark(new v(t,n,i,r))}e=Jn(e),t=Jn(t);var r=new fr;if(!et(e,t))return r;if(e.line==t.line)i(e.line,e.ch,t.ch,n);else{i(e.line,e.ch,null,n);for(var s=e.line+1,o=t.line;s<o;++s)i(s,null,null,n);i(t.line,null,t.ch,n)}return _t.push({from:e.line,to:t.line+1}),r}function cr(e){e=Jn(e);var t=new m(e.ch);return Gt(e.line).addMark(t),t}function hr(e){e=Jn(e);var t=[],n=Gt(e.line).marked;if(!n)return t;for(var r=0,i=n.length;r<i;++r){var s=n[r];(s.from==null||s.from<=e.ch)&&(s.to==null||s.to>=e.ch)&&t.push(s.marker||s)}return t}function pr(e,t,n){return typeof e=="number"&&(e=Gt($n(e))),e.gutterMarker={text:t,style:n},Bt=!0,e}function dr(e){typeof e=="number"&&(e=Gt($n(e))),e.gutterMarker=null,Bt=!0}function vr(e,t){var n=e,r=e;return typeof e=="number"?r=Gt($n(e)):n=S(e),n==null?null:t(r,n)?(_t.push({from:n,to:n+1}),r):null}function mr(e,t,n){return vr(e,function(e){if(e.className!=t||e.bgClassName!=n)return e.className=t,e.bgClassName=n,!0})}function gr(e,t){return vr(e,function(e,n){if(e.hidden!=t){e.hidden=t,Yt(e,t?0:1);var r=St.from.line,i=St.to.line;if(t&&(r==n||i==n)){var s=r==n?Xn({line:r,ch:0},r,0):St.from,o=i==n?Xn({line:i,ch:0},i,0):St.to;if(!o)return;Wn(s,o)}return Bt=!0}})}function yr(e){if(typeof e=="number"){if(!Kt(e))return null;var t=e;e=Gt(e);if(!e)return null}else{var t=S(e);if(t==null)return null}var n=e.gutterMarker;return{line:t,handle:e,text:e.text,markerText:n&&n.text,markerClass:n&&n.style,lineClass:e.className,bgClass:e.bgClassName}}function br(e){return lt.innerHTML="<pre><span>x</span></pre>",lt.firstChild.firstChild.firstChild.nodeValue=e,lt.firstChild.firstChild.offsetWidth||10}function wr(e,t){function i(e){return Sr(n,e).left}if(t<=0)return 0;var n=Gt(e),r=n.text,s=0,o=0,u=r.length,a,f=Math.min(u,Math.ceil(t/_r()));for(;;){var l=i(f);if(!(l<=t&&f<u)){a=l,u=f;break}f=Math.min(u,Math.ceil(f*1.2))}if(t>a)return u;f=Math.floor(u*.8),l=i(f),l<t&&(s=f,o=l);for(;;){if(u-s<=1)return a-t>t-o?s:u;var c=Math.ceil((s+u)/2),h=i(c);h>t?(u=c,a=h):(s=c,o=h)}}function Sr(e,t){if(t==0)return{top:0,left:0};var n=s.lineWrapping&&t<e.text.length&&$.test(e.text.slice(t-1,t+1));lt.innerHTML="<pre>"+e.getHTML(ur,t,Er,n)+"</pre>";var r=document.getElementById(Er),i=r.offsetTop,o=r.offsetLeft;if(F&&i==0&&o==0){var u=document.createElement("span");u.innerHTML="x",r.parentNode.insertBefore(u,r.nextSibling),i=u.offsetTop}return{top:i,left:o}}function xr(e,t){var n,r=Ar(),i=r*(T(bt,e.line)-(t?Ft:0));if(e.ch==0)n=0;else{var o=Sr(Gt(e.line),e.ch);n=o.left,s.lineWrapping&&(i+=Math.max(0,o.top))}return{x:n,y:i,yBot:i+r}}function Tr(e,t){function c(e){var t=Sr(u,e);if(f){var r=Math.round(t.top/n);return Math.max(0,t.left+(r-l)*z.clientWidth)}return t.left}t<0&&(t=0);var n=Ar(),r=_r(),i=Ft+Math.floor(t/n),o=x(bt,i);if(o>=bt.size)return{line:bt.size-1,ch:Gt(bt.size-1).text.length};var u=Gt(o),a=u.text,f=s.lineWrapping,l=f?i-T(bt,o):0;if(e<=0&&l==0)return{line:o,ch:0};var h=0,p=0,d=a.length,v,m=Math.min(d,Math.ceil((e+l*z.clientWidth*.9)/r));for(;;){var g=c(m);if(!(g<=e&&m<d)){v=g,d=m;break}m=Math.min(d,Math.ceil(m*1.2))}if(e>v)return{line:o,ch:d};m=Math.floor(d*.8),g=c(m),g<e&&(h=m,p=g);for(;;){if(d-h<=1)return{line:o,ch:v-e>e-p?h:d};var y=Math.ceil((h+d)/2),b=c(y);b>e?(d=y,v=b):(h=y,p=b)}}function Nr(e){var t=xr(e,!0),n=Q(rt);return{x:n.left+t.x,y:n.top+t.y,yBot:n.top+t.yBot}}function Ar(){if(Lr==null){Lr="<pre>";for(var e=0;e<49;++e)Lr+="x<br/>";Lr+="x</pre>"}var t=pt.clientHeight;return t==kr?Cr:(kr=t,lt.innerHTML=Lr,Cr=lt.firstChild.offsetHeight/50||1,lt.innerHTML="",Cr)}function _r(){return z.clientWidth==Mr?Or:(Mr=z.clientWidth,Or=br("x"))}function Dr(){return rt.offsetTop}function Pr(){return rt.offsetLeft}function Hr(e,t){var n=Q(z,!0),r,i;try{r=e.clientX,i=e.clientY}catch(e){return null}if(!t&&(r-n.left>z.clientWidth||i-n.top>z.clientHeight))return null;var s=Q(rt,!0);return Tr(r-s.left,i-s.top)}function Br(e){function s(){var e=ut(A.value).join("\n");e!=i&&Jr(Sn)(e,"end"),C.style.position="relative",A.style.cssText=r,I&&(z.scrollTop=n),Ht=!1,Mn(!0),kn()}var t=Hr(e),n=z.scrollTop;if(!t||window.opera)return;(Z(St.from,St.to)||et(t,St.from)||!et(t,St.to))&&Jr(Vn)(t.line,t.ch);var r=A.style.cssText;C.style.position="absolute",A.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: white; "+"border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",Ht=!0;var i=A.value=Nn();_n(),Y(A);if(j){O(e);var o=P(window,"mouseup",function(){o(),setTimeout(s,20)},!0)}else setTimeout(s,50)}function jr(){clearInterval(gt);var e=!0;ct.style.visibility="",gt=setInterval(function(){ct.style.visibility=(e=!e)?"":"hidden"},650)}function Ir(e){function v(e,t,n){if(!e.text)return;var r=e.styles,i=o?0:e.text.length-1,s;for(var a=o?0:r.length-2,f=o?r.length:-2;a!=f;a+=2*u){var l=r[a];if(r[a+1]!=null&&r[a+1]!=h){i+=u*l.length;continue}for(var c=o?0:l.length-1,v=o?l.length:-1;c!=v;c+=u,i+=u)if(i>=t&&i<n&&d.test(s=l.charAt(c))){var m=Fr[s];if(m.charAt(1)==">"==o)p.push(s);else{if(p.pop()!=m.charAt(0))return{pos:i,match:!1};if(!p.length)return{pos:i,match:!0}}}}}var t=St.inverted?St.from:St.to,n=Gt(t.line),r=t.ch-1,i=r>=0&&Fr[n.text.charAt(r)]||Fr[n.text.charAt(++r)];if(!i)return;var s=i.charAt(0),o=i.charAt(1)==">",u=o?1:-1,a=n.styles;for(var f=r+1,l=0,c=a.length;l<c;l+=2)if((f-=a[l].length)<=0){var h=a[l+1];break}var p=[n.text.charAt(r)],d=/[(){}[\]]/;for(var l=t.line,c=o?Math.min(l+100,bt.size):Math.max(-1,l-100);l!=c;l+=u){var n=Gt(l),m=l==t.line,g=v(n,m&&o?r+1:0,m&&!o?r:n.text.length);if(g)break}g||(g={pos:null,match:!1});var h=g.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",y=lr({line:t.line,ch:r},{line:t.line,ch:r+1},h),b=g.pos!=null&&lr({line:l,ch:g.pos},{line:l,ch:g.pos+1},h),w=Jr(function(){y.clear(),b&&b.clear()});e?setTimeout(w,800):Ut=w}function qr(e){var t,n;for(var r=e,i=e-40;r>i;--r){if(r==0)return 0;var o=Gt(r-1);if(o.stateAfter)return r;var u=o.indentation(s.tabSize);if(n==null||t>u)n=r-1,t=u}return n}function Rr(e){var t=qr(e),n=t&&Gt(t-1).stateAfter;return n?n=h(yt,n):n=p(yt),bt.iter(t,e,function(e){e.highlight(yt,n,s.tabSize),e.stateAfter=h(yt,n)}),t<e&&_t.push({from:t,to:e}),e<bt.size&&!Gt(e).stateAfter&&wt.push(e),n}function Ur(e,t){var n=Rr(e);bt.iter(e,t,function(e){e.highlight(yt,n,s.tabSize),e.stateAfter=h(yt,n)})}function zr(){var e=+(new Date)+s.workTime,t=wt.length;while(wt.length){if(!Gt(It).stateAfter)var n=It;else var n=wt.pop();if(n>=bt.size)continue;var r=qr(n),i=r&&Gt(r-1).stateAfter;i?i=h(yt,i):i=p(yt);var o=0,u=yt.compareStates,a=!1,f=r,l=!1;bt.iter(f,bt.size,function(t){var r=t.stateAfter;if(+(new Date)>e)return wt.push(f),Wr(s.workDelay),a&&_t.push({from:n,to:f+1}),l=!0;var c=t.highlight(yt,i,s.tabSize);c&&(a=!0),t.stateAfter=h(yt,i);var p=null;if(u){var d=r&&u(r,i);d!=B&&(p=!!d)}p==null&&(c!==!1||!r?o=0:++o>3&&(!yt.indent||yt.indent(r,"")==yt.indent(i,""))&&(p=!0));if(p)return!0;++f});if(l)return;a&&_t.push({from:n,to:f+1})}t&&s.onHighlightComplete&&s.onHighlightComplete(Qt)}function Wr(e){if(!wt.length)return;mt.set(e,Jr(zr))}function Xr(){Ot=Mt=Dt=null,_t=[],Pt=!1,jt=[]}function Vr(){var e=!1,t;Pt&&(e=!Pn()),_t.length?t=jn(_t,!0):(Pt&&Rn(),Bt&&qn()),e&&Pn(),Pt&&(Dn(),jr()),Et&&!Ht&&(Ot===!0||Ot!==!1&&Pt)&&Mn(Mt),Pt&&s.matchBrackets&&setTimeout(Jr(function(){Ut&&(Ut(),Ut=null),Z(St.from,St.to)&&Ir(!1)}),20);var n=Dt,r=jt;Pt&&s.onCursorActivity&&s.onCursorActivity(Qt),n&&s.onChange&&Qt&&s.onChange(Qt,n);for(var i=0;i<r.length;++i)r[i](Qt);t&&s.onUpdate&&s.onUpdate(Qt)}function Jr(e){return function(){$r++||Xr();try{var t=e.apply(this,arguments)}finally{--$r||Vr()}return t}}function Kr(e){Vt.startCompound();try{return e()}finally{Vt.endCompound()}}var s={},a=e.defaults;for(var d in a)a.hasOwnProperty(d)&&(s[d]=(i&&i.hasOwnProperty(d)?i:a)[d]);var y=document.createElement("div");y.className="CodeMirror"+(s.lineWrapping?" CodeMirror-wrap":""),y.innerHTML='<div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll" tabindex="-1"><div style="position: relative"><div style="position: relative"><div class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div style="position: relative; z-index: 0"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden;"></div><pre class="CodeMirror-cursor"> </pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div>',r.appendChild?r.appendChild(y):r(y);var C=y.firstChild,A=C.firstChild,z=y.lastChild,V=z.firstChild,J=V.firstChild,K=J.firstChild,nt=K.firstChild,rt=K.nextSibling.firstChild,lt=rt.firstChild,ct=lt.nextSibling,ht=ct.nextSibling,pt=ht.nextSibling;ar(),t&&(A.style.width="0px"),R||(rt.draggable=!0),rt.style.outline="none",s.tabindex!=null&&(A.tabIndex=s.tabindex),s.autofocus&&_n(),!s.gutter&&!s.lineNumbers&&(K.style.display="none"),W&&(C.style.height="1px",C.style.position="absolute");try{br("x")}catch(dt){throw dt.message.match(/runtime/i)&&(dt=new Error("A CodeMirror inside a P-style element does not work in Internet Explorer. (innerHTML bug)")),dt}var vt=new H,mt=new H,gt,yt,bt=new w([new b([new g("")])]),wt,Et;ir();var St={from:{line:0,ch:0},to:{line:0,ch:0},inverted:!1},xt,Tt,Nt,Ct=0,kt,Lt=!1,At=!1,Ot,Mt,_t,Dt,Pt,Ht,Bt,jt,Ft=0,It=0,qt=0,Rt=0,Ut,zt="",Wt,Xt={};Jr(function(){Zt(s.value||""),Ot=!1})();var Vt=new N;P(z,"mousedown",Jr(tn)),P(z,"dblclick",Jr(nn)),P(rt,"selectstart",L),j||P(z,"contextmenu",Br),P(z,"scroll",function(){Ct=z.scrollTop,jn([]),s.fixedGutter&&(K.style.left=z.scrollLeft+"px"),s.onScroll&&s.onScroll(Qt)}),P(window,"resize",function(){jn(!0)}),P(A,"keyup",Jr(pn)),P(A,"input",Ln),P(A,"keydown",Jr(cn)),P(A,"keypress",Jr(hn)),P(A,"focus",dn),P(A,"blur",vn);if(s.dragDrop){P(rt,"dragstart",sn);function $t(e){if(s.onDragEvent&&s.onDragEvent(Qt,k(e)))return;O(e)}P(z,"dragenter",$t),P(z,"dragover",$t),P(z,"drop",Jr(rn))}P(z,"paste",function(){_n(),Ln()}),P(A,"paste",Ln),P(A,"cut",Jr(function(){s.readOnly||Sn("")})),W&&P(V,"mouseup",function(){document.activeElement==A&&A.blur(),_n()});var Jt;try{Jt=document.activeElement==A}catch(dt){}Jt||s.autofocus?setTimeout(dn,20):vn();var Qt=y.CodeMirror={getValue:en,setValue:Jr(Zt),getSelection:Nn,replaceSelection:Jr(Sn),focus:function(){window.focus(),_n(),dn(),Ln()},setOption:function(e,t){var n=s[e];s[e]=t,e=="mode"||e=="indentUnit"?ir():e=="readOnly"&&t=="nocursor"?(vn(),A.blur()):e=="readOnly"&&!t?Mn(!0):e=="theme"?ar():e=="lineWrapping"&&n!=t?Jr(or)():e=="tabSize"&&jn(!0);if(e=="lineNumbers"||e=="gutter"||e=="firstLineNumber"||e=="theme")sr(),jn(!0)},getOption:function(e){return s[e]},undo:Jr(yn),redo:Jr(bn),indentLine:Jr(function(e,t){typeof t!="string"&&(t==null?t=s.smartIndent?"smart":"prev":t=t?"add":"subtract"),Kt(e)&&rr(e,t)}),indentSelection:Jr(nr),historySize:function(){return{undo:Vt.done.length,redo:Vt.undone.length}},clearHistory:function(){Vt=new N},matchBrackets:Jr(function(){Ir(!0)}),getTokenAt:Jr(function(e){return e=Jn(e),Gt(e.line).getTokenAt(yt,Rr(e.line),e.ch)}),getStateAfter:function(e){return e=$n(e==null?bt.size-1:e),Rr(e+1)},cursorCoords:function(e,t){return e==null&&(e=St.inverted),this.charCoords(e?St.from:St.to,t)},charCoords:function(e,t){return e=Jn(e),t=="local"?xr(e,!1):t=="div"?xr(e,!0):Nr(e)},coordsChar:function(e){var t=Q(rt);return Tr(e.x-t.left,e.y-t.top)},markText:Jr(lr),setBookmark:cr,findMarksAt:hr,setMarker:Jr(pr),clearMarker:Jr(dr),setLineClass:Jr(mr),hideLine:Jr(function(e){return gr(e,!0)}),showLine:Jr(function(e){return gr(e,!1)}),onDeleteLine:function(e,t){if(typeof e=="number"){if(!Kt(e))return null;e=Gt(e)}return(e.handlers||(e.handlers=[])).push(t),e},lineInfo:yr,addWidget:function(e,t,n,r,i){e=xr(Jn(e));var s=e.yBot,o=e.x;t.style.position="absolute",V.appendChild(t);if(r=="over")s=e.y;else if(r=="near"){var u=Math.max(z.offsetHeight,bt.height*Ar()),a=Math.max(V.clientWidth,rt.clientWidth)-Pr();e.yBot+t.offsetHeight>u&&e.y>t.offsetHeight&&(s=e.y-t.offsetHeight),o+t.offsetWidth>a&&(o=a-t.offsetWidth)}t.style.top=s+Dr()+"px",t.style.left=t.style.right="",i=="right"?(o=V.clientWidth-t.offsetWidth,t.style.right="0px"):(i=="left"?o=0:i=="middle"&&(o=(V.clientWidth-t.offsetWidth)/2),t.style.left=o+Pr()+"px"),n&&Hn(o,s,o+t.offsetWidth,s+t.offsetHeight)},lineCount:function(){return bt.size},clipPos:Jn,getCursor:function(e){return e==null&&(e=St.inverted),tt(e?St.from:St.to)},somethingSelected:function(){return!Z(St.from,St.to)},setCursor:Jr(function(e,t,n){t==null&&typeof e.line=="number"?Vn(e.line,e.ch,n):Vn(e,t,n)}),setSelection:Jr(function(e,t,n){(n?zn:Wn)(Jn(e),Jn(t||e))}),getLine:function(e){if(Kt(e))return Gt(e).text},getLineHandle:function(e){if(Kt(e))return Gt(e)},setLine:Jr(function(e,t){Kt(e)&&En(t,{line:e,ch:0},{line:e,ch:Gt(e).text.length})}),removeLine:Jr(function(e){Kt(e)&&En("",{line:e,ch:0},Jn({line:e+1,ch:0}))}),replaceRange:Jr(En),getRange:function(e,t){return Tn(Jn(e),Jn(t))},triggerOnKeyDown:Jr(cn),execCommand:function(e){return u[e](Qt)},moveH:Jr(Qn),deleteH:Jr(Gn),moveV:Jr(Zn),toggleOverwrite:function(){Lt?(Lt=!1,ct.className=ct.className.replace(" CodeMirror-overwrite","")):(Lt=!0,ct.className+=" CodeMirror-overwrite")},posFromIndex:function(e){var t=0,n;return bt.iter(0,bt.size,function(r){var i=r.text.length+1;if(i>e)return n=e,!0;e-=i,++t}),Jn({line:t,ch:n})},indexFromPos:function(e){if(e.line<0||e.ch<0)return 0;var t=e.ch;return bt.iter(0,e.line,function(e){t+=e.text.length+1}),t},scrollTo:function(e,t){e!=null&&(z.scrollLeft=e),t!=null&&(z.scrollTop=t),jn([])},operation:function(e){return Jr(e)()},compoundChange:function(e){return Kr(e)},refresh:function(){jn(!0),z.scrollHeight>Ct&&(z.scrollTop=Ct)},getInputField:function(){return A},getWrapperElement:function(){return y},getScrollerElement:function(){return z},getGutterElement:function(){return K}},fn=null,ln,Cn=!1,An="",Yn=null;fr.prototype.clear=Jr(function(){var e=Infinity,t=-Infinity;for(var n=0,r=this.set.length;n<r;++n){var i=this.set[n],s=i.marked;if(!s||!i.parent)continue;var o=S(i);e=Math.min(e,o),t=Math.max(t,o);for(var u=0;u<s.length;++u)s[u].marker==this&&s.splice(u--,1)}e!=Infinity&&_t.push({from:e,to:t+1})}),fr.prototype.find=function(){var e,t;for(var n=0,r=this.set.length;n<r;++n){var i=this.set[n],s=i.marked;for(var o=0;o<s.length;++o){var u=s[o];if(u.marker==this)if(u.from!=null||u.to!=null){var a=S(i);a!=null&&(u.from!=null&&(e={line:a,ch:u.from}),u.to!=null&&(t={line:a,ch:u.to}))}}}return{from:e,to:t}};var Er="CodeMirror-temp-"+Math.floor(Math.random()*16777215).toString(16),Cr,kr,Lr,Or,Mr=0,Fr={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},$r=0;for(var Qr in o)o.propertyIsEnumerable(Qr)&&!Qt.propertyIsEnumerable(Qr)&&(Qt[Qr]=o[Qr]);return Qt}function f(e){return typeof e=="string"?a[e]:e}function l(e,t,n,r,i){function s(t){t=f(t);var n=t[e];if(n!=null&&r(n))return!0;if(t.nofallthrough)return i&&i(),!0;var o=t.fallthrough;if(o==null)return!1;if(Object.prototype.toString.call(o)!="[object Array]")return s(o);for(var u=0,a=o.length;u<a;++u)if(s(o[u]))return!0;return!1}return t&&s(t)?!0:s(n)}function c(e){var t=ft[D(e,"keyCode")];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function h(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function p(e,t,n){return e.startState?e.startState(t,n):!0}function d(e,t){this.pos=this.start=0,this.string=e,this.tabSize=t||8}function v(e,t,n,r){this.from=e,this.to=t,this.style=n,this.marker=r}function m(e){this.from=e,this.to=e,this.line=null}function g(e,t){this.styles=t||[e,null],this.text=e,this.height=1,this.marked=this.gutterMarker=this.className=this.bgClassName=this.handlers=null,this.stateAfter=this.parent=this.hidden=null}function y(e,t,n,r){for(var i=0,s=0,o=0;s<t;i+=2){var u=n[i],a=s+u.length;o==0?(a>e&&r.push(u.slice(e-s,Math.min(u.length,t-s)),n[i+1]),a>=e&&(o=1)):o==1&&(a>t?r.push(u.slice(0,t-s),n[i+1]):r.push(u,n[i+1])),s=a}}function b(e){this.lines=e,this.parent=null;for(var t=0,n=e.length,r=0;t<n;++t)e[t].parent=this,r+=e[t].height;this.height=r}function w(e){this.children=e;var t=0,n=0;for(var r=0,i=e.length;r<i;++r){var s=e[r];t+=s.chunkSize(),n+=s.height,s.parent=this}this.size=t,this.height=n,this.parent=null}function E(e,t){while(!e.lines)for(var n=0;;++n){var r=e.children[n],i=r.chunkSize();if(t<i){e=r;break}t-=i}return e.lines[t]}function S(e){if(e.parent==null)return null;var t=e.parent,n=st(t.lines,e);for(var r=t.parent;r;t=r,r=r.parent)for(var i=0,s=r.children.length;;++i){if(r.children[i]==t)break;n+=r.children[i].chunkSize()}return n}function x(e,t){var n=0;e:do{for(var r=0,i=e.children.length;r<i;++r){var s=e.children[r],o=s.height;if(t<o){e=s;continue e}t-=o,n+=s.chunkSize()}return n}while(!e.lines);for(var r=0,i=e.lines.length;r<i;++r){var u=e.lines[r],a=u.height;if(t<a)break;t-=a}return n+r}function T(e,t){var n=0;e:do{for(var r=0,i=e.children.length;r<i;++r){var s=e.children[r],o=s.chunkSize();if(t<o){e=s;continue e}t-=o,n+=s.height}return n}while(!e.lines);for(var r=0;r<t;++r)n+=e.lines[r].height;return n}function N(){this.time=0,this.done=[],this.undone=[],this.compound=0,this.closed=!1}function C(){O(this)}function k(e){return e.stop||(e.stop=C),e}function L(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function A(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function O(e){L(e),A(e)}function M(e){return e.target||e.srcElement}function _(e){if(e.which)return e.which;if(e.button&1)return 1;if(e.button&2)return 3;if(e.button&4)return 2}function D(e,t){var n=e.override&&e.override.hasOwnProperty(t);return n?e.override[t]:e[t]}function P(e,t,n,r){if(typeof e.addEventListener=="function"){e.addEventListener(t,n,!1);if(r)return function(){e.removeEventListener(t,n,!1)}}else{var i=function(e){n(e||window.event)};e.attachEvent("on"+t,i);if(r)return function(){e.detachEvent("on"+t,i)}}}function H(){this.id=null}function J(e,t,n){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var r=0,i=0;r<t;++r)e.charAt(r)==" "?i+=n-i%n:++i;return i}function K(e){return e.currentStyle?e.currentStyle:window.getComputedStyle(e,null)}function Q(e,t){var n=e.ownerDocument.body,r=0,i=0,s=!1;for(var o=e;o;o=o.offsetParent){var u=o.offsetLeft,a=o.offsetTop;o==n?(r+=Math.abs(u),i+=Math.abs(a)):(r+=u,i+=a),t&&K(o).position=="fixed"&&(s=!0)}var f=t&&!s?null:n;for(var o=e.parentNode;o!=f;o=o.parentNode)o.scrollLeft!=null&&(r-=o.scrollLeft,i-=o.scrollTop);return{left:r,top:i}}function G(e){return e.textContent||e.innerText||e.nodeValue||""}function Y(e){t?(e.selectionStart=0,e.selectionEnd=e.value.length):e.select()}function Z(e,t){return e.line==t.line&&e.ch==t.ch}function et(e,t){return e.line<t.line||e.line==t.line&&e.ch<t.ch}function tt(e){return{line:e.line,ch:e.ch}}function rt(e){return nt.textContent=e,nt.innerHTML}function it(e,t){if(!t)return 0;if(!e)return t.length;for(var n=e.length,r=t.length;n>=0&&r>=0;--n,--r)if(e.charAt(n)!=t.charAt(r))break;return r+1}function st(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;++n)if(e[n]==t)return n;return-1}function ot(e){return/\w/.test(e)||e.toUpperCase()!=e.toLowerCase()}e.defaults={value:"",mode:null,theme:"default",indentUnit:2,indentWithTabs:!1,smartIndent:!0,tabSize:4,keyMap:"default",extraKeys:null,electricChars:!0,autoClearEmptyLines:!1,onKeyEvent:null,onDragEvent:null,lineWrapping:!1,lineNumbers:!1,gutter:!1,fixedGutter:!1,firstLineNumber:1,readOnly:!1,dragDrop:!0,onChange:null,onCursorActivity:null,onGutterClick:null,onHighlightComplete:null,onUpdate:null,onFocus:null,onBlur:null,onScroll:null,matchBrackets:!1,workTime:100,workDelay:200,pollInterval:100,undoDepth:40,tabindex:null,autofocus:null};var t=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),n=t||/Mac/.test(navigator.platform),r=/Win/.test(navigator.platform),i=e.modes={},s=e.mimeModes={};e.defineMode=function(t,n){!e.defaults.mode&&t!="null"&&(e.defaults.mode=t);if(arguments.length>2){n.dependencies=[];for(var r=2;r<arguments.length;++r)n.dependencies.push(arguments[r])}i[t]=n},e.defineMIME=function(e,t){s[e]=t},e.resolveMode=function(t){if(typeof t=="string"&&s.hasOwnProperty(t))t=s[t];else if(typeof t=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return typeof t=="string"?{name:t}:t||{name:"null"}},e.getMode=function(t,n){var n=e.resolveMode(n),r=i[n.name];return r?r(t,n):e.getMode(t,"text/plain")},e.listModes=function(){var e=[];for(var t in i)i.propertyIsEnumerable(t)&&e.push(t);return e},e.listMIMEs=function(){var e=[];for(var t in s)s.propertyIsEnumerable(t)&&e.push({mime:t,mode:s[t]});return e};var o=e.extensions={};e.defineExtension=function(e,t){o[e]=t};var u=e.commands={selectAll:function(e){e.setSelection({line:0,ch:0},{line:e.lineCount()-1})},killLine:function(e){var t=e.getCursor(!0),n=e.getCursor(!1),r=!Z(t,n);!r&&e.getLine(t.line).length==t.ch?e.replaceRange("",t,{line:t.line+1,ch:0}):e.replaceRange("",t,r?n:{line:t.line})},deleteLine:function(e){var t=e.getCursor().line;e.replaceRange("",{line:t,ch:0},{line:t})},undo:function(e){e.undo()},redo:function(e){e.redo()},goDocStart:function(e){e.setCursor(0,0,!0)},goDocEnd:function(e){e.setSelection({line:e.lineCount()-1},null,!0)},goLineStart:function(e){e.setCursor(e.getCursor().line,0,!0)},goLineStartSmart:function(e){var t=e.getCursor(),n=e.getLine(t.line),r=Math.max(0,n.search(/\S/));e.setCursor(t.line,t.ch<=r&&t.ch?0:r,!0)},goLineEnd:function(e){e.setSelection({line:e.getCursor().line},null,!0)},goLineUp:function(e){e.moveV(-1,"line")},goLineDown:function(e){e.moveV(1,"line")},goPageUp:function(e){e.moveV(-1,"page")},goPageDown:function(e){e.moveV(1,"page")},goCharLeft:function(e){e.moveH(-1,"char")},goCharRight:function(e){e.moveH(1,"char")},goColumnLeft:function(e){e.moveH(-1,"column")},goColumnRight:function(e){e.moveH(1,"column")},goWordLeft:function(e){e.moveH(-1,"word")},goWordRight:function(e){e.moveH(1,"word")},delCharLeft:function(e){e.deleteH(-1,"char")},delCharRight:function(e){e.deleteH(1,"char")},delWordLeft:function(e){e.deleteH(-1,"word")},delWordRight:function(e){e.deleteH(1,"word")},indentAuto:function(e){e.indentSelection("smart")},indentMore:function(e){e.indentSelection("add")},indentLess:function(e){e.indentSelection("subtract")},insertTab:function(e){e.replaceSelection(" ","end")},transposeChars:function(e){var t=e.getCursor(),n=e.getLine(t.line);t.ch>0&&t.ch<n.length-1&&e.replaceRange(n.charAt(t.ch)+n.charAt(t.ch-1),{line:t.line,ch:t.ch-1},{line:t.line,ch:t.ch+1})},newlineAndIndent:function(e){e.replaceSelection("\n","end"),e.indentLine(e.getCursor().line)},toggleOverwrite:function(e){e.toggleOverwrite()}},a=e.keyMap={};a.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharRight",Backspace:"delCharLeft",Tab:"insertTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite"},a.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Alt-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","Ctrl-Left":"goWordLeft","Ctrl-Right":"goWordRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delWordLeft","Ctrl-Delete":"delWordRight","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore",fallthrough:"basic"},a.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goWordLeft","Alt-Right":"goWordRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","Alt-Backspace":"delWordLeft","Ctrl-Alt-Backspace":"delWordRight","Alt-Delete":"delWordRight","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore",fallthrough:["basic","emacsy"]},a["default"]=n?a.macDefault:a.pcDefault,a.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageUp","Shift-Ctrl-V":"goPageDown","Ctrl-D":"delCharRight","Ctrl-H":"delCharLeft","Alt-D":"delWordRight","Alt-Backspace":"delWordLeft","Ctrl-K":"killLine","Ctrl-T":"transposeChars"},e.fromTextArea=function(t,n){function r(){t.value=u.getValue()}n||(n={}),n.value=t.value,!n.tabindex&&t.tabindex&&(n.tabindex=t.tabindex),n.autofocus==null&&t.getAttribute("autofocus")!=null&&(n.autofocus=!0);if(t.form){var i=P(t.form,"submit",r,!0);if(typeof t.form.submit=="function"){var s=t.form.submit;function o(){r(),t.form.submit=s,t.form.submit(),t.form.submit=o}t.form.submit=o}}t.style.display="none";var u=e(function(e){t.parentNode.insertBefore(e,t.nextSibling)},n);return u.save=r,u.getTextArea=function(){return t},u.toTextArea=function(){r(),t.parentNode.removeChild(u.getWrapperElement()),t.style.display="",t.form&&(i(),typeof t.form.submit=="function"&&(t.form.submit=s))},u},e.copyState=h,e.startState=p,d.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==0},peek:function(){return this.string.charAt(this.pos)},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(e){var t=this.string.charAt(this.pos);if(typeof e=="string")var n=t==e;else var n=t&&(e.test?e.test(t):e(t));if(n)return++this.pos,t},eatWhile:function(e){var t=this.pos;while(this.eat(e));return this.pos>t},eatSpace:function(){var e=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},backUp:function(e){this.pos-=e},column:function(){return J(this.string,this.start,this.tabSize)},indentation:function(){return J(this.string,null,this.tabSize)},match:function(e,t,n){if(typeof e!="string"){var i=this.string.slice(this.pos).match(e);return i&&t!==!1&&(this.pos+=i[0].length),i}function r(e){return n?e.toLowerCase():e}if(r(this.string).indexOf(r(e),this.pos)==this.pos)return t!==!1&&(this.pos+=e.length),!0},current:function(){return this.string.slice(this.start,this.pos)}},e.StringStream=d,v.prototype={attach:function(e){this.marker.set.push(e)},detach:function(e){var t=st(this.marker.set,e);t>-1&&this.marker.set.splice(t,1)},split:function(e,t){if(this.to<=e&&this.to!=null)return null;var n=this.from<e||this.from==null?null:this.from-e+t,r=this.to==null?null:this.to-e+t;return new v(n,r,this.style,this.marker)},dup:function(){return new v(null,null,this.style,this.marker)},clipTo:function(e,t,n,r,i){e&&r>this.from&&(r<this.to||this.to==null)?this.from=null:this.from!=null&&this.from>=t&&(this.from=Math.max(r,this.from)+i),n&&(t<this.to||this.to==null)&&(t>this.from||this.from==null)?this.to=null:this.to!=null&&this.to>t&&(this.to=r<this.to?this.to+i:t)},isDead:function(){return this.from!=null&&this.to!=null&&this.from>=this.to},sameSet:function(e){return this.marker==e.marker}},m.prototype={attach:function(e){this.line=e},detach:function(e){this.line==e&&(this.line=null)},split:function(e,t){if(e<this.from)return this.from=this.to=this.from-e+t,this},isDead:function(){return this.from>this.to},clipTo:function(e,t,n,r,i){(e||t<this.from)&&(n||r>this.to)?(this.from=0,this.to=-1):this.from>t&&(this.from=this.to=Math.max(r,this.from)+i)},sameSet:function(e){return!1},find:function(){return!this.line||!this.line.parent?null:{line:S(this.line),ch:this.from}},clear:function(){if(this.line){var e=st(this.line.marked,this);e!=-1&&this.line.marked.splice(e,1),this.line=null}}},g.inheritMarks=function(e,t){var n=new g(e),r=t&&t.marked;if(r)for(var i=0;i<r.length;++i)if(r[i].to==null&&r[i].style){var s=n.marked||(n.marked=[]),o=r[i],u=o.dup();s.push(u),u.attach(n)}return n},g.prototype={replace:function(e,t,n){var r=[],i=this.marked,s=t==null?this.text.length:t;y(0,e,this.styles,r),n&&r.push(n,null),y(s,this.text.length,this.styles,r),this.styles=r,this.text=this.text.slice(0,e)+n+this.text.slice(s),this.stateAfter=null;if(i){var o=n.length-(s-e);for(var u=0;u<i.length;++u){var a=i[u];a.clipTo(e==null,e||0,t==null,s,o),a.isDead()&&(a.detach(this),i.splice(u--,1))}}},split:function(e,t){var n=[t,null],r=this.marked;y(e,this.text.length,this.styles,n);var i=new g(t+this.text.slice(e),n);if(r)for(var s=0;s<r.length;++s){var o=r[s],u=o.split(e,t.length);u&&(i.marked||(i.marked=[]),i.marked.push(u),u.attach(i),u==o&&r.splice(s--,1))}return i},append:function(e){var t=this.text.length,n=e.marked,r=this.marked;this.text+=e.text,y(0,e.text.length,e.styles,this.styles);if(r)for(var i=0;i<r.length;++i)r[i].to==null&&(r[i].to=t);if(n&&n.length){r||(this.marked=r=[]);e:for(var i=0;i<n.length;++i){var s=n[i];if(!s.from)for(var o=0;o<r.length;++o){var u=r[o];if(u.to==t&&u.sameSet(s)){u.to=s.to==null?null:s.to+t,u.isDead()&&(u.detach(this),n.splice(i--,1));continue e}}r.push(s),s.attach(this),s.from+=t,s.to!=null&&(s.to+=t)}}},fixMarkEnds:function(e){var t=this.marked,n=e.marked;if(!t)return;for(var r=0;r<t.length;++r){var i=t[r],s=i.to==null;if(s&&n)for(var o=0;o<n.length;++o)if(n[o].sameSet(i)){s=!1;break}s&&(i.to=this.text.length)}},fixMarkStarts:function(){var e=this.marked;if(!e)return;for(var t=0;t<e.length;++t)e[t].from==null&&(e[t].from=0)},addMark:function(e){e.attach(this),this.marked==null&&(this.marked=[]),this.marked.push(e),this.marked.sort(function(e,t){return(e.from||0)-(t.from||0)})},highlight:function(e,t,n){var r=new d(this.text,n),i=this.styles,s=0,o=!1,u=i[0],a;this.text==""&&e.blankLine&&e.blankLine(t);while(!r.eol()){var f=e.token(r,t),l=this.text.slice(r.start,r.pos);r.start=r.pos,s&&i[s-1]==f?i[s-2]+=l:l&&(!o&&(i[s+1]!=f||s&&i[s-2]!=a)&&(o=!0),i[s++]=l,i[s++]=f,a=u,u=i[s]);if(r.pos>5e3){i[s++]=this.text.slice(r.pos),i[s++]=null;break}}return i.length!=s&&(i.length=s,o=!0),s&&i[s-2]!=a&&(o=!0),o||(i.length<5&&this.text.length<10?null:!1)},getTokenAt:function(e,t,n){var r=this.text,i=new d(r);while(i.pos<n&&!i.eol()){i.start=i.pos;var s=e.token(i,t)}return{start:i.start,end:i.pos,string:i.current(),className:s||null,state:t}},indentation:function(e){return J(this.text,null,e)},getHTML:function(e,t,n,r){function u(t,n){if(!t)return;s&&F&&t.charAt(0)==" "&&(t=" "+t.slice(1)),s=!1;if(t.indexOf(" ")==-1){o+=t.length;var r=rt(t)}else{var r="";for(var u=0;;){var a=t.indexOf(" ",u);if(a==-1){r+=rt(t.slice(u)),o+=t.length-u;break}o+=a-u;var f=e(o);r+=rt(t.slice(u,a))+f.html,o+=f.width,u=a+1}}n?i.push('<span class="',n,'">',r,"</span>"):i.push(r)}function v(e){return e?"cm-"+e.replace(/ +/g," cm-"):null}var i=[],s=!0,o=0,a=u;if(t!=null){var f=0,l='<span id="'+n+'">';a=function(e,n){var s=e.length;t>=f&&t<f+s?(t>f&&(u(e.slice(0,t-f),n),r&&i.push("<wbr>")),i.push(l),u(e.slice(t-f),n),i.push("</span>"),t--,f+=s):(f+=s,u(e,n),f==t&&f==d?i.push(l+"</span>"):f>t+10&&/\s/.test(e)&&(a=function(){}))}}var c=this.styles,h=this.text,p=this.marked,d=h.length;if(!h&&t==null)a(" ");else if(!p||!p.length)for(var m=0,g=0;g<d;m+=2){var y=c[m],b=c[m+1],w=y.length;g+w>d&&(y=y.slice(0,d-g)),g+=w,a(y,v(b))}else{var E=0,m=0,S="",b,x=0,T=p[0].from||0,N=[],C=0;function k(){var e;while(C<p.length&&((e=p[C]).from==E||e.from==null))e.style!=null&&N.push(e),++C;T=C<p.length?p[C].from:Infinity;for(var t=0;t<N.length;++t){var n=N[t].to||Infinity;n==E?N.splice(t--,1):T=Math.min(n,T)}}var L=0;while(E<d){T==E&&k();var A=Math.min(d,T);for(;;){if(S){var O=E+S.length,M=b;for(var _=0;_<N.length;++_)M=(M?M+" ":"")+N[_].style;a(O>A?S.slice(0,A-E):S,M);if(O>=A){S=S.slice(A-E),E=A;break}E=O}S=c[m++],b=v(c[m++])}}}return i.join("")},cleanUp:function(){this.parent=null;if(this.marked)for(var e=0,t=this.marked.length;e<t;++e)this.marked[e].detach(this)}},b.prototype={chunkSize:function(){return this.lines.length},remove:function(e,t,n){for(var r=e,i=e+t;r<i;++r){var s=this.lines[r];this.height-=s.height,s.cleanUp();if(s.handlers)for(var o=0;o<s.handlers.length;++o)n.push(s.handlers[o])}this.lines.splice(e,t)},collapse:function(e){e.splice.apply(e,[e.length,0].concat(this.lines))},insertHeight:function(e,t,n){this.height+=n,F?this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e)):this.lines.splice.apply(this.lines,[e,0].concat(t));for(var r=0,i=t.length;r<i;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}},w.prototype={chunkSize:function(){return this.size},remove:function(e,t,n){this.size-=t;for(var r=0;r<this.children.length;++r){var i=this.children[r],s=i.chunkSize();if(e<s){var o=Math.min(t,s-e),u=i.height;i.remove(e,o,n),this.height-=u-i.height,s==o&&(this.children.splice(r--,1),i.parent=null);if((t-=o)==0)break;e=0}else e-=s}if(this.size-t<25){var a=[];this.collapse(a),this.children=[new b(a)],this.children[0].parent=this}},collapse:function(e){for(var t=0,n=this.children.length;t<n;++t)this.children[t].collapse(e)},insert:function(e,t){var n=0;for(var r=0,i=t.length;r<i;++r)n+=t[r].height;this.insertHeight(e,t,n)},insertHeight:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0,i=this.children.length;r<i;++r){var s=this.children[r],o=s.chunkSize();if(e<=o){s.insertHeight(e,t,n);if(s.lines&&s.lines.length>50){while(s.lines.length>50){var u=s.lines.splice(s.lines.length-25,25),a=new b(u);s.height-=a.height,this.children.splice(r+1,0,a),a.parent=this}this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new w(t);if(!e.parent){var r=new w(e.children);r.parent=e,e.children=[r,n],e=r}else{e.size-=n.size,e.height-=n.height;var i=st(e.parent.children,e);e.parent.children.splice(i+1,0,n)}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iter:function(e,t,n){this.iterN(e,t-e,n)},iterN:function(e,t,n){for(var r=0,i=this.children.length;r<i;++r){var s=this.children[r],o=s.chunkSize();if(e<o){var u=Math.min(t,o-e);if(s.iterN(e,u,n))return!0;if((t-=u)==0)break;e=0}else e-=o}}},N.prototype={addChange:function(e,t,n){this.undone.length=0;var r=+(new Date),i=this.done[this.done.length-1],s=i&&i[i.length-1],o=r-this.time;if(this.compound&&i&&!this.closed)i.push({start:e,added:t,old:n});else if(o>400||!s||this.closed||s.start>e+n.length||s.start+s.added<e)this.done.push([{start:e,added:t,old:n}]),this.closed=!1;else{var u=Math.max(0,s.start-e),a=Math.max(0,e+n.length-(s.start+s.added));for(var f=u;f>0;--f)s.old.unshift(n[f-1]);for(var f=a;f>0;--f)s.old.push(n[n.length-f]);u&&(s.start=e),s.added+=t-(n.length-u-a)}this.time=r},startCompound:function(){this.compound++||(this.closed=!0)},endCompound:function(){--this.compound||(this.closed=!0)}},e.e_stop=O,e.e_preventDefault=L,e.e_stopPropagation=A,e.connect=P,H.prototype={set:function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)}};var B=e.Pass={toString:function(){return"CodeMirror.Pass"}},j=/gecko\/\d{7}/i.test(navigator.userAgent),F=/MSIE \d/.test(navigator.userAgent),I=/MSIE [1-8]\b/.test(navigator.userAgent),q=F&&document.documentMode==5,R=/WebKit\//.test(navigator.userAgent),U=/Chrome\//.test(navigator.userAgent),z=/Apple Computer/.test(navigator.vendor),W=/KHTML\//.test(navigator.userAgent),X=function(){if(I)return!1;var e=document.createElement("div");return"draggable"in e||"dragDrop"in e}(),V=function(){var e=document.createElement("textarea");return e.value="foo\nbar",e.value.indexOf("\r")>-1?"\r\n":"\n"}(),$=/^$/;j?$=/$'/:z?$=/\-[^ \-?]|\?[^ !'\"\),.\-\/:;\?\]\}]/:U&&($=/\-[^ \-\.?]|\?[^ \-\.?\]\}:;!'\"\),\/]|[\.!\"#&%\)*+,:;=>\]|\}~][\(\{\[<]|\$'/),document.documentElement.getBoundingClientRect!=null&&(Q=function(e,t){try{var n=e.getBoundingClientRect();n={top:n.top,left:n.left}}catch(r){n={top:0,left:0}}if(!t)if(window.pageYOffset==null){var i=document.documentElement||document.body.parentNode;i.scrollTop==null&&(i=document.body),n.top+=i.scrollTop,n.left+=i.scrollLeft}else n.top+=window.pageYOffset,n.left+=window.pageXOffset;return n});var nt=document.createElement("pre");rt("a")=="\na"?rt=function(e){return nt.textContent=e,nt.innerHTML.slice(1)}:rt(" ")!=" "&&(rt=function(e){return nt.innerHTML="",nt.appendChild(document.createTextNode(e)),nt.innerHTML}),e.htmlEscape=rt;var ut="\n\nb".split(/\n/).length!=3?function(e){var t=0,n,r=[];while((n=e.indexOf("\n",t))>-1)r.push(e.slice(t,e.charAt(n-1)=="\r"?n-1:n)),t=n+1;return r.push(e.slice(t)),r}:function(e){return e.split(/\r?\n/)};e.splitLines=ut;var at=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0};e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var ft={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",91:"Mod",92:"Mod",93:"Mod",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};return e.keyNames=ft,function(){for(var e=0;e<10;e++)ft[e+48]=String(e);for(var e=65;e<=90;e++)ft[e]=String.fromCharCode(e);for(var e=1;e<=12;e++)ft[e+111]=ft[e+63235]="F"+e}(),e}();define("CodeMirror",function(e){return function(){return e.CodeMirror}}(this)),CodeMirror.defineMode("mysql",function(e){function r(e){return new RegExp("^(?:"+e.join("|")+")$","i")}function u(e,t){var r=e.next();n=null;if(r=="$"||r=="?")return e.match(/^[\w\d]*/),"variable-2";if(r=="<"&&!e.match(/^[\s\u00a0=]/,!1))return e.match(/^[^\s\u00a0>]*>?/),"atom";if(r=='"'||r=="'")return t.tokenize=a(r),t.tokenize(e,t);if(r=="`")return t.tokenize=f(r),t.tokenize(e,t);if(/[{}\(\),\.;\[\]]/.test(r))return n=r,null;if(r!="-"){if(o.test(r))return e.eatWhile(o),null;if(r==":")return e.eatWhile(/[\w\d\._\-]/),"atom";e.eatWhile(/[_\w\d]/);if(e.eat(":"))return e.eatWhile(/[\w\d_\-]/),"atom";var u=e.current(),l;return i.test(u)?null:s.test(u)?"keyword":"variable"}ch2=e.next();if(ch2=="-")return e.skipToEnd(),"comment"}function a(e){return function(t,n){var r=!1,i;while((i=t.next())!=null){if(i==e&&!r){n.tokenize=u;break}r=!r&&i=="\\"}return"string"}}function f(e){return function(t,n){var r=!1,i;while((i=t.next())!=null){if(i==e&&!r){n.tokenize=u;break}r=!r&&i=="\\"}return"variable-2"}}function l(e,t,n){e.context={prev:e.context,indent:e.indent,col:n,type:t}}function c(e){e.indent=e.context.indent,e.context=e.context.prev}var t=e.indentUnit,n,i=r(["str","lang","langmatches","datatype","bound","sameterm","isiri","isuri","isblank","isliteral","union","a"]),s=r(["ACCESSIBLE","ALTER","AS","BEFORE","BINARY","BY","CASE","CHARACTER","COLUMN","CONTINUE","CROSS","CURRENT_TIMESTAMP","DATABASE","DAY_MICROSECOND","DEC","DEFAULT","DESC","DISTINCT","DOUBLE","EACH","ENCLOSED","EXIT","FETCH","FLOAT8","FOREIGN","GRANT","HIGH_PRIORITY","HOUR_SECOND","IN","INNER","INSERT","INT2","INT8","INTO","JOIN","KILL","LEFT","LINEAR","LOCALTIME","LONG","LOOP","MATCH","MEDIUMTEXT","MINUTE_SECOND","NATURAL","NULL","OPTIMIZE","OR","OUTER","PRIMARY","RANGE","READ_WRITE","REGEXP","REPEAT","RESTRICT","RIGHT","SCHEMAS","SENSITIVE","SHOW","SPECIFIC","SQLSTATE","SQL_CALC_FOUND_ROWS","STARTING","TERMINATED","TINYINT","TRAILING","UNDO","UNLOCK","USAGE","UTC_DATE","VALUES","VARCHARACTER","WHERE","WRITE","ZEROFILL","ALL","AND","ASENSITIVE","BIGINT","BOTH","CASCADE","CHAR","COLLATE","CONSTRAINT","CREATE","CURRENT_TIME","CURSOR","DAY_HOUR","DAY_SECOND","DECLARE","DELETE","DETERMINISTIC","DIV","DUAL","ELSEIF","EXISTS","FALSE","FLOAT4","FORCE","FULLTEXT","HAVING","HOUR_MINUTE","IGNORE","INFILE","INSENSITIVE","INT1","INT4","INTERVAL","ITERATE","KEYS","LEAVE","LIMIT","LOAD","LOCK","LONGTEXT","MASTER_SSL_VERIFY_SERVER_CERT","MEDIUMINT","MINUTE_MICROSECOND","MODIFIES","NO_WRITE_TO_BINLOG","ON","OPTIONALLY","OUT","PRECISION","PURGE","READS","REFERENCES","RENAME","REQUIRE","REVOKE","SCHEMA","SELECT","SET","SPATIAL","SQLEXCEPTION","SQL_BIG_RESULT","SSL","TABLE","TINYBLOB","TO","TRUE","UNIQUE","UPDATE","USING","UTC_TIMESTAMP","VARCHAR","WHEN","WITH","YEAR_MONTH","ADD","ANALYZE","ASC","BETWEEN","BLOB","CALL","CHANGE","CHECK","CONDITION","CONVERT","CURRENT_DATE","CURRENT_USER","DATABASES","DAY_MINUTE","DECIMAL","DELAYED","DESCRIBE","DISTINCTROW","DROP","ELSE","ESCAPED","EXPLAIN","FLOAT","FOR","FROM","GROUP","HOUR_MICROSECOND","IF","INDEX","INOUT","INT","INT3","INTEGER","IS","KEY","LEADING","LIKE","LINES","LOCALTIMESTAMP","LONGBLOB","LOW_PRIORITY","MEDIUMBLOB","MIDDLEINT","MOD","NOT","NUMERIC","OPTION","ORDER","OUTFILE","PROCEDURE","READ","REAL","RELEASE","REPLACE","RETURN","RLIKE","SECOND_MICROSECOND","SEPARATOR","SMALLINT","SQL","SQLWARNING","SQL_SMALL_RESULT","STRAIGHT_JOIN","THEN","TINYTEXT","TRIGGER","UNION","UNSIGNED","USE","UTC_TIME","VARBINARY","VARYING","WHILE","XOR","FULL","COLUMNS","MIN","MAX","STDEV","COUNT"]),o=/[*+\-<>=&|]/;return{startState:function(e){return{tokenize:u,context:null,indent:0,col:0}},token:function(e,t){e.sol()&&(t.context&&t.context.align==null&&(t.context.align=!1),t.indent=e.indentation());if(e.eatSpace())return null;var r=t.tokenize(e,t);r!="comment"&&t.context&&t.context.align==null&&t.context.type!="pattern"&&(t.context.align=!0);if(n=="(")l(t,")",e.column());else if(n=="[")l(t,"]",e.column());else if(n=="{")l(t,"}",e.column());else if(/[\]\}\)]/.test(n)){while(t.context&&t.context.type=="pattern")c(t);t.context&&n==t.context.type&&c(t)}else n=="."&&t.context&&t.context.type=="pattern"?c(t):/atom|string|variable/.test(r)&&t.context&&(/[\}\]]/.test(t.context.type)?l(t,"pattern",e.column()):t.context.type=="pattern"&&!t.context.align&&(t.context.align=!0,t.context.col=e.column()));return r},indent:function(e,n){var r=n&&n.charAt(0),i=e.context;if(/[\]\}]/.test(r))while(i&&i.type=="pattern")i=i.prev;var s=i&&r==i.type;return i?i.type=="pattern"?i.col:i.align?i.col+(s?0:1):i.indent+(s?0:t):0}}}),CodeMirror.defineMIME("text/x-mysql","mysql"),define("MySQLCodeMirror",function(){}),define("FiddleEditor",["CodeMirror","MySQLCodeMirror"],function(e,t){var n=function(t,n,r){return this.codeMirrorSupported=!/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent),this.codeMirrorSupported?this.codeMirror=e.fromTextArea(document.getElementById(t),{mode:"mysql",extraKeys:{Tab:"indentMore"},lineNumbers:!0,onChange:function(){n.call(r)}}):(this.textArea=document.getElementById(t),$(this.textArea).on("change",function(){n.call(r)}),$(this.textArea).on("keyup",function(){n.call(r)}),$(this.textArea).attr("fullscreen",!1)),this};return n.prototype.getValue=function(){return this.codeMirrorSupported?this.codeMirror.getValue():this.textArea.value},n.prototype.setValue=function(e){this.codeMirrorSupported?this.codeMirror.setValue(e):(this.textArea.value=e,$(this.textArea).trigger("change"))},n.prototype.refresh=function(){this.codeMirrorSupported&&this.codeMirror.refresh()},n.prototype.somethingSelected=function(){return this.codeMirrorSupported?this.codeMirror.somethingSelected():!1},n.prototype.getSelection=function(){return this.codeMirrorSupported?this.codeMirror.getSelection():this.textArea.value},n.prototype.getScrollerElement=function(){return this.codeMirrorSupported?this.codeMirror.getScrollerElement():null},n.prototype.getGutterElement=function(){return this.codeMirrorSupported?this.codeMirror.getGutterElement():null},n.prototype.isFullscreen=function(){return this.codeMirrorSupported?$(this.codeMirror.getScrollerElement()).hasClass("CodeMirror-fullscreen"):$(this.textArea).attr("fullscreen")==1},n.prototype.setFullscreen=function(e){if(e){var t=$(window).height()-40;this.codeMirrorSupported?($(this.codeMirror.getScrollerElement()).addClass("CodeMirror-fullscreen").height(t),$(this.codeMirror.getGutterElement()).height(t)):($(this.textArea).addClass("fullscreen"),$(this.textArea).height(t),$(this.textArea).attr("fullscreen",e))}else this.codeMirrorSupported?($(this.codeMirror.getScrollerElement()).removeClass("CodeMirror-fullscreen"),$(this.codeMirror.getGutterElement()).css("height","auto"),$(this.codeMirror.getScrollerElement()).css("height","200px")):($(this.textArea).removeClass("fullscreen"),$(this.textArea).height(100),$(this.textArea).attr("fullscreen",e))},n}),define("libs/renderTerminator",[],function(){var e=function(e,t){var n=e.find(".terminator a.btn");n.html(n.html().replace(/\[ .+ \]/,"[ "+t+" ]")),e.find(".terminator").data("statement_separator",t)};return e}),define("text!fiddle_backbone/templates/schemaOutput.html",[],function(){return' {{#if errorMessage}}\n <div class="alert alert-error database-error database-messages"><i class="icon-remove"></i>{{errorMessage}}</div> \n {{else}}\n <div class="alert alert-success database-messages"><i class="icon-ok"></i>Schema Ready</div> \n {{/if}}'}),define("text!fiddle_backbone/templates/schemaBrowser.html",[],function(){return' <h3>Schema Browser</h3>\n <ul class="tables">\n {{#each objects}}\n <li>\n <a href="#{{this.table_name}}"><i class="icon-plus"></i> {{this.table_name}}</a> ({{this.table_type}})\n <ul class="columns">\n {{#each this.columns}}\n <li>{{name}} {{type}}</li>\n {{/each}}\n </ul>\n </li>\n {{/each}}\n </ul>'}),define("fiddle_backbone/views/SchemaDef",["jQuery","Backbone","Handlebars","FiddleEditor","libs/renderTerminator","text!fiddle_backbone/templates/schemaOutput.html","text!fiddle_backbone/templates/schemaBrowser.html"],function(e,t,n,r,i,s,o){var u=t.View.extend({initialize:function(){this.editor=new r(this.id,this.handleSchemaChange,this),this.compiledOutputTemplate=n.compile(s),this.compiledSchemaBrowserTemplate=n.compile(o)},handleSchemaChange:function(){if(this.model.get("ddl")!=this.editor.getValue()||this.model.get("statement_separator")!=e(".panel.schema .terminator").data("statement_separator"))this.model.set({ddl:this.editor.getValue(),statement_separator:e(".panel.schema .terminator").data("statement_separator"),ready:!1}),e(".schema .helpTip").css("display",this.model.get("ddl").length?"none":"block"),e(".sql .helpTip").css("display",!this.model.get("ready")||this.model.get("loading")?"none":"block")},render:function(){this.editor.setValue(this.model.get("ddl")),this.updateDependents(),i(e(".panel.schema"),this.model.get("statement_separator"))},renderOutput:function(){this.options.output_el.html(this.compiledOutputTemplate(this.model.toJSON()))},renderSchemaBrowser:function(){this.options.browser_el.html(this.compiledSchemaBrowserTemplate({objects:this.model.get("schema_structure")}))},refresh:function(){this.editor.refresh()},updateDependents:function(){this.model.get("ready")?(e(".needsReadySchema").unblock(),e("#schemaBrowser").attr("disabled",!1),e(".schema .helpTip").css("display","none")):(e(".needsReadySchema").block({message:"Please build schema."}),e("#schemaBrowser").attr("disabled",!0),e(".schema .helpTip").css("display",this.model.get("loading")||this.model.get("ddl").length?"none":"block"))}});return u});var isIE=navigator.appVersion.indexOf("MSIE")!=-1?!0:!1,isWin=navigator.appVersion.toLowerCase().indexOf("win")!=-1?!0:!1,isOpera=navigator.userAgent.indexOf("Opera")!=-1?!0:!1;define("XPlans/oracle/flashver",function(){});var viewerMap={sqlmonitor:["11"],sqlpa:["11"],xplan:["11"],sql_detail:["11","11.2.0.2.0"],EmergencyADDM:["11"],ComparePeriodReport:["11"],AshViewer:["11"]},requiredMajorVersion=10,requiredMinorVersion=0,requiredRevision=0,hasProductInstall=DetectFlashVer(6,0,65),hasRequestedVersion=DetectFlashVer(requiredMajorVersion,requiredMinorVersion,requiredRevision);Vars=function(e){this.numVars=0;if(e!=null){var t,n,r=e.split("&"),i=r.length;for(var s=0;s<i;s++){var o=r[s];if(o.indexOf("=")!=-1&&o.length>3){var t=o.split("="),n=t[0],u=t[1];this[n]==null&&n.length>0&&u.length>0&&(this[n]=u,this.numVars++)}}}},Vars.prototype.toString=function(e){var t="";e==null&&(e="");for(var n in this)this[n]!=null&&typeof this[n]!="object"&&typeof this[n]!="function"&&n!="numVars"&&(t+=e+n+"="+this[n]+"&");return t.length>0&&(t=t.substr(0,t.length-1)),t},define("XPlans/oracle/loadswf",["XPlans/oracle/flashver"],function(e){return function(){return e.loadswf}}(this));if(typeof QP=="undefined"||!QP)var QP={};(function(){function e(e){var r=t(e),i=r[0];i.getContext!==null&&i.getContext!==undefined&&window.setTimeout(function(){var t=i.getContext("2d"),s=$(".qp-tr",e);i.width=s.outerWidth(!0),i.height=s.outerHeight(!0);var o=r.offset();$(".qp-tr",e).each(function(){var e=$("> * > .qp-node",$(this));$("> * > .qp-tr > * > .qp-node",$(this)).each(function(){n(t,o,e,$(this))})}),t.stroke()},1)}function t(e){var t=$("canvas",e);return t.length==0&&(e.prepend($("<canvas></canvas>").css("position","absolute").css("top",0).css("left",0)),t=$("canvas",e)),t}function n(e,t,n,r){var i=n.offset();i.top+=n.outerHeight()/2,i.left+=n.outerWidth();var s=r.offset();s.top+=r.outerHeight()/2;var o=i.left/2+s.left/2;e.moveTo(i.left-t.left,i.top-t.top),e.lineTo(o-t.left,i.top-t.top),e.lineTo(o-t.left,s.top-t.top),e.lineTo(s.left-t.left,s.top-t.top)}QP.drawLines=function(t){t===null||t===undefined?t=$(".qp-root").parent():t=$(t),e(t)}})(),define("XPlans/mssql",function(e){return function(){return e.QP}}(this)),define("text!fiddle_backbone/templates/queryTabularOutput.html",[],function(){return' {{#if id}}\n {{#each_with_index sets}}\n <div class="set" id="set_{{index}}">\n {{#if this.RESULTS.DATA.length}}\n <table class="results table table-bordered table-striped">\n <tr>\n {{#each this.RESULTS.COLUMNS}}\n <th>{{this}}</th>\n {{/each}}\n </tr>\n {{#each this.RESULTS.DATA}}\n <tr>\n {{#each this}}\n <td>{{result_display this this}}</td>\n {{/each}}\n </tr>\n {{/each}}\n </table>\n {{/if}}\n {{#if this.SUCCEEDED}}\n <div id="messages_{{index}}" class="alert alert-success database-messages">\n <i class="icon-ok"></i>\n Record Count: {{this.RESULTS.DATA.length}}; Execution Time: {{this.EXECUTIONTIME}}ms\n {{#if this.EXECUTIONPLAN.DATA.length}}\n <a href="#executionPlan" class="executionPlanLink"><i class="icon-plus"></i>View Execution Plan</a> \n {{/if}}\n <a href="#!{{../../schemaDef/dbType/id}}/{{../../schemaDef/short_code}}/{{../../id}}/{{index}}" class="setLink"><i class="icon-share-alt"></i> link</a>\n </div> \n \n {{#if this.EXECUTIONPLAN.DATA.length}}\n <table class="executionPlan table table-bordered">\n <tr>\n {{#each this.EXECUTIONPLAN.COLUMNS}}\n <th>{{this}}</th>\n {{/each}}\n </tr>\n {{#each this.EXECUTIONPLAN.DATA}}\n <tr>\n {{#each this}}\n <td><div style="position:relative">{{{this}}}</div></td>\n {{/each}}\n </tr>\n {{/each}}\n\n {{#if ../../../schemaDef/dbType/isSQLServer}}\n <tr>\n <td><a href="index.cfm/Fiddles/getSQLPlan?db_type_id={{../../../../schemaDef/dbType/id}}&short_code={{../../../../schemaDef/short_code}}&query_id={{../../../../id}}&id={{index}}">Download .sqlplan</a> | <a href="http://www.sqlsentry.net/plan-explorer/sql-server-query-view.asp?ad=201208-sqlfiddle-pe" target="_new">Download SQL Sentry Plan Explorer (free)</a></td>\n </tr>\n {{/if}}\n\n </table>\n {{/if}}\n \n {{else}}\n <div id="messages_{{index}}" class="alert alert-error database-messages"><i class="icon-remove"></i>{{this.ERRORMESSAGE}}</div> \n {{/if}}\n </div>\n {{/each_with_index}}\n {{/if}}'}),define("text!fiddle_backbone/templates/queryPlaintextOutput.html",[],function(){return' {{#if id}}\n {{#each_with_index sets}}\n <div class="set" id="set_{{index}}">\n {{#if this.RESULTS.DATA.length}}\n <pre class="results">\n|{{#each_simple_value_with_index this.RESULTS.COLUMNS}} {{result_display_padded ../this/RESULTS/COLUMNWIDTHS}} |{{/each_simple_value_with_index}}\n-{{#each_simple_value_with_index this.RESULTS.COLUMNS}}-{{divider_display ../this/RESULTS/COLUMNWIDTHS}}--{{/each_simple_value_with_index}}{{#each this.RESULTS.DATA}}\n|{{#each_simple_value_with_index this}} {{result_display_padded ../../this/RESULTS/COLUMNWIDTHS}} |{{/each_simple_value_with_index}}{{/each}}\n </pre>\n {{/if}}\n {{#if this.SUCCEEDED}}\n <div id="messages_{{index}}" class="alert alert-success database-messages">\n <i class="icon-ok"></i>\n Record Count: {{this.RESULTS.DATA.length}}; Execution Time: {{this.EXECUTIONTIME}}ms\n {{#if this.EXECUTIONPLAN.DATA.length}}\n <a href="#executionPlan" class="executionPlanLink"><i class="icon-plus"></i>View Execution Plan</a>\n {{/if}}\n <a href="#!{{../../schemaDef/dbType/id}}/{{../../schemaDef/short_code}}/{{../../id}}/{{index}}" class="setLink"><i class="icon-share-alt"></i> link</a>\n </div> \n \n {{#if this.EXECUTIONPLAN.DATA.length}}\n <table class="executionPlan table table-bordered">\n <tr>\n {{#each this.EXECUTIONPLAN.COLUMNS}}\n <th>{{this}}</th>\n {{/each}}\n </tr>\n {{#each this.EXECUTIONPLAN.DATA}}\n <tr>\n {{#each this}}\n <td><div style="position:relative">{{{this}}}</div></td>\n {{/each}}\n </tr>\n {{/each}}\n\n {{#if ../../../schemaDef/dbType/isSQLServer}}\n <tr>\n <td><a href="index.cfm/Fiddles/getSQLPlan?db_type_id={{../../../../schemaDef/dbType/id}}&short_code={{../../../../schemaDef/short_code}}&query_id={{../../../../id}}&id={{index}}">Download .sqlplan</a></td>\n </tr>\n {{/if}}\n \n </table>\n {{/if}}\n \n {{else}}\n <div id="messages_{{index}}" class="alert alert-error database-error database-messages"><i class="icon-remove"></i>{{this.ERRORMESSAGE}}</div> \n {{/if}}\n </div>\n {{/each_with_index}}\n {{/if}}'}),define("HandlebarsHelpers/divider_display",["Handlebars"],function(e){e.registerHelper("divider_display",function(e){var t=[];return t.length=e[this.index]+1,t.join("-")})}),define("HandlebarsHelpers/each_simple_value_with_index",["Handlebars"],function(e){e.registerHelper("each_simple_value_with_index",function(e,t){var n="";k=0;for(var r=0,i=e.length;r<i;r++){var s={value:e[r]};s.index=k,s.first=k==0,s.last=k==e.length,n+=t(s),k++}return n})}),define("HandlebarsHelpers/each_with_index",["Handlebars"],function(e){e.registerHelper("each_with_index",function(e,t){var n="",r=0;for(var i=0,s=e.length;i<s;i++)if(e[i]){var o=e[i];o.index=r,o.first=r==0,o.last=r==e.length,n+=t(o),r++}return n})}),define("HandlebarsHelpers/result_display_padded",["Handlebars"],function(e){e.registerHelper("result_display_padded",function(e){var t=[];return t.length=e[this.index]-this.value.toString().length+1,t.join(" ")+this.value.toString()})}),define("HandlebarsHelpers/result_display",["jQuery","Handlebars"],function(e,t){t.registerHelper("result_display",function(n){var r=/\b((?:https?:\/\/|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?������]))/ig;return e.isPlainObject(n)?JSON.stringify(n):n==null?"(null)":n===!1?"false":typeof n=="string"&&n.match(r)&&t.Utils.escapeExpression(n)==n?new t.SafeString(n.replace(r,"<a href='$1' target='_new'>$1</a>")):n})}),define("fiddle_backbone/views/Query",["jQuery","Backbone","Handlebars","FiddleEditor","libs/renderTerminator","XPlans/oracle/loadswf","XPlans/mssql","text!fiddle_backbone/templates/queryTabularOutput.html","text!fiddle_backbone/templates/queryPlaintextOutput.html","HandlebarsHelpers/divider_display","HandlebarsHelpers/each_simple_value_with_index","HandlebarsHelpers/each_with_index","HandlebarsHelpers/result_display_padded","HandlebarsHelpers/result_display"],function(e,t,n,r,i,s,o,u,a){var f=t.View.extend({initialize:function(){this.editor=new r(this.id,this.handleQueryChange,this),this.outputType="tabular",this.compiledOutputTemplate={},this.compiledOutputTemplate.tabular=n.compile(u),this.compiledOutputTemplate.plaintext=n.compile(a)},setOutputType:function(e){this.outputType=e},handleQueryChange:function(){var t=this.model.get("schemaDef");this.model.set({sql:this.editor.getValue()}),e(".sql .helpTip").css("display",!t.get("ready")||t.get("loading")||this.model.get("sql").length?"none":"block")},render:function(){this.editor.setValue(this.model.get("sql")),this.model.id&&this.renderOutput(),i(e(".panel.sql"),this.model.get("statement_separator"))},renderOutput:function(){var t=this.model,n=this.model.toJSON();_.each(n.sets,function(e,t){if(e.RESULTS){var r=_.map(e.RESULTS.COLUMNS,function(e){return e.length});_.each(e.RESULTS.DATA,function(e){r=_.map(e,function(e,t){return _.max([e.toString().length,r[t]])})}),n.sets[t].RESULTS.COLUMNWIDTHS=r}}),n.schemaDef=this.model.get("schemaDef").toJSON(),n.schemaDef.dbType=this.model.get("schemaDef").get("dbType").toJSON(),n.schemaDef.dbType.isSQLServer=this.model.get("schemaDef").get("dbType").get("simple_name")=="SQL Server",this.options.output_el.html(this.compiledOutputTemplate[this.outputType](n)),e("script.oracle_xplan_xml").each(function(){e(this).siblings("div.oracle_xplan").html(s(e(this).text()))}),this.options.output_el.find("a.executionPlanLink").click(function(n){n.preventDefault(),e("i",this).toggleClass("icon-minus icon-plus"),e(this).closest(".set").find(".executionPlan").toggle(),e("i",this).hasClass("icon-minus")&&t.get("schemaDef").get("dbType").get("simple_name")=="SQL Server"&&o.drawLines(e(this).closest(".set").find(".executionPlan div"))})},refresh:function(){this.editor.refresh()},checkForSelectedText:function(){this.editor.somethingSelected()?this.model.set("sql",this.editor.getSelection()):this.model.set("sql",this.editor.getValue())}});return f}),define("fiddle_backbone/router",["jQuery","Underscore","Backbone","libs/renderTerminator","fiddle_backbone/models/UsedFiddle"],function(e,t,n,r,i){var s=function(s,o,u,a,f){var l=n.Router.extend({routes:{"!:db_type_id":"DBType","!:db_type_id/:short_code":"SchemaDef","!:db_type_id/:short_code/:query_id":"Query","!:db_type_id/:short_code/:query_id/:set_id":"SetAnchor"},DBType:function(e){s.setSelectedType(e,!0),f.render()},SchemaDef:function(e,t){this.loadContent(e,"!"+e+"/"+t)},Query:function(e,t,n){this.loadContent(e,"!"+e+"/"+t+"/"+n)},SetAnchor:function(n,r,i,a){var f=function(){e("#set_"+a).length&&(window.scrollTo(0,e("#set_"+a).offset().top-50),e("#set_"+a).addClass("highlight"))};!s.getSelectedType()||s.getSelectedType().get("id")!=n||o.get("short_code")!=r||u.get("id")!=i?(u.bind("reloaded",t.once(f)),this.loadContent(n,"!"+n+"/"+r+"/"+i)):(e(".set").removeClass("highlight"),f())},loadContent:function(n,f){this.DBType(n);if(u.get("pendingChanges")&&!confirm("Warning! You have made changes to your query which will be lost. Continue?'"))return!1;o.set("loading",!0),e(".helpTip").css("display","none"),e("body").block({message:"Loading..."}),e.getJSON("index.cfm/fiddles/loadContent",{fragment:f},function(f){o.set("loading",!1);if(f.short_code){var l=s.getSelectedType();l.get("context")=="browser"?(l.get("className")=="sqljs"&&o.get("browserEngines").websql.nativeSQLite&&confirm("Fiddle originally built with SQL.js, but you have WebSQL available - would you like to use that instead (it'll be faster to load)?")&&(s.setSelectedType(e("#db_type_id a:contains('WebSQL')").closest("li").attr("db_type_id")),l=s.getSelectedType(),o.set({ddl:f.ddl,dbType:l,statement_separator:f.schema_statement_separator}),f.sql&&(u.set({schemaDef:o,sql:f.sql,statement_separator:f.query_statement_separator}),o.on("built",t.once(function(){u.execute()}))),o.build(s)),o.get("browserEngines")[l.get("className")].buildSchema({short_code:e.trim(f.short_code),statement_separator:f.schema_statement_separator,ddl:f.ddl,success:function(){o.set({short_code:f.short_code,ddl:f.ddl,ready:!0,valid:!0,errorMessage:"",statement_separator:f.schema_statement_separator,dbType:s.getSelectedType()}),r(e(".panel.schema"),f.schema_statement_separator),f.sql?(a.insert(new i({fragment:"!"+n+"/"+f.short_code+"/"+f.id})),u.set({id:f.id,sql:f.sql,statement_separator:f.query_statement_separator})):a.insert(new i({fragment:"!"+n+"/"+f.short_code})),o.get("browserEngines")[l.get("className")].getSchemaStructure({callback:function(t){o.set({schema_structure:t}),o.trigger("reloaded"),f.sql?o.get("browserEngines")[l.get("className")].executeQuery({sql:f.sql,statement_separator:f.query_statement_separator,success:function(t){u.set({sets:t}),u.trigger("reloaded"),e("body").unblock()},error:function(t){u.set({sets:[]}),u.trigger("reloaded"),e("body").unblock()}}):e("body").unblock()}})},error:function(t){o.set({short_code:f.short_code,ddl:f.ddl,ready:!0,valid:!1,errorMessage:t,dbType:s.getSelectedType(),statement_separator:f.schema_statement_separator,schema_structure:[]}),r(e(".panel.schema"),f.schema_statement_separator),f.sql&&(u.set({id:f.id,sql:f.sql,statement_separator:f.query_statement_separator,schemaDef:o}),u.trigger("reloaded")),o.trigger("failed"),o.trigger("reloaded"),e("body").unblock()}})):(o.set({short_code:f.short_code,ddl:f.ddl,ready:!0,valid:!0,errorMessage:"",statement_separator:f.schema_statement_separator,schema_structure:f.schema_structure}),r(e(".panel.schema"),f.schema_statement_separator),o.trigger("reloaded"),f.sql?(a.insert(new i({fragment:"!"+n+"/"+f.short_code+"/"+f.id})),u.set({id:f.id,sql:f.sql,sets:f.sets,statement_separator:f.query_statement_separator}),u.trigger("reloaded")):a.insert(new i({fragment:"!"+n+"/"+f.short_code})),e("body").unblock())}else e("body").unblock()})}}),c=new l;return n.history.start({pushState:!1}),c};return{initialize:s}}),function(e){function u(n,u){var f=n==window,c=u&&u.message!==undefined?u.message:undefined;u=e.extend({},e.blockUI.defaults,u||{}),u.overlayCSS=e.extend({},e.blockUI.defaults.overlayCSS,u.overlayCSS||{});var v=e.extend({},e.blockUI.defaults.css,u.css||{}),m=e.extend({},e.blockUI.defaults.themedCSS,u.themedCSS||{});c=c===undefined?u.message:c,f&&s&&a(window,{fadeOut:0});if(c&&typeof c!="string"&&(c.parentNode||c.jquery)){var g=c.jquery?c[0]:c,y={};e(n).data("blockUI.history",y),y.el=g,y.parent=g.parentNode,y.display=g.style.display,y.position=g.style.position,y.parent&&y.parent.removeChild(g)}e(n).data("blockUI.onUnblock",u.onUnblock);var b=u.baseZ,w=e.browser.msie||u.forceIframe?e('<iframe class="blockUI" style="z-index:'+b++ +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+u.iframeSrc+'"></iframe>'):e('<div class="blockUI" style="display:none"></div>'),E=u.theme?e('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+b++ +';display:none"></div>'):e('<div class="blockUI blockOverlay" style="z-index:'+b++ +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>'),S,x;u.theme&&f?x='<div class="blockUI '+u.blockMsgClass+' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(b+10)+';display:none;position:fixed">'+'<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(u.title||" ")+"</div>"+'<div class="ui-widget-content ui-dialog-content"></div>'+"</div>":u.theme?x='<div class="blockUI '+u.blockMsgClass+' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(b+10)+';display:none;position:absolute">'+'<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(u.title||" ")+"</div>"+'<div class="ui-widget-content ui-dialog-content"></div>'+"</div>":f?x='<div class="blockUI '+u.blockMsgClass+' blockPage" style="z-index:'+(b+10)+';display:none;position:fixed"></div>':x='<div class="blockUI '+u.blockMsgClass+' blockElement" style="z-index:'+(b+10)+';display:none;position:absolute"></div>',S=e(x),c&&(u.theme?(S.css(m),S.addClass("ui-widget-content")):S.css(v)),!u.theme&&(!u.applyPlatformOpacityRules||!e.browser.mozilla||!/Linux/.test(navigator.platform))&&E.css(u.overlayCSS),E.css("position",f?"fixed":"absolute"),(e.browser.msie||u.forceIframe)&&w.css("opacity",0);var T=[w,E,S],N=f?e("body"):e(n);e.each(T,function(){this.appendTo(N)}),u.theme&&u.draggable&&e.fn.draggable&&S.draggable({handle:".ui-dialog-titlebar",cancel:"li"});var C=r&&(!e.boxModel||e("object,embed",f?null:n).length>0);if(i||C){f&&u.allowBodyStretch&&e.boxModel&&e("html,body").css("height","100%");if((i||!e.boxModel)&&!f)var k=d(n,"borderTopWidth"),L=d(n,"borderLeftWidth"),A=k?"(0 - "+k+")":0,O=L?"(0 - "+L+")":0;e.each([w,E,S],function(e,t){var n=t[0].style;n.position="absolute";if(e<2)f?n.setExpression("height","Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:"+u.quirksmodeOffsetHack+') + "px"'):n.setExpression("height",'this.parentNode.offsetHeight + "px"'),f?n.setExpression("width",'jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'):n.setExpression("width",'this.parentNode.offsetWidth + "px"'),O&&n.setExpression("left",O),A&&n.setExpression("top",A);else if(u.centerY)f&&n.setExpression("top",'(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'),n.marginTop=0;else if(!u.centerY&&f){var r=u.css&&u.css.top?parseInt(u.css.top):0,i="((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "+r+') + "px"';n.setExpression("top",i)}})}c&&(u.theme?S.find(".ui-widget-content").append(c):S.append(c),(c.jquery||c.nodeType)&&e(c).show()),(e.browser.msie||u.forceIframe)&&u.showOverlay&&w.show();if(u.fadeIn){var M=u.onBlock?u.onBlock:t,_=u.showOverlay&&!c?M:t,D=c?M:t;u.showOverlay&&E._fadeIn(u.fadeIn,_),c&&S._fadeIn(u.fadeIn,D)}else u.showOverlay&&E.show(),c&&S.show(),u.onBlock&&u.onBlock();l(1,n,u),f?(s=S[0],o=e(":input:enabled:visible",s),u.focusInput&&setTimeout(h,20)):p(S[0],u.centerX,u.centerY);if(u.timeout){var P=setTimeout(function(){f?e.unblockUI(u):e(n).unblock(u)},u.timeout);e(n).data("blockUI.timeout",P)}}function a(t,n){var r=t==window,i=e(t),u=i.data("blockUI.history"),a=i.data("blockUI.timeout");a&&(clearTimeout(a),i.removeData("blockUI.timeout")),n=e.extend({},e.blockUI.defaults,n||{}),l(0,t,n),n.onUnblock===null&&(n.onUnblock=i.data("blockUI.onUnblock"),i.removeData("blockUI.onUnblock"));var c;r?c=e("body").children().filter(".blockUI").add("body > .blockUI"):c=e(".blockUI",t),r&&(s=o=null),n.fadeOut?(c.fadeOut(n.fadeOut),setTimeout(function(){f(c,u,n,t)},n.fadeOut)):f(c,u,n,t)}function f(t,n,r,i){t.each(function(e,t){this.parentNode&&this.parentNode.removeChild(this)}),n&&n.el&&(n.el.style.display=n.display,n.el.style.position=n.position,n.parent&&n.parent.appendChild(n.el),e(i).removeData("blockUI.history")),typeof r.onUnblock=="function"&&r.onUnblock(i,r)}function l(t,n,r){var i=n==window,o=e(n);if(!t&&(i&&!s||!i&&!o.data("blockUI.isBlocked")))return;i||o.data("blockUI.isBlocked",t);if(!r.bindEvents||t&&!r.showOverlay)return;var u="mousedown mouseup keydown keypress";t?e(document).bind(u,r,c):e(document).unbind(u,c)}function c(t){if(t.keyCode&&t.keyCode==9&&s&&t.data.constrainTabKey){var n=o,r=!t.shiftKey&&t.target===n[n.length-1],i=t.shiftKey&&t.target===n[0];if(r||i)return setTimeout(function(){h(i)},10),!1}var u=t.data;return e(t.target).parents("div."+u.blockMsgClass).length>0?!0:e(t.target).parents().children().filter("div.blockUI").length==0}function h(e){if(!o)return;var t=o[e===!0?o.length-1:0];t&&t.focus()}function p(e,t,n){var r=e.parentNode,i=e.style,s=(r.offsetWidth-e.offsetWidth)/2-d(r,"borderLeftWidth"),o=(r.offsetHeight-e.offsetHeight)/2-d(r,"borderTopWidth");t&&(i.left=s>0?s+"px":"0"),n&&(i.top=o>0?o+"px":"0")}function d(t,n){return parseInt(e.css(t,n))||0}if(/1\.(0|1|2)\.(0|1|2)/.test(e.fn.jquery)||/^1.1/.test(e.fn.jquery)){alert("blockUI requires jQuery v1.2.3 or later! You are using v"+e.fn.jquery);return}e.fn._fadeIn=e.fn.fadeIn;var t=function(){},n=document.documentMode||0,r=e.browser.msie&&(e.browser.version<8&&!n||n<8),i=e.browser.msie&&/MSIE 6.0/.test(navigator.userAgent)&&!n;e.blockUI=function(e){u(window,e)},e.unblockUI=function(e){a(window,e)},e.growlUI=function(t,n,r,i){var s=e('<div class="growlUI"></div>');t&&s.append("<h1>"+t+"</h1>"),n&&s.append("<h2>"+n+"</h2>"),r==undefined&&(r=3e3),e.blockUI({message:s,fadeIn:700,fadeOut:1e3,centerY:!1,timeout:r,showOverlay:!1,onUnblock:i,css:e.blockUI.defaults.growlCSS})},e.fn.block=function(t){return this.unblock({fadeOut:0}).each(function(){e.css(this,"position")=="static"&&(this.style.position="relative"),e.browser.msie&&(this.style.zoom=1),u(this,t)})},e.fn.unblock=function(e){return this.each(function(){a(this,e)})},e.blockUI.version=2.39,e.blockUI.defaults={message:"<h1>Please wait...</h1>",title:null,draggable:!0,theme:!1,css:{padding:0,margin:0,width:"30%",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"3px solid #aaa",backgroundColor:"#fff",cursor:"wait"},themedCSS:{width:"30%",top:"40%",left:"35%"},overlayCSS:{backgroundColor:"#000",opacity:.6,cursor:"wait"},growlCSS:{width:"350px",top:"10px",left:"",right:"10px",border:"none",padding:"5px",opacity:.6,cursor:"default",color:"#fff",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px","border-radius":"10px"},iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank",forceIframe:!1,baseZ:1e3,centerX:!0,centerY:!0,allowBodyStretch:!0,bindEvents:!0,constrainTabKey:!0,fadeIn:200,fadeOut:400,timeout:0,showOverlay:!0,focusInput:!0,applyPlatformOpacityRules:!0,onBlock:null,onUnblock:null,quirksmodeOffsetHack:4,blockMsgClass:"blockMsg"};var s=null,o=[]}(jQuery),define("libs/jquery/jquery.blockUI",function(){}),function(e){e.cookie=function(t,n,r){if(arguments.length>1&&(!/Object/.test(Object.prototype.toString.call(n))||n===null||n===undefined)){r=e.extend({},r);if(n===null||n===undefined)r.expires=-1;if(typeof r.expires=="number"){var i=r.expires,s=r.expires=new Date;s.setDate(s.getDate()+i)}return n=String(n),document.cookie=[encodeURIComponent(t),"=",r.raw?n:encodeURIComponent(n),r.expires?"; expires="+r.expires.toUTCString():"",r.path?"; path="+r.path:"",r.domain?"; domain="+r.domain:"",r.secure?"; secure":""].join("")}r=n||{};var o=r.raw?function(e){return e}:decodeURIComponent,u=document.cookie.split("; ");for(var a=0,f;f=u[a]&&u[a].split("=");a++)if(o(f[0])===t)return o(f[1]||"");return null}}(jQuery),define("libs/jquery/jquery.cookie",function(){}),!function(e){var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.collapse.defaults,n),this.options.parent&&(this.$parent=e(this.options.parent)),this.options.toggle&&this.toggle()};t.prototype={constructor:t,dimension:function(){var e=this.$element.hasClass("width");return e?"width":"height"},show:function(){var t,n,r,i;if(this.transitioning)return;t=this.dimension(),n=e.camelCase(["scroll",t].join("-")),r=this.$parent&&this.$parent.find("> .accordion-group > .in");if(r&&r.length){i=r.data("collapse");if(i&&i.transitioning)return;r.collapse("hide"),i||r.data("collapse",null)}this.$element[t](0),this.transition("addClass",e.Event("show"),"shown"),this.$element[t](this.$element[0][n])},hide:function(){var t;if(this.transitioning)return;t=this.dimension(),this.reset(this.$element[t]()),this.transition("removeClass",e.Event("hide"),"hidden"),this.$element[t](0)},reset:function(e){var t=this.dimension();return this.$element.removeClass("collapse")[t](e||"auto")[0].offsetWidth,this.$element[e!==null?"addClass":"removeClass"]("collapse"),this},transition:function(t,n,r){var i=this,s=function(){n.type=="show"&&i.reset(),i.transitioning=0,i.$element.trigger(r)};this.$element.trigger(n);if(n.isDefaultPrevented())return;this.transitioning=1,this.$element[t]("in"),e.support.transition&&this.$element.hasClass("collapse")?this.$element.one(e.support.transition.end,s):s()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}},e.fn.collapse=function(n){return this.each(function(){var r=e(this),i=r.data("collapse"),s=typeof n=="object"&&n;i||r.data("collapse",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.collapse.defaults={toggle:!0},e.fn.collapse.Constructor=t,e(function(){e("body").on("click.collapse.data-api","[data-toggle=collapse]",function(t){var n=e(this),r,i=n.attr("data-target")||t.preventDefault()||(r=n.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,""),s=e(i).data("collapse")?"toggle":n.data();e(i).collapse(s)})})}(window.jQuery),define("Bootstrap/bootstrap-collapse",function(){}),!function(e){var t=function(t){this.element=e(t)};t.prototype={constructor:t,show:function(){var t=this.element,n=t.closest("ul:not(.dropdown-menu)"),r=t.attr("data-target"),i,s,o;r||(r=t.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,""));if(t.parent("li").hasClass("active"))return;i=n.find(".active a").last()[0],o=e.Event("show",{relatedTarget:i}),t.trigger(o);if(o.isDefaultPrevented())return;s=e(r),this.activate(t.parent("li"),n),this.activate(s,s.parent(),function(){t.trigger({type:"shown",relatedTarget:i})})},activate:function(t,n,r){function o(){i.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),t.addClass("active"),s?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu")&&t.closest("li.dropdown").addClass("active"),r&&r()}var i=n.find("> .active"),s=r&&e.support.transition&&i.hasClass("fade");s?i.one(e.support.transition.end,o):o(),i.removeClass("in")}},e.fn.tab=function(n){return this.each(function(){var r=e(this),i=r.data("tab");i||r.data("tab",i=new t(this)),typeof n=="string"&&i[n]()})},e.fn.tab.Constructor=t,e(function(){e("body").on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(t){t.preventDefault(),e(this).tab("show")})})}(window.jQuery),define("Bootstrap/bootstrap-tab",function(){}),!function(e){function r(){e(t).parent().removeClass("open")}var t='[data-toggle="dropdown"]',n=function(t){var n=e(t).on("click.dropdown.data-api",this.toggle);e("html").on("click.dropdown.data-api",function(){n.parent().removeClass("open")})};n.prototype={constructor:n,toggle:function(t){var n=e(this),i,s,o;if(n.is(".disabled, :disabled"))return;return s=n.attr("data-target"),s||(s=n.attr("href"),s=s&&s.replace(/.*(?=#[^\s]*$)/,"")),i=e(s),i.length||(i=n.parent()),o=i.hasClass("open"),r(),o||i.toggleClass("open"),!1}},e.fn.dropdown=function(t){return this.each(function(){var r=e(this),i=r.data("dropdown");i||r.data("dropdown",i=new n(this)),typeof t=="string"&&i[t].call(r)})},e.fn.dropdown.Constructor=n,e(function(){e("html").on("click.dropdown.data-api",r),e("body").on("click.dropdown",".dropdown form",function(e){e.stopPropagation()}).on("click.dropdown.data-api",t,n.prototype.toggle)})}(window.jQuery),define("Bootstrap/bootstrap-dropdown",function(){}),!function(e){function n(){var t=this,n=setTimeout(function(){t.$element.off(e.support.transition.end),r.call(t)},500);this.$element.one(e.support.transition.end,function(){clearTimeout(n),r.call(t)})}function r(e){this.$element.hide().trigger("hidden"),i.call(this)}function i(t){var n=this,r=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var i=e.support.transition&&r;this.$backdrop=e('<div class="modal-backdrop '+r+'" />').appendTo(document.body),this.options.backdrop!="static"&&this.$backdrop.click(e.proxy(this.hide,this)),i&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),i?this.$backdrop.one(e.support.transition.end,t):t()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(e.support.transition.end,e.proxy(s,this)):s.call(this)):t&&t()}function s(){this.$backdrop.remove(),this.$backdrop=null}function o(){var t=this;this.isShown&&this.options.keyboard?e(document).on("keyup.dismiss.modal",function(e){e.which==27&&t.hide()}):this.isShown||e(document).off("keyup.dismiss.modal")}var t=function(t,n){this.options=n,this.$element=e(t).delegate('[data-dismiss="modal"]',"click.dismiss.modal",e.proxy(this.hide,this))};t.prototype={constructor:t,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var t=this,n=e.Event("show");this.$element.trigger(n);if(this.isShown||n.isDefaultPrevented())return;e("body").addClass("modal-open"),this.isShown=!0,o.call(this),i.call(this,function(){var n=e.support.transition&&t.$element.hasClass("fade");t.$element.parent().length||t.$element.appendTo(document.body),t.$element.show(),n&&t.$element[0].offsetWidth,t.$element.addClass("in"),n?t.$element.one(e.support.transition.end,function(){t.$element.trigger("shown")}):t.$element.trigger("shown")})},hide:function(t){t&&t.preventDefault();var i=this;t=e.Event("hide"),this.$element.trigger(t);if(!this.isShown||t.isDefaultPrevented())return;this.isShown=!1,e("body").removeClass("modal-open"),o.call(this),this.$element.removeClass("in"),e.support.transition&&this.$element.hasClass("fade")?n.call(this):r.call(this)}},e.fn.modal=function(n){return this.each(function(){var r=e(this),i=r.data("modal"),s=e.extend({},e.fn.modal.defaults,r.data(),typeof n=="object"&&n);i||r.data("modal",i=new t(this,s)),typeof n=="string"?i[n]():s.show&&i.show()})},e.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},e.fn.modal.Constructor=t,e(function(){e("body").on("click.modal.data-api",'[data-toggle="modal"]',function(t){var n=e(this),r,i=e(n.attr("data-target")||(r=n.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,"")),s=i.data("modal")?"toggle":e.extend({},i.data(),n.data());t.preventDefault(),i.modal(s)})})}(window.jQuery),define("Bootstrap/bootstrap-modal",function(){}),!function(e){var t=function(e,t){this.init("tooltip",e,t)};t.prototype={constructor:t,init:function(t,n,r){var i,s;this.type=t,this.$element=e(n),this.options=this.getOptions(r),this.enabled=!0,this.options.trigger!="manual"&&(i=this.options.trigger=="hover"?"mouseenter":"focus",s=this.options.trigger=="hover"?"mouseleave":"blur",this.$element.on(i,this.options.selector,e.proxy(this.enter,this)),this.$element.on(s,this.options.selector,e.proxy(this.leave,this))),this.options.selector?this._options=e.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(t){return t=e.extend({},e.fn[this.type].defaults,t,this.$element.data()),t.delay&&typeof t.delay=="number"&&(t.delay={show:t.delay,hide:t.delay}),t},enter:function(t){var n=e(t.currentTarget)[this.type](this._options).data(this.type);if(!n.options.delay||!n.options.delay.show)return n.show();clearTimeout(this.timeout),n.hoverState="in",this.timeout=setTimeout(function(){n.hoverState=="in"&&n.show()},n.options.delay.show)},leave:function(t){var n=e(t.currentTarget)[this.type](this._options).data(this.type);this.timeout&&clearTimeout(this.timeout);if(!n.options.delay||!n.options.delay.hide)return n.hide();n.hoverState="out",this.timeout=setTimeout(function(){n.hoverState=="out"&&n.hide()},n.options.delay.hide)},show:function(){var e,t,n,r,i,s,o;if(this.hasContent()&&this.enabled){e=this.tip(),this.setContent(),this.options.animation&&e.addClass("fade"),s=typeof this.options.placement=="function"?this.options.placement.call(this,e[0],this.$element[0]):this.options.placement,t=/in/.test(s),e.remove().css({top:0,left:0,display:"block"}).appendTo(t?this.$element:document.body),n=this.getPosition(t),r=e[0].offsetWidth,i=e[0].offsetHeight;switch(t?s.split(" ")[1]:s){case"bottom":o={top:n.top+n.height,left:n.left+n.width/2-r/2};break;case"top":o={top:n.top-i,left:n.left+n.width/2-r/2};break;case"left":o={top:n.top+n.height/2-i/2,left:n.left-r};break;case"right":o={top:n.top+n.height/2-i/2,left:n.left+n.width}}e.css(o).addClass(s).addClass("in")}},isHTML:function(e){return typeof e!="string"||e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3||/^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(e)},setContent:function(){var e=this.tip(),t=this.getTitle();e.find(".tooltip-inner")[this.isHTML(t)?"html":"text"](t),e.removeClass("fade in top bottom left right")},hide:function(){function r(){var t=setTimeout(function(){n.off(e.support.transition.end).remove()},500);n.one(e.support.transition.end,function(){clearTimeout(t),n.remove()})}var t=this,n=this.tip();n.removeClass("in"),e.support.transition&&this.$tip.hasClass("fade")?r():n.remove()},fixTitle:function(){var e=this.$element;(e.attr("title")||typeof e.attr("data-original-title")!="string")&&e.attr("data-original-title",e.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(t){return e.extend({},t?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var e,t=this.$element,n=this.options;return e=t.attr("data-original-title")||(typeof n.title=="function"?n.title.call(t[0]):n.title),e},tip:function(){return this.$tip=this.$tip||e(this.options.template)},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(){this[this.tip().hasClass("in")?"hide":"show"]()}},e.fn.tooltip=function(n){return this.each(function(){var r=e(this),i=r.data("tooltip"),s=typeof n=="object"&&n;i||r.data("tooltip",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.tooltip.Constructor=t,e.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover",title:"",delay:0}}(window.jQuery),define("Bootstrap/bootstrap-tooltip",function(){}),!function(e){var t=function(e,t){this.init("popover",e,t)};t.prototype=e.extend({},e.fn.tooltip.Constructor.prototype,{constructor:t,setContent:function(){var e=this.tip(),t=this.getTitle(),n=this.getContent();e.find(".popover-title")[this.isHTML(t)?"html":"text"](t),e.find(".popover-content > *")[this.isHTML(n)?"html":"text"](n),e.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var e,t=this.$element,n=this.options;return e=t.attr("data-content")||(typeof n.content=="function"?n.content.call(t[0]):n.content),e},tip:function(){return this.$tip||(this.$tip=e(this.options.template)),this.$tip}}),e.fn.popover=function(n){return this.each(function(){var r=e(this),i=r.data("popover"),s=typeof n=="object"&&n;i||r.data("popover",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.popover.Constructor=t,e.fn.popover.defaults=e.extend({},e.fn.tooltip.defaults,{placement:"right",content:"",template:'<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'})}(window.jQuery),define("Bootstrap/bootstrap-popover",function(){}),define("fiddle_backbone/app",["BrowserEngines/engines","fiddle_backbone/models/UsedFiddle","fiddle_backbone/models/MyFiddleHistory","fiddle_backbone/models/DBTypesList","fiddle_backbone/models/SchemaDef","fiddle_backbone/models/Query","fiddle_backbone/views/DBTypesList","fiddle_backbone/views/SchemaDef","fiddle_backbone/views/Query","fiddle_backbone/router","libs/renderTerminator","libs/jquery/jquery.blockUI","libs/jquery/jquery.cookie","Bootstrap/bootstrap-collapse","Bootstrap/bootstrap-tab","Bootstrap/bootstrap-dropdown","Bootstrap/bootstrap-modal","Bootstrap/bootstrap-tooltip","Bootstrap/bootstrap-popover"],function(e,t,n,r,i,s,o,u,a,f,l){var c=function(c){var h={},p=new n,d=new r,v=new i({browserEngines:e}),m=new s({schemaDef:v}),g=new o({el:$("#db_type_id")[0],collection:d}),y=new u({id:"schema_ddl",model:v,output_el:$("#output"),browser_el:$("#browser")}),b=new a({id:"sql",model:m,output_el:$("#output")});d.on("change",function(){g.render(),v.has("dbType")&&v.set("ready",v.get("dbType").id==this.getSelectedType().id)}),v.on("change",function(){this.hasChanged("ready")&&y.updateDependents(),this.hasChanged("errorMessage")&&y.renderOutput(),this.hasChanged("schema_structure")&&y.renderSchemaBrowser()}),v.on("reloaded",function(){this.set("dbType",d.getSelectedType()),y.render()}),m.on("reloaded",function(){this.set({pendingChanges:!1},{silent:!0}),b.render()}),v.on("built failed",function(){$("#buildSchema label").prop("disabled",!1),$("#buildSchema label").html($("#buildSchema label").data("originalValue")),y.renderOutput(),y.renderSchemaBrowser()}),m.on("change",function(){(this.hasChanged("sql")||this.hasChanged("statement_separator"))&&!this.hasChanged("id")&&!this.get("pendingChanges")&&this.set({pendingChanges:!0},{silent:!0})}),m.on("executed",function(){var e=$(".runQuery");e.prop("disabled",!1),e.html(e.data("originalValue")),this.set({pendingChanges:!1},{silent:!0}),b.renderOutput()}),$("#buildSchema").click(function(e){var t=$("label",this);e.preventDefault();if(t.prop("disabled"))return!1;t.data("originalValue",t.html()),t.prop("disabled",!0).text("Building Schema..."),v.build(d)});var w=function(e){var t=$(".runQuery");e.preventDefault();if(t.prop("disabled"))return!1;t.data("originalValue",t.html()),t.prop("disabled",!0).text("Executing SQL..."),b.checkForSelectedText(),m.execute()};return $(".runQuery").click(w),$(document).keyup(function(e){e.keyCode==116&&(e.preventDefault(),w(e))}),$("#runQueryOptions li a").click(function(e){e.preventDefault(),b.setOutputType(this.id),b.renderOutput()}),$("#queryPrettify").click(function(e){var t=$(this);t.attr("disabled",!0),e.preventDefault(),$.post("index.cfm/proxy/formatSQL",{sql:m.get("sql")},function(e){m.set({sql:e}),m.trigger("reloaded"),m.set({pendingChanges:!0}),t.attr("disabled",!1)})}),$(".terminator .dropdown-menu a").on("click",function(e){e.preventDefault(),l($(this).closest(".panel"),$(this).attr("href")),$(this).closest(".panel").hasClass("schema")?y.handleSchemaChange():m.set({pendingChanges:!0,statement_separator:$(this).attr("href")},{silent:!0})}),$(window).bind("beforeunload",function(){if(m.get("pendingChanges"))return"Warning! You have made changes to your query which will be lost. Continue?'"}),d.on("reset",function(){h=f.initialize(d,v,m,p,g),this.length&&!this.getSelectedType()&&this.setSelectedType(this.first().id,!0),g.render(),y.render(),b.render()}),p.on("change reset remove",function(){localStorage&&localStorage.setItem("fiddleHistory",JSON.stringify(this.toJSON()))}),$("#clear").click(function(e){e.preventDefault(),v.reset(),m.reset(),h.navigate("!"+d.getSelectedType().id,{trigger:!0})}),$("#sample").click(function(e){e.preventDefault(),h.navigate("!"+d.getSelectedType().get("sample_fragment"),{trigger:!0})}),d.on("change",function(){g.render(),m.id&&v.get("short_code").length&&v.get("dbType").id==this.getSelectedType().id?h.navigate("!"+this.getSelectedType().id+"/"+v.get("short_code")+"/"+m.id):v.get("short_code").length&&v.get("dbType").id==this.getSelectedType().id?h.navigate("!"+this.getSelectedType().id+"/"+v.get("short_code")):h.navigate("!"+this.getSelectedType().id)}),v.on("built",function(){p.insert(new t({fragment:"!"+this.get("dbType").id+"/"+this.get("short_code")})),h.navigate("!"+this.get("dbType").id+"/"+this.get("short_code"))}),m.on("executed",function(){var e=this.get("schemaDef");p.insert(new t({fragment:"!"+e.get("dbType").id+"/"+e.get("short_code")+"/"+this.id})),h.navigate("!"+e.get("dbType").id+"/"+e.get("short_code")+"/"+this.id)}),d.reset(c),{dbTypes:d,schemaDef:v,schemaDefView:y,queryView:b}};return{initialize:c}});var dateFormat=function(){var e=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,t=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,n=/[^-+\dA-Z]/g,r=function(e,t){e=String(e),t=t||2;while(e.length<t)e="0"+e;return e};return function(i,s,o){var u=dateFormat;arguments.length==1&&Object.prototype.toString.call(i)=="[object String]"&&!/\d/.test(i)&&(s=i,i=undefined),i=i?new Date(i):new Date;if(isNaN(i))throw SyntaxError("invalid date");s=String(u.masks[s]||s||u.masks["default"]),s.slice(0,4)=="UTC:"&&(s=s.slice(4),o=!0);var a=o?"getUTC":"get",f=i[a+"Date"](),l=i[a+"Day"](),c=i[a+"Month"](),h=i[a+"FullYear"](),p=i[a+"Hours"](),d=i[a+"Minutes"](),v=i[a+"Seconds"](),m=i[a+"Milliseconds"](),g=o?0:i.getTimezoneOffset(),y={d:f,dd:r(f),ddd:u.i18n.dayNames[l],dddd:u.i18n.dayNames[l+7],m:c+1,mm:r(c+1),mmm:u.i18n.monthNames[c],mmmm:u.i18n.monthNames[c+12],yy:String(h).slice(2),yyyy:h,h:p%12||12,hh:r(p%12||12),H:p,HH:r(p),M:d,MM:r(d),s:v,ss:r(v),l:r(m,3),L:r(m>99?Math.round(m/10):m),t:p<12?"a":"p",tt:p<12?"am":"pm",T:p<12?"A":"P",TT:p<12?"AM":"PM",Z:o?"UTC":(String(i).match(t)||[""]).pop().replace(n,""),o:(g>0?"-":"+")+r(Math.floor(Math.abs(g)/60)*100+Math.abs(g)%60,4),S:["th","st","nd","rd"][f%10>3?0:(f%100-f%10!=10)*f%10]};return s.replace(e,function(e){return e in y?y[e]:e.slice(1,e.length-1)})}}();dateFormat.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"},dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]},Date.prototype.format=function(e,t){return dateFormat(this,e,t)},define("DateFormat",function(e){return function(){return e.dateFormat}}(this)),define("text!DDLBuilder/templates/generic.sql",[],function(){return"CREATE TABLE {{{tablePrefix}}}{{tableName}}{{{tableSuffix}}}\n ({{#each_with_index columns}}{{#if index}}, {{/if}}{{{../fieldPrefix}}}{{name}}{{{../fieldSuffix}}} {{db_type}}{{/each_with_index}})\n{{separator}}\n \nINSERT INTO {{{tablePrefix}}}{{tableName}}{{{tableSuffix}}}\n ({{#each_with_index columns}}{{#if index}}, {{/if}}{{{../fieldPrefix}}}{{name}}{{{../fieldSuffix}}}{{/each_with_index}})\nVALUES\n {{#each_with_index data}}{{#if index}},\n {{/if}}({{#each_with_index r}}{{#if index}}, {{/if}}{{formatted_field ../..}}{{/each_with_index}}){{/each_with_index}}\n{{separator}}"}),define("text!DDLBuilder/templates/oracle.sql",[],function(){return"CREATE TABLE {{{tablePrefix}}}{{tableName}}{{{tableSuffix}}}\n ({{#each_with_index columns}}{{#if index}}, {{/if}}{{{../fieldPrefix}}}{{name}}{{{../fieldSuffix}}} {{db_type}}{{/each_with_index}})\n{{separator}}\n\nINSERT ALL {{#each_with_index data}}\n INTO {{{../tablePrefix}}}{{../tableName}}{{{../tableSuffix}}} ({{#each_with_index r}}{{#if index}}, {{/if}}{{{../../fieldPrefix}}}{{column_name_for_index ../..}}{{{../../fieldSuffix}}}{{/each_with_index}})\n VALUES ({{#each_with_index r}}{{#if index}}, {{/if}}{{formatted_field ../..}}{{/each_with_index}}){{/each_with_index}}\nSELECT * FROM dual\n{{separator}}"}),define("text!DDLBuilder/templates/sqlite.sql",[],function(){return"CREATE TABLE {{tablePrefix}}{{tableName}}{{tableSuffix}}\n ({{#each_with_index columns}}{{#if index}}, {{/if}}{{{../fieldPrefix}}}{{name}}{{{../fieldSuffix}}} {{db_type}}{{/each_with_index}})\n{{separator}}\n\n{{#each_with_index data}}\nINSERT INTO {{tablePrefix}}{{../tableName}}{{tableSuffix}}\n ({{#each_with_index ../columns}}{{#if index}}, {{/if}}{{{../../fieldPrefix}}}{{name}}{{{../../fieldSuffix}}}{{/each_with_index}})\nVALUES\n ({{#each_with_index r}}{{#if index}}, {{/if}}{{formatted_field ../..}}{{/each_with_index}})\n{{../separator}}\n\n{{/each_with_index}}"}),define("DDLBuilder/ddl_builder",["jQuery","Handlebars","DateFormat","text!./templates/generic.sql","text!./templates/oracle.sql","text!./templates/sqlite.sql","HandlebarsHelpers/each_with_index"],function(e,t,n,r,i,s){return ddl_builder=function(e){return e||(e={}),this.fieldPrefix="",this.fieldSuffix="",this.tablePrefix="",this.tableSuffix="",this.dateFormatMask="yyyy-mm-dd HH:MM:ss",this.charType="varchar",this.intType="int",this.floatType="numeric",this.dateType="datetime",this.valueSeparator="",this.column_count=0,this.definition={tableName:"Table1",columns:[],data:[]},this.ddlTemplate=r,this.compiledTemplate=t.compile(this.ddlTemplate),this.setup(e),this},ddl_builder.prototype.setup=function(e){for(var n in e)this[n]=e[n];return e.ddlTemplate&&(this.compiledTemplate=t.compile(this.ddlTemplate)),e.tableName&&(this.definition.tableName=e.tableName),this},ddl_builder.prototype.setupForDBType=function(e,t){switch(e){case"SQL Server":this.setup({statement_separator:t,fieldPrefix:"[",fieldSuffix:"]",tablePrefix:"[",tableSuffix:"]"});break;case"MySQL":this.setup({statement_separator:t,fieldPrefix:"`",fieldSuffix:"`",tablePrefix:"`",tableSuffix:"`"});break;case"PostgreSQL":this.setup({statement_separator:t,dateType:"timestamp",fieldPrefix:'"',fieldSuffix:'"'});break;case"Oracle":var n=i;this.setup({dateFormatMask:"dd-mmm-yyyy hh:MM:ss TT",statement_separator:t,ddlTemplate:n,dateType:"timestamp",charType:"varchar2",fieldPrefix:'"',fieldSuffix:'"'});break;case"SQLite":var n=s;this.setup({fieldPrefix:'"',fieldSuffix:'"',tablePrefix:'"',tableSuffix:'"',statement_separator:t,ddlTemplate:n,dateType:"DATE",charType:"TEXT",intType:"INTEGER",floatType:"REAL"})}return this},ddl_builder.prototype.populateDBTypes=function(){for(var e=0;e<this.definition.columns.length;e++)this.definition.columns[e].type=="charType"?this.definition.columns[e].db_type=this[this.definition.columns[e].type]+"("+this.definition.columns[e].length+")":this.definition.columns[e].db_type=this[this.definition.columns[e].type];this.definition.dateFormatMask=this.dateFormatMask},ddl_builder.prototype.populateWrappers=function(){this.definition.fieldPrefix=this.fieldPrefix,this.definition.fieldSuffix=this.fieldSuffix},ddl_builder.prototype.guessValueSeparator=function(t){var n=t.split("\n"),r=!1,i=0,s="";for(var o=0;o<n.length;o++)if(n[o].search(/[A-Z0-9_]/i)!=-1&&!r){var u=e.trim(n[o]).match(/([A-Z0-9_]+ ?)+([^A-Z0-9_]*)/gi);u.length==1&&(u=e.trim(n[o]).match(/([A-Z0-9_]+ ?)+?([^A-Z0-9_]*)/gi)),r=!0;for(var a=0;a<u.length;a++){var f=u[a].match(/[A-Z0-9_]+([^A-Z0-9_]*)$/i).pop();f.search(/^\s\s+$/)!=-1?f=new RegExp("\\s\\s+"):f.search(/^\t+$/)!=-1?f=new RegExp("\\t+"):f.search(/^\s+$/)!=-1?f=new RegExp("\\s+"):f=e.trim(f);if(f instanceof RegExp||f.length)if(s instanceof RegExp||!!s.length){if(s.toString()!=f.toString())return{status:!1,message:"Unable to find consistent column separator in header row"}}else s=f;else!(f instanceof RegExp)&&!(s instanceof RegExp)&&!s.length&&(s="\n")}s instanceof RegExp||s.length?i=e.trim(n[o]).split(s).length:i=1}else if(n[o].search(/[A-Z0-9_]/i)!=-1&&e.trim(n[o]).split(s).length!=i&&(s.toString()!=/\s\s+/.toString()||e.trim(n[o]).split(/\s+/).length!=i))return{status:!1,message:"Line "+o+' does not have the same number of columns as the header, based on separator "'+s+'".'};return{status:!0,separator:s,column_count:i}},ddl_builder.prototype.parse=function(t){if(!this.valueSeparator.length){var n=this.guessValueSeparator(t);if(!n.status)return"ERROR! "+n.message;this.column_count=n.column_count,this.valueSeparator=n.separator}var r=t.split("\n");for(var i=0;i<r.length;i++){var s=e.trim(r[i]).split(this.valueSeparator);if(e.trim(r[i]).length&&(s.length==this.column_count||this.valueSeparator.toString()==/\s\s+/.toString()&&(s=e.trim(r[i]).split(/\s+/)).length==this.column_count))if(!this.definition.columns.length)for(var o=0;o<s.length;o++){var u=e.trim(s[o]);u.length?this.definition.columns.push({name:u}):this.definition.columns.push(!1)}else{var a=[];for(var o=0;o<s.length;o++)if(this.definition.columns[o]!==!1){var u=e.trim(s[o]).replace(/'/g,"''");isNaN(u)||this.definition.columns[o].type=="dateType"||this.definition.columns[o].type=="charType"?this.definition.columns[o].type!="charType"&&!isNaN(Date.parse(u))?this.definition.columns[o].type="dateType":this.definition.columns[o].type="charType":this.definition.columns[o].type!="floatType"&&u%1!=0?this.definition.columns[o].type="floatType":this.definition.columns[o].type="intType";if(!this.definition.columns[o].length||u.length>this.definition.columns[o].length)this.definition.columns[o].length=u.length;a.push({v:u})}this.definition.data.push({r:a})}}return this.populateDBTypes(),this.populateWrappers(),this.render()},t.registerHelper("formatted_field",function(e){var r="",i=-1;for(var s=0;s<e.columns.length;s++){e.columns[s]&&i++;if(i==this.index){r=e.columns[s].type;break}}return!this.v.length||this.v.toUpperCase()=="NULL"?"NULL":r=="charType"?new t.SafeString("'"+this.v.replace(/'/g,"''")+"'"):r=="dateType"?new t.SafeString("'"+n(this.v,e.dateFormatMask)+"'"):this.v}),t.registerHelper("column_name_for_index",function(e){return e.columns[this.index].name}),ddl_builder.prototype.render=function(){return this.compiledTemplate(e.extend(this.definition,{separator:this.statement_separator}))},ddl_builder}),function(){function e(){function t(e){window.console&&window.console.log("ID Selector: "+e)}function n(e){var t=e+"=",n=document.cookie.split(";");for(var r=0;r<n.length;r++){var i=n[r];while(i.charAt(0)==" ")i=i.substring(1,i.length);if(i.indexOf(t)==0)return decodeURIComponent(i.substring(t.length,i.length))}return null}function k(e,t){this.grid=e,this.idx=t;var n=this.td=y.createElement("td");o=n.style,o.fontWeight="bold",o.padding="4px",o.verticalAlign="middle",o.cursor="pointer";var r=this;n.onmouseover=function(){r.onMouseOver()},n.onmouseout=function(){r.onMouseOut()},n.onclick=function(){r.onClick()};var i=u[t],s=y.createElement("img");s.src=i?"https://www.idselector.com/static/opicons/"+i.icon:"https://www.idselector.com/images/openid.ico",s.style.width="16px",s.style.height="16px",s.style.verticalAlign="middle",n.appendChild(s),n.appendChild(y.createTextNode(" ")),n.appendChild(y.createTextNode(i?i.shortname:"Other OpenID")),this.selected=!1}function L(){this.table=y.createElement("table"),this.table.style.backgroundColor="#FFF",this.table.style.width="100%",this.table.style.border="1px solid #6e91af",this.tbody=y.createElement("tbody"),this.table.appendChild(this.tbody),this.maxOffset=(Math.ceil(u.length/12)-1)*12,this.cells=[];for(var e=0;e<u.length;e++)this.cells[e]=new k(this,e);this.rows=[y.createElement("tr"),y.createElement("tr"),y.createElement("tr"),y.createElement("tr")],this.otherCell=new k(this,-1);var t=y.createElement("td");t.style.padding="4px",t.style.textAlign="right",t.style.verticalAlign="middle",t.colSpan=2,t.innerHTML='<a href="http://openid.net/" style="color:#6e91af;" target="_blank">Help</a>';var n=y.createElement("tr");n.style.borderTop="1px solid #AAA",n.appendChild(this.otherCell.td),n.appendChild(t);for(var r=0;r<4;r++)this.tbody.appendChild(this.rows[r]);this.tbody.appendChild(n),this.offset=0}function O(){var t=window.ActiveXObject?e?document.body.scrollLeft:document.documentElement.scrollLeft:window.pageXOffset,n=e?document.body.clientWidth:document.documentElement.clientWidth,r=n+t-401,i=f.offsetLeft,s=f.offsetTop;if(f.clientTop)s+=f.clientTop;else if(document.defaultView&&document.defaultView.getComputedStyle){var o=document.defaultView.getComputedStyle(f,"");s+=parseInt(o.getPropertyValue("border-top-width")),s+=parseInt(o.getPropertyValue("border-bottom-width"))}var u=f.offsetParent;while(u){i+=u.offsetLeft,s+=u.offsetTop;if(u.clientLeft)i+=u.clientLeft,s+=u.clientTop;else if(document.defaultView&&document.defaultView.getComputedStyle){var o=document.defaultView.getComputedStyle(u,"");s+=parseInt(o.getPropertyValue("border-top-width")),i+=parseInt(o.getPropertyValue("border-left-width"))}u=u.offsetParent}s+=f.offsetHeight,i=Math.max(Math.min(i,r),0);var a=v.style;a.left=i+"px",a.top=s+"px",a.display="block",a.height=b.offsetHeight+2+"px";var l=document.body.parentNode}function M(){v.style.display="none"}function _(e){if(e.isTextEdit){var t=e.createTextRange();t&&(t.move("character",e.value.length),t.select())}}function D(){f.value=="Click to Sign In"&&(f.value="http://"),_(f),O()}function B(e,t,n){if(n){var r=new Date;r.setTime(r.getTime()+n*24*60*60*1e3);var i="; expires="+r.toGMTString()}else var i="";document.cookie=e+"="+encodeURIComponent(t)+i+"; path=/"}var e=document.compatMode!="CSS1Compat",r=n("__openid_selector_openid"),i=n("__openid_selector_op_id"),s=n("__openid_selector_uname"),o,u=[{shortname:"myOpenID",url_suffix:".myopenid.com/",openid1:!0,openid2:!0,id:8,icon:"myopenid.ico",url_prefix:"http://",website:"https://www.myopenid.com/",longname:"myOpenID",usercalled:"username"},{shortname:"claimID",url_suffix:"",openid1:!0,openid2:!1,id:4,icon:"claimid.ico",url_prefix:"http://claimid.com/",website:"http://claimid.com/",longname:"claimID",usercalled:"username"},{shortname:"Clickpass",url_suffix:"",openid1:!0,openid2:!0,id:5,icon:"clickpass.ico",url_prefix:"http://clickpass.com/public/",website:"http://www.clickpass.com/",longname:"Clickpass",usercalled:"username"},{shortname:"Wordpress",url_suffix:".wordpress.com/",openid1:!0,openid2:!1,id:14,icon:"wordpress.ico",url_prefix:"http://",website:"http://www.wordpress.com/",longname:"Wordpress",usercalled:"username"},{shortname:"Blogger",url_suffix:".blogspot.com/",openid1:!0,openid2:!1,id:2,icon:"blogger.ico",url_prefix:"http://",website:"http://www.blogger.com/",longname:"Google Blogger",usercalled:"blog name"},{shortname:"Livejournal",url_suffix:".livejournal.com/",openid1:!0,openid2:!1,id:7,icon:"lj.ico",url_prefix:"http://",website:"http://www.livejournal.com/",longname:"Livejournal",usercalled:"username"},{shortname:"Technorati",url_suffix:"",openid1:!0,openid2:!1,id:10,icon:"technorati.ico",url_prefix:"http://technorati.com/people/technorati/",website:"http://www.technorati.com/",longname:"Technorati",usercalled:"username"},{shortname:"Flickr",url_suffix:"",openid1:!1,openid2:!0,id:6,icon:"flickr.ico",url_prefix:"http://www.flickr.com/photos/",website:"http://www.flickr.com/",longname:"Flickr",usercalled:"username"},{shortname:"Identity.net",url_suffix:".identity.net/",openid1:!0,openid2:!0,id:23,icon:"identity.ico",url_prefix:"http://",website:"http://identity.net/",longname:"Identity.net",usercalled:"username"},{shortname:"Google",url_suffix:"",openid1:!1,openid2:!0,id:26,icon:"google.ico",url_prefix:"",website:"https://www.google.com/accounts/o8/id",longname:"Google",usercalled:"username"},{shortname:"Yahoo!",url_suffix:"",openid1:!1,openid2:!0,id:15,icon:"yahoo.ico",url_prefix:"http://me.yahoo.com/",website:"http://yahoo.com/",longname:"Yahoo!",usercalled:"yahoo id"},{shortname:"AOL",url_suffix:"",openid1:!0,openid2:!1,id:1,icon:"aol.ico",url_prefix:"http://openid.aol.com/",website:"http://www.aol.com/",longname:"America Online/AIM",usercalled:"screenname"}],a=window.idselector_input_id?window.idselector_input_id:"openid_identifier",f=document.getElementById(a);if(f==null){t("couldn't find openid input box with id = "+a);for(H=0;!f&&H<document.forms.length;H++)f=document.forms[H].openid_identifier;for(H=0;!f&&H<document.forms.length;H++)f=document.forms[H].openid_url}if(f==null){t("couldn't find openid input box");return}var l=f.value,c=document.createElement("img");o=c.style,o.width="16px",o.height="16px",o.verticalAlign="middle",o.padding="0px",o.border="0px",o.margin="0px",o.display="inline";var h=document.createElement("div");h.innerHTML='<button type="button"></button>';var p=document.createElement("img");p.src="https://www.idselector.com/images/arrow.gif",p.style.display="inline";var d=h.firstChild;h.removeChild(d),d.id="__idselector_button",d.style.cursor="pointer",d.appendChild(c),d.appendChild(document.createTextNode(" ")),d.appendChild(p);var v=document.createElement("iframe");v.frameBorder=0,v.scrolling="no",o=v.style,o.display="none",o.position="absolute",o.width="400px",o.height="0px",o.margin="0px",o.padding="0px",o.zIndex=1e4,o.border="0px";var m=f.parentNode,g=null;window.idselector_target_id&&(g=document.getElementById(window.idselector_target_id),g||t("couldn't find element with id "+window.idselector_target_id)),g?g.insertBefore(d,g.firstChild):(m.insertBefore(d,f.nextSibling),m.insertBefore(document.createTextNode(" "),d)),document.body.appendChild(v);var y=v.contentWindow.document;y.open(),y.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>ID Selector</title><style type="text/css">html{color:#000;background:#6e91af;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:\'\';}abbr,acronym {border:0;font-variant:normal;}sup {vertical-align:text-top;}sub {vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}body {border:1px solid #6e91af;font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}table {font-size:inherit;font:100%;}pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%;}</style></head><body></body></html>'),y.close();var b=y.body,w=y.createElement("img");w.style.verticalAlign="middle",w.style.cursor="pointer",w.src="https://www.idselector.com/images/arrow_white_back.png";var E=y.createElement("img");E.style.verticalAlign="middle",E.style.cursor="pointer",E.src="https://www.idselector.com/images/arrow_white_forward.png";var S=y.createElement("div");S.style[document.all?"styleFloat":"cssFloat"]="right",S.innerHTML='<a href="https://www.myopenid.com/signup?affiliate_id=21239" style="color:#fff;" target="_blank">Get an OpenID</a>';var x=y.createElement("div");o=x.style,o.fontWeight="bold",o.color="#fff",o.padding="2px 8px 2px 8px",x.appendChild(S),x.appendChild(y.createTextNode("Sign in with OpenID using"));var T=y.createElement("span");T.appendChild(y.createTextNode("xxx:"));var N=y.createElement("input");N.type="text",N.size=20,o=N.style,o.verticalAlign="middle",o.padding="2px 2px 2px 20px",o.backgroundRepeat="no-repeat",o.backgroundPosition="2px 2px";var C=y.createElement("div");o=C.style,o.color="#fff",o.padding="2px 8px 2px 8px",o.textAlign="right",o.position="relative",C.appendChild(T),C.appendChild(y.createTextNode(" ")),C.appendChild(N),_id=k.prototype={},_id.onMouseOver=function(){this.selected||(this.td.style.backgroundColor="#eee")},_id.onMouseOut=function(){this.selected||(this.td.style.backgroundColor="")},_id.onClick=function(){this.grid.select(this),provider=u[this.idx],this.idx==-1?(f.value="http://",f.focus()):provider.openid2&&!provider.openid1?(f.focus(),setTimeout(M,1)):(N.focus(),N.select())},_id.setSelected=function(e){this.td.style.backgroundColor=e?"#c6d9e8":"",this.selected=e},_id=L.prototype={},_id.forward=function(){this.offset=Math.min(this.offset+12,this.maxOffset),this.gen()},_id.back=function(){this.offset=Math.max(this.offset-12,0),this.gen()},_id.gen=function(){for(var e=0;e<4;e++){var t=this.rows[e];while(t.firstChild)t.removeChild(t.firstChild)}for(var e=0;e<12;e++){var t=this.rows[Math.floor(e/3)],n=this.cells[this.offset+e];n?t.appendChild(n.td):t.appendChild(y.createElement("td"))}E.style.visibility=this.offset==this.maxOffset?"hidden":"",w.style.visibility=this.offset==0?"hidden":"",v.style.height=b.offsetHeight+2+"px"},_id.select=function(e){this.curr&&this.curr.setSelected(!1),this.curr=e,e.setSelected(!0);if(e.idx>-1){var t=u[e.idx];if(t.openid2&&!t.openid1)T.style.visibility="hidden",N.style.visibility="hidden",f.value=t.website;else{T.style.visibility="",N.style.visibility="",T.removeChild(T.firstChild);var n=y.createTextNode(t.longname+" "+t.usercalled+":");T.appendChild(n),N.style.backgroundImage="url(https://www.idselector.com/static/opicons/"+t.icon+")",f.value=t.url_prefix+"username"+t.url_suffix,N.value="username"}c.src="https://www.idselector.com/static/opicons/"+t.icon}else T.style.visibility="hidden",N.style.visibility="hidden",c.src="https://www.idselector.com/images/openid.ico"},_id.setName=function(e){var t=u[this.curr.idx];f.value=t.url_prefix+e+t.url_suffix};var A=new L;A.gen(),b.appendChild(x),b.appendChild(A.table),b.appendChild(C),d.onclick=function(e){return v.style.display=="none"?O():M(),e&&(e.cancelBubble=!0),!1},d.onfocus=function(){d.blur()},E.onclick=function(){A.forward()},w.onclick=function(){A.back()},f.onkeypress=function(e){var t;window.event?t=window.event.keyCode:e.which&&(t=e.which),t!=13&&t!=9&&A.select(A.otherCell)},N.onkeydown=function(e){var t;v.contentWindow.event?t=v.contentWindow.event.keyCode:e.which&&(t=e.which),(t==13||t==9)&&setTimeout(function(){f.onfocus=D,f.focus(),setTimeout(M,1)},1)},N.onkeyup=function(){var e=this.value;e||(e="username",this.value=e,this.select()),A.setName(e)},oldOnResize=window.onresize,window.onresize=function(e){try{v.style.display=="block"&&O()}finally{oldOnResize&&oldOnResize(e)}},oldOnScroll=window.onscroll,window.onscroll=function(e){try{v.style.display=="block"&&O()}finally{oldOnScroll&&oldOnScroll(e)}};if(i){var P=null;for(var H=0;H<u.length;H++)u[H].id==i&&(P=A.cells[H]);P&&(A.select(P),N.value=s)}A.curr||A.select(A.otherCell),r?f.value=r:l.length==0&&(f.value="Click to Sign In"),f.onfocus=D;var j=null;m=f.parentNode;while(m&&m.nodeType==1){if(m.nodeName=="FORM"){j=m;break}m=m.parentNode}if(j){var F=j.onsubmit;j.onsubmit=function(e){try{B("__openid_selector_openid",f.value,365);if(A.curr.idx>-1){var t=u[A.curr.idx].id;B("__openid_selector_op_id",t,365),B("__openid_selector_uname",N.value,365)}else B("__openid_selector_op_id","",-1),B("__openid_selector_uname","",-1)}finally{if(F)return F(e)}}}window.ActiveXObject?document.body.parentNode.attachEvent("onclick",function(){window.event.srcElement!=f&&window.event.srcElement!=d&&M()}):document.body.parentNode.addEventListener("click",function(e){e.target!=f&&e.target!=d&&M()},!1)}var t=window.onload;window.onload=function(n){try{e()}finally{return t&&t(n)}}}(),define("libs/idselector",function(){}),requirejs.config({paths:{jQuery:"libs/jquery/jquery",Underscore:"libs/underscore",Backbone:"libs/backbone",Bootstrap:"libs/bootstrap",Handlebars:"libs/handlebars-1.0.0.beta.6",HandlebarsHelpers:"libs/handlebarsHelpers",DateFormat:"libs/date.format",BrowserEngines:"libs/browserEngines",FiddleEditor:"libs/fiddleEditor",CodeMirror:"libs/codemirror/codemirror",MySQLCodeMirror:"libs/codemirror/mode/mysql/mysql",XPlans:"libs/xplans",DDLBuilder:"libs/ddl_builder"},shim:{Backbone:{deps:["Underscore","jQuery","libs/json2"],exports:"Backbone"},jQuery:{exports:"$"},Underscore:{exports:"_"},CodeMirror:{exports:"CodeMirror"},Handlebars:{exports:"Handlebars"},DateFormat:{exports:"dateFormat"},"XPlans/oracle/loadswf":{deps:["XPlans/oracle/flashver"],exports:"loadswf"},"XPlans/mssql":{exports:"QP"},MySQLCodeMirror:["CodeMirror"],"libs/jquery/jquery.blockUI":["jQuery"],"libs/jquery/jquery.cookie":["jQuery"],"Bootstrap/bootstrap-collapse":["jQuery"],"Bootstrap/bootstrap-tab":["jQuery"],"Bootstrap/bootstrap-dropdown":["jQuery"],"Bootstrap/bootstrap-modal":["jQuery"],"Bootstrap/bootstrap-tooltip":["jQuery"],"Bootstrap/bootstrap-popover":["jQuery","Bootstrap/bootstrap-tooltip"]}}),require(["jQuery","Underscore","dbTypes_cached","fiddle_backbone/app","DDLBuilder/ddl_builder","libs/idselector"],function(e,t,n,r,i){function u(t){e("#exit_fullscreen").css("display")=="none"?(e("body").css("overflow-y","hidden"),e(".navbar-fixed-top").css("position","fixed").css("margin",0),e("#exit_fullscreen").css("display","block"),e("#exit_fullscreen span").text("Exit Fullscreen "+t),e(".nav-collapse, .btn-navbar, #db_type_label_collapsed .navbar-text").css("display","none")):(e("body").css("overflow-y","auto"),e("body").css("height","100%"),e(".navbar-fixed-top").css("position","").css("margin",""),e("#exit_fullscreen").css("display","none"),e(".nav-collapse, .btn-navbar, #db_type_label_collapsed .navbar-text").css("display",""))}function a(){var t=e(window).height()-165;if(t>400){var n=e("#schema-output").width();e("#schema-output").height((t-10)*.7),e("#output").css("min-height",(t-10)*.3+"px"),fiddleBackbone.schemaDefView.editor.isFullscreen()?(e("#fiddleFormDDL .CodeMirror-scroll, #schema_ddl").css("height",e(window).height()+"px"),e("#fiddleFormDDL .CodeMirror-scroll .CodeMirror-gutter").height("height",e(window).height()+"px")):(e("#fiddleFormDDL .CodeMirror-scroll").css("height",e("#fiddleFormDDL").height()-(5+e("#fiddleFormDDL .action_buttons").height())+"px"),e("#schema_ddl").css("height",e("#fiddleFormDDL").height()-(15+e("#fiddleFormDDL .action_buttons").height())+"px"),e("#fiddleFormDDL .CodeMirror-scroll .CodeMirror-gutter").height(e("#fiddleFormDDL .CodeMirror-scroll").height()-2)),fiddleBackbone.queryView.editor.isFullscreen()?(e("#fiddleFormSQL .CodeMirror-scroll, #sql").css("height",e(window).height()+"px"),e("#fiddleFormSQL .CodeMirror-scroll .CodeMirror-gutter").css("height",e(window).height()+"px")):(e("#fiddleFormSQL .CodeMirror-scroll").css("height",e("#fiddleFormSQL").height()-(5+e("#fiddleFormSQL .action_buttons").height())+"px"),e("#sql").css("height",e("#fiddleFormSQL").height()-(15+e("#fiddleFormSQL .action_buttons").height())+"px"),e("#fiddleFormSQL .CodeMirror-scroll .CodeMirror-gutter").height(e("#fiddleFormSQL .CodeMirror-scroll").height()-2)),e("#browser").height(e("#fiddleFormDDL .CodeMirror-scroll").height());var r=function(t){var n={height:e(".blockMsg",t).height(),width:e(".blockMsg",t).width()},r={height:e(t).height(),width:e(t).width()};e(".blockMsg",t).css("top",(r.height-n.height)/2).css("left",(r.width-n.width)/2)};r(e("div.sql.panel")),r(e("#output")),fiddleBackbone.schemaDefView.refresh(),fiddleBackbone.queryView.refresh()}}e.blockUI.defaults.overlayCSS.cursor="auto",e.blockUI.defaults.css.cursor="auto",fiddleBackbone=r.initialize(n),e("#userInfo").on("click","#myFiddles",function(t){t.preventDefault(),e("#myFiddlesModal").modal("show"),e("#myFiddlesModal .modal-body").block({message:"Loading..."});var n=function(){var t=e(this);e(".tab-pane",this).removeClass("active"),e(e("#myFiddlesTabs li.active a").attr("href")).addClass("active"),t.unblock(),e(".preview-schema").popover({placement:"left",title:"Schema Structure",content:function(){return e(this).closest("td").find(".schemaPreviewWrapper").html()}}),e(".preview-ddl").popover({placement:"left",title:"Schema DDL",content:function(){return e(this).closest("td").find(".schemaPreviewWrapper").html()}}),e(".result-sets").popover({placement:"left",title:"Query Results",content:function(){return e(this).closest("td").find(".resultSetWrapper").html()}}),e(".preview-sql").popover({placement:"left",title:"SQL Statements",content:function(){return e(this).closest("td").find(".resultSetWrapper").html()}}),e(".showAll",this).click(function(t){t.preventDefault(),e("tr.for-schema-"+e(this).closest("tr").attr("id")).show("fast"),e(this).hide()}),e(".favorite",this).click(function(t){t.preventDefault();var r=this,i=e(this).closest("tr.queryLog");e.post("index.cfm/UserFiddles/setFavorite",{schema_def_id:e(this).attr("schema_def_id"),query_id:e(this).attr("query_id"),favorite:e(this).attr("href")=="#addFavorite"?1:0},function(){e(r).attr("href")=="#addFavorite"?e(r).attr("href","#removeFavorite").attr("title","Remove from favorites"):e(r).attr("href","#addFavorite").attr("title","Add to favorites"),e("i",r).toggleClass("icon-star-empty icon-star"),e(r).closest(".tab-pane").attr("id")=="favorites"&&e(".queryLog[schema_def_id="+e(r).attr("schema_def_id")+"][query_id="+e(r).attr("query_id")+"] a.favorite").replaceWith(r),e("#favorites").load("index.cfm/UserFiddles/getFavorites",{tz:(new Date).getTimezoneOffset()/60},n)})}),e(".forgetSchema",this).click(function(n){n.preventDefault();var r=e(this).closest("tr.schemaLog").attr("id");e.post("index.cfm/UserFiddles/forgetSchema",{schema_def_id:e(this).attr("schema_def_id")},function(){e("#"+r+",tr.for-schema-"+r,t).remove()})}),e(".forgetQuery",this).click(function(t){t.preventDefault();var n=e(this).closest("tr.queryLog");e.post("index.cfm/UserFiddles/forgetQuery",{schema_def_id:e(this).attr("schema_def_id"),query_id:e(this).attr("query_id")},function(){n.remove()})}),e(".forgetOtherQueries",this).click(function(t){t.preventDefault();var n=e(this).closest("tbody").find('tr.queryLog[schema_def_id="'+e(this).attr("schema_def_id")+'"][query_id!="'+e(this).attr("query_id")+'"]');e.post("index.cfm/UserFiddles/forgetOtherQueries",{schema_def_id:e(this).attr("schema_def_id"),query_id:e(this).attr("query_id")},function(){n.remove()})})};e("#myFiddlesModal .modal-body").load("index.cfm/UserFiddles",{tz:(new Date).getTimezoneOffset()/60},n)}),e("#myFiddlesTabs a").on("click",function(t){t.preventDefault(),e(this).tab("show")}),e("#myFiddlesModal .modal-body").on("click","a",function(t){e(this).hasClass("favorite")||e("#myFiddlesModal").modal("hide")}),e("#myFiddlesModal").on("hidden",function(){e(".popover-anchor",this).popover("hide")});if(e("#user_choices",this).length){var s=[];try{fullHistory=e.parseJSON(localStorage.getItem("fiddleHistory")),fullHistory.length&&(s=t.map(fullHistory,function(e,t){return[e.fragment,dateFormat(e.last_used,"mm/dd/yyyy HH:MM:ss")]}),e.post("index.cfm/UserFiddles/loadFromLocalStorage",{localHistory:JSON.stringify(s)},function(n){var r=e.parseJSON(n);fullHistory=t.reject(fullHistory,function(e){return t.find(r,function(t){return t[0]==e.fragment})}),localStorage.setItem("fiddleHistory",JSON.stringify(fullHistory))}))}catch(o){}}e("#loginModal form").submit(function(){e("#hash",this).val(window.location.hash)}),e("#loginModal").on("hidden",function(){e("iframe").css("display","none")}),e("#userInfo").on("click","#logout",function(t){t.preventDefault(),e("<form>",{action:e(this).attr("href"),method:"GET"}).append(e("<input>",{type:"hidden",name:"hash",value:window.location.hash})).submit()}),e("#textToDDLModal .btn").click(function(t){t.preventDefault();var n=(new i({tableName:e("#tableName").val()})).setupForDBType(fiddleBackbone.dbTypes.getSelectedType().get("simple_name"),fiddleBackbone.schemaDef.get("statement_separator")),r=n.parse(e("#raw").val());e("#parseResults").text(r),e(this).attr("id")=="appendDDL"&&(fiddleBackbone.schemaDef.set("ddl",fiddleBackbone.schemaDef.get("ddl")+"\n\n"+r),fiddleBackbone.schemaDef.trigger("reloaded"),e("#textToDDLModal").modal("hide"))}),e("#exit_fullscreen").on("click",function(e){e.preventDefault(),fiddleBackbone.schemaDefView.editor.setFullscreen(!1),fiddleBackbone.queryView.editor.setFullscreen(!1),u(""),a()}),e("#schemaFullscreen").on("click",function(e){e.preventDefault(),fiddleBackbone.schemaDefView.editor.setFullscreen(!0),u("Schema Editor")}),e("#queryFullscreen").on("click",function(e){e.preventDefault(),fiddleBackbone.queryView.editor.setFullscreen(!0),u("Query Editor")}),e("#schemaBrowser").on("click",function(t){t.preventDefault(),e(this).attr("disabled")||(e("#fiddleFormDDL .CodeMirror, .ddl_actions").css("display","none"),e("#browser, .browser_actions").css("display","block"))}),e("#browser").on("click",".tables a",function(t){t.preventDefault(),e("i",this).toggleClass("icon-minus icon-plus"),e(this).siblings(".columns").toggle()}),e("#ddlEdit").on("click",function(t){t.preventDefault(),e("#fiddleFormDDL .CodeMirror, .ddl_actions").css("display","block"),e("#browser, .browser_actions").css("display","none")}),e(window).bind("resize",a),setTimeout(a,1),e(".nav").on("click","a",function(t){e(".nav-collapse.in").collapse("hide")})}),define("main",function(){})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/qunit_main.js b/src/main/webapp/javascripts_min/qunit_main.js new file mode 100644 index 0000000..c592c86 --- /dev/null +++ b/src/main/webapp/javascripts_min/qunit_main.js @@ -0,0 +1 @@ +requirejs.config({paths:{jQuery:"libs/jquery/jquery",Underscore:"libs/underscore",Backbone:"libs/backbone",Bootstrap:"libs/bootstrap",Handlebars:"libs/handlebars-1.0.0.beta.6",HandlebarsHelpers:"libs/handlebarsHelpers",DateFormat:"libs/date.format",BrowserEngines:"libs/browserEngines",FiddleEditor:"libs/fiddleEditor",CodeMirror:"libs/codemirror/codemirror",MySQLCodeMirror:"libs/codemirror/mode/mysql/mysql",XPlans:"libs/xplans",DDLBuilder:"libs/ddl_builder",QUnit:"libs/qunit-1.10.0"},shim:{Backbone:{deps:["Underscore","jQuery","libs/json2"],exports:"Backbone"},jQuery:{exports:"$"},Underscore:{exports:"_"},CodeMirror:{exports:"CodeMirror"},Handlebars:{exports:"Handlebars"},DateFormat:{exports:"dateFormat"},"XPlans/oracle/loadswf":{deps:["XPlans/oracle/flashver"],exports:"loadswf"},"XPlans/mssql":{exports:"QP"},QUnit:{exports:function(){return{test:test,equal:equal,ok:ok}}},MySQLCodeMirror:["CodeMirror"],"libs/jquery/jquery.blockUI":["jQuery"],"libs/jquery/jquery.cookie":["jQuery"],"Bootstrap/bootstrap-collapse":["jQuery"],"Bootstrap/bootstrap-tab":["jQuery"],"Bootstrap/bootstrap-dropdown":["jQuery"],"Bootstrap/bootstrap-modal":["jQuery"],"Bootstrap/bootstrap-tooltip":["jQuery"],"Bootstrap/bootstrap-popover":["jQuery","Bootstrap/bootstrap-tooltip"]}}),require(["libs/ddl_builder/qunit/main"],function(){})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_min/text.js b/src/main/webapp/javascripts_min/text.js new file mode 100644 index 0000000..fc407f2 --- /dev/null +++ b/src/main/webapp/javascripts_min/text.js @@ -0,0 +1,7 @@ +/** + * @license RequireJS text 2.0.3 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/requirejs/text for details + */ + +define(["module"],function(e){var t,n,r=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],i=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,s=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,o=typeof location!="undefined"&&location.href,u=o&&location.protocol&&location.protocol.replace(/\:/,""),a=o&&location.hostname,f=o&&(location.port||undefined),l=[],c=e.config&&e.config()||{};t={version:"2.0.3",strip:function(e){if(e){e=e.replace(i,"");var t=e.match(s);t&&(e=t[1])}else e="";return e},jsEscape:function(e){return e.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:c.createXhr||function(){var e,t,n;if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;if(typeof ActiveXObject!="undefined")for(t=0;t<3;t+=1){n=r[t];try{e=new ActiveXObject(n)}catch(i){}if(e){r=[n];break}}return e},parseName:function(e){var t=!1,n=e.indexOf("."),r=e.substring(0,n),i=e.substring(n+1,e.length);return n=i.indexOf("!"),n!==-1&&(t=i.substring(n+1,i.length),t=t==="strip",i=i.substring(0,n)),{moduleName:r,ext:i,strip:t}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(e,n,r,i){var s,o,u,a=t.xdRegExp.exec(e);return a?(s=a[2],o=a[3],o=o.split(":"),u=o[1],o=o[0],(!s||s===n)&&(!o||o.toLowerCase()===r.toLowerCase())&&(!u&&!o||u===i)):!0},finishLoad:function(e,n,r,i){r=n?t.strip(r):r,c.isBuild&&(l[e]=r),i(r)},load:function(e,n,r,i){if(i.isBuild&&!i.inlineText){r();return}c.isBuild=i.isBuild;var s=t.parseName(e),l=s.moduleName+"."+s.ext,h=n.toUrl(l),p=c.useXhr||t.useXhr;!o||p(h,u,a,f)?t.get(h,function(n){t.finishLoad(e,s.strip,n,r)},function(e){r.error&&r.error(e)}):n([l],function(e){t.finishLoad(s.moduleName+"."+s.ext,s.strip,e,r)})},write:function(e,n,r,i){if(l.hasOwnProperty(n)){var s=t.jsEscape(l[n]);r.asModule(e+"!"+n,"define(function () { return '"+s+"';});\n")}},writeFile:function(e,n,r,i,s){var o=t.parseName(n),u=o.moduleName+"."+o.ext,a=r.toUrl(o.moduleName+"."+o.ext)+".js";t.load(u,r,function(n){var r=function(e){return i(a,e)};r.asModule=function(e,t){return i.asModule(e,a,t)},t.write(e,u,r,s)},s)}};if(c.env==="node"||!c.env&&typeof process!="undefined"&&process.versions&&!!process.versions.node)n=require.nodeRequire("fs"),t.get=function(e,t){var r=n.readFileSync(e,"utf8");r.indexOf("")===0&&(r=r.substring(1)),t(r)};else if(c.env==="xhr"||!c.env&&t.createXhr())t.get=function(e,n,r){var i=t.createXhr();i.open("GET",e,!0),c.onXhr&&c.onXhr(i,e),i.onreadystatechange=function(t){var s,o;i.readyState===4&&(s=i.status,s>399&&s<600?(o=new Error(e+" HTTP status: "+s),o.xhr=i,r(o)):n(i.responseText))},i.send(null)};else if(c.env==="rhino"||!c.env&&typeof Packages!="undefined"&&typeof java!="undefined")t.get=function(e,t){var n,r,i="utf-8",s=new java.io.File(e),o=java.lang.System.getProperty("line.separator"),u=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(s),i)),a="";try{n=new java.lang.StringBuffer,r=u.readLine(),r&&r.length()&&r.charAt(0)===65279&&(r=r.substring(1)),n.append(r);while((r=u.readLine())!==null)n.append(o),n.append(r);a=String(n.toString())}finally{u.close()}t(a)};return t})
\ No newline at end of file diff --git a/src/main/webapp/javascripts_static/sql.js b/src/main/webapp/javascripts_static/sql.js new file mode 100644 index 0000000..bdd80ea --- /dev/null +++ b/src/main/webapp/javascripts_static/sql.js @@ -0,0 +1 @@ +function ca(b){throw b}var fa=void 0,la=null;function sa(){return(function(){})}function ya(b){return(function(){return b})}try{this.Module=Module}catch(Ma){this.Module=Module={}}var ab=typeof process==="object",hb=typeof window==="object",lb=typeof importScripts==="function",vb=!hb&&!ab&&!lb;if(ab){Module.print=(function(b){process.stdout.write(b+"\n")});Module.printErr=(function(b){process.stderr.write(b+"\n")});var Ib=require("fs"),cc=require("path");Module.read=(function(b){var b=cc.normalize(b),c=Ib.readFileSync(b).toString();!c&&b!=cc.resolve(b)&&(b=path.join(__dirname,"..","src",b),c=Ib.readFileSync(b).toString());return c});Module.load=(function(b){fc(read(b))});Module.arguments||(Module.arguments=process.argv.slice(2))}else{vb?(Module.print=print,Module.printErr=printErr,Module.read=typeof read!="undefined"?read:(function(b){snarf(b)}),Module.arguments||(typeof scriptArgs!="undefined"?Module.arguments=scriptArgs:typeof arguments!="undefined"&&(Module.arguments=arguments))):hb?(Module.print||(Module.print=(function(b){console.log(b)})),Module.printErr||(Module.printErr=(function(b){console.log(b)})),Module.read=(function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(la);return c.responseText}),Module.arguments||typeof arguments!="undefined"&&(Module.arguments=arguments)):lb?Module.load=importScripts:ca("Unknown runtime environment. Where are we?")}function fc(b){eval.call(la,b)}!Module.load=="undefined"&&Module.read&&(Module.load=(function(b){fc(Module.read(b))}));Module.printErr||(Module.printErr=sa());Module.print||(Module.print=Module.printErr);Module.arguments||(Module.arguments=[]);Module.print=Module.print;Module.Pr=Module.printErr;var ic={i1:0,i8:0,i16:0,i32:0,i64:0},lc={"float":0,"double":0};function nc(b,c,d,e){var f=Math.pow(2,e)-1;if(e<32){switch(d){case"shl":return[b<<e,c<<e|(b&f<<32-e)>>>32-e];case"ashr":return[(b>>>e|(c&f)<<32-e)>>0>>>0,c>>e>>>0];case"lshr":return[(b>>>e|(c&f)<<32-e)>>>0,c>>>e]}}else{if(e==32){switch(d){case"shl":return[0,b];case"ashr":return[c,(c|0)<0?f:0];case"lshr":return[c,0]}}else{switch(d){case"shl":return[0,b<<e-32];case"ashr":return[c>>e-32>>>0,(c|0)<0?f:0];case"lshr":return[c>>>e-32,0]}}}oc("unknown bitshift64 op: "+[value,d,e])}function sc(b){if(wc==1){return 1}var c={"%i1":1,"%i8":1,"%i16":2,"%i32":4,"%i64":8,"%float":4,"%double":8}["%"+b];c||(b[b.length-1]=="*"?c=wc:b[0]=="i"&&(b=parseInt(b.substr(1)),yc(b%8==0),c=b/8));return c}function Cc(b){var c={};b.filter((function(b){return c[b]?!1:c[b]=!0}))}function Dc(){var b,c,d;c=b=0;var e=[],f=-1;d=["i32","i32"].map((function(d){var h,i;d in ic||d in lc||d[d.length-1]=="*"?i=h=sc(d):(isPointerType(d)?0:/^\[\d+\ x\ (.*)\]/.test(d)||/<?{ ?[^}]* ?}>?/.test(d)||d[0]=="%")?(h=Types.types[d].Nr,i=Types.types[d].Mr):ca("Unclear type in struct: "+d+", in undefined :: "+dump(Types.types[fa]));i=Math.min(i,wc);c=Math.max(c,i);d=Ec(b,i);b=d+h;f>=0&&e.push(d-f);return f=d}));b=Ec(b,c);e.length==0||Cc(e);return d}function Ic(b){var c=a;a+=b;a=a+3>>2<<2;return c}function Nc(b){var c=Pc;Pc+=b;Pc=Pc+3>>2<<2;if(Pc>=Sc){for(;Sc<=Pc;){Sc=2*Sc+4095>>12<<12}var b=l,d=new ArrayBuffer(Sc);l=new Int8Array(d);n=new Int16Array(d);p=new Int32Array(d);t=new Uint8Array(d);Vc=new Uint16Array(d);y=new Uint32Array(d);Wc=new Float32Array(d);Xc=new Float64Array(d);l.set(b)}return c}function Ec(b,c){return Math.ceil(b/(c?c:4))*(c?c:4)}var wc=4,ad={},z,B;function oc(b){Module.print(b+":\n"+Error().stack);ca("Assertion: "+b)}function yc(b,c){b||oc("Assertion failed: "+c)}var dd=this;function gd(b,c,d,e){var f=0;try{var g=eval("_"+b)}catch(h){try{g=dd.Module["_"+b]}catch(i){}}yc(g,"Cannot call unknown function "+b+" (perhaps LLVM optimizations or closure removed it?)");var j=0,b=e?e.map((function(b){var c=d[j++];c=="string"?(f||(f=a),c=Ic(b.length+1),kd(b,c),b=c):c=="array"&&(f||(f=a),c=Ic(b.length),ld(b,c),b=c);return b})):[],c=(function(b,c){if(c=="string"){return pd(b)}yc(c!="array");return b})(g.apply(la,b),c);f&&(a=f);return c}Module.ccall=gd;Module.cwrap=(function(b,c,d){return(function(){return gd(b,c,d,Array.prototype.slice.call(arguments))})});function rd(b,c,d){d=d||"i8";d[d.length-1]==="*"&&(d="i32");switch(d){case"i1":l[b]=c;break;case"i8":l[b]=c;break;case"i16":n[b>>1]=c;break;case"i32":p[b>>2]=c;break;case"i64":p[b>>2]=c;break;case"float":Wc[b>>2]=c;break;case"double":xd[0]=c;p[b>>2]=C[0];p[b+4>>2]=C[1];break;default:oc("invalid type for setValue: "+d)}}Module.setValue=rd;function yd(b,c){c=c||"i8";c[c.length-1]==="*"&&(c="i32");switch(c){case"i1":return l[b];case"i8":return l[b];case"i16":return n[b>>1];case"i32":return p[b>>2];case"i64":return p[b>>2];case"float":return Wc[b>>2];case"double":return C[0]=p[b>>2],C[1]=p[b+4>>2],xd[0];default:oc("invalid type for setValue: "+c)}return la}Module.getValue=yd;var Bd=0,F=2;Module.ALLOC_NORMAL=Bd;Module.ALLOC_STACK=1;Module.ALLOC_STATIC=F;function G(b,c,d){var e,f;typeof b==="number"?(e=!0,f=b):(e=!1,f=b.length);var g=typeof c==="string"?c:la,d=[Dd,Ic,Nc][d===fa?F:d](Math.max(f,g?1:c.length));if(e){return Ed(d,0,f),d}e=0;for(var h;e<f;){var i=b[e];typeof i==="function"&&(i=ad.Or(i));h=g||c[e];h===0?e++:(h=="i64"&&(h="i32"),rd(d+e,i,h),e+=sc(h))}return d}Module.allocate=G;function pd(b,c){for(var d=typeof c=="undefined",e="",f=0,g,h=String.fromCharCode(0);;){g=String.fromCharCode(t[b+f]);if(d&&g==h){break}e+=g;f+=1;if(!d&&f==c){break}}return e}Module.Pointer_stringify=pd;Module.Array_stringify=(function(b){for(var c="",d=0;d<b.length;d++){c+=String.fromCharCode(b[d])}return c});var Gd,Hd=4096,l,t,n,Vc,p,y,Wc,Xc,a,Ld,Pc,Nd=Module.TOTAL_STACK||5242880,Sc=Module.TOTAL_MEMORY||10485760;yc(!!Int32Array&&!!Float64Array&&!!(new Int32Array(1)).subarray&&!!(new Int32Array(1)).set,"Cannot fallback to non-typed array case: Code is too specialized");var Od=new ArrayBuffer(Sc);l=new Int8Array(Od);n=new Int16Array(Od);p=new Int32Array(Od);t=new Uint8Array(Od);Vc=new Uint16Array(Od);y=new Uint32Array(Od);Wc=new Float32Array(Od);Xc=new Float64Array(Od);p[0]=255;yc(t[0]===255&&t[3]===0,"Typed arrays 2 must be run on a little-endian system");var Rd=Pd("(null)");Pc=Rd.length;for(var Td=0;Td<Rd.length;Td++){l[Td]=Rd[Td]}Module.HEAP=fa;Module.HEAP8=l;Module.HEAP16=n;Module.HEAP32=p;Module.HEAPU8=t;Module.HEAPU16=Vc;Module.HEAPU32=y;Module.HEAPF32=Wc;Module.HEAPF64=Xc;Ld=(a=Ec(Pc))+Nd;var Wd=Ec(Ld,8);l.subarray(Wd);var C=p.subarray(Wd>>2);Wc.subarray(Wd>>2);var xd=Xc.subarray(Wd>>3);Ld=Wd+8;Pc=Ld+4095>>12<<12;function ae(b){for(;b.length>0;){var c=b.shift(),d=c.Ma;typeof d==="number"&&(d=Gd[d]);d(c.sr===fa?la:c.sr)}}var ee=[],fe=[],ne=[];function pe(b,c){return Array.prototype.slice.call(l.subarray(b,b+c))}Module.Array_copy=pe;Module.TypedArray_copy=(function(b,c,d){d===fa&&(d=0);for(var e=new Uint8Array(c-d),f=d;f<c;++f){e[f-d]=l[b+f]}return e.buffer});function qe(b){for(var c=0;l[b+c];){c++}return c}Module.String_len=qe;Module.String_copy=(function(b,c){var d=qe(b);c&&d++;var e=pe(b,d);c&&(e[d-1]=0);return e});function Pd(b,c,d){var e=[],f=0;if(d===fa){d=b.length}for(;f<d;){var g=b.charCodeAt(f);g>255&&(g&=255);e.push(g);f+=1}c||e.push(0);return e}Module.intArrayFromString=Pd;function re(b){for(var c=[],d=0;d<b.length;d++){var e=b[d];e>255&&(e&=255);c.push(String.fromCharCode(e))}return c.join("")}Module.intArrayToString=re;function kd(b,c,d){for(var e=0;e<b.length;){var f=b.charCodeAt(e);f>255&&(f&=255);l[c+e]=f;e+=1}d||(l[c+e]=0)}Module.writeStringToMemory=kd;function ld(b,c){for(var d=0;d<b.length;d++){l[c+d]=b[d]}}Module.writeArrayToMemory=ld;var R=[],se=0;function te(b,c,d){for(;;){var e=d-1|0;if((d|0)<=0){break}d=t[b];if(d<<24>>24==0){break}if(l[R.i+(d&255)|0]<<24>>24!=l[R.i+(t[c]&255)|0]<<24>>24){break}c=c+1|0;b=b+1|0;d=e}return(e|0)<0?0:(t[R.i+(t[b]&255)|0]&255)-(t[R.i+(t[c]&255)|0]&255)|0}function ve(b){if((b|0)==0){b=0}else{var c=l[b]<<24>>24==0;a:do{if(c){var d=b}else{for(var e=b;;){if(e=e+1|0,l[e]<<24>>24==0){d=e;break a}}}}while(0);b=d-b&1073741823}return b}function ze(b){return b>>>0<4?p[Be+(b<<2)>>2]:0}function Ce(b){var c=b+4|0,d=p[c>>2],e=(d|0)>0;a:do{if(e){for(var f=b+8|0,g=0,h=d;;){var i=p[p[f>>2]+(g<<4)+4>>2];(i|0)!=0&&(p[(p[i+4>>2]+4|0)>>2]=p[i>>2],h=p[c>>2]);g=g+1|0;if((g|0)>=(h|0)){break a}}}}while(0)}function De(b){var c=(b|0)==0;do{if(!c){var d=p[Je>>2];if((d|0)==(b|0)){p[Je>>2]=p[b+12>>2]}else{if((d|0)!=0){for(;;){var e=d+12|0,f=p[e>>2];if(!((f|0)!=(b|0)&(f|0)!=0)){break}d=f}(f|0)==(b|0)&&(p[e>>2]=p[b+12>>2])}}}}while(0)}function Ke(b){for(var b=(te(b,R.Uc|0,7)|0)==0?b+7|0:b,c=ve(b),d=0;;){if((d|0)>=4){var e=0;break}var f=p[Be+(d<<2)>>2];if((te(b,f,c)|0)==0&&(f=l[f+c|0],f<<24>>24==0||f<<24>>24==61)){e=1;break}d=d+1|0}return e}function Le(b,c,d,e){if(b>>>0>9){Qe(13333),d=21}else{var f=y[Ve+(b<<2)>>2];p[c>>2]=f;b=(b<<2)+We|0;p[d>>2]=p[b>>2];(e|0)!=0&&(p[b>>2]=f);d=0}return d}function Qe(b){var c=a;cf(21,R.xf|0,(z=a,a+=8,p[z>>2]=b,p[z+4>>2]=R.Y+20|0,z));a=c}function df(b,c,d,e,f){var g;e>>=2;var h=d>>2,i=a;a+=12;var d=i>>2,j=i+4,k=i+8;do{if((c|0)==0){var m=b+236|0;p[h]=p[m>>2];var o=b+240|0;p[e]=p[o>>2];(f|0)!=0&&(p[o>>2]=p[m>>2]);m=0}else{if((c|0)==4||(c|0)==5||(c|0)==6){p[h]=0,m=(c-4<<2)+b+244|0,p[e]=p[m>>2],(f|0)!=0&&(p[m>>2]=0),m=0}else{if((c|0)==1){Ce(b);var m=b+4|0,o=p[m>>2],r=(o|0)>0;a:do{if(r){var q=b+8|0,s=0,u=0;for(g=o;;){var w=p[p[q>>2]+(u<<4)+4>>2];if((w|0)!=0){w=p[p[w+4>>2]>>2];g=w+128|0;var v=p[g>>2]+(Vc[w+116>>1]&65535)+60|0,v=((p[p[w+176>>2]+40>>2]|0)==0?0:Gd[p[of+120>>2]](p[p[w+176>>2]+40>>2]))*v|0,w=pf(w),s=(v+w+p[g>>2]|0)+s|0;g=p[m>>2]}u=u+1|0;if((u|0)>=(g|0)){var x=s;break a}}}else{x=0}}while(0);p[h]=x;m=p[e]=0}else{if((c|0)==2){p[d]=0;Ce(b);m=b+500|0;p[m>>2]=i;o=b+4|0;r=p[o>>2];q=(r|0)>0;a:do{if(q){s=b+8|0;u=0;for(w=r;;){v=p[p[s>>2]+(u<<4)+12>>2];g=v>>2;if((v|0)==0){g=w}else{w=Gd[p[of+44>>2]](20);p[d]=(p[g+11]+p[g+3]+p[g+7]+p[g+15])*w+p[d]|0;w=pf(p[g+5]);p[d]=p[d]+w|0;w=pf(p[g+13]);p[d]=p[d]+w|0;w=pf(p[g+9]);p[d]=p[d]+w|0;w=pf(p[g+17]);p[d]=p[d]+w|0;w=p[g+12];v=(w|0)==0;b:do{if(!v){for(var A=w;;){if(qf(b,p[A+8>>2]),A=p[A>>2],(A|0)==0){break b}}}}while(0);g=p[g+4];w=(g|0)==0;b:do{if(!w){for(v=g;;){if(rf(b,p[v+8>>2]),v=p[v>>2],(v|0)==0){break b}}}}while(0);g=p[o>>2]}u=u+1|0;if((u|0)>=(g|0)){break a}w=g}}}while(0);p[m>>2]=0;p[e]=0;p[h]=p[d];m=0}else{if((c|0)==3){p[j>>2]=0;m=b+500|0;p[m>>2]=j;o=p[b+136>>2];if((o|0)==0){o=0}else{for(;;){if(tf(b,o),o=p[o+64>>2],(o|0)==0){break}}o=p[j>>2]}p[m>>2]=0;p[e]=0;p[h]=o;m=0}else{if((c|0)==7||(c|0)==8){p[k>>2]=0;m=b+4|0;q=p[m>>2];if((q|0)>0){o=b+8|0;for(r=0;;){if(s=p[p[o>>2]+(r<<4)+4>>2],(s|0)!=0&&(s=p[p[s+4>>2]>>2],q=f,s=(c|0)==7?s+160|0:s+164|0,p[k>>2]=p[k>>2]+p[s>>2]|0,(q|0)!=0&&(p[s>>2]=0),q=p[m>>2]),r=r+1|0,(r|0)>=(q|0)){break}}m=p[k>>2]}else{m=0}p[e]=0;p[h]=m;m=0}else{m=1}}}}}}}while(0);a=i;return m}df.X=1;function pf(b){return Gd[p[of+40>>2]](b)}function qf(b,c){var d=c>>2;(c|0)!=0&&(uf(b,p[d+7]),vf(b,p[d]),vf(b,p[d+1]),Df(b,p[d+3]),Ef(b,p[d+4]),vf(b,c))}function rf(b,c){var d,e=c>>2,f,g=(c|0)==0;do{if(!g){var h=(b|0)!=0;f=h?(p[b+500>>2]|0)==0?4:5:4;if(f==4){f=c+32|0;var i=n[f>>1]-1&65535;n[f>>1]=i;if(i<<16>>16!=0){break}}f=p[e+4];i=(f|0)==0;a:do{if(!i){var j=b+500|0;if(h){var k=f;for(d=k>>2;;){var m=p[d+8];if((p[j>>2]|0)==0){var o=p[d];Ff(p[d+9]+24|0,o,ve(o),0)}Gf(b,k);if((m|0)==0){break a}k=m;d=k>>2}}else{j=f;for(d=j>>2;;){k=p[d+8];m=p[d];Ff(p[d+9]+24|0,m,ve(m),0);Gf(0,j);if((k|0)==0){break a}j=k;d=j>>2}}}}while(0);Hf(b,c);Rf(b,c);vf(b,p[e]);vf(b,p[e+10]);Zf(b,p[e+7]);Df(b,p[e+11]);h=b;d=c;((h|0)==0?3:(p[h+500>>2]|0)==0?3:4)==3&&$f(0,d);f=d+60|0;i=p[f>>2];if((i|0)!=0){d=d+56|0;j=(p[d>>2]|0)>0;a:do{if(j){k=0;for(m=i;;){if(vf(h,p[m+(k<<2)>>2]),k=k+1|0,m=p[f>>2],(k|0)>=(p[d>>2]|0)){var r=m;break a}}}else{r=i}}while(0);vf(h,r)}vf(b,c)}}while(0)}rf.X=1;function tf(b,c){var d;ag(p[c+72>>2],n[c+80>>1]<<16>>16);var e=c+16|0;ag(p[e>>2],(Vc[c+48>>1]&65535)<<1);var f=p[c+184>>2],g=(f|0)==0;a:do{if(!g){var h=f;for(d=h>>2;;){var i=p[d+6];bg(b,p[d],p[d+1]);vf(b,h);if((i|0)==0){break a}h=i;d=h>>2}}}while(0);d=n[c+82>>1];f=d<<16>>16>0;a:do{if(f){g=c+76|0;for(h=d<<16>>16;;){if(h=h-1|0,vf(b,p[p[g>>2]+(h<<2)>>2]),(h|0)<=0){break a}}}}while(0);bg(b,p[c+4>>2],p[c+28>>2]);vf(b,p[c+44>>2]);vf(b,p[e>>2]);vf(b,p[c+160>>2]);vf(b,p[c+164>>2]);vf(b,c)}tf.X=1;function ng(b){var c=(og()|0)==0;a:do{if(c){if((b|0)==0){var d=p[Je>>2]}else{for(var e=Je;;){e=p[e>>2];if((e|0)==0){d=0;break a}if((pg(b,p[e+16>>2])|0)==0){d=e;break a}e=e+12|0}}}else{d=0}}while(0);return d}function og(){var b,c=(p[of+196>>2]|0)==0;do{if(c){p[of+204>>2]=1;if((p[of+208>>2]|0)==0&&(b=qg(),(b|0)!=0)){break}p[of+208>>2]=1;(p[of+216>>2]|0)==0&&(p[of+216>>2]=8);var d=p[of+220>>2]+1|0;p[of+220>>2]=d;if((p[of+200>>2]|p[of+196>>2]|0)==0){p[of+200>>2]=1;b=rg>>2;for(d=b+23;b<d;b++){p[b]=0}for(b=0;;){if(yg(rg,Ag+b*36|0),b=b+1|0,(b|0)==52){break}}yg(rg,Bg|0);yg(rg,Bg+36|0);yg(rg,Bg+72|0);yg(rg,Bg+108|0);yg(rg,Bg+144|0);yg(rg,Bg+180|0);yg(rg,Bg+216|0);yg(rg,Bg+252|0);yg(rg,Ig|0);yg(rg,Ig+36|0);yg(rg,Ig+72|0);if((p[of+212>>2]|0)==0){if(b=p[of+104>>2],(b|0)==0&&(Jg(),b=p[of+104>>2]),b=Gd[b](p[of+100>>2]),(b|0)==0){b=9}else{var e=b;b=11}}else{b=9}if(b==9&&(p[of+212>>2]=1,e=Kg(10),(e|0)==0?e=7:(Lg(e),Mg(Ng|0,1),Mg(Ng+88|0,0),Mg(Ng+176|0,0),Mg(Ng+264|0,0),e=0),(e|0)==0)){e=p[of+176>>2];b=p[of+180>>2];var d=p[of+184>>2],f=fa;if((p[Og+28>>2]|0)!=0){b&=-8;p[Og+32>>2]=b;p[Og+56>>2]=d;p[Og+36>>2]=d;if((d|0)>90){p[Og+40>>2]=10,p[Og+44>>2]=e,p[Og+60>>2]=0,p[Og+64>>2]=0,f=5}else{if(p[Og+40>>2]=((d|0)/10&-1)+1|0,p[Og+44>>2]=e,p[Og+60>>2]=0,p[Og+64>>2]=0,(d|0)==0){var g=e,f=8}else{f=5}}if(f==5){for(var g=b*d|0,h=d,d=e,f=0;;){var h=h-1|0,i=d;p[d>>2]=f;p[Og+60>>2]=i;if((h|0)==0){break}d=d+b|0;f=i}g=e+g|0}p[Og+48>>2]=g}p[of+196>>2]=1;e=0}p[of+200>>2]=0;b=e;d=p[of+220>>2]}else{b=0}d=d-1|0;p[of+220>>2]=d;(d|0)<1&&(p[of+216>>2]=0)}else{b=0}}while(0);return b}og.X=1;function Mg(b,c){var d=og();(d|0)==0&&(De(b),d=p[Je>>2],(c|0)!=0|(d|0)==0?(p[b+12>>2]=d,p[Je>>2]=b):(p[b+12>>2]=p[d+12>>2],p[(p[Je>>2]+12|0)>>2]=b),d=0);return d}function Pg(b,c,d){p[Qg+12>>2]=b;p[Qg+16>>2]=0;b=Qg+4|0;p[b>>2]=c;p[b+4>>2]=d;if((d|0)>0||(d|0)==0&&c>>>0>0){var b=p[Ve>>2],e=(b|0)<0?-1:0,c=(e|0)>=(d|0)&&((e|0)>(d|0)||b>>>0>=c>>>0)}else{c=0}p[Qg+32>>2]=c&1}function Rg(b,c){var d=(b<<2)+Ve|0,e=p[d>>2]+c|0;p[d>>2]=e;d=(b<<2)+We|0;(e|0)>(p[d>>2]|0)&&(p[d>>2]=e)}function Zg(b,c,d,e){var f=b>>2;p[f+1]=c;p[f+2]=c;p[f]=0;p[f+3]=0;p[f+4]=d;p[f+5]=e;l[b+25|0]=1;l[b+26|0]=0;l[b+24|0]=0}function $g(b,c){if((og()|0)==0){var d=Qg+4|0,e=p[d>>2],d=p[d+4>>2];(c|0)<0||(c|0)==0&&b>>>0<0||((c|0)>0||(c|0)==0&&b>>>0>0?Pg(2,b,c):Pg(0,0,0),ah())}else{e=d=-1}return[e,d]}function ah(){var b=a;a+=8;Le(0,b,b+4,0);var c=p[b>>2];a=b;return[c,(c|0)<0?-1:0]}function Kg(b){return(og()|0)==0?bh(b):0}function bh(b){var c,d=a;a+=4;c=d>>2;(b-1|0)>>>0>2147483390?c=p[c]=0:(p[of>>2]|0)==0?(b=Gd[p[of+28>>2]](b),c=p[c]=b):(ch(b,d),c=p[c]);a=d;return c}function Lg(b){if((b|0)!=0){if((p[of>>2]|0)!=0){var c=-pf(b)|0;Rg(0,c);Rg(9,-1)}Gd[p[of+32>>2]](b)}}function dh(b,c){return(og()|0)==0?eh(b,c):0}function eh(b,c){if((b|0)==0){var d=bh(c)}else{if((c|0)<1){Lg(b),d=0}else{if((c|0)>2147483391){d=0}else{var d=pf(b),e=Gd[p[of+44>>2]](c);if((d|0)==(e|0)){d=b}else{if((p[of>>2]|0)==0){d=Gd[p[of+36>>2]](b,e)}else{jh(5,c);var f=e-d|0,g=p[Ve>>2],h=(g|0)<0?-1:0,i=Qg+4|0,i=(T.b(p[i>>2],p[i+4>>2],f,(f|0)<0?-1:0),T.result[0]),j=T.result[1];(h|0)<(j|0)||(h|0)==(j|0)&&g>>>0<i>>>0||kh(f);f=Gd[p[of+36>>2]](b,e);(f|0)==0&(p[Qg+12>>2]|0)!=0?(kh(c),e=Gd[p[of+36>>2]](b,e)):e=f;(e|0)==0?d=0:(d=pf(e)-d|0,Rg(0,d),d=e)}}}}}return d}eh.X=1;function lh(b,c){var d=a;a+=100;var e=d+72;(og()|0)==0?(Zg(e,d|0,70,1e9),l[e+25|0]=2,sh(e,0,b,c),e=th(e)):e=0;a=d;return e}function sh(b,c,d,e){var f,g,h=a;a+=84;var i;g=h>>2;var j=h+8,k=h+12,m=(c|0)!=0,o=k|0,r=b+12|0,q=k+1|0,s=d,u=e,w=0;a:for(;;){var v=l[s];if(v<<24>>24==0){break}else{if(v<<24>>24==37){var x=s,A=w}else{for(var E=s,J=1;;){var M=E+1|0,D=l[M];if(D<<24>>24==37||D<<24>>24==0){break}E=M;J=J+1|0}uh(b,s,J);if(D<<24>>24==0){break}x=M;A=s}}var K=x+1|0,H=l[K];if(H<<24>>24==0){uh(b,R.zq|0,1);break}for(var N=K,Q=H<<24>>24,P=0,L=0,I=0,X=0,Y=0,da=0;;){if((Q|0)==45){var ga=1,ha=L,ba=I,ea=X,ja=Y,ra=da}else{if((Q|0)==43){ga=P,ha=1,ba=I,ea=X,ja=Y,ra=da}else{if((Q|0)==32){ga=P,ha=L,ba=1,ea=X,ja=Y,ra=da}else{if((Q|0)==35){ga=P,ha=L,ba=I,ea=1,ja=Y,ra=da}else{if((Q|0)==33){ga=P,ha=L,ba=I,ea=X,ja=1,ra=da}else{if((Q|0)==48){ga=P,ha=L,ba=I,ea=X,ja=Y,ra=1}else{var Va=N,ta=Q,xa=da,Fa=Y,Na=X,Ea=I,La=L,za=P;break}}}}}}var Ba=N+1|0,Ja=l[Ba],ka=Ja<<24>>24;if(Ja<<24>>24==0){Va=Ba;ta=ka;xa=ra;Fa=ja;Na=ea;Ea=ba;La=ha;za=ga;break}N=Ba;Q=ka;P=ga;L=ha;I=ba;X=ea;Y=ja;da=ra}var S=(ta|0)==42;b:do{if(S){var ib=p[u>>2],Wa=(ib|0)<0,Za=Va+1|0,Sa=Za,tb=u+4|0,pb=l[Za]<<24>>24,fb=Wa?-ib|0:ib,Xa=Wa?1:za}else{if((ta-48|0)>>>0<10){for(var Ab=0,rb=ta,cb=Va;;){var Cb=rb-48+Ab*10|0,Zb=cb+1|0,dc=l[Zb]<<24>>24;if((dc-48|0)>>>0>=10){Sa=Zb;tb=u;pb=dc;fb=Cb;Xa=za;break b}Ab=Cb;rb=dc;cb=Zb}}else{Sa=Va,tb=u,pb=ta,fb=0,Xa=za}}}while(0);var kb=(pb|0)==46;b:do{if(kb){var Oa=Sa+1|0,Db=l[Oa];if(Db<<24>>24==42){var Wb=p[tb>>2],Nb=(Wb|0)<0?-Wb|0:Wb,$b=Sa+2|0,Rb=$b,Ra=tb+4|0;f=Ra>>2;var Ob=l[$b]<<24>>24,Ua=Nb}else{var Jb=Db<<24>>24;if((Db-48&255)<10){for(var Vb=0,Pb=Oa,sb=Jb;;){var db=Vb*10-48+sb|0,wb=Pb+1|0,ob=l[wb],Kb=ob<<24>>24;if((ob-48&255)>=10){Rb=wb;Ra=tb;f=Ra>>2;Ob=Kb;Ua=db;break b}Vb=db;Pb=wb;sb=Kb}}else{Rb=Oa,Ra=tb,f=Ra>>2,Ob=Jb,Ua=0}}}else{Rb=Sa,Ra=tb,f=Ra>>2,Ob=pb,Ua=-1}}while(0);if((Ob|0)==108){var ub=Rb+1|0,Xb=l[ub];if(Xb<<24>>24==108){var Sb=Rb+2|0,Qb=Sb,ac=l[Sb]<<24>>24,Gb=1}else{Qb=ub,ac=Xb<<24>>24,Gb=0}}else{Qb=Rb,ac=Ob,Gb=0}for(var xb=0;;){if((xb|0)>=23){var Ta=0,qb=vh|0;break}var bc=vh+xb*6|0;if((ac|0)==(l[bc|0]<<24>>24|0)){if(!(m|xb>>>0<20)){break a}Ta=l[vh+xb*6+3|0];qb=bc;break}xb=xb+1|0}var $a=Ta&255;b:do{if(($a|0)==14){var mb=0;i=37}else{if(($a|0)==16||($a|0)==1){mb=Gb,i=37}else{if(($a|0)==2||($a|0)==3||($a|0)==4){var Bb=Ra,bb=Ra+8|0,jb=(C[0]=p[Bb>>2],C[1]=p[Bb+4>>2],xd[0]);xd[0]=jb;p[g]=C[0];p[g+1]=C[1];var nb=(Ua|0)<0?6:Ua;if(jb<0){var zb=-jb;xd[0]=zb;p[g]=C[0];p[g+1]=C[1];var Tb=45,ec=zb}else{Tb=La<<24>>24!=0?43:Ea<<24>>24==0?0:32,ec=jb}var Hb=Ta<<24>>24==4,Eb=Hb?(((nb|0)>0)<<31>>31)+nb|0:nb,Lb=(Eb|0)>0;c:do{if(Lb){for(var gb=.5,Mb=Eb;;){var vc=Mb-1|0,hc=gb*.1;if((vc|0)<=0){var kc=hc;break c}gb=hc;Mb=vc}}else{kc=.5}}while(0);var pc=Ta<<24>>24==2;if(pc){var jc=ec+kc;xd[0]=jc;p[g]=C[0];p[g+1]=C[1];var mc=jc}else{mc=ec}if((mc!=mc&1|0)!=0){var Fb=bb,Ub=R.Bq|0,Ya=3,Pa=fb,yb=0}else{var Ka=mc>0;do{if(Ka){if(mc<1e+32){var Ac=0,Jc=mc}else{for(var uc=0,Tc=mc;;){var Yc=Tc*1e-32,ua=uc+32|0;if(!(Yc>=1e+32&(ua|0)<351)){break}uc=ua;Tc=Yc}xd[0]=Yc;p[g]=C[0];p[g+1]=C[1];Ac=ua;Jc=Yc}if(Jc>=1e8&(Ac|0)<351){for(var md=Ac,nd=Jc;;){var Bc=nd*1e-8,Qc=md+8|0;if(!(Bc>=1e8&(Qc|0)<351)){break}md=Qc;nd=Bc}xd[0]=Bc;p[g]=C[0];p[g+1]=C[1];var Oc=Qc,ed=Bc}else{Oc=Ac,ed=Jc}if(ed>=10&(Oc|0)<351){for(var Fc=Oc,ud=ed;;){var Rc=ud*.1,Yb=Fc+1|0;if(!(Rc>=10&(Yb|0)<351)){break}Fc=Yb;ud=Rc}xd[0]=Rc;p[g]=C[0];p[g+1]=C[1];var W=Yb,bd=Rc}else{W=Oc,bd=ed}if(bd<1e-8){for(var hd=bd,eb=W;;){var Uc=hd*1e8,cd=eb-8|0;if(Uc>=1e-8){break}hd=Uc;eb=cd}xd[0]=Uc;p[g]=C[0];p[g+1]=C[1];var vd=cd,id=Uc}else{vd=W,id=bd}if(id<1){for(var Zc=id,td=vd;;){var zd=Zc*10,Id=td-1|0;if(zd>=1){break}Zc=zd;td=Id}xd[0]=zd;p[g]=C[0];p[g+1]=C[1];var xc=Id,qc=zd}else{xc=vd,qc=id}if((xc|0)<=350){var Gc=xc,Hc=qc;break}var zc=Tb<<24>>24==45?R.Cq|0:Tb<<24>>24==43?R.Dq|0:R.Eq|0,Kc=ve(zc),Fb=bb,Ub=zc,Ya=Kc,Pa=fb,yb=0;i=182;break b}Gc=0;Hc=mc}while(0);if(pc){var wd=Gc}else{var be=Hc+kc;xd[0]=be;p[g]=C[0];p[g+1]=C[1];be<10?wd=Gc:(xd[0]=be*.1,p[g]=C[0],p[g+1]=C[1],wd=Gc+1|0)}if(Hb){var ge=Na<<24>>24==0&1,Xd=(wd|0)<-4|(wd|0)>(Eb|0),rc=Eb-(Xd?0:wd)|0;if(Xd){var Lc=rc,Jd=3,Qd=ge}else{Lc=rc,Jd=2,Qd=ge}}else{Lc=Eb,Jd=Ta,Qd=0}var Fd=Jd<<24>>24==3,Cd=Fd?0:wd,ce=Lc+fb+Cd|0,Yd=(ce|0)>55;do{if(Yd){var Mc=bh(ce+15|0);if((Mc|0)!=0){var jd=Mc,gc=Mc;break}l[b+24|0]=1;break a}jd=o;gc=0}while(0);p[j>>2]=0;if(Tb<<24>>24==0){var fd=jd}else{l[jd]=Tb,fd=jd+1|0}if((Cd|0)<0){l[fd]=48;var Sd=fd+1|0,$c=Cd}else{for(var Ad=Cd^-1,Xe=(Ad|0)>-1?Ad:-1,ef=-2-Xe|0,oe=Cd+Xe|0,wf=Cd,Kd=fd;;){var ue=wh(h,j);l[Kd]=ue;if((wf|0)<=0){break}wf=wf-1|0;Kd=Kd+1|0}Sd=oe+(fd+2)|0;$c=ef}var xf=(Fa|Na|(Lc|0)>0&1)<<24>>24==0;if(xf){var Ge=Sd}else{l[Sd]=46,Ge=Sd+1|0}if(($c+1|0)<0){var yf=$c+(Lc+1)|0,Re=$c^-1;Ed(Ge,48,Re);var Se=yf,tc=Ge+Re|0}else{Se=Lc,tc=Ge}var ff=(Se|0)>0;c:do{if(ff){for(var he=tc+Se|0,je=tc;;){var de=wh(h,j),Me=je+1|0;l[je]=de;if((Me|0)==(he|0)){var od=he;break c}je=Me}}else{od=tc}}while(0);var ke=Qd<<24>>24==0|xf;c:do{if(ke){var Zd=od}else{for(var le=od;;){var ye=le-1|0,zf=l[ye];if(zf<<24>>24!=48){if(zf<<24>>24==46){break}else{Zd=le;break c}}l[ye]=0;le=ye}Fa<<24>>24==0?(l[ye]=0,Zd=ye):(l[le]=48,Zd=le+1|0)}}while(0);if(Fd){var Ye=Zd+1|0;l[Zd]=l[R.uc+(t[qb+4|0]&255)|0];var Ze=Zd+2|0;if((wd|0)<0){l[Ye]=45;var Ae=-wd|0}else{l[Ye]=43,Ae=wd}if((Ae|0)>99){l[Ze]=((Ae|0)/100&-1)+48&255;var Sf=Zd+3|0,cg=(Ae|0)%100}else{Sf=Ze,cg=Ae}l[Sf]=((cg|0)/10&-1)+48&255;l[Sf+1|0]=cg%10+48&255;var If=Sf+2|0}else{If=Zd}l[If]=0;var Jf=If,Cg=jd,Kf=Jf-Cg|0;if(xa<<24>>24!=0&Xa<<24>>24==0&(Kf|0)<(fb|0)){var Sg=fb-Kf|0,Lf=(Kf|0)<0;c:do{if(!Lf){for(var Te=fb;;){l[jd+Te|0]=l[jd+(Te-Sg)|0];var gf=Te-1|0;if((gf|0)<(Sg|0)){break c}Te=gf}}}while(0);(fb|0)!=(Kf|0)&&Ed(jd+(Tb<<24>>24!=0&1)|0,48,fb+Cg-Jf|0);Fb=bb;Ub=jd;Ya=fb}else{Fb=bb,Ub=jd,Ya=Kf}Pa=fb;yb=gc}i=182}else{if(($a|0)==5){p[p[f]>>2]=p[r>>2],Fb=Ra+4|0,Ub=A,yb=Pa=Ya=0,i=182}else{if(($a|0)==8){l[o]=37,Fb=Ra,Ub=o,Ya=1,Pa=fb,yb=0,i=182}else{if(($a|0)==9){var sg=Ra+4|0,Mf=p[f]&255;l[o]=Mf;(Ua|0)>-1?((Ua|0)>1&&Ed(q,Mf,Ua-1|0),Fb=sg,Ub=o,Ya=Ua):(Fb=sg,Ub=o,Ya=1);Pa=fb;yb=0;i=182}else{if(($a|0)==6||($a|0)==7){var He=Ra+4|0,$e=p[f];if(($e|0)==0){var Ne=xh|0,Ue=0}else{Ta<<24>>24!=7?(Ne=$e,Ue=0):Ue=Ne=$e}if((Ua|0)>-1){for(var hf=0;;){if((hf|0)>=(Ua|0)){Fb=He;Ub=Ne;Ya=hf;Pa=fb;yb=Ue;i=182;break b}if(l[Ne+hf|0]<<24>>24==0){Fb=He;Ub=Ne;Ya=hf;Pa=fb;yb=Ue;i=182;break b}hf=hf+1|0}}else{var Dg=ve(Ne),Fb=He,Ub=Ne,Ya=Dg,Pa=fb,yb=Ue;i=182}}else{if(($a|0)==10||($a|0)==11||($a|0)==15){for(var me=Ta<<24>>24==15?34:39,jf=Ra+4|0,$d=p[f],Nf=($d|0)==0,Eg=Nf?Ta<<24>>24==11?R.V|0:R.Fq|0:$d,tg=me&255,dg=0,eg=Ua,Af=0;;){if((eg|0)==0){break}var Md=l[Eg+Af|0];if(Md<<24>>24==0){break}dg=((Md<<24>>24|0)==(tg|0)&1)+dg|0;eg=eg-1|0;Af=Af+1|0}var Tf=Ta<<24>>24==11&(Nf^1),Tg=((Tf&1)<<1|1)+Af+dg|0,Of=(Tg|0)>70;do{if(Of){var Uf=bh(Tg);if((Uf|0)!=0){var kf=Uf,Vf=Uf;break}l[b+24|0]=1;break a}kf=o;Vf=0}while(0);if(Tf){l[kf]=me;var af=1}else{af=0}var Ug=(Af|0)>0;c:do{if(Ug){for(var ug=0,ie=af;;){var lf=l[Eg+ug|0],mh=ie+1|0;l[kf+ie|0]=lf;if((lf<<24>>24|0)==(tg|0)){l[kf+mh|0]=lf;var Fg=ie+2|0}else{Fg=mh}var fg=ug+1|0;if((fg|0)==(Af|0)){var gg=Fg;break c}ug=fg;ie=Fg}}else{gg=af}}while(0);if(Tf){l[kf+gg|0]=me;var Ie=gg+1|0}else{Ie=gg}l[kf+Ie|0]=0;Fb=jf;Ub=kf;Ya=Ie;Pa=fb;yb=Vf;i=182}else{if(($a|0)==12){var Pf=Ra+4|0,Vg=p[f];(Vg|0)!=0&&uh(b,p[Vg>>2],p[Vg+4>>2]);Fb=Pf;Ub=A;yb=Pa=Ya=0;i=182}else{if(($a|0)==13){var hg=p[f],Gg=Ra+8|0,ig=p[f+1],jg=p[(hg+4>>2)+(ig*15|0)];(jg|0)!=0&&(uh(b,jg,-1),uh(b,R.oc|0,1));uh(b,p[(hg+8>>2)+(ig*15|0)],-1);Fb=Gg;Ub=A;yb=Pa=Ya=0;i=182}else{break a}}}}}}}}}}}while(0);if(i==37){var Wf=mb<<24>>24!=0;if((l[qb+2|0]&1)<<24>>24==0){if(Wf){var vg=Ra,kg=vg|0,lg=vg+4|0,Bf=Ra+8|0,bf=0,Xf=p[lg>>2],mf=p[kg>>2]}else{Bf=Ra+4|0,Xf=bf=0,mf=p[f]}}else{if(Wf){var Eh=Ra,kg=Eh|0,lg=Eh+4|0,wg=Ra+8|0,Cf=p[lg>>2],mg=p[kg>>2]}else{var Qf=p[f],ci=(Qf|0)<0?-1:0,wg=Ra+4|0,Cf=ci,mg=Qf}if((Cf|0)<0||(Cf|0)==0&&mg>>>0<0){var di=(T.b(0,0,mg,Cf),T.result[0]),Fh=T.result[1],Bf=wg,bf=45,Xf=Fh,mf=di}else{if(La<<24>>24!=0){Bf=wg,bf=43}else{var Gh=Ea<<24>>24==0?0:32,Bf=wg,bf=Gh}Xf=Cf;mf=mg}}var nh=mf==0&&Xf==0;if(xa<<24>>24==0){var nf=Ua}else{var Wg=fb-(bf<<24>>24!=0&1)|0,nf=(Ua|0)<(Wg|0)?Wg:Ua}var Hh=(nf|0)<60;do{if(!Hh){var Xg=nf+10|0,xg=bh(Xg);if((xg|0)!=0){var Yf=xg,Hg=Xg,Yg=xg;break}l[b+24|0]=1;break a}Yf=o;Hg=70;Yg=0}while(0);var ei=Yf+(Hg-1)|0;if(Ta<<24>>24==16){var fi=(T.k(mf,Xf,10,0,!0),T.result[0]);if(fi>>>0>3){i=57}else{var Ui=(T.j(mf,Xf,10,0,!0),T.result[0]),zj=(T.k(Ui,T.result[1],10,0,!0),T.result[0]),Aj=T.result[1];if(zj==1&&Aj==0){i=57}else{var Vi=fi;i=58}}i==57&&(Vi=0);var wi=Vi<<1;l[Yf+(Hg-2)|0]=l[R.yc+(wi|1)|0];var fl=Yf+(Hg-3)|0;l[fl]=l[R.yc+wi|0];var mk=fl}else{mk=ei}for(var nm=t[qb+4|0]&255,om=l[qb+1|0]&255,gi=mk,xi=Xf,Bj=mf;;){var gl=(T.k(Bj,xi,om,0,!0),T.result[0]),Wi=gi-1|0;l[Wi]=l[R.uc+gl+nm|0];var yi=(T.j(Bj,xi,om,0,!0),T.result[0]),hl=T.result[1];if(yi==0&&hl==0){break}gi=Wi;xi=hl;Bj=yi}var il=ei,nk=Wi,jl=nf-il+nk|0;if((jl|0)>0){for(var kl=il-nf-nk|0,Cj=jl,Dj=Wi;;){var pm=Dj-1|0;l[pm]=48;var O=Cj-1|0;if((O|0)<=0){break}Cj=O;Dj=pm}var aa=gi+(kl-1)|0}else{aa=Wi}if(bf<<24>>24==0){var Z=aa}else{var $=aa-1|0;l[$]=bf;Z=$}var Ej=nh|Na<<24>>24==0;b:do{if(Ej){var wa=Z}else{var ia=t[qb+5|0];if(ia<<24>>24==0){wa=Z}else{var Aa=R.Tq+(ia&255)|0;if(ia<<24>>24==6||ia<<24>>24==3){wa=Z}else{for(var Fj=Aa,zi=Z,U=l[Aa];;){var oh=zi-1|0;l[oh]=U;var Ih=Fj+1|0,ph=l[Ih];if(ph<<24>>24==0){wa=oh;break b}Fj=Ih;zi=oh;U=ph}}}}}while(0);Fb=Bf;Ub=wa;Ya=il-wa|0;Pa=fb;yb=Yg}var qh=Xa<<24>>24!=0;if(!qh){var rh=Pa-Ya|0;(rh|0)>0&&yh(b,rh)}(Ya|0)>0?uh(b,Ub,Ya):i=187;if(qh){var Gj=Pa-Ya|0;(Gj|0)>0&&yh(b,Gj)}Lg(yb);s=Qb+1|0;u=Fb;w=Ub}a=h}sh.X=1;function th(b){var c,d;d=(b+8|0)>>2;var e=p[d];if((e|0)!=0){c=(b+12|0)>>2;l[e+p[c]|0]=0;var f=l[b+25|0];f<<24>>24!=0&&(e=b+4|0,(p[d]|0)==(p[e>>2]|0)&&(f=f<<24>>24==1?zh(p[b>>2],p[c]+1|0):Kg(p[c]+1|0),p[d]=f,(f|0)==0?l[b+24|0]=1:Ah(f,p[e>>2],p[c]+1|0)))}return p[d]}function Bh(b){var c=a;a+=4;if((og()|0)==0){p[c>>2]=arguments[Bh.length];var d=lh(b,p[c>>2])}else{d=0}a=c;return d}function Ch(b,c,d){var e=a;a+=4;p[e>>2]=arguments[Ch.length];var f=p[e>>2],g=a;a+=28;(b|0)<1?f=c:(Zg(g,c,b,0),l[g+25|0]=0,sh(g,0,d,f),f=th(g));a=g;a=e;return f}function cf(b,c){var d=a;a+=4;if((p[of+224>>2]|0)!=0){p[d>>2]=arguments[cf.length];var e=p[d>>2],f=a;a+=240;Zg(f,f+28|0,210,0);l[f+25|0]=0;sh(f,0,c,e);var e=p[of+224>>2],g=p[of+228>>2],h=th(f);Gd[e](g,b,h);a=f}a=d}function Dh(b,c){var d=(b|0)==0;a:do{if(!d){for(var e=c,f=b;;){var f=f-1|0,g=Jh();l[e]=g;if((f|0)==0){break a}e=e+1|0}}}while(0)}function Jh(){var b=a;a+=256;if(l[Kh|0]<<24>>24==0){l[Kh+2|0]=0;l[Kh+1|0]=0;var c=ng(0);Gd[p[c+56>>2]](c,256,b|0);for(c=0;;){if(l[Kh+(c+3)|0]=c&255,c=c+1|0,(c|0)==256){var d=0;break}}for(;;){var c=Kh+(d+3)|0,e=(l[b+d|0]+l[c]&255)+l[Kh+2|0]&255;l[Kh+2|0]=e;var e=Kh+(e&255)+3|0,f=l[e];l[e]=l[c];l[c]=f;d=d+1|0;if((d|0)==256){break}}l[Kh|0]=1}d=l[Kh+1|0]+1&255;l[Kh+1|0]=d;d=Kh+(d&255)+3|0;c=t[d];e=l[Kh+2|0]+c&255;l[Kh+2|0]=e;l[d]=l[Kh+(e&255)+3|0];l[Kh+(t[Kh+2|0]&255)+3|0]=c;d=l[Kh+(l[Kh+(t[Kh+1|0]&255)+3|0]+c&255)+3|0];a=b;return d}Jh.X=1;function Lh(b,c,d,e,f){var g=a;a+=520;var h,i=g+516,j=e&-256,k=e&16,m=e&8,o=e&1,r=e&2,q=(e&4|0)!=0,s=q&&((j|0)==16384||(j|0)==2048||(j|0)==524288)?1:0;Ed(d,0,44);j=(j|0)==256;do{if(j){var u=c;h=e;var w=a;a+=72;u=(Gd[p[Mh+52>>2]](u,w)|0)==0;a:do{if(u){for(var v=p[w>>2],x=p[w+4>>2],A=Nh;;){var E=p[A>>2];if((E|0)==0){v=0;break a}if((p[E>>2]|0)==(v|0)&&(p[E+4>>2]|0)==(x|0)){break}A=E+32|0}for(v=E+28|0;;){var J=p[v>>2];if((J|0)==0){v=0;break a}var M=J+8|0;if((p[J+4>>2]|0)==(h|0)){break}v=M}p[v>>2]=p[M>>2];v=J}else{v=0}}while(0);a=w;h=v;if((h|0)==0){w=h=Kg(12);if((h|0)==0){Q=7;h=26;break}h=-1}else{w=h,h=p[h>>2]}p[d+28>>2]=w;u=q?r|512:r;u=(w=(k|0)!=0)?u|2048:u;if((h|0)<0){P=c,L=w,I=u,h=12}else{var D=o,K=e,H=h,N=c;h=17}}else{if((c|0)==0){h=g|0;w=Oh(h);if((w|0)!=0){var Q=w;h=26;break}P=h}else{P=c}I=q?r|512:r;h=(k|0)!=0;var P=P,L=h,I=h?I|2048:I;h=12}}while(0);do{if(h==12){k=P;q=e;E=i;J=a;a+=588;M=J+516;p[E>>2]=420;h=(q&526336|0)==0;do{if(h){if((q&8|0)==0){w=0;break}p[E>>2]=384}else{for(w=ve(k);;){var X=w-1|0;if(l[k+X|0]<<24>>24==45){break}w=X}w=J|0;Ah(w,k,X);l[J+X|0]=0;if((Gd[p[Mh+52>>2]](w,M)|0)!=0){w=1802;break}p[E>>2]=p[M+8>>2]&511}w=0}while(0);a=J;k=w;if((k|0)!=0){Q=k,h=26}else{if(k=p[i>>2],q=Ph(P,I,k),(q|0)<0){if(!((p[Qh>>2]|0)==21|(r|0)==0|L)&&(q=e&-8|1,k=Ph(P,I&2048,k),(k|0)>=0)){D=1;K=q;H=k;N=P;h=17;break}Rh(30044);var Y=Sh(14,R.na|0,P,30044);h=24}else{D=o,K=e,H=q,N=P,h=17}}}}while(0);if(h==17){(f|0)!=0&&(p[f>>2]=K);e=d+28|0;f=p[e>>2];(f|0)!=0&&(p[(f|0)>>2]=H,p[(p[e>>2]+4|0)>>2]=K);if((m|0)!=0){Gd[p[Mh+196>>2]](N)}N=p[Mh+88>>2];e=Gd[N](H,1,(z=a,a+=4,p[z>>2]=0,z))|1;Gd[N](H,2,(z=a,a+=4,p[z>>2]=e,z));m<<=2;D=(D|0)==0?m:m|2;j=j?D:D|128;s=s?j|8:j;Y=Th(b,H,d,c,(K&64|0)==0?s:s|64);h=24}h==24&&((Y|0)==0?Q=0:(Lg(p[d+28>>2]),Q=Y));a=g;return Q}Lh.X=1;function Yh(b,c){var d=a;a+=8;var e=Dc(),f=Date.now();p[d+e[0]>>2]=Math.floor(f/1e3);p[d+e[1]>>2]=Math.floor((f-1e3*Math.floor(f/1e3))*1e3);var e=p[d>>2],g=(T.multiply(e,(e|0)<0?-1:0,1e3,0),T.result[0]),e=(p[d+4>>2]|0)/1e3&-1,f=(e|0)<0?-1:0,g=(T.add(g,T.result[1],1045635584,49096),T.result[0]),e=(T.add(g,T.result[1],e,f),T.result[0]),f=T.result[1];p[c>>2]=e;p[c+4>>2]=f;a=d;return 0}function Zh(b,c,d,e){var f,g,h=(d|0)==(b|0);a:do{if(h){$h(b,1,R.Gj|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));var i=0}else{var j=Kg(48);g=j>>2;i=j;if((j|0)==0){$h(b,7,0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z))}else{Ed(j,0,48);var k=ai(b,d,e);f=(j+24|0)>>2;p[f]=k;k=ai(b,b,c);p[g+1]=k;p[g]=b;p[g+5]=d;p[g+4]=1;p[g+10]=0;g=p[f];var m=(g|0)==0|(k|0)==0;do{if(!m&&(bi(p[k>>2],p[k+4>>2],p[p[g+4>>2]+32>>2],-1,0)|0)!=7){b=p[f]+16|0;p[b>>2]=p[b>>2]+1|0;break a}}while(0);Lg(j)}i=0}}while(0);return i}Zh.X=1;function $h(b,c,d){var e,f=a;a+=4;var g=(b|0)==0;do{if(!g){e=(b+212|0)>>2;var h=p[e];if((h|0)==0&&(h=hi(b),p[e]=h,(h|0)==0)){break}p[b+20>>2]=c;(d|0)==0?ii(h,0,0,1,0):(p[f>>2]=arguments[$h.length],h=ji(b,d,p[f>>2]),ii(p[e],-1,h,1,4))}}while(0);a=f}function ki(b){return b<<24>>24!=0&1}function li(b,c){p[c+4>>2]=b}function ai(b,c,d){var e,f=mi(c,d);if((f|0)==1){var g=ni(b,556);e=g>>2;if((g|0)==0){$h(b,7,R.ca|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));var h=0;e=10}else{if(p[e]=c,(oi(g)|0)==0){vf(b,p[e+2]),vf(b,g),e=7}else{var h=g+8|0,i=p[h>>2];$h(b,p[e+1],R.d|0,(z=a,a+=4,p[z>>2]=i,z));vf(b,p[h>>2]);vf(b,g);h=0;e=10}}}else{e=7}e==7&&((f|0)<0?($h(b,1,R.Tp|0,(z=a,a+=4,p[z>>2]=d,z)),h=0):h=p[p[c+8>>2]+(f<<4)+4>>2]);return h}function pi(b,c){var d,e,f,g=a;a+=8;var h,i=g+4;f=(b+24|0)>>2;var j=p[f];li(p[j>>2],p[j+4>>2]);var k=b|0,j=b+28|0;e=y[j>>2];if((((e|0)==5||(e|0)==0||(e|0)==6?0:1)|0)==0){var m=p[f],o=p[m+4>>2],r=p[o>>2];e=(b+4|0)>>2;var q=p[e],s=p[p[q+4>>2]>>2];if((p[k>>2]|0)==0){h=4}else{if(l[o+19|0]<<24>>24==2){var u=5,w=0;h=9}else{h=4}}do{if(h==4){w=b+12|0;if((p[w>>2]|0)==0){o=qi(q,2);if((o|0)!=0){u=o;w=0;break}p[w>>2]=1;w=p[e];ri(p[w>>2],p[w+4>>2],1,b+8|0);w=p[f]}else{w=m}(ki(l[w+8|0])|0)!=0?w=u=0:(u=qi(w,0),w=1)}}while(0);d=p[p[f]+4>>2];m=p[d+32>>2];o=p[p[e]+4>>2];q=p[o+32>>2];o=(l[p[o>>2]+5|0]&255|0)==5;h=(m|0)==(q|0)|(u|0)==0&o^1?u:8;var u=p[d+44>>2],v=(c|0)<0;d=(b+16|0)>>2;a:do{if(v){for(var x=h,A=p[d];;){if(!(A>>>0<=u>>>0&(x|0)==0)){var E=x;break a}(A|0)==(Math.floor((y[si>>2]>>>0)/(y[p[p[f]+4>>2]+32>>2]>>>0))+1|0)?x=0:(x=ti(r,A,g,0),(x|0)==0&&(x=p[g>>2],A=ui(b,A,p[x+4>>2]),vi(x),x=A));A=p[d]+1|0;p[d]=A}}else{for(var J=h,A=0;;){if((A|0)>=(c|0)){E=J;break a}x=y[d];if(!(x>>>0<=u>>>0&(J|0)==0)){E=J;break a}(x|0)==(Math.floor((y[si>>2]>>>0)/(y[p[p[f]+4>>2]+32>>2]>>>0))+1|0)?x=0:(J=ti(r,x,g,0),(J|0)!=0?x=J:(J=p[g>>2],x=ui(b,x,p[J+4>>2]),vi(J)));p[d]=p[d]+1|0;J=x;A=A+1|0}}}while(0);if((E|0)==0){if(p[b+36>>2]=u,h=y[d],p[b+32>>2]=u+1-h|0,h>>>0>u>>>0){h=26}else{if((p[b+40>>2]|0)!=0){var M=E}else{h=p[p[p[b+24>>2]+4>>2]>>2]+88|0,p[b+44>>2]=p[h>>2],p[h>>2]=b,p[b+40>>2]=1,M=E}h=43}}else{(E|0)==101?h=26:(M=E,h=43)}do{if(h==26){if(E=p[e],E=Ai(p[E>>2],p[E+4>>2],1,p[b+8>>2]+1|0),(E|0)!=0){M=E}else{E=p[k>>2];(E|0)==0?h=29:Bi(E,-1);if(o&&(E=Ci(p[e],2),(E|0)!=0)){M=E;break}if((m|0)<(q|0)){E=(q|0)/(m|0)&-1;E=(u-1+E|0)/(E|0)&-1;p[s+24>>2]=(((E|0)==(Math.floor((y[si>>2]>>>0)/(y[p[p[e]+4>>2]+32>>2]>>>0))+1|0))<<31>>31)+E|0;d=m;var v=(m|0)<0?-1:0,M=(T.multiply(u,(u|0)<0?-1:0,d,v),T.result[0]),E=T.result[1],A=p[s+60>>2],x=Di(s,0,1),D=p[si>>2],K=D+q|0,J=K,K=(K|0)<0?-1:0,H=(K|0)<(E|0)||(K|0)==(E|0)&&J>>>0<M>>>0,J=H?J:M,K=H?K:E,D=H=D+m|0,H=(H|0)<0?-1:0,N=(x|0)==0,Q=N&((H|0)<(K|0)||(H|0)==(K|0)&&D>>>0<J>>>0);a:do{if(Q){for(var P=H,L=D;;){p[i>>2]=0;var I=(T.j(L,P,d,v),T.result[0]),I=(T.add(I,T.result[1],1,0),T.result[0]),I=ti(r,I,i,0),X=p[i>>2],I=(I|0)==0?Ei(A,p[X+4>>2],m,L,P):I;vi(X);L=(T.add(L,P,d,v),T.result[0]);P=T.result[1];X=(I|0)==0;if(!(X&((P|0)<(K|0)||(P|0)==(K|0)&&L>>>0<J>>>0))){var Y=I,da=X;break a}}}else{Y=x,da=N}}while(0);if(!da){M=Y;break}d=A;v=E;E=a;a+=8;A=Fi(d,E);x=p[E+4>>2];M=(A|0)==0&((x|0)>(v|0)||(x|0)==(v|0)&&p[E>>2]>>>0>M>>>0)?Gi(d,M,v):A;a=E;E=M;if((E|0)!=0){M=E;break}E=Hi(s)}else{p[s+24>>2]=((m|0)/(q|0)&-1)*u|0,E=Di(s,0,0)}(E|0)!=0?M=E:(E=Ii(p[e],0),M=(E|0)!=0?E:101)}}}while(0);(w|0)!=0&&(Ji(p[f],0),Ii(p[f],0));f=(M|0)==3082?7:M;p[j>>2]=f}else{f=e}a=g;return f}pi.X=1;function qi(b,c){var d,e,f,g,h,i=y[b+4>>2];g=i>>2;f=(b|0)>>2;li(p[f],i);var j=b+8|0;e=l[j];do{if(e<<24>>24==2){var k=0,m=(c|0)==0;h=41}else{if(e<<24>>24==1){if((c|0)==0){var o=0;h=43;break}var r=0}else{r=(c|0)==0}h=5}}while(0);a:do{if(h==5){if(e=(i+22|0)>>1,d=n[e],(d&1)<<16>>16==0|r){var q=(c|0)!=0;h=q?l[i+19|0]<<24>>24==2?9:8:8;b:do{if(h==8){if((d&64)<<16>>16!=0){h=9}else{if((c|0)>1){for(var s=i+72|0;;){s=p[s>>2];if((s|0)==0){h=16;break b}var u=p[s>>2];if((u|0)!=(b|0)){var w=u;h=15;break b}s=s+12|0}}else{h=16}}}}while(0);h==9&&(w=p[g+19],h=15);if(h==15&&(p[w>>2]|0)!=0){o=262,h=43}else{if(d=Ki(b,1,1),(d|0)!=0){o=d,h=43}else{s=n[e];n[e]=s&-9;d=(i+44|0)>>2;(p[d]|0)==0&&(n[e]=s|8);var u=i+12|0,v=i+19|0,x=i,A=q^1,E=i|0,s=(c|0)>1,J=s&1,M=0;b:for(;;){var D=(p[u>>2]|0)==0;do{if(D){h=Li(i);if((h|0)==0){M=0;continue b}var K=h;h=26}else{if((M|0)!=0|A){h=M}else{if((n[e]&1)<<16>>16!=0){K=8;h=26;break}h=Mi(p[E>>2],J,l[p[f]+29|0]<<24>>24==2&1);if((h|0)!=0){K=h;h=26;break}h=Ni(i)}if((h|0)==0){var H=0;break b}var N=h,Q=0;h=28}}while(0);h==26&&(N=K,Q=(K|0)==0);Oi(i);h=(N&255|0)==5;do{if(h&&l[v]<<24>>24==0&&(Ti(x)|0)!=0){M=N;continue b}}while(0);if(Q){H=N;break}k=N;m=r;h=41;break a}l[j]<<24>>24==0&&(h=i+40|0,p[h>>2]=p[h>>2]+1|0,l[b+9|0]<<24>>24!=0&&(h=b+28|0,l[b+36|0]=1,x=i+72|0,p[b+40>>2]=p[x>>2],p[x>>2]=h));h=q?2:1;l[j]=h;(h&255)>(t[v]&255)&&(l[v]=h);q?(q=p[u>>2],p[g+19]=b,u=n[e],n[e]=s?u|32:u&-33,e=q+64|0,(p[d]|0)==(Xi(p[e>>2]+28|0)|0)?(k=H,m=r,h=41):(q=Yi(p[q+76>>2]),(q|0)!=0?(o=q,h=43):(Zi(p[e>>2]+28|0,p[d]),k=0,m=r,h=41))):(o=H,h=43)}}}else{o=8,h=43}}}while(0);h==41&&(o=(k|0)!=0|m?k:$i(p[g],p[p[f]+480>>2]));return o}qi.X=1;function ri(b,c,d,e){li(b,c);p[e>>2]=Xi((d<<2)+p[p[c+12>>2]+64>>2]+36|0)}function ti(b,c,d,e){var f=b>>2,g,h=(c|0)==0;a:do{if(h){aj(43304);var i=11}else{var i=y[f+10],j=(i|0)==0;do{if(j){var k=bj(p[f+44],c,1,d);if((k|0)==0){k=y[d>>2];g=k+20|0;var m=(e|0)==0;if((p[g>>2]|0)!=0&m){b=b+160|0;p[b>>2]=p[b>>2]+1|0;i=0;break a}p[g>>2]=b;var o=(c|0)<0;b:do{if(!o){g=b+128|0;o=y[g>>2];if((((p[si>>2]|0)/(o|0)&-1)+1|0)==(c|0)){g=9;break}var r=l[b+15|0]<<24>>24==0;do{if(r&&y[f+6]>>>0>=c>>>0&m&&(p[p[f+15]>>2]|0)!=0){r=b+164|0;p[r>>2]=p[r>>2]+1|0;r=cj(k);if((r|0)==0){i=0;break a}g=20;break b}}while(0);if(y[f+33]>>>0<c>>>0){r=13;g=20;break}m?b=o:(dj(),y[f+7]>>>0<c>>>0||ej(p[f+14],c),fj(b,c),gj(),b=p[g>>2]);Ed(p[k+4>>2],0,b);i=0;break a}g=9}while(0);g==9&&(aj(43342),r=11);(k|0)!=0&&hj(k);k=r}}else{k=i}}while(0);ij(b);p[d>>2]=0;i=k}}while(0);return i}ti.X=1;function jj(b){return(b|0)==0?0:l[b+105|0]<<24>>24==0?0:p[b+160>>2]}function ui(b,c,d){var e=a;a+=4;var f=b+4|0,g=p[p[f>>2]+4>>2],h=p[g>>2],b=p[p[p[b+24>>2]+4>>2]+32>>2],g=p[g+32>>2],i=(b|0)<(g|0)?b:g,j=(b|0)<0?-1:0,k=(T.multiply(b,j,c,0),T.result[0]),m=T.result[1];if((b|0)==(g|0)){c=3}else{if((l[h+15|0]&255|0)==0){c=3}else{var o=8,c=12}}a:do{if(c==3){if((b|0)>0){for(var r=(T.b(k,m,b,j),T.result[0]),q=g,s=(g|0)<0?-1:0,u=0,w=T.result[1],v=g;;){p[e>>2]=0;var x=(T.j(r,w,q,s),T.result[0])+1|0;if((x|0)!=(Math.floor((y[si>>2]>>>0)/(v>>>0))+1|0)){v=ti(h,x,e,0);u=y[e>>2];if((v|0)==0&&(v=Yi(u),(v|0)==0)){var v=(T.k(r,w,b,j),T.result[0]),v=d+v|0,x=p[u+4>>2],A=(T.k(r,w,q,s),T.result[0]);Ah(x+A|0,v,i);v=l[p[u+8>>2]]=0}vi(u);u=v}r=(T.add(r,w,q,s),T.result[0]);w=T.result[1];if(!((u|0)==0&((w|0)<(m|0)||(w|0)==(m|0)&&r>>>0<k>>>0))){o=u;break a}v=p[p[p[f>>2]+4>>2]+32>>2]}}else{o=0}}}while(0);a=e;return o}ui.X=1;function vi(b){if((b|0)!=0){var c=p[b+20>>2];kj(b);ij(c)}}function Ai(b,c,d,e){li(b,c);var f=p[c+12>>2],b=p[f+64>>2],f=Yi(p[f+76>>2]);(f|0)==0&&(Zi((d<<2)+b+36|0,e),(d|0)==7&&(l[c+18|0]=e&255));return f}function Bi(b,c){var d,e,f,g,h=(c|0)>-1;do{if(h){f=b+8|0,lj(p[p[f>>2]+(c<<4)+12>>2]),(c|0)!=1&&lj(p[p[f>>2]+28>>2])}else{Ce(b);g=(b+4|0)>>2;var i=p[g],j=(i|0)>0;f=(b+8|0)>>2;a:do{if(j){for(var k=0,m=i;;){var o=p[p[f]+(k<<4)+12>>2];(o|0)!=0&&(lj(o),m=p[g]);k=k+1|0;if((k|0)>=(m|0)){break a}}}}while(0);p[(b+12|0)>>2]&=-513;tj(b);i=p[g];j=(i|0)>2;k=p[f];a:do{if(j){o=m=2;for(e=k;;){if(d=(m<<4)+e|0,(p[e+(m<<4)+4>>2]|0)==0?(e=d|0,vf(b,p[e>>2]),p[e>>2]=0):((o|0)<(m|0)&&(e=((o<<4)+e|0)>>2,d>>=2,p[e]=p[d],p[e+1]=p[d+1],p[e+2]=p[d+2],p[e+3]=p[d+3]),o=o+1|0),m=m+1|0,d=p[g],e=p[f],(m|0)>=(d|0)){var r=o,q=d,s=e;break a}}}else{r=2,q=i,s=k}}while(0);Ed((r<<4)+s|0,0,q-r<<4);p[g]=r;(r|0)<3&&(i=p[f],g=b+444|0,(i|0)!=(g|0)&&(Ah(g,i,32),vf(b,i),p[f]=g))}}while(0)}Bi.X=1;function Ci(b,c){var d,e=p[b+4>>2];d=(e+22|0)>>1;var f=n[d];n[d]=(c|0)==1?f|16:f&-17;var g=qi(b,0);if((g|0)==0){var h=e+12|0,e=y[p[h>>2]+64>>2],f=e+18|0,i=c&255,j=c&255;(t[f]&255|0)==(j|0)&&(t[e+19|0]&255|0)==(j|0)?e=g:(g=qi(b,2),(g|0)!=0?e=g:(g=Yi(p[p[h>>2]+76>>2]),(g|0)!=0?e=g:(l[f]=i,l[e+19|0]=i,e=0)))}else{e=g}n[d]&=-17;return e}function Di(b,c,d){var e,f=b>>2,g=a;a+=8;var h,i=g+4,j=y[f+10],k=(j|0)==0;a:do{if(k){var m=b+16|0;if((t[m]&255)>=3){var o=l[b+15|0]<<24>>24==0;do{if(o){var r=b+180|0;if((uj(p[r>>2])|0)==0){var q=b;e=a;a+=4;h=q+18|0;if(l[h]<<24>>24==0){if((p[q+24>>2]|0)==0){h=0}else{var s=ti(q,1,e,0),q=p[e>>2];(s|0)==0?(s=Yi(q),(s|0)!=0?h=s:(vj(q),l[h]=1,h=0)):h=s;vi(q)}}else{h=0}a=e;e=h;if((e|0)!=0){m=e;break a}e=(b+24|0)>>2;h=y[e];var q=b+28|0,s=y[q>>2],u=h>>>0<s>>>0;do{if(u&&l[b+5|0]<<24>>24!=2){var w=((p[si>>2]|0)/(p[f+32]|0)&-1)+1|0;p[e]=s;var v=b+56|0,x=h,A=s;b:for(;;){for(;;){var E=x+1|0;if(E>>>0>A>>>0){break b}if(!((wj(p[v>>2],E)|0)!=0|(E|0)==(w|0))){break}x=E}A=ti(b,E,i,0);if((A|0)!=0){m=A;break a}A=p[i>>2];x=Yi(A);vi(A);if((x|0)!=0){m=x;break a}x=E;A=p[q>>2]}p[e]=h}}while(0);h=xj(b,c);if((h|0)!=0){m=h;break a}h=yj(b,0);if((h|0)!=0){m=h;break a}h=b+176|0;q=Hj(p[h>>2]);q=Ij(b,q);if((q|0)!=0){m=q;break a}Jj(p[h>>2]);e=y[e];if((e|0)!=(p[f+8]|0)&&(e=Kj(b,e-((e|0)==(((p[si>>2]|0)/(p[f+32]|0)&-1)+1|0)&1)|0),(e|0)!=0)){m=e;break a}if((d|0)!=0){break}e=Hi(b);if((e|0)!=0){m=e;break a}}else{e=b+176|0;h=Hj(p[e>>2]);p[g>>2]=0;if((h|0)==0){if(h=ti(b,1,g,0),q=p[g>>2],p[(q+12|0)>>2]=0,(q|0)==0){var J=h,M=0;h=9}else{var D=q,K=q;h=8}}else{D=h,K=0,h=8}h==8&&(J=Lj(b,D,p[f+6],1),M=K);vi(M);if((J|0)!=0){m=J;break a}Jj(p[e>>2])}}else{Mj(p[f+22]),r=b+180|0}}while(0);(uj(p[r>>2])|0)==0&&(l[m]=5)}m=0}else{m=j}}while(0);a=g;return m}Di.X=1;function Ei(b,c,d,e,f){return Gd[p[p[b>>2]+12>>2]](b,c,d,e,f)}function Hi(b){var c=p[b+60>>2];l[b+8|0]<<24>>24==0?b=Nj(c,t[b+12|0]&255):(p[c>>2]|0)==0?b=0:(b=Gd[p[p[c>>2]+40>>2]](c,8,0),b=(b|0)!=12?b:0);return b}function Ii(b,c){var d=b+8|0,e=l[d]<<24>>24==0;do{if(e){var f=0}else{f=b+4|0;li(p[b>>2],p[f>>2]);if(l[d]<<24>>24==2){var f=p[f>>2],g;g=p[f>>2];var h=y[g+40>>2],i=(h|0)==0;a:do{if(i){var j=g+16|0,k=l[j]<<24>>24==2;do{if(k&&l[g+4|0]<<24>>24!=0&&l[g+5|0]<<24>>24==1){l[j]=1;j=0;break a}}while(0);j=Oj(g,t[g+19|0]&255);j=Pj(g,j)}else{j=h}}while(0);g=j;if((g|0)!=0&(c|0)==0){f=g;break}l[f+19|0]=1}Qj(b);f=0}}while(0);return f}function Ji(b,c){var d=l[b+8|0]<<24>>24==2;do{if(d){var e=p[b+4>>2];li(p[b>>2],e);if(l[e+17|0]<<24>>24!=0){var f=Rj(e);if((f|0)!=0){e=f;break}}e=Di(p[e>>2],c,0)}else{e=0}}while(0);return e}function Sj(b){var c,d,e=(b|0)==0;do{if(e){c=0}else{d=(b+24|0)>>2;c=p[d];li(p[c>>2],p[c+4>>2]);c=(b|0)>>2;if((p[c]|0)!=0){var f=p[d]+16|0;p[f>>2]=p[f>>2]-1|0}if((p[b+40>>2]|0)!=0){d=p[p[p[d]+4>>2]>>2]+88|0;var f=p[d>>2],g=(f|0)==(b|0);a:do{if(g){var h=d}else{for(var i=f;;){var i=i+44|0,j=p[i>>2];if((j|0)==(b|0)){h=i;break a}i=j}}}while(0);p[h>>2]=p[b+44>>2]}Tj(p[b+4>>2]);d=p[b+28>>2];d=(d|0)==101?0:d;$h(p[c],d,0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));(p[c]|0)!=0&&Lg(b);c=d}}while(0);return c}Sj.X=1;function Tj(b){var c=a;a+=8;var d=c+4,e=p[b+4>>2];li(p[b>>2],e);var f=Uj(e,0,0);(f|0)!=0&&Vj(b,f);if(l[b+8|0]<<24>>24==2){var g=e|0;Wj(p[g>>2]);if((Xj(e,1,c,0)|0)==0){var f=p[c>>2],h=Xi(p[f+64>>2]+28|0);p[d>>2]=h;(h|0)==0?(p[d>>2]=p[p[g>>2]+24>>2],d=p[d>>2]):d=h;p[(e+44|0)>>2]=d;Yj(f)}l[e+19|0]=1}Qj(b);a=c}function Zj(b){if((b|0)==0){var c=0}else{c=p[b>>2],($j(c)|0)==0?(b=gk(b),c=hk(c,b)):(Qe(62706),c=21)}return c}function $j(b){(b|0)==0?(cf(21,R.Rp|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),b=1):b=0;return b}function gk(b){var c=p[b+52>>2],c=(c|0)==-1108210269||(c|0)==1369188723?ik(b):0;jk(b);return c}function kk(b){var c=b>>2;p[c+22]=-1;p[c+23]=0;l[b+96|0]=2;p[(b+52|0)>>2]=-1108210269;p[c+27]=0;p[c+21]=1;l[b+101|0]=-1;p[c+30]=0;b=b+144|0;p[b>>2]=0;p[b+4>>2]=0}function lk(b){return t[b+30|0]&255}function ok(b){b&=255;return b>>>0>26|(b|0)==2?R.qq|0:p[pk+(b<<2)>>2]}function hk(b,c){if((b|0)==0){var d=255,e=c}else{d=b+30|0,l[d]<<24>>24!=0|(c|0)==3082?($h(b,7,0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),l[d]=0,e=7):e=c,d=p[b+24>>2]}return d&e}function qk(b){if((b|0)==0){b=0}else{var c=ik(b);kk(b);b=hk(p[b>>2],c)}return b}function ik(b){var c,d=b>>2,e=p[d];rk(b);if((p[d+22]|0)>-1){sk(b),c=b+56|0,vf(e,p[c>>2]),p[c>>2]=0,l[b+100|0]<<24>>24!=0&&(l[b+99|0]=1)}else{if(c=p[d+23],(c|0)!=0&&l[b+99|0]<<24>>24!=0){$h(e,c,0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));var f=p[e+212>>2];c=(b+56|0)>>2;ii(f,-1,p[c],1,-1);vf(e,p[c]);p[c]=0}}c=b+56|0;vf(p[b>>2],p[c>>2]);p[c>>2]=0;p[b+20>>2]=0;p[d+13]=649915045;return p[e+24>>2]&p[d+23]}function tk(b){(n[b+28>>1]&9312)<<16>>16!=0&&uk(b);var c=b+36|0;vf(p[b>>2],p[c>>2]);p[b+4>>2]=0;p[c>>2]=0;p[b+32>>2]=0}function vk(b){var c;c=(b+28|0)>>1;(n[c]&18)<<16>>16==0?b=wk(b):(xk(b),n[c]=n[c]&-19|16,b=(p[b+24>>2]|0)==0?0:p[b+4>>2]);return b}function xk(b){var c,d,e;e=(b+28|0)>>1;if((n[e]&16384)<<16>>16==0){b=0}else{d=(b+24|0)>>2;c=(b+16|0)>>2;var f=p[c]+p[d]|0;(yk(b,(f|0)<1?1:f,1)|0)!=0?b=7:(Ed(p[b+4>>2]+p[d]|0,0,p[c]),p[d]=p[d]+p[c]|0,n[e]&=-16897,b=0)}return b}function wk(b){return zk(b,1)}function Ak(b){return Bk(b,1)}function Bk(b,c){var d;d=b+28|0;var e=n[d>>1];if((e&16)<<16>>16==0){if((zk(b,c)|0)==0){var f=0;d=6}else{var g=n[d>>1];d=4}}else{g=e,d=4}d==4&&(f=p[b+24>>2],f=(g&16384)<<16>>16==0?f:p[b+16>>2]+f|0);return f}function Ck(b){return Bk(b,2)}function Dk(b){var c,d=a;a+=8;c=d>>2;var e=Vc[b+28>>1]&65535;(e&8|0)==0?(e&4|0)==0?(e&18|0)==0?b=0:(xd[0]=0,p[c]=C[0],p[c+1]=C[1],Ek(p[b+4>>2],d,p[b+24>>2],l[b+31|0]),b=(C[0]=p[c],C[1]=p[c+1],xd[0])):(b=b+16|0,b=p[b>>2]+p[b+4>>2]*4294967296):(b=b+8|0,b=(C[0]=p[b>>2],C[1]=p[b+4>>2],xd[0]));a=d;return b}function Fk(b){return Gk(b)[0]}function Gk(b){var c,d=a;a+=8;c=d>>2;var e=Vc[b+28>>1]&65535;(e&4|0)==0?(e&8|0)==0?(e&18|0)==0?c=b=0:(p[c]=0,p[c+1]=0,Hk(p[b+4>>2],d,p[b+24>>2],l[b+31|0]),b=p[c+1],c=p[c]):(b=b+8|0,b=(C[0]=p[b>>2],C[1]=p[b+4>>2],xd[0]),c=Ik(b),b=c[1],c=c[0]):(c=b+16|0,b=p[c+4>>2],c=p[c>>2]);a=d;return[c,b]}function Jk(b){b=Gk(b);return[b[0],b[1]]}function zk(b,c){var d,e=(b|0)==0;a:do{if(e){d=0}else{d=(b+28|0)>>1;var f=Vc[d];if((f&1)<<16>>16!=0){d=0}else{var g=(f&65535)>>>3&2|f;n[d]=g;(f&16384)<<16>>16==0?f=g:(xk(b),f=n[d]);d=c&255;if((f&2)<<16>>16==0){Kk(b,d),d&=247}else{f=d&247;Lk(b,f);d=(d&8|0)==0;do{if(!d&&(p[b+4>>2]&1|0)!=0&&(Mk(b)|0)!=0){d=0;break a}}while(0);Nk(b);d=f}d=(t[b+31|0]&255|0)!=(d|0)?0:p[b+4>>2]}}}while(0);return d}zk.X=1;function Ok(b){return zk(b,2)}function Qk(b,c,d,e){Sk(b,c,d,0,e)}function Sk(b,c,d,e,f){(Tk(b+8|0,c,d,e,f)|0)==18&&Uk(b)}function Vk(b,c){Wk(b+8|0,c)}function Wk(b,c){if((c!=c&1|0)==0){tk(b);var d=b+8|0;xd[0]=c;p[d>>2]=C[0];p[d+4>>2]=C[1];n[b+28>>1]=8;l[b+30|0]=2}else{Xk(b)}}function Yk(b,c,d){p[b+52>>2]=1;Tk(b+8|0,c,d,1,-1)}function Tk(b,c,d,e,f){var g=(c|0)==0;do{if(g){Xk(b);var h=0}else{var h=p[b>>2],h=(h|0)==0?1e9:p[h+72>>2],i=e<<24>>24==0,j=i?16:2;if((d|0)<0){var k=e<<24>>24==1;a:do{if(k){for(var m=0;;){if((m|0)>(h|0)){var o=m;break a}if(l[c+m|0]<<24>>24==0){o=m;break a}m=m+1|0}}else{for(m=0;;){if((m|0)>(h|0)){o=m;break a}if((l[c+(m|1)|0]|l[c+m|0])<<24>>24==0){o=m;break a}m=m+2|0}}}while(0);k=j|512;j=o}else{k=j,j=d}if((f|0)==-1){m=(k&512)<<16>>16==0?j:j+(e<<24>>24==1?1:2)|0;if((j|0)>(h|0)){h=18;break}if((yk(b,m,0)|0)!=0){h=7;break}Ah(p[b+4>>2],c,m)}else{m=(f|0)==4,tk(b),p[b+4>>2]=c,m?(p[b+36>>2]=c,p[b+32>>2]=0):(p[b+32>>2]=f,k|=(f|0)==0?2048:1024)}p[b+24>>2]=j;n[b+28>>1]=k;k=i?1:e;l[b+31|0]=k;l[b+30|0]=i?4:3;if(i=k<<24>>24!=1){var i=b,r=fa,k=fa,k=(i+24|0)>>2,m=(p[k]|0)>1;do{if(m){var r=(i+4|0)>>2,q=p[r],s=l[q],q=l[q+1|0];if(s<<24>>24==-1&q<<24>>24==-2){s=2}else{s=s<<24>>24==-2&q<<24>>24==-1;if(!s){r=0;break}s=s?3:0}q=Mk(i);if((q|0)!=0){r=q;break}var u=p[k]-2|0;p[k]=u;var w=p[r],q=w,w=w+2|0;if(w<q&&q<w+u){w+=u;for(q+=u;u--;){q--,w--,l[q]=l[w]}}else{Ah(q,w,u)}l[p[r]+p[k]|0]=0;l[p[r]+p[k]+1|0]=0;n[(i+28|0)>>1]|=512;l[i+31|0]=s}r=0}while(0);i=(r|0)!=0}h=i?7:(j|0)>(h|0)?18:0}}while(0);return h}Tk.X=1;function Zk(b,c){$k(b+8|0,c,(c|0)<0?-1:0)}function $k(b,c,d){tk(b);var e=b+16|0;p[e>>2]=c;p[e+4>>2]=d;n[b+28>>1]=4;l[b+30|0]=1}function al(b,c,d){$k(b+8|0,c,d)}function bl(b){Xk(b+8|0)}function Xk(b){var c;c=(b+28|0)>>1;var d=n[c];if((d&64)<<16>>16!=0){var d=p[b+16>>2],e=p[d>>2]+172|0;p[(d+64|0)>>2]=p[e>>2];p[e>>2]=d;d=n[c]}(d&32)<<16>>16!=0&&(cl(p[b+16>>2]),d=n[c]);n[c]=d&-16640|1;l[b+30|0]=5}function dl(b,c,d,e){Sk(b,c,d,1,e)}function el(b,c){ll(b+8|0,c)}function ll(b,c){var d;d=(b+28|0)>>1;(n[d]&9312)<<16>>16!=0&&uk(b);Ah(b,c,36);var e=n[d],f=e&-1025;n[d]=f;(e&18)<<16>>16!=0&&(n[c+28>>1]&2048)<<16>>16==0&&(n[d]=f|4096,Mk(b))}function ml(b,c){nl(b+8|0,c)}function nl(b,c){tk(b);n[b+28>>1]=16400;l[b+30|0]=4;p[b+24>>2]=0;p[b+16>>2]=(c|0)<0?0:c;l[b+31|0]=1}function ol(b,c){p[b+52>>2]=c;(n[b+36>>1]&1)<<16>>16!=0&&Tk(b+8|0,ok(c),-1,1,0)}function Uk(b){p[b+52>>2]=18;Tk(b+8|0,R.Fa|0,-1,1,0)}function pl(b){var c=b+8|0;Xk(c);p[b+52>>2]=7;l[p[c>>2]+30|0]=1}function ql(b){return p[p[b>>2]+4>>2]}function rl(b){return p[b+8>>2]}function sl(b){return(b|0)==0?0:Vc[b+48>>1]&65535}function tl(b){var c;if((ul(b)|0)==0){for(var d=p[b>>2],e=0;;){var f=vl(b);if((f|0)!=17){c=f;break}f=e+1|0;if((e|0)>=5){c=17;break}var g=b,e=a;a+=4;var h=p[g>>2],i=wl(h,jj(g),-1,0,g,e,0);if((i|0)==0){var i=h=p[e>>2],j=g,k=a;a+=196;for(var m=i>>2,o=k>>2,r=m+49;m<r;m++,o++){p[o]=p[m]}m=j>>2;o=i>>2;for(r=m+49;m<r;m++,o++){p[o]=p[m]}m=k>>2;o=j>>2;for(r=m+49;m<r;m++,o++){p[o]=p[m]}m=i+64|0;o=p[m>>2];r=j+64|0;p[m>>2]=p[r>>2];p[r>>2]=o;m=i+60|0;o=p[m>>2];r=j+60|0;p[m>>2]=p[r>>2];p[r>>2]=o;m=i+160|0;o=p[m>>2];r=j+160|0;p[m>>2]=p[r>>2];p[r>>2]=o;l[j+105|0]=l[i+105|0];a=k;xl(h,g);p[h+92>>2]=0;gk(h);g=0}else{(i|0)==7?(l[h+30|0]=1,g=7):g=i}a=e;e=g;if((e|0)==0){qk(b),e=f}else{if(l[b+105|0]<<24>>24==0){c=e;break}c=p[d+212>>2];if((c|0)==0){c=e;break}f=wk(c);c=(b+56|0)>>2;vf(d,p[c]);if(l[d+30|0]<<24>>24==0){f=yl(d,f);p[c]=f;c=p[b+92>>2]=e;break}p[c]=0;c=p[b+92>>2]=7;break}}b=hk(d,c)}else{Qe(63112),b=21}return b}tl.X=1;function ul(b){(b|0)==0?(cf(21,R.Qp|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),b=1):b=$j(p[b>>2]);return b}function vl(b){var c,d,e,f=a;a+=8;var g;(p[b+52>>2]|0)!=-1108210269&&qk(b);var h=b|0,i=y[h>>2];e=i>>2;if(l[i+30|0]<<24>>24==0){g=b+88|0;d=p[g>>2];(d|0)<1?l[b+99|0]<<24>>24==0?((d|0)<0&&(d=(i+140|0)>>2,(p[d]|0)==0&&(p[e+56]=0),(p[e+40]|0)!=0&&l[i+124|0]<<24>>24==0&&zl(p[e],b+136|0),p[d]=p[d]+1|0,l[b+104|0]<<24>>24==0&&(d=i+144|0,p[d>>2]=p[d>>2]+1|0),p[g>>2]=0),g=17):(p[b+92>>2]=17,c=1,g=30):g=17;if(g==17){l[b+97|0]<<24>>24==0?(c=(i+148|0)>>2,p[c]=p[c]+1|0,g=Al(b),p[c]=p[c]-1|0,c=g):c=Bl(b);if((c|0)==100){i=100}else{g=i+160|0;if((p[g>>2]|0)!=0&&l[i+124|0]<<24>>24==0){var j=b+160|0;if((p[j>>2]|0)!=0){zl(p[e],f);g=p[g>>2];d=p[e+41];var j=p[j>>2],k=b+136|0,k=(T.b(p[f>>2],p[f+4>>2],p[k>>2],p[k+4>>2]),T.result[0]),k=(T.multiply(k,T.result[1],1e6,0),T.result[0]);Gd[g](d,j,k,T.result[1])}}if((c|0)!=101){i=c}else{c=i+4|0;g=(p[c>>2]|0)>0;a:do{if(g){d=i+8|0;for(var j=i+192|0,k=i+196|0,m=0,o=0;;){var r=p[p[d>>2]+(o<<4)+4>>2];if((r|0)!=0){r=p[p[p[r+4>>2]>>2]+180>>2];if((r|0)==0){r=0}else{var r=r+12|0,q=p[r>>2];p[r>>2]=0;r=q}q=p[j>>2];m=(q|0)!=0&(r|0)>0&(m|0)==0?Gd[q](p[k>>2],i,p[p[d>>2]+(o<<4)>>2],r):m}o=o+1|0;if((o|0)>=(p[c>>2]|0)){var s=m;break a}}}else{s=0}}while(0);i=s;p[b+92>>2]=i;i=(i|0)==0?101:1}}p[e+5]=i;s=b+92|0;(hk(p[h>>2],p[s>>2])|0)==7&&(p[s>>2]=7);c=i}b=l[b+105|0]<<24>>24==0?c:(c-100|0)>>>0>1?sk(b):c;e=p[e+6]&b}else{e=p[b+92>>2]=7}a=f;return e}vl.X=1;function vf(b,c){var d;if((b|0)==0){d=6}else{var e=b+500|0;(p[e>>2]|0)==0?(Cl(b,c)|0)==0?d=6:(d=b+256|0,p[c>>2]=p[d>>2],p[d>>2]=c,d=b+236|0,p[d>>2]=p[d>>2]-1|0,d=7):(d=Dl(b,c),e=p[e>>2],p[e>>2]=p[e>>2]+d|0,d=7)}d==6&&Lg(c)}function yl(b,c){if((c|0)==0){var d=0}else{var d=ve(c)+1|0,e=zh(b,d);(e|0)==0?d=0:(Ah(e,c,d),d=e)}return d}function El(b,c){var d,e=p[b+48>>2];d=(e+28|0)>>1;(n[d]&8192)<<16>>16==0?(c|0)<1?(uk(e),n[d]=1,d=e+4|0,p[d>>2]=0):(yk(e,c,0),n[d]=8192,p[(e+16|0)>>2]=p[b>>2],d=e+4|0,e=p[d>>2],(e|0)!=0&&Ed(e,0,c)):d=e+4|0;return p[d>>2]}function uk(b){var c=Vc[b+28>>1]&65535,d=(c&8192|0)==0;a:do{if(d){var e=(c&1024|0)==0;do{if(!e){var f=b+32|0,g=p[f>>2];if((g|0)!=0){Gd[g](p[b+4>>2]);p[f>>2]=0;break a}}}while(0);(c&32|0)==0?(c&64|0)!=0&&Xk(b):cl(p[b+16>>2])}else{Fl(b,p[b+16>>2]),tk(b)}}while(0)}function yk(b,c,d){var e,f,g,h=(c|0)<32?32:c;f=(b|0)>>2;var i=p[f],c=(b+36|0)>>2,i=(Dl(i,p[c])|0)<(h|0),d=(d|0)==0;a:do{if(i){do{if(!d){g=b+4|0;var j=p[g>>2],k=p[c];if((j|0)!=(k|0)){g=k;break}e=Gl(p[f],j,h);p[c]=e;p[g>>2]=e;e=g;e>>=2;g=10;break a}g=p[c]}while(0);vf(p[f],g);g=zh(p[f],h);p[c]=g}g=7}while(0);g==7&&(e=b+4|0,f=p[e>>2],(f|0)==0|d||(d=p[c],(d|0)==0|(f|0)==(d|0)||Ah(d,f,p[b+24>>2])),e>>=2);d=(b+28|0)>>1;if((n[d]&1024)<<16>>16!=0&&(f=p[b+32>>2],(f|0)!=0)){Gd[f](p[e])}c=p[c];p[e]=c;n[d]=(c|0)==0?1:n[d]&-6145;p[b+32>>2]=0;return(p[e]|0)!=0?0:7}yk.X=1;function Hl(b,c,d,e){var f,g=(c|0)<0;do{if(g){f=10}else{var h=b+4|0,i=p[h>>2];if((i|0)==0){var j=0;f=4}else{if(f=p[i+4>>2],(f|0)>(c|0)){var k=i;f=6}else{j=f,f=4}}if(f==4){i=k=Il(p[b+8>>2],i,(c<<3)+16|0);if((k|0)==0){f=10;break}p[h>>2]=i;h=c+1|0;Ed((j<<3)+k+8|0,0,h-j<<3);p[(k+4|0)>>2]=h;p[k>>2]=p[b>>2];k=i}h=(c<<3)+k+8|0;i=p[h>>2];f=(c<<3)+k+12|0;if((i|0)!=0){var m=p[f>>2];if((m|0)!=0){Gd[m](i)}}p[h>>2]=d;p[f>>2]=e;f=12}}while(0);if(f==10&&(e|0)!=0){Gd[e](d)}}Hl.X=1;function Il(b,c,d){var e=b+30|0;l[e]<<24>>24==0?(c|0)==0?b=zh(b,d):(Cl(b,c)|0)==0?(b=dh(c,d),(b|0)==0&&(l[e]=1,b=0)):(e=b+232|0,(Vc[e>>1]&65535|0)<(d|0)?(d=zh(b,d),(d|0)==0?b=0:(Ah(d,c,Vc[e>>1]&65535),vf(b,c),b=d)):b=c):b=0;return b}function Jl(b,c){var d=(b|0)==0;a:do{if(d){var e=Kl}else{var e=y[b+20>>2],f=(e|0)==0;do{if(!f&&(Vc[b+48>>1]&65535|0)>(c|0)&(c|0)>-1){e=e+c*40|0;break a}}while(0);e=p[b>>2];(e|0)!=0&&$h(e,25,0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));e=Kl}}while(0);return e}function Ll(b){if((b|0)!=0){var c=b+92|0,b=hk(p[b>>2],p[c>>2]);p[c>>2]=b}}function Ml(b,c){var d=Jl(b,c),d=wk(d);Ll(b);return d}function Nl(b,c){var d=Jl(b,c),d=lk(d);Ll(b);return d}function Ol(b,c){return Pl(b,c,6,0)}function Ql(b){var c=Vc[b+28>>1]&65535;l[b+30|0]=(c&1|0)==0?(c&4|0)==0?(c&8|0)==0?(c&2|0)==0?4:3:2:1:5}function Pl(b,c,d,e){var f=sl(b),g=(f|0)>(c|0)&(c|0)>-1;do{if(g){var h=p[b>>2],i=Gd[d](p[b+16>>2]+(f*e+c)*40|0),h=h+30|0;if(l[h]<<24>>24==0){break}l[h]=0}i=0}while(0);return i}function Rl(b,c,d,e,f){return Yl(b,c,d,e,f,0)}function Yl(b,c,d,e,f,g){var h=$l(b,c);if((h|0)==0){(d|0)==0?g=0:(c=p[b+72>>2]+(c-1)*40|0,d=Tk(c,d,e,g,f),b>>=2,g=(d|0)!=0|g<<24>>24==0?d:Lk(c,t[p[p[p[b]+8>>2]+12>>2]+77|0]&255),$h(p[b],g,0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),g=hk(p[b],g))}else{if(!((f|0)==-1||(f|0)==0)){Gd[f](d)}g=h}return g}function am(b,c,d){var e=$l(b,c);(e|0)==0&&Wk(p[b+72>>2]+(c-1)*40|0,d);return e}function $l(b,c){var d=(ul(b)|0)==0;a:do{if(d){var e=(p[b+52>>2]|0)==-1108210269;do{if(e&&(p[b+88>>2]|0)<=-1){d=(c|0)<1;do{if(!d&&(n[b+80>>1]<<16>>16|0)>=(c|0)){d=c-1|0;e=p[b+72>>2];tk(e+d*40|0);n[(e+28>>1)+(d*20|0)]=1;$h(p[b>>2],0,0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));if(l[b+105|0]<<24>>24==0){e=0;break a}e=p[b+180>>2];if((d|0)<32){if(!((e&1<<d|0)!=0|(e|0)==-1)){e=0;break a}}else{if((e|0)!=-1){e=0;break a}}l[b+99|0]=1;e=0;break a}}while(0);$h(p[b>>2],25,0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));e=25;break a}}while(0);$h(p[b>>2],21,0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));e=p[b+160>>2];cf(21,R.al|0,(z=a,a+=4,p[z>>2]=e,z));Qe(63628)}else{Qe(63620)}e=21}while(0);return e}$l.X=1;function gm(b,c,d,e){var f=$l(b,c);(f|0)==0&&$k(p[b+72>>2]+(c-1)*40|0,d,e);return f}function hm(b,c,d){var e=$l(b,c);(e|0)==0&&nl(p[b+72>>2]+(c-1)*40|0,d);return e}function im(b,c,d){var e=(b|0)==0|(c|0)==0;a:do{if(e){var f=0}else{var f=n[b+82>>1]<<16>>16,g=b+76|0,h=0;b:for(;;){if((h|0)>=(f|0)){f=0;break a}var i=p[p[g>>2]+(h<<2)>>2],j=(i|0)==0;do{if(!j&&(jm(i,c,d)|0)==0&&l[i+d|0]<<24>>24==0){break b}}while(0);h=h+1|0}f=h+1|0}}while(0);return f}function xl(b,c){var d=b+80|0,e=n[d>>1]<<16>>16>0;a:do{if(e){for(var f=c+72|0,g=b+72|0,h=0;;){if(km(p[f>>2]+h*40|0,p[g>>2]+h*40|0),h=h+1|0,(h|0)>=(n[d>>1]<<16>>16|0)){break a}}}}while(0)}function lm(b){var c=b+30|0,d=l[c];d<<24>>24==3?(mm(b),Ql(b),b=l[c]):b=d;return b&255}function mm(b){var c,d=a;a+=16;var e=d+8;c=(b+28|0)>>1;var f=Vc[c]&65535;if((f&12|0)==0){var g=l[b+31|0];if((f&2|0)!=0){var f=b+4|0,h=b+24|0;(Ek(p[f>>2],d,p[h>>2],g)|0)!=0&&((Hk(p[f>>2],e,p[h>>2],g)|0)==0?(g=p[e+4>>2],b=b+16|0,p[b>>2]=p[e>>2],p[b+4>>2]=g,n[c]|=4):(e=(C[0]=p[d>>2],C[1]=p[d+4>>2],xd[0]),b=b+8|0,xd[0]=e,p[b>>2]=C[0],p[b+4>>2]=C[1],n[c]|=8))}}a=d}function qm(b,c){for(var d=c,e=b;;){var f=t[e];if(f<<24>>24==0){var g=0,h=l[R.i+(t[d]&255)|0];break}var f=t[R.i+(f&255)|0],i=t[R.i+(t[d]&255)|0];if(f<<24>>24!=i<<24>>24){g=f&255;h=i;break}d=d+1|0;e=e+1|0}return g-(h&255)|0}function rm(b,c){var d=(c|0)==0;a:do{if(d){var e=-1e6}else{for(var f=b+8|0,g=p[b+4>>2],h=0;;){if((h|0)>=(g|0)){e=h;break a}if((p[p[f>>2]+(h<<4)+12>>2]|0)==(c|0)){e=h;break a}h=h+1|0}}}while(0);return e}function sm(b,c,d){y[b+28>>2]>>>0>c>>>0&&(p[(p[b+4>>2]+c*20+4|0)>>2]=d)}function tm(b,c,d){y[b+28>>2]>>>0>c>>>0&&(p[(p[b+4>>2]+c*20+8|0)>>2]=d)}function um(b,c,d){y[b+28>>2]>>>0>c>>>0&&(p[(p[b+4>>2]+c*20+12|0)>>2]=d)}function vm(b,c){p[(b+112|0)>>2]|=1<<c}function wm(b,c,d,e,f,g,h,i){var j,k,m,o,r,q,s=a;a+=4;var u;q=s>>2;p[q]=0;var w=(h|0)!=0,v=w&1;p[i>>2]=0;var h=ni(b,28),x=(h|0)!=0;a:do{if(x){var A=zh(b,556);u=A;if((A|0)==0){var E=u;u=37}else{var J=A,M=b+12|0,D=h+20|0,K=h,H=h+12|0,N=h+24|0,Q=b+30|0,P=w?3:4,L=w?4:3,I=A+456|0,X=A+72|0,Y=A+68|0,da=1,ga=0;o=0;b:for(;;){Ed(A,0,556);p[J>>2]=b;vf(b,o);p[q]=0;Ce(b);var ha=xm(u,0,d,c);r=ha>>2;if((ha|0)==0){break}if((l[ha+34|0]&16)<<24>>24!=0){ym(u,R.In|0,(z=a,a+=4,p[z>>2]=d,z));break}if((p[r+7]|0)!=0){ym(u,R.Op|0,(z=a,a+=4,p[z>>2]=d,z));break}var ba=ha+12|0;o=(ha+8|0)>>2;for(var ea=p[o],ja=0;;){if((ja|0)>=(ea|0)){break}if((qm(p[(p[ba>>2]>>2)+(ja*6|0)],e)|0)==0){break}ja=ja+1|0}if((ja|0)==(ea|0)){vf(b,0);c=zm(b,R.Nq|0,(z=a,a+=4,p[z>>2]=e,z));p[q]=c;j=u;var ra=1;u=39;break a}do{if(w){ba=(p[M>>2]&67108864|0)==0;c:do{if(ba){var Va=0}else{if(k=p[r+9],(k|0)==0){Va=0}else{ea=0;for(k>>=2;;){m=p[k+5];var ta=(m|0)>0;d:do{if(ta){for(var xa=ea,Fa=0;;){if(xa=(p[((Fa<<3)+36>>2)+k]|0)==(ja|0)?R.Wc|0:xa,Fa=Fa+1|0,(Fa|0)>=(m|0)){var Na=xa;break d}}}else{Na=ea}}while(0);k=p[k+1];if((k|0)==0){Va=Na;break c}ea=Na;k>>=2}}}}while(0);ba=p[r+4];ea=(ba|0)==0;c:do{if(ea){var Ea=Va}else{k=Va;m=ba;for(m>>=2;;){ta=p[m+1];xa=(ta|0)>0;d:do{if(xa){for(var Fa=p[m+2],La=k,za=0;;){if(La=(p[Fa+(za<<2)>>2]|0)==(ja|0)?R.fd|0:La,za=za+1|0,(za|0)>=(ta|0)){var Ba=La;break d}}}else{Ba=k}}while(0);m=p[m+8];if((m|0)==0){Ea=Ba;break c}k=Ba;m>>=2}}}while(0);if((Ea|0)!=0){vf(b,0);c=zm(b,R.qd|0,(z=a,a+=4,p[z>>2]=Ea,z));p[q]=c;j=u;ra=1;u=39;break a}}}while(0);ba=Am(b);p[D>>2]=ba;(ba|0)!=0&&(k=(ha+68|0)>>2,ea=rm(b,p[k]),Bm(ba,12,Cm|0),sm(ba,0,ea),tm(ba,0,v),sm(ba,1,ea),tm(ba,1,p[p[k]>>2]),um(ba,1,p[p[k]+4>>2]),vm(ba,ea),sm(ba,2,ea),ha=ha+20|0,tm(ba,2,p[ha>>2]),um(ba,2,v),Dm(ba,2,p[r],0),Em(ba,P),tm(ba,L,p[ha>>2]),um(ba,L,ea),Dm(ba,L,p[o]+1|0,-14),tm(ba,7,p[o]),l[Q]<<24>>24==0&&(p[I>>2]=1,p[X>>2]=1,p[Y>>2]=1,Fm(ba,u)));p[K>>2]=v;p[H>>2]=ja;p[N>>2]=b;o=l[Q]<<24>>24==0;do{if(o){gm(p[D>>2],1,f,g);ga=Gm(h,f,g,s);if(!((da|0)<5&(ga|0)==17)){r=ga;break}da=da+1|0;o=p[q];continue b}r=ga}while(0);if((r|0)==0){E=u;u=37;break a}j=u;ra=r;u=39;break a}j=(A+8|0)>>2;(p[j]|0)!=0&&(vf(b,0),p[q]=p[j],p[j]=0);j=u;ra=1;u=39}}else{E=0,u=37}}while(0);if(u==37){if(l[b+30|0]<<24>>24!=0){j=E,ra=0,u=39}else{p[i>>2]=h;var Ja=E,ka=0;u=43}}u==39&&(x&&(Ja=p[h+20>>2],(Ja|0)!=0&&gk(Ja)),vf(b,h),Ja=j,ka=ra);q=p[q];$h(b,ka,(q|0)!=0?R.d|0:0,(z=a,a+=4,p[z>>2]=q,z));vf(b,q);vf(b,Ja);b=hk(b,ka);a=s;return b}wm.X=1;function ni(b,c){var d=zh(b,c);(d|0)!=0&&Ed(d,0,c);return d}function zh(b,c){var d,e=(b|0)!=0;if(e){if(l[b+30|0]<<24>>24!=0){var f=0;d=13}else{if(l[b+234|0]<<24>>24==0){d=11}else{if((Vc[b+232>>1]&65535|0)<(c|0)){d=b+248|0,p[d>>2]=p[d>>2]+1|0,d=11}else{var g=b+256|0;d=y[g>>2];(d|0)==0?(d=b+252|0,p[d>>2]=p[d>>2]+1|0,d=11):(p[g>>2]=p[d>>2],g=b+236|0,f=p[g>>2]+1|0,p[g>>2]=f,g=b+244|0,p[g>>2]=p[g>>2]+1|0,g=b+240|0,(f|0)>(p[g>>2]|0)&&(p[g>>2]=f),f=d,d=13)}}}}else{d=11}d==11&&(d=bh(c),(d|0)!=0|e^1||(l[b+30|0]=1),f=d);return f}zh.X=1;function xm(b,c,d,e){if((Hm(b)|0)==0){var f=Im(p[b>>2],d,e);(f|0)==0&&(c=(c|0)!=0?R.Xk|0:R.Yk|0,(e|0)==0?ym(b,R.ub|0,(z=a,a+=8,p[z>>2]=c,p[z+4>>2]=d,z)):ym(b,R.tb|0,(z=a,a+=12,p[z>>2]=c,p[z+4>>2]=e,p[z+8>>2]=d,z)),l[b+17|0]=1);b=f}else{b=0}return b}function ym(b,c){var d=a;a+=4;var e=p[b>>2];p[d>>2]=arguments[ym.length];var f=ji(e,c,p[d>>2]);if(l[e+33|0]<<24>>24==0){var g=b+64|0;p[g>>2]=p[g>>2]+1|0;g=b+8|0;vf(e,p[g>>2]);p[g>>2]=f;p[b+4>>2]=1}else{vf(e,f)}a=d}function zm(b,c){var d=a;a+=4;p[d>>2]=arguments[zm.length];var e=ji(b,c,p[d>>2]);a=d;return e}function Am(b){var c,d=ni(b,196);c=d>>2;if((d|0)==0){c=0}else{p[c]=b;var b=(b+136|0)>>2,e=p[b];(e|0)==0?e=0:(p[(e+60|0)>>2]=d,e=p[b]);p[c+16]=e;p[c+15]=0;p[b]=d;p[c+13]=649915045;c=d}return c}function Bm(b,c,d){var e,f,g;f=(b+28|0)>>2;var h=p[f];if((h+c|0)>(p[b+32>>2]|0)){if((Jm(b)|0)!=0){var i=0;g=12}else{var j=p[f];g=4}}else{j=h,g=4}do{if(g==4){if((c|0)>0){for(var i=b+4|0,k=0,h=d;;){g=l[h+2|0];var m=g<<24>>24,o=k+j|0,r=y[i>>2];e=r>>2;var q=t[h|0];l[r+o*20|0]=q;p[e+(o*5|0)+1]=l[h+1|0]<<24>>24;g<<24>>24<0?(l[R.wc+(q&255)|0]&1)<<24>>24==0?g=9:(p[e+(o*5|0)+2]=j+(m^-1)|0,g=10):g=9;g==9&&(p[e+(o*5|0)+2]=m);p[e+(o*5|0)+3]=l[h+3|0]<<24>>24;l[r+o*20+1|0]=0;p[e+(o*5|0)+4]=0;l[r+o*20+3|0]=0;e=k+1|0;if((e|0)==(c|0)){break}k=e;h=h+4|0}p[f]=p[f]+c|0}i=j}}while(0);return i}Bm.X=1;function Dm(b,c,d,e){var f,g,h;g=(b|0)>>2;var i=p[g],j=p[b+4>>2],k=(j|0)==0;do{if(k){h=3}else{if(l[i+30|0]<<24>>24!=0){h=3}else{var m=(c|0)<0?p[b+28>>2]-1|0:c;h=j+m*20+1|0;m=j+m*20+16|0;Km(i,l[h]<<24>>24,p[m>>2]);f=(m|0)>>2;p[f]=0;if((e|0)==-14){p[f]=d,l[h]=-14}else{if((d|0)==0){p[f]=0,l[h]=0}else{if((e|0)==-6){var m=Vc[d+6>>1]&65535,o=(m<<2)+12|0,r=zh(0,o+m|0);p[f]=r;if((r|0)==0){l[p[g]+30|0]=1;l[h]=0;h=24;break}Ah(r,d,o);f=r+8|0;o=p[f>>2];(o|0)!=0&&(r=(m<<2)+r+12|0,p[f>>2]=r,Ah(r,o,m));l[h]=-6}else{if((e|0)==-16){p[f]=d,l[h]=-6}else{if((e|0)==-10){p[f]=d,l[h]=-10,Lm(d)}else{if((e|0)<0){p[f]=d;l[h]=e&255;h=24;break}m=Mm(p[g],d,(e|0)==0?ve(d):e);p[f]=m;l[h]=-1}}}}}h=24}}}while(0);h==3&&!((e|0)==-6||(e|0)==-10)&&Km(i,e,d)}Dm.X=1;function Em(b,c){var d=p[b+4>>2];(d|0)!=0&&(Km(p[b>>2],l[d+c*20+1|0]<<24>>24,p[(d+16>>2)+(c*5|0)]),d=d+c*20|0,Ed(d,0,20),l[d]=-107)}function Nm(b){var c=(b|0)==0;a:do{if(!c){for(var d=b;;){if(l[d+99|0]=1,d=p[d+64>>2],(d|0)==0){break a}}}}while(0)}function Fm(b,c){var d,e,f,g,h=c>>2,i=a;a+=12;var j=i+4;g=j>>2;var k=i+8,m=p[b>>2],o=p[h+114],r=p[h+18],q=y[h+17];p[i>>2]=p[h+106];var h=p[h+20],s=(h|0)==0?1:h,h=q+r|0,r=p[b+4>>2];f=r+p[b+28>>2]*20|0;p[g]=f;var u=r+p[b+32>>2]*20|0;Pm(b,i);l[b+103|0]=(l[c+348|0]<<24>>24==0?0:l[c+349|0]<<24>>24!=0)&1;r=c+480|0;h=l[r]<<24>>24!=0&(h|0)<10?10:h;Ed(f,0,u-f|0);p[g]=f+(f&7)|0;l[b+99|0]=0;f=(b+8|0)>>2;var w=h*40|0;e=(b+72|0)>>2;var v=o*40|0,x=b+12|0,A=p[i>>2]<<2;d=(b+76|0)>>2;for(var E=o<<2,J=b+68|0,M=q<<2,D=b+192|0,K=b+164|0,H=m+30|0;;){p[k>>2]=0;var N=Qm(p[f],w,j,u,k);p[f]=N;N=Qm(p[e],v,j,u,k);p[e]=N;N=Qm(p[x>>2],A,j,u,k);p[x>>2]=N;N=Qm(p[d],E,j,u,k);p[d]=N;N=Qm(p[J>>2],M,j,u,k);p[J>>2]=N;u=Qm(p[D>>2],s,j,u,k);p[D>>2]=u;u=p[k>>2];if((u|0)==0){p[g]=p[K>>2];break}N=ni(m,u);p[K>>2]=N;p[g]=N;if(l[H]<<24>>24!=0){break}u=N+u|0}n[b+50>>1]=q&65535;p[b+188>>2]=s;g=p[e];j=(g|0)==0;a:do{if(!j&&(n[b+80>>1]=o&65535,(o|0)>0)){k=0;for(q=g;;){n[(q+28>>1)+(k*20|0)]=1;p[(p[e]+k*40|0)>>2]=m;k=k+1|0;if((k|0)==(o|0)){break a}q=p[e]}}}while(0);o=p[d];(o|0)!=0&&(g=c+460|0,j=p[g>>2]&65535,n[b+82>>1]=j,k=c+464|0,Ah(o,p[k>>2],j<<16>>16<<2),Ed(p[k>>2],0,p[g>>2]<<2));o=p[f];g=(o|0)==0;a:do{if(!g&&(q=o-40|0,p[f]=q,p[b+24>>2]=h,(h|0)>=1)){j=h+1|0;for(k=1;;){n[(q+28>>1)+(k*20|0)]=128;p[(p[f]+k*40|0)>>2]=m;k=k+1|0;if((k|0)==(j|0)){break a}q=p[f]}}}while(0);l[b+97|0]=l[r];kk(b);a=i}Fm.X=1;function Gm(b,c,d,e){var f=b>>2,b=(b+20|0)>>2,g=p[b],h=p[g+72>>2]+16|0;p[(h|0)>>2]=c;p[(h+4|0)>>2]=d;h=tl(p[b]);(h|0)==100?(c=y[f+3],d=g+68|0,g=y[p[d>>2]>>2],h=y[p[g+84>>2]+(c<<2)>>2],h>>>0<12?(c=(h|0)==0?R.kb|0:(h|0)==7?R.ib|0:R.hb|0,f=zm(p[f+6],R.Zk|0,(z=a,a+=4,p[z>>2]=c,z)),Zj(p[b]),p[b]=0,b=1):(p[f+2]=p[p[g+88>>2]+(c<<2)>>2],p[f+1]=Rm(h),b=p[p[p[d>>2]>>2]>>2],p[f+4]=b,Sm(b),l[b+84|0]=1,b=f=0)):(g=p[b],(g|0)==0?(f=0,b=h):(g=Zj(g),p[b]=0,f=p[f+6],(g|0)==0?(f=zm(f,R.$k|0,(z=a,a+=8,p[z>>2]=c,p[z+4>>2]=d,z)),b=1):(b=Tm(f),f=zm(f,R.d|0,(z=a,a+=4,p[z>>2]=b,z)),b=g)));p[e>>2]=f;return b}Gm.X=1;function Um(b,c,d,e,f){var g;g=b>>2;if((b|0)==0){Qe(71409);var h=21}else{var h=p[g+6],b=b+20|0,i=p[b>>2];if((e|d|0)<0){c=5}else{if((e+d|0)>(p[g+1]|0)){c=5}else{if((i|0)==0){var j=4}else{j=Gd[f](p[g+4],p[g+2]+e|0,d,c),(j|0)==4?(gk(i),p[b>>2]=0,j=4):(p[(h+20|0)>>2]=j,p[(i+92|0)>>2]=j)}c=10}}c==5&&($h(h,1,0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),j=1);h=hk(h,j)}return h}function Vm(b,c,d,e){var f=t[b+79|0],g=f<<24>>24==0;do{if(g){var h=4}else{if((f&255)>1&&(h=Wm(b),(h|0)!=0)){break}h=Xm(b,c,d,e,0)}}while(0);return h}function Ym(b,c,d,e,f){var g,h=a;a+=8;var i,j=h+4;g=j>>2;p[g]=0;var k=(Zm(b)|0)==0;do{if(k){Qe(90712);var m=21}else{var o=(c|0)==0?xh|0:c;$h(b,0,0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));var m=(d|0)==0,r=b+12|0,q=0,s=0;a:for(;;){var u=q,q=s;b:for(;;){if((q|0)==0){var w=u;i=7}else{if((q|0)==17){if(i=u+1|0,(i|0)<2){w=i,i=7}else{var v=17;i=34}}else{v=q,i=34}}do{if(i==7){if(l[o]<<24>>24==0){v=q}else{p[g]=0;q=$m(b,o,-1,j,h);if((q|0)==0){break b}u=w;continue b}}}while(0);var x=v,A=0,E=p[g];i=35;break a}var J=p[g];if((J|0)==0){o=p[h>>2],q=w,s=0}else{var u=sl(J),q=u<<3|1,s=(u|0)>0,M=0,D=0,K=0,H=J;b:for(;;){J=tl(H);c:do{if(!m){do{if((J|0)==100){if((D|0)==0){i=17}else{var N=K,Q=D;i=21}}else{if((J|0)==101){if((D|0)!=0){var P=K,L=H;break b}if((p[r>>2]&8192|0)==0){var I=M,X=0,Y=K,da=H;break c}i=17}else{I=M;X=D;Y=K;da=H;break c}}}while(0);do{if(i==17){i=D=ni(b,q);if((D|0)==0){x=J;A=i;E=H;i=35;break a}d:do{if(s){for(D=0;;){if(K=Ol(H,D),p[((D<<2)+i|0)>>2]=K,D=D+1|0,(D|0)==(u|0)){break d}}}}while(0);if((J|0)==100){N=i,Q=1,i=21}else{var ga=M,ha=i,ba=1;i=27}}}while(0);d:do{if(i==21){M=(u<<2)+N|0;for(H=0;;){if((H|0)>=(u|0)){ga=M;ha=N;ba=Q;break d}D=Ml(p[g],H);p[((H+u<<2)+N|0)>>2]=D;if((D|0)==0){var ea=y[g];if((Nl(ea,H)|0)!=5){break}}H=H+1|0}l[b+30|0]=1;x=J;A=N;E=ea;i=35;break a}}while(0);H=Gd[d](e,u,ga,ha);M=p[g];if((H|0)==0){I=ga;X=ba;Y=ha;da=M;break}gk(M);p[g]=0;$h(b,4,0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));var ja=ha,ra=4;i=37;break a}I=M;X=D;Y=K;da=H}while(0);if((J|0)!=100){P=Y;L=da;break}M=I;D=X;K=Y;H=da}u=gk(L);p[g]=0;q=(u|0)==17;b:do{if(q){var Va=o,ta=w}else{if(s=y[h>>2],(l[R.e+(t[s]&255)|0]&1)<<24>>24==0){Va=s,ta=0}else{for(;;){if(s=s+1|0,(l[R.e+(t[s]&255)|0]&1)<<24>>24==0){Va=s;ta=0;break b}}}}}while(0);vf(b,P);o=Va;q=ta;s=u}}i==35&&((E|0)!=0&&gk(E),ja=A,ra=x);vf(b,ja);m=hk(b,ra);if((m|0)==0){if((f|0)==0){m=0;break}}else{if(r=an(b),o=(f|0)==0,(m|0)!=(r|0)|o){if(o){break}}else{c=Tm(b);c=ve(c)+1|0;d=bh(c);p[f>>2]=d;if((d|0)==0){$h(b,7,0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));m=7;break}b=Tm(b);Ah(d,b,c);break}}p[f>>2]=0}}while(0);a=h;return m}Module._sqlite3_exec=Ym;Ym.X=1;function Zm(b){(b|0)==0?(bn(R.V|0),b=0):(b=p[b+56>>2],(b|0)==-1607883113?b=1:((cn(b)|0)!=0&&bn(R.Wk|0),b=0));return b}function $m(b,c,d,e,f){return wl(b,c,d,0,0,e,f)}function an(b){(b|0)==0?b=7:(cn(p[b+56>>2])|0)==0?(Qe(113832),b=21):b=l[b+30|0]<<24>>24!=0?7:p[b+24>>2]&p[b+20>>2];return b}function Tm(b){if((b|0)==0){b=ok(7)}else{if((cn(p[b+56>>2])|0)==0){Qe(113763),b=ok(21)}else{if(l[b+30|0]<<24>>24==0){var c=wk(p[b+212>>2]),b=(c|0)!=0?c:ok(p[b+20>>2])}else{b=ok(7)}}}return b}function dn(b,c,d,e){var f,g,h;g=e>>2;var i=a;a+=4;h=i>>2;f=p[b>>2];p[h]=0;var j=ve(c),k=j+300|0,m=(e|0)!=0;m&&(p[g]=0);(p[b+12>>2]&536870912|0)==0?(m&&(d=Bh(R.mb|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),p[g]=d),d=1):(e=(d|0)==0?R.Sk|0:d,d=Gd[p[f+40>>2]](f,c),(d|0)==0?(m&&(d=Kg(k),p[h]=d,p[g]=d,(d|0)!=0&&(Ch(k,d,R.Tk|0,(z=a,a+=4,p[z>>2]=c,z)),Gd[p[f+44>>2]](f,j+299|0,p[h]))),d=1):(j=Gd[p[f+48>>2]](f,d,e),(j|0)==0?(m&&(b=ve(e)+k|0,k=Kg(b),p[h]=k,p[g]=k,(k|0)!=0&&(Ch(b,k,R.Uk|0,(z=a,a+=8,p[z>>2]=e,p[z+4>>2]=c,z)),Gd[p[f+44>>2]](f,b-1|0,p[h])),Gd[p[f+52>>2]](f,d)),d=1):(Gd[j](b,i,jn)|0)==0?(g=(b+128|0)>>2,h=ni(b,(p[g]<<2)+4|0),(h|0)==0?d=7:(c=p[g],f=(b+132|0)>>2,(c|0)>0&&Ah(h,p[f],c<<2),vf(b,p[f]),p[f]=h,f=p[g],p[g]=f+1|0,p[((f<<2)+h|0)>>2]=d,d=0)):(m&&(b=p[h],b=Bh(R.Vk|0,(z=a,a+=4,p[z>>2]=b,z)),p[g]=b),Lg(p[h]),Gd[p[f+52>>2]](f,d),d=1)));a=i;return d}dn.X=1;function wl(b,c,d,e,f,g,h){p[g>>2]=0;if((Zm(b)|0)==0){Qe(94167),b=21}else{Ce(b);var i=nn(b,c,d,e,f,g,h);(i|0)!=17?b=i:(Zj(p[g>>2]),b=nn(b,c,d,e,f,g,h))}return b}function sn(b,c,d,e,f,g){var h=a;a+=4;p[h>>2]=0;p[f>>2]=0;if((Zm(b)|0)==0){Qe(94275),b=21}else{d=tn(b,c,d);e=(d|0)==0?0:wl(b,d,-1,e,0,f,h);f=p[h>>2];if(!((f|0)==0|(g|0)==0)){var f=un(d,f-d|0),i=(f|0)>0;a:do{if(i){for(var j=c,k=0;;){if(j=(((t[j+1|0]&255)<<8|t[j]&255)-55296|0)>>>0<2048?j+4|0:j+2|0,k=k+1|0,(k|0)==(f|0)){var m=j;break a}}}else{m=c}}while(0);p[g>>2]=c+(m-c|0)|0}vf(b,d);b=hk(b,e)}a=h;return b}function vn(b,c,d,e,f,g){var h,i,j,k=a;a+=28;p[d>>2]=0;var m=(f|0)!=0;m&&(p[f>>2]=0);var o=(e|0)!=0;o&&(p[e>>2]=0);var r=(g|0)!=0;r&&(p[g>>2]=0);j=(k+4|0)>>2;p[j]=0;var q=k+12|0;p[q>>2]=0;var s=k+16|0;p[s>>2]=0;i=(k+20|0)>>2;p[i]=1;var u=k+8|0;p[u>>2]=20;var w=k+24|0;p[w>>2]=0;var v=Kg(80);h=(k|0)>>2;p[h]=v;var x=(v|0)==0;do{if(x){var A=p[b+20>>2]=7}else{if(p[v>>2]=0,A=Ym(b,c,14,k,g),p[p[h]>>2]=p[i],(A&255|0)==4){wn(p[h]+4|0),A=p[j],(A|0)!=0&&(r&&(Lg(p[g>>2]),A=p[j],A=Bh(R.d|0,(z=a,a+=4,p[z>>2]=A,z)),p[g>>2]=A,A=p[j]),Lg(A)),A=p[w>>2],p[b+20>>2]=A}else{if(Lg(p[j]),(A|0)==0){var E=p[i],J=p[h];if((p[u>>2]|0)>(E|0)){E=dh(J,E<<2);if((E|0)==0){wn(p[h]+4|0);A=p[b+20>>2]=7;break}p[h]=E}else{E=J}p[d>>2]=E+4|0;m&&(p[f>>2]=p[s>>2]);if(!o){break}p[e>>2]=p[q>>2]}else{wn(p[h]+4|0)}}}}while(0);a=k;return A}vn.X=1;function xn(b,c,d,e){var f,g,h;g=(b+12|0)>>2;var i=y[g],j=(d|0)==0,k=c<<(((i|0)!=0|j)&1^1);f=(b+20|0)>>2;h=b+8|0;var m=p[h>>2];if((k+p[f]|0)>(m|0)){if(i=(m<<1)+k|0,p[h>>2]=i,h=dh(p[b>>2],i<<2),(h|0)==0){h=19}else{p[b>>2]=h;var o=p[g];h=4}}else{o=i,h=4}a:do{if(h==4){h=(o|0)==0;i=b+16|0;b:do{if(!h){if((p[i>>2]|0)==(c|0)){break}c=b+4|0;Lg(p[c>>2]);d=Bh(R.Ck|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));p[c>>2]=d;var r=p[b+24>>2]=1;h=20;break a}p[i>>2]=c;k=b;for(m=0;;){if((m|0)>=(c|0)){break b}var q=p[e+(m<<2)>>2],q=Bh(R.d|0,(z=a,a+=4,p[z>>2]=q,z));if((q|0)==0){h=19;break a}var s=p[f];p[f]=s+1|0;p[((s<<2)+p[k>>2]|0)>>2]=q;m=m+1|0}}while(0);if(!j){h=b;for(i=0;;){if((i|0)>=(c|0)){break}k=(i<<2)+d|0;m=p[k>>2];if((m|0)==0){k=0}else{m=ve(m)+1|0;q=Kg(m);if((q|0)==0){h=19;break a}Ah(q,p[k>>2],m);k=q}m=p[f];p[f]=m+1|0;p[((m<<2)+p[h>>2]|0)>>2]=k;i=i+1|0}p[g]=p[g]+1|0}r=0;h=20}}while(0);h==19&&(p[b+24>>2]=7,r=1);return r}xn.X=1;function wn(b){if((b|0)!=0){var c=b-4|0,d=p[c>>2],e=(d|0)>1;a:do{if(e){for(var f=1;;){var g=p[b+(f-1<<2)>>2];(g|0)!=0&&Lg(g);f=f+1|0;if((f|0)>=(d|0)){break a}}}}while(0);Lg(c)}}function yn(b,c,d,e,f){var g,h=ve(c),i=zh(b,h+17|0);g=i>>2;if((i|0)==0){if((f|0)!=0){Gd[f](e)}}else{var j=i+16|0;Ah(j,c,h+1|0);p[g+1]=j;p[g]=d;p[g+2]=e;p[g+3]=f;c=Ff(b+288|0,j,h,i);(c|0)!=0&&(d=c+12|0,(p[d>>2]|0)!=0&&(Bi(b,-1),Gd[p[d>>2]](p[c+8>>2])));vf(b,c);(c|0)==(i|0)&&(l[b+30|0]=1)}return hk(b,0)}function zn(b,c){var d,e,f=a;a+=4;var g;p[f>>2]=0;g=b+304|0;var h=p[g>>2];if((h|0)==0){g=3}else{var i=p[h>>2];if((i|0)==0){g=3}else{h=ni(b,556);e=h>>2;if((h|0)==0){e=7}else{var j=h+524|0;l[j]=1;p[e]=b;d=h+448|0;xd[0]=1;p[d>>2]=C[0];p[d+4>>2]=C[1];if((An(h,c,f)|0)==0){d=(h+504|0)>>2;var k=p[d];if((k|0)==0){g=13}else{if(l[b+30|0]<<24>>24!=0){g=13}else{if((p[k+28>>2]|0)!=0){g=13}else{if((l[k+34|0]&16)<<24>>24!=0){g=13}else{var m=i+12|0;(p[m>>2]|0)==0&&(p[m>>2]=p[k+12>>2],p[(i+8|0)>>2]=p[p[d]+8>>2],p[(p[d]+8|0)>>2]=0,p[(p[d]+12|0)>>2]=0);m=p[(p[g>>2]|0)>>2]=0;g=14}}}}}else{g=13}g==13&&(m=p[f>>2],$h(b,1,(m|0)!=0?R.d|0:0,(z=a,a+=4,p[z>>2]=m,z)),vf(b,m),m=1);l[j]=0;g=p[e+3];(g|0)!=0&&gk(g);rf(b,p[e+126]);vf(b,h);e=m}e=hk(b,e);g=18}}g==3&&($h(b,21,0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),Qe(101949),e=21);a=f;return e}zn.X=1;function An(b,c,d){var e,f,g,h,i,j=b>>2,k=a;a+=4;var m,o=p[j];i=o>>2;var r=p[i+19];(p[i+35]|0)==0&&(p[(o+224|0)>>2]=0);h=(b+4|0)>>2;p[h]=0;g=(b+500|0)>>2;p[g]=c;var q=bh(1612);(q|0)!=0&&(p[q>>2]=-1);var s=(q|0)==0;do{if(s){l[o+30|0]=1;var u=7}else{u=o+234|0;e=l[u];(p[i+65]|0)!=0&&(l[u]=1);var w=o+30|0,v=b+492|0,x=v|0;f=(b+496|0)>>2;var A=o+224|0,E=-1,J=0;a:for(;;){for(;;){if(l[w]<<24>>24!=0){var M=E,D=J;m=19;break a}var K=c+J|0;if(l[K]<<24>>24==0){M=E;D=J;m=19;break a}p[x>>2]=K;var H=Bn(K,k);p[f]=H;var N=H+J|0;if((N|0)>(r|0)){p[h]=18;M=E;D=N;m=19;break a}var Q=p[k>>2];if((Q|0)==149){if((p[A>>2]|0)==0){J=N}else{ym(b,R.$d|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));p[h]=9;M=E;D=N;m=19;break a}}else{if((Q|0)==148){vf(o,p[d>>2]);var P=zm(o,R.ae|0,(z=a,a+=4,p[z>>2]=v,z));p[d>>2]=P;P=1;m=24;break a}else{(Q|0)==1&&(p[g]=c+N|0);break}}}Cn(q,Q,p[x>>2],H,b);E=p[k>>2];if((p[h]|0)!=0){M=E;D=N;m=19;break}J=N}m==19&&(P=c+D|0,l[P]<<24>>24==0&&(p[h]|0)==0&&(m=b+492|0,(M|0)!=1&&(Cn(q,1,p[m>>2],p[f],b),p[g]=P),Cn(q,0,p[m>>2],p[f],b)),P=0);m=q;if((m|0)!=0){f=(p[m>>2]|0)>-1;a:do{if(f){for(;;){if(Dn(m),(p[m>>2]|0)<=-1){break a}}}}while(0);Lg(m)}l[u]=e;if(l[w]<<24>>24==0){m=p[h],(m|0)==0||(m|0)==101?m=29:(L=m,m=27)}else{var L=p[h]=7;m=27}m==27&&(u=b+8|0,(p[u>>2]|0)==0&&(e=ok(L),En(u,o,R.d|0,(z=a,a+=4,p[z>>2]=e,z))));u=b+8|0;e=p[u>>2];(e|0)==0?u=P:(p[d>>2]=e,cf(p[h],R.d|0,(z=a,a+=4,p[z>>2]=e,z)),p[u>>2]=0,u=P+1|0);e=b+12|0;w=p[e>>2];(w|0)!=0&&(p[j+16]|0)>0&&l[b+18|0]<<24>>24==0&&(jk(w),p[e>>2]=0);l[b+18|0]<<24>>24==0&&(e=b+408|0,vf(o,p[e>>2]),p[e>>2]=0,p[j+101]=0);Lg(p[j+133]);l[b+524|0]<<24>>24==0&&rf(o,p[j+126]);qf(o,p[j+127]);e=p[j+115];w=(e|0)>0;f=b+464|0;v=p[f>>2];a:do{if(w){x=e;for(A=v;;){if(x=x-1|0,vf(o,p[A+(x<<2)>>2]),A=p[f>>2],(x|0)<=0){var I=A;break a}}}else{I=v}}while(0);vf(o,I);vf(o,p[j+119]);e=(b+420|0)>>2;w=p[e];f=(w|0)==0;a:do{if(!f){for(v=w;;){if(p[e]=p[v>>2],vf(o,v),v=p[e],(v|0)==0){break a}}}}while(0);e=(b+540|0)>>2;w=p[e];f=(w|0)==0;a:do{if(!f){for(v=w;;){if(p[e]=p[v+72>>2],rf(o,v),v=p[e],(v|0)==0){break a}}}}while(0);(u|0)>0&&(p[h]|0)==0&&(p[h]=1)}}while(0);a=k;return u}An.X=1;function Fn(b,c){var d,e=a;a+=4;d=e>>2;p[d]=arguments[Fn.length];if((c|0)==1){var f=p[b+304>>2];if((f|0)==0){Qe(102325),d=6}else{var g=p[d];p[d]=g+4|0;l[p[f+4>>2]+16|0]=p[g>>2]&255;g=0;d=7}}else{Qe(102333),d=6}d==6&&($h(b,21,0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),g=21);a=e;return g}function Gn(b){var c=0;a:for(;;){var d=t[b];if(d<<24>>24==0){var e=(c|0)==1&1;break}var f=d<<24>>24;b:do{if((f|0)==59){var g=b,h=0}else{if((f|0)==32||(f|0)==13||(f|0)==9||(f|0)==10||(f|0)==12){g=b,h=1}else{if((f|0)==47){if(l[b+1|0]<<24>>24!=42){g=b,h=2}else{for(var i=b+2|0;;){var j=l[i];if(j<<24>>24==0){e=0;break a}else{if(j<<24>>24==42){if(i=i+1|0,l[i]<<24>>24==47){g=i;h=1;break b}}else{i=i+1|0}}}}}else{if((f|0)==45){if(l[b+1|0]<<24>>24!=45){g=b,h=2}else{if(d<<24>>24==10){g=b,h=1}else{g=b;for(h=45;;){var k=g+1|0,m=h<<24>>24==0;if(!(h<<24>>24!=10&(m^1))){break}h=l[g+2|0];g=k}if(m){e=(c|0)==1&1;break a}else{g=k,h=1}}}}else{if((f|0)==91){for(g=b;;){var o=g+1|0,g=l[o],r=g<<24>>24==0;if(!(g<<24>>24!=93&(r^1))){break}g=o}if(r){e=0;break a}g=o;h=2}else{if((f|0)==96||(f|0)==34||(f|0)==39){for(g=b;;){var q=g+1|0,g=l[q],s=g<<24>>24==0;if(!(g<<24>>24!=d<<24>>24&(s^1))){break}g=q}if(s){e=0;break a}g=q;h=2}else{if((l[R.e+(d&255)|0]&70)<<24>>24==0){g=b,h=2}else{g=(l[R.e+(t[b+1|0]&255)|0]&70)<<24>>24==0;c:do{if(g){var u=1}else{for(h=1;;){if(h=h+1|0,(l[R.e+(t[b+h|0]&255)|0]&70)<<24>>24==0){u=h;break c}}}}while(0);do{if((f|0)==99||(f|0)==67){if((u|0)==6&&(te(b,R.Md|0,6)|0)==0){h=4;break}}else{if((f|0)==116||(f|0)==84){if((u|0)==7){if((te(b,R.ia|0,7)|0)==0){h=6;break}}else{if((u|0)==4){if((te(b,R.jb|0,4)|0)==0){h=5;break}}else{if((u|0)==9&&(te(b,R.ee|0,9)|0)==0){h=5;break}}}}else{if((f|0)==101||(f|0)==69){if((u|0)==3){if((te(b,R.me|0,3)|0)==0){h=7;break}}else{if((u|0)==7&&(te(b,R.xe|0,7)|0)==0){h=3;break}}}}}h=2}while(0);g=b+(u-1)|0}}}}}}}}while(0);c=(c<<3)+R.nr+(h&255)|0;b=g+1|0;c=t[c]&255}return e}Gn.X=1;function hi(b){var c=ni(b,40);(c|0)!=0&&(n[c+28>>1]=1,l[c+30|0]=5,p[c>>2]=b);return c}function ii(b,c,d,e,f){(b|0)!=0&&Tk(b,d,c,e,f)}function Hn(b){(b|0)!=0&&(tk(b),vf(p[b>>2],b))}function qg(){(p[of+28>>2]|0)==0&&In();for(var b=Qg>>2,c=b+9;b<c;b++){p[b]=0}(p[of+4>>2]|0)!=0&&(p[Qg>>2]=8);var b=p[of+164>>2],c=p[of+168>>2],d=p[of+172>>2];if((b|0)!=0&(c|0)>99&(d|0)>0){c&=-8;p[of+168>>2]=c;p[Qg+24>>2]=b;p[Qg+28>>2]=d;d=d-1|0;if((d|0)>0){for(var e=b,f=0;;){var g=e+c|0;p[e>>2]=g;f=f+1|0;if((f|0)==(d|0)){break}e=g}b=b+c*d|0}p[b>>2]=0;p[Qg+20>>2]=b+4|0}else{p[Qg+20>>2]=0,p[of+164>>2]=0,p[of+168>>2]=0,p[of+172>>2]=0}(p[of+176>>2]|0)==0|(p[of+180>>2]|0)<512|(p[of+184>>2]|0)<1&&(p[of+176>>2]=0,p[of+180>>2]=0,p[of+184>>2]=0);return Gd[p[of+48>>2]](p[of+56>>2])}qg.X=1;function Jn(b){b=b+48|0;return[p[b>>2],p[b+4>>2]]}function Kn(b){return p[b+60>>2]}function Ln(b){return p[b+64>>2]}function Mn(b,c,d){p[b+428>>2]=c;p[b+432>>2]=d;return p[b+436>>2]=0}function Nn(b){var c,d=a;a+=4;c=d>>2;if((p[of+196>>2]|0)==0){if(p[c]=arguments[Nn.length],(b|0)==4){var e=p[c];p[c]=e+4|0;c=p[e>>2]>>2;p[of+28>>2]=p[c];p[of+32>>2]=p[c+1];p[of+36>>2]=p[c+2];p[of+40>>2]=p[c+3];p[of+44>>2]=p[c+4];p[of+48>>2]=p[c+5];p[of+52>>2]=p[c+6];p[of+56>>2]=p[c+7]}else{if((b|0)==5){(p[of+28>>2]|0)==0&&In(),e=p[c],p[c]=e+4|0,c=p[e>>2]>>2,p[c]=p[of+28>>2],p[c+1]=p[of+32>>2],p[c+2]=p[of+36>>2],p[c+3]=p[of+40>>2],p[c+4]=p[of+44>>2],p[c+5]=p[of+48>>2],p[c+6]=p[of+52>>2],p[c+7]=p[of+56>>2]}else{if((b|0)==9){e=p[c],p[c]=e+4|0,p[of>>2]=p[e>>2]}else{if((b|0)==6){var e=p[c],f=e+4|0;p[c]=f;p[of+164>>2]=p[e>>2];var g=e+8|0;p[c]=g;p[of+168>>2]=p[f>>2];p[c]=e+12|0;p[of+172>>2]=p[g>>2]}else{if((b|0)==7){e=p[c],f=e+4|0,p[c]=f,p[of+176>>2]=p[e>>2],g=e+8|0,p[c]=g,p[of+180>>2]=p[f>>2],p[c]=e+12|0,p[of+184>>2]=p[g>>2]}else{if((b|0)==17){e=p[c],p[c]=e+4|0,p[of+12>>2]=p[e>>2]}else{if((b|0)==16){e=p[c],f=e+4|0,p[c]=f,p[of+224>>2]=p[e>>2],p[c]=e+8|0,p[of+228>>2]=p[f>>2]}else{if((b|0)==18){e=p[c];p[c]=e+4|0;c=p[e>>2]>>2;e=of+96>>2;for(f=c+13;c<f;c++,e++){p[e]=p[c]}}else{if((b|0)==19){(p[of+104>>2]|0)==0&&Jg();e=p[c];p[c]=e+4|0;e=p[e>>2];c=of+96>>2;e>>=2;for(f=c+13;c<f;c++,e++){p[e]=p[c]}}else{(b|0)==13&&(e=p[c],f=e+4|0,p[c]=f,p[of+20>>2]=p[e>>2],p[c]=e+8|0,p[of+24>>2]=p[f>>2])}}}}}}}}}}else{Qe(112492)}a=d}Nn.X=1;function In(){var b=a;Nn(4,(z=a,a+=4,p[z>>2]=On,z));a=b}function Jg(){var b=a;Nn(18,(z=a,a+=4,p[z>>2]=Pn,z));a=b}function Qn(b,c){var d,e,f=a;a+=4;e=f>>2;p[e]=arguments[Qn.length];var g=(c|0)==1001;a:do{if(g){var h=p[e];d=h;var i=h+4|0;p[e]=i;d=p[d>>2];var j=i,i=h+8|0;p[e]=i;j=p[j>>2];p[e]=h+12|0;h=Rn(b,d,j,p[i>>2])}else{for(h=0;;){if(h>>>0>=2){h=1;break a}if((p[Sn+(h<<3)>>2]|0)==(c|0)){break}h=h+1|0}i=d=y[e];j=d+4|0;p[e]=j;i=y[i>>2];p[e]=d+8|0;j=y[j>>2];d=(b+12|0)>>2;var k=y[d];(i|0)>0?(i=p[Sn+(h<<3)+4>>2]|k,p[d]=i):(i|0)!=0?i=k:(i=k&(p[Sn+(h<<3)+4>>2]^-1),p[d]=i);(k|0)!=(i|0)&&Nm(p[b+136>>2]);(j|0)!=0&&(p[j>>2]=(p[Sn+(h<<3)+4>>2]&p[d]|0)!=0&1);h=0}}while(0);a=f;return h}Qn.X=1;function Rn(b,c,d,e){if((p[b+236>>2]|0)==0){var f=b+235|0;l[f]<<24>>24!=0&&Lg(p[b+260>>2]);var g=d&-8,d=(g|0)<5?0:g,h=(e|0)<0?0:e;(d|0)==0|(h|0)==0?(d=0,g=h,e=0):(c|0)!=0?(g=h,e=c):(dj(),e=bh(d*h|0),gj(),(e|0)==0?(g=h,e=0):(h=pf(e),g=(h|0)/(g|0)&-1));p[b+260>>2]=e;h=b+256|0;p[h>>2]=0;n[b+232>>1]=d&65535;if((e|0)==0){p[b+264>>2]=0,b=l[b+234|0]=0}else{if((g|0)>0){for(var i=g,j=e,k=0;;){var i=i-1|0,m=j;p[j>>2]=k;p[h>>2]=m;if((i|0)<=0){break}j=j+d|0;k=m}d=e+(d*g|0)|0}else{d=e}p[b+264>>2]=d;l[b+234|0]=1;b=(c|0)==0&1}l[f]=b;f=0}else{f=5}return f}Rn.X=1;function Tn(b){var c,d,e,f,g=b>>2,h=(b|0)==0;a:do{if(h){d=0}else{if(f=(b+56|0)>>2,(cn(p[f])|0)==0){Qe(112927),d=21}else{if(Bi(b,-1),Un(b,68),(p[g+34]|0)==0){e=(b+4|0)>>2;var i=p[e];d=(b+8|0)>>2;for(var j=0;;){if((j|0)>=(i|0)){break}c=p[p[d]+(j<<4)+4>>2];var k=(c|0)==0;do{if(!k&&((p[c+16>>2]|0)!=0&1|0)!=0){$h(b,5,R.Xe|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));d=5;break a}}while(0);j=j+1|0}Vn(b);i=(p[e]|0)>0;b:do{if(i){for(j=0;;){c=p[d];var k=(j<<4)+c+4|0,m=p[k>>2];(m|0)!=0&&(Wn(m),p[k>>2]=0,(j|0)!=1&&(p[((j<<4)+c+12|0)>>2]=0));j=j+1|0;if((j|0)>=(p[e]|0)){break b}}}}while(0);Bi(b,-1);for(e=0;;){i=p[((e<<2)+320>>2)+g];j=(i|0)==0;b:do{if(!j){for(c=i;;){k=p[c+28>>2];m=(c|0)==0;c:do{if(!m){for(var o=c;;){Xn(b,p[o+32>>2]);var r=p[o+8>>2];vf(b,o);if((r|0)==0){break c}o=r}}}while(0);if((k|0)==0){break b}c=k}}}while(0);e=e+1|0;if((e|0)==23){break}}e=b+412|0;i=p[g+105];j=(i|0)==0;b:do{if(!j){for(k=i;;){m=p[k+8>>2];c=m>>2;o=p[c+4];if((o|0)!=0){Gd[o](p[c+2])}o=p[c+9];if((o|0)!=0){Gd[o](p[c+7])}o=p[c+14];if((o|0)!=0){Gd[o](p[c+12])}vf(b,m);c=p[k>>2];if((c|0)==0){break b}k=c}}}while(0);Yn(e);e=b+288|0;i=p[g+74];j=(i|0)==0;b:do{if(!j){for(c=i;;){k=p[c+8>>2];m=p[k+12>>2];if((m|0)!=0){Gd[m](p[k+8>>2])}vf(b,k);c=p[c>>2];if((c|0)==0){break b}}}}while(0);Yn(e);$h(b,0,0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));e=p[g+53];(e|0)!=0&&Hn(e);e=b;i=e+128|0;j=(p[i>>2]|0)>0;b:do{if(j){c=e|0;k=e+132|0;for(m=0;;){if(o=p[c>>2],Gd[p[o+52>>2]](o,p[p[k>>2]+(m<<2)>>2]),m=m+1|0,(m|0)>=(p[i>>2]|0)){var q=k;break b}}}else{q=e+132|0}}while(0);vf(e,p[q>>2]);p[f]=-1254786768;vf(b,p[p[d]+28>>2]);p[f]=-1623446221;l[b+235|0]<<24>>24!=0&&Lg(p[g+65]);Lg(b);d=0}else{$h(b,5,R.Ne|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),d=5}}}}while(0);return d}Module._sqlite3_close=Tn;Tn.X=1;function cn(b){(b|0)==-264537850||(b|0)==-1607883113||(b|0)==1266094736?b=1:(bn(R.Aq|0),b=0);return b}function Vn(b){var c;c=(b+476|0)>>2;var d=p[c],e=(d|0)==0;a:do{if(!e){for(var f=d;;){if(p[c]=p[f+12>>2],vf(b,f),f=p[c],(f|0)==0){break a}}}}while(0);p[b+480>>2]=0;p[b+484>>2]=0;l[b+488|0]=0}function Wn(b){var c,d=p[b+4>>2];c=d>>2;li(p[b>>2],d);var e=p[c+2],f=(e|0)==0;a:do{if(!f){for(var g=e;;){var h=p[g+8>>2];(p[g>>2]|0)==(b|0)&&Zn(g);if((h|0)==0){break a}g=h}}}while(0);Tj(b);var i;if(l[b+9|0]<<24>>24==0){i=7}else{e=d+64|0;f=p[e>>2]-1|0;p[e>>2]=f;e=(f|0)<1;a:do{if(e){f=p[$n>>2];if((f|0)==(d|0)){p[$n>>2]=p[d+68>>2]}else{for(;;){if((f|0)==0){f=1;break a}i=f+68|0;f=p[i>>2];if((f|0)==(d|0)){break}}p[i>>2]=p[d+68>>2]}f=1}else{f=0}}while(0);i=(f|0)==0?11:7}if(i==7){ao(p[c]);c=p[c+13];i=d+48|0;if((c|0)!=0&&(e=p[i>>2],(e|0)!=0)){Gd[c](e)}vf(0,p[i>>2]);bo(d);Lg(d)}d=b+24|0;c=p[d>>2];i=b+20|0;(c|0)!=0&&(p[(c+20|0)>>2]=p[i>>2]);c=p[i>>2];(c|0)!=0&&(p[(c+24|0)>>2]=p[d>>2]);Lg(b)}Wn.X=1;function Xn(b,c){if((c|0)!=0){var d=c|0,e=p[d>>2]-1|0;p[d>>2]=e;(e|0)==0&&(Gd[p[c+4>>2]](p[c+8>>2]),vf(b,c))}}function Yn(b){var c=b+8|0,d=p[c>>2];p[c>>2]=0;c=b+12|0;Lg(p[c>>2]);p[c>>2]=0;p[b>>2]=0;c=(d|0)==0;a:do{if(!c){for(var e=d;;){var f=p[e>>2];Lg(e);if((f|0)==0){break a}e=f}}}while(0);p[b+4>>2]=0}function co(b,c,d){var e=b+196|0,f=p[e>>2];p[b+192>>2]=c;p[e>>2]=d;return f}function eo(b,c,d,e,f,g,h,i,j){var k;if((j|0)==0){f=fo(b,c,d,e,f,g,h,i,0)}else{var m=ni(b,12);k=m>>2;(m|0)==0?(Gd[j](f),f=1):(p[k+1]=j,p[k+2]=f,c=fo(b,c,d,e,f,g,h,i,m),(p[k]|0)==0&&(Gd[j](f),vf(b,m)),f=c)}return hk(b,f)}function fo(b,c,d,e,f,g,h,i,j){var k,m=(c|0)==0;a:do{if(m){k=7}else{if((g|0)==0){if(!((i|0)!=0^(h|0)==0)){k=7;break}}else{if(!((i|0)==0&(h|0)==0)){k=7;break}}if((d+1|0)>>>0>128){k=7}else{if(k=ve(c),(k|0)>255){k=7}else{var o=(e|0)==4;do{if(o){var r=2}else{if((e|0)!=5){r=e}else{r=fo(b,c,d,1,f,g,h,i,j);if((r|0)!=0){k=22;break a}r=fo(b,c,d,2,f,g,h,i,j);if((r|0)!=0){k=22;break a}r=3}}}while(0);var o=r&255,q=go(b,c,k,d,o,0),s=(q|0)==0;do{if(!s&&(t[q+2|0]&255|0)==(r|0)&&(n[q>>1]<<16>>16|0)==(d|0)){if((p[b+140>>2]|0)!=0){$h(b,5,R.bl|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));r=5;k=22;break a}Nm(p[b+136>>2])}}while(0);k=go(b,c,k,d,o,1);(k|0)==0?r=7:(r=k+32|0,Xn(b,p[r>>2]),(j|0)!=0&&(o=j|0,p[o>>2]=p[o>>2]+1|0),p[r>>2]=j,l[k+3|0]=0,p[k+12>>2]=g,p[k+16>>2]=h,p[k+20>>2]=i,p[k+4>>2]=f,n[k>>1]=d&65535,r=0);k=22}}}}while(0);k==7&&(Qe(113277),r=21);return r}fo.X=1;function tn(b,c,d){var e,f=a;a+=40;e=f>>2;for(var g=f>>2,h=g+10;g<h;g++){p[g]=0}p[e]=b;Tk(f,c,d,2,0);Lk(f,1);l[b+30|0]<<24>>24==0?b=p[e+1]:(tk(f),b=p[e+1]=0);a=f;return b}function ho(b,c,d){c=(go(b,c,ve(c),d,1,0)|0)==0?fo(b,c,d,1,0,18,0,0,0):0;return hk(b,c)}function go(b,c,d,e,f,g){var h,i=((t[R.i+(t[c]&255)|0]&255)+d|0)%23,j=b+320|0,k=io(j,i,c,d),m=(k|0)==0;a:do{if(m){var o=0,r=0}else{for(var q=k,s=0,u=0;;){var w=jo(q,e,f),v=(w|0)>(u|0),s=v?q:s,u=v?w:u,q=p[q+8>>2];if((q|0)==0){o=s;r=u;break a}}}}while(0);g=(g|0)!=0;a:do{if(g){if((r|0)>=6&&(n[o>>1]<<16>>16|0)==(e|0)){var x=o}else{x=h=ni(b,d+37|0),(h|0)!=0&&(k=h+36|0,p[h+24>>2]=k,n[h>>1]=e&65535,l[h+2|0]=f,Ah(k,c,d),l[d+(h+36)|0]=0,yg(j,x))}h=12}else{if((o|0)!=0&&(p[b+12>>2]&268435456|0)==0){var A=o;h=13}else{if(k=io(rg,i,c,d),(k|0)==0){x=o,h=12}else{m=o;for(q=0;;){if(s=jo(k,e,f),m=(u=(s|0)>(q|0))?k:m,q=u?s:q,k=p[k+8>>2],(k|0)==0){x=m;h=12;break a}}}}}}while(0);h==12&&((x|0)==0?h=15:(A=x,h=13));if(h==13){if((p[A+16>>2]|0)!=0){var E=A;h=16}else{(p[A+12>>2]|0)!=0|g?(E=A,h=16):h=15}}h==15&&(E=0);return E}go.X=1;function ko(b,c){(c|0)>0?co(b,20,c):co(b,0,0);return 0}function lo(b,c){var d;if((c|0)==0){e=10,d=5}else{if(l[c]<<24>>24==0){var e=10;d=5}else{if(d=mi(b,c),(d|0)<0){$h(b,1,R.ff|0,(z=a,a+=4,p[z>>2]=c,z));var f=1;d=6}else{e=d,d=5}}}d==5&&(e=mo(b,e,0,0,0),$h(b,e,0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),f=e);return hk(b,f)}function mi(b,c){var d=(c|0)==0;a:do{if(d){var e=-1}else{for(var f=ve(c),g=p[b+4>>2]-1|0,h=(g<<4)+p[b+8>>2]|0;;){if((g|0)<=-1){e=g;break a}var i=p[h>>2];if((f|0)==(ve(i)|0)&&(qm(i,c)|0)==0){e=g;break a}h=h-16|0;g=g-1|0}}}while(0);return e}function mo(b,c,d,e,f){var g;g=(b+4|0)>>2;var h=(p[g]|0)>0;a:do{if(h){var i=b+8|0;if((c|0)==10){for(var j=f,k=e,m=0,o=0;;){j=no(p[p[i>>2]+(m<<4)+4>>2],d,k,j);j=(k=(j|0)==5)?0:j;o=k?1:o;m=m+1|0;if(!((m|0)<(p[g]|0)&(j|0)==0)){var r=j,q=o;break a}k=j=0}}else{for(var j=f,k=e,s=0,o=m=0;;){if((m|0)==(c|0)&&(j=no(p[p[i>>2]+(m<<4)+4>>2],d,k,j),(j|0)!=5?s=j:(o=1,s=0),j=k=0),m=m+1|0,!((m|0)<(p[g]|0)&(s|0)==0)){r=s;q=o;break a}}}}else{q=r=0}}while(0);return(r|0)!=0|(q|0)==0?r:5}mo.X=1;function oo(b,c){return po(b,c,6,0)}Module._sqlite3_open=oo;function po(b,c,d,e){var f,g,h,i=a;a+=12;h=i>>2;var j=i+4;g=j>>2;var k=i+8;p[h]=d;p[g]=0;p[k>>2]=0;p[c>>2]=0;var m=og();if((m|0)==0){if((1<<(d&7)&70|0)==0){Qe(114296),c=21}else{m=(p[of+4>>2]|0)==0?0:(d&32768|0)!=0?0:(d&65536|0)!=0?1:p[of+8>>2];(d&262144|0)==0?(p[of+192>>2]|0)!=0&&(d|=131072,p[h]=d):(d&=-131073,p[h]=d);var o=d&-655129;p[h]=o;var r=qo(504),d=r>>2,q=(r|0)==0;do{if(q){var s=0}else{(m|0)!=0&&(p[d+17]=8);p[d+6]=255;p[d+1]=2;var u=r+56|0;p[u>>2]=-264537850;f=(r+8|0)>>2;p[f]=r+444|0;Ah(r+72|0,to,44);l[r+28|0]=1;l[r+32|0]=-1;p[d+9]=0;p[(r+12|0)>>2]|=1207961600;uo(r+412|0);uo(r+288|0);vo(r,R.w|0,1,0,22,0);vo(r,R.w|0,3,0,22,0);vo(r,R.w|0,2,0,22,0);vo(r,R.Vf|0,1,1,22,0);var w=r+30|0;if(l[w]<<24>>24!=0){s=0}else{s=wo(r,1,R.w|0,0);p[d+11]=s;vo(r,R.Db|0,1,0,24,0);p[d+4]=o;var v=r,s=xo(e,b,i,v,j,k);if((s|0)==0){if(s=p[g],v=yo(p[v>>2],s,r,p[f]+4|0,0,p[h]|256),(v|0)==0){if(v=zo(r,p[p[f]+4>>2]),p[(p[f]+12|0)>>2]=v,v=zo(r,0),p[(p[f]+28|0)>>2]=v,p[(p[f]|0)>>2]=R.qg|0,l[p[f]+9|0]=3,p[(p[f]+16|0)>>2]=R.jb|0,l[p[f]+25|0]=1,p[u>>2]=-1607883113,l[w]<<24>>24==0){$h(r,0,0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));f=r;(ho(f,R.Ag|0,2)|0)==7&&(l[f+30|0]=1);f=an(r);if((f|0)==0){if((an(r)|0)!=0){break}f=0}$h(r,f,0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));Rn(r,0,p[of+20>>2],p[of+24>>2]);ko(r,1e3)}}else{$h(r,(v|0)==3082?7:v,0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z))}}else{(s|0)==7&&(l[w]=1),f=p[k>>2],$h(r,s,(f|0)!=0?R.d|0:0,(z=a,a+=4,p[z>>2]=f,z)),Lg(f),s=p[g]}}}}while(0);Lg(s);b=an(r);(b|0)==7?(Tn(r),e=0):((b|0)!=0&&(p[d+14]=1266094736),e=r);p[c>>2]=e;c=hk(0,b)}}else{c=m}a=i;return c}po.X=1;function vo(b,c,d,e,f,g){var h,i=ve(c),j=d&255,d=d<<24>>24==8||d<<24>>24==4?2:j,k=(d|0)==0|d>>>0>3;a:do{if(k){Qe(113878),h=21}else{var m=d&255,o=wo(b,m,c,0),r=(o|0)==0;do{if(!r&&(p[o+12>>2]|0)!=0){if((p[b+140>>2]|0)!=0){$h(b,5,R.Ef|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));h=5;break a}Nm(p[b+136>>2]);var q=o+4|0,s=t[q];if((s&247|0)==(d|0)){var u=Ao(b+412|0,c,i);h=u>>2;if(l[u+4|0]<<24>>24==s<<24>>24){s=p[h+4];if((s|0)!=0){Gd[s](p[h+2])}p[h+3]=0;s=l[q]}if(l[u+24|0]<<24>>24==s<<24>>24){s=p[h+9];if((s|0)!=0){Gd[s](p[h+7])}p[h+8]=0;q=l[q]}else{q=s}if(l[u+44|0]<<24>>24==q<<24>>24){u=p[h+14];if((u|0)!=0){Gd[u](p[h+12])}p[h+13]=0}}}}while(0);m=wo(b,m,c,1);h=m>>2;(m|0)==0?h=7:(p[h+3]=f,p[h+2]=e,p[h+4]=g,l[m+4|0]=(d|j&8)&255,$h(b,0,0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),h=0)}}while(0);return h}vo.X=1;function Bo(b,c,d,e){var f=(c|0)==0;a:do{if(f){var g=0,h=p[b+4>>2]}else{for(var i=b+8|0,j=p[b+4>>2],k=0;;){if((k|0)>=(j|0)){g=k;h=j;break a}if((pg(p[p[i>>2]+(k<<4)>>2],c)|0)==0){g=k;h=j;break a}k=k+1|0}}}while(0);(g|0)<(h|0)?(b=p[p[b+8>>2]+(g<<4)+4>>2],(b|0)==0?d=1:(c=b+4|0,li(p[b>>2],p[c>>2]),b=p[p[p[c>>2]>>2]+60>>2],(d|0)==7?(p[e>>2]=b,d=0):d=(p[b>>2]|0)==0?12:Gd[p[p[b>>2]+40>>2]](b,d,e))):d=1;return d}Bo.X=1;function Co(b){var c,d=a;a+=4;c=d>>2;p[c]=arguments[Co.length];if((b|0)==5){Ah(Do|0,Kh|0,259),c=0}else{if((b|0)==6){Ah(Kh|0,Do|0,259),c=0}else{if((b|0)==7){c=l[Kh|0]=0}else{if((b|0)==8){var e=p[c],f=e+4|0;p[c]=f;var g=p[e>>2];p[c]=e+8|0;c=Eo(g,p[f>>2])}else{if((b|0)==10){f=p[c],g=f+4|0,p[c]=g,e=p[f>>2],p[c]=f+8|0,c=p[g>>2],p[Fo>>2]=e,p[Go>>2]=c,c=0}else{if((b|0)==11){e=p[si>>2],f=p[c],p[c]=f+4|0,c=p[f>>2],(c|0)!=0&&(p[si>>2]=c),c=e}else{if((b|0)==12){c=0}else{if((b|0)==13){e=p[c],p[c]=e+4|0,c=p[e>>2]}else{if((b|0)==14){f=p[c],e=f+4|0,p[c]=e,g=p[f>>2],p[c]=f+8|0,c=p[p[g+8>>2]+4>>2],bi(p[c>>2],p[c+4>>2],0,p[e>>2],0),c=0}else{if((b|0)==15){f=p[c],e=f+4|0,p[c]=e,g=p[f>>2],p[c]=f+8|0,c=g+12|0,p[c>>2]=p[c>>2]&-256|p[e>>2]&255,c=0}else{if((b|0)==16){e=p[c],p[c]=e+4|0,c=p[e>>2],c=(Ho(c,ve(c))|0)!=26?121:0}else{if((b|0)==17){g=p[c];f=g+4|0;p[c]=f;var e=p[g>>2],h=g+8|0;p[c]=h;f=p[f>>2];p[c]=g+12|0;c=p[h>>2];(e|0)!=0&&(e=Io(e),p[f>>2]=e);Jo(c)}else{(b|0)==18&&(e=p[c],p[c]=e+4|0,p[of+232>>2]=p[e>>2])}c=0}}}}}}}}}}}a=d;return c}Co.X=1;function Eo(b,c){var d,e=a;a+=4;d=e>>2;var f=Ko(b),g=((b+7|0)/8&-1)+1|0,h=Kg(g),i=Kg(512),j=(f|0)==0|(h|0)==0|(i|0)==0;a:do{if(j){var k=-1}else{Ed(h,0,g);ej(0,1);Lo(0,1,i);for(var k=e,m=0;;){var o=y[c+(m<<2)>>2];if((o|0)==0){break}else{if((o|0)==1||(o|0)==2||(o|0)==5){var r=(m+2<<2)+c|0,q=p[r>>2],s=q-1|0;p[d]=s;p[r>>2]=q+p[c+(m+3<<2)>>2]|0;r=4}else{Dh(4,k),r=2,s=p[d]}}var q=((m|1)<<2)+c|0,u=p[q>>2]-1|0;p[q>>2]=u;m=((u|0)>0?0:r)+m|0;r=(s&2147483647|0)%(b|0);p[d]=r;r=r+1|0;s=1<<(r&7);if((o&1|0)==0){o=h+(r>>>3)|0,l[o]=t[o]&255&(s^255)&255,Lo(f,r,i)}else{q=h+(r>>>3)|0;l[q]=(t[q]&255|s)&255;if((o|0)==5){continue}if((ej(f,r)|0)!=0){k=-1;break a}}}k=wj(0,0)-b+wj(f,b+1|0)+wj(f,0)+p[f>>2]|0;for(o=1;;){if((o|0)>(b|0)){var w=k;break}if(((t[(o>>3)+h|0]&255&1<<(o&7)|0)!=0&1|0)!=(wj(f,o)|0)){w=o;break}o=o+1|0}p[d]=o;k=w}}while(0);Lg(i);Lg(h);Mo(f);a=e;return k}Eo.X=1;function No(b,c){var d=l[b];if(d<<24>>24==45){var e=b+1|0,d=1}else{e=d<<24>>24==43?b+1|0:b,d=0}var f=l[e]<<24>>24==48;a:do{if(f){for(var g=e;;){if(g=g+1|0,l[g]<<24>>24!=48){var h=g;break a}}}else{h=e}}while(0);for(g=f=e=0;;){if((g|0)>=11){var i=0;break}var j=(l[h+g|0]<<24>>24)-48|0;if(j>>>0>=10){h=(T.b(f,e,d,0),T.result[0]);i=T.result[1];if((i|0)>0||(i|0)==0&&h>>>0>2147483647){i=0;break}d=(d|0)==0?f:(T.b(0,0,f,e),T.result[0]);p[c>>2]=d;i=1;break}e=(T.multiply(f,e,10,0),T.result[0]);f=(T.add(j,(j|0)<0?-1:0,e,T.result[1]),T.result[0]);e=T.result[1];g=g+1|0}return i}No.X=1;function jh(b,c){p[Ve+(b<<2)>>2]=c;var d=(b<<2)+We|0;(p[d>>2]|0)<(c|0)&&(p[d>>2]=c)}function Mj(b){var c=(b|0)==0;a:do{if(!c){for(var d=b;;){if(p[d+16>>2]=1,d=p[d+44>>2],(d|0)==0){break a}}}}while(0)}function bi(b,c,d,e,f){var g=c>>2;li(b,c);b=(c+22|0)>>1;(n[b]&2)<<16>>16==0?(e=(e|0)<0?p[g+8]-p[g+9]|0:e,(d-512|0)>>>0<65025&&(d-1&d|0)==0&&(p[g+8]=d,bo(c)),c=c+32|0,d=Oo(p[g],c,e),p[g+9]=p[c>>2]-(e&65535)|0,(f|0)!=0&&(n[b]|=2),f=d):f=8;return f}function Io(b){var c,d=a;a+=4;c=d>>2;var e=p[Qg+28>>2];if((e|0)==0|(p[of+168>>2]|0)<(b|0)){(p[of>>2]|0)==0?(b=Gd[p[of+28>>2]](b),c=p[c]=b):(jh(8,b),b=ch(b,d),c=p[c],(c|0)==0?c=0:Rg(4,b))}else{var f=p[Qg+24>>2];p[c]=f;p[Qg+24>>2]=p[f>>2];p[Qg+28>>2]=e-1|0;Rg(3,1);jh(8,b);c=f}a=d;return c}function Jo(b){if((b|0)!=0){if(y[of+164>>2]>>>0<=b>>>0&y[Qg+20>>2]>>>0>b>>>0){p[b>>2]=p[Qg+24>>2],p[Qg+24>>2]=b,p[Qg+28>>2]=p[Qg+28>>2]+1|0,Rg(3,-1)}else{if((p[of>>2]|0)!=0){var c=-pf(b)|0;Rg(4,c);Rg(0,c);Rg(9,-1)}Gd[p[of+32>>2]](b)}}}function Po(b,c,d){var e=(b|0)==0;a:do{if(e){var f=0}else{for(var g=ve(b)+(b+1)|0;;){if(l[g]<<24>>24==0){f=0;break a}var h=ve(g),i=h+(g+1)|0;if((pg(g,c)|0)==0){f=i;break a}g=ve(i)+(h+(g+2))|0}}}while(0);b=f;return(b|0)==0?(d|0)!=0&1:Qo(b)&1}function Hk(b,c,d,e){for(var f=c>>2,c=e<<24>>24==1?1:2,d=b+d|0,b=e<<24>>24==3?b+1|0:b;;){if(b>>>0>=d>>>0){var g=b,h=0;break}e=t[b];if((l[R.e+(e&255)|0]&1)<<24>>24==0){e<<24>>24==45?(g=b+c|0,h=1):(g=e<<24>>24==43?b+c|0:b,h=0);break}else{b=b+c|0}}for(b=g;;){if(b>>>0>=d>>>0){var i=0,j=0,k=0,m=0;break}if(l[b]<<24>>24!=48){m=k=j=i=0;break}b=b+c|0}for(;;){var e=b+j|0,o=e>>>0<d>>>0;if(!o){var r=i;break}e=t[e];i=e<<24>>24;if((e-48&255)>=10){r=i;break}m=(T.multiply(m,k,10,0),T.result[0]);k=e;e=(e|0)<0?-1:0;m=(T.add(m,T.result[1],-48,-1),T.result[0]);m=(T.add(m,T.result[1],k,e),T.result[0]);k=T.result[1];j=j+c|0}(k|0)<0||(k|0)==0&&m>>>0<0?(p[f]=0,p[f+1]=-2147483648):((h|0)==0?p[f]=m:(d=(T.b(0,0,m,k),T.result[0]),k=T.result[1],p[f]=d),p[f+1]=k);if((r|0)==0|o^1){if((j|0)==0&(g|0)==(b|0)){h=1}else{if(g=c*19|0,(j|0)>(g|0)){h=1}else{if((j|0)<(g|0)){h=0}else{for(var q,j=0;;){q=((l[b+j*c|0]<<24>>24)-(l[R.nf+j|0]<<24>>24))*10|0;var j=j+1|0,s=(q|0)==0;if(!(s&(j|0)<18)){break}}q=s?(l[b+c*18|0]<<24>>24)-56|0:q;h=(q|0)<0?0:(q|0)>0?1:(h|0)!=0?0:2}}}}else{h=1}return h}Hk.X=1;function Qo(b){var c=((t[b]&255)-48|0)>>>0<10;a:do{if(c){var d=dp(b)&255}else{for(var d=ve(b),e=0;;){if((e|0)>=7){d=1;break a}if((t[R.Zq+e|0]&255|0)==(d|0)&&(te(R.br+(t[R.$q+e|0]&255)|0,b,d)|0)==0){break}e=e+1|0}d=l[R.ar+e|0]}}while(0);return d}function dp(b){var c=a;a+=4;p[c>>2]=0;(b|0)==0?b=0:(No(b,c),b=p[c>>2]);a=c;return b}function ch(b,c){var d=Gd[p[of+44>>2]](b);jh(5,b);if((p[Qg+12>>2]|0)!=0){var e=p[Ve>>2],f=(e|0)<0?-1:0,g=Qg+4|0,g=(T.b(p[g>>2],p[g+4>>2],d,(d|0)<0?-1:0),T.result[0]),h=T.result[1];(f|0)<(h|0)||(f|0)==(h|0)&&e>>>0<g>>>0?p[Qg+32>>2]=0:(p[Qg+32>>2]=1,kh(d))}e=Gd[p[of+28>>2]](d);(e|0)!=0&&(d=pf(e),Rg(0,d),Rg(9,1));p[c>>2]=e;return d}function kh(b){var c=p[Qg+12>>2];if((c|0)!=0){var d=p[Ve>>2],e=p[Qg+16>>2];p[Qg+12>>2]=0;Gd[c](e,d,(d|0)<0?-1:0,b);p[Qg+12>>2]=c;p[Qg+16>>2]=e}}function Ho(b,c){var d=(c|0)<2;a:do{if(d){var e=26}else{for(e=R.dr+((t[R.i+(t[b]&255)|0]&255)<<2^c^(t[R.i+(t[b+(c-1)|0]&255)|0]&255)*3)%127|0;;){var e=t[e],f=(e&255)-1|0;if(e<<24>>24==0){e=26;break a}if((t[R.er+f|0]&255|0)==(c|0)&&(te(R.gr+(Vc[fp+(f<<1)>>1]&65535)|0,b,c)|0)==0){break}e=R.fr+f|0}e=t[R.cr+f|0]&255}}while(0);return e}function bo(b){b=b+80|0;ip(p[b>>2]);p[b>>2]=0}function Oo(b,c,d){var e,f,g=a;a+=8;var h;f=g>>2;var i=p[c>>2];h=l[b+15|0]<<24>>24==0?3:(p[b+24>>2]|0)==0?3:11;a:do{if(h==3){var j=b+176|0;if((p[p[j>>2]+12>>2]|0)!=0|(i|0)==0){h=11}else{if(e=(b+128|0)>>2,(i|0)==(p[e]|0)){h=11}else{p[f]=0;p[f+1]=0;if(l[b+16|0]<<24>>24==0){h=8}else{if(h=p[b+60>>2],(p[h>>2]|0)==0){h=8}else{if(h=Fi(h,g),(h|0)==0){h=8}else{var k=h;h=10}}}do{if(h==8){if(k=Fp(i),(k|0)==0){k=7}else{Gp(b);h=p[f];var m=p[f+1];f=i;var o=(T.add(f,0,-1,-1),T.result[0]);h=(T.add(o,T.result[1],h,m),T.result[0]);f=(T.j(h,T.result[1],f,0),T.result[0]);p[b+24>>2]=f;p[e]=i;e=b+172|0;ip(p[e>>2]);p[e>>2]=k;j=p[j>>2];e=j+40|0;k=p[e>>2];(k|0)!=0&&(Gd[p[of+140>>2]](k),p[e>>2]=0,p[j+44>>2]=0);p[j+20>>2]=i;h=11;break a}}}while(0);p[c>>2]=p[e];var r=k;h=14}}}}while(0);h==11&&(p[c>>2]=p[b+128>>2],b=b+118|0,n[b>>1]=((d|0)<0?n[b>>1]<<16>>16:d)&65535,r=0);a=g;return r}Oo.X=1;function Fi(b,c){return Gd[p[p[b>>2]+24>>2]](b,c)}function Gp(b){Mj(p[b+88>>2]);Hp(p[b+176>>2],0)}function ip(b){if((b|0)!=0){if(y[Og+44>>2]>>>0<=b>>>0&y[Og+48>>2]>>>0>b>>>0){Rg(1,-1),p[b>>2]=p[Og+60>>2],p[Og+60>>2]=b,b=p[Og+56>>2]+1|0,p[Og+56>>2]=b,p[Og+64>>2]=(b|0)<(p[Og+40>>2]|0)&1}else{var c=-pf(b)|0;Rg(2,c);Lg(b)}}}function Ip(b){var c,d=p[b+28>>2];c=d+8|0;if((p[c>>2]|0)==(b|0)){for(var e=b;;){var f=p[e+36>>2];if((f|0)==0){break}if((n[f+24>>1]&4)<<16>>16==0){break}e=f}p[c>>2]=f}c=(b+32|0)>>2;e=p[c];b=(b+36|0)>>2;f=p[b];(e|0)==0?p[(d+4|0)>>2]=f:p[(e+36|0)>>2]=f;e=p[b];f=p[c];(e|0)==0?p[(d|0)>>2]=f:p[(e+32|0)>>2]=f;p[c]=0;p[b]=0}function wj(b,c){var d,e=(b|0)==0;a:do{if(e){var f=0}else{if(y[b>>2]>>>0<c>>>0|(c|0)==0){f=0}else{var g=b;d=g>>2;for(var h=c-1|0;;){var i=y[d+2];if((i|0)==0){break}var j=(h>>>0)%(i>>>0);d=y[((Math.floor((h>>>0)/(i>>>0))<<2)+12>>2)+d];if((d|0)==0){f=0;break a}g=d;d=g>>2;h=j}if(y[d]>>>0<4001){f=(t[g+(h>>>3)+12|0]&255&1<<(h&7)|0)!=0&1}else{for(j=h+1|0;;){h=(h>>>0)%125;g=y[((h<<2)+12>>2)+d];if((g|0)==0){f=0;break a}if((g|0)==(j|0)){f=1;break a}h=h+1|0}}}}}while(0);return f}wj.X=1;function Jp(b,c){var d=(c|0)>0;a:do{if(d){for(var e=b+c|0,f=0,g=b;;){var h=g+1|0,f=f<<3^f^t[R.i+(t[g]&255)|0]&255;if((h|0)==(e|0)){var i=f;break a}g=h}}else{i=0}}while(0);return i}function Hp(b,c){var d=b+40|0;if((p[d>>2]|0)!=0){var e=p[b>>2],f=(e|0)==0;a:do{if(!f){for(var g=e;;){var h=y[g+32>>2];y[g+16>>2]>>>0>c>>>0&&Kp(g);if((h|0)==0){break a}g=h}}}while(0);(c|0)==0?(e=p[b+44>>2],(e|0)==0?e=1:(Ed(p[e+4>>2],0,p[b+20>>2]),e=2)):e=c+1|0;Gd[p[of+136>>2]](p[d>>2],e)}}function Kp(b){var c;c=(b+24|0)>>1;(n[c]&2)<<16>>16!=0&&(Ip(b),n[c]&=-7,n[b+26>>1]<<16>>16==0&&Lp(b))}function Lp(b){var c=p[b+28>>2];(p[c+28>>2]|0)!=0&&((p[b+16>>2]|0)==1&&(p[(c+44|0)>>2]=0),Gd[p[of+128>>2]](p[c+40>>2],p[b>>2],0))}function Fp(b){var c;jh(7,b);if((p[Og+32>>2]|0)<(b|0)){c=4}else{if(c=p[Og+60>>2],(c|0)==0){c=4}else{p[Og+60>>2]=p[c>>2];var d=p[Og+56>>2]-1|0;p[Og+56>>2]=d;p[Og+64>>2]=(d|0)<(p[Og+40>>2]|0)&1;Rg(1,1);d=c;c=6}}c==4&&(b=bh(b),(b|0)==0?d=0:(c=pf(b),Rg(2,c),d=b));return d}function Ko(b){var c=qo(512);(c|0)!=0&&(p[c>>2]=b);return c}function ej(b,c){var d,e,f=(b|0)==0;a:do{if(f){var g=0}else{g=b;d=g>>2;for(var h=c-1|0;;){var i=g|0,j=y[i>>2];if(j>>>0<=4e3){e=8;break}var k=g+8|0,m=y[k>>2];if((m|0)==0){e=7;break}var o=(h>>>0)%(m>>>0),g=(Math.floor((h>>>0)/(m>>>0))<<2)+g+12|0,h=y[g>>2];if((h|0)==0&&(h=Ko(m),p[g>>2]=h,(h|0)==0)){g=7;break a}g=h;d=g>>2;h=o}do{if(e==7&&j>>>0>=4001){var o=h+1|0,r=(h>>>0)%125,m=g+12|0,q=y[((r<<2)+12>>2)+d],s=(q|0)==0;do{if(s){if(e=y[d+1],e>>>0<124){var u=r,w=e;e=20}else{e=14}}else{e=r;for(var v=q;;){if((v|0)==(o|0)){g=0;break a}var x=e+1|0,x=x>>>0>124?0:x,v=y[((x<<2)+12>>2)+d];if((v|0)==0){break}e=x}e=y[d+1];e>>>0>61?e=14:(u=x,w=e,e=20)}}while(0);if(e==14){j=f=zh(0,500);if((f|0)==0){g=7;break a}u=m;Ah(f,u,500);Ed(u,0,500);p[k>>2]=Math.floor(((p[i>>2]+124|0)>>>0)/125);i=0;for(k=ej(g,o);;){var A=p[j+(i<<2)>>2],A=(A|0)==0?k:ej(g,A)|k,i=i+1|0;if((i|0)==125){break}k=A}vf(0,f);g=A;break a}else{if(e==20){p[d+1]=w+1|0;p[((u<<2)+12>>2)+d]=o;g=0;break a}}}}while(0);g=g+(h>>>3)+12|0;l[g]=(t[g]&255|1<<(h&7))&255;g=0}}while(0);return g}ej.X=1;function Lo(b,c,d){var e,f=(b|0)==0;a:do{if(!f){var g=b;e=g>>2;for(var h=c-1|0;;){var i=y[e+2];if((i|0)==0){break}var j=(h>>>0)%(i>>>0),g=y[((Math.floor((h>>>0)/(i>>>0))<<2)+12>>2)+e];if((g|0)==0){break a}e=g>>2;h=j}if(y[e]>>>0<4001){g=g+(h>>>3)+12|0,l[g]=t[g]&255&(1<<(h&7)^255)&255}else{j=d;e=g+12|0;Ah(d,e,500);Ed(e,0,500);e=(g+4|0)>>2;p[e]=0;h=h+1|0;for(i=0;;){var k=(i<<2)+j|0,m=p[k>>2];if(!((m|0)==0|(m|0)==(h|0))){m=((m-1|0)>>>0)%125;p[e]=p[e]+1|0;var o=(m<<2)+g+12|0,r=(p[o>>2]|0)==0;b:do{if(r){var q=o}else{for(var s=m;;){var s=s+1|0,s=s>>>0>124?0:s,u=(s<<2)+g+12|0;if((p[u>>2]|0)==0){q=u;break b}}}}while(0);p[q>>2]=p[k>>2]}i=i+1|0;if((i|0)==125){break a}}}}}while(0)}Lo.X=1;function Mo(b){if((b|0)!=0){var c=(p[b+8>>2]|0)==0;a:do{if(!c){for(var d=b+12|0,e=0;;){if(Mo(p[d+(e<<2)>>2]),e=e+1|0,(e|0)==125){break a}}}}while(0);Lg(b)}}function qo(b){var c=bh(b);(c|0)!=0&&Ed(c,0,b);return c}function wo(b,c,d,e){if((d|0)==0){b=p[b+44>>2]}else{var f=ve(d),g=b+412|0,h=Ao(g,d,f);(h|0)!=0|(e|0)==0?b=h:(e=ni(b,f+61|0),(e|0)==0?b=e:(h=e+60|0,p[e>>2]=h,l[e+4|0]=1,p[e+20>>2]=h,l[e+24|0]=2,p[e+40>>2]=h,l[e+44|0]=3,Ah(h,d,f),l[f+(e+60)|0]=0,d=Ff(g,p[e>>2],f,e),(d|0)==0?b=e:(l[b+30|0]=1,vf(b,d),b=0)))}return(b|0)==0?0:b+((c&255)-1)*20|0}function Ao(b,c,d){b=Mp(b,c,d,(p[b+12>>2]|0)==0?0:(Jp(c,d)>>>0)%(y[b>>2]>>>0));return(b|0)==0?0:p[b+8>>2]}function Mp(b,c,d,e){var f=p[b+12>>2];if((f|0)==0){var g=b+4|0,b=b+8|0}else{g=(e<<3)+f|0,b=(e<<3)+f+4|0}for(g=p[g>>2];;){b=p[b>>2];e=g-1|0;if((g|0)==0|(b|0)==0){var h=0;break}if((p[b+16>>2]|0)==(d|0)&&(te(p[b+12>>2],c,d)|0)==0){h=b;break}g=e;b|=0}return h}function Ff(b,c,d,e){var f,g;g=(b|0)>>2;var h=y[g],h=(h|0)==0?0:(Jp(c,d)>>>0)%(h>>>0),i=Mp(b,c,d,h);if((i|0)==0){if((e|0)==0){b=0}else{if(i=bh(20),f=i>>2,(i|0)==0){b=e}else{p[f+3]=c;p[f+4]=d;p[f+2]=e;e=b+4|0;f=p[e>>2]+1|0;p[e>>2]=f;if(f>>>0>9&&f>>>0>p[g]<<1>>>0){var e=f<<1,j,e=e<<3>>>0>1024?128:e;f=b|0;var k=(e|0)==(p[f>>2]|0);a:do{if(k){var m=0}else{dj();var o=j=bh(e<<3);gj();if((j|0)==0){m=0}else{var r=b+12|0;Lg(p[r>>2]);p[r>>2]=o;var q=pf(j),r=q>>>3;p[f>>2]=r;Ed(j,0,q&-8);j=b+8|0;q=p[j>>2];p[j>>2]=0;if((q|0)==0){m=1}else{for(j=q>>2;;){var s=p[j];Np(b,((Jp(p[j+3],p[j+4])>>>0)%(r>>>0)<<3)+o|0,q);if((s|0)==0){m=1;break a}q=s;j=q>>2}}}}}while(0);h=(m|0)==0?h:(Jp(c,d)>>>0)%(y[g]>>>0)}c=p[b+12>>2];(c|0)==0?Np(b,0,i):Np(b,(h<<3)+c|0,i);b=0}}}else{g=i+8|0,d=p[g>>2],(e|0)==0?(g=i+4|0,m=p[g>>2],c=(i|0)>>2,e=p[c],(m|0)==0?p[b+8>>2]=e:p[(m|0)>>2]=e,m=p[c],(m|0)!=0&&(p[(m+4|0)>>2]=p[g>>2]),g=p[b+12>>2],(g|0)!=0&&(m=(h<<3)+g+4|0,(p[m>>2]|0)==(i|0)&&(p[m>>2]=p[c]),h=(h<<3)+g|0,p[h>>2]=p[h>>2]-1|0),Lg(i),h=b+4|0,c=p[h>>2]-1|0,p[h>>2]=c,(c|0)==0&&Yn(b)):(p[g>>2]=e,p[i+12>>2]=c),b=d}return b}Ff.X=1;function Np(b,c,d){var e;if((c|0)==0){e=9}else{e=(c|0)>>2;var f=p[e];if((f|0)==0){p[e]=1,p[c+4>>2]=d,e=9}else{var c=c+4|0,g=p[c>>2];p[e]=f+1|0;p[c>>2]=d;(g|0)==0?e=9:(p[d>>2]=g,e=(g+4|0)>>2,p[d+4>>2]=p[e],f=p[e],(f|0)==0?p[b+8>>2]=d:p[(f|0)>>2]=d,p[e]=d,e=12)}}e==9&&(b=(b+8|0)>>2,p[d>>2]=p[b],e=p[b],(e|0)!=0&&(p[(e+4|0)>>2]=d),p[d+4>>2]=0,p[b]=d)}function uo(b){p[b+8>>2]=0;p[b+4>>2]=0;p[b>>2]=0;p[b+12>>2]=0}function dj(){var b=p[Fo>>2];if((b|0)!=0){Gd[b]()}}function gj(){var b=p[Go>>2];if((b|0)!=0){Gd[b]()}}function xo(b,c,d,e,f,g){var h,i=y[d>>2],j=ve(c),k=(p[of+12>>2]|i&64|0)!=0&(j|0)>4;a:do{if(k){if((jm(c,R.Wh|0,5)|0)!=0){h=63}else{var m=j+2|0,o=i|64,r=(j|0)>0;b:do{if(r){for(var q=m,s=0;;){if(q=(l[c+s|0]<<24>>24==38&1)+q|0,s=s+1|0,(s|0)==(j|0)){var u=q;break b}}}else{u=m}}while(0);m=Kg(u);if((m|0)==0){var w=7;h=69}else{q=l[c+5|0]<<24>>24==47;do{if(q){if(l[c+6|0]<<24>>24!=47){var s=0,v=5,r=0;break}for(r=7;;){q=l[c+r|0];if(q<<24>>24==47||q<<24>>24==0){break}r=r+1|0}if((r|0)==7){s=0;v=7;r=0;break}else{if((r|0)==16){q=c+7|0;if((jm(R.gi|0,q,9)|0)==0){s=0;v=16;r=0;break}var x=q}else{x=c+7|0}}x=Bh(R.qi|0,(z=a,a+=8,p[z>>2]=r-7|0,p[z+4>>2]=x,z));p[g>>2]=x;var x=1,A=o,E=m;h=67;break a}s=0;v=5;r=0;h=42}while(0);b:for(;;){var q=m+(r-1)|0,J=s,s=v;c:for(;;){var v=s,M=l[c+s|0];d:for(;;){if(M<<24>>24==0||M<<24>>24==35){break b}var D=v+1|0,K=M<<24>>24==37;do{if(K){var H=t[c+D|0];if((l[R.e+(H&255)|0]&8)<<24>>24!=0){var N=t[v+(c+2)|0];if((l[R.e+(N&255)|0]&8)<<24>>24!=0){break d}}}else{h=30}}while(0);if((J|0)==1){if(!(M<<24>>24==61||M<<24>>24==38)){var Q=M,P=1,L=D,I=r;h=41;break c}if(l[q]<<24>>24!=0){if(M<<24>>24!=38){Q=0;P=2;L=D;I=r;h=41;break c}Q=l[m+r|0]=0;P=1;L=D;I=r+1|0;h=41;break c}for(K=D;;){var X=t[c+K|0];if(X<<24>>24==0||X<<24>>24==35){v=K;M=X;continue d}if(l[c+(K-1)|0]<<24>>24==38){v=K;M=X;continue d}K=K+1|0}}else{if((J|0)==0){if(M<<24>>24==63){h=40;break c}Q=M;P=0}else{if((J|0)==2){if(M<<24>>24==38){h=40;break c}Q=M;P=2}else{Q=M,P=J}}L=D;I=r;h=41;break c}}M=v+3|0;v=((Op(H<<24>>24)&255)<<4)+(Op(N<<24>>24)&255)|0;if((v|0)!=0){Q=v&255;P=J;L=M;I=r;h=41;break}if((J|0)==1){for(v=M;;){M=l[c+v|0];if(M<<24>>24==0||M<<24>>24==35||M<<24>>24==61||M<<24>>24==38){J=1;s=v;continue c}v=v+1|0}}else{if((J|0)==0){for(v=M;;){M=l[c+v|0];if(M<<24>>24==0||M<<24>>24==35||M<<24>>24==63){J=0;s=v;continue c}v=v+1|0}}else{for(v=(J|0)==2;;){K=l[c+M|0];if(K<<24>>24==0||K<<24>>24==35){s=M;continue c}if(v&K<<24>>24==38){J=2;s=M;continue c}M=M+1|0}}}}h==40&&(Q=0,P=1,L=D,I=r);l[m+I|0]=Q;s=P;v=L;r=I+1|0}(J|0)==1&&(l[m+r|0]=0,r=r+1|0);l[m+r|0]=0;l[r+(m+1)|0]=0;r=b;for(q=ve(m)+(m+1)|0;;){if(l[q]<<24>>24==0){var Y=o,da=r,ga=m;h=65;break a}s=ve(q);v=s+(q+1)|0;M=ve(v);if((s|0)==3){if((jm(R.Ai|0,q,3)|0)==0){var ha=o,ba=v}else{ha=o,ba=r}h=62}else{if((s|0)==5){if((jm(R.$b|0,q,5)|0)==0){var ea=Pp|0,ja=R.$b|0,ra=-393217,Va=393216;h=52}else{ha=o,ba=r,h=62}}else{(s|0)==4?(K=(h=(jm(R.lj|0,q,4)|0)==0)?o&7:0,h?(ea=Qp|0,ja=R.fc|0,ra=-8,Va=K,h=52):(ha=o,ba=r,h=62)):(ha=o,ba=r,h=62)}}b:do{if(h==52){ha=0;c:for(;;){ba=p[ea+(ha<<3)>>2];if((ba|0)==0){break}K=(M|0)==(ve(ba)|0);do{if(K&&(jm(v,ba,M)|0)==0){ha=p[ea+(ha<<3)+4>>2];if((ha|0)==0){break c}if((ha|0)>(Va|0)){x=Bh(R.xk|0,(z=a,a+=8,p[z>>2]=ja,p[z+4>>2]=v,z));p[g>>2]=x;x=3;A=o;E=m;h=67;break a}ha|=ra&o;ba=r;break b}}while(0);ha=ha+1|0}x=Bh(R.mk|0,(z=a,a+=8,p[z>>2]=ja,p[z+4>>2]=v,z));p[g>>2]=x;x=1;A=o;E=m;h=67;break a}}while(0);o=ha;r=ba;q=M+(s+(q+2))|0}}}}else{h=63}}while(0);h==63&&(k=Kg(j+2|0),(k|0)==0?(w=7,h=69):(Ah(k,c,j),l[k+j|0]=0,l[j+(k+1)|0]=0,Y=i,da=b,ga=k,h=65));if(h==65){if(b=ng(da),p[e>>2]=b,(b|0)!=0){var ta=ga,xa=Y,Fa=0;h=68}else{e=Bh(R.Gk|0,(z=a,a+=4,p[z>>2]=da,z)),p[g>>2]=e,x=1,A=Y,E=ga,h=67}}h==67&&(Lg(E),ta=0,xa=A,Fa=x,h=68);h==68&&(p[d>>2]=xa,p[f>>2]=ta,w=Fa);return w}xo.X=1;function yo(b,c,d,e,f,g){var h,i,j,k=a;a+=100;if((c|0)==0){var m=1,o=0;i=3}else{var r=l[c]<<24>>24==0,q=(pg(c,R.Ig|0)|0)==0;if(q|r^1){var s=q,u=r,w=1;i=4}else{m=r,o=1,i=3}}i==3&&(s=(l[d+29|0]<<24>>24==2&1|0)!=0,u=m,w=o);f=(p[d+12>>2]&131072|0)==0?f:f|2;f=s?f|4:f;u|=s;m=(g&256|0)!=0&u?g&-769|512:g;o=qo(44);g=o>>2;r=(o|0)==0;a:do{if(r){q=7}else{l[o+8|0]=0;q=o;p[q>>2]=d;p[g+7]=o;p[g+8]=1;b:do{if(u){i=24}else{if((m&131072|0)==0){i=24}else{var v=p[b+8>>2]+1|0;j=bh(v);l[o+9|0]=1;if((j|0)==0){Lg(o);q=7;break a}v=Rp(b,c,v,j);if((v|0)!=0){Lg(j);Lg(o);q=v;break a}for(var x=$n;;){var A=y[x>>2];if((A|0)==0){Lg(j);i=24;break b}x=p[A>>2];if((pg(j,p[x+144>>2])|0)==0&&(p[x>>2]|0)==(b|0)){break}x=A+68|0}for(var x=d+8|0,E=p[d+4>>2];;){h=E-1|0;if((E|0)>0){E=p[p[x>>2]+(h<<4)+4>>2];if((E|0)==0){E=h;continue}if((p[E+4>>2]|0)!=(A|0)){E=h;continue}Lg(j);Lg(o);q=19;break a}p[g+1]=A;var J=A+64|0;p[J>>2]=p[J>>2]+1|0;Lg(j);var J=A,M=v;i=37;break b}}}}while(0);if(i==24){if(x=qo(84),j=x>>2,v=x,(x|0)==0){var D=7,K=v;i=52}else{if(h=x,i=h>>2,h=Sp(b,h,c,f,m),(h|0)!=0){D=h,K=v,i=52}else{if(E=p[i],h=k|0,Ed(h,0,100),E=p[E+60>>2],(p[E>>2]|0)==0?h=0:(h=Tp(E,h,100,0,0),h=(h|0)!=522?h:0),(h|0)!=0){D=h,K=v,i=52}else{l[x+16|0]=f&255;p[j+1]=d;h=p[i];E=x;p[h+152>>2]=32;p[h+156>>2]=E;p[g+1]=v;p[j+2]=0;p[j+3]=0;E=y[i];l[E+14|0]<<24>>24!=0&&(n[(x+22|0)>>1]|=1);i=(t[k+17|0]&255)<<16|(t[k+16|0]&255)<<8;var H=x+32|0;h=H>>2;p[h]=i;if((i-512|0)>>>0>65024){i=31}else{if((i+16777215&i|0)!=0){i=31}else{var N=t[k+20|0];n[(x+22|0)>>1]|=2;l[x+17|0]=(Xi(k+52|0)|0)!=0&1;l[x+18|0]=(Xi(k+64|0)|0)!=0&1;N&=255;i=34}}i==31&&(p[h]=0,s|w^1||(l[x+17|0]=0,l[x+18|0]=0),N=0);i=Oo(E,H,N);(i|0)!=0?(D=i,K=v,i=52):(p[j+9]=p[h]-N|0,l[o+9|0]<<24>>24!=0&&(p[j+16]=1,p[j+17]=p[$n>>2],p[$n>>2]=v),J=v,M=0,i=37)}}}}do{if(i==37){D=l[o+9|0]<<24>>24==0;b:do{if(!D){K=p[d+4>>2];j=d+8|0;for(v=0;;){if((v|0)>=(K|0)){break b}x=p[p[j>>2]+(v<<4)+4>>2];if((x|0)!=0&&l[x+9|0]<<24>>24!=0){var Q=x;break}v=v+1|0}for(;;){var P=Q+24|0,K=p[P>>2];if((K|0)==0){break}Q=K}K=y[g+1];if(K>>>0<y[Q+4>>2]>>>0){p[g+5]=Q,p[g+6]=0,p[P>>2]=o}else{for(j=Q;;){var L=j+20|0,v=y[L>>2];if((v|0)==0){p[g+5]=0;p[g+6]=j;break}if(y[v+4>>2]>>>0<K>>>0){j=v}else{p[g+5]=v;p[g+6]=j;p[v+24>>2]=o;break}}p[L>>2]=o}}}while(0);p[e>>2]=o;if((M|0)!=0){D=M,K=J}else{b=o+4|0;if((Up(p[q>>2],p[b>>2],0,0)|0)!=0){q=0;break a}Vp(p[p[p[b>>2]>>2]+176>>2],2e3);q=0;break a}}}while(0);(K|0)!=0&&(q=p[K>>2],(q|0)!=0&&ao(q));Lg(K);Lg(o);p[e>>2]=0;q=D}}while(0);a=k;return q}yo.X=1;function zo(b,c){var d=(c|0)==0?ni(0,84):Up(p[c>>2],p[c+4>>2],84,30);(d|0)==0?l[b+30|0]=1:l[d+76|0]<<24>>24==0&&(uo(d+8|0),uo(d+24|0),uo(d+40|0),uo(d+56|0),l[d+77|0]=1);return d}function Up(b,c,d,e){li(b,c);var b=c+48|0,f=p[b>>2];(f|0)!=0|(d|0)==0?c=f:(d=ni(0,d),p[b>>2]=d,p[c+52>>2]=e,c=d);return c}function lj(b){var c,d,e=a;a+=32;var f=e+16,g=b+8|0;d=g>>2;c=e>>2;p[c]=p[d];p[c+1]=p[d+1];p[c+2]=p[d+2];p[c+3]=p[d+3];var h=b+40|0;d=h>>2;c=f>>2;p[c]=p[d];p[c+1]=p[d+1];p[c+2]=p[d+2];p[c+3]=p[d+3];uo(h);Yn(b+24|0);c=p[f+8>>2];d=(c|0)==0;a:do{if(!d){for(h=c;;){if(qf(0,p[h+8>>2]),h=p[h>>2],(h|0)==0){break a}}}}while(0);Yn(f);uo(g);f=p[e+8>>2];g=(f|0)==0;a:do{if(!g){for(c=f;;){if(rf(0,p[c+8>>2]),c=p[c>>2],(c|0)==0){break a}}}}while(0);Yn(e);Yn(b+56|0);p[b+72>>2]=0;f=b+78|0;g=n[f>>1];(g&1)<<16>>16!=0&&(b=b+4|0,p[b>>2]=p[b>>2]+1|0,n[f>>1]=g&-2);a=e}lj.X=1;function Rp(b,c,d,e){l[e]=0;return Gd[p[b+36>>2]](b,c,d,e)}function Sp(b,c,d,e,f){var g,h,i,j,k,m=a;a+=8;k=m>>2;var o=m+4,r=e&1,q=(r|0)==0,s=e&2;p[k]=1024;j=(b+4|0)>>2;var u=p[j],u=(u|0)>32?u+7&-8:32;p[c>>2]=0;var w=e&4,e=w>>>2,d=(w|0)==0?d:0,w=(d|0)!=0;do{if(w){if(l[d]<<24>>24==0){var v=0,x=0,A=0,E=0;h=12}else{i=b+8|0;h=p[i>>2]+1|0;var J=bh(h<<1);if((J|0)==0){var M=7}else{l[J]=0;h=Rp(b,d,h,J);g=ve(J);var D=ve(d)+(d+1)|0,K=l[D]<<24>>24==0;a:do{if(K){var H=D}else{for(var N=D;;){var Q=ve(N),N=ve(Q+(N+1)|0)+(Q+(N+2))|0;if(l[N]<<24>>24==0){H=N;break a}}}}while(0);if((h|0)==0){if((g+8|0)<=(p[i>>2]|0)){v=H+1-D|0;x=D;A=g;E=J;h=12;break}Rh(42670);M=14}else{M=h}Lg(J)}h=34}}else{E=A=x=v=0,h=12}}while(0);a:do{if(h==12){if(H=qo((u<<1)+v+(p[j]+247&-8)+A*3+17|0),(H|0)==0){Lg(E),M=7}else{M=H;J=H+176|0;p[J>>2]=H+192|0;h=H+240|0;i=(H+60|0)>>2;p[i]=h;h=p[j]+247&-8;p[(H+68|0)>>2]=H+h|0;h=h+u|0;p[(H+64|0)>>2]=H+h|0;g=h+u|0;D=H+g|0;h=(H+144|0)>>2;p[h]=D;if((E|0)!=0){K=A+1|0;N=H+v+K+g|0;g=(H+148|0)>>2;p[g]=N;Ah(D,E,A);Ah(p[h]+K|0,x,v);Ah(p[g],E,A);D=R.Ch|0;K=p[g]+A|0;for(N=D+9;D<N;D++,K++){l[K]=l[D]}g=p[g]+A+9|0;D=H+184|0;p[D>>2]=g;Ah(g,E,A);g=p[D>>2]+A|0;l[g]=l[R.ba|0];l[g+1]=l[(R.ba|0)+1];l[g+2]=l[(R.ba|0)+2];l[g+3]=l[(R.ba|0)+3];l[g+4]=l[(R.ba|0)+4];Lg(E)}p[H>>2]=b;p[(H+120|0)>>2]=f;if(w){if(l[d]<<24>>24==0){h=23}else{if(p[o>>2]=0,h=Wp(b,p[h],p[i],f,o),g=p[o>>2]&1,(g|h|0)==0&&(Xp(M),D=y[H+124>>2],D>>>0>1024&&(p[k]=D>>>0>8192?8192:D)),(h|0)==0){var P=g,L=0;h=25}else{var I=h;h=26}}}else{h=23}h==23&&(l[H+16|0]=1,l[H+17|0]=4,P=f&1,L=1,h=25);do{if(h==25&&(I=Oo(M,m,-1),(I|0)==0)){b=(e|0)!=0;k=p[k];f=e^1;j=b?0:28;o=H;v=p[J>>2];x=v>>2;Ed(v,0,48);p[x+5]=k;p[x+6]=88;p[x+7]=f;p[x+8]=j;p[x+9]=o;p[x+4]=100;l[H+6|0]=(r^1)&255;l[H+7|0]=(P|0)!=0&(s|0)!=0&1;p[(H+132|0)>>2]=1073741823;l[H+13|0]=L;l[H+4|0]=L;l[H+18|0]=L;l[H+15|0]=e&255;l[H+14|0]=P&255;l[H+8|0]=L;L<<24>>24==0&&(l[H+9|0]=1,l[H+12|0]=2,l[H+11|0]=34,l[H+10|0]=2);n[H+116>>1]=88;r=H+136|0;p[(r|0)>>2]=-1;p[(r+4|0)>>2]=-1;Xp(M);q?b&&(l[H+5|0]=4):l[H+5|0]=2;p[(H+168|0)>>2]=26;p[c>>2]=M;M=0;break a}}while(0);Yp(p[i]);Lg(H);M=I}}}while(0);a=m;return M}Sp.X=1;function uj(b){return(b|0)!=0&1}function Xi(b){return(t[b+1|0]&255)<<16|(t[b]&255)<<24|t[b+3|0]&255|(t[b+2|0]&255)<<8}function Zp(b){var c=p[b+16>>2];(c|0)>-1?b=c:(c=(T.multiply(c,(c|0)<0?-1:0,-1024,-1),T.result[0]),b=p[b+24>>2]+p[b+20>>2]|0,b=(T.j(c,T.result[1],b,(b|0)<0?-1:0),T.result[0]));return b}function Pj(b,c){var d=c&255;if((d|0)==13||(d|0)==10){p[b+40>>2]=c,l[b+16|0]=6}return c}function Ti(b){var c=p[b+4>>2]+428|0;if((c|0)==0){b=0}else{var d=p[c>>2];if((d|0)==0){b=0}else{var b=(c+8|0)>>2,e=p[b];(e|0)<0?b=0:(c=Gd[d](p[c+4>>2],e),p[b]=(c|0)==0?-1:p[b]+1|0,b=c)}}return b}function ao(b){var c=p[b+172>>2];dj();l[b+4|0]=0;var d=b+180|0;$p(p[d>>2],t[b+10|0]&255,p[b+128>>2],c);p[d>>2]=0;Gp(b);if(l[b+15|0]<<24>>24==0){d=b+64|0;if((p[p[d>>2]>>2]|0)!=0){var e=aq(b);Pj(b,e)}bq(b)}else{cq(b),d=b+64|0}gj();Yp(p[d>>2]);Yp(p[b+60>>2]);ip(c);c=p[p[b+176>>2]+40>>2];if((c|0)!=0){Gd[p[of+140>>2]](c)}Lg(b)}function Vp(b,c){p[b+16>>2]=c;var d=p[b+40>>2];if((d|0)!=0){var e=p[of+116>>2],f=Zp(b);Gd[e](d,f)}}function $p(b,c,d,e){var f=a;a+=4;if((b|0)==0){b=0}else{var g=b+4|0,h=Gd[p[p[p[g>>2]>>2]+28>>2]](p[g>>2],4);(h|0)==0?(h=b+43|0,l[h]<<24>>24==0&&(l[h]=1),c=dq(b,0,0,0,c,d,e,0,0),(c|0)!=0?g=0:(p[f>>2]=-1,eq(p[g>>2],10,f),(p[f>>2]|0)!=1?(g=1,c=0):(g=b+16|0,d=p[g+4>>2],((d|0)>-1||(d|0)==-1&&p[g>>2]>>>0>4294967295)&&fq(b,0,0),g=0))):(g=0,c=h);gq(b,g);Yp(p[b+8>>2]);(g|0)!=0&&(dj(),hq(p[b>>2],p[b+100>>2],0),gj());Lg(p[b+32>>2]);Lg(b);b=c}a=f;return b}$p.X=1;function cq(b){var c;c=b+56|0;Mo(p[c>>2]);p[c>>2]=0;iq(b);c=p[b+180>>2];if((uj(c)|0)==0){if(l[b+4|0]<<24>>24==0){c=p[b+60>>2];c=(p[c>>2]|0)==0?7:(jq(c)&2048|0)==0?7:(l[b+5|0]&5)<<24>>24==1?8:7;c==7&&Yp(p[b+64>>2]);c=(kq(b,0)|0)==0;var d=b+16|0;!c&&l[d]<<24>>24==6&&(l[b+17|0]=5);l[b+18|0]=0;l[d]=0}}else{lq(c),l[b+16|0]=0}c=b+40|0;(p[c>>2]|0)!=0&&(Gp(b),l[b+18|0]=l[b+13|0],l[b+16|0]=0,p[c>>2]=0);c=b+72|0;p[c>>2]=0;p[c+4>>2]=0;c=b+80|0;p[c>>2]=0;p[c+4>>2]=0;l[b+19|0]=0}cq.X=1;function aq(b){var c,d=b+64|0;if(l[b+8|0]<<24>>24==0){if(c=Nj(p[d>>2],2),(c|0)==0){c=3}else{var e=c;c=4}}else{c=3}c==3&&(e=Fi(p[d>>2],b+80|0));return e}function bq(b){var c=t[b+16|0];c<<24>>24==6||c<<24>>24==0||((c&255)>1?(dj(),Wj(b),gj()):l[b+4|0]<<24>>24==0&&Oj(b,0));cq(b)}function Yp(b){var c=b|0,d=p[c>>2];(d|0)!=0&&(Gd[p[d+4>>2]](b),p[c>>2]=0)}function Wj(b){var c=b+16|0,d=t[c];a:do{if(!(d<<24>>24==6||d<<24>>24==1||d<<24>>24==0)){var e=(uj(p[b+180>>2])|0)==0;do{if(e){if((p[p[b+64>>2]>>2]|0)==0|d<<24>>24==2){e=Oj(b,0);if(!(l[b+15|0]<<24>>24==0&(d&255)>2)){var f=e;break}p[b+40>>2]=4;l[c]=6;break a}f=mq(b,0)}else{var f=nq(b,2,-1),g=Oj(b,t[b+19|0]&255),f=(f|0)!=0?f:g}}while(0);Pj(b,f)}}while(0)}function Oj(b,c){var d,e=b>>2,f=b+16|0;if((t[f]&255)<2){if((t[b+17|0]&255)<2){var g=0;d=21}else{d=3}}else{d=3}if(d==3){iq(b);var g=y[e+16],h=p[g>>2],i=(h|0)==0;a:do{if(i){d=0}else{if(((h|0)==(oq|0)&1|0)==0){d=t[b+5|0];do{if(d<<24>>24==3){d=(b+72|0)>>2;g=p[d]==0&&p[d+1]==0?0:Gi(g,0,0);p[d]=0;p[d+1]=0;d=g;break a}else{if(d<<24>>24!=1&&l[b+4|0]<<24>>24==0|d<<24>>24==5){Yp(g);if(l[b+13|0]<<24>>24!=0){d=0;break a}d=hq(p[e],p[e+37],0);break a}}}while(0);d=pq(b,c);var j=b+72|0;p[j>>2]=0;p[j+4>>2]=0}else{Yp(g),d=0}}}while(0);g=b+56|0;Mo(p[g>>2]);p[g>>2]=0;p[e+11]=0;g=b+176|0;Jj(p[g>>2]);Hp(p[g>>2],p[e+6]);e=b+180|0;g=p[e>>2];(uj(g)|0)!=0&&qq(g);l[b+4|0]<<24>>24==0?(e=p[e>>2],(uj(e)|0)!=0&&(rq(e,0)|0)==0?e=0:(e=kq(b,1),l[b+18|0]=0)):e=0;l[f]=1;l[b+19|0]=0;g=(d|0)==0?e:d}return g}Oj.X=1;function iq(b){var c;c=(b+96|0)>>2;var d=(p[c]|0)>0;a:do{if(d){for(var e=b+92|0,f=0;;){if(Mo(p[(p[e>>2]+16>>2)+(f*11|0)]),f=f+1|0,(f|0)>=(p[c]|0)){break a}}}}while(0);d=p[b+68>>2];(l[b+4|0]<<24>>24==0?6:((p[d>>2]|0)==(oq|0)&1|0)==0?7:6)==6&&Yp(d);d=b+92|0;Lg(p[d>>2]);p[d>>2]=0;p[c]=0;p[b+52>>2]=0}function Gi(b,c,d){return Gd[p[p[b>>2]+16>>2]](b,c,d)}function pq(b,c){var d,e=a;a+=8;var f=b+72|0;if(p[f>>2]==0&&p[f+4>>2]==0){f=0}else{d=b+136|0;var f=p[d>>2],g=p[d+4>>2];d=(b+64|0)>>2;var h=p[d],h=(c|0)!=0|(f==0&&g==0)?Gi(h,0,0):Ei(h,sq|0,28,0,0);if((h|0)!=0){f=h}else{if(h=l[b+8|0]<<24>>24==0?Nj(p[d],t[b+12|0]&255|16):0,(h|0)==0&((g|0)>0||(g|0)==0&&f>>>0>0)){var h=Fi(p[d],e),i=p[e+4>>2],f=(h|0)==0&((i|0)>(g|0)||(i|0)==(g|0)&&p[e>>2]>>>0>f>>>0)?Gi(p[d],f,g):h}else{f=h}}}a=e;return f}pq.X=1;function hq(b,c,d){return Gd[p[b+28>>2]](b,c,d)}function Jj(b){b|=0;var c=p[b>>2],d=(c|0)==0;a:do{if(!d){for(var e=c;;){if(Kp(e),e=p[b>>2],(e|0)==0){break a}}}}while(0)}function qq(b){var c=b+44|0;l[c]<<24>>24!=0&&(tq(b,0,1),l[c]=0,l[b+47|0]=0)}function rq(b,c){if((c|0)==0){var d=b+43|0;l[d]<<24>>24==0?d=0:(l[d]=0,(uq(b,(n[b+40>>1]<<16>>16)+3|0)|0)==0?d=l[d]<<24>>24==0:(l[d]=1,d=0),d&=1)}else{(c|0)>0?(vq(b,(n[b+40>>1]<<16>>16)+3|0),d=l[b+43|0]=1):d=l[b+43|0]<<24>>24==0&1}return d}function kq(b,c){var d=p[b+60>>2];if((p[d>>2]|0)==0){d=0}else{var d=Gd[p[p[d>>2]+32>>2]](d,c),e=b+17|0;l[e]<<24>>24!=5&&(l[e]=c&255)}return d}function uq(b,c){return l[b+43|0]<<24>>24==0?wq(p[b+4>>2],c,1,6):0}function vq(b,c){l[b+43|0]<<24>>24==0&&wq(p[b+4>>2],c,1,5)}function wq(b,c,d,e){return Gd[p[p[b>>2]+56>>2]](b,c,d,e)}function tq(b,c,d){l[b+43|0]<<24>>24==0&&wq(p[b+4>>2],c,d,9)}function Nj(b,c){return Gd[p[p[b>>2]+20>>2]](b,c)}function xq(b,c,d,e,f){var g;g=(b+20|0)>>2;var h=(p[g]!=e||p[g+1]!=f)|(e==0&&f==0);a:do{if(h){var i=p[b+4>>2];if((i|0)==0|((f|0)<0||(f|0)==0&&e>>>0<1020)){var j=i}else{for(var k=0,m=1020;;){if(i|=0,m=(T.add(m,k,1020,0),T.result[0]),k=T.result[1],i=p[i>>2],(i|0)==0|((k|0)>(f|0)||(k|0)==(f|0)&&m>>>0>e>>>0)){j=i;break a}}}}else{j=p[b+28>>2]}}while(0);h=(T.k(e,f,1020,0),T.result[0]);for(k=d;;){i=1020-h|0;m=(k|0)<(i|0)?k:i;Ah(c,j+(h+4)|0,m);k=k-i|0;if((k|0)<=-1){var o=j;break}c=c+m|0;j=p[j>>2];if(!((j|0)!=0&(k|0)>0)){o=j;break}h=0}d=(T.add(d,(d|0)<0?-1:0,e,f),T.result[0]);e=T.result[1];p[g]=d;p[g+1]=e;p[b+28>>2]=o;return 0}xq.X=1;function yq(b,c,d){var e,f=b+16|0;e=(b+8|0)>>2;for(var b=b+4|0,g=f|0;;){if((d|0)<=0){var h=0;break}var i=p[f>>2],j=(T.k(p[e],p[e+1],1020,0),T.result[0]),k=1020-j|0,k=(d|0)<(k|0)?d:k;if((j|0)==0){var m=Kg(1024),o=m;if((m|0)==0){h=3082;break}p[m>>2]=0;(i|0)==0?(i=m,p[b>>2]=i):(p[(i|0)>>2]=o,i=m);p[g>>2]=i}Ah(i+(j+4)|0,c,k);c=c+k|0;d=d-k|0;k=(T.add(p[e],p[e+1],k,(k|0)<0?-1:0),T.result[0]);j=T.result[1];p[e]=k;p[e+1]=j}return h}yq.X=1;function zq(b){var c=p[b+4>>2],d=(c|0)==0;a:do{if(!d){for(var e=c;;){var f=p[e>>2];Lg(e);if((f|0)==0){break a}e=f}}}while(0);Aq(b);return 0}function Aq(b){Ed(b,0,32);p[b>>2]=oq}function nq(b,c,d){var e,f=b>>2,g=y[f+10],h=(g|0)==0;do{if(h){e=(b+96|0)>>2;var i=y[e];if((i|0)>(d|0)){var j=(c|0)==1,k=(j&1^1)+d|0,i=(k|0)<(i|0);a:do{if(i){for(var m=b+92|0,o=k;;){if(Mo(p[(p[m>>2]+16>>2)+(o*11|0)]),o=o+1|0,(o|0)>=(p[e]|0)){break a}}}}while(0);p[e]=k;j?(k|0)!=0?e=g:(e=p[f+17],j=p[e>>2],(j|0)==0?e=g:(e=((j|0)==(oq|0)&1|0)==0?0:Gi(e,0,0),p[f+13]=0)):e=(uj(p[f+45])|0)==0&&(p[p[f+16]>>2]|0)==0?g:Bq(b,(k|0)==0?0:p[f+23]+(k-1)*44|0)}else{e=0}}else{e=g}}while(0);return e}nq.X=1;function mq(b,c){var d,e,f,g,h,i,j,k,m=a;a+=20;var o=m+8;k=o>>2;var r=m+12,q=m+16;j=q>>2;i=(b|0)>>2;var s=p[i];p[r>>2]=0;p[j]=1;h=(b+64|0)>>2;var u=Fi(p[h],m),w=(u|0)==0;a:do{if(w){var v=b+172|0,x=p[v>>2],A=Cq(p[h],x,p[p[i]+8>>2]+1|0);if((A|0)!=0){var E=A;f=23}else{x=l[x]<<24>>24==0?0:Dq(s,x,0,q);A=(x|0)!=0|(p[j]|0)==0;b:do{if(A){Q=x,f=25}else{var J=b+72|0;g=J>>2;p[g]=0;p[g+1]=0;f=(b+124|0)>>2;var M=b+128|0,D=b+80|0,K=b+24|0,H=c;c:for(;;){var N=Eq(b,c,p[m>>2],p[m+4>>2],o,r);if((N|0)!=0){if((N|0)==101){break}else{var Q=N;f=25;break b}}N=p[k];if((N|0)==-1){d=m|0;e=d>>2;N=p[e];d=m+4|0;d>>=2;var N=(T.b(N,p[d],p[f],0),T.result[0]),P=p[M>>2]+8|0,N=(T.j(N,T.result[1],P,(P|0)<0?-1:0),T.result[0]),L=p[k]=N}else{L=N}if((L|c|0)==0){d=D|0;e=d>>2;P=p[e];d=D+4|0;d>>=2;N=p[f];d=(T.add(N,0,P,p[d]),T.result[0]);e=T.result[1];var P=p[g],I=p[g+1];d==P&&e==I&&(d=m|0,e=d>>2,L=p[e],d=m+4|0,d>>=2,L=(T.b(L,p[d],P,I),T.result[0]),d=p[M>>2]+8|0,L=(T.j(L,T.result[1],d,(d|0)<0?-1:0),T.result[0]),p[k]=L)}else{d=J|0,e=d>>2,d=J+4|0,d>>=2,I=p[d],P=p[e],N=p[f]}if(P==N&&I==0){N=p[r>>2];P=Kj(b,N);if((P|0)!=0){E=P;f=23;break a}p[K>>2]=N}N=H;for(H=0;;){if(H>>>0>=L>>>0){H=N;continue c}(N|0)!=0&&Gp(b);N=Fq(b,J,0,1,0);if((N|0)!=0){if((N|0)==101){break}else{if((N|0)==522){break c}else{Q=N;f=25;break b}}}N=0;H=H+1|0}d=m|0;e=d>>2;H=p[e];d=m+4|0;d>>=2;N=p[d];p[g]=H;p[g+1]=N;H=0}l[b+18|0]=l[b+13|0];f=26}}while(0);if(f==25&&(l[b+18|0]=l[b+13|0],(Q|0)!=0)){var X=Q;f=33;break}v=y[v>>2];X=Cq(p[h],v,p[p[i]+8>>2]+1|0);if((X|0)==0){X=t[b+16|0];if((X&255)>3|X<<24>>24==0&&(X=Hi(b),(X|0)!=0)){f=33;break}X=Oj(b,l[v]<<24>>24!=0&1);X=(X|0)!=0?X:l[v]<<24>>24==0?0:(p[j]|0)==0?X:Gq(p[i],v)}f=33}}else{E=u,f=23}}while(0);f==23&&(l[b+18|0]=l[b+13|0],X=E);Xp(b);a=m;return X}mq.X=1;function Cq(b,c,d){var e,f=a;a+=24;var g=f+4;e=g>>2;var h=f+12,i=f+16;l[c]=0;var j=Fi(b,g),k=p[e],m=p[e+1],o=(j|0)!=0|((m|0)<0||(m|0)==0&&k>>>0<16);do{if(o){var r=j}else{var r=(T.add(k,m,-16,-1),T.result[0]),q=Hq(b,r,T.result[1],f),r=y[f>>2];if((q|0)==0&r>>>0<d>>>0){var q=g|0,s=g+4|0,q=(T.add(p[q>>2],p[s>>2],-12,-1),T.result[0]),q=Hq(b,q,T.result[1],h);if((q|0)!=0){r=q}else{if(q=i|0,s=(T.add(p[e],p[e+1],-8,-1),T.result[0]),s=Tp(b,q,8,s,T.result[1]),(s|0)!=0){r=s}else{if((jm(q,R.qa|0,8)|0)!=0){r=0}else{var q=g|0,q=p[q>>2],s=g+4|0,s=p[s>>2],u=(T.b(-16,-1,r,0),T.result[0]),q=(T.add(u,T.result[1],q,s),T.result[0]),q=Tp(b,c,r,q,T.result[1]);if((q|0)!=0){r=q}else{s=y[h>>2];if((r|0)==0){q=s}else{for(q=0;;){var w=s-(l[c+q|0]<<24>>24)|0,q=q+1|0;if(q>>>0>=r>>>0){break}s=w}q=p[h>>2]=w}(q|0)!=0&&(r=p[f>>2]=0);r=l[c+r|0]=0}}}}}else{r=q}}}while(0);a=f;return r}Cq.X=1;function Dq(b,c,d,e){return Gd[p[b+32>>2]](b,c,d,e)}function Eq(b,c,d,e,f,g){var h,i,j,k=a;a+=16;var m=k+8,o=k+12;i=Iq(b);var r=i[0],q=i[1],s=b+72|0;j=s>>2;var u;p[(s|0)>>2]=r;p[(s+4|0)>>2]=q;i=(b+124|0)>>2;var w=(T.add(p[i],0,r,q),T.result[0]);u=T.result[1];d=(u|0)>(e|0)||(u|0)==(e|0)&&w>>>0>d>>>0;do{if(d){e=101}else{(c|0)==0?(e=b+80|0,r==p[e>>2]&&q==p[e+4>>2]?(h=b+64|0,h>>=2,e=7):e=5):e=5;if(e==5){h=b+64|0;e=k|0;w=Tp(p[h>>2],e,8,r,q);if((w|0)!=0){e=w;break}if((jm(e,R.qa|0,8)|0)!=0){e=101;break}h>>=2}e=p[h];w=(T.add(r,q,8,0),T.result[0]);e=Hq(e,w,T.result[1],f);if((e|0)==0&&(e=p[h],w=(T.add(r,q,12,0),T.result[0]),e=Hq(e,w,T.result[1],b+48|0),(e|0)==0&&(e=p[h],w=(T.add(r,q,16,0),T.result[0]),e=Hq(e,w,T.result[1],g),(e|0)==0))){w=p[j];u=p[j+1];if(w==0&&u==0){e=p[h];w=(T.add(r,q,20,0),T.result[0]);e=Hq(e,w,T.result[1],o);if((e|0)!=0){break}e=p[h];w=(T.add(r,q,24,0),T.result[0]);e=Hq(e,w,T.result[1],m);if((e|0)!=0){break}e=p[m>>2];(e|0)==0&&(e=p[b+128>>2],p[m>>2]=e);if(e>>>0<512){e=101;break}w=y[o>>2];if(w>>>0<32|e>>>0>65536|w>>>0>65536){e=101;break}if((e-1&e|0)!=0){e=101;break}if((w-1&w|0)!=0){e=101;break}e=Oo(b,m,-1);p[i]=w;u=p[j+1];var v=p[j]}else{e=0,v=w,w=p[i]}v=(T.add(v,u,w,0),T.result[0]);w=T.result[1];u=s|0;p[u>>2]=v;u=s+4|0;p[u>>2]=w}}}while(0);a=k;return e}Eq.X=1;function Kj(b,c){var d,e=a;a+=8;var f;d=(b+60|0)>>2;var g=y[d];if((p[g>>2]|0)==0){f=0}else{if(f=t[b+16|0],(f&255)>3|f<<24>>24==0){f=y[b+128>>2];var h=Fi(g,e),g=(f|0)<0?-1:0,i=(T.multiply(f,g,c,0),T.result[0]),j=T.result[1];if((h|0)!=0){f=h}else{var h=p[e>>2],k=p[e+4>>2];if(h==i&&k==j){f=0}else{if((k|0)>(j|0)||(k|0)==(j|0)&&h>>>0>i>>>0){var m=Gi(p[d],i,j);f=9}else{h=(T.add(h,k,f,g),T.result[0]),k=T.result[1],(k|0)>(j|0)||(k|0)==(j|0)&&h>>>0>i>>>0?f=10:(m=p[b+172>>2],Ed(m,0,f),d=p[d],g=(T.b(i,j,f,g),T.result[0]),m=Ei(d,m,f,g,T.result[1]),f=9)}f==9&&(m|0)!=0?f=m:(p[b+32>>2]=c,f=0)}}}else{f=0}}a=e;return f}Kj.X=1;function Jq(b,c,d){var c=c-200|0,e=(c|0)>0;a:do{if(e){for(var f=b,g=c;;){if(f=(t[d+g|0]&255)+f|0,g=g-200|0,(g|0)<=0){var h=f;break a}}}else{h=b}}while(0);return h}function Kq(b){var c=p[b+28>>2],d=c|0,e=p[d>>2];p[b+32>>2]=e;(e|0)!=0&&(p[(e+36|0)>>2]=b);p[d>>2]=b;d=c+4|0;(p[d>>2]|0)==0&&(p[d>>2]=b);c=c+8|0;(p[c>>2]|0)==0&&(n[b+24>>1]&4)<<16>>16==0&&(p[c>>2]=b)}function Iq(b){var c=b+72|0,d=p[c>>2],c=p[c+4>>2];d==0&&c==0?d=b=0:(d=(T.add(d,c,-1,-1),T.result[0]),b=p[b+124>>2],d=(T.j(d,T.result[1],b,0),T.result[0]),d=(T.add(d,T.result[1],1,0),T.result[0]),d=(T.multiply(d,T.result[1],b,0),T.result[0]),b=T.result[1]);return[d,b]}function Fq(b,c,d,e,f){var g,h=c>>2,i=b>>2,j=a;a+=12;var k,m=j+4,o=j+8,r=y[i+43],q=(e|0)!=0,s=y[(q?b+64|0:b+68|0)>>2],u=Hq(s,p[h],p[h+1],m),w=(u|0)==0;a:do{if(w){g=(b+128|0)>>2;var v=p[g],x=(T.add(p[h],p[h+1],4,0),T.result[0]),v=Tp(s,r,v,x,T.result[1]);if((v|0)!=0){g=v}else{var v=(e<<2)+p[g]+4|0,x=(T.add(v,(v|0)<0?-1:0,p[h],p[h+1]),T.result[0]),A=T.result[1];p[h]=x;p[h+1]=A;v=y[m>>2];if((v|0)==0){g=101}else{if((v|0)==(((p[si>>2]|0)/(p[g]|0)&-1)+1|0)){g=101}else{if(v>>>0>y[i+6]>>>0){g=0}else{if((wj(d,v)|0)!=0){g=0}else{do{if(q){k=(T.add(x,A,-4,-1),T.result[0]);k=Hq(s,k,T.result[1],o);if((k|0)!=0){g=k;break a}if((f|0)==0&&(Jq(p[i+12],p[g],r)|0)!=(p[o>>2]|0)){g=101;break a}}}while(0);if((d|0)!=0&&(x=ej(d,v),(x|0)!=0)){g=x;break}if(x=(v|0)==1){A=b+118|0,k=t[r+20|0],(n[A>>1]<<16>>16|0)!=(k&255|0)&&(n[A>>1]=k&255)}A=(uj(p[i+45])|0)==0?Lq(p[i+44],v):0;p[j>>2]=A;if(q){if(l[b+8|0]<<24>>24==0){k=c|0;var E=c+4|0,J=p[E>>2],M=b+80|0,E=M|0,M=M+4|0,M=p[M>>2];k=(J|0)<=(M|0)&&((J|0)<(M|0)||p[k>>2]>>>0<=p[E>>2]>>>0)}else{k=1}E=k&1}else{E=((A|0)==0?1:(n[A+24>>1]&4)<<16>>16==0)&1}k=y[i+15];if((p[k>>2]|0)==0){k=31}else{if(J=t[b+16|0],J<<24>>24!=0&(J&255)<4|(E|0)==0){k=31}else{var D=p[g],K=(T.multiply(v-1|0,0,D,(D|0)<0?-1:0),T.result[0]),D=Ei(k,r,D,K,T.result[1]),K=b+32|0;v>>>0>y[K>>2]>>>0&&(p[K>>2]=v);K=p[i+22];(K|0)!=0&&Mq(K,v,r);K=A;k=35}}do{if(k==31){if(q){D=0,K=A,k=35}else{if((A|0)!=0){var H=A,N=0;k=36}else{D=b+20|0;l[D]=l[D]+1&255;K=ti(b,v,j,1);l[D]=l[D]-1&255;if((K|0)!=0){g=K;break a}K=p[j>>2];n[(K+24|0)>>1]&=-9;Nq(K);D=0;k=35}}}}while(0);if(k==35){if((K|0)==0){g=D;break}H=K;N=D}v=p[H+4>>2];Ah(v,r,p[g]);Gd[p[i+42]](H);do{if(q){if((f|0)!=0&&(k=c|0,E=c+4|0,g=p[E>>2],A=b+80|0,E=A|0,M=A+4|0,A=p[M>>2],(g|0)>(A|0)||(g|0)==(A|0)&&p[k>>2]>>>0>p[E>>2]>>>0)){break}Kp(H)}}while(0);if(x){g=v+24|0;v=b+100|0;for(x=g+16;g<x;g++,v++){l[v]=l[g]}}kj(H);g=N}}}}}}else{g=u}}while(0);a=j;return g}Fq.X=1;function Gq(b,c){var d,e=a;a+=12;d=e>>2;var f=e+8,g=b+4|0,h=qo(p[g>>2]<<1),g=h+p[g>>2]|0;if((h|0)==0){Lg(0),h=7}else{var i=Wp(b,c,h,16385,0);if((i|0)==0){var i=Fi(h,e),j=(i|0)==0;a:do{if(j){var k=p[b+8>>2],m=k+1|0,k=bh(k+p[d]+2|0);if((k|0)==0){m=0,k=7}else{var o=e|0,o=p[o>>2],r=(T.add(o,p[(e+4|0)>>2],1,0),T.result[0]),r=k+r|0,o=Tp(h,k,o,0,0);if((o|0)!=0){m=k,k=o}else{o=e|0;l[k+p[o>>2]|0]=0;for(var q=o=k;;){var s=q-o|0,u=(s|0)<0?-1:0,w=p[d+1];if(!((u|0)<(w|0)||(u|0)==(w|0)&&s>>>0<p[d]>>>0)){break}s=Dq(b,q,0,f);if((s|0)!=0){m=k;k=s;break a}s=(p[f>>2]|0)==0;do{if(!s){u=Wp(b,q,g,2049,0);if((u|0)!=0){m=k;k=u;break a}u=Cq(g,r,m);Yp(g);if((u|0)!=0){m=k;k=u;break a}if(l[r]<<24>>24!=0&&(pg(r,c)|0)==0){m=k;k=u;break a}}}while(0);q=ve(q)+(q+1)|0}Yp(h);r=hq(b,c,0);m=k;k=r}}}else{m=0,k=i}}while(0);Lg(m);d=k}else{Lg(0),d=i}Yp(h);Lg(h);h=d}a=e;return h}Gq.X=1;function Xp(b){var c;if(l[b+13|0]<<24>>24==0){if(c=b+60|0,(jq(p[c>>2])&4096|0)!=0){c=3}else{var d=Oq(p[c>>2]);c=b+124|0;d=d>>>0<32?512:d;p[c>>2]=d;d>>>0>65536&&(p[c>>2]=65536);c=6}}else{c=3}c==3&&(p[b+124>>2]=512)}function jq(b){return Gd[p[p[b>>2]+48>>2]](b)}function Oq(b){var c=p[p[b>>2]+44>>2];return(c|0)==0?4096:Gd[c](b)}function Wp(b,c,d,e,f){return Gd[p[b+24>>2]](b,c,d,e&556927,f)}function Tp(b,c,d,e,f){return Gd[p[p[b>>2]+8>>2]](b,c,d,e,f)}function Hq(b,c,d,e){var f=a;a+=4;var g=f|0,b=Tp(b,g,4,c,d);(b|0)==0&&(p[e>>2]=Xi(g));a=f;return b}function Lq(b,c){var d=a;a+=4;bj(b,c,0,d);var e=p[d>>2];a=d;return e}function Mq(b,c,d){var e=(b|0)==0;a:do{if(!e){for(var f=b;;){var g=f+28|0;if((((p[g>>2]|0)==5||(p[g>>2]|0)==0||(p[g>>2]|0)==6?0:1)|0)==0&&y[f+16>>2]>>>0>c>>>0){var h=ui(f,c,d);(h|0)!=0&&(p[g>>2]=h)}f=y[f+44>>2];if((f|0)==0){break a}}}}while(0)}function Nq(b){var c;c=(b+24|0)>>1;var d=n[c],e=d&-33;n[c]=e;(d&2)<<16>>16==0&&(n[c]=e|2,Kq(b))}function kj(b){var c=b+26|0,d=n[c>>1]-1&65535;n[c>>1]=d;d<<16>>16==0&&(c=p[b+28>>2]+12|0,p[c>>2]=p[c>>2]-1|0,(n[b+24>>1]&2)<<16>>16==0?Lp(b):(Ip(b),Kq(b)))}function bj(b,c,d,e){var f,g=b>>2,h;f=(b+40|0)>>2;h=p[f];if((h|0)!=0|(d|0)==0){var i=h,j=b+28|0;h=5}else{h=b+28|0;var k=Gd[p[of+112>>2]](p[g+5],p[g+6]+40|0,p[h>>2]);if((k|0)==0){var m=7;h=32}else{i=p[of+116>>2],j=Zp(b),Gd[i](k,j),i=p[f]=k,j=h,h=5}}do{if(h==5){m=((p[j>>2]|0)==0?2:(p[g]|0)!=0?1:2)*d|0;k=(i|0)==0?0:Gd[p[of+124>>2]](i,c,m);if((k|0)==0&(m|0)==1){var o=k=b+8|0;a:for(;;){o=p[o>>2];if((o|0)==0){h=16;break}var r=n[o+26>>1]<<16>>16==0;do{if(r&&(n[o+24>>1]&4)<<16>>16==0){var q=p[k>>2]=o;h=20;break a}}while(0);o=o+36|0}a:do{if(h==16){p[k>>2]=0;for(o=b+4|0;;){o=p[o>>2];if((o|0)==0){h=21;break a}if(n[o+26>>1]<<16>>16==0){q=o;h=20;break a}o=o+36|0}}}while(0);if(h==20&&(k=Gd[p[g+8]](p[g+9],q),!((k|0)==5||(k|0)==0))){m=k;break}r=Gd[p[of+124>>2]](p[f],c,2)}else{r=k}if((r|0)==0){p[e>>2]=0}else{h=o=k=p[r+4>>2];if((p[h>>2]|0)==0){Ed(k,0,40);p[h>>2]=r;p[(k+4|0)>>2]=p[r>>2];var s=k+40|0;p[(k+8|0)>>2]=s;Ed(s,0,p[g+6]);p[(k+28|0)>>2]=b;p[(k+16|0)>>2]=c;s=k+26|0;h=27}else{if(h=k+26|0,r=n[h>>1],r<<16>>16==0){s=h,h=27}else{var u=r,w=h;h=28}}h==27&&(u=b+12|0,p[u>>2]=p[u>>2]+1|0,u=n[s>>1],w=s);n[w>>1]=u+1&65535;(c|0)==1&&(p[g+11]=o);p[e>>2]=o;if((k|0)!=0){m=0;break}}m=(m|0)!=0?7:0}}while(0);return m}bj.X=1;function Pq(b,c){var d=a;a+=40;var e=b,f=c,g=d;a:for(;;){var h=f+16|0;if((f|0)==0){f=g+12|0;if((e|0)==0){p[f>>2]=0;break}p[f>>2]=e;break}else{for(var i=e,j=g;;){if((i|0)==0){p[j+12>>2]=f;break a}j=j+12|0;if(y[i+16>>2]>>>0>=y[h>>2]>>>0){p[j>>2]=f;e=i;g=f;f=p[f+12>>2];continue a}j=p[j>>2]=i;i=p[i+12>>2]}}}e=p[d+12>>2];a=d;return e}function Bq(b,c){var d,e,f,g,h,i=a;a+=16;var j;h=i>>2;var k=i+4,m=i+8,o=(c|0)!=0,r=c+20|0;if(o){var q=Ko(p[r>>2]);if((q|0)==0){var s=7;j=33}else{var u=q;j=3}}else{u=0,j=3}a:do{if(j==3){p[b+24>>2]=p[(o?r:b+28|0)>>2];l[b+18|0]=l[b+13|0];b:do{if(o){var w=b+72|0,v=w|0;g=v>>2;var x=p[g],A=w+4|0;f=A>>2;var E=p[f];if((uj(p[b+180>>2])|0)!=0){var J=w,M=E,D=x;j=12}else{var K=c+8|0,v=K|0;g=v>>2;var H=p[g],A=K+4|0;f=A>>2;var N=p[f],Q=H==0&&N==0,P=Q?x:H,L=Q?E:N,I=c|0,X=p[I+4>>2];p[w>>2]=p[I>>2];p[w+4>>2]=X;for(var Y=0;;){if((Y|0)!=0){var da=Y,ga=w,ha=E,ba=x;j=13;break b}var ea=w|0;e=ea>>2;var ja=w+4|0;d=ja>>2;var ra=p[d];if(!((ra|0)<(L|0)||(ra|0)==(L|0)&&p[e]>>>0<P>>>0)){da=0;ga=w;ha=E;ba=x;j=13;break b}Y=Fq(b,w,u,1,1)}}}else{if((uj(p[b+180>>2])|0)==0){var Va=b+72|0,v=Va|0;g=v>>2;A=Va+4|0;f=A>>2;J=Va;M=p[f];D=p[g];j=12}else{var ta=b;p[ta+24>>2]=p[ta+28>>2];var xa,Fa=p[ta+180>>2],Na=ta;if(l[Fa+44|0]<<24>>24==0){var Ea=0}else{var La=Fa+68|0,za=y[La>>2];Ah(Fa+52|0,p[p[Fa+32>>2]>>2],48);var Ba=p[La>>2]+1|0,Ja=Ba>>>0>za>>>0;c:do{if(Ja){var ka=0}else{for(var S=Ba;;){var ib=(S+33|0)>>>12,Wa=S+33|0,Za=Qq(Na,p[((ib|0)==0?(Wa<<2)+p[p[Fa+32>>2]>>2]|0:((Wa&4095)<<2)+p[p[Fa+32>>2]+(ib<<2)>>2]|0)>>2]),Sa=S+1|0;if((Za|0)!=0|Sa>>>0>za>>>0){ka=Za;break c}S=Sa}}}while(0);Rq(Fa);Ea=ka}xa=Ea;var tb=Hj(p[ta+176>>2]),pb=(tb|0)!=0&(xa|0)==0;c:do{if(pb){for(var fb=tb;;){var Xa=p[fb+12>>2],Ab=Qq(ta,p[fb+16>>2]);if(!((Xa|0)!=0&(Ab|0)==0)){var rb=Ab;break c}fb=Xa}}else{rb=xa}}while(0);s=rb;break a}}}while(0);j==12&&(p[J>>2]=0,da=p[J+4>>2]=0,ga=J,ha=M,ba=D);var cb=b+80|0,Cb=b+124|0,Zb=b+128|0,dc=da;b:for(;;){var kb=(dc|0)==0;if(!kb){break}ea=ga|0;e=ea>>2;ja=ga+4|0;d=ja>>2;var Oa=p[d];if(!((Oa|0)<(ha|0)||(Oa|0)==(ha|0)&&p[e]>>>0<ba>>>0)){break}p[h]=0;var Db=Eq(b,0,ba,ha,i,k),Wb=p[h];if((Wb|0)==0){ea=cb|0;e=ea>>2;var Nb=p[e],ja=cb+4|0;d=ja>>2;var $b=(T.add(p[Cb>>2],0,Nb,p[d]),T.result[0]),Rb=T.result[1],Ra=p[ga>>2],Ob=p[ga+4>>2];if($b==Ra&&Rb==Ob){var Ua=(T.b(ba,ha,Ra,Ob),T.result[0]),Jb=p[Zb>>2]+8|0,Vb=(T.j(Ua,T.result[1],Jb,(Jb|0)<0?-1:0),T.result[0]);p[h]=Vb;Pb=0;sb=Db;db=Vb}else{var Pb=0,sb=Db,db=0}}else{Pb=0,sb=Db,db=Wb,j=19}for(;;){if(!((sb|0)==0&Pb>>>0<db>>>0)){dc=sb;continue b}ea=ga|0;e=ea>>2;ja=ga+4|0;d=ja>>2;var wb=p[d];if(!((wb|0)<(ha|0)||(wb|0)==(ha|0)&&p[e]>>>0<ba>>>0)){dc=sb;continue b}var ob=Fq(b,ga,u,1,1),Pb=Pb+1|0,sb=ob,db=p[h]}}b:do{if(o){var Kb=c+24|0,ub=y[Kb>>2],Xb=p[Zb>>2]+4|0,Sb=(T.multiply(Xb,(Xb|0)<0?-1:0,ub,0),T.result[0]),Qb=T.result[1];p[m>>2]=Sb;p[m+4>>2]=Qb;var ac=p[b+180>>2];if((uj(ac)|0)==0){var Gb=dc,xb=ub}else{var Ta=ac,qb=c+28|0,bc=qb+12|0,$a=Ta+104|0;if((p[bc>>2]|0)==(p[$a>>2]|0)){var mb=p[qb>>2]}else{p[qb>>2]=0,p[bc>>2]=p[$a>>2],mb=0}var Bb=Ta+68|0;mb>>>0<y[Bb>>2]>>>0&&(p[Bb>>2]=mb,p[Ta+76>>2]=p[qb+4>>2],p[Ta+80>>2]=p[qb+8>>2],Rq(Ta));Gb=0;xb=p[Kb>>2]}for(var bb=b+52|0,jb=xb,nb=Gb;;){if((nb|0)!=0){Mo(u);s=nb;break a}if(jb>>>0>=y[bb>>2]>>>0){Mo(u);break b}var zb=Fq(b,m,u,0,1),jb=jb+1|0,nb=zb}}else{if(Mo(u),!kb){s=dc;break a}}}while(0);ea=ga|0;e=ea>>2;p[e]=ba;ja=ga+4|0;d=ja>>2;p[d]=ha;s=0}}while(0);a=i;return s}Bq.X=1;function Rq(b){var c=a;a+=12;var d=c+4,e=c+8;p[c>>2]=0;p[d>>2]=0;p[e>>2]=0;var f=b+68|0,g=p[f>>2];if((g|0)!=0){Sq(b,(g+33|0)>>>12,c,d,e);e=p[f>>2]-p[e>>2]|0;b=y[c>>2];for(f=0;;){if(g=(f<<1)+b|0,(Vc[g>>1]&65535|0)>(e|0)&&(n[g>>1]=0),f=f+1|0,(f|0)==8192){break}}d=(e+1<<2)+p[d>>2]|0;Ed(d,0,b-d|0)}a=c}function Sq(b,c,d,e,f){var g=a;a+=4;b=Tq(b,c,g);if((b|0)==0){var h=p[g>>2];if((c|0)==0){var i=h+136|0;p[g>>2]=i;c=0}else{c=(c<<12)-34|0,i=h}p[e>>2]=i-4|0;p[d>>2]=h+16384|0;p[f>>2]=c}a=g;return b}function Tq(b,c,d){var e,f;f=(b+24|0)>>2;if((p[f]|0)>(c|0)){var g=p[b+32>>2];f=5}else{var h=c+1|0,i=b+32|0,j=dh(p[i>>2],h<<2);if((j|0)==0){var k=7;e=0;f=12}else{g=p[f],Ed((g<<2)+j|0,0,h-g<<2),p[i>>2]=j,p[f]=h,g=j,f=5}}f==5&&(e=(b+32|0)>>2,k=(c<<2)+g|0,(p[k>>2]|0)==0?l[b+43|0]<<24>>24==2?(b=qo(32768),p[((c<<2)+p[e]|0)>>2]=b,b=(p[p[e]+(c<<2)>>2]|0)!=0?0:7):(k=Gd[p[p[p[b+4>>2]>>2]+52>>2]](p[b+4>>2],c,32768,t[b+44|0]&255,k),(k|0)!=8?b=k:(l[b+46|0]|=2,b=0)):b=0,k=b,e=p[p[e]+(c<<2)>>2]);p[d>>2]=e;return k}Tq.X=1;function Qq(b,c){var d=Uq(p[b+176>>2],c);if((d|0)==0){d=0}else{if((n[d+26>>1]<<16>>16|0)==1){hj(d),d=0}else{var e=cj(d);if((e|0)==0){Gd[p[b+168>>2]](d)}vi(d);d=e}}Mj(p[b+88>>2]);return d}function Hj(b){b|=0;var c=p[b>>2];if((c|0)==0){b=0}else{for(;;){var d=p[c+32>>2];p[c+12>>2]=d;if((d|0)==0){break}c=d}b=p[b>>2]}var e=b,f,b=a;a+=128;c=b|0;d=b>>2;for(f=d+32;d<f;d++){p[d]=0}if((e|0)==0){d=1,c=0}else{d=b+124|0;for(f=e;;){var g=f+12|0,e=p[g>>2];p[g>>2]=0;for(var h=f,g=0;;){if((g|0)>=31){if((g|0)!=31){break}f=Pq(p[d>>2],h);p[d>>2]=f;break}f=((g<<2)+b|0)>>2;var i=p[f];if((i|0)==0){p[f]=h;break}h=Pq(i,h);p[f]=0;g=g+1|0}if((e|0)==0){break}f=e}d=1;c=p[c>>2]}for(;;){var j=Pq(c,p[b+(d<<2)>>2]),c=d+1|0;if((c|0)==32){break}d=c;c=j}a=b;return j}function Uq(b,c){var d=a;a+=4;p[d>>2]=0;bj(b,c,0,d);var e=p[d>>2];a=d;return e}function hj(b){(n[b+24>>1]&2)<<16>>16!=0&&Ip(b);var c=p[b+28>>2],d=c+12|0;p[d>>2]=p[d>>2]-1|0;(p[b+16>>2]|0)==1&&(p[(c+44|0)>>2]=0);Gd[p[of+128>>2]](p[c+40>>2],p[b>>2],1)}function cj(b){var c=b>>2,b=a;a+=4;var d=p[c+5],e=p[c+4];p[b>>2]=0;var f=d+128|0,g=p[f>>2],h=d+60|0;if((p[p[h>>2]>>2]|0)==0){Ed(p[c+1],0,g),d=0}else{var i=p[d+180>>2];if((uj(i)|0)==0){var j=i=0}else{i=Vq(i,e,b,g,p[c+1]),j=p[b>>2]}(j|i|0)==0?(f=p[f>>2],f=(T.multiply(f,(f|0)<0?-1:0,e-1|0,0),T.result[0]),g=Tp(p[h>>2],p[c+1],g,f,T.result[1]),g=(g|0)!=522?g:0):g=i;if((e|0)!=1){d=g}else{if((g|0)==0){c=p[c+1]+24|0;d=d+100|0;for(e=c+16;c<e;c++,d++){l[d]=l[c]}d=0}else{d=d+100|0;for(e=d+16;d<e;d++){l[d]=255}d=g}}}a=b;return d}cj.X=1;function Vq(b,c,d,e,f){var g,h=a;a+=12;var i,j=h+4,k=h+8,m=y[b+68>>2],o=(m|0)==0;a:do{if(o){i=3}else{if(n[b+40>>1]<<16>>16==0){i=3}else{var r=(m+33|0)>>>12,q=0;b:for(;;){var s=(q|0)==0;if((r|0)>-1&s){s=Sq(b,r,h,j,k);if((s|0)!=0){var u=s;i=19;break a}for(var s=p[h>>2],w=p[k>>2],v=p[j>>2],x=8192,A=c*383&8191,E=0;;){g=((A<<1)+s|0)>>1;if(n[g]<<16>>16==0){r=r-1|0;q=E;continue b}var J=(Vc[g]&65535)+w|0;g=J>>>0>m>>>0?E:(p[v+((Vc[g]&65535)<<2)>>2]|0)!=(c|0)?E:J;if((x|0)==0){aj(47555);u=11;i=19;break a}A=A+1&8191;x=x-1|0;E=g}}else{if(s){u=p[d>>2]=0;i=19;break a}c=Vc[b+66>>1]&65535;q=(T.multiply(c&65024|c<<16&65536|24,0,q-1|0,0),T.result[0]);q=(T.add(q,T.result[1],56,0),T.result[0]);c=T.result[1];p[d>>2]=1;u=Tp(p[b+8>>2],f,e,q,c);i=19;break a}}}}}while(0);i==3&&(u=p[d>>2]=0);a=h;return u}Vq.X=1;function Wq(b){b&=65535;return b<<16&65536|b&65024}function aj(b){var c=a;cf(11,R.Rg|0,(z=a,a+=8,p[z>>2]=b,p[z+4>>2]=R.Y+20|0,z));a=c}function lq(b){qq(b);var c=b+40|0,d=n[c>>1];d<<16>>16>-1&&(vq(b,(d<<16>>16)+3|0),n[c>>1]=-1)}function dq(b,c,d,e,f,g,h,i,j){var k=a;a+=4;var m;p[k>>2]=0;var o=l[b+46|0]<<24>>24==0;do{if(o){var r=Xq(b,1,1);if((r|0)==0){r=b+45|0;l[r]=1;if((c|0)==0){q=0,m=6}else{if(m=Yq(b,d,e,0,1),(m|0)!=0){if((m|0)==5){var q=0;m=6}else{var s=m,u=c;m=15}}else{l[b+44|0]=1,q=c,m=6}}a:do{if(m==6){s=Zq(b,k);if((s|0)==0){s=b+68|0;u=(p[s>>2]|0)==0;do{if(!u&&(Wq(n[b+66>>1])|0)!=(g|0)){aj(48147);s=11;u=q;break a}}while(0);u=$q(b,q,d,e,f,h);if((u|0)==5||(u|0)==0){(i|0)!=0&&(p[i>>2]=p[s>>2]),(j|0)!=0&&(p[j>>2]=p[(p[p[b+32>>2]>>2]+96|0)>>2])}s=u}u=q}}while(0);(p[k>>2]|0)!=0&&Ed(b+52|0,0,48);qq(b);tq(b,1,1);l[r]=0;r=(s|0)!=0|(u|0)==(c|0)?s:5}}else{r=8}}while(0);a=k;return r}dq.X=1;function eq(b,c,d){Gd[p[p[b>>2]+40>>2]](b,c,d)}function fq(b,c,d){var e=a;a+=8;dj();var f=b+8|0,g=Fi(p[f>>2],e),h=p[e+4>>2],c=(g|0)==0&((h|0)>(d|0)||(h|0)==(d|0)&&p[e>>2]>>>0>c>>>0)?Gi(p[f>>2],c,d):g;gj();(c|0)!=0&&(b=p[b+100>>2],cf(c,R.Yg|0,(z=a,a+=4,p[z>>2]=b,z)));a=e}function gq(b,c){var d=l[b+43|0]<<24>>24==2;a:do{if(d){var e=b+24|0;if((p[e>>2]|0)>0){for(var f=b+32|0,g=0;;){if(Lg(p[p[f>>2]+(g<<2)>>2]),p[((g<<2)+p[f>>2]|0)>>2]=0,g=g+1|0,(g|0)>=(p[e>>2]|0)){break a}}}}else{e=p[b+4>>2],Gd[p[p[e>>2]+64>>2]](e,c)}}while(0)}function Xq(b,c,d){return l[b+43|0]<<24>>24==0?wq(p[b+4>>2],c,d,10):0}function Yq(b,c,d,e,f){var g=(c|0)==0;a:do{if(g){var h=Xq(b,e,f)}else{for(;;){var i=Xq(b,e,f);if((i|0)!=5){h=i;break a}if((Gd[c](d)|0)==0){h=5;break a}}}}while(0);return h}function Zq(b,c){var d=a;a+=4;var e,f=Tq(b,0,d),g=(f|0)==0;a:do{if(g){if((p[d>>2]|0)==0){var h=1;e=4}else{if(e=br(b,c),(e|0)==0){var i=0;e=13}else{h=e,e=4}}if(e==4){i=(l[b+46|0]&2)<<24>>24==0;do{if(i){e=Xq(b,0,1);if((e|0)!=0){break a}e=b+44|0;l[e]=1;var j=Tq(b,0,d);if((j|0)==0){var k=br(b,c);(k|0)==0?j=k=0:(j=cr(b),p[c>>2]=1)}else{k=h}l[e]=0;tq(b,0,1);e=k;k=j}else{k=uq(b,0),(k|0)!=0?e=h:(vq(b,0),e=h,k=264)}}while(0);if((e|0)!=0){e=k;break}i=k}(p[b+52>>2]|0)==3007e3?e=i:(Rh(47200),e=14)}else{e=f}}while(0);a=d;return e}Zq.X=1;function $q(b,c,d,e,f,g){var h,i,j,k,m,o=a;a+=28;var r;m=o>>2;var q=o+4,s=o+8,u=o+12,w=o+20;k=w>>2;p[m]=0;p[q>>2]=0;p[s>>2]=0;var v=Wq(n[b+66>>1]),x=b+32|0,A=p[p[x>>2]>>2]+96|0;j=(A|0)>>2;i=(b+68|0)>>2;var E=y[j]>>>0<y[i]>>>0;do{if(E){var J=dr(b,o);if((J|0)==0){var J=(c|0)!=0,M=b+72|0,D=y[M>>2],K=J?d:0,H=1,N=p[i],Q=0;a:for(;;){if((H|0)>=5){r=9;break}var P=(H<<2)+A+4|0,L=y[P>>2],I=N>>>0>L>>>0;do{if(I){var X=H+3|0,Y=Yq(b,K,e,X,1);if((Y|0)!=0){if((Y|0)==5){var X=0,Y=L,da=5;break}else{var ga=Y;r=35;break a}}p[P>>2]=-1;tq(b,X,1);X=K;Y=N;da=0}else{X=K,Y=N,da=Q}}while(0);K=X;H=H+1|0;N=Y;Q=da}do{if(r==9){ga=y[j]>>>0<N>>>0;do{if(ga){if(H=Yq(b,K,e,3,1),(H|0)==0){P=y[j];if(H=(f|0)!=0){if(r=Nj(p[b+8>>2],f),(r|0)==0){r=14}else{var ha=r,ba=(v|0)<0?-1:0,ea=v;h=b+4|0;h>>=2;r=17}}else{r=14}r==14&&(ea=v,ba=(v|0)<0?-1:0,ha=(T.multiply(D,0,ea,ba),T.result[0]),h=T.result[1],p[k]=ha,p[k+1]=h,h=b+4|0,ha=Fi(p[h>>2],u),(ha|0)==0&&(L=p[u+4>>2],I=p[k+1],(L|0)<(I|0)||(L|0)==(I|0)&&p[u>>2]>>>0<p[k]>>>0?eq(p[h>>2],5,w):ha=0),h>>=2);L=p[m];I=X=v+24|0;X=(X|0)<0?-1:0;Y=b+8|0;da=ha;a:for(;;){if((da|0)!=0){var ja=da;break}for(;;){var da=L,ra=q,Va=s,ta=da|0,xa=y[ta>>2],Fa=p[da+4>>2],Na=-1;b:for(;;){c:for(;;){var Ea=Fa-1|0;if((Fa|0)<=0){break b}for(var Fa=da+Ea*20+8|0,La=da+Ea*20+12|0,za=da+Ea*20+16|0,Ba=p[(da+20>>2)+(Ea*5|0)],Ja=p[Fa>>2];;){if((Ja|0)>=(Ba|0)){Fa=Ea;continue c}var ka=Vc[p[La>>2]+(Ja<<1)>>1]&65535,S=y[p[za>>2]+(ka<<2)>>2];if(S>>>0>xa>>>0){break}Ja=Ja+1|0;p[Fa>>2]=Ja}if(S>>>0<Na>>>0){break}Fa=Ea}p[Va>>2]=p[(da+24>>2)+(Ea*5|0)]+ka|0;Fa=Ea;Na=S}p[ta>>2]=Na;p[ra>>2]=Na;if(((Na|0)==-1&1|0)!=0){break}ra=y[s>>2];if(ra>>>0<=P>>>0|ra>>>0>N>>>0){da=0;continue a}da=y[q>>2];if(da>>>0>D>>>0){da=0;continue a}ra=(T.multiply(ra-1|0,0,I,X),T.result[0]);ra=(T.add(ra,T.result[1],56,0),T.result[0]);ra=Tp(p[Y>>2],g,v,ra,T.result[1]);if((ra|0)!=0){ja=ra;break a}da=(T.multiply(da-1|0,0,ea,ba),T.result[0]);da=Ei(p[h],g,v,da,T.result[1]);if((da|0)!=0){ja=da;break a}}if((N|0)==(p[p[p[x>>2]>>2]+16>>2]|0)&&(ja=(T.multiply(p[M>>2],0,ea,ba),T.result[0]),ja=Gi(p[h],ja,T.result[1]),ja=(ja|0)!=0|H^1?ja:Nj(p[h],f),(ja|0)!=0)){break}p[j]=N;ja=0;break}tq(b,3,1);H=ja}}else{H=Q}}while(0);ga=(H|0)==5?0:H;(ga|0)!=0|J^1||(y[j]>>>0<y[i]>>>0?ga=5:(c|0)==2&&(ga=Yq(b,K,e,4,4),(ga|0)==0&&(tq(b,4,4),ga=0)))}}while(0);Jo(p[m]);J=ga}}else{J=0}}while(0);a=o;return J}$q.X=1;function dr(b,c){var d,e,f=a;a+=16;var g=f+4;e=g>>2;var h=f+8,i=f+12,j=y[b+68>>2],k=(j+33|0)>>>12,m=k+1|0,o=j<<1,r=o+k*20+28|0,k=Io(r);if((k|0)==0){e=7}else{Ed(k,0,r);r=k+4|0;p[r>>2]=m;var o=Io(j>>>0>4096?8192:o),q=(o|0)==0,s=q?7:0;q^=1;var u=(m|0)>0&q;a:do{if(u){var w=k+8|0;d=w>>2;for(var v=0;;){var x=Sq(b,v,f,h,g),A=(x|0)==0;if(!A){break}var E=p[h>>2]+4|0;p[h>>2]=E;var J=v+1|0;if((J|0)==(m|0)){var M=p[e],D=j-M|0}else{D=p[f>>2]-E>>2,M=p[e]}p[i>>2]=D;var K=w+p[r>>2]*20|0,H=(M<<1)+K|0,N=M+1|0;p[e]=N;var Q=(D|0)>0;b:do{if(Q){for(var P=0;;){if(n[K+(P+M<<1)>>1]=P&65535,P=P+1|0,(P|0)>=(D|0)){break b}}}}while(0);er(E,o,H,i);p[d+(v*5|0)+4]=N;p[d+(v*5|0)+3]=p[i>>2];p[d+(v*5|0)+1]=H;p[d+(v*5|0)+2]=E;if((J|0)>=(m|0)){var L=x,I=A;d=12;break a}v=J}Jo(o);var X=x;d=13}else{L=s,I=q,d=12}}while(0);if(d==12){if(Jo(o),I){var Y=L;d=14}else{X=L,d=13}}d==13&&(Jo(k),Y=X);p[c>>2]=k;e=Y}a=f;return e}dr.X=1;function er(b,c,d,e){var f,g,h,i=a;a+=112;var j;h=i>>2;var k=i+4;g=k>>2;var m=i+8;f=m>>2;var o=p[e>>2];p[h]=0;p[g]=0;m>>=2;for(j=m+26;m<j;m++){p[m]=0}m=(o|0)>0;do{if(m){for(j=0;;){p[h]=1;var r=(j<<1)+d|0;p[g]=r;if((j&1|0)==0){var q=0,s=r,r=1}else{for(q=0;;){fr(b,p[((q<<3)+4>>2)+f],p[(q<<3>>2)+f],k,i,c);var u=q+1|0;if((1<<u&j|0)==0){break}q=u}q=u;s=p[g];r=p[h]}p[((q<<3)+4>>2)+f]=s;p[(q<<3>>2)+f]=r;j=j+1|0;if((j|0)==(o|0)){break}}j=q+1|0;if((j|0)<13){var w=j;j=7}else{var v=r;j=11}}else{w=1,j=7}}while(0);if(j==7){for(;;){(1<<w&o|0)!=0&&fr(b,p[((w<<3)+4>>2)+f],p[(w<<3>>2)+f],k,i,c);d=w+1|0;if((d|0)==13){break}w=d}v=p[h]}p[e>>2]=v;a=i}er.X=1;function fr(b,c,d,e,f,g){var h,i=y[f>>2],j=y[e>>2],k=(i|0)>0,m=(d|0)>0,o=k|m;a:do{if(o){for(var r=0,q=0,s=0,u=k,w=m;;){do{if(w){h=(r<<1)+c|0;if(u){var v=(q<<1)+j|0;if(y[b+((Vc[h>>1]&65535)<<2)>>2]>>>0>=y[b+((Vc[v>>1]&65535)<<2)>>2]>>>0){var x=v;h=7;break}}var A=h,E=q,J=r+1|0;h=8}else{x=(q<<1)+j|0,h=7}}while(0);h==7&&(A=x,E=q+1|0,J=r);r=Vc[A>>1];q=p[b+((r&65535)<<2)>>2];u=s+1|0;n[g+(s<<1)>>1]=r;s=(J|0)<(d|0)?((p[b+((Vc[c+(J<<1)>>1]&65535)<<2)>>2]|0)==(q|0)&1)+J|0:J;h=(E|0)<(i|0);w=(s|0)<(d|0);if(!(h|w)){var M=u;break a}r=s;q=E;s=u;u=h}}else{M=0}}while(0);p[e>>2]=c;p[f>>2]=M;Ah(c,g,M<<1)}fr.X=1;function br(b,c){var d=a;a+=104;var e=d+8,f=d+56,g=p[p[b+32>>2]>>2];Ah(e,g,48);gr(b);Ah(f,g+48|0,48);(jm(e,f,48)|0)==0?l[e+12|0]<<24>>24==0?e=1:(f=d|0,hr(1,e,40,0,f),(p[f>>2]|0)!=(p[e+40>>2]|0)?e=1:(p[d+4>>2]|0)!=(p[e+44>>2]|0)?e=1:(f=b+52|0,(jm(f,e,48)|0)!=0&&(p[c>>2]=1,Ah(f,e,48),e=Vc[b+66>>1]&65535,p[b+36>>2]=e<<16&65536|e&65024),e=0)):e=1;a=d;return e}br.X=1;function cr(b){var c,d,e=b>>2,f=a;a+=48;d=f>>2;var g=f+8,h=f+40,i=f+44,j=t[b+45|0]&255,k=j+1|0,j=7-j|0;c=Xq(b,k,j);if((c|0)==0){Ed(b+52|0,0,48);c=(b+8|0)>>2;var m=Fi(p[c],f),o=(m|0)==0;a:do{if(o){var r=p[d+1],r=(r|0)>0||(r|0)==0&&p[d]>>>0>32;b:do{if(r){var q=g|0,s=Tp(p[c],q,32,0,0);if((s|0)!=0){r=s;break a}var s=Xi(q),u=Xi(g+8|0);if((s&-2|0)!=931071618){var w=0,v=0}else{if((u-1&u|0)!=0|(u|0)>65536|(u|0)<512){v=w=0}else{var x=s&1;l[b+65|0]=x;p[e+9]=u;p[e+26]=Xi(g+12|0);var A=g+16|0,s=b+84|0,E=A|0,A=A+4|0,A=t[A]|t[A+1]<<8|t[A+2]<<16|t[A+3]<<24|0,J=s|0;B=t[E]|t[E+1]<<8|t[E+2]<<16|t[E+3]<<24|0;l[J]=B&255;B>>=8;l[J+1]=B&255;B>>=8;l[J+2]=B&255;B>>=8;l[J+3]=B&255;s=s+4|0;B=A;l[s]=B&255;B>>=8;l[s+1]=B&255;B>>=8;l[s+2]=B&255;B>>=8;l[s+3]=B&255;s=b+76|0;hr((x^1)&255,q,24,0,s);if((p[s>>2]|0)!=(Xi(g+24|0)|0)){v=w=0}else{if(q=b+80|0,(p[q>>2]|0)!=(Xi(g+28|0)|0)){v=w=0}else{if((Xi(g+4|0)|0)!=3007e3){Rh(46332);r=14;break a}x=u+24|0;E=Kg(x);if((E|0)==0){r=7;break a}var A=E+24|0,J=x,M=(x|0)<0?-1:0,D=b+68|0,K=b+72|0,u=(u&65280|u>>>16)&65535,H=b+66|0,N=0,Q=0,P=32,L=1,I=0,X=0;c:for(;;){var Y=(T.add(P,Q,J,M),T.result[0]),da=T.result[1],ga=p[d+1];if(!((da|0)>(ga|0)||(da|0)==(ga|0)&&Y>>>0>p[d]>>>0)){N=Tp(p[c],E,x,P,Q);Q=(N|0)==0;do{if(Q){var P=b,ga=h,ha=i,ba=A,ea=E,ja=P+76|0;if((jm(P+84|0,ea+8|0,8)|0)==0){var ra=Xi(ea);if((ra|0)==0){P=0}else{var Va=l[P+65|0]<<24>>24==0&1;hr(Va,ea,8,ja,ja);hr(Va,ba,p[P+36>>2],ja,ja);(p[ja>>2]|0)!=(Xi(ea+16|0)|0)?P=0:(p[P+80>>2]|0)!=(Xi(ea+20|0)|0)?P=0:(p[ga>>2]=ra,p[ha>>2]=Xi(ea+4|0),P=1)}}else{P=0}if((P|0)==0){Lg(E);w=X;v=I;break b}P=ir(b,L,p[h>>2]);if((P|0)==0){N=p[i>>2];(N|0)!=0&&(p[D>>2]=L,p[K>>2]=N,n[H>>1]=u,I=p[s>>2],X=p[q>>2]);N=P;Q=da;P=Y;L=L+1|0;continue c}}else{P=N}}while(0);Lg(E);r=P;break a}Lg(E);if((N|0)==0){w=X;v=I;break b}r=N;break a}}}}}}else{v=w=0}}while(0);p[e+19]=v;p[e+20]=w;jr(b);r=p[p[e+8]>>2]+96|0;p[(r|0)>>2]=0;p[(r+4|0)>>2]=0;p[(r+8|0)>>2]=-1;p[(r+12|0)>>2]=-1;p[(r+16|0)>>2]=-1;p[(r+20|0)>>2]=-1;r=p[e+18];(r|0)!=0&&(s=p[e+25],cf(0,R.th|0,(z=a,a+=8,p[z>>2]=r,p[z+4>>2]=s,z)));r=0}else{r=m}}while(0);tq(b,k,j);b=r}else{b=c}a=f;return b}cr.X=1;function Rh(b){var c=a;cf(14,R.ih|0,(z=a,a+=8,p[z>>2]=b,p[z+4>>2]=R.Y+20|0,z));a=c}function hr(b,c,d,e,f){d=c+d|0;if((e|0)==0){var g=0,e=0}else{g=p[e+4>>2],e=p[e>>2]}b=(b|0)==0;a:do{if(b){for(var h=c,i=g,j=e;;){var k=kr(p[h>>2]),j=i+j+k|0,k=kr(p[h+4>>2]),i=j+i+k|0,h=h+8|0;if(h>>>0>=d>>>0){var m=i,o=j;break a}}}else{h=c;i=g;for(j=e;;){j=i+j+p[h>>2]|0;k=h+8|0;i=j+i+p[h+4>>2]|0;if(k>>>0>=d>>>0){m=i;o=j;break a}h=k}}}while(0);p[f>>2]=o;p[f+4>>2]=m}function ir(b,c,d){var e,f,g=a;a+=12;var h=g+4;f=h>>2;var i=g+8;e=i>>2;p[g>>2]=0;p[f]=0;p[e]=0;h=Sq(b,(c+33|0)>>>12,i,h,g);i=(h|0)==0;a:do{if(i){var j=c-p[g>>2]|0;if((j|0)==1){var k=p[f],m=k+4|0;Ed(m,0,p[e]+16384-m|0)}else{k=p[f]}(p[k+(j<<2)>>2]|0)!=0&&Rq(b);for(var k=p[e],m=j,o=d*383&8191;;){if(n[k+(o<<1)>>1]<<16>>16==0){p[((j<<2)+p[f]|0)>>2]=d;n[p[e]+(o<<1)>>1]=j&65535;var r=h;break a}if((m|0)==0){aj(46201);r=11;break a}o=o+1&8191;m=m-1|0}}else{r=h}}while(0);a=g;return r}ir.X=1;function jr(b){var c=p[p[b+32>>2]>>2],d=b+52|0;l[b+64|0]=1;p[d>>2]=3007e3;hr(1,d,40,0,b+92|0);Ah(c+48|0,d,48);gr(b);Ah(c,d,48)}function gr(b){l[b+43|0]<<24>>24!=2&&(b=p[b+4>>2],Gd[p[p[b>>2]+60>>2]](b))}function lr(b){var c,d=b|0,e=l[d]<<24>>24==0;a:do{if(e){var f=p[b+60>>2],g=y[b+64>>2],h=t[b+5|0]&255;if((mr(b,t[g+h|0]&255)|0)==0){var i=f+32|0;n[b+18>>1]=p[i>>2]+65535&65535;l[b+1|0]=0;var f=y[f+36>>2],j=h+12-((t[b+3|0]&255)<<2)|0;n[b+12>>1]=j&65535;p[b+68>>2]=g+f|0;j&=65535;p[b+72>>2]=g+j|0;var k=t[h+(g+5)|0],m=t[h+(g+6)|0];c=(t[h+(g+3)|0]&255)<<8|t[h+(g+4)|0]&255;n[b+16>>1]=c;c&=65535;if(c>>>0>Math.floor(((p[i>>2]-8|0)>>>0)/6)>>>0){aj(50625);var o=11}else{i=(c<<1)+j|0;j=f-4|0;k=(((k&255)<<8|m&255)+65535&65535)+(t[h+(g+7)|0]&255)+1|0;m=(t[h+(g+1)|0]&255)<<8|t[h+(g+2)|0]&255;b:for(;;){h=m&65535;if(m<<16>>16==0){if((k|0)>(f|0)){aj(50689);o=11;break a}n[b+14>>1]=k-i&65535;l[d]=1;o=0}else{if((h|0)<(i|0)|(h|0)>(j|0)){aj(50668);o=11;break a}m=(t[g+h|0]&255)<<8|t[h+(g+1)|0]&255;c=h+3|0;var r=(t[h+(g+2)|0]&255)<<8|t[g+c|0]&255;if(m<<16>>16==0){var q=r&65535;c=13}else{r&=65535,(m&65535|0)>(c+r|0)?(q=r,c=13):c=14}do{if(c==13&&(q+h|0)<=(f|0)){k=q+k|0;continue b}}while(0);aj(50675);o=11}break a}}}else{aj(50613),o=11}}else{o=0}}while(0);return o}lr.X=1;function mr(b,c){var d,e=c>>>3&255;l[b+3|0]=e;var f=c&-9;l[b+6|0]=4-(c>>>1&252)&255;var g=y[b+60>>2];d=g>>1;if((f|0)==5){l[b+2|0]=1,l[b+4|0]=e,n[b+8>>1]=n[d+14],n[b+10>>1]=n[d+15],d=5}else{if((f|0)==2){l[b+2|0]=0,l[b+4|0]=0,n[b+8>>1]=n[d+12],n[b+10>>1]=n[d+13],d=5}else{aj(50574);var h=11;d=6}}d==5&&(l[b+7|0]=l[g+20|0],h=0);return h}function Zi(b,c){l[b]=c>>>24&255;l[b+1|0]=c>>>16&255;l[b+2|0]=c>>>8&255;l[b+3|0]=c&255}function nr(b,c){var d,e=(p[b+40>>2]|0)==0;do{if(e){if(l[b+20|0]<<24>>24!=0){var f=0}else{if(l[b+21|0]<<24>>24!=0&&(n[c+24>>1]&4)<<16>>16!=0){f=0}else{p[c+12>>2]=0;f=(uj(p[b+180>>2])|0)==0;a:do{if(f){d=(n[c+24>>1]&4)<<16>>16==0?l[b+16|0]<<24>>24==3?11:12:11;if(d==11&&(d=yj(b,1),(d|0)!=0)){var g=d;d=18;break}d=y[c+16>>2];var h=d>>>0>y[b+24>>2]>>>0;do{if(h&&(or(d,p[c+20>>2])|0)!=0){var i=pr(c);if((i|0)!=0){g=i;d=18;break a}}}while(0);var j=Ij(b,c)}else{if((or(p[c+16>>2],p[c+20>>2])|0)!=0&&(d=pr(c),(d|0)!=0)){g=d;d=18;break}j=Lj(b,c,0,0)}d=16}while(0);d==16&&((j|0)!=0?g=j:(Kp(c),g=0));f=Pj(b,g)}}}else{f=0}}while(0);return f}nr.X=1;function or(b,c){for(var d=p[c+96>>2],e=c+92|0,f=0;;){if((f|0)>=(d|0)){var g=0;break}var h=y[e>>2];if(y[(h+20>>2)+(f*11|0)]>>>0>=b>>>0&&(wj(p[(h+16>>2)+(f*11|0)],b)|0)==0){g=1;break}f=f+1|0}return g}function pr(b){var c,d=p[b+20>>2];if(l[d+5|0]<<24>>24==2){var e=d+52|0,f=b+16|0;c=6}else{c=p[d+68>>2];var g=(p[c>>2]|0)==0;a:do{if(g){var h=l[d+5|0]<<24>>24==4;do{if(!h&&l[d+22|0]<<24>>24==0){h=Wp(p[d>>2],0,c,8222,0);break a}}while(0);Aq(c)}h=0}while(0);c=h;if((c|0)!=0){var i=c;c=7}else{g=p[b+4>>2];c=d+52|0;var h=d+128|0,j=p[h>>2]+4|0,j=(T.multiply(j,(j|0)<0?-1:0,p[c>>2],0),T.result[0]),k=T.result[1],m=d+68|0,b=b+16|0,o=qr(p[m>>2],j,k,p[b>>2]);(o|0)!=0?(i=o,c=7):(m=p[m>>2],h=p[h>>2],j=(T.add(j,k,4,0),T.result[0]),g=Ei(m,g,h,j,T.result[1]),(g|0)==0?(e=c,f=b,c=6):(i=g,c=7))}}c==6&&(p[e>>2]=p[e>>2]+1|0,i=fj(d,p[f>>2]));return i}pr.X=1;function Lj(b,c,d,e){var f,g=a;a+=4;f=g>>2;p[f]=c;var h=(e|0)==0;do{if(h){var i=c}else{if(p[f]=c,(c|0)==0){i=0}else{for(var i=c,j=g;;){var k=i+12|0,j=y[i+16>>2]>>>0>d>>>0?j:k,i=y[k>>2];p[j>>2]=i;if((i|0)==0){break}}i=p[f]}}}while(0);(p[i+16>>2]|0)==1&&vj(i);c=rr(p[b+180>>2],p[b+128>>2],i,d,e,t[b+11|0]&255);d=(c|0)==0;a:do{if(d&&(e=b+88|0,h=y[e>>2],!((h|0)==0|(i|0)==0))){f=i;for(f>>=2;;){Mq(h,p[f+4],p[f+1]);f=p[f+3];if((f|0)==0){break a}f>>=2;h=p[e>>2]}}}while(0);a=g;return c}Lj.X=1;function yj(b,c){var d,e=a;a+=20;var f,g=e+8,h=(uj(p[b+180>>2])|0)==0?sr(b,4):0,i=(h|0)==0;a:do{if(i){var j=l[b+8|0]<<24>>24==0;b:do{if(j){d=(b+64|0)>>2;var k=(p[p[d]>>2]|0)==0;do{if(!k&&l[b+5|0]<<24>>24!=4){k=jq(p[b+60>>2]);if(j=(k&512|0)==0){var m=g|0;f=g;p[f>>2]=-117058087;p[f+4>>2]=-681336544;Zi(g+8|0,p[b+44>>2]);var o=Iq(b);f=o[0];var o=o[1],r=e|0,q=Tp(p[d],r,8,f,o);if((q|0)==0){if((jm(r,R.qa|0,8)|0)!=0){f=10}else{var s=Ei(p[d],tr,1,f,o);f=9}}else{s=q,f=9}if(f==9&&!((s|0)==522||(s|0)==0)){j=s;break a}f=l[b+9|0]<<24>>24==0;do{if(!f&&(k&1024|0)==0&&(o=Nj(p[d],t[b+12|0]&255),(o|0)!=0)){j=o;break a}}while(0);f=b+80|0;m=Ei(p[d],m,12,p[f>>2],p[f+4>>2]);if((m|0)!=0){j=m;break a}}if((k&1024|0)==0&&(k=t[b+12|0],d=Nj(p[d],(k<<24>>24==3?16:0)|k&255),(d|0)!=0)){j=d;break a}k=b+72|0;d=k|0;k=k+4|0;m=p[k>>2];f=b+80|0;k=f|0;p[k>>2]=p[d>>2];d=f+4|0;p[d>>2]=m;if((c|0)==0|j^1){break b}p[b+44>>2]=0;j=ur(b);if((j|0)==0){break b}break a}}while(0);k=b+72|0;d=k|0;d=p[d>>2];k=k+4|0;m=p[k>>2];f=b+80|0;k=f|0;p[k>>2]=d;d=f+4|0;p[d>>2]=m}}while(0);j=p[b+176>>2];d=p[j>>2];k=(d|0)==0;b:do{if(!k){for(m=d;;){if(n[(m+24|0)>>1]&=-5,m=p[m+32>>2],(m|0)==0){break b}}}}while(0);p[j+8>>2]=p[j+4>>2];l[b+16|0]=4;j=0}else{j=h}}while(0);a=e;return j}yj.X=1;function Ij(b,c){var d,e,f=a;a+=8;var g;e=(b+60|0)>>2;d=p[e];if((p[d>>2]|0)==0){if(d=Wp(p[b>>2],0,d,p[b+120>>2]|30,0),(d|0)==0){g=3}else{var h=d;g=18}}else{g=3}a:do{if(g==3){d=(b+24|0)>>2;var i=y[d],j=b+36|0;if(i>>>0>y[j>>2]>>>0){var k=p[b+128>>2],i=(T.multiply(k,(k|0)<0?-1:0,i,0),T.result[0]),k=T.result[1];p[f>>2]=i;p[f+4>>2]=k;eq(p[e],5,f);var i=p[d],m=p[j>>2]=i}else{m=i}if((c|0)==0){h=0}else{for(var j=b+128|0,i=b+100|0,k=b+32|0,o=b+88|0,r=c,q=0,s=m;;){m=y[r+16>>2];if(m>>>0>s>>>0){m=q}else{if((n[r+24>>1]&32)<<16>>16!=0){m=q}else{var q=p[j>>2],u=(T.multiply(q,(q|0)<0?-1:0,m-1|0,0),T.result[0]),w=T.result[1];if(s=(m|0)==1){vj(r);var v=p[j>>2]}else{v=q}var q=r+4|0,x=p[q>>2],u=Ei(p[e],x,v,u,w);if(s){s=x+24|0;w=i;for(x=s+16;s<x;s++,w++){l[w]=l[s]}}m>>>0>y[k>>2]>>>0&&(p[k>>2]=m);Mq(p[o>>2],m,p[q>>2]);m=u}}r=y[r+12>>2];if((m|0)!=0|(r|0)==0){h=m;break a}q=m;s=p[d]}}}}while(0);a=f;return h}Ij.X=1;function vj(b){var c=Xi(p[b+20>>2]+100|0)+1|0,b=(b+4|0)>>2;Zi(p[b]+24|0,c);Zi(p[b]+92|0,c);Zi(p[b]+96|0,3007010)}function ur(b){var c,d,e,f,g,h=y[b+172>>2],i=b+128|0,j=y[i>>2];f=(b+124|0)>>2;var k=y[f],j=j>>>0>k>>>0?k:j,k=b+96|0,m=y[k>>2],o=(m|0)>0;a:do{if(o){for(var r=b+92|0,q=b+72|0,s=0,u=m;;){var w=p[r>>2]+s*44+8|0;e=w|0;e>>=2;d=w+4|0;d>>=2;p[e]==0&&p[d]==0?(d=p[q>>2],u=p[q+4>>2],e=w|0,e>>=2,p[e]=d,d=w+4|0,d>>=2,p[d]=u,w=p[k>>2]):w=u;s=s+1|0;if((s|0)>=(w|0)){g=q;c=g>>2;break a}u=w}}else{g=b+72|0,c=g>>2}}while(0);m=Iq(b);k=m[0];m=m[1];p[(g|0)>>2]=k;p[(g+4|0)>>2]=m;g=b+80|0;p[g>>2]=k;p[g+4>>2]=m;if(l[b+8|0]<<24>>24==0){if(l[b+5|0]<<24>>24==4){g=10}else{if((jq(p[b+60>>2])&512|0)!=0){g=10}else{g=h;for(k=g+12;g<k;g++){l[g]=0}g=12}}}else{g=10}g==10&&(g=h|0,B=-117058087,l[g]=B&255,B>>=8,l[g+1]=B&255,B>>=8,l[g+2]=B&255,B>>=8,l[g+3]=B&255,g=h+4|0,B=-681336544,l[g]=B&255,B>>=8,l[g+1]=B&255,B>>=8,l[g+2]=B&255,B>>=8,l[g+3]=B&255,Zi(h+8|0,-1));g=b+48|0;Dh(4,g);Zi(h+12|0,p[g>>2]);Zi(h+16|0,p[b+28>>2]);Zi(h+20|0,p[f]);Zi(h+24|0,p[i>>2]);Ed(h+28|0,0,j-28|0);b=b+64|0;for(i=g=0;;){if((g|0)!=0){break}if(i>>>0>=y[f]>>>0){break}g=Ei(p[b>>2],h,j,p[c],p[c+1]);k=(T.add(p[c],p[c+1],j,0),T.result[0]);m=T.result[1];p[c]=k;p[c+1]=m;i=i+j|0}return g}ur.X=1;function sr(b,c){for(var d=b+152|0,e=b+156|0;;){var f=vr(b,c);if((f|0)!=5){break}if((Gd[p[d>>2]](p[e>>2])|0)==0){break}}return f}function vr(b,c){var d=b+17|0,e=t[d];(e&255|0)<(c|0)|e<<24>>24==5?(e=Gd[p[p[p[b+60>>2]>>2]+28>>2]](p[b+60>>2],c),(e|0)!=0?d=e:l[d]<<24>>24!=5|(c|0)==4?(l[d]=c&255,d=e):d=0):d=0;return d}function Op(b){return(-(b>>>6&1)&9)+b&15}function wr(b,c){for(var d=c;;){if((d|0)<=0){break}var e=d-1|0;if(l[b+e|0]<<24>>24!=32){break}d=e}return(d|0)==0&1}function rr(b,c,d,e,f,g){var h,i,j,k,m=a;a+=64;k=m>>2;var o=m+24,r=m+56,q=xr(b),s=(q|0)==0;a:do{if(s){j=(b+68|0)>>2;var u=p[j],w=(u|0)==0;do{if(w){var v=o|0;Zi(v,931071618);Zi(o+4|0,3007e3);Zi(o+8|0,c);var x=b+104|0;Zi(o+12|0,p[x>>2]);var A=b+84|0;(p[x>>2]|0)==0&&Dh(8,A);var E=A,J=o+16|0,M=E|0,D=E+4|0,K=t[D]|t[D+1]<<8|t[D+2]<<16|t[D+3]<<24|0,H=J|0;B=t[M]|t[M+1]<<8|t[M+2]<<16|t[M+3]<<24|0;l[H]=B&255;B>>=8;l[H+1]=B&255;B>>=8;l[H+2]=B&255;B>>=8;l[H+3]=B&255;var N=J+4|0;B=K;l[N]=B&255;B>>=8;l[N+1]=B&255;B>>=8;l[N+2]=B&255;B>>=8;l[N+3]=B&255;var Q=r|0;hr(1,v,24,0,Q);var P=p[Q>>2];Zi(o+24|0,P);var L=p[r+4>>2];Zi(o+28|0,L);p[b+36>>2]=c;l[b+65|0]=0;p[b+76>>2]=P;p[b+80>>2]=L;l[b+47|0]=1;var I=b+8|0,X=Ei(p[I>>2],v,32,0,0);if((X|0)!=0){var Y=X;break a}if(l[b+48|0]<<24>>24==0|(g|0)==0){var da=I}else{var ga=Nj(p[I>>2],g&19);if((ga|0)!=0){Y=ga;break a}da=I}}else{da=b+8|0}}while(0);p[k]=b;var ha=m+4|0;p[ha>>2]=p[da>>2];i=(m+8|0)>>2;p[i]=0;p[i+1]=0;p[k+4]=g;p[k+5]=c;var ba=c+24|0,ea=ba,ja=(ba|0)<0?-1:0,ra=(T.multiply(u,0,ea,ja),T.result[0]),Va=(T.add(ra,T.result[1],32,0),T.result[0]),ta=T.result[1],xa=(f|0)==0;b:do{if(xa){var Fa=ta,Na=Va,Ea=0,La=d;h=La>>2;for(var za=u;;){if((La|0)==0){var Ba=za,Ja=Ea,ka=Fa,S=Na;break b}var ib=yr(m,p[h+1],p[h+4],0,Na,Fa);if((ib|0)!=0){Y=ib;break a}var Wa=za+1|0,Za=(T.add(Na,Fa,ea,ja),T.result[0]),Fa=T.result[1],Na=Za,Ea=La,La=p[h+3];h=La>>2;za=Wa}}else{for(var Sa=ta,tb=Va,pb=0,fb=d,Xa=u;;){if((fb|0)==0){Ba=Xa;Ja=pb;ka=Sa;S=tb;break b}var Ab=fb+12|0,rb=yr(m,p[fb+4>>2],p[fb+16>>2],(p[Ab>>2]|0)==0?e:0,tb,Sa);if((rb|0)!=0){Y=rb;break a}var cb=Xa+1|0,Cb=(T.add(tb,Sa,ea,ja),T.result[0]),Sa=T.result[1],tb=Cb,pb=fb,fb=p[Ab>>2],Xa=cb}}}while(0);var Zb=(f|0)!=0;do{if(Zb){var dc=(g&32|0)==0;b:do{if(dc){var kb=0,Oa=0}else{if(l[b+49|0]<<24>>24==0){kb=Nj(p[ha>>2],g&19),Oa=0}else{var Db=Oq(p[da>>2]),Wb=Db,Nb=(Db|0)<0?-1:0,$b=(T.add(S,ka,-1,-1),T.result[0]),Rb=(T.add($b,T.result[1],Wb,Nb),T.result[0]),Ra=T.result[1],Ob=(T.k(Rb,Ra,Wb,Nb),T.result[0]),Ua=(T.b(Rb,Ra,Ob,T.result[1]),T.result[0]),Jb=T.result[1];p[i]=Ua;p[i+1]=Jb;for(var Vb=Ja+4|0,Pb=Ja+16|0,sb=ka,db=S,wb=0,ob=Jb,Kb=Ua;;){if(!((sb|0)<(ob|0)||(sb|0)==(ob|0)&&db>>>0<Kb>>>0)){kb=0;Oa=wb;break b}var ub=yr(m,p[Vb>>2],p[Pb>>2],e,db,sb);if((ub|0)!=0){Y=ub;break a}var Xb=(T.add(db,sb,ea,ja),T.result[0]),sb=T.result[1],db=Xb,wb=wb+1|0,ob=p[i+1],Kb=p[i]}}}}while(0);var Sb=b+47|0;if(l[Sb]<<24>>24==0){var Qb=kb,ac=Oa}else{var Gb=b+16|0,xb=p[Gb>>2],Ta=p[Gb+4>>2];if((Ta|0)>-1||(Ta|0)==-1&&xb>>>0>4294967295){var qb=(T.multiply(Oa+Ba|0,0,ea,ja),T.result[0]),bc=(T.add(qb,T.result[1],32,0),T.result[0]),$a=T.result[1],mb=($a|0)>(Ta|0)||($a|0)==(Ta|0)&&bc>>>0>xb>>>0;fq(b,mb?bc:xb,mb?$a:Ta);l[Sb]=0}Qb=kb;ac=Oa}}else{ac=Qb=0}}while(0);var Bb=p[j],bb=(d|0)!=0&(Qb|0)==0;b:do{if(bb){for(var jb=Bb,nb=d;;){var zb=jb+1|0,Tb=ir(b,zb,p[nb+16>>2]),ec=p[nb+12>>2];if(!((ec|0)!=0&(Tb|0)==0)){var Hb=Tb,Eb=zb;break b}jb=zb;nb=ec}}else{Hb=Qb,Eb=Bb}}while(0);var Lb=(Hb|0)==0,gb=Lb&(ac|0)>0;b:do{if(gb){for(var Mb=Ja+16|0,vc=Eb,hc=ac;;){var kc=vc+1|0,pc=hc-1|0,jc=ir(b,kc,p[Mb>>2]),mc=(jc|0)==0;if(!(mc&(pc|0)>0)){var Fb=jc,Ub=kc,Ya=mc;break b}vc=kc;hc=pc}}else{Fb=Hb,Ub=Eb,Ya=Lb}}while(0);if(Ya){n[b+66>>1]=(c&65280|c>>>16)&65535;p[j]=Ub;if(Zb){var Pa=b+60|0;p[Pa>>2]=p[Pa>>2]+1|0;p[b+72>>2]=e;jr(b);p[b+12>>2]=Ub}Y=0}else{Y=Fb}}else{Y=q}}while(0);a=m;return Y}rr.X=1;function xr(b){var c=a;a+=8;var d=c+4,e=b+40|0,f=n[e>>1]<<16>>16==0;a:do{if(f){var g=p[p[b+32>>2]>>2]+96|0,h=g|0,i=(p[h>>2]|0)==0;do{if(!i){Dh(4,c);var j=Xq(b,4,4);if((j|0)!=0){if((j|0)==5){break}else{var k=j;break a}}var j=b+84|0,m=b+104|0;p[m>>2]=p[m>>2]+1|0;p[b+68>>2]=0;Zi(j,Xi(j)+1|0);p[b+88>>2]=p[c>>2];jr(b);p[h>>2]=0;p[(g+8|0)>>2]=-1;p[(g+12|0)>>2]=-1;p[(g+16|0)>>2]=-1;p[(g+20|0)>>2]=-1;tq(b,4,4)}}while(0);vq(b,3);n[e>>1]=-1;for(g=0;;){if(g=g+1|0,h=zr(b,d,1,g),(h|0)!=-1){k=h;break a}}}else{k=0}}while(0);a=c;return k}xr.X=1;function yr(b,c,d,e,f,g){var h=a;a+=24;var i=h|0,j=p[b>>2],k=j+76|0;Zi(i,d);Zi(i+4|0,e);var m=j+84|0,d=i+8|0,e=m|0,m=m+4|0,m=t[m]|t[m+1]<<8|t[m+2]<<16|t[m+3]<<24|0,o=d|0;B=t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24|0;l[o]=B&255;B>>=8;l[o+1]=B&255;B>>=8;l[o+2]=B&255;B>>=8;l[o+3]=B&255;d=d+4|0;B=m;l[d]=B&255;B>>=8;l[d+1]=B&255;B>>=8;l[d+2]=B&255;B>>=8;l[d+3]=B&255;d=l[j+65|0]<<24>>24==0&1;hr(d,i,8,k,k);hr(d,c,p[j+36>>2],k,k);Zi(i+16|0,p[k>>2]);Zi(i+20|0,p[j+80>>2]);i=Ar(b,i,24,f,g);(i|0)==0?(i=p[b+20>>2],f=(T.add(f,g,24,0),T.result[0]),b=Ar(b,c,i,f,T.result[1])):b=i;a=h;return b}function Ar(b,c,d,e,f){var g=b+8|0,h=p[g>>2],g=p[g+4>>2];if((g|0)>(f|0)||(g|0)==(f|0)&&h>>>0>e>>>0){var i=(T.add(d,(d|0)<0?-1:0,e,f),T.result[0]),j=T.result[1];if((j|0)<(g|0)||(j|0)==(g|0)&&i>>>0<h>>>0){var k=c,m=d,o=f,r=e,e=6}else{if(h=(T.b(h,g,e,f),T.result[0]),g=b+4|0,i=Ei(p[g>>2],c,h,e,f),(i|0)!=0){var q=i,e=7}else{g=Nj(p[g>>2],p[b+16>>2]),(h|0)==(d|0)?(q=g,e=7):(d=d-h|0,c=c+h|0,e=(T.add(h,(h|0)<0?-1:0,e,f),T.result[0]),f=T.result[1],(g|0)==0?(k=c,m=d,o=f,r=e,e=6):(q=g,e=7))}}}else{k=c,m=d,o=f,r=e,e=6}e==6&&(q=Ei(p[b+4>>2],k,m,r,o));return q}function zr(b,c,d,e){var f,g,h;(e|0)>5?(e|0)>100?(g=15,h=34):(Gd[p[p[b>>2]+60>>2]](p[b>>2],(e|0)>9?e*238-2142|0:1),h=6):h=6;a:do{if(h==6){h=(d|0)!=0;if(!h){g=Zq(b,c);e=(g|0)==5;do{if(e){if((p[p[b+32>>2]>>2]|0)==0){g=-1;break a}g=uq(b,2);if((g|0)!=0){if((g|0)==5){g=261;break a}else{var i=g;break}}vq(b,2);g=-1;break a}i=g}while(0);if((i|0)!=0){g=i;break}}g=(b+32|0)>>2;i=p[p[g]>>2]+96|0;e=i>>2;do{if(h){var j=0;f=b+68|0;f>>=2}else{if(j=b+52|0,f=b+68|0,(p[e]|0)!=(p[f>>2]|0)){j=0,f>>=2}else{h=uq(b,3);gr(b);if((h|0)!=0){if((h|0)==5){j=5;f>>=2;break}else{g=h;break a}}if((jm(p[p[g]>>2],j,48)|0)==0){g=n[b+40>>1]=0;break a}vq(b,3);g=-1;break a}}}while(0);h=y[e+2];var k=y[e+3];if(h>>>0>y[f]>>>0){var m=0,o=0;h=35}else{if(h>>>0>k>>>0){var r=1,q=h;h=37}else{m=h,o=1,h=35}}h==35&&(k>>>0>y[f]>>>0?(r=o,q=m):(r=2,q=k));var s=y[e+4];q>>>0>s>>>0?(k=r,s=q):s>>>0>y[f]>>>0?(k=r,s=q):k=3;var u=y[e+5];s>>>0<=u>>>0&&u>>>0<=y[f]>>>0&&(k=4,s=u);u=(l[b+46|0]&2)<<24>>24==0;b:do{if(u){if(s>>>0<y[f]>>>0|(k|0)==0){for(var w=j,v=1;;){if((v|0)>=5){v=k;A=s;break b}var x=v+3|0,w=Xq(b,x,1);if((w|0)==0){break}else{if((w|0)!=5){g=w;break a}}w=5;v=v+1|0}A=p[f];p[((v<<2)+i+4|0)>>2]=A;tq(b,x,1);w=0}else{var w=j,v=k,A=s}}else{w=j,v=k,A=s}}while(0);if((v|0)==0){g=(w|0)==5?-1:520}else{if(i=v+3|0,j=uq(b,i),(j|0)==0){gr(b);e=(p[((v<<2)+4>>2)+e]|0)==(A|0);do{if(e&&(jm(p[p[g]>>2],b+52|0,48)|0)==0){n[b+40>>1]=v&65535;g=j;break a}}while(0);vq(b,i);g=-1}else{g=(j|0)==5?-1:j}}}}while(0);return g}zr.X=1;function qr(b,c,d,e){var f=a;a+=4;var g=f|0;Zi(g,e);b=Ei(b,g,4,c,d);a=f;return b}function fj(b,c){var d=b+96|0,e=p[d>>2],f=(e|0)>0;a:do{if(f){for(var g=b+92|0,h=0,i=0,j=e;;){var k=y[g>>2];y[(k+20>>2)+(h*11|0)]>>>0<c>>>0||(i|=ej(p[(k+16>>2)+(h*11|0)],c),j=p[d>>2]);h=h+1|0;if((h|0)>=(j|0)){var m=i;break a}}}else{m=0}}while(0);return m}function no(b,c,d,e){if((b|0)==0){c=0}else{var f=p[b+4>>2];li(p[b>>2],f);if(l[f+19|0]<<24>>24!=0){c=6}else{var b=p[f>>2],f=b>>2,g=y[f+45],c=(g|0)==0?0:dq(g,c,p[f+38],p[f+39],t[b+10|0]&255,p[f+32],p[f+43],d,e)}}return c}function io(b,c,d,e){for(b=(c<<2)+b|0;;){b=p[b>>2];if((b|0)==0){var f=0;break}c=p[b+24>>2];if((te(c,d,e)|0)==0&&l[c+e|0]<<24>>24==0){f=b;break}b=b+28|0}return f}function jo(b,c,d){var e;e=n[b>>1];var f=(e<<16>>16|0)==(c|0),c=(c|0)==-1;if(e<<16>>16==-1|f){var g=c;e=5}else{if(c){(p[b+12>>2]|0)!=0?(g=1,e=5):(p[b+16>>2]|0)==0?(h=0,e=10):(g=1,e=5)}else{var h=0;e=10}}e==5&&(f=f|g?4:1,b=l[b+2|0],h=b<<24>>24==d<<24>>24?f|2:!(d<<24>>24==2&b<<24>>24==3)&&!(d<<24>>24==3&b<<24>>24==2)?f:f+1|0);return h}function yg(b,c){var d=y[c+24>>2],e=ve(d),f=((t[R.i+(t[d]&255)|0]&255)+e|0)%23,d=io(b,f,d,e);(d|0)==0?(p[c+8>>2]=0,f=(f<<2)+b|0,p[c+28>>2]=p[f>>2]):(f=d+8|0,p[c+8>>2]=p[f>>2]);p[f>>2]=c}function Lk(b,c){return(n[b+28>>1]&2)<<16>>16==0?0:(t[b+31|0]&255|0)==(c|0)?0:Br(b,c&255)}function Br(b,c){var d,e,f=b+31|0,g=c<<24>>24==1,h=l[f]<<24>>24==1|g;do{if(h){d=(b+24|0)>>2;var i=y[d];if(g){i&=-2;p[d]=i;var j=i<<1|1,k=i}else{j=(i<<1)+2|0,k=i}var i=b+4|0,m=y[i>>2],o=m+k|0,j=zh(p[b>>2],j);if((j|0)==0){d=7;break}var r=l[f];a:do{if(r<<24>>24==1){var q=c<<24>>24==2,s=(k|0)>0;b:do{if(q){if(s){e=m;for(var u=j;;){var w=e+1|0;e=t[e];var v=e&255,x=(e&255)>191;do{if(x){e=t[R.Ga+(v-192)|0]&255;for(var A=w;;){if((A|0)==(o|0)){break}var E=t[A];if((E&-64)<<24>>24!=-128){break}e=E&63|e<<6;A=A+1|0}if(e>>>0<128|(e&-2048|0)==55296|(e&-2|0)==65534){var J=A,M=65533;e=23}else{if(e>>>0<65536){J=A,M=e,e=23}else{var D=e-65536|0;l[u]=(D>>>10&192|e>>>10&63)&255;l[u+1|0]=(D>>>18&3|216)&255;l[u+2|0]=e&255;l[u+3|0]=(e>>>8&3|220)&255;var D=u+4|0,K=A;e=25}}}else{J=w,M=v,e=23}}while(0);e==23&&(l[u]=M&255,l[u+1|0]=M>>>8&255,D=u+2|0,K=J);if(K>>>0>=o>>>0){H=D;break b}e=K;u=D}}else{var H=j}}else{if(s){e=m;for(u=j;;){w=e+1|0;e=t[e];v=e&255;x=(e&255)>191;do{if(x){e=t[R.Ga+(v-192)|0]&255;for(A=w;;){if((A|0)==(o|0)){break}E=t[A];if((E&-64)<<24>>24!=-128){break}e=E&63|e<<6;A=A+1|0}if(e>>>0<128|(e&-2048|0)==55296|(e&-2|0)==65534){var N=A,Q=65533;e=33}else{if(e>>>0<65536){N=A,Q=e,e=33}else{var P=e-65536|0;l[u]=(P>>>18&3|216)&255;l[u+1|0]=(P>>>10&192|e>>>10&63)&255;l[u+2|0]=(e>>>8&3|220)&255;l[u+3|0]=e&255;var P=u+4|0,L=A;e=35}}}else{N=w,Q=v,e=33}}while(0);e==33&&(l[u]=Q>>>8&255,l[u+1|0]=Q&255,P=u+2|0,L=N);if(L>>>0>=o>>>0){H=P;break b}e=L;u=P}}else{H=j}}}while(0);p[d]=H-j|0;l[H]=0;q=H+1|0;e=58}else{if(r<<24>>24==2){if((k|0)>0){s=m;for(u=j;;){if(v=t[s]&255,w=s+2|0,x=(t[s+1|0]&255)<<8|v,(x-55296|0)>>>0<2048&w>>>0<o>>>0?(v=(x<<10&983040)+65536|v<<10&64512|t[w]&255|(t[s+3|0]&255)<<8&768,s=s+4|0):(v=x,s=w),v>>>0<128?(l[u]=v&255,u=u+1|0):v>>>0<2048?(l[u]=(v>>>6&31|192)&255,l[u+1|0]=(v&63|128)&255,u=u+2|0):v>>>0<65536?(l[u]=(v>>>12&15|224)&255,l[u+1|0]=(v>>>6&63|128)&255,l[u+2|0]=(v&63|128)&255,u=u+3|0):(l[u]=(v>>>18&7|240)&255,l[u+1|0]=(v>>>12&63|128)&255,l[u+2|0]=(v>>>6&63|128)&255,l[u+3|0]=(v&63|128)&255,u=u+4|0),s>>>0>=o>>>0){I=u;e=57;break a}}}else{var I=j;e=57}}else{if((k|0)>0){s=m;for(u=j;;){if(w=s+2|0,v=t[s+1|0]&255,x=(t[s]&255)<<8|v,(x-55296|0)>>>0<2048&w>>>0<o>>>0?(v=(x<<10&983040)+65536|v<<10&64512|t[s+3|0]&255|(t[w]&255)<<8&768,s=s+4|0):(v=x,s=w),v>>>0<128?(l[u]=v&255,u=u+1|0):v>>>0<2048?(l[u]=(v>>>6&31|192)&255,l[u+1|0]=(v&63|128)&255,u=u+2|0):v>>>0<65536?(l[u]=(v>>>12&15|224)&255,l[u+1|0]=(v>>>6&63|128)&255,l[u+2|0]=(v&63|128)&255,u=u+3|0):(l[u]=(v>>>18&7|240)&255,l[u+1|0]=(v>>>12&63|128)&255,l[u+2|0]=(v>>>6&63|128)&255,l[u+3|0]=(v&63|128)&255,u=u+4|0),s>>>0>=o>>>0){I=u;e=57;break a}}}else{I=j,e=57}}}}while(0);e==57&&(p[d]=I-j|0,q=I);l[q]=0;tk(b);d=b+28|0;k=n[d>>1]&-7681;l[f]=c;n[d>>1]=k|1536;p[i>>2]=j;p[b+36>>2]=j}else{if((Mk(b)|0)!=0){d=7;break}d=p[b+4>>2];j=p[b+24>>2]&-2;i=d+j|0;j=(j|0)>0;a:do{if(j){for(o=d;;){if(k=l[o],m=o+1|0,l[o]=l[m],o=o+2|0,l[m]=k,o>>>0>=i>>>0){break a}}}}while(0);l[f]=c}d=0}while(0);return d}Br.X=1;function Mk(b){var c,d,e;e=(b+28|0)>>1;c=n[e];(c&16384)<<16>>16!=0&&(xk(b),c=n[e]);(c&18)<<16>>16==0?b=0:(d=(b+4|0)>>2,(p[d]|0)==(p[b+36>>2]|0)?b=0:(c=(b+24|0)>>2,(yk(b,p[c]+2|0,1)|0)!=0?b=7:(l[p[d]+p[c]|0]=0,l[p[d]+p[c]+1|0]=0,n[e]|=512,b=0)));return b}function Zn(b){var c=p[b>>2];if((c|0)!=0){var d=p[b+4>>2];li(p[c>>2],p[c+4>>2]);Cr(b);var c=b+12|0,e=p[c>>2],f=b+8|0,g=p[f>>2];(e|0)==0?p[(d+8|0)>>2]=g:p[(e+8|0)>>2]=g;e=p[f>>2];(e|0)!=0&&(p[(e+12|0)>>2]=p[c>>2]);c=b+86|0;e=n[c>>1]<<16>>16<0;a:do{if(!e){for(f=0;;){if(Yj(p[b+(f<<2)+128>>2]),f=f+1|0,(f|0)>(n[c>>1]<<16>>16|0)){break a}}}}while(0);Oi(d);Sm(b)}}function Cr(b){var c=b+68|0;Lg(p[c>>2]);p[c>>2]=0;l[b+79|0]=0}function Yj(b){(b|0)!=0&&vi(p[b+76>>2])}function Oi(b){if(l[b+19|0]<<24>>24==0){var b=b+12|0,c=p[b>>2];(c|0)!=0&&(Yj(c),p[b>>2]=0)}}function Sm(b){b=b+80|0;Lg(p[b>>2]);p[b>>2]=0}function Un(b,c){var d,e;e=(b+308|0)>>2;var f=p[e];if((f|0)!=0){d=(b+312|0)>>2;var g=(p[d]|0)>0;a:do{if(g){for(var h=0,i=f;;){var i=p[i+(h<<2)>>2],j=p[i+8>>2];if((j|0)!=0){var k=p[p[j>>2]+c>>2];if((k|0)!=0){Gd[k](j)}}p[(i+20|0)>>2]=0;Jr(i);h=h+1|0;i=p[e];if((h|0)>=(p[d]|0)){var m=i;break a}}}else{m=f}}while(0);vf(b,m);p[d]=0;p[e]=0}}function Jr(b){var c=p[b>>2],d=b+12|0,e=p[d>>2]-1|0;p[d>>2]=e;if((e|0)==0){d=p[b+8>>2];if((d|0)!=0){Gd[p[p[d>>2]+16>>2]](d)}vf(c,b)}}function ds(b){var c,d;if((b|0)!=0){var e=b+16|0,f=p[p[e>>2]>>2];d=(b+20|0)>>2;var g=p[d];if(!((g|0)==0&&(p[f+24>>2]|0)!=(b|0))){c=(b+24|0)>>2;var h=p[c];(h|0)!=0&&(p[(h+20|0)>>2]=g,g=p[d]);(g|0)!=0&&(p[g+24>>2]=p[c]);g=f+20|0;(p[g>>2]|0)==(b|0)&&(p[g>>2]=p[d]);f=f+24|0;(p[f>>2]|0)==(b|0)&&(p[f>>2]=p[c]);p[d]=0;p[c]=0;b=p[e>>2]+28|0;p[b>>2]=p[b>>2]-1|0}}}ds.X=1;function ms(b){for(var c=y[b+16>>2],d=((y[b+8>>2]>>>0)%(y[c+36>>2]>>>0)<<2)+p[c+40>>2]|0;;){var e=p[d>>2],f=e+12|0;if((e|0)==(b|0)){break}d=f}p[d>>2]=p[f>>2];b=c+32|0;p[b>>2]=p[b>>2]-1|0}function ts(b){return(b|0)==0?0:p[(b-8|0)>>2]}function bn(b){var c=a;cf(21,R.Kq|0,(z=a,a+=4,p[z>>2]=b,z));a=c}function Is(b,c,d){var e,f,g,h,i,j;i=b>>2;var k=b+36|0,m=y[k>>2];g=(m|0)==0;a:do{if(g){j=7}else{for(var o=((c>>>0)%(m>>>0)<<2)+p[i+10]|0;;){h=y[o>>2];if((h|0)==0){j=7;break a}if((p[h+8>>2]|0)==(c|0)){break}o=h+12|0}ds(h);var r=h;j=28}}while(0);do{if(j==7){if((d|0)==0){ds(0);var q=0;j=30}else{o=y[b>>2];h=o>>2;g=(b+32|0)>>2;var s=y[g],u=s-p[i+7]|0,w=(d|0)==1;if(w){if(u>>>0>=y[h+3]>>>0){q=0;j=30;break}if(u>>>0>=y[i+6]>>>0){q=0;j=30;break}if((ot(b)|0)!=0){q=0;j=30;break}}if(s>>>0>=m>>>0&&(Bt(b)|0)!=0){q=0,j=30}else{s=b+12|0;u=(p[s>>2]|0)==0;a:do{if(u){j=23}else{if(j=y[h+6],(j|0)==0){j=23}else{f=(p[g]+1|0)>>>0<y[i+5]>>>0;do{if(f&&y[h+4]>>>0<y[h+1]>>>0&&(ot(b)|0)==0){j=23;break a}}while(0);ms(j);ds(j);f=y[j+16>>2]>>2;if((p[f+2]+p[f+1]|0)==(p[i+2]+p[i+1]|0)){e=o+16|0;p[e>>2]=p[s>>2]-p[f+3]+p[e>>2]|0;var v=j;e=v>>2;j=27}else{Ct(j),j=23}}}}while(0);if(j==23){w?(dj(),e=Dt(b),gj()):e=Dt(b);if((e|0)==0){q=0;j=30;break}v=e;e=v>>2}r=(c>>>0)%(y[k>>2]>>>0);p[g]=p[g]+1|0;p[e+2]=c;g=b+40|0;p[e+3]=p[p[g>>2]+(r<<2)>>2];p[e+4]=b;p[e+6]=0;p[e+5]=0;p[p[e+1]>>2]=0;r=p[((r<<2)+p[g>>2]|0)>>2]=v;j=28}}}}while(0);j==28&&(b=b+44|0,y[b>>2]>>>0<c>>>0&&(p[b>>2]=c),q=r);return q|0}Is.X=1;function Et(b){for(var c=b+24|0,d=b+16|0,b=b+4|0;;){if(y[d>>2]>>>0<=y[b>>2]>>>0){break}var e=y[c>>2];if((e|0)==0){break}ds(e);ms(e);Ct(e)}}function Ct(b){if((b|0)!=0){var c=p[b+16>>2];ip(p[b>>2]);(p[c+12>>2]|0)!=0&&(b=p[c>>2]+16|0,p[b>>2]=p[b>>2]-1|0)}}function Ft(b,c){var d=b+36|0,e=(p[d>>2]|0)==0;a:do{if(!e){for(var f=b+40|0,g=b+32|0,h=0;;){var i=(h<<2)+p[f>>2]|0;b:for(;;){for(;;){var j=y[i>>2];if((j|0)==0){break b}if(y[j+8>>2]>>>0<c>>>0){break}p[g>>2]=p[g>>2]-1|0;p[i>>2]=p[j+12>>2];ds(j);Ct(j)}i=j+12|0}h=h+1|0;if(h>>>0>=y[d>>2]>>>0){break a}}}}while(0)}function ot(b){if((p[Og+36>>2]|0)==0){b=4}else{if((p[b+8>>2]+p[b+4>>2]|0)>(p[Og+32>>2]|0)){b=4}else{var c=p[Og+64>>2],b=5}}b==4&&(c=p[Qg+32>>2]);return c}function Bt(b){var c;c=(b+36|0)>>2;var d=y[c],e=d<<1,e=e>>>0<256?256:e;(d|0)!=0&&dj();var f=e<<2,d=Kg(f);(p[c]|0)!=0&&gj();if((d|0)==0){c=p[b+40>>2]}else{Ed(d,0,f);var f=p[c],g=(f|0)==0,b=(b+40|0)>>2,h=y[b];a:do{if(g){var i=h}else{for(var j=0,k=h,m=f;;){var o=p[k+(j<<2)>>2];if((o|0)!=0){for(k=o;;){var m=k+12|0,o=p[m>>2],r=((y[k+8>>2]>>>0)%(e>>>0)<<2)+d|0;p[m>>2]=p[r>>2];p[r>>2]=k;if((o|0)==0){break}k=o}m=p[c];k=p[b]}j=j+1|0;if(j>>>0>=m>>>0){i=k;break a}}}}while(0);Lg(i);p[b]=d;p[c]=e;c=d}return(c|0)!=0?0:7}Bt.X=1;function Dt(b){var c=b+4|0,d=Fp(p[c>>2]+p[b+8>>2]+28|0),e=p[c>>2],c=d+e|0;(d|0)==0?b=0:(p[c>>2]=d,p[(e+(d+4)|0)>>2]=e+(d+28)|0,(p[b+12>>2]|0)!=0&&(b=p[b>>2]+16|0,p[b>>2]=p[b>>2]+1|0),b=c);return b}function Gt(b,c,d){var e,f=p[d>>2],g=(lk(f)|0)==5;a:do{if(!g){var h=wk(f);if((h|0)!=0){var i=Ak(p[d>>2]),j=(c|0)==1;do{if(j){var k=Ht|0,m=R.qr|0,o=1,r=0;e=17}else{e=wk(p[d+4>>2]);if((e|0)==0){break a}var q=l[e];if(q<<24>>24==0){var s=h,u=i;e=32}else{for(var w=0,v=e;;){var x=v+1|0,v=l[x],q=(q&255)>191&(v&-64)<<24>>24==-128;b:do{if(q){for(var A=x;;){var A=A+1|0,E=l[A];if((E&-64)<<24>>24!=-128){var J=A,M=E;break b}}}else{J=x,M=v}}while(0);x=w+1|0;if(M<<24>>24==0){break}w=x;v=J;q=M}if((x|0)>0){w=(T.multiply(x,(x|0)<0?-1:0,5,0),T.result[0]);w=v=It(b,w,T.result[1]);if((v|0)==0){break a}v=(x<<2)+w|0;if(l[e]<<24>>24==0){s=h,u=i,e=32}else{q=0;for(A=e;;){p[w+(q<<2)>>2]=A;var D=A+1|0,E=(t[A]&255)>191;b:do{if(E){if((l[D]&-64)<<24>>24!=-128){var K=D}else{for(var H=D;;){if(H=H+1|0,(l[H]&-64)<<24>>24!=-128){K=H;break b}}}}else{K=D}}while(0);l[v+q|0]=K-A&255;D=q+1|0;if(l[K]<<24>>24==0){break}q=D;A=K}(D|0)>0?(k=w,m=v,o=D,r=e,e=17):(s=h,u=i,e=32)}}else{s=h,u=i,e=32}}}}while(0);do{if(e==17){j=ql(b);s=(j&1|0)==0;b:do{if(s){var N=h,Q=i}else{u=h;for(w=i;;){if((w|0)<=0){N=u;Q=w;break b}for(v=0;;){if((v|0)>=(o|0)){N=u;Q=w;break b}var P=t[m+v|0]&255;if((P|0)<=(w|0)&&(jm(u,p[k+(v<<2)>>2],P)|0)==0){break}v=v+1|0}u=u+P|0;w=w-P|0}}}while(0);j=(j&2|0)==0;b:do{if(j){var L=Q}else{s=Q;c:for(;;){if((s|0)<=0){L=s;break b}for(u=0;;){if((u|0)>=(o|0)){L=s;break b}w=t[m+u|0]&255;if((w|0)<=(s|0)&&(v=s-w|0,(jm(N+v|0,p[k+(u<<2)>>2],w)|0)==0)){s=v;continue c}u=u+1|0}}}}while(0);(r|0)!=0&&Lg(k);s=N;u=L}}while(0);dl(b,s,u,-1)}}}while(0)}Gt.X=1;function Jt(b,c,d){var e=d>>2,f=p[e+1],g=(lk(f)|0)==5;a:do{if(!g){var h=(c|0)==3;if(!(h&&(lk(p[e+2])|0)==5)){var i=lk(p[e]),j=Fk(f),k=j,m=(j|0)<0?-1:0,o=(i|0)==4,r=p[e];b:do{if(o){var q=Ak(r),s=vk(p[e]);if((s|0)==0){break a}var u=s,w=q}else{var v=wk(r);if((v|0)==0){break a}if((j|0)<0){var x=l[v];if(x<<24>>24==0){u=v,w=0}else{for(var A=0,E=v,J=x;;){var M=E+1|0,D=l[M],K=(J&255)>191&(D&-64)<<24>>24==-128;c:do{if(K){for(var H=M;;){var N=H+1|0,Q=l[N];if((Q&-64)<<24>>24!=-128){var P=N,L=Q;break c}H=N}}else{P=M,L=D}}while(0);var I=A+1|0;if(L<<24>>24==0){u=v;w=I;break b}A=I;E=P;J=L}}}else{u=v,w=0}}}while(0);if(h){var X=Fk(p[e+2]),Y=X,da=(X|0)<0?-1:0;if((X|0)<0){var ga=(T.b(0,0,Y,da),T.result[0]),ha=T.result[1],ba=1,ea=ha,ja=ga}else{var ba=0,ea=da,ja=Y}}else{var ra=p[rl(b)+72>>2],Va=(ra|0)<0?-1:0,ba=0,ea=Va,ja=ra}if((j|0)<0){var ta=(T.add(w,(w|0)<0?-1:0,k,m),T.result[0]),xa=T.result[1];if((xa|0)<0||(xa|0)==0&&ta>>>0<0){var Fa=(T.add(ja,ea,ta,xa),T.result[0]),Na=T.result[1],Ea=(Na|0)<0||(Na|0)==0&&Fa>>>0<0,La=Ea?0:Fa,za=Ea?0:Na,Ba=La,Ja=ka=0}else{var za=ea,Ba=ja,ka=xa,Ja=ta}}else{if((j|0)>0){var S=(T.add(k,m,-1,-1),T.result[0]),ib=T.result[1],za=ea,Ba=ja,ka=ib,Ja=S}else{var Wa=(ea|0)>0||(ea|0)==0&&ja>>>0>0,Za=(T.add(Wa,(Wa|0)<0?-1:0,ja,ea),T.result[0]),za=T.result[1],Ba=Za,ka=m,Ja=k}}if((ba|0)==0){var Sa=za,tb=Ba,pb=ka,fb=Ja}else{var Xa=(T.b(Ja,ka,Ba,za),T.result[0]),Ab=T.result[1];(Ab|0)<0||(Ab|0)==0&&Xa>>>0<0?(Sa=ka,tb=Ja,fb=pb=0):(Sa=za,tb=Ba,pb=Ab,fb=Xa)}if(o){var rb=(T.add(tb,Sa,fb,pb),T.result[0]),cb=T.result[1],Cb=w,Zb=(w|0)<0?-1:0,dc=tb;if((cb|0)>(Zb|0)||(cb|0)==(Zb|0)&&rb>>>0>Cb>>>0){var kb=(T.b(Cb,Zb,fb,pb),T.result[0]),Oa=T.result[1],Db=(Oa|0)<0||(Oa|0)==0&&kb>>>0<0?0:kb}else{Db=dc}Qk(b,u+fb|0,Db,-1)}else{var Wb=l[u],Nb=(fb!=0||pb!=0)&Wb<<24>>24!=0;b:do{if(Nb){for(var $b=u,Rb=pb,Ra=fb,Ob=Wb;;){var Ua=$b+1|0,Jb=l[Ua],Vb=(Ob&255)>191&(Jb&-64)<<24>>24==-128;c:do{if(Vb){for(var Pb=Ua;;){var sb=Pb+1|0,db=l[sb];if((db&-64)<<24>>24!=-128){var wb=sb,ob=db;break c}Pb=sb}}else{wb=Ua,ob=Jb}}while(0);var Kb=(T.add(Ra,Rb,-1,-1),T.result[0]),ub=T.result[1];if(!((Kb!=0||ub!=0)&ob<<24>>24!=0)){var Xb=wb,Sb=ob;break b}$b=wb;Rb=ub;Ra=Kb;Ob=ob}}else{Xb=u,Sb=Wb}}while(0);var Qb=Sb<<24>>24==0|(tb==0&&Sa==0);b:do{if(Qb){var ac=Xb}else{for(var Gb=Xb,xb=Sa,Ta=tb,qb=Sb;;){var bc=Gb+1|0,$a=l[bc],mb=(qb&255)>191&($a&-64)<<24>>24==-128;c:do{if(mb){for(var Bb=bc;;){var bb=Bb+1|0,jb=l[bb];if((jb&-64)<<24>>24!=-128){var nb=bb,zb=jb;break c}Bb=bb}}else{nb=bc,zb=$a}}while(0);var Tb=(T.add(Ta,xb,-1,-1),T.result[0]),ec=T.result[1];if(zb<<24>>24==0|(Tb==0&&ec==0)){ac=nb;break b}Gb=nb;xb=ec;Ta=Tb;qb=zb}}}while(0);dl(b,Xb,ac-Xb|0,-1)}}}}while(0)}Jt.X=1;function Kt(b,c,d){var e,f=a;a+=8;var g;e=f>>2;if((c|0)==2){if(c=p[d+4>>2],(lk(c)|0)==5){g=15}else{var h=Fk(c),h=(h|0)>30?30:h,h=(h|0)<0?0:h;g=5}}else{h=0,g=5}do{if(g==5&&(c=p[d>>2],(lk(c)|0)!=5)){c=Dk(c);xd[0]=c;p[e]=C[0];p[e+1]=C[1];if((h|0)==0){if(c>=0&c<0x7ffffffffffffc00){g=c+.5;var i=g>>>0;g=Math.min(Math.floor(g/4294967296),4294967295);i+=g*4294967296;xd[0]=i;p[e]=C[0];p[e+1]=C[1];g=14}else{c<0&c>-0x7ffffffffffffc00?(g=.5-c,i=g>>>0,g=Math.min(Math.floor(g/4294967296),4294967295),i=-(i+g*4294967296),xd[0]=i,p[e]=C[0],p[e+1]=C[1],g=14):g=11}}else{g=11}if(g==11){c=Bh(R.Xd|0,(z=a,a+=12,p[z>>2]=h,xd[0]=c,p[z+4>>2]=C[0],p[z+8>>2]=C[1],z));if((c|0)==0){pl(b);break}Ek(c,f,ve(c),1);Lg(c);i=(C[0]=p[e],C[1]=p[e+1],xd[0])}Vk(b,i)}}while(0);a=f}Kt.X=1;function Lt(b,c,d){var c=y[d>>2],e=lk(c);do{if((e|0)==1||(e|0)==2){el(b,c)}else{if((e|0)==4){var f=vk(c),g=Ak(p[d>>2]),h=g,h=(T.add(h<<1|0,((g|0)<0?-1:0)<<1|h>>>31,4,0),T.result[0]),h=It(b,h,T.result[1]);if((h|0)!=0){var i=(g|0)>0;a:do{if(i){for(var j=0;;){var k=f+j|0,m=j<<1;l[m+(h+2)|0]=l[R.ra+((t[k]&255)>>>4)|0];l[m+(h+3)|0]=l[R.ra+(t[k]&15)|0];j=j+1|0;if((j|0)==(g|0)){break a}}}}while(0);f=g<<1;l[f+(h+2)|0]=39;l[f+(h+3)|0]=0;l[h]=88;l[h+1|0]=39;dl(b,h,-1,-1);Lg(h)}}else{if((e|0)==3){if(f=wk(c),(f|0)!=0){for(g=i=h=0;;){j=l[f+g|0];if(j<<24>>24==0){break}else{j<<24>>24==39&&(i=(T.add(i,h,1,0),T.result[0]),h=T.result[1])}g=g+1|0}j=g;g=(g|0)<0?-1:0;h=(T.add(i,h,3,0),T.result[0]);g=(T.add(h,T.result[1],j,g),T.result[0]);g=It(b,g,T.result[1]);if((g|0)!=0){l[g]=39;h=l[f];i=h<<24>>24==0;j=g+1|0;a:do{if(i){var o=2,r=j}else{for(var k=0,q=1,s=f,u=h,w=2,m=j;;){if(l[m]=u,l[s]<<24>>24==39?(l[g+w|0]=39,q=q+2|0):q=w,k=k+1|0,s=f+k|0,u=l[s],w=q+1|0,m=g+q|0,u<<24>>24==0){o=w;r=m;break a}}}}while(0);l[r]=39;l[g+o|0]=0;dl(b,g,o,34)}}}else{dl(b,R.V|0,4,0)}}}}while(0)}Lt.X=1;function Mt(b,c,d){var e,c=wk(p[d>>2]),f=(c|0)==0;a:do{if(!f){var g=Ak(p[d>>2]),h=d+4|0,i=wk(p[h>>2]);if((i|0)!=0){if(l[i]<<24>>24==0){el(b,p[d>>2])}else{var h=Ak(p[h>>2]),j=d+8|0,k=wk(p[j>>2]);if((k|0)!=0){var j=Ak(p[j>>2]),m=g+1|0,o=m,r=(m|0)<0?-1:0,q=It(b,o,r);if((q|0)!=0){for(var m=g-h|0,s=j-h|0,u=s,w=(s|0)<0?-1:0,v=h-1|0,x=s=0,A=o,o=q;;){if((x|0)>(m|0)){d=g-x|0;Ah(o+s|0,c+x|0,d);d=s+d|0;l[o+d|0]=0;dl(b,o,d,34);break a}var q=c+x|0,E=l[q],J=E<<24>>24==l[i]<<24>>24;do{if(J){if((jm(q,i,h)|0)!=0){e=11}else{var M=rl(b),D=(T.add(A,r,u,w),T.result[0]),K=T.result[1],H=(T.add(D,K,-1,-1),T.result[0]),N=T.result[1],M=p[M+72>>2];e=(M|0)<0?-1:0;if((N|0)>(e|0)||(N|0)==(e|0)&&H>>>0>M>>>0){Uk(b);Lg(o);break a}M=dh(o,D);if((M|0)==0){pl(b);Lg(o);break a}Ah(M+s|0,k,j);H=s+j|0;N=v+x|0;e=17}}else{e=11}}while(0);e==11&&(l[o+s|0]=E,H=s+1|0,N=x,K=r,D=A,M=o);s=H;x=N+1|0;r=K;A=D;o=M}}}}}}}while(0)}Mt.X=1;function Nt(b,c,d){var e,b=El(b,28),c=lm(p[d>>2]);if(!((b|0)==0|(c|0)==5)){e=(b+16|0)>>2;var f=(T.add(p[e],p[e+1],1,0),T.result[0]),g=T.result[1];p[e]=f;p[e+1]=g;d=p[d>>2];(c|0)==1?(c=Jk(d),d=c[0],c=c[1],e=b>>2,f=(C[0]=p[e],C[1]=p[e+1],xd[0])+(d+c*4294967296),xd[0]=f,p[e]=C[0],p[e+1]=C[1],e=b+24|0,(l[e]|l[b+25|0])<<24>>24==0&&(Ot(b+8|0,d,c)|0)!=0&&(l[e]=1)):(c=Dk(d),d=b>>2,c=(C[0]=p[d],C[1]=p[d+1],xd[0])+c,xd[0]=c,p[d]=C[0],p[d+1]=C[1],l[b+25|0]=1)}}Nt.X=1;function Pt(b,c,d){c=a;a+=4;for(var e=rl(b),f=wk(p[d>>2]),g=wk(p[d+4>>2]),d=wk(p[d+8>>2]),h=f,i=f,f=0;;){if(l[h]<<24>>24==0){break}var j=Bn(h,c);if((p[c>>2]|0)==102){for(var k=h;;){var m=k+j|0,o=Bn(m,c);if((p[c>>2]|0)!=149){break}j=o;k=m}h=Mm(e,m,o);if((h|0)==0){break}Qt(h);if((qm(g,h)|0)==0){var r=(f|0)!=0?f:xh|0,r=zm(e,R.vd|0,(z=a,a+=16,p[z>>2]=r,p[z+4>>2]=m-i|0,p[z+8>>2]=i,p[z+12>>2]=d,z));vf(e,f);i=k+o+j|0;f=r}vf(e,h);j=o;h=m}h=h+j|0}m=(f|0)!=0?f:xh|0;m=zm(e,R.$a|0,(z=a,a+=8,p[z>>2]=m,p[z+4>>2]=i,z));dl(b,m,-1,4);vf(e,f);a=c}Pt.X=1;function Qt(b){var c=(b|0)==0;do{if(!c){var d=l[b],e=d<<24>>24;if(!((e|0)==39||(e|0)==34||(e|0)==96)){if((e|0)==91){d=93}else{break}}for(var e=0,f=1;;){var g=l[b+f|0];if(g<<24>>24==0){break}if(g<<24>>24==d<<24>>24){f=f+1|0;if(l[b+f|0]<<24>>24!=d<<24>>24){break}l[b+e|0]=d}else{l[b+e|0]=g}e=e+1|0;f=f+1|0}l[b+e|0]=0}}while(0)}function Bn(b,c){var d=c>>2,e,f=t[b],g=f&255;a:do{if((g|0)==32||(g|0)==9||(g|0)==10||(g|0)==12||(g|0)==13){e=(l[R.e+(t[b+1|0]&255)|0]&1)<<24>>24==0;b:do{if(e){var h=1}else{for(var i=1;;){if(i=i+1|0,(l[R.e+(t[b+i|0]&255)|0]&1)<<24>>24==0){h=i;break b}}}}while(0);p[d]=149;i=h;e=106}else{if((g|0)==45){if(l[b+1|0]<<24>>24==45){for(e=2;;){i=l[b+e|0];if(i<<24>>24==0||i<<24>>24==10){break}e=e+1|0}p[d]=149;i=e}else{p[d]=87,i=1}e=106}else{if((g|0)==40){p[d]=22,i=1,e=106}else{if((g|0)==41){p[d]=23,i=1,e=106}else{if((g|0)==59){i=p[d]=1,e=106}else{if((g|0)==43){p[d]=86,i=1,e=106}else{if((g|0)==42){p[d]=88,i=1,e=106}else{if((g|0)==47){e=l[b+1|0]<<24>>24==42;do{if(e&&(i=t[b+2|0],i<<24>>24!=0)){f=i&255;for(e=3;;){i=t[b+e|0];if((f|0)==42&i<<24>>24==47){var j=42;break}f=i&255;if(i<<24>>24==0){j=f;break}e=e+1|0}p[d]=149;i=((j|0)!=0&1)+e|0;e=106;break a}}while(0);p[d]=89;i=1;e=106}else{if((g|0)==37){p[d]=90,i=1,e=106}else{if((g|0)==61){p[d]=76,i=l[b+1|0]<<24>>24==61?2:1,e=106}else{if((g|0)==60){e=l[b+1|0],e<<24>>24==61?(p[d]=78,i=2):e<<24>>24==62?(p[d]=75,i=2):e<<24>>24==60?(p[d]=84,i=2):(p[d]=79,i=1),e=106}else{if((g|0)==62){e=l[b+1|0],e<<24>>24==61?(p[d]=80,i=2):e<<24>>24==62?(p[d]=85,i=2):(p[d]=77,i=1),e=106}else{if((g|0)==33){p[d]=l[b+1|0]<<24>>24==61?75:148,i=2,e=106}else{if((g|0)==124){l[b+1|0]<<24>>24==124?(p[d]=91,i=2):(p[d]=83,i=1),e=106}else{if((g|0)==44){p[d]=25,i=1,e=106}else{if((g|0)==38){p[d]=82,i=1,e=106}else{if((g|0)==126){p[d]=93,i=1,e=106}else{if((g|0)==96||(g|0)==39||(g|0)==34){for(var k=1;;){var m=l[b+k|0];if(m<<24>>24==0){p[d]=148;i=k;e=106;break a}var o=m<<24>>24==f<<24>>24;do{if(o){var r=k+1|0;if(l[b+r|0]<<24>>24!=f<<24>>24){if(m<<24>>24==39){p[d]=94;i=r;e=106;break a}p[d]=26;i=r;e=106;break a}}else{r=k}}while(0);k=r+1|0}}else{if((g|0)==46){((t[b+1|0]&255)-48|0)>>>0<10?e=54:(p[d]=118,i=1,e=106)}else{if((g|0)==48||(g|0)==49||(g|0)==50||(g|0)==51||(g|0)==52||(g|0)==53||(g|0)==54||(g|0)==55||(g|0)==56||(g|0)==57){e=54}else{if((g|0)==91){i=0;for(e=1;;){if(i){var q=93;break}i=t[b+e|0];if(i<<24>>24==0){q=i&255;break}i=i<<24>>24==93;e=e+1|0}p[d]=(q|0)==93?26:148;i=e;e=106}else{if((g|0)==63){if(p[d]=133,((t[b+1|0]&255)-48|0)>>>0<10){for(k=1;;){if(k=k+1|0,((t[b+k|0]&255)-48|0)>>>0>=10){i=k;e=106;break a}}}else{i=1,e=106}}else{if((g|0)==35){if(((t[b+1|0]&255)-48|0)>>>0<10){for(e=1;;){var s=e+1|0;if(((t[b+s|0]&255)-48|0)>>>0>=10){break}e=s}(e|0)>0?(p[d]=132,i=s,e=106):e=78}else{e=78}}else{if((g|0)==36||(g|0)==64||(g|0)==58){e=78}else{if((g|0)==120||(g|0)==88){if(l[b+1|0]<<24>>24!=39){e=101}else{p[d]=131;e=t[b+2|0];i=(l[R.e+(e&255)|0]&8)<<24>>24==0;b:do{if(i){var u=2,w=e}else{for(k=2;;){if(k=k+1|0,m=t[b+k|0],(l[R.e+(m&255)|0]&8)<<24>>24==0){u=k;w=m;break b}}}}while(0);e=w<<24>>24==39&(u&1|0)==0;b:do{if(e){var v=u,x=w}else{p[d]=148;for(i=u;;){k=l[b+i|0];if(k<<24>>24==0||k<<24>>24==39){v=i;x=k;break b}i=i+1|0}}}while(0);i=(x<<24>>24!=0&1)+v|0;e=106}}else{e=101}}}}}}}}}}}}}}}}}}}}}}}}}}while(0);a:do{if(e==54){p[d]=129;j=t[b];f=((j&255)-48|0)>>>0<10;b:do{if(f){for(h=0;;){if(h=h+1|0,q=t[b+h|0],((q&255)-48|0)>>>0>=10){var A=h,E=q;break b}}}else{A=0,E=j}}while(0);if(E<<24>>24==46){for(j=A;;){var J=j+1|0;if(((t[b+J|0]&255)-48|0)>>>0>=10){break}j=J}p[d]=130;j=J}else{j=A}f=t[b+j|0];do{if(f<<24>>24==101||f<<24>>24==69){h=t[j+(b+1)|0];if(((h&255)-48|0)>>>0<10){h=q=j+2|0,q=l[b+q|0]}else{if(!(h<<24>>24==43||h<<24>>24==45)){h=j;q=f;break}h=j+2|0;q=t[b+h|0];if(((q&255)-48|0)>>>0>=10){h=j;q=f;break}}q=((q&255)-48|0)>>>0<10;b:do{if(q){for(s=h;;){if(s=s+1|0,((t[b+s|0]&255)-48|0)>>>0>=10){var M=s;break b}}}else{M=h}}while(0);p[d]=130;h=M;q=l[b+M|0]}else{h=j,q=f}}while(0);if((l[R.e+(q&255)|0]&70)<<24>>24==0){i=h}else{for(j=h;;){if(p[d]=148,j=j+1|0,(l[R.e+(t[b+j|0]&255)|0]&70)<<24>>24==0){i=j;break a}}}}else{if(e==78){p[d]=133;j=0;for(i=1;;){f=t[b+i|0];if(f<<24>>24==0){var D=i;e=91;break}if((l[R.e+(f&255)|0]&70)<<24>>24==0){if(f<<24>>24==40&(j|0)>0){var K=i;e=83;break}if(f<<24>>24!=58){D=i;e=91;break}f=i+1|0;if(l[b+f|0]<<24>>24!=58){D=i;e=91;break}i=f}else{j=j+1|0}i=i+1|0}b:do{if(e==83){for(;;){var H=K+1|0,D=t[b+H|0];if(D<<24>>24==0){break}i=D<<24>>24==41;if((l[R.e+(D&255)|0]&1)<<24>>24!=0|i){if(!i){break}D=K+2|0;break b}else{K=H}}p[d]=148;D=H}}while(0);(j|0)==0&&(p[d]=148);i=D}else{if(e==101){if((l[R.e+g|0]&70)<<24>>24==0){p[d]=148,i=1}else{j=(l[R.e+(t[b+1|0]&255)|0]&70)<<24>>24==0;b:do{if(j){var N=1}else{for(i=1;;){if(i=i+1|0,(l[R.e+(t[b+i|0]&255)|0]&70)<<24>>24==0){N=i;break b}}}}while(0);p[d]=Ho(b,N);i=N}}}}}while(0);return i}Bn.X=1;function Mm(b,c,d){(c|0)==0?c=0:(b=zh(b,d+1|0),(b|0)==0?c=0:(Ah(b,c,d),l[b+d|0]=0,c=b));return c}function Rt(b,c,d){var e,f=a;a+=144;e=f>>2;var g=f+44;(St(b,c,d,f)|0)==0&&(Tt(f),c=g|0,d=p[e+2],g=p[e+3],e=p[e+4],Ch(100,c,R.Ud|0,(z=a,a+=12,p[z>>2]=d,p[z+4>>2]=g,p[z+8>>2]=e,z)),dl(b,c,-1,-1));a=f}function Ut(b,c,d){var e=a;a+=144;var f=e+44;if((St(b,c,d,e)|0)==0){Vt(e);var c=f|0,d=p[e+20>>2],f=p[e+24>>2],g=e+32|0,g=(C[0]=p[g>>2],C[1]=p[g+4>>2],xd[0])&-1;Ch(100,c,R.Td|0,(z=a,a+=12,p[z>>2]=d,p[z+4>>2]=f,p[z+8>>2]=g,z));dl(b,c,-1,-1)}a=e}function Wt(b,c,d){var e,f=a;a+=144;e=f>>2;var g=f+44;if((St(b,c,d,f)|0)==0){Xt(f);var c=g|0,d=p[e+2],g=p[e+3],h=p[e+4],i=p[e+5];e=p[e+6];var j=f+32|0,j=(C[0]=p[j>>2],C[1]=p[j+4>>2],xd[0])&-1;Ch(100,c,R.Sd|0,(z=a,a+=24,p[z>>2]=d,p[z+4>>2]=g,p[z+8>>2]=h,p[z+12>>2]=i,p[z+16>>2]=e,p[z+20>>2]=j,z));dl(b,c,-1,-1)}a=f}function Yt(b){var c,d=b>>2,e,f=b+42|0;if(l[f]<<24>>24==0){var g=b+40|0;if(l[g]<<24>>24==0){c=1;var h=2e3,i=1;e=4}else{e=p[d+2];var j=p[d+3],k=p[d+4];if((j|0)<3){c=j,h=e,i=k,e=4}else{var m=e,o=j,r=k;e=5}}e==4&&(m=h-1|0,o=c+12|0,r=i);c=((r+((m|0)/-100&-1)+((m|0)/400&-1)+((m*36525+172251900|0)/100&-1)+((o*306001+306001|0)/1e4&-1)+2|0)-1524.5)*864e5;h=c>>>0;i=Math.min(Math.floor(c/4294967296),4294967295);c=(b|0)>>2;p[c]=h;p[c+1]=i;l[f]=1;f=b+41|0;l[f]<<24>>24!=0&&(m=p[d+6]*6e4+p[d+5]*36e5|0,o=(m|0)<0?-1:0,r=b+32|0,e=(C[0]=p[r>>2],C[1]=p[r+4>>2],xd[0])*1e3,r=e>>>0,e=Math.min(Math.floor(e/4294967296),4294967295),h=(T.add(r,e,h,i),T.result[0]),h=(T.add(h,T.result[1],m,o),T.result[0]),i=T.result[1],p[c]=h,p[c+1]=i,b=b+43|0,l[b]<<24>>24!=0&&(d=p[d+7]*6e4|0,d=(T.b(h,i,d,(d|0)<0?-1:0),T.result[0]),h=T.result[1],p[c]=d,p[c+1]=h,l[g]=0,l[f]=0,l[b]=0))}}Yt.X=1;function Tt(b){var c=b>>2,d=b+40|0;if(l[d]<<24>>24==0){if(l[b+42|0]<<24>>24==0){p[c+2]=2e3,p[c+3]=1,p[c+4]=1}else{b|=0;var b=(T.add(p[b>>2],p[b+4>>2],432e5,0),T.result[0]),b=(T.j(b,T.result[1],864e5,0),T.result[0]),e=((b|0)-1867216.25)/36524.25&-1,e=b+e+((e|0)/-4&-1)+1525|0,b=((e|0)-122.1)/365.25&-1,e=e-((b*36525|0)/100&-1)|0,f=(e|0)/30.6001&-1;p[c+4]=e-(f*30.6001&-1)|0;e=((f|0)<14?-1:-13)+f|0;p[c+3]=e;p[c+2]=((e|0)>2?-4716:-4715)+b|0}l[d]=1}}Tt.X=1;function Zt(b,c,d){var e,f,g=a;a+=188;var h=g+44,i=g+144,j=wk(p[d>>2]),k=(j|0)==0;a:do{if(!k&&(St(b,c-1|0,d+4|0,g)|0)==0){e=rl(b);f=0;var m=1,o=0;b:for(;;){var r=l[j+o|0];do{if(r<<24>>24==0){break b}else{if(r<<24>>24==37){var q=o+1|0,s=l[j+q|0]<<24>>24;if((s|0)==100||(s|0)==72||(s|0)==109||(s|0)==77||(s|0)==83||(s|0)==87){var u=(T.add(m,f,1,0),T.result[0]),s=T.result[1]}else{if((s|0)==119||(s|0)==37){s=f,u=m}else{if((s|0)==102){u=(T.add(m,f,8,0),T.result[0]),s=T.result[1]}else{if((s|0)==106){u=(T.add(m,f,3,0),T.result[0]),s=T.result[1]}else{if((s|0)==89){u=(T.add(m,f,8,0),T.result[0]),s=T.result[1]}else{if((s|0)==115||(s|0)==74){u=(T.add(m,f,50,0),T.result[0]),s=T.result[1]}else{break a}}}}}}}else{s=f,u=m,q=o}}}while(0);o=q+1|0;m=(T.add(u,s,1,0),T.result[0]);f=T.result[1]}r=f>>>0<0||f>>>0==0&&m>>>0<100;do{if(r){o=h|0}else{o=p[e+72>>2];s=(o|0)<0?-1:0;if(f>>>0>s>>>0||f>>>0==s>>>0&&m>>>0>o>>>0){Uk(b);break a}o=zh(e,m);if((o|0)==0){pl(b);break a}}}while(0);Yt(g);Xt(g);m=g+16|0;f=(g+32|0)>>2;var r=g+20|0,s=i,q=g,u=i+42|0,w=i+12|0,v=i+16|0,x=g|0;e=x>>2;for(var A=i|0,E=g+12|0,J=g+24|0,M=g+8|0,D=0,K=0;;){var H=l[j+K|0];if(H<<24>>24==0){break}else{if(H<<24>>24==37){var K=K+1|0,H=j+K|0,N=l[H]<<24>>24;if((N|0)==100){H=p[m>>2],Ch(3,o+D|0,R.M|0,(z=a,a+=4,p[z>>2]=H,z)),D=D+2|0}else{if((N|0)==102){H=(C[0]=p[f],C[1]=p[f+1],xd[0]),H=H>59.999?59.999:H,N=o+D|0,Ch(7,N,R.Ed|0,(z=a,a+=8,xd[0]=H,p[z>>2]=C[0],p[z+4>>2]=C[1],z)),D=ve(N)+D|0}else{if((N|0)==72){H=p[r>>2],Ch(3,o+D|0,R.M|0,(z=a,a+=4,p[z>>2]=H,z)),D=D+2|0}else{if((N|0)==87||(N|0)==106){for(var N=q>>2,Q=s>>2,P=N+11;N<P;N++,Q++){p[Q]=p[N]}l[u]=0;p[w>>2]=1;p[v>>2]=1;Yt(i);var P=p[A>>2],L=p[A+4>>2],N=(T.add(p[e],p[e+1],432e5,0),T.result[0]),Q=T.result[1],P=(T.b(N,Q,P,L),T.result[0]),P=(T.j(P,T.result[1],864e5,0),T.result[0]);l[H]<<24>>24==87?(H=(T.j(N,Q,864e5,0),T.result[0]),H=(T.k(H,T.result[1],7,0),T.result[0]),H=(P+7-H|0)/7&-1,Ch(3,o+D|0,R.M|0,(z=a,a+=4,p[z>>2]=H,z)),D=D+2|0):(H=P+1|0,Ch(4,o+D|0,R.Fd|0,(z=a,a+=4,p[z>>2]=H,z)),D=D+3|0)}else{(N|0)==74?(H=o+D|0,Q=x|0,N=x+4|0,N=(p[Q>>2]+p[N>>2]*4294967296)/864e5,Ch(20,H,R.za|0,(z=a,a+=8,xd[0]=N,p[z>>2]=C[0],p[z+4>>2]=C[1],z)),D=ve(H)+D|0):(N|0)==109?(H=p[E>>2],Ch(3,o+D|0,R.M|0,(z=a,a+=4,p[z>>2]=H,z)),D=D+2|0):(N|0)==77?(H=p[J>>2],Ch(3,o+D|0,R.M|0,(z=a,a+=4,p[z>>2]=H,z)),D=D+2|0):(N|0)==115?(H=o+D|0,Q=x|0,Q=p[Q>>2],N=x+4|0,N=(T.j(Q,p[N>>2],1e3,0),T.result[0]),N=(T.add(N,T.result[1],-413362496,-50),T.result[0]),Q=T.result[1],Ch(30,H,R.U|0,(z=a,a+=8,p[z>>2]=N,p[z+4>>2]=Q,z)),D=ve(H)+D|0):(N|0)==83?(H=(C[0]=p[f],C[1]=p[f+1],xd[0])&-1,Ch(3,o+D|0,R.M|0,(z=a,a+=4,p[z>>2]=H,z)),D=D+2|0):(N|0)==119?(H=(T.add(p[e],p[e+1],1296e5,0),T.result[0]),H=(T.j(H,T.result[1],864e5,0),T.result[0]),H=(T.k(H,T.result[1],7,0),T.result[0]),l[o+D|0]=(H&255)+48&255,D=D+1|0):(N|0)==89?(H=o+D|0,N=p[M>>2],Ch(5,H,R.Gd|0,(z=a,a+=4,p[z>>2]=N,z)),D=ve(H)+D|0):(l[o+D|0]=37,D=D+1|0)}}}}}else{l[o+D|0]=H,D=D+1|0}}K=K+1|0}l[o+D|0]=0;dl(b,o,-1,(o|0)==(h|0)?-1:4)}}while(0);a=g}Zt.X=1;function St(b,c,d,e){Ed(e,0,44);var f=(c|0)==0;a:do{if(f){var g=$t(b,e)}else{var h=y[d>>2];if((lk(h)-1|0)>>>0<2){var i=Dk(h)*864e5+.5,h=i>>>0,i=Math.min(Math.floor(i/4294967296),4294967295),j=e|0;p[j>>2]=h;p[j+4>>2]=i;l[e+42|0]=1}else{h=wk(h);if((h|0)==0){g=1;break}var j=b,k=h,i=e,h=a;a+=8;if((au(k,i)|0)==0){i=0}else{if((bu(k,i)|0)==0){i=0}else{if((qm(k,R.Rd|0)|0)==0){i=$t(j,i)}else{if((Ek(k,h,ve(k),1)|0)==0){i=1}else{var k=(C[0]=p[h>>2],C[1]=p[h+4>>2],xd[0])*864e5+.5,j=k>>>0,k=Math.min(Math.floor(k/4294967296),4294967295),m=i|0;p[m>>2]=j;p[m+4>>2]=k;l[i+42|0]=1;i=0}}}}a=h;if((i|0)!=0){g=1;break}}for(h=1;;){if((h|0)>=(c|0)){g=0;break a}i=wk(p[d+(h<<2)>>2]);if((i|0)==0){g=1;break a}if((cu(b,i,e)|0)!=0){g=1;break a}h=h+1|0}}}while(0);return g}function Xt(b){Tt(b);Vt(b)}function Vt(b){var c=b+41|0;if(l[c]<<24>>24==0){Yt(b);var d=b|0,d=(T.add(p[d>>2],p[d+4>>2],432e5,0),T.result[0]),d=((T.k(d,T.result[1],864e5,0),T.result[0])|0)/1e3,e=b+32|0,f=d&-1,g=(f|0)/3600&-1;p[b+20>>2]=g;var g=g*-3600+f|0,h=(g|0)/60&-1;p[b+24>>2]=h;xd[0]=d-(f|0)+(g+h*-60|0);p[e>>2]=C[0];p[e+4>>2]=C[1];l[c]=1}}function $t(b,c){if((zl(p[rl(b)>>2],c|0)|0)==0){l[c+42|0]=1;var d=0}else{d=1}return d}function du(b){l[b+40|0]=0;l[b+41|0]=0;l[b+43|0]=0}function cu(b,c,d){var e,f,g,h,i,j,k,m,o,r,q=d>>2,s=a;a+=88;var u;r=s>>2;var w=s+4;o=w>>2;var v=s+12,x=s+44;p[r]=1;for(var A=v|0,E=0;;){if((E|0)>=29){break}var J=t[c+E|0];if(J<<24>>24==0){break}l[v+E|0]=l[R.i+(J&255)|0];E=E+1|0}l[v+E|0]=0;var M=l[A]<<24>>24;a:do{if((M|0)==108){if((pg(A,R.Hd|0)|0)==0){Yt(d);var D=eu(d,b,s),K=d|0,H=K|0,N=K+4|0,Q=(T.add(p[H>>2],p[N>>2],D[0],D[1]),T.result[0]),P=T.result[1],L=K|0;p[L>>2]=Q;var I=K+4|0;p[I>>2]=P;du(d)}}else{if((M|0)==117){var X=(pg(A,R.Id|0)|0)==0;do{if(X&&l[d+42|0]<<24>>24!=0){var Y=d|0,da=Y|0,ga=Y+4|0,ha=(T.add(p[da>>2],p[ga>>2],43200,0),T.result[0]),ba=(T.j(ha,T.result[1],86400,0),T.result[0]),ea=(T.add(ba,T.result[1],1045635584,49096),T.result[0]),ja=T.result[1],ra=Y|0;p[ra>>2]=ea;var Va=Y+4|0;p[Va>>2]=ja;du(d);p[r]=0;break a}}while(0);if((pg(A,R.Jd|0)|0)==0){Yt(d);var ta=eu(d,b,s),xa=ta[0],Fa=ta[1];if((p[r]|0)==0){var Na=d|0,da=Na|0,Ea=p[da>>2],ga=Na+4|0,La=(T.b(Ea,p[ga>>2],xa,Fa),T.result[0]),za=T.result[1],Ba=Na|0;m=Ba>>2;p[m]=La;var Ja=Na+4|0;k=Ja>>2;p[k]=za;du(d);var ka=eu(d,b,s),S=ka[0],ib=ka[1],ra=Na|0,Wa=p[ra>>2],Va=Na+4|0,Za=p[Va>>2],Sa=(T.b(xa,Fa,S,ib),T.result[0]),tb=(T.add(Sa,T.result[1],Wa,Za),T.result[0]),pb=T.result[1];p[Na>>2]=tb;p[Na+4>>2]=pb}}}else{if((M|0)==119){if((fu(A,R.Kd|0,8)|0)==0){var fb=v+8|0;if((Ek(fb,w,ve(fb),1)|0)!=0){var Xa=(C[0]=p[o],C[1]=p[o+1],xd[0]),Ab=Xa&-1;if((Ab|0)==Xa&(Ab|0)>-1&Xa<7){Xt(d);l[d+43|0]=0;l[d+42|0]=0;Yt(d);j=(d|0)>>2;var rb=p[j],cb=p[j+1],Cb=(T.add(rb,cb,1296e5,0),T.result[0]),Zb=(T.j(Cb,T.result[1],864e5,0),T.result[0]),dc=(T.k(Zb,T.result[1],7,0),T.result[0]),kb=T.result[1],Oa=Ab,Db=(Ab|0)<0?-1:0,Wb=(T.add(dc,kb,-7,-1),T.result[0]),Nb=T.result[1],$b=(kb|0)>(Db|0)||(kb|0)==(Db|0)&&dc>>>0>Oa>>>0,Rb=(T.b(Oa,Db,$b?Wb:dc,$b?Nb:kb),T.result[0]),Ra=(T.multiply(Rb,T.result[1],864e5,0),T.result[0]),Ob=(T.add(Ra,T.result[1],rb,cb),T.result[0]),Ua=T.result[1];p[j]=Ob;p[j+1]=Ua;du(d);p[r]=0}}}}else{if((M|0)==115){if((fu(A,R.Ld|0,9)|0)==0){var Jb=v+9|0;Tt(d);l[d+41|0]=1;p[q+6]=0;p[q+5]=0;var Vb=d+32|0;xd[0]=0;p[Vb>>2]=C[0];p[Vb+4>>2]=C[1];l[d+43|0]=0;l[d+42|0]=0;if((pg(Jb,R.bb|0)|0)==0){p[q+4]=1}else{if((pg(Jb,R.cb|0)|0)==0){Tt(d),p[q+3]=1,p[q+4]=1}else{if((pg(Jb,R.eb|0)|0)!=0){break}}}p[r]=0}}else{if((M|0)==43||(M|0)==45||(M|0)==48||(M|0)==49||(M|0)==50||(M|0)==51||(M|0)==52||(M|0)==53||(M|0)==54||(M|0)==55||(M|0)==56||(M|0)==57){for(var Pb=1;;){var sb=v+Pb|0,db=t[sb];if(db<<24>>24==0||db<<24>>24==58){break}if((l[R.e+(db&255)|0]&1)<<24>>24!=0){break}Pb=Pb+1|0}if((Ek(A,w,Pb,1)|0)==0){p[r]=1}else{var wb=t[sb];if(wb<<24>>24==58){for(var ob=((t[A]&255)-48|0)>>>0<10?A:v+1|0,Kb=x>>2,ub=Kb+11;Kb<ub;Kb++){p[Kb]=0}if((bu(ob,x)|0)==0){Yt(x);i=(x|0)>>2;var Xb=(T.add(p[i],p[i+1],-432e5,-1),T.result[0]),Sb=(T.k(Xb,T.result[1],864e5,0),T.result[0]),Qb=T.result[1];p[i]=Sb;p[i+1]=Qb;if(l[A]<<24>>24==45){var ac=(T.b(0,0,Sb,Qb),T.result[0]),Gb=T.result[1];p[i]=ac;var xb=p[i+1]=Gb,Ta=ac}else{xb=Qb,Ta=Sb}Yt(d);du(d);var qb=d|0,H=qb|0,bc=p[H>>2],N=qb+4|0,$a=(T.add(bc,p[N>>2],Ta,xb),T.result[0]),mb=T.result[1],L=qb|0;p[L>>2]=$a;I=qb+4|0;p[I>>2]=mb;p[r]=0}}else{var Bb=(l[R.e+(wb&255)|0]&1)<<24>>24==0;b:do{if(Bb){var bb=sb}else{for(var jb=sb;;){var nb=jb+1|0;if((l[R.e+(t[nb]&255)|0]&1)<<24>>24==0){bb=nb;break b}jb=nb}}}while(0);var zb=ve(bb);if((zb-3|0)>>>0<=7){var Tb=zb-1|0,ec=bb+Tb|0;if(l[ec]<<24>>24==115){l[ec]=0;var Hb=Tb}else{Hb=zb}Yt(d);p[r]=0;var Eb=(C[0]=p[o],C[1]=p[o+1],xd[0]),Lb=Eb<0?-.5:.5;if((Hb|0)==3){if((pg(bb,R.eb|0)|0)!=0){u=55}else{var gb=Eb*864e5+Lb,Mb=gb>>>0,vc=Math.min(Math.floor(gb/4294967296),4294967295),hc=d|0,kc=hc|0;h=kc>>2;var pc=p[h],jc=hc+4|0;g=jc>>2;var mc=(T.add(pc,p[g],Mb,vc),T.result[0]),Fb=T.result[1],Ub=hc|0;f=Ub>>2;p[f]=mc;var Ya=hc+4|0;e=Ya>>2;p[e]=Fb;u=56}}else{if((Hb|0)==4){if((pg(bb,R.Nd|0)|0)==0){var Pa=Eb*36e5+Lb,yb=Pa>>>0,Ka=Math.min(Math.floor(Pa/4294967296),4294967295),Ac=d|0,kc=Ac|0;h=kc>>2;var Jc=p[h],jc=Ac+4|0;g=jc>>2;var uc=(T.add(yb,Ka,Jc,p[g]),T.result[0]),Tc=T.result[1],Ub=Ac|0;f=Ub>>2;p[f]=uc;Ya=Ac+4|0;e=Ya>>2;p[e]=Tc;u=56}else{if((pg(bb,R.cb|0)|0)!=0){u=55}else{var Yc=Eb&-1;Xt(d);var ua=d+8|0;p[ua>>2]=p[ua>>2]+Yc|0;l[d+42|0]=0;Yt(d);var md=Yc|0;if(md!=Eb){var nd=(Eb-md)*31536e6+Lb,Bc=nd>>>0,Qc=Math.min(Math.floor(nd/4294967296),4294967295),Oc=d|0,Ba=Oc|0;m=Ba>>2;var ed=p[m],Ja=Oc+4|0;k=Ja>>2;var Fc=(T.add(ed,p[k],Bc,Qc),T.result[0]),ud=T.result[1],Rc=Oc|0;p[Rc>>2]=Fc;var Yb=Oc+4|0;p[Yb>>2]=ud}u=56}}}else{if((Hb|0)==6){if((pg(bb,R.Od|0)|0)==0){var W=Eb*6e4+Lb,bd=W>>>0,hd=Math.min(Math.floor(W/4294967296),4294967295),eb=d|0,kc=eb|0;h=kc>>2;var Uc=p[h],jc=eb+4|0;g=jc>>2;var cd=(T.add(bd,hd,Uc,p[g]),T.result[0]),vd=T.result[1],Ub=eb|0;f=Ub>>2;p[f]=cd;Ya=eb+4|0;e=Ya>>2;p[e]=vd;u=56}else{if((pg(bb,R.Pd|0)|0)!=0){u=55}else{var id=Eb*1e3+Lb,Zc=id>>>0,td=Math.min(Math.floor(id/4294967296),4294967295),zd=d|0,kc=zd|0;h=kc>>2;var Id=p[h],jc=zd+4|0;g=jc>>2;var xc=(T.add(Zc,td,Id,p[g]),T.result[0]),qc=T.result[1],Ub=zd|0;f=Ub>>2;p[f]=xc;Ya=zd+4|0;e=Ya>>2;p[e]=qc;u=56}}}else{if((Hb|0)==5){if((pg(bb,R.bb|0)|0)!=0){u=55}else{Xt(d);var Gc=Eb&-1,Hc=d+12|0,zc=p[Hc>>2]+Gc|0,Kc=(((zc|0)>0?-1:-12)+zc|0)/12&-1,wd=d+8|0;p[wd>>2]=p[wd>>2]+Kc|0;p[Hc>>2]=zc+Kc*-12|0;l[d+42|0]=0;Yt(d);var be=Gc|0;if(be!=Eb){var ge=(Eb-be)*2592e6+Lb,Xd=ge>>>0,rc=Math.min(Math.floor(ge/4294967296),4294967295),Lc=d|0,Ba=Lc|0;m=Ba>>2;var Jd=p[m],Ja=Lc+4|0;k=Ja>>2;var Qd=(T.add(Jd,p[k],Xd,rc),T.result[0]),Fd=T.result[1],Rc=Lc|0;p[Rc>>2]=Qd;Yb=Lc+4|0;p[Yb>>2]=Fd}u=56}}else{u=55}}}}u==55&&(p[r]=1);du(d)}}}}}}}}}while(0);var Cd=p[r];a=s;return Cd}cu.X=1;function eu(b,c,d){var e,f,g,h,i=a;a+=136;h=i>>2;var j=i+44;g=j>>2;var k=i+88,m=i+92;f=m>>2;e=m>>2;for(var o=e+11;e<o;e++){p[e]=0}b>>=2;e=i>>2;for(o=b+11;b<o;b++,e++){p[e]=p[b]}Xt(i);e=i+8|0;(p[e>>2]-1971|0)>>>0>66?(p[e>>2]=2e3,p[h+3]=1,p[h+4]=1,p[h+5]=0,p[h+6]=0,e=i+32|0,xd[0]=0,p[e>>2]=C[0],p[e+4>>2]=C[1]):(e=(i+32|0)>>2,o=(C[0]=p[e],C[1]=p[e+1],xd[0])+.5&-1|0,xd[0]=o,p[e]=C[0],p[e+1]=C[1]);p[h+7]=0;l[i+42|0]=0;Yt(i);e=i|0;h=p[e>>2];e=p[e+4>>2];o=(T.j(h,e,1e3,0),T.result[0]);o=(T.add(o,T.result[1],-413362496,0),T.result[0]);p[k>>2]=o;gu||(gu=Dd(hu));o=gu;if(!iu){ju=Dd(4);p[ju>>2]=-(new Date).getTimezoneOffset()*60;ku=Dd(4);p[ku>>2]=Number((new Date(2e3,0,1)).getTimezoneOffset()!=(new Date(2e3,6,1)).getTimezoneOffset());var b=G(Pd("GMT"),"i8",Bd),r=G(Pd("GMT"),"i8",Bd);iu=Dd(8);p[iu>>2]=b;p[iu+4>>2]=r}k=new Date(p[k>>2]*1e3);p[o+lu>>2]=k.getSeconds();p[o+mu>>2]=k.getMinutes();p[o+nu>>2]=k.getHours();p[o+ou>>2]=k.getDate();p[o+pu>>2]=k.getMonth();p[o+qu>>2]=k.getFullYear()-1900;p[o+ru>>2]=k.getDay();b=new Date(k.getFullYear(),0,1);p[o+su>>2]=Math.floor((k.getTime()-b.getTime())/864e5);p[o+tu>>2]=b.getTimezoneOffset()*60;p[o+uu>>2]=Number(b.getTimezoneOffset()!=k.getTimezoneOffset());"GMT"in vu||(vu.GMT=G(Pd("GMT"),"i8",Bd));p[o+wu>>2]=vu.GMT;o=(p[of+232>>2]|0)==0?o:0;k=(o|0)==0;if(!k){o>>=2;m>>=2;for(b=o+11;o<b;o++,m++){p[m]=p[o]}}(k&1|0)==0?(p[g+2]=p[f+5]+1900|0,p[g+3]=p[f+4]+1|0,p[g+4]=p[f+3],p[g+5]=p[f+2],p[g+6]=p[f+1],c=j+32|0,xd[0]=p[f]|0,p[c>>2]=C[0],p[c+4>>2]=C[1],l[j+40|0]=1,l[j+41|0]=1,l[j+42|0]=0,l[j+43|0]=0,Yt(j),p[d>>2]=0,d=j|0,f=(T.b(p[d>>2],p[d+4>>2],h,e),T.result[0]),d=T.result[1]):(Yk(c,R.Qd|0,-1),p[d>>2]=1,f=d=0);a=i;return[f,d]}eu.X=1;function Ek(b,c,d,e){var f,g=e<<24>>24==1?1:2,h=b+d|0;xd[0]=0;p[c>>2]=C[0];p[c+4>>2]=C[1];if(e<<24>>24==3){var i=b+1|0}else{i=b,f=3}for(;;){if(i>>>0>=h>>>0){var j=0;f=72;break}var k=t[i];if((l[R.e+(k&255)|0]&1)<<24>>24==0){f=6;break}i=i+g|0}if(f==6){if(k<<24>>24==45){var m=i+g|0,o=-1}else{m=k<<24>>24==43?i+g|0:i,o=1}for(var r=m,q=0;;){if(r>>>0>=h>>>0){var s=r,u=q,w=0,v=0;break}if(l[r]<<24>>24!=48){s=r;u=q;v=w=0;break}r=r+g|0;q=q+1|0}for(;;){if(s>>>0>=h>>>0){var x=s,A=u,E=0;break}var J=t[s];if(!(((J&255)-48|0)>>>0<10&((w|0)<214748364||(w|0)==214748364&&v>>>0<3435973835))){x=s;A=u;E=0;break}var M=(T.multiply(v,w,10,0),T.result[0]),D=(J<<24>>24)-48|0,K=(T.add(D,(D|0)<0?-1:0,M,T.result[1]),T.result[0]),H=T.result[1],s=s+g|0,u=u+1|0,w=H,v=K}for(;;){if(x>>>0>=h>>>0){var N=x,Q=A,P=1,L=0,I=w,X=v,Y=E,da=1;f=42;break}var ga=t[x];if(((ga&255)-48|0)>>>0>=10){f=19;break}x=x+g|0;A=A+1|0;E=E+1|0}a:do{if(f==19){var ha=ga<<24>>24==46;b:do{if(ha){for(var ba=x,ea=A,ja=w,ra=v,Va=E;;){var ta=ba+g|0;if(ta>>>0>=h>>>0){var xa=ta,Fa=ea;break}var Na=t[ta];if(!(((Na&255)-48|0)>>>0<10&((ja|0)<214748364||(ja|0)==214748364&&ra>>>0<3435973835))){xa=ta;Fa=ea;break}var Ea=(T.multiply(ra,ja,10,0),T.result[0]),La=(Na<<24>>24)-48|0,za=(T.add(La,(La|0)<0?-1:0,Ea,T.result[1]),T.result[0]),Ba=T.result[1],ba=ta,ea=ea+1|0,ja=Ba,ra=za,Va=Va-1|0}for(;;){if(xa>>>0>=h>>>0){var Ja=xa,ka=Fa,S=ja,ib=ra,Wa=Va;break b}if(((t[xa]&255)-48|0)>>>0>=10){Ja=xa;ka=Fa;S=ja;ib=ra;Wa=Va;break b}xa=xa+g|0;Fa=Fa+1|0}}else{Ja=x,ka=A,S=w,ib=v,Wa=E}}while(0);if(Ja>>>0<h>>>0){var Za=l[Ja];b:do{if(Za<<24>>24==101||Za<<24>>24==69){var Sa=Ja+g|0;if(Sa>>>0>=h>>>0){N=Sa;Q=ka;L=P=0;I=S;X=ib;Y=Wa;da=1;break a}var tb=l[Sa];if(tb<<24>>24==45){var pb=(g<<1)+Ja|0,fb=-1}else{pb=tb<<24>>24==43?(g<<1)+Ja|0:Sa,fb=1}for(var Xa=pb,Ab=0,rb=0;;){if(Xa>>>0>=h>>>0){var cb=Xa,Cb=Ab,Zb=rb,dc=fb;break b}var kb=t[Xa];if(((kb&255)-48|0)>>>0>=10){cb=Xa;Cb=Ab;Zb=rb;dc=fb;break b}var Oa=(rb|0)<1e4?(kb<<24>>24)+(rb*10-48)|0:1e4,Xa=Xa+g|0,Ab=1,rb=Oa}}else{cb=Ja,Cb=1,Zb=0,dc=1}}while(0);if((ka|0)==0|(Cb|0)==0){N=cb,Q=ka,P=Cb,L=Zb,I=S,X=ib,Y=Wa,da=dc}else{for(var Db=cb;;){if(Db>>>0>=h>>>0){N=Db;Q=ka;P=Cb;L=Zb;I=S;X=ib;Y=Wa;da=dc;break a}if((l[R.e+(t[Db]&255)|0]&1)<<24>>24==0){N=Db;Q=ka;P=Cb;L=Zb;I=S;X=ib;Y=Wa;da=dc;break a}Db=Db+g|0}}}else{N=Ja,Q=ka,P=1,L=0,I=S,X=ib,Y=Wa,da=1}}}while(0);var Wb=L*da+Y|0,Nb=(Wb|0)<0,$b=Nb?-Wb|0:Wb,Rb=X==0&&I==0;do{if(Rb){var Ra=(o|0)<0?(Q|0)!=0?0:0:0}else{var Ob=(Wb>>31|1)>0;a:do{if(Ob){if(((I|0)<214748364||(I|0)==214748364&&X>>>0<3435973836)&($b|0)>0){for(var Ua=I,Jb=X,Vb=$b;;){var Pb=Vb-1|0,sb=(T.multiply(Jb,Ua,10,0),T.result[0]),db=T.result[1];if(!(((db|0)<214748364||(db|0)==214748364&&sb>>>0<3435973836)&(Pb|0)>0)){wb=Pb;ob=db;Kb=sb;break a}Ua=db;Jb=sb;Vb=Pb}}else{var wb=$b,ob=I,Kb=X}}else{var ub=(T.k(X,I,10,0),T.result[0]),Xb=T.result[1];if((ub==0&&Xb==0)&($b|0)>0){for(var Sb=I,Qb=X,ac=$b;;){var Gb=ac-1|0,xb=(T.j(Qb,Sb,10,0),T.result[0]),Ta=T.result[1],qb=(T.k(xb,Ta,10,0),T.result[0]),bc=T.result[1];if(!((qb==0&&bc==0)&(Gb|0)>0)){wb=Gb;ob=Ta;Kb=xb;break a}Sb=Ta;Qb=xb;ac=Gb}}else{wb=$b,ob=I,Kb=X}}}while(0);var $a=(o|0)<0,mb=(T.b(0,0,Kb,ob),T.result[0]),Bb=T.result[1],bb=$a?mb:Kb,jb=$a?Bb:ob;if((wb|0)==0){Ra=bb+jb*4294967296}else{if((wb-308|0)>>>0<34){var nb=(wb%308|0)==0;a:do{if(nb){var zb=1}else{for(var Tb=wb,ec=1;;){var Hb=ec*10,Eb=Tb-1|0;if((Eb%308|0)==0){zb=Hb;break a}Tb=Eb;ec=Hb}}}while(0);var Lb=bb+jb*4294967296,Ra=Nb?Lb/zb/1e+308:Lb*zb*1e+308}else{if((wb|0)>341){Ra=Nb?0:(bb+jb*4294967296)*Infinity}else{var gb=(wb%22|0)==0;a:do{if(gb){var Mb=wb,vc=1}else{for(var hc=wb,kc=1;;){var pc=kc*10,jc=hc-1|0;if((jc%22|0)==0){Mb=jc;vc=pc;break a}hc=jc;kc=pc}}}while(0);var mc=(Mb|0)>0;a:do{if(mc){for(var Fb=Mb,Ub=vc;;){var Ya=Ub*1e+22,Pa=Fb-22|0;if((Pa|0)<=0){var yb=Ya;break a}Fb=Pa;Ub=Ya}}else{yb=vc}}while(0);var Ka=bb+jb*4294967296,Ra=Nb?Ka/yb:Ka*yb}}}}}while(0);xd[0]=Ra;p[c>>2]=C[0];p[c+4>>2]=C[1];j=(N>>>0>=h>>>0&(Q|0)>0?(P|0)!=0:0)&1}return j}Ek.X=1;function un(b,c){var d=(c|0)>-1?b+c|0:-1,e=t[b],f=e<<24>>24!=0&d>>>0>b>>>0;a:do{if(f){for(var g=0,h=b,i=e;;){var h=h+1|0,j=t[h],i=(i&255)>191&(j&-64)<<24>>24==-128;b:do{if(i){for(var k=h;;){var k=k+1|0,m=l[k];if((m&-64)<<24>>24!=-128){var o=k,r=m;break b}}}else{o=h,r=j}}while(0);g=g+1|0;if(!(r<<24>>24!=0&o>>>0<d>>>0)){var q=g;break a}h=o;i=r}}else{q=0}}while(0);return q}function xu(b,c){var d=b+1|0,e=t[b],f=e&255,e=(e&255)>191;do{if(e){var g=t[R.Ga+(f-192)|0]&255,h=t[d]&255,i=(h&192|0)==128;a:do{if(i){for(var j=g,k=d,m=h;;){if(k=k+1|0,j=m&63|j<<6,m=t[k]&255,(m&192|0)!=128){var o=j,r=k;break a}}}else{o=g,r=d}}while(0);o>>>0<128|(o&-2048|0)==55296|(o&-2|0)==65534?(g=r,h=65533):(g=r,h=o)}else{g=d,h=f}}while(0);p[c>>2]=g;return h}function bu(b,c){var d=a;a+=12;var e=d+4,f=d+8,g=(yu(b,(z=a,a+=40,p[z>>2]=2,p[z+4>>2]=0,p[z+8>>2]=24,p[z+12>>2]=58,p[z+16>>2]=d,p[z+20>>2]=2,p[z+24>>2]=0,p[z+28>>2]=59,p[z+32>>2]=0,p[z+36>>2]=e,z))|0)==2;a:do{if(g){var h=b+5|0,i=l[h]<<24>>24==58;do{if(i){if((yu(b+6|0,(z=a,a+=20,p[z>>2]=2,p[z+4>>2]=0,p[z+8>>2]=59,p[z+12>>2]=0,p[z+16>>2]=f,z))|0)!=1){h=1;break a}var j=b+8|0;if(l[j]<<24>>24!=46){var k=0}else{var m=b+9|0,o=t[m];if(((o&255)-48|0)>>>0<10){j=0;for(k=1;;){var r=(o<<24>>24)+j*10-48,q=k*10,s=m+1|0,o=t[s];if(((o&255)-48|0)>>>0>=10){break}j=r;k=q;m=s}j=s;k=r/q}else{k=0}}}else{p[f>>2]=0,j=h,k=0}}while(0);l[c+42|0]=0;l[c+41|0]=1;p[c+20>>2]=p[d>>2];p[c+24>>2]=p[e>>2];h=c+32|0;xd[0]=(p[f>>2]|0)+k;p[h>>2]=C[0];p[h+4>>2]=C[1];(zu(j,c)|0)!=0?h=1:(l[c+43|0]=(p[c+28>>2]|0)!=0&1,h=0)}else{h=1}}while(0);a=d;return h}bu.X=1;function yu(b){var c,d=a;a+=4;c=d>>2;p[c]=arguments[yu.length];var e=b,f=0;a:for(;;){var g=p[c],h=g,i=g+4|0;p[c]=i;var h=p[h>>2],j=g+8|0;p[c]=j;var i=p[i>>2],k=g+12|0;p[c]=k;var j=p[j>>2],m=g+16|0;p[c]=m;k=p[k>>2];p[c]=g+20|0;g=p[m>>2];for(m=0;;){if((h|0)==0){break}var o=t[e];if(((o&255)-48|0)>>>0>=10){var r=f;break a}m=(o<<24>>24)+(m*10-48)|0;e=e+1|0;h=h-1|0}if((m|0)<(i|0)|(m|0)>(j|0)){r=f;break}if((k|0)==0){p[g>>2]=m;r=f+1|0;break}if((k|0)!=(l[e]<<24>>24|0)){r=f;break}p[g>>2]=m;e=e+1|0;f=f+1|0}a=d;return r}yu.X=1;function zu(b,c){var d=a;a+=8;var e,f=d+4,g=(l[R.e+(t[b]&255)|0]&1)<<24>>24==0;a:do{if(g){var h=b}else{for(e=b;;){if(e=e+1|0,(l[R.e+(t[e]&255)|0]&1)<<24>>24==0){h=e;break a}}}}while(0);g=c+28|0;p[g>>2]=0;e=l[h];if(e<<24>>24==45){var i=-1;e=7}else{if(e<<24>>24==43){i=1,e=7}else{if(e<<24>>24==122||e<<24>>24==90){var j=h+1|0;e=9}else{var k=e<<24>>24!=0&1;e=12}}}e==7&&((yu(h+1|0,(z=a,a+=40,p[z>>2]=2,p[z+4>>2]=0,p[z+8>>2]=14,p[z+12>>2]=58,p[z+16>>2]=d,p[z+20>>2]=2,p[z+24>>2]=0,p[z+28>>2]=59,p[z+32>>2]=0,p[z+36>>2]=f,z))|0)!=2?(k=1,e=12):(p[g>>2]=(p[d>>2]*60+p[f>>2])*i|0,j=h+6|0,e=9));if(e==9){f=t[j];h=(l[R.e+(f&255)|0]&1)<<24>>24==0;a:do{if(h){var m=f}else{for(i=j;;){if(i=i+1|0,k=t[i],(l[R.e+(k&255)|0]&1)<<24>>24==0){m=k;break a}}}}while(0);k=m<<24>>24!=0&1}a=d;return k}zu.X=1;function au(b,c){var d=a;a+=12;var e=d+4,f=d+8,g=l[b]<<24>>24==45,h=g?b+1|0:b,i=(yu(h,(z=a,a+=60,p[z>>2]=4,p[z+4>>2]=0,p[z+8>>2]=9999,p[z+12>>2]=45,p[z+16>>2]=d,p[z+20>>2]=2,p[z+24>>2]=1,p[z+28>>2]=12,p[z+32>>2]=45,p[z+36>>2]=e,p[z+40>>2]=2,p[z+44>>2]=1,p[z+48>>2]=31,p[z+52>>2]=0,p[z+56>>2]=f,z))|0)==3;do{if(i){var j=h+10|0,k=t[j],k=k<<24>>24==84|(l[R.e+(k&255)|0]&1)<<24>>24!=0;a:do{if(k){for(var m=j;;){var m=m+1|0,o=t[m];if(!(o<<24>>24==84|(l[R.e+(o&255)|0]&1)<<24>>24!=0)){var r=m;break a}}}else{r=j}}while(0);if((bu(r,c)|0)!=0){if(l[r]<<24>>24!=0){j=1;break}l[c+41|0]=0}l[c+42|0]=0;l[c+40|0]=1;j=p[d>>2];p[c+8>>2]=g?-j|0:j;p[c+12>>2]=p[e>>2];p[c+16>>2]=p[f>>2];l[c+43|0]<<24>>24!=0&&Yt(c);j=0}else{j=1}}while(0);a=d;return j}au.X=1;function zl(b,c){var d=a;a+=8;var e;if((p[b>>2]|0)>1){if(e=p[b+72>>2],(e|0)==0){e=4}else{var f=Gd[e](b,c);e=5}}else{e=4}if(e==4){var f=Gd[p[b+64>>2]](b,d),g=(C[0]=p[d>>2],C[1]=p[d+4>>2],xd[0])*864e5;e=g>>>0;g=Math.min(Math.floor(g/4294967296),4294967295);p[c>>2]=e;p[c+4>>2]=g}a=d;return f}function Ot(b,c,d){var e,f=p[b>>2],g=p[b+4>>2],h=(d|0)>-1||(d|0)==-1&&c>>>0>4294967295;do{if(h){e=(g|0)>0||(g|0)==0&&f>>>0>0;var i=(T.b(-1,2147483647,f,g),T.result[0]),j=T.result[1];if(e&((j|0)<(d|0)||(j|0)==(d|0)&&i>>>0<c>>>0)){var k=1;e=6;break}}else{if(!((g|0)<0||(g|0)==0&&f>>>0<0)){e=5;break}e=(T.b(1,-2147483648,f,g),T.result[0]);var i=T.result[1],j=(T.add(c,d,1,0),T.result[0]),m=T.result[1];if((i|0)>(m|0)||(i|0)==(m|0)&&e>>>0>j>>>0){k=1;e=6;break}}e=5}while(0);e==5&&(c=(T.add(f,g,c,d),T.result[0]),d=T.result[1],p[b>>2]=c,p[b+4>>2]=d,k=0);return k}function Au(b,c,d,e){var f,g,h=a;a+=8;var i;g=h>>2;var j=h+4;f=j>>2;p[g]=b;p[f]=c;var b=t[d+2|0]&255,c=t[d|0]&255,k=t[d+1|0]&255,m=l[d+3|0]<<24>>24==0,o=0;a:for(;;){for(;;){var r=xu(p[g],h);if((r|0)==0){var q=l[p[f]]<<24>>24==0&1;i=61;break a}do{if(!o){if((r|0)==(c|0)){i=6;break a}if((r|0)==(k|0)){if((xu(p[f],j)|0)==0){q=0;i=61;break a}o=0;continue a}}}while(0);if((r|0)==(b|0)){r=xu(p[f],j);if((r|0)==0){q=0;i=61;break a}var s=xu(p[g],h);if((s|0)==94){var u=xu(p[g],h),s=1}else{u=s,s=0}if((u|0)==93){var w=(r|0)==93&1,u=xu(p[g],h)}else{w=0}var v=(u|0)==0,x=(u|0)!=93&(v^1);b:do{if(x){for(var A=w,E=u,J=0;;){if((E|0)==45){i=p[g];var M=l[i];if(M<<24>>24==93||M<<24>>24==0){i=50}else{if((J|0)==0){i=50}else{i=xu(i,h);var D=0,K=r>>>0<J>>>0|r>>>0>i>>>0?A:1;i=51}}}else{i=50}i==50&&(K=(r|0)==(E|0)?1:A,D=E);E=xu(p[g],h);A=(E|0)==0;if(!((E|0)!=93&(A^1))){var H=K,N=A;break b}A=K;J=D}}else{H=w,N=v}}while(0);if(N|(H|0)==(s|0)){q=0;i=61;break a}}else{if(!((r|0)!=(e|0)|o)){o=1;continue a}o=xu(p[f],j);m||(r=r>>>0>127?r:t[R.i+r|0]&255,o>>>0>127||(o=R.i+o|0,o=t[o]&255));if((r|0)==(o|0)){o=0;continue a}q=0;i=61;break a}}}a:do{if(i==6){for(;;){var Q=xu(p[g],h),D=(Q|0)==(k|0);if((Q|0)==(c|0)){if(!D){continue}}else{if(!D){break}}if((xu(p[f],j)|0)==0){q=0;break a}}if((Q|0)==0){q=1}else{D=(Q|0)==(e|0);do{if(!D){if((Q|0)!=(b|0)){H=Q;break}g=p[g]-1|0;j=p[f];b:for(;;){if(l[j]<<24>>24==0){var P=0;break}Q=Au(g,j,d,e);q=y[f];if((Q|0)!=0){P=l[q]<<24>>24!=0;break}Q=q+1|0;p[f]=Q;if((t[q]&255)>191){if((l[Q]&-64)<<24>>24!=-128){j=Q}else{for(q=Q;;){if(q=q+1|0,p[f]=q,(l[q]&-64)<<24>>24!=-128){j=q;continue b}}}}else{j=Q}}q=P&1;break a}H=xu(p[g],h);if((H|0)==0){q=0;break a}}while(0);for(D=p[g];;){N=xu(p[f],j);if((N|0)==0){q=0;break a}b:do{if(m){if((N|0)==(H|0)){var L=H;i=36}else{for(;;){if(K=xu(p[f],j),(K|0)==0|(K|0)==(H|0)){var I=H,X=K;i=35;break b}}}}else{if(o=N>>>0>127?N:t[R.i+N|0]&255,K=H>>>0>127?H:t[R.i+H|0]&255,(o|0)==0|(o|0)==(K|0)){I=K,X=o,i=35}else{for(;;){if(o=xu(p[f],j),o=o>>>0>127?o:t[R.i+o|0]&255,(o|0)==0|(o|0)==(K|0)){I=K;X=o;i=35;break b}}}}}while(0);if(i==35){if((X|0)==0){q=0;break a}L=I}if((Au(D,p[f],d,e)|0)!=0){q=1;break a}H=L}}}}while(0);a=h;return q}Au.X=1;function uh(b,c,d){var e,f,g=b+26|0,h=b+24|0,i=(l[h]|l[g])<<24>>24==0;do{if(i){var j=(d|0)<0?ve(c):d;if(!((j|0)==0|(c|0)==0)){f=(b+12|0)>>2;var k=p[f],m=b+16|0;e=p[m>>2];if((k+j|0)<(e|0)){e=k}else{var o=l[b+25|0];if(o<<24>>24==0){l[g]=1;j=e-k-1|0;if((j|0)<1){break}e=k}else{e=(b+8|0)>>2;var r=p[e],r=(r|0)==(p[b+4>>2]|0)?0:r,q=j+1|0,k=(T.add(k,(k|0)<0?-1:0,q,(q|0)<0?-1:0),T.result[0]),q=T.result[1],s=p[b+20>>2],u=(s|0)<0?-1:0;if((q|0)>(u|0)||(q|0)==(u|0)&&k>>>0>s>>>0){Bu(b);l[g]=1;break}p[m>>2]=k;m=o<<24>>24==1?Il(p[b>>2],r,k):dh(r,k);if((m|0)==0){l[h]=1;Bu(b);break}(r|0)==0&&(o=p[f],(o|0)>0&&Ah(m,p[e],o));p[e]=m;e=p[f]}}Ah(p[b+8>>2]+e|0,c,j);p[f]=p[f]+j|0}}}while(0)}uh.X=1;function Bu(b){var c=b+8|0,d=p[c>>2];(d|0)!=(p[b+4>>2]|0)&&(l[b+25|0]<<24>>24==1?vf(p[b>>2],d):Lg(d));p[c>>2]=0}function It(b,c,d){var e=p[rl(b)+72>>2],f=(e|0)<0?-1:0;(f|0)<(d|0)||(f|0)==(d|0)&&e>>>0<c>>>0?(Uk(b),b=0):(c=bh(c),(c|0)!=0?b=c:(pl(b),b=0));return b}function Cu(b,c,d){var e,f,g=a;a+=80;var h=g+40,i=Vc[b+28>>1],j=i&65535,k=Vc[c+28>>1],m=k&65535,o=(k|i)&65535,r=(o&1|0)==0;a:do{if(r){if((o&12|0)==0){i=(o&2|0)==0;do{if(!i){if((j&2|0)==0){var q=1;break a}if((m&2|0)==0){q=-1;break a}if((d|0)!=0){j=d+4|0;if(l[b+31|0]<<24>>24==l[j]<<24>>24){q=Gd[p[d+12>>2]](p[d+8>>2],p[b+24>>2],p[b+4>>2],p[c+24>>2],p[c+4>>2]);break a}m=g>>2;for(i=m+10;m<i;m++){p[m]=0}m=h>>2;for(i=m+10;m<i;m++){p[m]=0}Du(g,b,4096);Du(h,c,4096);b=zk(g,l[j]);c=(b|0)==0?0:p[g+24>>2];j=zk(h,l[j]);d=Gd[p[d+12>>2]](p[d+8>>2],c,b,(j|0)==0?0:p[h+24>>2],j);tk(g);tk(h);q=d;break a}}}while(0);h=p[b+24>>2];d=p[c+24>>2];b=jm(p[b+4>>2],p[c+4>>2],(h|0)>(d|0)?d:h);h=(b|0)==0?h-d|0:b;a=g;return h}else{if((j&12|0)==0){q=1}else{if((m&12|0)==0){q=-1}else{if((i&4&k)<<16>>16==0){(j&8|0)==0?(q=b+16|0,f=q|0,f>>=2,e=q+4|0,e>>=2,q=p[f]+p[e]*4294967296):(q=b+8|0,q=(C[0]=p[q>>2],C[1]=p[q+4>>2],xd[0])),(m&8|0)==0?(e=c+16|0,f=e|0,f>>=2,e=e+4|0,e>>=2,f=p[f]+p[e]*4294967296):(f=c+8|0,f=(C[0]=p[f>>2],C[1]=p[f+4>>2],xd[0])),q=q<f?-1:q>f&1}else{e=b+16|0;f=e|0;f>>=2;q=p[f];e=e+4|0;e>>=2;f=p[e];var s=c+16|0;e=p[s>>2];s=p[s+4>>2];q=(f|0)<(s|0)||(f|0)==(s|0)&&q>>>0<e>>>0?-1:((f|0)>(s|0)||(f|0)==(s|0)&&q>>>0>e>>>0)&1}}}}}else{q=(m&1)-(j&1)|0}}while(0);a=g;return q}Cu.X=1;function Du(b,c,d){var e;e=(b+28|0)>>1;(n[e]&9312)<<16>>16!=0&&uk(b);Ah(b,c,36);p[b+32>>2]=0;(n[c+28>>1]&2048)<<16>>16==0&&(n[e]=(n[e]&58367|d)&65535)}function Cn(b,c,d,e,f){var g,h=a;a+=12;var i;g=b>>2;(p[g]|0)<0&&(p[g]=0,p[b+4>>2]=-1,n[b+12>>1]=0,l[b+14|0]=0);p[h>>2]=d;p[h+4>>2]=e;d=b+8|0;p[d>>2]=f;f=c&255;e=(c|0)==253;a:do{if(e){if(i=Eu(b,f),(i|0)<630){var j=i;i=8}else{(i|0)<959?(Fu(b,i-630|0),i=12):i=10}}else{for(;;){var k=Eu(b,f);if((k|0)<630){j=k;i=8;break a}if((k|0)>=959){i=10;break a}Fu(b,k-630|0);if((p[g]|0)<=-1){i=12;break a}}}}while(0);i==8?(Gu(b,j,c,h),b=b+4|0,p[b>>2]=p[b>>2]-1|0):i==10&&(g=a,j=h>>2,c=a,a+=12,p[c>>2]=p[j],p[c+4>>2]=p[j+1],p[c+8>>2]=p[j+2],b=b+8|0,j=p[b>>2],ym(j,R.lb|0,(z=a,a+=4,p[z>>2]=c,z)),p[b>>2]=j,a=g,Hu(p[d>>2],f,h));a=h}Cn.X=1;function En(b,c,d){var e=a;a+=4;p[e>>2]=arguments[En.length];var f=ji(c,d,p[e>>2]);vf(c,p[b>>2]);p[b>>2]=f;a=e}function Eu(b,c){var d,e=Vc[b+(p[b>>2]<<4)+12>>1],f=e&65535,e=(e&65535)>418;a:do{if(e){d=4}else{var g=n[Iu+(f<<1)>>1];d=g<<16>>16;for(var g=g<<16>>16==-74,h=c;;){if(g){d=4;break a}var i=h&255,j=d+i|0,k=j>>>0>1556;do{if(!k&&l[R.Ac+j|0]<<24>>24==h<<24>>24){var m=(j<<1)+Ju|0;d=15;break a}}while(0);if(h<<24>>24==0){break}if((h&255)<67&&(h=t[R.rr+i|0],h<<24>>24!=0)){continue}m=d+67|0;if((m|0)<=-1){break}if(l[R.Ac+m|0]<<24>>24!=67){break}m=(m<<1)+Ju|0;d=15;break a}m=(f<<1)+Ku|0;d=15}}while(0);d==4&&(m=(f<<1)+Ku|0);return Vc[m>>1]&65535}function jk(b){if((b|0)!=0){var c=b|0,d=p[c>>2],e=b+60|0,f=p[e>>2],g=b+64|0,h=p[g>>2];(f|0)==0?p[(d+136|0)>>2]=h:p[(f+64|0)>>2]=h;f=p[g>>2];(f|0)!=0&&(p[(f+60|0)>>2]=p[e>>2]);p[b+52>>2]=-1241070648;p[c>>2]=0;tf(d,b)}}function ji(b,c,d){var e=a;a+=100;var f=e+72;Zg(f,e|0,70,p[b+72>>2]);p[f>>2]=b;sh(f,1,c,d);c=th(f);l[f+24|0]<<24>>24!=0&&(l[b+30|0]=1);a=e;return c}function Dn(b){var c;c=(b|0)>>2;var d=p[c];(d|0)<0||(Hu(p[b+8>>2],l[(d<<4)+b+14|0],(d<<4)+b+16|0),p[c]=p[c]-1|0)}function Hu(b,c,d){d>>=2;b>>=2;c&=255;(c|0)==160||(c|0)==194?Zf(p[b],p[d]):(c|0)==174||(c|0)==175?Df(p[b],p[d]):(c|0)==179||(c|0)==187||(c|0)==197||(c|0)==200||(c|0)==202||(c|0)==204||(c|0)==214||(c|0)==216||(c|0)==217||(c|0)==220||(c|0)==221||(c|0)==226?Lu(p[b],p[d]):(c|0)==193||(c|0)==198||(c|0)==206||(c|0)==207?Mu(p[b],p[d]):(c|0)==199||(c|0)==201||(c|0)==210||(c|0)==215||(c|0)==225||(c|0)==227||(c|0)==238||(c|0)==243?Df(p[b],p[d]):(c|0)==211||(c|0)==213||(c|0)==219?Ef(p[b],p[d]):(c|0)==234||(c|0)==239?uf(p[b],p[d]):(c|0)==236&&Ef(p[b],p[d+1])}Hu.X=1;function Zf(b,c){(c|0)!=0&&(Nu(b,c),vf(b,c))}function Df(b,c){var d;if((c|0)!=0){d=(c+2|0)>>1;var e=n[d];if((e&16384)<<16>>16==0){Df(b,p[c+8>>2]);Df(b,p[c+12>>2]);e=n[d];(e&8192)<<16>>16==0&&(l[c+34|0]&1)<<24>>24!=0&&(vf(b,p[c+4>>2]),e=n[d]);var f=c+16|0;(e&2048)<<16>>16==0?Lu(b,p[f>>2]):Zf(b,p[f>>2]);d=n[d]}else{d=e}d<<16>>16<0||vf(b,c|0)}}function Lu(b,c){var d;if((c|0)!=0){var e=c+12|0,f=c|0,g=(p[f>>2]|0)>0;a:do{if(g){var h=0,i=p[e>>2];for(d=i>>2;;){Df(b,p[d]);vf(b,p[d+1]);vf(b,p[d+2]);d=h+1|0;if((d|0)>=(p[f>>2]|0)){break a}h=d;i=i+20|0;d=i>>2}}}while(0);vf(b,p[e>>2]);vf(b,c)}}function Mu(b,c){var d;if((c|0)!=0){var e=c|0,f=n[e>>1]<<16>>16>0;a:do{if(f){var g=0,h=c+4|0;for(d=h>>2;;){vf(b,p[d]);vf(b,p[d+1]);vf(b,p[d+2]);vf(b,p[d+13]);rf(b,p[d+3]);Zf(b,p[d+4]);Df(b,p[d+9]);Ef(b,p[d+10]);d=g+1|0;if((d|0)>=(n[e>>1]<<16>>16|0)){break a}g=d;h=h+60|0;d=h>>2}}}while(0);vf(b,c)}}function Ef(b,c){if((c|0)!=0){var d=c+4|0,e=(p[d>>2]|0)>0,f=c|0,g=p[f>>2];a:do{if(e){for(var h=0,i=g;;){if(vf(b,p[i+(h<<3)>>2]),h=h+1|0,i=p[f>>2],(h|0)>=(p[d>>2]|0)){var j=i;break a}}}else{j=g}}while(0);vf(b,j);vf(b,c)}}function uf(b,c){var d,e=(c|0)==0;a:do{if(!e){var f=c;for(d=f>>2;;){var g=p[d+8];Df(b,p[d+5]);Lu(b,p[d+6]);Zf(b,p[d+2]);Ef(b,p[d+7]);vf(b,f|0);if((g|0)==0){break a}f=g;d=f>>2}}}while(0)}function Nu(b,c){var d=c>>2;Lu(b,p[d]);Mu(b,p[d+2]);Df(b,p[d+3]);Lu(b,p[d+4]);Df(b,p[d+5]);Lu(b,p[d+6]);Zf(b,p[d+7]);Df(b,p[d+10]);Df(b,p[d+11])}function Gu(b,c,d,e){var f=b|0,g=p[f>>2]+1|0;p[f>>2]=g;if((g|0)>99){c=b+8|0;d=p[c>>2];e=(b|0)>>2;f=p[e];p[e]=f-1|0;f=(f|0)>0;a:do{if(f){for(;;){if(Dn(b),(p[e]|0)<=-1){break a}}}}while(0);ym(d,R.Bk|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));p[c>>2]=d}else{n[b+(g<<4)+12>>1]=c&65535,l[(g<<4)+b+14|0]=d&255,b=((g<<4)+b+16|0)>>2,e>>=2,p[b]=p[e],p[b+1]=p[e+1],p[b+2]=p[e+2]}}function Fu(b,c){var d,e,f,g,h,i,j,k,m,o,r,q,s,u,w,v,x,A,E,J,M,D,K=a;a+=60;D=K>>2;var H=K+12;M=H>>2;var N=K+24,Q=K+36,P=K+52,L=y[b+8>>2];J=L>>2;E=(b|0)>>2;var I=y[E];A=K>>2;p[A]=p[Ou>>2];p[A+1]=p[Ou+4>>2];p[A+2]=p[Ou+8>>2];a:do{if((c|0)==5){Pu(L,0)}else{if((c|0)==6){Pu(L,1)}else{if((c|0)==7){Pu(L,2)}else{if((c|0)==8){Qu(L)}else{if((c|0)==9){var X=L,Y=p[b+(I-1<<4)+16>>2],da=p[X>>2],ga=(Ru(X,22,R.gc|0,0,0)|0)==0;do{if(ga){var ha=Su(X);if((ha|0)!=0){var ba=(Y|0)==7;b:do{if(!ba){var ea=da+4|0;if((p[ea>>2]|0)>0){for(var ja=(Y|0)==9?2:1,ra=0;;){V(ha,35,ra,ja);vm(ha,ra);var Va=ra+1|0;if((Va|0)>=(p[ea>>2]|0)){break b}ra=Va}}}}while(0);V(ha,34,0,0)}}}while(0)}else{if((c|0)==13){p[D]=7}else{if((c|0)==14||(c|0)==15||(c|0)==16||(c|0)==115||(c|0)==117){p[D]=t[(I<<4)+b+14|0]&255}else{if((c|0)==17||(c|0)==18){var ta=L;if((Ru(ta,22,R.Ak|0,0,0)|0)==0){var xa=Su(ta);(xa|0)!=0&&V(xa,34,1,0)}}else{if((c|0)==19){var Fa=L;if((Ru(Fa,22,R.hc|0,0,0)|0)==0){var Na=Su(Fa);(Na|0)!=0&&V(Na,34,1,1)}}else{if((c|0)==22){Tu(L,0,(I<<4)+b+16|0)}else{if((c|0)==23){Tu(L,1,(I<<4)+b+16|0)}else{if((c|0)==24){Tu(L,2,(I<<4)+b+16|0)}else{if((c|0)==26){Uu(L,(I-1<<4)+b+16|0,(I<<4)+b+16|0,p[b+(I-4<<4)+16>>2],0,0,p[b+(I-2<<4)+16>>2])}else{if((c|0)==27){l[p[J]+234|0]=0;var Ea=(I<<4)+b+16|0,La=K,za=Ea|0;x=za>>2;var Ba=p[x],Ja=Ea+4|0;v=Ja>>2;var ka=p[v];p[La>>2]=Ba;p[La+4>>2]=ka}else{if((c|0)==28||(c|0)==31||(c|0)==70||(c|0)==83||(c|0)==85||(c|0)==87||(c|0)==98||(c|0)==109||(c|0)==120||(c|0)==121||(c|0)==222||(c|0)==225){p[D]=0}else{if((c|0)==29||(c|0)==30||(c|0)==71||(c|0)==86||(c|0)==108||(c|0)==119||(c|0)==223||(c|0)==226){p[D]=1}else{if((c|0)==32){Vu(L,(I-1<<4)+b+16|0,(I<<4)+b+16|0,0)}else{if((c|0)==33){var S=(I<<4)+b+16|0;Vu(L,0,0,p[S>>2]);Zf(p[J],p[S>>2])}else{if((c|0)==36){var ib=p[b+(I-2<<4)+16>>2];p[D]=ib;p[D+1]=p[J+124]+p[J+123]-ib|0}else{if((c|0)==37){var Wa=(I<<4)+b+16|0;Wu(L,Wa);var Za=Wa,Sa=K,tb=p[Za+4>>2];p[Sa>>2]=p[Za>>2];p[Sa+4>>2]=tb}else{if((c|0)==38||(c|0)==39||(c|0)==40||(c|0)==41||(c|0)==42||(c|0)==43||(c|0)==46||(c|0)==49||(c|0)==127||(c|0)==128||(c|0)==138||(c|0)==147||(c|0)==251||(c|0)==260||(c|0)==261||(c|0)==262||(c|0)==263||(c|0)==264||(c|0)==265||(c|0)==266||(c|0)==267||(c|0)==285){var pb=(I<<4)+b+16|0,fb=K,Xa=pb|0;w=Xa>>2;var Ab=p[w],rb=pb+4|0;u=rb>>2;var cb=p[u],za=fb|0;x=za>>2;p[x]=Ab;Ja=fb+4|0;v=Ja>>2;p[v]=cb}else{if((c|0)==45){var Cb=p[L+504>>2];if((Cb|0)!=0){var Zb=p[Cb+8>>2];if((Zb|0)>=1){var dc=Zb-1|0,kb=p[Cb+12>>2],Oa=Xu(p[L>>2],(I<<4)+b+16|0);p[(kb+dc*24+12|0)>>2]=Oa;l[kb+dc*24+22|0]=Yu(Oa)}}}else{if((c|0)==47){var Db=p[b+(I-3<<4)+16>>2];p[D]=Db;p[D+1]=p[b+(I<<4)+16>>2]+p[b+(I<<4)+20>>2]-Db|0}else{if((c|0)==48){var Wb=p[b+(I-5<<4)+16>>2];p[D]=Wb;p[D+1]=p[b+(I<<4)+16>>2]+p[b+(I<<4)+20>>2]-Wb|0}else{if((c|0)==50){var Nb=p[b+(I-1<<4)+16>>2];p[D]=Nb;p[D+1]=p[b+(I<<4)+16>>2]+p[b+(I<<4)+20>>2]-Nb|0}else{if((c|0)==57||(c|0)==59){Zu(L,(I<<4)+b+16|0)}else{if((c|0)==58){Zu(L,(I-1<<4)+b+16|0)}else{if((c|0)==60){var $b=$u(L,156,p[b+(I<<4)+16>>2],0,0);p[M]=$b;p[M+1]=p[b+(I-1<<4)+16>>2];p[M+2]=p[b+(I<<4)+24>>2];Zu(L,H)}else{if((c|0)==61){av(N,L,94,(I<<4)+b+16|0),Zu(L,N)}else{if((c|0)==63){var Rb=p[J+126];if((Rb|0)!=0){var Ra=p[Rb+8>>2];(Ra|0)<1||(l[p[Rb+12>>2]+(Ra-1)*24+20|0]=p[b+(I<<4)+16>>2]&255)}}else{if((c|0)==64){bv(L,0,p[b+(I-1<<4)+16>>2],p[b+(I<<4)+16>>2],p[b+(I-2<<4)+16>>2])}else{if((c|0)==65){cv(L,0,0,0,0,p[b+(I<<4)+16>>2],0,0,0,0)}else{if((c|0)==66){dv(L,p[b+(I-1<<4)+16>>2])}else{if((c|0)==67){ev(L,0,(I-2<<4)+b+16|0,p[b+(I-1<<4)+16>>2],p[b+(I<<4)+16>>2])}else{if((c|0)==68){fv(p[J+126],p[b+(I<<4)+16>>2])}else{if((c|0)==69){var Ob=L,Ua=(I<<4)+b+16|0,Jb=fa,Vb=p[Ob+504>>2],Pb=(Vb|0)==0;b:do{if(!Pb){var sb=p[Vb+8>>2]-1|0,db=p[Ob>>2],wb=Xu(db,Ua);if((wb|0)!=0){if((gv(Ob,wb)|0)==0){vf(db,wb)}else{var ob=Vb+12|0;p[(p[ob>>2]+sb*24+16|0)>>2]=wb;var Kb=p[Vb+16>>2];if((Kb|0)!=0){for(var ub=Kb,Jb=ub>>2;;){(p[p[Jb+2]>>2]|0)==(sb|0)&&(p[p[Jb+11]>>2]=p[(p[ob>>2]+16>>2)+(sb*6|0)]);var Xb=p[Jb+8];if((Xb|0)==0){break b}ub=Xb;Jb=ub>>2}}}}}}while(0)}else{if((c|0)==72){p[D]=0}else{if((c|0)==73){p[D]=p[b+(I-1<<4)+16>>2]&(p[b+(I<<4)+20>>2]^-1)|p[b+(I<<4)+16>>2]}else{if((c|0)==74||(c|0)==75){p[D]=0,p[D+1]=0}else{if((c|0)==76){p[D]=p[b+(I<<4)+16>>2],p[D+1]=255}else{if((c|0)==77){p[D]=p[b+(I<<4)+16>>2]<<8,p[D+1]=65280}else{if((c|0)==78){p[D]=7}else{if((c|0)==79){p[D]=8}else{if((c|0)==80){p[D]=9}else{if((c|0)==81){p[D]=6}else{if((c|0)==82){p[D]=0}else{if((c|0)==84||(c|0)==99||(c|0)==101||(c|0)==104){p[D]=p[b+(I<<4)+16>>2]}else{if((c|0)==88){p[D+1]=0,p[D]=0}else{if((c|0)==89){var Sb=(I-1<<4)+b+16|0,Qb=K,ac=p[Sb+4>>2];p[Qb>>2]=p[Sb>>2];p[Qb+4>>2]=ac}else{if((c|0)==94){bv(L,p[b+(I-3<<4)+16>>2],p[b+(I<<4)+16>>2],p[b+(I-2<<4)+16>>2],0)}else{if((c|0)==95){cv(L,0,0,0,p[b+(I-2<<4)+16>>2],p[b+(I<<4)+16>>2],0,0,0,0)}else{if((c|0)==96){dv(L,p[b+(I-2<<4)+16>>2])}else{if((c|0)==97){ev(L,p[b+(I-6<<4)+16>>2],(I-3<<4)+b+16|0,p[b+(I-2<<4)+16>>2],p[b+(I-1<<4)+16>>2]),fv(p[J+126],p[b+(I<<4)+16>>2])}else{if((c|0)==100){p[D]=99}else{if((c|0)==102){l[K]=99}else{if((c|0)==103){l[K]=p[b+(I<<4)+16>>2]&255}else{if((c|0)==105){p[D]=4}else{if((c|0)==106){p[D]=5}else{if((c|0)==107){hv(L,p[b+(I<<4)+16>>2],0,p[b+(I-1<<4)+16>>2])}else{if((c|0)==110){iv(L,(I-7<<4)+b+16|0,(I-3<<4)+b+16|0,(I-2<<4)+b+16|0,p[b+(I<<4)+16>>2],p[b+(I-6<<4)+16>>2],p[b+(I-4<<4)+16>>2])}else{if((c|0)==111){hv(L,p[b+(I<<4)+16>>2],1,p[b+(I-1<<4)+16>>2])}else{if((c|0)==112){s=(Q|0)>>2;p[s]=p[jv>>2];p[s+1]=p[jv+4>>2];p[s+2]=p[jv+8>>2];p[s+3]=p[jv+12>>2];var Gb=(I<<4)+b+16|0;kv(L,p[Gb>>2],Q);Zf(p[J],p[Gb>>2])}else{if((c|0)==113){p[D]=p[b+(I<<4)+16>>2]}else{if((c|0)==114){q=((I<<4)+b+16|0)>>2;var xb=p[q];(xb|0)==0?Zf(p[J],p[b+(I-2<<4)+16>>2]):(l[xb+4|0]=p[b+(I-1<<4)+16>>2]&255,p[(p[q]+28|0)>>2]=p[b+(I-2<<4)+16>>2]);p[D]=p[q]}else{if((c|0)==116){p[D]=113}else{if((c|0)==118){var Ta=lv(L,p[b+(I-6<<4)+16>>2],p[b+(I-5<<4)+16>>2],p[b+(I-4<<4)+16>>2],p[b+(I-3<<4)+16>>2],p[b+(I-2<<4)+16>>2],p[b+(I-1<<4)+16>>2],p[b+(I-7<<4)+16>>2],p[b+(I<<4)+16>>2],p[b+(I<<4)+20>>2]);p[D]=Ta}else{if((c|0)==122||(c|0)==247){p[D]=p[b+(I-1<<4)+16>>2]}else{if((c|0)==123||(c|0)==151||(c|0)==159||(c|0)==240||(c|0)==246){p[D]=0}else{if((c|0)==124){var qb=(I-1<<4)+b+16|0,bc=L|0,$a=mv(p[bc>>2],p[b+(I-2<<4)+16>>2],p[qb>>2]);p[D]=$a;if((p[b+(I<<4)+20>>2]|0)==0){var mb=$a}else{var Bb=K;nv(L,$a,(I<<4)+b+16|0,1);mb=p[Bb>>2]}var bb=p[bc>>2],jb=qb;if((mb|0)!=0){var nb=p[mb+12>>2]+(p[mb>>2]-1)*20+8|0;vf(bb,p[nb>>2]);var zb=p[jb+4>>2],Tb=Mm(bb,zb,p[jb+8>>2]-zb|0);p[nb>>2]=Tb}}else{if((c|0)==125){var ec=L|0,Hb=ov(p[ec>>2],113,0),Eb=mv(p[ec>>2],p[b+(I-1<<4)+16>>2],Hb);p[D]=Eb}else{if((c|0)==126){var Lb=$u(L,113,0,0,(I<<4)+b+16|0),gb=$u(L,26,0,0,(I-2<<4)+b+16|0),Mb=$u(L,118,gb,Lb,0),vc=mv(p[J],p[b+(I-3<<4)+16>>2],Mb);p[D]=vc}else{if((c|0)==129){p[D+1]=0}else{if((c|0)==130){var hc=ni(p[J],64);p[D]=hc}else{if((c|0)==131){var kc=p[b+(I<<4)+16>>2];p[D]=kc;pv(kc)}else{if((c|0)==132){var pc=p[b+(I-1<<4)+16>>2];p[D]=pc;if((pc|0)!=0){var jc=n[pc>>1];jc<<16>>16>0&&(l[pc+((jc<<16>>16)-1)*60+32|0]=p[b+(I<<4)+16>>2]&255)}}else{if((c|0)==133){p[D]=0}else{if((c|0)==134){var mc=qv(L,p[b+(I-6<<4)+16>>2],(I-5<<4)+b+16|0,(I-4<<4)+b+16|0,(I-3<<4)+b+16|0,0,p[b+(I-1<<4)+16>>2],p[b+(I<<4)+16>>2]);p[D]=mc;rv(L,mc,(I-2<<4)+b+16|0)}else{if((c|0)==135){var Fb=qv(L,p[b+(I-6<<4)+16>>2],0,0,(I-2<<4)+b+16|0,p[b+(I-4<<4)+16>>2],p[b+(I-1<<4)+16>>2],p[b+(I<<4)+16>>2]);p[D]=Fb}else{if((c|0)==136){var Ub=(I-6<<4)+b+16|0,Ya=(p[Ub>>2]|0)==0,Pa=I-2|0;do{if(Ya&&(p[b+(Pa<<4)+20>>2]|0)==0&&(p[b+(I-1<<4)+16>>2]|0)==0&&(p[b+(I<<4)+16>>2]|0)==0){p[D]=p[b+(I-4<<4)+16>>2];break a}}while(0);var yb=(I-4<<4)+b+16|0;pv(p[yb>>2]);var Ka=lv(L,0,p[yb>>2],0,0,0,0,0,0,0),Ac=qv(L,p[Ub>>2],0,0,(Pa<<4)+b+16|0,Ka,p[b+(I-1<<4)+16>>2],p[b+(I<<4)+16>>2]);p[D]=Ac}else{if((c|0)==137||(c|0)==146){p[D]=0,p[D+1]=0}else{if((c|0)==139){var Jc=sv(p[J],0,(I-1<<4)+b+16|0,(I<<4)+b+16|0);p[D]=Jc}else{if((c|0)==140){p[D]=1}else{if((c|0)==141){var uc=tv(L,(I-1<<4)+b+16|0,0,0);p[D]=uc}else{if((c|0)==142){var Tc=tv(L,(I-2<<4)+b+16|0,(I-1<<4)+b+16|0,0);p[D]=Tc}else{if((c|0)==143){var Yc=tv(L,(I-3<<4)+b+16|0,(I-2<<4)+b+16|0,(I-1<<4)+b+16|0);p[D]=Yc}else{if((c|0)==144||(c|0)==155||(c|0)==162||(c|0)==169||(c|0)==235||(c|0)==237){p[D]=p[b+(I<<4)+16>>2]}else{if((c|0)==145||(c|0)==161||(c|0)==168||(c|0)==236||(c|0)==238){p[D]=0}else{if((c|0)==148){p[D]=0,p[D+1]=1}else{if((c|0)==149||(c|0)==181){p[D]=p[b+(I-1<<4)+16>>2]}else{if((c|0)==150||(c|0)==180){p[D]=0}else{if((c|0)==152||(c|0)==160||(c|0)==239){p[D]=p[b+(I<<4)+16>>2]}else{if((c|0)==153){var ua=mv(p[J],p[b+(I-3<<4)+16>>2],p[b+(I-1<<4)+16>>2]);p[D]=ua;(ua|0)!=0&&(l[p[ua+12>>2]+(p[ua>>2]-1)*20+12|0]=p[b+(I<<4)+16>>2]&255)}else{if((c|0)==154){var md=mv(p[J],0,p[b+(I-1<<4)+16>>2]);p[D]=md;if((md|0)!=0){var nd=p[md+12>>2];(nd|0)!=0&&(l[nd+12|0]=p[b+(I<<4)+16>>2]&255)}}else{if((c|0)==156||(c|0)==158){p[D]=0}else{if((c|0)==157){p[D]=1}else{if((c|0)==163){p[D]=0,p[D+1]=0}else{if((c|0)==164){p[D]=p[b+(I<<4)+16>>2],p[D+1]=0}else{if((c|0)==165){p[D]=p[b+(I-2<<4)+16>>2],p[D+1]=p[b+(I<<4)+16>>2]|0}else{if((c|0)==166){p[D+1]=p[b+(I-2<<4)+16>>2]|0,p[D]=p[b+(I<<4)+16>>2]}else{if((c|0)==167){var Bc=(I-2<<4)+b+16|0;rv(L,p[Bc>>2],(I-1<<4)+b+16|0);uv(L,p[Bc>>2],p[b+(I<<4)+16>>2])}else{if((c|0)==170){var Qc=(I-4<<4)+b+16|0;rv(L,p[Qc>>2],(I-3<<4)+b+16|0);var Oc=(I-1<<4)+b+16|0;vv(L,p[Oc>>2],R.be|0);wv(L,p[Qc>>2],p[Oc>>2],p[b+(I<<4)+16>>2],t[(I-5<<4)+b+16|0]&255)}else{if((c|0)==171){var ed=mv(p[J],p[b+(I-4<<4)+16>>2],p[b+(I<<4)+16>>2]);p[D]=ed;nv(L,ed,(I-2<<4)+b+16|0,1)}else{if((c|0)==172){var Fc=mv(p[J],0,p[b+(I<<4)+16>>2]);p[D]=Fc;nv(L,Fc,(I-2<<4)+b+16|0,1)}else{if((c|0)==173){xv(L,p[b+(I-5<<4)+16>>2],p[b+(I-1<<4)+16>>2],0,p[b+(I-4<<4)+16>>2],t[(I-7<<4)+b+16|0]&255)}else{if((c|0)==174){xv(L,p[b+(I-2<<4)+16>>2],0,p[b+(I<<4)+16>>2],p[b+(I-1<<4)+16>>2],t[(I-4<<4)+b+16|0]&255)}else{if((c|0)==175){xv(L,p[b+(I-3<<4)+16>>2],0,0,p[b+(I-2<<4)+16>>2],t[(I-5<<4)+b+16|0]&255)}else{if((c|0)==176){l[K]=l[(I<<4)+b+16|0]}else{if((c|0)==177){l[K]=5}else{if((c|0)==178||(c|0)==241){var ud=mv(p[J],p[b+(I-2<<4)+16>>2],p[b+(I<<4)+16>>2]);p[D]=ud}else{if((c|0)==179||(c|0)==242){var Rc=mv(p[J],0,p[b+(I<<4)+16>>2]);p[D]=Rc}else{if((c|0)==182){var Yb=yv(p[J],p[b+(I-2<<4)+16>>2],(I<<4)+b+16|0);p[D]=Yb}else{if((c|0)==183){var W=yv(p[J],0,(I<<4)+b+16|0);p[D]=W}else{if((c|0)==184){r=((I<<4)+b+16|0)>>2,p[A]=p[r],p[A+1]=p[r+1],p[A+2]=p[r+2]}else{if((c|0)==185){var bd=K|0;p[D]=p[b+(I-1<<4)+16>>2];zv(bd,p[b+(I-2<<4)+16>>2],(I<<4)+b+16|0)}else{if((c|0)==186||(c|0)==191||(c|0)==192){av(K|0,L,t[(I<<4)+b+14|0]&255,(I<<4)+b+16|0)}else{if((c|0)==187||(c|0)==188){av(K|0,L,26,(I<<4)+b+16|0)}else{if((c|0)==189){var hd=(I-2<<4)+b+16|0,eb=$u(L,26,0,0,hd),Uc=(I<<4)+b+16|0,cd=$u(L,26,0,0,Uc),vd=$u(L,118,eb,cd,0),id=K|0;p[D]=vd;zv(id,p[hd>>2],Uc)}else{if((c|0)==190){var Zc=(I-4<<4)+b+16|0,td=$u(L,26,0,0,Zc),zd=$u(L,26,0,0,(I-2<<4)+b+16|0),Id=(I<<4)+b+16|0,xc=$u(L,26,0,0,Id),qc=$u(L,118,zd,xc,0),Gc=$u(L,118,td,qc,0),Hc=K|0;p[D]=Gc;zv(Hc,p[Zc>>2],Id)}else{if((c|0)==193){var zc=(I<<4)+b+16|0,Kc=zc;if(l[L+18|0]<<24>>24==0){ym(L,R.lb|0,(z=a,a+=4,p[z>>2]=zc,z)),p[D]=0}else{var wd=$u(L,132,0,0,Kc);p[D]=wd;(wd|0)!=0&&No(p[zc>>2]+1|0,wd+24|0)}zv(K|0,p[zc>>2],Kc)}else{if((c|0)==194){var be=K|0,ge=(I<<4)+b+16|0,Xd=ge;av(be,L,133,Xd);Av(L,p[D]);zv(be,p[ge>>2],Xd)}else{if((c|0)==195){var rc=I-2|0,Lc=(I<<4)+b+16|0,Jd=Bv(L,p[b+(rc<<4)+16>>2],Lc);p[D]=Jd;p[D+1]=p[b+(rc<<4)+20>>2];p[D+2]=p[Lc>>2]+p[b+(I<<4)+20>>2]|0}else{if((c|0)==196){var Qd=$u(L,37,p[b+(I-3<<4)+16>>2],0,(I-1<<4)+b+16|0),Fd=K|0;p[D]=Qd;zv(Fd,p[b+(I-5<<4)+16>>2],(I<<4)+b+16|0)}else{if((c|0)==197){var Cd=(I-1<<4)+b+16|0,ce=p[Cd>>2];if((ce|0)==0){var Yd=0}else{if((p[ce>>2]|0)>(p[p[J]+96>>2]|0)){var Mc=(I-4<<4)+b+16|0;ym(L,R.ce|0,(z=a,a+=4,p[z>>2]=Mc,z));Yd=p[Cd>>2]}else{Yd=ce}}var jd=(I-4<<4)+b+16|0,gc=Cv(L,Yd,jd),fd=K|0,Sd=K|0;p[Sd>>2]=gc;zv(fd,p[jd>>2],(I<<4)+b+16|0);if((p[b+(I-2<<4)+16>>2]|0)!=0){var $c=p[Sd>>2];($c|0)!=0&&(n[($c+2|0)>>1]|=16)}}else{if((c|0)==198){var Ad=(I-3<<4)+b+16|0,Xe=Cv(L,0,Ad),ef=K|0;p[D]=Xe;zv(ef,p[Ad>>2],(I<<4)+b+16|0)}else{if((c|0)==199){var oe=(I<<4)+b+16|0,wf=oe,Kd=Cv(L,0,wf),ue=K|0;p[D]=Kd;(Kd|0)!=0&&(l[Kd|0]=-101);zv(ue,p[oe>>2],wf)}else{if((c|0)==200||(c|0)==201||(c|0)==202||(c|0)==203||(c|0)==204||(c|0)==205||(c|0)==206||(c|0)==207){Dv(K|0,L,t[(I-1<<4)+b+14|0]&255,(I-2<<4)+b+16|0,(I<<4)+b+16|0)}else{if((c|0)==208||(c|0)==210){var xf=(I<<4)+b+16|0,Ge=K,Xa=xf|0;w=Xa>>2;var yf=p[w],rb=xf+4|0;u=rb>>2;var Re=p[u],za=Ge|0;x=za>>2;p[x]=yf;Ja=Ge+4|0;v=Ja>>2;p[v]=Re;p[D+2]=0}else{if((c|0)==209||(c|0)==211){var Se=(I<<4)+b+16|0,tc=K,Xa=Se|0;w=Xa>>2;var ff=p[w],rb=Se+4|0;u=rb>>2;var he=p[u],za=tc|0;x=za>>2;p[x]=ff;Ja=tc+4|0;v=Ja>>2;p[v]=he;p[D+2]=1}else{if((c|0)==212){var je=L|0,de=mv(p[je>>2],0,p[b+(I<<4)+16>>2]),Me=I-2|0,od=mv(p[je>>2],de,p[b+(Me<<4)+16>>2]),ke=I-1|0,Zd=Cv(L,od,(ke<<4)+b+16|0),le=K|0;p[le>>2]=Zd;if((p[b+(ke<<4)+24>>2]|0)==0){var ye=Zd}else{var zf=$u(L,19,Zd,0,0),ye=p[le>>2]=zf}p[D+1]=p[b+(Me<<4)+20>>2];p[D+2]=p[b+(I<<4)+24>>2];(ye|0)!=0&&(n[(ye+2|0)>>1]|=128)}else{if((c|0)==213){var Ye=p[b+(I-2<<4)+16>>2];o=(L|0)>>2;var Ze=mv(p[o],0,Ye),Ae=I-4|0,Sf=mv(p[o],Ze,p[b+(Ae<<4)+16>>2]),cg=mv(p[o],Sf,p[b+(I<<4)+16>>2]),If=I-3|0,Jf=Cv(L,cg,(If<<4)+b+16|0),Cg=K|0;p[Cg>>2]=Jf;if((p[b+(If<<4)+24>>2]|0)==0){var Kf=Jf}else{var Sg=$u(L,19,Jf,0,0),Kf=p[Cg>>2]=Sg}p[D+1]=p[b+(Ae<<4)+20>>2];p[D+2]=p[b+(I<<4)+24>>2];(Kf|0)!=0&&(n[(Kf+2|0)>>1]|=128)}else{if((c|0)==214){Ev(K|0,L,t[(I<<4)+b+14|0]&255,(I-1<<4)+b+16|0,(I<<4)+b+16|0)}else{if((c|0)==215){Ev(K|0,L,74,(I-2<<4)+b+16|0,(I<<4)+b+16|0)}else{if((c|0)==216){var Lf=(I<<4)+b+16|0;Dv(K|0,L,70,(I-2<<4)+b+16|0,Lf);Fv(p[J],p[Lf>>2],p[D],73)}else{if((c|0)==217){var Te=(I<<4)+b+16|0;Dv(K|0,L,146,(I-3<<4)+b+16|0,Te);Fv(p[J],p[Te>>2],p[D],74)}else{if((c|0)==218||(c|0)==219){var gf=I-1|0;Gv(K|0,L,t[(gf<<4)+b+14|0]&255,(I<<4)+b+16|0,(gf<<4)+b+16|0)}else{if((c|0)==220){Gv(K|0,L,156,(I<<4)+b+16|0,(I-1<<4)+b+16|0)}else{if((c|0)==221){Gv(K|0,L,157,(I<<4)+b+16|0,(I-1<<4)+b+16|0)}else{if((c|0)==224){var sg=p[b+(I-2<<4)+16>>2];m=(L|0)>>2;var Mf=mv(p[m],0,sg),He=mv(p[m],Mf,p[b+(I<<4)+16>>2]),$e=I-4|0,Ne=$u(L,71,p[b+($e<<4)+16>>2],0,0);k=(K|0)>>2;p[k]=Ne;(Ne|0)==0?Lu(p[m],He):p[(Ne+16|0)>>2]=He;if((p[b+(I-3<<4)+16>>2]|0)!=0){var Ue=$u(L,19,p[k],0,0);p[k]=Ue}p[D+1]=p[b+($e<<4)+20>>2];p[D+2]=p[b+(I<<4)+24>>2]}else{if((c|0)==227){j=((I-1<<4)+b+16|0)>>2;if((p[j]|0)==0){var hf=$u(L,129,0,0,(p[b+(I-3<<4)+16>>2]<<3)+Hv|0);p[D]=hf;Df(p[J],p[b+(I-4<<4)+16>>2])}else{var Dg=$u(L,72,p[b+(I-4<<4)+16>>2],0,0);i=(K|0)>>2;p[i]=Dg;(Dg|0)==0?Lu(p[J],p[j]):(p[(Dg+16|0)>>2]=p[j],Iv(L,p[i]));if((p[b+(I-3<<4)+16>>2]|0)!=0){var me=$u(L,19,p[i],0,0);p[i]=me}}p[D+1]=p[b+(I-4<<4)+20>>2];p[D+2]=p[b+(I<<4)+16>>2]+p[b+(I<<4)+20>>2]|0}else{if((c|0)==228){var jf=$u(L,116,0,0,0);h=(K|0)>>2;p[h]=jf;(jf|0)==0?Zf(p[J],p[b+(I-1<<4)+16>>2]):(p[jf+16>>2]=p[b+(I-1<<4)+16>>2],n[(p[h]+2|0)>>1]|=2048,Iv(L,p[h]));p[D+1]=p[b+(I-2<<4)+16>>2];p[D+2]=p[b+(I<<4)+16>>2]+p[b+(I<<4)+20>>2]|0}else{if((c|0)==229){var $d=I-4|0,Nf=$u(L,72,p[b+($d<<4)+16>>2],0,0);g=(K|0)>>2;p[g]=Nf;(Nf|0)==0?Zf(p[J],p[b+(I-1<<4)+16>>2]):(p[(Nf+16|0)>>2]=p[b+(I-1<<4)+16>>2],n[(p[g]+2|0)>>1]|=2048,Iv(L,p[g]));if((p[b+(I-3<<4)+16>>2]|0)!=0){var Eg=$u(L,19,p[g],0,0);p[g]=Eg}p[D+1]=p[b+($d<<4)+20>>2];p[D+2]=p[b+(I<<4)+16>>2]+p[b+(I<<4)+20>>2]|0}else{if((c|0)==230){var tg=L|0,dg=I-1|0,eg=(dg<<4)+b+16|0,Af=(I<<4)+b+16|0,Md=sv(p[tg>>2],0,eg,Af),Tf=I-3|0,Tg=$u(L,72,p[b+(Tf<<4)+16>>2],0,0);f=(K|0)>>2;p[f]=Tg;if((Tg|0)==0){Mu(p[tg>>2],Md)}else{var Of=lv(L,0,Md,0,0,0,0,0,0,0);p[(p[f]+16|0)>>2]=Of;n[(p[f]+2|0)>>1]|=2048;Iv(L,p[f])}if((p[b+(I-2<<4)+16>>2]|0)!=0){var Uf=$u(L,19,p[f],0,0);p[f]=Uf}p[D+1]=p[b+(Tf<<4)+20>>2];var kf=p[Af>>2];p[D+2]=(kf|0)==0?p[eg>>2]+p[b+(dg<<4)+20>>2]|0:kf+p[b+(I<<4)+20>>2]|0}else{if((c|0)==231){var Vf=$u(L,20,0,0,0);p[D]=Vf;(Vf|0)==0?Zf(p[J],p[b+(I-1<<4)+16>>2]):(p[Vf+16>>2]=p[b+(I-1<<4)+16>>2],n[(Vf+2|0)>>1]|=2048,Iv(L,Vf));p[D+1]=p[b+(I-3<<4)+16>>2];p[D+2]=p[b+(I<<4)+16>>2]+p[b+(I<<4)+20>>2]|0}else{if((c|0)==232){var af=$u(L,134,p[b+(I-3<<4)+16>>2],p[b+(I-1<<4)+16>>2],0),Ug=K|0;p[Ug>>2]=af;(af|0)==0?Lu(p[J],p[b+(I-2<<4)+16>>2]):(p[(af+16|0)>>2]=p[b+(I-2<<4)+16>>2],Iv(L,p[Ug>>2]));p[D+1]=p[b+(I-4<<4)+16>>2];p[D+2]=p[b+(I<<4)+16>>2]+p[b+(I<<4)+20>>2]|0}else{if((c|0)==233){var ug=L|0,ie=mv(p[ug>>2],p[b+(I-4<<4)+16>>2],p[b+(I-2<<4)+16>>2]),lf=K|0;p[lf>>2]=ie;var mh=mv(p[ug>>2],ie,p[b+(I<<4)+16>>2]);p[lf>>2]=mh}else{if((c|0)==234){var Fg=L|0,fg=mv(p[Fg>>2],0,p[b+(I-2<<4)+16>>2]),gg=K|0;p[gg>>2]=fg;var Ie=mv(p[Fg>>2],fg,p[b+(I<<4)+16>>2]);p[gg>>2]=Ie}else{if((c|0)==243){var Pf=(I-6<<4)+b+16|0,Vg=(I-5<<4)+b+16|0,hg=sv(p[J],0,(I-3<<4)+b+16|0,0);cv(L,Pf,Vg,hg,p[b+(I-1<<4)+16>>2],p[b+(I-9<<4)+16>>2],(I-10<<4)+b+16|0,(I<<4)+b+16|0,0,p[b+(I-7<<4)+16>>2])}else{if((c|0)==244||(c|0)==298){p[D]=2}else{if((c|0)==245){p[D]=0}else{if((c|0)==248){var Gg=I-1|0;if((p[b+(Gg<<4)+20>>2]|0)==0){var ig=0,jg=L|0}else{var Wf=(Gg<<4)+b+16|0,vg=L|0,kg=ov(p[vg>>2],152,0);Bv(L,kg,Wf);ig=kg;jg=vg}var lg=mv(p[jg>>2],p[b+(I-4<<4)+16>>2],ig),Bf=K;p[D]=lg;nv(L,lg,(I-2<<4)+b+16|0,1);vv(L,p[Bf>>2],R.Aa|0);var bf=p[Bf>>2];(bf|0)!=0&&(l[p[bf+12>>2]+(p[bf>>2]-1)*20+12|0]=p[b+(I<<4)+16>>2]&255)}else{if((c|0)==249){var Xf=I-1|0;if((p[b+(Xf<<4)+20>>2]|0)==0){var mf=0}else{var Eh=(Xf<<4)+b+16|0,wg=$u(L,152,0,0,0);Bv(L,wg,Eh);mf=wg}var Cf=mv(p[J],0,mf),mg=K;p[D]=Cf;nv(L,Cf,(I-2<<4)+b+16|0,1);vv(L,p[mg>>2],R.Aa|0);var Qf=p[mg>>2];(Qf|0)!=0&&(l[p[Qf+12>>2]+(p[Qf>>2]-1)*20+12|0]=p[b+(I<<4)+16>>2]&255)}else{if((c|0)==250){p[D]=0,p[D+1]=0}else{if((c|0)==252){Jv(L,p[b+(I<<4)+16>>2],p[b+(I-1<<4)+16>>2])}else{if((c|0)==253||(c|0)==254){var ci=Su(L);(ci|0)!=0&&V(ci,127,0,0)}else{if((c|0)==255){Kv(L,(I-1<<4)+b+16|0,(I<<4)+b+16|0,0,0)}else{if((c|0)==256){Kv(L,(I-3<<4)+b+16|0,(I-2<<4)+b+16|0,(I<<4)+b+16|0,0)}else{if((c|0)==257){Kv(L,(I-4<<4)+b+16|0,(I-3<<4)+b+16|0,(I-1<<4)+b+16|0,0)}else{if((c|0)==258){Kv(L,(I-3<<4)+b+16|0,(I-2<<4)+b+16|0,(I<<4)+b+16|0,1)}else{if((c|0)==259){Kv(L,(I-4<<4)+b+16|0,(I-3<<4)+b+16|0,(I-1<<4)+b+16|0,1)}else{if((c|0)==270){var di=p[b+(I-3<<4)+16>>2];p[P>>2]=di;p[P+4>>2]=p[b+(I<<4)+20>>2]+p[b+(I<<4)+16>>2]-di|0;Lv(L,p[b+(I-1<<4)+16>>2],P)}else{if((c|0)==271){var Fh=(I-7<<4)+b+16|0,Gh=I-6|0,nh=(Gh<<4)+b+16|0,nf=I-4|0;Mv(L,Fh,nh,p[b+(I-5<<4)+16>>2],p[b+(nf<<4)+16>>2],p[b+(nf<<4)+20>>2],p[b+(I-2<<4)+16>>2],p[b+(I<<4)+16>>2],p[b+(I-10<<4)+16>>2],p[b+(I-8<<4)+16>>2]);if((p[b+(Gh<<4)+20>>2]|0)==0){var Wg=Fh,Hh=K,Xg=Wg|0,xg=Wg+4|0,Yf=p[xg>>2],Hg=Hh|0;p[Hg>>2]=p[Xg>>2];var Yg=Hh+4|0;p[Yg>>2]=Yf}else{var ei=nh,fi=K,Xg=ei|0,Ui=p[Xg>>2],xg=ei+4|0,zj=p[xg>>2],Hg=fi|0;p[Hg>>2]=Ui;Yg=fi+4|0;p[Yg>>2]=zj}}else{if((c|0)==272||(c|0)==275){p[D]=34}else{if((c|0)==273){p[D]=30}else{if((c|0)==274){p[D]=48}else{if((c|0)==276||(c|0)==277){p[D]=t[(I<<4)+b+14|0]&255,p[D+1]=0}else{if((c|0)==278){p[D]=107,p[D+1]=p[b+(I<<4)+16>>2]}else{if((c|0)==281||(c|0)==303){p[D]=0}else{if((c|0)==282||(c|0)==304){p[D]=p[b+(I<<4)+16>>2]}else{if((c|0)==283){var Aj=(I-1<<4)+b+16|0,Vi=p[Aj>>2];e=((I-2<<4)+b+16|0)>>2;p[(p[p[e]+36>>2]+32|0)>>2]=Vi;p[(p[e]+36|0)>>2]=p[Aj>>2];p[D]=p[e]}else{if((c|0)==284){var wi=(I-1<<4)+b+16|0,fl=p[wi>>2];p[(fl+36|0)>>2]=fl;p[D]=p[wi>>2]}else{if((c|0)==286){var mk=(I<<4)+b+16|0,nm=K,Xa=mk|0;w=Xa>>2;var om=p[w],rb=mk+4|0;u=rb>>2;var gi=p[u],za=nm|0;x=za>>2;p[x]=om;Ja=nm+4|0;v=Ja>>2;p[v]=gi;ym(L,R.de|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z))}else{if((c|0)==288){ym(L,R.fe|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z))}else{if((c|0)==289){ym(L,R.ge|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z))}else{if((c|0)==290){var xi=p[J],Bj=p[b+(I-1<<4)+16>>2],gl=p[b+(I<<4)+16>>2],Wi=l[(I-5<<4)+b+16|0],yi=Nv(xi,107,(I-4<<4)+b+16|0);if((yi|0)!=0){var hl=Ov(xi,Bj,1);p[yi+24>>2]=hl;var il=Pv(xi,gl,1);p[yi+20>>2]=il;l[yi+1|0]=Wi}Lu(xi,Bj);Df(xi,gl);p[D]=yi}else{if((c|0)==291){var nk=Qv(p[J],(I-5<<4)+b+16|0,p[b+(I-4<<4)+16>>2],p[b+(I-1<<4)+16>>2],0,l[(I-7<<4)+b+16|0]);p[D]=nk}else{if((c|0)==292){var jl=Qv(p[J],(I-2<<4)+b+16|0,p[b+(I-1<<4)+16>>2],0,p[b+(I<<4)+16>>2],l[(I-4<<4)+b+16|0]);p[D]=jl}else{if((c|0)==293){var kl=p[J],Cj=p[b+(I<<4)+16>>2],Dj=Nv(kl,106,(I-2<<4)+b+16|0);if((Dj|0)!=0){var pm=Pv(kl,Cj,1);p[Dj+20>>2]=pm;l[Dj+1|0]=99}Df(kl,Cj);p[D]=Dj}else{if((c|0)==294){var O=p[J],aa=p[b+(I<<4)+16>>2],Z=ni(O,40);if((Z|0)==0){Zf(O,aa);var $=0}else{l[Z]=116,p[Z+8>>2]=aa,l[Z+1|0]=99,$=Z}p[D]=$}else{if((c|0)==295){var Ej=$u(L,56,0,0,0);p[D]=Ej;(Ej|0)!=0&&(l[Ej+1|0]=4);p[D+1]=p[b+(I-3<<4)+16>>2];p[D+2]=p[b+(I<<4)+16>>2]+p[b+(I<<4)+20>>2]|0}else{if((c|0)==296){var wa=$u(L,56,0,0,(I-1<<4)+b+16|0);p[D]=wa;(wa|0)!=0&&(l[wa+1|0]=p[b+(I-3<<4)+16>>2]&255);p[D+1]=p[b+(I-5<<4)+16>>2];p[D+2]=p[b+(I<<4)+16>>2]+p[b+(I<<4)+20>>2]|0}else{if((c|0)==297){p[D]=1}else{if((c|0)==299){p[D]=3}else{if((c|0)==300){Rv(L,p[b+(I<<4)+16>>2],p[b+(I-1<<4)+16>>2])}else{if((c|0)==301){var ia=p[b+(I-3<<4)+16>>2];Sv(L,24,Tv,ia,ia,p[b+(I-1<<4)+16>>2],p[b+(I<<4)+16>>2])}else{if((c|0)==302){var Aa=p[b+(I<<4)+16>>2];Sv(L,25,Uv,Aa,0,0,Aa)}else{if((c|0)==307){Vv(L,0,0)}else{if((c|0)==308){Vv(L,(I-1<<4)+b+16|0,(I<<4)+b+16|0)}else{if((c|0)==309){Wv(L,0,0)}else{if((c|0)==310){Wv(L,(I-1<<4)+b+16|0,(I<<4)+b+16|0)}else{if((c|0)==311){Xv(L,p[b+(I-3<<4)+16>>2],(I<<4)+b+16|0)}else{if((c|0)==312){Yv(L,(I<<4)+b+16|0)}else{if((c|0)==313){l[p[J]+234|0]=0,Zv(L,p[b+(I<<4)+16>>2])}else{if((c|0)==316){$v(L,0)}else{if((c|0)==317){$v(L,(I<<4)+b+16|0)}else{if((c|0)==318){aw(L,(I-3<<4)+b+16|0,(I-2<<4)+b+16|0,(I<<4)+b+16|0)}else{if((c|0)==321){var Fj=L;bw(Fj);p[Fj+516>>2]=0;p[Fj+520>>2]=0}else{if((c|0)==323||(c|0)==324||(c|0)==325){var zi=L,U=(I<<4)+b+16|0,oh=zi+516|0,Ih=p[oh>>2];(Ih|0)==0?(p[oh>>2]=p[U>>2],p[zi+520>>2]=p[U+4>>2]):p[zi+520>>2]=p[U>>2]+p[U+4>>2]-Ih|0}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}while(0);var ph=t[(c<<1)+cw|0],qh=ph&255,rh=t[(c<<1)+cw+1|0],Gj=rh&255,ro=p[E]-Gj|0;p[E]=ro;var va=Vc[Ju+((n[dw+((Vc[b+(I-Gj<<4)+12>>1]&65535)<<1)>>1]<<16>>16)+(ph&255)<<1)>>1]&65535;if((va|0)<630){if(rh<<24>>24==0){Gu(b,va,qh,K)}else{p[E]=ro+1|0;var Om=1-Gj+I|0;n[b+(Om<<4)+12>>1]=va&65535;l[(Om<<4)+b+14|0]=ph;d=((Om<<4)+b+16|0)>>2;p[d]=p[A];p[d+1]=p[A+1];p[d+2]=p[A+2]}}else{var so=b+8|0,ar=p[so>>2],zg=b|0,Qa=(p[zg>>2]|0)>-1;a:do{if(Qa){for(;;){if(Dn(b),(p[zg>>2]|0)<=-1){break a}}}}while(0);p[so>>2]=ar}a=K}Fu.X=1;function Pu(b,c){l[b+480|0]=c&255;p[b+456>>2]=0}function Qu(b){var c,d=b>>2,e,f=y[d],g=f+30|0,h=l[g]<<24>>24==0;do{if(h&&l[b+18|0]<<24>>24==0){var i=b+64|0;if((p[i>>2]|0)==0){var j=Su(b),k=(j|0)==0;do{if(k){var m=b+352|0;e=24}else{ew(j,6);e=b+352|0;c=p[e>>2];if((c|0)>0){fw(j,c-1|0);c=f+4|0;var o=(p[c>>2]|0)>0;a:do{if(o){for(var r=b+344|0,q=b+340|0,s=f+124|0,u=f+8|0,w=1,v=0;;){(p[r>>2]&w|0)!=0&&(vm(j,v),V(j,35,v,(p[q>>2]&w|0)!=0&1),l[s]<<24>>24==0&&gw(j,38,v,p[((v<<2)+356>>2)+d],p[p[p[u>>2]+(v<<4)+12>>2]+4>>2]));v=v+1|0;if((v|0)>=(p[c>>2]|0)){break a}w<<=1}}}while(0);c=(b+528|0)>>2;o=(p[c]|0)>0;a:do{if(o){r=b+532|0;for(q=0;;){if(hw(j,132,0,0,0,iw(f,p[p[r>>2]+(q<<2)>>2]),-10),q=q+1|0,(q|0)>=(p[c]|0)){break a}}}}while(0);p[c]=0;c=b;u=fa;o=Su(c);r=c+404|0;q=(p[r>>2]|0)>0;a:do{if(q){s=c+408|0;for(w=0;;){v=y[s>>2];u=v>>2;hw(o,131,p[(w<<4>>2)+u],p[((w<<4)+4>>2)+u],t[(w<<4)+v+8|0]&255,p[((w<<4)+12>>2)+u],-2);u=w+1|0;if((u|0)>=(p[r>>2]|0)){break a}w=u}}}while(0);jw(b);V(j,1,0,p[e>>2])}if((p[i>>2]|0)!=0){m=e,e=24}else{if(l[g]<<24>>24!=0){m=e,e=24}else{if((p[d+105]|0)!=0){var x=b+68|0;(p[x>>2]|0)==0&&(p[x>>2]=1)}Fm(j,b);p[d+1]=101;l[b+16|0]=0;x=e;e=25}}}}while(0);e==24&&(p[d+1]=1,x=m);p[d+17]=0;p[d+18]=0;p[d+19]=0;p[d+114]=0;p[d+86]=0;p[x>>2]=0}}}while(0)}Qu.X=1;function Tu(b,c,d){var e=b|0,d=Xu(p[e>>2],d),f=(d|0)==0;a:do{if(!f){var g=Su(b),h=(g|0)==0;do{if(!h&&(Ru(b,32,p[kw+(c<<2)>>2],d,0)|0)==0){hw(g,33,c,0,0,d,-1);break a}}while(0);vf(p[e>>2],d)}}while(0)}function Uu(b,c,d,e,f,g,h){var i,j=b>>2,k=a;a+=4;var m=y[j],o=lw(b,c,d,k),r=(o|0)<0;a:do{if(!r){i=(e|0)==0;do{if(!i){if((p[d+4>>2]|0)==0|(o|0)==1){c=1;break}ym(b,R.vk|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));break a}c=o}while(0);var q=p[k>>2];i=q;var s=b+484|0,u=p[i+4>>2];p[s>>2]=p[i>>2];p[s+4>>2]=u;s=Xu(m,q);if((s|0)!=0){u=(mw(b,s)|0)==0;b:do{if(u){var w=(p[m+116>>2]|0)==1?1:e;i=(m+8|0)>>2;var v=p[p[i]+(c<<4)>>2];if((Ru(b,18,(w|0)==1?R.n|0:R.o|0,0,v)|0)==0){var w=(w|0)!=0,x=(f|0)==0?w?4:2:w?6:8;if((w=(g|0)!=0)||(Ru(b,x,s,0,v)|0)==0){v=l[b+524|0]<<24>>24==0;do{if(v){v=p[p[i]+(c<<4)>>2];if((Hm(b)|0)!=0){break b}if((Im(m,s,v)|0)==0){if((nw(m,s,v)|0)==0){break}ym(b,R.yk|0,(z=a,a+=4,p[z>>2]=s,z));break b}if((h|0)==0){ym(b,R.wk|0,(z=a,a+=4,p[z>>2]=q,z));break b}ow(b,c);break b}}while(0);x=v=ni(m,76);if((v|0)!=0){p[v>>2]=s;p[v+4>>2]=-1;d=v+68|0;p[d>>2]=p[p[i]+(c<<4)+12>>2];n[v+32>>1]=1;p[v+24>>2]=1e6;p[j+126]=x;l[b+18|0]<<24>>24==0&&(pg(s,R.ob|0)|0)==0&&(p[(p[d>>2]+72|0)>>2]=x);if(l[m+124|0]<<24>>24!=0){break a}d=Su(b);if((d|0)==0){break a}pw(b,0,c);w&&ew(d,132);o=b+72|0;r=p[o>>2];e=r+1|0;p[j+103]=e;h=r+2|0;p[j+104]=h;j=r+3|0;p[o>>2]=j;gw(d,36,c,j,2);vm(d,c);o=qw(d,27,j);V(d,7,(p[m+12>>2]&1048576|0)!=0?1:4,j);gw(d,37,c,2,j);V(d,7,t[p[p[i]+12>>2]+77|0]&255,j);gw(d,37,c,5,j);fw(d,o);(g|f|0)==0?V(d,105,c,h):V(d,7,0,h);rw(b,c);V(d,56,0,e);V(d,10,0,j);gw(d,57,0,j,e);sw(d,8);ew(d,45);break a}l[m+30|0]=1;p[j+1]=7;i=b+64|0;p[i>>2]=p[i>>2]+1|0}}}}while(0);vf(m,s)}}}while(0);a=k}Uu.X=1;function Vu(b,c,d,e){var f,g=b>>2,h=a;a+=116;var i,j=h+64,k=h+100,m=p[g],o=(e|0)==0,r=(d|0)==0&o;do{if(!r){var q=m+30|0;if(l[q]<<24>>24==0){var s=b+504|0,u=p[s>>2];f=u>>2;if((u|0)!=0){var w=u+68|0,v=rm(m,p[w>>2]),x=u+44|0;if((p[x>>2]|0)!=0){i=j>>2;for(var A=i+9;i<A;i++){p[i]=0}i=h>>2;for(A=i+16;i<A;i++){p[i]=0}n[h>>1]=1;p[h+8>>2]=p[f];p[h+16>>2]=u;p[h+36>>2]=-1;p[j>>2]=b;p[j+4>>2]=h;l[j+22|0]=1;if((tw(j,p[x>>2])|0)!=0){break}}x=m+124|0;if(l[x]<<24>>24==0){i=9}else{if(p[(u+20|0)>>2]=p[m+120>>2],l[x]<<24>>24==0){i=9}else{var E=u|0;i=20}}if(i==9){E=Su(b);if((E|0)==0){break}qw(E,45,0);i=(A=(p[f+7]|0)==0)?R.Rb|0:R.ec|0;if(o){var A=A?R.gk|0:R.hk|0,J=p[g+121],M=p[d>>2]+1-J|0,J=zm(m,R.ik|0,(z=a,a+=12,p[z>>2]=A,p[z+4>>2]=M,p[z+8>>2]=J,z)),D=b+416|0}else{A=b+416|0;gw(E,40,1,p[A>>2],v);sw(E,1);p[g+17]=2;uw(k,8,1);kv(b,e,k);qw(E,45,1);if((p[g+16]|0)==0){J=vw(b,e);if((J|0)==0){break}M=J+8|0;p[(u+8|0)>>2]=p[M>>2];var K=J+12|0;p[(u+12|0)>>2]=p[K>>2];p[M>>2]=0;p[K>>2]=0;rf(m,J)}J=ww(m,u);D=A}var M=m+8|0,K=p[p[M>>2]+(v<<4)>>2],H=(v|0)==1?R.n|0:R.o|0,A=u|0,N=p[A>>2],D=p[D>>2],Q=p[g+103];xw(b,R.jk|0,(z=a,a+=32,p[z>>2]=K,p[z+4>>2]=H,p[z+8>>2]=i,p[z+12>>2]=N,p[z+16>>2]=N,p[z+20>>2]=D,p[z+24>>2]=J,p[z+28>>2]=Q,z));vf(m,J);yw(b,v);(l[u+34|0]&8)<<24>>24!=0&&(i=p[M>>2],(p[p[i+(v<<4)+12>>2]+72>>2]|0)==0&&(i=p[i+(v<<4)>>2],xw(b,R.kk|0,(z=a,a+=4,p[z>>2]=i,z))));i=p[A>>2];i=zm(m,R.lk|0,(z=a,a+=4,p[z>>2]=i,z));zw(E,v,i);if(l[x]<<24>>24==0){break}E=A}v=p[E>>2];(Ff(p[w>>2]+8|0,v,ve(v),u)|0)==0?(p[s>>2]=0,q=m+40|0,p[q>>2]=p[q>>2]+1|0,p[(m+12|0)>>2]|=512,(p[f+7]|0)==0&&(f=p[g+121],p[(u+48|0)>>2]=un(f,p[((p[c>>2]|0)==0?d:c)>>2]-f|0)+13|0)):l[q]=1}}}}while(0);a=h}Vu.X=1;function Wu(b,c){var d,e,f=y[b>>2],g=p[b+504>>2],h=(g|0)==0;a:do{if(!h){if(e=(g+8|0)>>2,(p[e]+1|0)>(p[f+80>>2]|0)){e=p[g>>2],ym(b,R.ek|0,(z=a,a+=4,p[z>>2]=e,z))}else{var i=Xu(f,c);if((i|0)!=0){var j=y[e];d=(g+12|0)>>2;for(var k=i+1|0,m=0;;){if((m|0)>=(j|0)){g=p[d];if((j&7|0)==0){g=Il(f,g,j*24+192|0);if((g|0)==0){vf(f,i);break a}f=g;p[d]=f;d=p[e]}else{d=j,f=g}g=f+d*24|0;Ed(g,0,24);p[g>>2]=i;l[f+d*24+22|0]=98;p[e]=p[e]+1|0;break a}var o=y[(p[d]>>2)+(m*6|0)],r=l[R.i+(t[i]&255)|0]<<24>>24==l[R.i+(t[o]&255)|0]<<24>>24;do{if(r&&(qm(k,o+1|0)|0)==0){ym(b,R.fk|0,(z=a,a+=4,p[z>>2]=i,z));vf(f,i);break a}}while(0);m=m+1|0}}}}}while(0)}Wu.X=1;function Zu(b,c){var d=p[b>>2],e=p[b+504>>2];if((e|0)==0){e=c|0}else{var f=p[e+8>>2]-1|0,g=p[e+12>>2],e=c|0;if((Aw(p[e>>2],2)|0)==0){f=p[(g>>2)+(f*6|0)],ym(b,R.dk|0,(z=a,a+=4,p[z>>2]=f,z))}else{var h=g+f*24+4|0;Df(d,p[h>>2]);var i=Pv(d,p[e>>2],1);p[h>>2]=i;f=g+f*24+8|0;vf(d,p[f>>2]);g=p[c+4>>2];g=Mm(d,g,p[c+8>>2]-g|0);p[f>>2]=g}}Df(d,p[e>>2])}function $u(b,c,d,e,f){var g=b|0,c=Bw(p[g>>2],c,f,1);Cw(p[g>>2],c,d,e);(c|0)!=0&&Dw(b,p[c+44>>2]);return c}function av(b,c,d,e){c=$u(c,d,0,0,e);p[b>>2]=c;c=e|0;p[b+4>>2]=p[c>>2];p[b+8>>2]=p[c>>2]+p[e+4>>2]|0}function bv(b,c,d,e,f){var g,h,i=p[b+504>>2];g=i>>2;var j=(i|0)==0;a:do{if(j){var k=c}else{if(l[b+524|0]<<24>>24!=0){k=c}else{var k=i+34|0,m=l[k];if((m&4)<<24>>24==0){l[k]=m|4;m=(c|0)==0;do{if(m){var o=p[g+2]-1|0;l[p[g+3]+o*24+21|0]=1;h=16}else{h=c|0;var r=p[h>>2];if((r|0)>0){for(var q=c+12|0,s=i+8|0,u=i+12|0,w=0;;){for(var v=p[s>>2],x=0;;){if((x|0)>=(v|0)){var A=r;break}var E=p[u>>2];if((qm(p[(p[q>>2]+4>>2)+(w*5|0)],p[(E>>2)+(x*6|0)])|0)==0){l[E+x*24+21|0]=1;A=p[h>>2];break}x=x+1|0}w=w+1|0;if((w|0)>=(A|0)){break}r=A}(A|0)>1?h=21:(o=x,h=16)}else{h=21}}}while(0);do{if(h==16&&(o|0)>-1&&(o|0)<(p[g+2]|0)&&(m=p[(p[g+3]+12>>2)+(o*6|0)],(m|0)!=0&&(qm(m,R.qb|0)|f|0)==0)){p[(i+4|0)>>2]=o;l[i+35|0]=d&255;l[k]=(t[k]&255|e<<3)&255;k=c;break a}}while(0);(e|0)==0?(k=cv(b,0,0,0,c,d,0,0,f,0),(k|0)!=0&&(l[k+25|0]=2),k=0):(ym(b,R.ck|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),k=c)}else{k=p[g],ym(b,R.bk|0,(z=a,a+=4,p[z>>2]=k,z)),k=c}}}}while(0);Lu(p[b>>2],k)}bv.X=1;function cv(b,c,d,e,f,g,h,i,j,k){var m,o,r,q,s,u,w,v,x=a;a+=28;var A,E=x+8,J=x+24;v=J>>2;var M=b|0,D=y[M>>2];p[v]=0;var K=D+30|0,H=l[K]<<24>>24==0;a:do{if(H){if(l[b+524|0]<<24>>24!=0){var N=0,Q=0,P=f}else{if((Hm(b)|0)!=0){Q=N=0,P=f}else{var L=(e|0)!=0;if(L){var I=lw(b,c,d,J);if((I|0)<0){Q=N=0;P=f;break}if(l[D+124|0]<<24>>24==0){var X=Ew(b,e),Y=(p[d+4>>2]|0)!=0|(X|0)==0?I:(p[X+68>>2]|0)!=(p[p[D+8>>2]+28>>2]|0)?I:1}else{Y=I}var da=p[v];(Fw(E,b,Y,R.Aa|0,da)|0)!=0&&Gw(E,e);var ga=xm(b,0,p[e+8>>2],p[e+4>>2]);if((ga|0)==0){Q=N=0;P=f;break}if(l[K]<<24>>24!=0){Q=N=0;P=f;break}var ha=ga;w=ha>>2;var ba=Y,ea=da}else{var ja=p[b+504>>2];if((ja|0)==0){Q=N=0;P=f;break}var ra=rm(D,p[ja+68>>2]),ha=ja;w=ha>>2;ba=ra;ea=0}u=(D+8|0)>>2;var Va=y[u],ta=(ba<<4)+Va|0;s=(ha|0)>>2;var xa=p[s],Fa=(te(xa,R.N|0,7)|0)==0;do{if(Fa&&(jm(xa+7|0,R.Oj|0,9)|0)!=0){ym(b,R.Pj|0,(z=a,a+=4,p[z>>2]=xa,z));Q=N=0;P=f;break a}}while(0);if((p[w+7]|0)==0){if((l[ha+34|0]&16)<<24>>24==0){var Na=(ea|0)==0;do{if(Na){var Ea=p[w+4],La=(Ea|0)==0;b:do{if(La){var za=1}else{for(var Ba=1,Ja=Ea;;){var ka=Ba+1|0,S=p[Ja+32>>2];if((S|0)==0){za=ka;break b}Ba=ka;Ja=S}}}while(0);var ib=zm(D,R.Vj|0,(z=a,a+=8,p[z>>2]=xa,p[z+4>>2]=za,z));if((ib|0)==0){Q=N=0;P=f;break a}var Wa=ib,Za=p[ta>>2]}else{var Sa=Xu(D,ea);if((Sa|0)==0){Q=N=0;P=f;break a}if((mw(b,Sa)|0)!=0){N=Sa;Q=0;P=f;break a}var tb=l[D+124|0]<<24>>24==0;do{if(tb&&(Im(D,Sa,0)|0)!=0){ym(b,R.Tj|0,(z=a,a+=4,p[z>>2]=Sa,z));N=Sa;Q=0;P=f;break a}}while(0);var pb=p[ta>>2];if((nw(D,Sa,pb)|0)==0){Wa=Sa,Za=pb}else{if((k|0)==0){ym(b,R.Uj|0,(z=a,a+=4,p[z>>2]=Sa,z));N=Sa;Q=0;P=f;break a}ow(b,ba);N=Sa;Q=0;P=f;break a}}}while(0);var fb=(ba|0)==1,Xa=fb?R.n|0:R.o|0;if((Ru(b,18,Xa,0,Za)|0)!=0){N=Wa,Q=0,P=f}else{if((Ru(b,fb?3:1,Wa,p[s],Za)|0)!=0){N=Wa,Q=0,P=f}else{if((f|0)==0){var Ab=p[(p[w+3]>>2)+((p[w+2]-1)*6|0)];p[x>>2]=Ab;p[x+4>>2]=ve(Ab);var rb=mv(p[M>>2],0,0);if((rb|0)==0){N=Wa;P=Q=0;break}nv(b,rb,x,0);l[p[rb+12>>2]+12|0]=j&255;var cb=rb}else{cb=f}q=(cb|0)>>2;var Cb=p[q],Zb=(Cb|0)>0;b:do{if(Zb){for(var dc=p[cb+12>>2],kb=0,Oa=0;;){var Db=p[(dc>>2)+(kb*5|0)];if((Db|0)==0){var Wb=Oa}else{var Nb=p[Db+20>>2],Wb=(Nb|0)==0?Oa:ve(p[Nb>>2])+(Oa+1)|0}var $b=kb+1|0;if(($b|0)>=(Cb|0)){var Rb=Wb;break b}kb=$b;Oa=Wb}}else{Rb=0}}while(0);var Ra=ve(Wa),Ob=Cb<<2,Ua=ni(D,(Cb<<3)+Rb+Cb+(Ob+59&-8)+Ra+1|0),Jb=Ua,Vb=l[K]<<24>>24==0;b:do{if(Vb){p[(Ua+12|0)>>2]=Ua+48|0;var Pb=Ua+((Ob|1)+55&-8)|0;r=(Ua+44|0)>>2;p[r]=Pb;var sb=(Cb<<2)+Pb|0;o=(Ua+8|0)>>2;p[o]=sb;var db=(Cb<<2)+sb|0,wb=Ua+40|0;p[wb>>2]=db;var ob=db+Cb|0;m=Ua>>2;p[m]=ob;var Kb=Ra+1|0,ub=db+Kb+Cb|0;Ah(ob,Wa,Kb);p[(Ua+16|0)>>2]=ha;var Xb=Ua+4|0;p[Xb>>2]=p[q];var Sb=Ua+24|0;l[Sb]=g&255;l[Ua+25|0]=Na&1;var Qb=Ua+36|0;p[Qb>>2]=p[p[u]+(ba<<4)+12>>2];var ac=((t[p[Va+(ba<<4)+12>>2]+76|0]&255)>3)<<31>>31,Gb=ha+12|0,xb=ha+8|0,Ta=D+44|0,qb=D+124|0,bc=ub,$a=0,mb=p[cb+12>>2];c:for(;;){if(($a|0)>=(p[q]|0)){break}for(var Bb=y[mb+4>>2],bb=p[xb>>2],jb=p[Gb>>2],nb=0;;){if((nb|0)>=(bb|0)){var zb=p[s];ym(b,R.Wj|0,(z=a,a+=8,p[z>>2]=zb,p[z+4>>2]=Bb,z));l[b+17|0]=1;A=99;break b}if((qm(Bb,p[jb>>2])|0)==0){p[(($a<<2)+p[o]|0)>>2]=nb;var Tb=p[mb>>2];if((Tb|0)==0){A=59}else{var ec=p[Tb+20>>2];if((ec|0)==0){A=59}else{var Hb=p[ec>>2],Eb=ve(Hb)+1|0;Ah(bc,Hb,Eb);var Lb=bc,gb=bc+Eb|0;A=61}}if(A==59){var Mb=p[(p[Gb>>2]+16>>2)+(nb*6|0)],Lb=(Mb|0)!=0?Mb:p[p[Ta>>2]>>2],gb=bc}if(l[qb]<<24>>24==0&&(gv(b,Lb)|0)==0){A=99;break b}p[(($a<<2)+p[r]|0)>>2]=Lb;l[p[wb>>2]+$a|0]=l[mb+12|0]∾bc=gb;$a=$a+1|0;mb=mb+20|0;continue c}jb=jb+24|0;nb=nb+1|0}}Hw(Jb);var vc=(ha|0)==(p[b+504>>2]|0);c:do{if(vc){for(var hc=ha+16|0;;){var kc=p[hc>>2];if((kc|0)==0){break c}var pc=p[kc+4>>2];if((pc|0)==(p[Xb>>2]|0)){for(var jc=kc+8|0,mc=kc+44|0,Fb=0;;){if((Fb|0)>=(pc|0)){break}if((p[p[jc>>2]+(Fb<<2)>>2]|0)!=(p[p[o]+(Fb<<2)>>2]|0)){break}var Ub=p[p[mc>>2]+(Fb<<2)>>2],Ya=p[p[r]+(Fb<<2)>>2];if((Ub|0)!=(Ya|0)&&(qm(Ub,Ya)|0)!=0){break}Fb=Fb+1|0}if((Fb|0)==(pc|0)){break}}hc=kc+32|0}var Pa=kc+24|0,yb=l[Pa],Ka=l[Sb];if(yb<<24>>24==Ka<<24>>24){A=100;break b}if(yb<<24>>24==99|Ka<<24>>24==99){var Ac=yb}else{ym(b,R.Xj|0,(z=a,a+=4,p[z>>2]=0,z)),Ac=l[Pa]}if(Ac<<24>>24!=99){A=99;break b}l[Pa]=l[Sb];A=99;break b}}while(0);var Jc=l[qb]<<24>>24==0;do{if(Jc){var uc=b+72|0,Tc=p[uc>>2]+1|0;p[uc>>2]=Tc;var Yc=Su(b);if((Yc|0)==0){A=99;break b}pw(b,1,ba);V(Yc,104,ba,Tc);if((h|0)==0){var ua=0}else{var md=(g|0)==0?xh|0:R.Zj|0,nd=p[p[v]>>2],Bc=p[i>>2]+1-nd|0,ua=zm(D,R.Yj|0,(z=a,a+=12,p[z>>2]=md,p[z+4>>2]=Bc,p[z+8>>2]=nd,z))}var Qc=p[p[u]+(ba<<4)>>2],Oc=p[m],ed=p[s];xw(b,R.$j|0,(z=a,a+=24,p[z>>2]=Qc,p[z+4>>2]=Xa,p[z+8>>2]=Oc,p[z+12>>2]=ed,p[z+16>>2]=Tc,p[z+20>>2]=ua,z));vf(D,ua);if(L){Iw(b,Jb,Tc);yw(b,ba);var Fc=p[m],ud=zm(D,R.ak|0,(z=a,a+=4,p[z>>2]=Fc,z));zw(Yc,ba,ud);qw(Yc,129,0);A=91}else{A=92}}else{var Rc=p[m];if((Ff(p[Qb>>2]+24|0,Rc,ve(Rc),Ua)|0)==0){p[(D+12|0)>>2]|=512,L?(p[(Ua+20|0)>>2]=p[D+120>>2],A=91):A=92}else{l[K]=1;A=99;break b}}}while(0);if(A==91&&l[qb]<<24>>24==0){A=99;break}var Yb=(g|0)==5,W=ha+16|0,bd=p[W>>2];do{if(Yb){if((bd|0)==0){var hd=0;break}if(l[bd+24|0]<<24>>24==5){hd=bd;break}for(var eb=bd;;){var Uc=eb+32|0,cd=p[Uc>>2];if((cd|0)==0){break}if(l[cd+24|0]<<24>>24==5){break}eb=cd}p[(Ua+32|0)>>2]=cd;p[Uc>>2]=Jb;N=Wa;Q=Jb;P=cb;break a}hd=bd}while(0);p[(Ua+32|0)>>2]=hd;p[W>>2]=Jb;N=Wa;Q=Jb;P=cb;break a}A=99}while(0);A==99&&(Ua|0)==0||(vf(D,p[Ua+28>>2]),vf(D,Ua));N=Wa;Q=0;P=cb}}}else{ym(b,R.Rj|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),Q=N=0,P=f}}else{ym(b,R.Qj|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),Q=N=0,P=f}}}}else{Q=N=0,P=f}}while(0);Lu(D,P);Mu(D,e);vf(D,N);a=x;return Q}cv.X=1;function dv(b,c){var d,e=p[b>>2];d=p[b+504>>2];if((d|0)==0){d=4}else{if(l[b+524|0]<<24>>24!=0){d=4}else{d=d+44|0;var f=Jw(e,p[d>>2],c);p[d>>2]=f;d=5}}d==4&&Df(e,c)}function fv(b,c){if((b|0)!=0){var d=p[b+36>>2];(d|0)!=0&&(l[d+24|0]=c&255)}}function ev(b,c,d,e,f){var g,h,i,j,k,m=y[b>>2],o=y[b+504>>2];j=o>>2;var r=(o|0)==0;a:do{if(r){var q=0}else{if(l[b+524|0]<<24>>24!=0){q=0}else{q=(c|0)==0;do{if(q){k=p[j+2]-1|0;if((k|0)<0){q=0;break a}if((e|0)==0){var s=1;k=13}else{var u=p[e>>2];if((u|0)==1){var w=d+4|0,v=1,x=w,w=p[w>>2]+45|0;k=15}else{f=p[(p[j+3]>>2)+(k*6|0)];ym(b,R.Lj|0,(z=a,a+=8,p[z>>2]=f,p[z+4>>2]=d,z));q=0;break a}}}else{if((e|0)==0){s=p[c>>2],k=13}else{h=p[e>>2];k=p[c>>2];if((h|0)!=(k|0)){ym(b,R.Mj|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));q=0;break a}var A=d+4|0,E=(k<<3)+p[A>>2]+37|0;if((h|0)>0){u=h,v=k,x=A,w=E,k=15}else{var J=E,M=k;i=A;i>>=2;var D=1;k=17}}}}while(0);b:do{if(k==13){i=d+4|0,J=(s<<3)+p[i>>2]+37|0,M=s,i>>=2,D=0}else{if(k==15){h=p[e+12>>2];A=w;for(E=0;;){if(A=ve(p[(h+4>>2)+(E*5|0)])+(A+1)|0,E=E+1|0,(E|0)>=(u|0)){J=A;M=v;i=x;i>>=2;D=1;break b}}}}}while(0);A=ni(m,J);h=A>>2;k=A;if((A|0)==0){q=k}else{p[h]=o;E=o+36|0;p[h+1]=p[E>>2];var K=A+36|0,H=K,N=(M<<3)+H|0,Q=A+8|0;p[Q>>2]=N;Ah(N,p[d>>2],p[i]);l[N+p[i]|0]=0;Qt(N);N=N+p[i]+1|0;p[h+5]=M;g=(o+8|0)>>2;b:do{if(!q){for(var q=o+12|0,K=c+12|0,P=0;;){if((P|0)>=(M|0)){break b}for(var L=p[g],I=0;;){if((I|0)>=(L|0)){var X=L;break}if((qm(p[(p[q>>2]>>2)+(I*6|0)],p[(p[K>>2]+4>>2)+(P*5|0)])|0)==0){p[H+(P<<3)>>2]=I;X=p[g];break}I=I+1|0}if((I|0)>=(X|0)){break}P=P+1|0}d=p[(p[K>>2]+4>>2)+(P*5|0)];ym(b,R.Nj|0,(z=a,a+=4,p[z>>2]=d,z));q=k;break a}p[K>>2]=p[g]-1|0}while(0);q=D&(M|0)>0;b:do{if(q){g=e+12|0;K=0;for(P=N;;){if(L=ve(p[(p[g>>2]+4>>2)+(K*5|0)]),p[H+(K<<3)+4>>2]=P,Ah(P,p[(p[g>>2]+4>>2)+(K*5|0)],L),l[P+L|0]=0,P=L+(P+1)|0,K=K+1|0,(K|0)==(M|0)){break b}}}}while(0);l[A+24|0]=0;l[A+25|0]=f&255;l[A+26|0]=f>>>8&255;q=p[Q>>2];H=q=Ff(p[j+17]+56|0,q,ve(q),A);(q|0)==(A|0)?(l[m+30|0]=1,q=k):((q|0)!=0&&(p[h+3]=H,p[(q+16|0)>>2]=k),p[E>>2]=k,q=0)}}}}while(0);vf(m,q);Lu(m,c);Lu(m,e)}ev.X=1;function hv(b,c,d,e){var f,g=p[b>>2],h=l[g+30|0]<<24>>24==0;a:do{if(h){var i=(e|0)!=0;if(i){var j=g+33|0;l[j]=l[j]+1&255}var k=c+4|0,j=xm(b,d,p[c+8>>2],p[k>>2]);i&&(f=g+33|0,l[f]=l[f]-1&255);if((j|0)==0){i&&Kw(b,p[k>>2])}else{var i=rm(g,p[j+68>>2]),m=j+34|0;if(!((l[m]&16)<<24>>24!=0&&(Lw(b,j)|0)!=0)){f=(i|0)==1;var o=p[p[g+8>>2]+(i<<4)>>2];if((Ru(b,9,f?R.n|0:R.o|0,0,o)|0)==0){if(k=(d|0)!=0){var m=0,r=f?15:17}else{(l[m]&16)<<24>>24==0?(f=f?13:11,m=0,r=f):(m=p[p[iw(g,j)+4>>2]+4>>2],r=30)}f=(j|0)>>2;if((Ru(b,r,p[f],m,o)|0)==0&&(Ru(b,9,p[f],0,o)|0)==0){o=p[f];m=(te(o,R.N|0,7)|0)==0;do{if(m&&(te(o,R.Dj|0,11)|0)!=0){ym(b,R.Ej|0,(z=a,a+=4,p[z>>2]=o,z));break a}}while(0);m=(p[j+28>>2]|0)==0;do{if(k){if(!m){break}ym(b,R.Fj|0,(z=a,a+=4,p[z>>2]=o,z));break a}if(!m){ym(b,R.Ij|0,(z=a,a+=4,p[z>>2]=o,z));break a}}while(0);(Su(b)|0)!=0&&(pw(b,1,i),Mw(b,i,R.zb|0,p[f]),Nw(b,c,j),Ow(b,j,i,d))}}}}}}while(0);Mu(g,c)}hv.X=1;function iv(b,c,d,e,f,g,h){var i=a;a+=28;var j=i+8,k=i+24;p[k>>2]=0;var m=p[b>>2],o=(p[b+456>>2]|0)>0;a:do{if(o){ym(b,R.Cj|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z))}else{Uu(b,d,e,g,1,0,h);var r=p[b+504>>2],q=(r|0)==0;do{if(!q&&(p[b+64>>2]|0)==0){lw(b,d,e,k);d=(Fw(j,b,rm(m,p[r+68>>2]),R.ec|0,p[k>>2])|0)==0;do{if(!d&&(Pw(j,f)|0)!=0){Zf(m,f);break a}}while(0);j=Qw(m,f,1);p[(r+28|0)>>2]=j;Zf(m,f);if(l[m+30|0]<<24>>24!=0){break a}l[m+124|0]<<24>>24==0&&Lw(b,r);m=b+492|0;f=i;r=p[m>>2];m=p[m+4>>2];p[f>>2]=r;p[f+4>>2]=m;f=i|0;j=l[r];j<<24>>24==0||j<<24>>24==59||(m=r+m|0,r=p[f>>2]=m);m=i+4|0;p[m>>2]=0;c=p[c>>2];for(r=r-c|0;;){var j=r-1|0,s=c+j|0;if((r|0)<=0){break}if((l[R.e+(t[s]&255)|0]&1)<<24>>24==0){break}r=j}p[f>>2]=s;p[m>>2]=1;Vu(b,0,i,0);break a}}while(0)}Zf(m,f)}while(0);a=i}iv.X=1;function kv(b,c,d){var e,f,g,h,i,j,k,m,o,r,q,s,u,w,v,x,A,E,J,M,D,K,H=c>>2,N=a;a+=112;var Q;K=N>>2;var P=N+4;D=P>>2;var L=N+8;M=L>>2;var I=N+56,X=N+72;J=X>>2;var Y=N+108;E=Y>>2;A=(b+548|0)>>2;var da=y[A];x=(b+552|0)>>2;var ga=p[x];p[x]=ga+1|0;p[A]=ga;var ha=b|0,ba=y[ha>>2],ea=(c|0)==0;a:do{if(ea){var ja=1}else{var ra=ba+30|0;if(l[ra]<<24>>24!=0){ja=1}else{var Va=b+64|0;if((p[Va>>2]|0)!=0){ja=1}else{if((Ru(b,21,0,0,0)|0)!=0){ja=1}else{for(var ta=L|0,xa=ta>>2,Fa=xa+12;xa<Fa;xa++){p[xa]=0}var Na=d|0;v=(c+24|0)>>2;(t[Na]&255)<5&&(Lu(ba,p[v]),p[v]=0,n[(c+6|0)>>1]&=-2);Rw(b,c,0);p[K]=p[v];var Ea=c+8|0,La=p[Ea>>2];w=(c|0)>>2;var za=p[w],Ba=(p[Va>>2]|0)==0;b:do{if(Ba){if(l[ra]<<24>>24!=0){Q=146}else{u=(c+6|0)>>1;var Ja=Vc[u],ka=Su(b);if((ka|0)==0){Q=146}else{if((p[za>>2]|0)>1){if((l[d|0]-6&255)<2){ym(b,R.Bj|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),S=1}else{var S=0}}else{S=0}if((S|0)!=0){Q=146}else{var ib=c+28|0;s=(b+536|0)>>2;q=(b+72|0)>>2;for(var Wa=0,Za=(Ja&65535)>>>2&1,Sa=La;;){var tb=y[ib>>2],pb=(tb|0)==0;if(!pb){break}if((Wa|0)>=(n[Sa>>1]<<16>>16|0)){break}var fb=y[(Sa+20>>2)+(Wa*15|0)],Xa=(fb|0)==0;do{if(Xa){var Ab=Wa,rb=Za,cb=Sa}else{var Cb=Sa+Wa*60+24|0,Zb=p[Cb>>2];if((Zb|0)==0){var dc=Sw(c);p[s]=p[s]+dc|0;var kb=n[fb+6>>1]&4;if((Tw(b,c,Wa,Za,(kb&65535)>>>2&65535)|0)==0){var Oa=p[q]+1|0;p[q]=Oa;var Db=Sa+Wa*60+28|0;p[Db>>2]=Oa;var Wb=V(ka,7,0,Oa);p[Cb>>2]=Wb+1|0;var Nb=l[Sa+Wa*60+34|0]<<24>>24==0?Uw(b):0;uw(I,9,p[(Sa+36>>2)+(Wa*15|0)]);l[Sa+Wa*60+35|0]=p[x]&255;kv(b,fb,I);var $b=fb+68|0,Rb=(C[0]=p[$b>>2],C[1]=p[$b+4>>2],xd[0]);p[(p[(Sa+16>>2)+(Wa*15|0)]+24|0)>>2]=Rb>=0?Math.floor(Rb):Math.ceil(Rb);(Nb|0)!=0&&fw(ka,Nb);var Ra=qw(ka,3,p[Db>>2]);sm(ka,Wb,Ra);var Ob=b;l[Ob+19|0]=0;p[Ob+56>>2]=0;var Ua=Wa,Jb=Za}else{kb<<16>>16==0?(Ua=-1,Jb=Za):(n[u]|=4,Ua=-1,Jb=1)}if(l[ra]<<24>>24!=0){Q=146;break b}var Vb=Sw(c);p[s]=p[s]-Vb|0;var Pb=p[Ea>>2];(t[Na]&255)<5||(p[K]=p[v]);Ab=Ua;rb=Jb;cb=Pb}else{V(ka,2,p[(Sa+28>>2)+(Wa*15|0)],Zb),Ab=Wa,rb=Za,cb=Sa}}}while(0);Wa=Ab+1|0;Za=rb;Sa=cb}var sb=y[w],db=y[H+3];r=(c+16|0)>>2;var wb=y[r];p[D]=wb;var ob=y[H+5],Kb=Vc[u],ub=(Kb&1)<<16>>16!=0;if(pb){var Xb=p[K];var Sb=(Vw(wb,Xb)|0)==0?(p[ba+12>>2]&32|0)!=0?Xb:p[K]=0:Xb;if((Kb&5)<<16>>16==1){if((Vw(Sb,sb)|0)!=0){Q=42}else{n[u]=Kb&-2;var Qb=Ov(ba,sb,0);p[r]=Qb;p[D]=Qb;p[K]=0;var ac=-1;Q=44}}else{Q=42}if(Q==42){if((Sb|0)==0){ac=-1}else{var Gb=Ww(b,Sb),xb=b+68|0,Ta=p[xb>>2];p[xb>>2]=Ta+1|0;p[(p[K]+8|0)>>2]=Ta;var qb=p[K],bc=hw(ka,42,p[qb+8>>2],p[qb>>2]+2|0,0,Gb,-16),ac=p[H+16]=bc}}l[Na]<<24>>24==9&&V(ka,42,p[d+4>>2],p[sb>>2]);var $a=Xw(ka);o=(c+68|0)>>2;xd[0]=0x7ffffffffffffc00;p[o]=C[0];p[o+1]=C[1];Yw(b,c,$a);var mb=(ac|0)>-1;if((p[H+12]|0)==0&mb){l[Zw(ka,ac)|0]=43;var Bb=n[u]|64,bb=n[u]=Bb}else{bb=n[u]}if((bb&1)<<16>>16==0){var jb=-1,nb=-1}else{var zb=b+68|0,Tb=p[zb>>2];p[zb>>2]=Tb+1|0;var ec=Ww(b,p[w]),Hb=hw(ka,42,Tb,0,0,ec,-16);sw(ka,16);jb=Tb;nb=Hb}var Eb=(Za|0)==0,Lb=p[D],gb=(Lb|0)==0;do{if(Eb){if(gb){var Mb=$w(b,Sa,db,N,ub?p[w]:0,0);m=Mb>>2;if((Mb|0)==0){Q=146;break b}var vc=Mb+44|0,hc=(C[0]=p[vc>>2],C[1]=p[vc+4>>2],xd[0]),kc=(C[0]=p[o],C[1]=p[o+1],xd[0]);hc<kc?(xd[0]=hc,p[o]=C[0],p[o+1]=C[1]):Q=58;mb&&(p[K]|0)==0&&(Em(ka,ac),p[H+16]=-1);var pc=l[Mb+8|0];if(pc<<24>>24==0){var jc=jb}else{var mc=Zw(ka,nb);if(pc<<24>>24==2){var Fb=p[q],Ub=Fb+1|0;p[q]=Ub;var Ya=Fb+2|0;k=(sb|0)>>2;var Pa=p[k],yb=Ya+Pa|0;p[q]=(Pa<<1)+Ub|0;l[mc|0]=7;p[mc+4>>2]=1;p[mc+8>>2]=Ub;var Ka=sb+12|0;ax(b,p[k],p[Ka>>2],Ya,1);var Ac=p[ka+28>>2]+p[k]+1|0,Jc=Ac+2|0;V(ka,27,Ub,Ac+1|0);var uc=(p[k]|0)>0;c:do{if(uc){for(var Tc=0;;){var Yc=bx(b,p[(p[Ka>>2]>>2)+(Tc*5|0)]);gw(ka,75,Tc+Ya|0,Jc,Tc+yb|0);Dm(ka,-1,Yc,-4);sw(ka,-128);var ua=Tc+1|0;if((ua|0)>=(p[k]|0)){break c}Tc=ua}}}while(0);V(ka,1,0,p[m+5]);V(ka,7,0,Ub);gw(ka,13,Ya,yb,p[k])}else{l[mc|0]=-107}jc=-1}cx(b,c,sb,0,0,p[K],jc,d,p[m+5],p[m+6]);dx(Mb);var md=jc;Q=142}else{Q=69}}else{gb?(xd[0]=1,p[o]=C[0],p[o+1]=C[1],Q=79):Q=69}}while(0);do{if(Q==69){var nd=p[w],Bc=p[nd>>2];if((Bc|0)>0){for(var Qc=Bc,Oc=p[nd+12>>2];;){n[Oc+16>>1]=0;var ed=Qc-1|0;if((ed|0)<=0){break}Qc=ed;Oc=Oc+20|0}var Fc=p[D]}else{Fc=Lb}var ud=p[Fc>>2],Rc=(ud|0)>0;c:do{if(Rc){for(var Yb=ud,W=p[Fc+12>>2];;){n[W+16>>1]=0;var bd=Yb-1|0;if((bd|0)<=0){break c}Yb=bd;W=W+20|0}}}while(0);if((C[0]=p[o],C[1]=p[o+1],xd[0])>100){xd[0]=100,p[o]=C[0],p[o+1]=C[1]}Q=79}}while(0);if(Q==79){for(var hd=Xw(ka),xa=X>>2,Fa=xa+9;xa<Fa;xa++){p[xa]=0}p[J]=b;p[J+1]=Sa;p[J+7]=L;var eb=p[D],Uc=L+16|0;p[Uc>>2]=(eb|0)==0?0:p[eb>>2]+1|0;p[M+3]=eb;ex(X,sb);ex(X,p[K]);(ob|0)!=0&&fx(X,ob);j=(L+24|0)>>2;p[M+8]=p[j];var cd=L+40|0,vd=(p[cd>>2]|0)>0;c:do{if(vd){for(var id=L+36|0,Zc=0;;){ex(X,p[p[p[id>>2]+(Zc<<4)>>2]+16>>2]);var td=Zc+1|0;if((td|0)>=(p[cd>>2]|0)){break c}Zc=td}}}while(0);if(l[ra]<<24>>24!=0){Q=146;break}var zd=p[D];if((zd|0)==0){var Id=L+36|0,xc=gx(c,p[Id>>2]);i=xc>>2;if((xc|0)==0){p[E]=0;var qc=p[w],Gc;if((p[qc>>2]|0)==1){var Hc=p[p[qc+12>>2]>>2];if(l[Hc|0]<<24>>24!=-103){var zc=0}else{if((n[Hc+2>>1]&2048)<<16>>16!=0){zc=0}else{var Kc=p[Hc+16>>2];if((Kc|0)==0){zc=0}else{if((p[Kc>>2]|0)!=1){zc=0}else{if(l[p[p[Kc+12>>2]>>2]|0]<<24>>24!=-102){zc=0}else{var wd=p[Hc+4>>2],zc=(qm(wd,R.oa|0)|0)==0?1:(qm(wd,R.pa|0)|0)==0?2:0}}}}}}else{zc=0}Gc=zc;var be=Gc<<24>>24==0;if(be){var ge=0}else{var Xd=Ov(ba,p[p[p[qc+12>>2]>>2]+16>>2],0);p[E]=Xd;(Xd|0)==0?ge=0:(l[ra]<<24>>24==0&&(l[p[Xd+12>>2]+12|0]=Gc<<24>>24!=1&1,l[p[p[p[E]+12>>2]>>2]|0]=-104),ge=Xd)}hx(b,L);var rc=$w(b,Sa,db,Y,0,Gc&255);if((rc|0)==0){Lu(ba,ge);Q=146;break}ix(b,L);(p[E]|0)!=0|be||V(ka,1,0,p[rc+24>>2]);dx(rc);jx(p[b+12>>2],L);var Lc=ge}else{var Jd=rm(p[ha>>2],p[i+17]),Qd=b+68|0,Fd=p[Qd>>2];p[Qd>>2]=Fd+1|0;var Cd=xc+20|0,ce=p[Cd>>2];ow(b,Jd);kx(b,Jd,p[Cd>>2],0,p[i]);var Yd=p[i+4],Mc=(Yd|0)==0;do{if(Mc){$c=0,Q=127}else{for(var jd=0,gc=Yd;;){var fd=l[gc+26|0]<<24>>24==0?(jd|0)!=0&&(p[gc+4>>2]|0)>=(p[jd+4>>2]|0)?jd:gc:jd,Sd=p[gc+32>>2];if((Sd|0)==0){break}jd=fd;gc=Sd}if((fd|0)==0){var $c=0;Q=127}else{if((p[fd+4>>2]|0)<(p[i+2]|0)){var Ad=p[fd+20>>2],Xe=lx(b,fd);gw(ka,39,Fd,Ad,Jd);if((Xe|0)==0){var ef=fd}else{Dm(ka,-1,Xe,-16),ef=fd}Q=130}else{$c=fd,Q=127}}}}while(0);Q==127&&(gw(ka,39,Fd,ce,Jd),ef=$c);V(ka,32,Fd,p[p[Id>>2]+8>>2]);qw(ka,45,Fd);var oe=b;if(l[oe+480|0]<<24>>24==2){var wf=p[xc>>2],Kd=(ef|0)!=0,ue=Kd?R.oj|0:xh|0,xf=Kd?p[ef>>2]:xh|0,Ge=p[xc+24>>2],yf=zm(p[oe>>2],R.nj|0,(z=a,a+=16,p[z>>2]=wf,p[z+4>>2]=ue,p[z+8>>2]=xf,p[z+12>>2]=Ge,z));hw(p[oe+12>>2],150,p[oe+548>>2],0,0,yf,-1)}Lc=0}p[K]=0;mx(b,ob,hd,8);cx(b,c,p[w],0,0,0,-1,d,hd,hd);Lu(ba,Lc)}else{h=(b+68|0)>>2;var Re=p[h];p[h]=Re+1|0;g=(L+4|0)>>2;p[g]=Re;var Se=Ww(b,zd),tc=hw(ka,43,p[g],p[Uc>>2],0,Se,-16),ff=p[q],he=ff+1|0,je=ff+2|0,de=ff+3|0;p[q]=de;var Me=Xw(ka),od=p[q]+1|0;p[q]=od;var ke=Xw(ka),Zd=p[q],le=Zd+1|0,ye=p[D]|0,zf=p[ye>>2]+Zd|0;p[q]=zf;var Ye=zf+1|0;p[q]=p[ye>>2]+zf|0;V(ka,7,0,je);V(ka,7,0,he);gw(ka,10,0,le,p[p[D]>>2]+Zd|0);V(ka,2,od,ke);var Ze=$w(b,Sa,db,P,0,0);if((Ze|0)==0){Q=146;break}if((p[D]|0)==0){p[D]=p[r];var Ae=0,Sf=0,cg=0}else{nx(b,ub?(n[u]&1)<<16>>16!=0?R.dc|0:R.cc|0:R.dc|0);var If=p[p[D]>>2],Jf=If+1|0,Cg=p[j],Kf=(Cg|0)>0;c:do{if(Kf){for(var Sg=p[M+5],Lf=Jf,Te=Jf,gf=0;;){if((p[(Sg+12>>2)+(gf*6|0)]|0)<(Te|0)){var sg=Te,Mf=Lf}else{sg=Te+1|0,Mf=Lf+1|0}var He=gf+1|0;if((He|0)>=(Cg|0)){var $e=Mf;break c}Lf=Mf;Te=sg;gf=He}}else{$e=Jf}}while(0);var Ne=ox(b,$e);px(b);var Ue=p[D];ax(b,p[Ue>>2],p[Ue+12>>2],Ne,0);V(ka,55,p[g],Ne+If|0);var hf=p[j],Dg=(hf|0)>0;c:do{if(Dg){for(var me=L+20|0,jf=Jf,$d=0,Nf=hf;;){f=p[me>>2]>>2;if((p[f+($d*6|0)+3]|0)<(jf|0)){var Eg=jf,tg=Nf}else{var dg=jf+Ne|0,eg=qx(b,p[f+($d*6|0)],p[f+($d*6|0)+2],p[f+($d*6|0)+1],dg);(dg|0)!=(eg|0)&&V(ka,15,eg,dg);Eg=jf+1|0;tg=p[j]}var Af=$d+1|0;if((Af|0)>=(tg|0)){break c}jf=Eg;$d=Af;Nf=tg}}}while(0);var Md=rx(b);gw(ka,31,Ne,$e,Md);V(ka,96,p[g],Md);sx(b,Md);tx(b,Ne,$e);dx(Ze);var Tf=p[h];p[h]=Tf+1|0;p[M+2]=Tf;var Tg=rx(b);gw(ka,44,Tf,Tg,$e);V(ka,70,p[g],hd);l[L+1|0]=1;px(b);Ae=Tg;Sf=Tf;cg=1}e=(ka+28|0)>>2;var Of=p[e];px(b);cg&&V(ka,62,p[g],Ae);var Uf=p[D],kf=p[Uf>>2],Vf=(kf|0)>0;c:do{if(Vf){if(cg){for(var af=0;;){gw(ka,29,Sf,af,af+Ye|0);(af|0)==0&&sw(ka,32);var Ug=af+1|0,ug=p[p[D]>>2];if((Ug|0)>=(ug|0)){var ie=ug;break c}af=Ug}}else{for(var lf=0,mh=Uf;;){l[ta]=1;ux(b,p[(p[mh+12>>2]>>2)+(lf*5|0)],lf+Ye|0);var Fg=p[D],fg=lf+1|0,gg=p[Fg>>2];if((fg|0)>=(gg|0)){ie=gg;break c}lf=fg;mh=Fg}}}else{ie=kf}}while(0);hw(ka,24,le,Ye,ie,Se,-6);var Ie=p[e],Pf=Ie+1|0;gw(ka,25,Pf,0,Pf);vx(b,Ye,le,p[p[D]>>2]);V(ka,2,de,Me);V(ka,120,je,hd);V(ka,2,od,ke);fw(ka,Ie);ix(b,L);V(ka,7,1,he);cg?V(ka,81,p[g],Of):(dx(Ze),Em(ka,tc));V(ka,2,de,Me);V(ka,1,0,hd);var Vg=p[e];V(ka,7,1,je);qw(ka,3,de);wx(ka,Me);var hg=p[e];V(ka,120,he,hg+2|0);qw(ka,3,de);jx(p[b+12>>2],L);var Gg=hg+1|0;mx(b,ob,Gg,8);cx(b,c,p[w],0,0,p[K],jb,d,Gg,Vg);qw(ka,3,de);wx(ka,ke);hx(b,L);qw(ka,3,od)}wx(ka,hd);md=jb}(md|0)>-1&&nx(b,R.cc|0);(p[K]|0)!=0&&(nx(b,R.mj|0),xx(b,c,ka,p[sb>>2],d));wx(ka,$a);p[A]=da;if(l[Na]<<24>>24!=5){var ig=0}else{yx(b,Sa,sb),ig=0}Q=149}else{var jg=(p[H+9]|0)==0;do{if(jg){for(var Wf=c,vg=0,kg=1,lg=tb;;){p[Wf+36>>2]=c;p[Wf+32>>2]=vg;if((lg|0)==0){break}vg=Wf;Wf=lg;kg=kg+1|0;lg=p[lg+28>>2]}var Bf=p[ba+88>>2];if((Bf|0)!=0&(kg|0)>(Bf|0)){ym(b,R.kj|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));Q=146;break b}}}while(0);var bf=zx(b,c,d);p[A]=da;ja=bf;break a}}}}}else{Q=146}}while(0);Q==146&&(p[A]=da,ig=1);vf(ba,p[M+5]);vf(ba,p[M+9]);ja=ig}}}}}while(0);a=N;return ja}kv.X=1;function pv(b){if((b|0)!=0){var c=n[b>>1]<<16>>16,d=c-1|0,e=(d|0)>0;a:do{if(e){for(var f=c,g=d;;){l[b+g*60+32|0]=l[b+(f-2)*60+32|0];var h=g-1|0;if((h|0)<=0){break a}f=g;g=h}}}while(0);l[b+32|0]=0}}function lv(b,c,d,e,f,g,h,i,j,k){var m=a;a+=76;var o=b|0,b=y[o>>2],r=ni(b,76);if((r|0)==0){for(var r=m>>2,q=r+19;r<q;r++){p[r]=0}r=m}(c|0)==0&&(c=ov(b,113,0),c=mv(p[o>>2],0,c));p[r>>2]=c;p[r+8>>2]=d;p[r+12>>2]=e;p[r+16>>2]=f;p[r+20>>2]=g;p[r+24>>2]=h;n[r+6>>1]=(i|0)!=0&1;l[r+4|0]=116;p[r+40>>2]=j;p[r+44>>2]=k;p[r+56>>2]=-1;p[r+60>>2]=-1;p[r+64>>2]=-1;l[b+30|0]<<24>>24==0?d=r:(Nu(b,r),(r|0)!=(m|0)&&vf(b,r),d=0);a=m;return d}lv.X=1;function mv(b,c,d){var e;if((c|0)==0){if(c=ni(b,16),(c|0)==0){var f=c,c=7}else{var g=c,c=3}}else{g=c,c=3}do{if(c==3){var h=g+4|0,i=p[h>>2];e=(g|0)>>2;var j=y[e],c=(g+12|0)>>2;if((i|0)>(j|0)){var k=j}else{i=Il(b,p[c],i*40+80|0);if((i|0)==0){f=g;c=7;break}p[c]=i;k=Dl(b,i);p[h>>2]=Math.floor((k>>>0)/20);k=p[e]}p[e]=k+1|0;k=p[c]+k*20|0;Ed(k,0,20);p[(k|0)>>2]=d;k=g;c=8}}while(0);c==7&&(Df(b,d),Lu(b,f),k=0);return k}function nv(b,c,d,e){if((c|0)!=0){var f=p[c>>2]-1|0,c=p[c+12>>2],b=Mm(p[b>>2],p[d>>2],p[d+4>>2]);p[(c+f*20+4|0)>>2]=b;(e|0)==0|(b|0)==0||Qt(b)}}function ov(b,c,d){var e=a;a+=8;p[e>>2]=d;p[e+4>>2]=(d|0)==0?0:ve(d);b=Bw(b,c,e,0);a=e;return b}function qv(b,c,d,e,f,g,h,i){var j=p[b>>2];if((c|0)==0){var k=(h|0)!=0;(i|0)==0&(k^1)?b=4:(k=k?R.ij|0:R.jj|0,ym(b,R.hj|0,(z=a,a+=4,p[z>>2]=k,z)),b=9)}else{b=4}if(b==4){if(c=sv(j,c,d,e),(c|0)==0){b=9}else{if(d=n[c>>1],d<<16>>16==0){b=9}else{var m=(d<<16>>16)-1|0;(p[f+4>>2]|0)!=0&&(f=Xu(j,f),p[(c+m*60+12|0)>>2]=f);p[(c+m*60+20|0)>>2]=g;p[(c+m*60+40|0)>>2]=h;p[(c+m*60+44|0)>>2]=i;m=c;b=10}}}b==9&&(Df(j,h),Ef(j,i),Zf(j,g),m=0);return m}function rv(b,c,d){var e=(c|0)==0;a:do{if(!e){var f=n[c>>1];if(f<<16>>16>0){var f=(f<<16>>16)-1|0,g=(p[d+4>>2]|0)==1;do{if(g&&(p[d>>2]|0)==0){l[c+f*60+33|0]=1;break a}}while(0);g=Xu(p[b>>2],d);p[(c+56>>2)+(f*15|0)]=g}}}while(0)}function sv(b,c,d,e){if((c|0)==0){if(c=ni(b,64),(c|0)==0){var f=0,c=10}else{n[c+2>>1]=1;var g=c,c=4}}else{g=c,c=4}if(c==4){if(f=Ax(b,g,1,n[g>>1]<<16>>16),l[b+30|0]<<24>>24==0){var g=(n[f>>1]<<16>>16)-1|0,c=(e|0)==0?0:(p[e>>2]|0)!=0?e:0,h=(c|0)==0,e=h?0:d,d=Xu(b,h?d:c);p[(f+8>>2)+(g*15|0)]=d;b=Xu(b,e);p[(f+4>>2)+(g*15|0)]=b}else{Mu(b,f),f=0}}return f}function tv(b,c,d,e){var f,g=a;a+=12;f=g>>2;p[f]=c;p[f+1]=d;p[f+2]=e;var h=0,i=0;a:for(;;){if((h|0)>=3){var j=i;break}var k=p[(h<<2>>2)+f];if((k|0)==0){j=i;break}var m=k+4|0,o=k|0,k=0;b:for(;;){if((k|0)>=7){var r=i;break}var q=y[m>>2],s=(q|0)==(t[Bx+k*3+1|0]&255|0);do{if(s&&(te(p[o>>2],R.jr+(t[Bx+k*3|0]&255)|0,q)|0)==0){i|=t[Bx+k*3+2|0]&255;if((k|0)>6){r=i;break b}h=h+1|0;continue a}}while(0);k=k+1|0}j=r|64;break}f=(j&33|0)!=33&(j&64|0)==0;do{if(f){if((j&32|0)==0|(j&24|0)==8){h=j;break}ym(b,R.gj|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z))}else{h=(e|0)==0?R.W+1|0:R.W|0,ym(b,R.fj|0,(z=a,a+=16,p[z>>2]=c,p[z+4>>2]=d,p[z+8>>2]=h,p[z+12>>2]=e,z))}h=1}while(0);a=g;return h}tv.X=1;function uv(b,c,d){var e,f,g,h,i,j=a;a+=44;var k,m=j+8;p[j>>2]=0;p[j+4>>2]=0;var o=b|0,r=y[o>>2],q=(p[b+64>>2]|0)==0;a:do{if(q&&l[r+30|0]<<24>>24==0){var s=Ew(b,c);i=s>>2;if((s|0)!=0){var u=Cx(b,s,106,0,0),w=(p[i+7]|0)!=0;if((Lw(b,s)|0)==0){var v=(u|0)!=0;if((Dx(b,s,v&1)|0)==0){var x=rm(r,p[i+17]);f=p[p[r+8>>2]+(x<<4)>>2];h=(s|0)>>2;var A=Ru(b,9,p[h],0,f);if((A|0)!=1){g=(b+68|0)>>2;var E=y[g];p[g]=E+1|0;p[c+36>>2]=E;f=(s+16|0)>>2;var J=p[f];e=(J|0)==0;b:do{if(e){k=10}else{for(var M=J,D=p[g];;){if(D=D+1|0,p[g]=D,M=p[M+32>>2],(M|0)==0){break b}}}}while(0);w&&Ex(b,j,p[h]);g=Su(b);if((g|0)!=0){J=b+18|0;l[J]<<24>>24==0&&(l[g+98|0]=1);pw(b,1,x);w&&Fx(b,s,d,E);e=m>>2;for(M=e+9;e<M;e++){p[e]=0}p[m>>2]=b;p[m+4>>2]=c;if((tw(m,d)|0)==0){e=(r+12|0)>>2;(p[e]&4096|0)==0?M=-1:(M=b+72|0,D=p[M>>2]+1|0,p[M>>2]=D,V(g,7,0,D),M=D);v|=(d|0)!=0|(A|0)!=0;b:do{if(v){k=25}else{if((l[s+34|0]&16)<<24>>24!=0){k=25}else{if((Gx(p[p[o>>2]+12>>2],s,0,0)|0)!=0){k=25}else{if(hw(g,103,p[i+5],x,M,p[h],-2),A=p[f],(A|0)==0){k=38}else{for(;;){if(V(g,103,p[A+20>>2],x),A=p[A+32>>2],(A|0)==0){k=38;break b}}}}}}}while(0);do{if(k==25){x=b+72|0;h=p[x>>2];i=h+1|0;h=h+2|0;p[x>>2]=h;V(g,10,0,i);x=$w(b,c,d,0,0,8);if((x|0)==0){break a}v=qx(b,s,-1,E,h);V(g,112,i,v);(p[e]&4096|0)!=0&&V(g,20,M,1);dx(x);x=Xw(g);w||Hx(b,s,E,40);i=gw(g,113,i,x,h);v=s+34|0;(l[v]&16)<<24>>24==0?Ix(b,s,E,h,l[J]<<24>>24==0&1,u,99):(A=iw(r,s),Jx(b,s),hw(g,140,0,1,h,A,-10),sw(g,2),Kx(b));V(g,1,0,i);wx(g,x);if(!w&&(l[v]&16)<<24>>24==0){h=p[f];i=(h|0)==0;b:do{if(!i){x=1;for(v=h;;){V(g,45,x+E|0,p[v+20>>2]);v=p[v+32>>2];if((v|0)==0){break b}x=x+1|0}}}while(0);qw(g,45,E)}}}while(0);l[J]<<24>>24==0&&(p[b+432>>2]|0)==0&&Lx(b);(p[e]&4096|0)!=0&&l[J]<<24>>24==0&&(p[b+432>>2]|0)==0&&(V(g,16,M,1),Sx(g,1),Az(g,0,0,R.ej|0,0))}}}}}}}}while(0);Kz(j);Mu(r,c);Df(r,d);a=j}uv.X=1;function vv(b,c,d){(c|0)!=0&&(p[c>>2]|0)>(p[p[b>>2]+80>>2]|0)&&ym(b,R.dj|0,(z=a,a+=4,p[z>>2]=d,z))}function wv(b,c,d,e,f){var g,h,i,j,k,m,o,r,q,s,u,w=b>>2,v=a;a+=48;var x,A=v+8,E=v+44;u=E>>2;p[v>>2]=0;p[v+4>>2]=0;s=(b|0)>>2;var J=p[s],M=(p[w+16]|0)==0;a:do{if(M){if(l[J+30|0]<<24>>24!=0){var D=c,K=e,H=0,N=0}else{var Q=Ew(b,c);if((Q|0)==0){D=c,K=e,N=H=0}else{var P=rm(p[s],p[Q+68>>2]),L=Cx(b,Q,107,d,E),I=(p[Q+28>>2]|0)!=0;if((Lw(b,Q)|0)!=0){D=c,K=e,N=H=0}else{if((Dx(b,Q,p[u])|0)!=0){D=c,K=e,N=H=0}else{q=(Q+8|0)>>2;var X=zh(J,p[q]<<2),Y=X;r=Y>>2;if((X|0)==0){D=c,K=e,H=0}else{var da=(p[q]|0)>0;b:do{if(da){for(var ga=0;;){p[((ga<<2)+Y|0)>>2]=-1;var ha=ga+1|0;if((ha|0)>=(p[q]|0)){break b}ga=ha}}}while(0);o=(b+68|0)>>2;var ba=p[o],ea=ba+1|0;p[o]=ea;p[c+36>>2]=ba;var ja=Q+16|0;m=ja>>2;var ra=p[m],Va=(ra|0)==0;b:do{if(!Va){for(var ta=ra,xa=p[o];;){var Fa=xa+1|0;p[o]=Fa;var Na=p[ta+32>>2];if((Na|0)==0){break b}ta=Na;xa=Fa}}}while(0);for(var Ea=A>>2,La=Ea+9;Ea<La;Ea++){p[Ea]=0}p[A>>2]=b;p[A+4>>2]=c;var za=d|0;k=(d+12|0)>>2;var Ba=Q+12|0;j=(Q+4|0)>>2;for(var Ja=Q|0,ka=J+8|0,S=0,ib=0,Wa=0;;){if((S|0)>=(p[za>>2]|0)){break}if((tw(A,p[(p[k]>>2)+(S*5|0)])|0)!=0){D=c;K=e;H=0;N=Y;break a}for(var Za=p[q],Sa=0;;){if((Sa|0)>=(Za|0)){var tb=ib,pb=Wa,fb=Za;break}var Xa=p[k];if((qm(p[(p[Ba>>2]>>2)+(Sa*6|0)],p[(Xa+4>>2)+(S*5|0)])|0)==0){if((Sa|0)==(p[j]|0)){var Ab=p[(Xa>>2)+(S*5|0)],rb=1}else{Ab=ib,rb=Wa}p[((Sa<<2)+Y|0)>>2]=S;tb=Ab;pb=rb;fb=p[q];break}Sa=Sa+1|0}if((Sa|0)<(fb|0)){var cb=tb,Cb=pb}else{var Zb=p[k],dc=p[(Zb+4>>2)+(S*5|0)];if((aA(dc)|0)==0){ym(b,R.$i|0,(z=a,a+=4,p[z>>2]=dc,z));l[b+17|0]=1;D=c;K=e;H=0;N=Y;break a}cb=p[(Zb>>2)+(S*5|0)];Cb=1}var kb=Ru(b,23,p[Ja>>2],p[(p[Ba>>2]>>2)+(Sa*6|0)],p[p[ka>>2]+(P<<4)>>2]);if((kb|0)==1){D=c;K=e;H=0;N=Y;break a}else{(kb|0)==2&&(p[((Sa<<2)+Y|0)>>2]=-1)}S=S+1|0;ib=cb;Wa=Cb}var Oa=Gx(p[p[s]+12>>2],Q,Y,Wa),Db=p[m],Wb=(Db|0)==0;b:do{if(Wb){var Nb=0}else{for(var $b=0,Rb=Db;;){var Ra=$b+1|0,Ob=p[Rb+32>>2];if((Ob|0)==0){break}$b=Ra;Rb=Ob}if((Ra|0)>0){var Ua=zh(J,Ra<<2),Jb=Ua;if((Ua|0)==0){D=c;K=e;H=Jb;N=Y;break a}var Vb=Jb,Pb=p[m]}else{Vb=0,Pb=Db}if((Pb|0)==0){Nb=Vb}else{if(i=(b+72|0)>>2,(Oa|Wa|0)==0){for(var sb=0,db=Pb;;){for(var wb=p[db+4>>2],ob=db+8|0,Kb=0;;){if((Kb|0)>=(wb|0)){var ub=0;break}if((p[(p[p[ob>>2]+(Kb<<2)>>2]<<2>>2)+r]|0)>-1){var Xb=p[i]+1|0,ub=p[i]=Xb;break}Kb=Kb+1|0}p[Vb+(sb<<2)>>2]=ub;var Sb=p[db+32>>2];if((Sb|0)==0){Nb=Vb;break b}sb=sb+1|0;db=Sb}}else{for(var Qb=0,ac=Pb;;){var Gb=p[i]+1|0;p[i]=Gb;p[Vb+(Qb<<2)>>2]=Gb;var xb=p[ac+32>>2];if((xb|0)==0){Nb=Vb;break b}Qb=Qb+1|0;ac=xb}}}}}while(0);var Ta=Su(b);if((Ta|0)==0){D=c,K=e}else{var qb=b+18|0;l[qb]<<24>>24==0&&(l[Ta+98|0]=1);pw(b,1,P);if((l[Q+34|0]&16)<<24>>24==0){h=(b+72|0)>>2;var bc=p[h],$a=bc+1|0,mb=bc+2|0;p[h]=mb;var Bb=(L|0)!=0,bb=(Oa|0)==0;if(bb&(Bb^1)){var jb=0,nb=mb}else{var zb=bc+3|0,Tb=p[q]+mb|0;p[h]=Tb;jb=zb;nb=Tb}var ec=(Wa|0)!=0;if(bb&((ec|Bb)^1)){var Hb=mb,Eb=nb}else{var Lb=nb+1|0,Eb=Hb=p[h]=Lb}var gb=Eb+1|0;p[h]=p[q]+Eb|0;I&&(Ex(b,v,p[Ja>>2]),Fx(b,Q,e,ba));if((tw(A,e)|0)!=0){D=c;K=e;H=Nb;N=Y;break}gw(Ta,10,0,$a,mb);var Mb=$w(b,c,e,0,0,4);if((Mb|0)==0){D=c;K=e;H=Nb;N=Y;break}var vc=l[Mb+6|0];V(Ta,65,ba,mb);var hc=vc<<24>>24!=0;hc||V(Ta,112,$a,mb);dx(Mb);g=(J+12|0)>>2;if((p[g]&4096|0)==0){var kc=0}else{if((p[w+108]|0)!=0){kc=0}else{var pc=p[h]+1|0;p[h]=pc;V(Ta,7,0,pc);kc=pc}}b:do{if(I){var jc=0}else{hc||eA(b,ba,P,Q,40);var mc=(f|0)==5;c:do{if(mc){var Fb=1}else{for(var Ub=ja;;){var Ya=p[Ub>>2];if((Ya|0)==0){Fb=0;break c}if(l[Ya+24|0]<<24>>24==5){Fb=1;break c}Ub=Ya+32|0}}}while(0);var Pa=p[m];if((Pa|0)==0){jc=Fb}else{if((Fb|0)==0){for(var yb=0,Ka=Pa;;){if((p[Nb+(yb<<2)>>2]|0)>0){var Ac=lx(b,Ka);hw(Ta,40,ea+yb|0,p[Ka+20>>2],P,Ac,-16)}var Jc=p[Ka+32>>2];if((Jc|0)==0){jc=Fb;break b}yb=yb+1|0;Ka=Jc}}else{for(var uc=0,Tc=Pa;;){var Yc=lx(b,Tc);hw(Ta,40,ea+uc|0,p[Tc+20>>2],P,Yc,-16);var ua=p[Tc+32>>2];if((ua|0)==0){jc=Fb;break b}uc=uc+1|0;Tc=ua}}}}}while(0);if(hc){var md=qw(Ta,74,mb),nd=ew(Ta,1);fw(Ta,md);var Bc=nd}else{Bc=gw(Ta,113,$a,0,mb)}gw(Ta,54,ba,Bc,mb);ec&&(ux(b,ib,Hb),qw(Ta,21,Hb));var Qc=(Oa|0)!=0,Oc=Qc|Bb;do{if(Oc){var ed=Qc?hA(b,Q):0,Fc=jA(b,L,d,0,3,Q,f)|ed,ud=(p[q]|0)>0;b:do{if(ud){if((Fc|0)==-1){for(var Rc=0;;){LA(Ta,Q,ba,Rc,Rc+jb|0);var Yb=Rc+1|0;if((Yb|0)>=(p[q]|0)){break b}Rc=Yb}}else{for(var W=0;;){(p[(W<<2>>2)+r]|0)<0?x=88:(W|0)<32&&(1<<W&Fc|0)!=0?x=88:(V(Ta,10,0,W+jb|0),x=90);x==88&&LA(Ta,Q,ba,W,W+jb|0);var bd=W+1|0;if((bd|0)>=(p[q]|0)){break b}W=bd}}}}while(0);(Wa|0)==0&&V(Ta,14,mb,Hb)}}while(0);var hd=jA(b,L,d,1,1,Q,f);gw(Ta,10,0,gb,p[q]+Eb|0);var eb=p[q],Uc=(eb|0)>0;b:do{if(Uc){for(var cd=0;;){if((cd|0)!=(p[j]|0)){var vd=p[(cd<<2>>2)+r];if((vd|0)>-1){ux(b,p[(p[k]>>2)+(vd*5|0)],cd+gb|0)}else{if((p[u]&1|0)==0|(cd|0)>31||(1<<cd&hd|0)!=0){var id=cd+gb|0;gw(Ta,29,ba,cd,id);XA(Ta,Q,cd,id)}}}var Zc=cd+1|0,td=p[q];if((Zc|0)>=(td|0)){var zd=td;break b}cd=Zc}}else{zd=eb}}while(0);var Id=(p[u]&1|0)==0;b:do{if(Id){x=107}else{V(Ta,30,gb,zd);qB(Ta,Q);rB(b,L,107,d,1,Q,mb,f,Bc);gw(Ta,54,ba,Bc,mb);var xc=p[q];if((xc|0)>0){for(var qc=0,Gc=xc;;){if((p[(qc<<2>>2)+r]|0)<0){if((qc|0)==(p[j]|0)){var Hc=Gc}else{var zc=qc+gb|0;gw(Ta,29,ba,qc,zc);XA(Ta,Q,qc,zc);Hc=p[q]}}else{Hc=Gc}var Kc=qc+1|0;if((Kc|0)>=(Hc|0)){break b}qc=Kc;Gc=Hc}}}}while(0);if(!I){QB(b,Q,ba,Hb,Nb,ec?mb:0,1,f,Bc,0);Qc&&TB(b,Q,mb,0);var wd=gw(Ta,54,ba,0,mb);UB(b,p[m],ba,Nb);(Oa|Wa|0)!=0&&V(Ta,59,ba,0);fw(Ta,wd);Qc?(TB(b,Q,0,Hb),VB(b,Q,ba,Hb,Nb,1,0,0),WB(b,Q,d,mb)):VB(b,Q,ba,Hb,Nb,1,0,0)}(p[g]&4096|0)!=0&&(p[w+108]|0)==0&&V(Ta,20,kc,1);rB(b,L,107,d,2,Q,mb,f,Bc);V(Ta,1,0,Bc);fw(Ta,Bc);var be=p[m],ge=(be|0)==0;b:do{if(!ge){if((jc|0)==0){for(var Xd=0,rc=be;;){(p[Nb+(Xd<<2)>>2]|0)>0&&V(Ta,45,ea+Xd|0,0);var Lc=p[rc+32>>2];if((Lc|0)==0){break b}Xd=Xd+1|0;rc=Lc}}else{for(var Jd=0,Qd=be;;){V(Ta,45,ea+Jd|0,0);var Fd=p[Qd+32>>2];if((Fd|0)==0){break b}Jd=Jd+1|0;Qd=Fd}}}}while(0);V(Ta,45,ba,0);l[qb]<<24>>24==0&&(p[w+108]|0)==0&&Lx(b);if((p[g]&4096|0)==0){D=c;K=e;H=Nb;N=Y;break}if((p[w+108]|0)!=0){D=c;K=e;H=Nb;N=Y;break}if(l[qb]<<24>>24!=0){D=c;K=e;H=Nb;N=Y;break}V(Ta,16,kc,1);Sx(Ta,1);Az(Ta,0,0,R.aj|0,0);D=c;K=e}else{XB(b,c,Q,d,ib,Y,e,f),K=D=0}}H=Nb}N=Y}}}}}else{D=c,K=e,N=H=0}}while(0);Kz(v);vf(J,H);vf(J,N);Mu(J,D);Lu(J,d);Df(J,K);a=v}wv.X=1;function xv(b,c,d,e,f,g){var h,i,j,k,m,o,r,q,s,u=a;a+=60;var w,v=u+16,x=u+20,A=u+56,E=y[b>>2];s=(u|0)>>2;p[s]=0;p[s+1]=0;p[s+2]=0;p[s+3]=0;var J=b+64|0,M=(p[J>>2]|0)==0;a:do{if(M){var D=E+30|0;if(l[D]<<24>>24!=0){var K=0}else{if((p[c+8>>2]|0)==0){K=0}else{var H=Ew(b,c);q=H>>2;if((H|0)==0){K=0}else{var N=rm(E,p[q+17]);if((Ru(b,18,p[q],0,p[p[E+8>>2]+(N<<4)>>2])|0)!=0){K=0}else{var Q=Cx(b,H,105,0,v),P=(p[q+7]|0)!=0;if((Lw(b,H)|0)!=0){K=0}else{if((Dx(b,H,p[v>>2])|0)!=0){K=0}else{var L=Su(b);r=L>>2;if((L|0)==0){K=0}else{var I=b+18|0;l[I]<<24>>24==0&&(l[L+98|0]=1);var X=(e|0)!=0;pw(b,(X|(Q|0)!=0)&1,N);var Y=(f|0)==0;if(Y){if((YB(b,H,e,g,N)|0)==0){w=13}else{var da=0,ga=0;w=145}}else{w=13}b:do{if(w==13){var ha=ZB(b,N,H);c:do{if(X){o=(b+72|0)>>2;var ba=p[o]+1|0;p[o]=ba;V(L,7,0,ba);var ea=p[o]+1|0;p[o]=ea;uw(u,10,ea);var ja=p[r+7],ra=ja+2|0,Va=u+4|0;V(L,7,ja+1|0,p[Va>>2]);var ta=V(L,1,0,0);if((kv(b,e,u)|0)!=0){K=0;break a}if((p[J>>2]|0)!=0){K=0;break a}if(l[D]<<24>>24!=0){K=0;break a}V(L,7,1,ba);var xa=y[Va>>2];qw(L,4,xa);V(L,6,2,2);fw(L,ta);var Fa=y[u+8>>2],Na=y[p[e>>2]>>2];if((Q|0)==0&&($B(b,ra,N,H)|0)==0){var Ea=ba,La=Fa,za=Na,Ba=0,Ja=0,ka=xa}else{var S=b+68|0,ib=p[S>>2];p[S>>2]=ib+1|0;var Wa=rx(b),Za=rx(b);V(L,42,ib,Na);var Sa=qw(L,4,xa),tb=qw(L,27,ba);gw(L,31,Fa,Na,Wa);V(L,56,ib,Za);gw(L,57,ib,Wa,Za);V(L,1,0,Sa);fw(L,tb);sx(b,Wa);sx(b,Za);Ea=ba;La=Fa;za=Na;Ba=ib;Ja=1;ka=xa}}else{for(var pb=x>>2,fb=pb+9;pb<fb;pb++){p[pb]=0}p[x>>2]=b;for(var Xa=(d|0)==0?0:p[d>>2],Ab=d+12|0,rb=0;;){if((rb|0)>=(Xa|0)){La=Ea=0;za=Xa;Ba=-1;ka=Ja=0;break c}if((tw(x,p[(p[Ab>>2]>>2)+(rb*5|0)])|0)!=0){K=0;break a}rb=rb+1|0}}}while(0);var cb=H+34|0,Cb=(l[cb]&16)<<24>>24==0;c:do{if(Cb){var Zb=0}else{var dc=y[q+2];if((dc|0)>0){for(var kb=p[q+3],Oa=0,Db=0;;){var Wb=(l[kb+Db*24+23|0]<<24>>24!=0&1)+Oa|0,Nb=Db+1|0;if((Nb|0)>=(dc|0)){Zb=Wb;break c}Oa=Wb;Db=Nb}}else{Zb=0}}}while(0);var $b=(za|0)==0,Rb=$b|Y^1;do{if(!Rb){var Ra=p[q+2]-Zb|0;if((za|0)!=(Ra|0)){ym(b,R.li|0,(z=a,a+=16,p[z>>2]=c,p[z+4>>2]=0,p[z+8>>2]=Ra,p[z+12>>2]=za,z));K=0;break a}}}while(0);var Ob=(f|0)!=0;c:do{if(Ob){m=(f+4|0)>>2;var Ua=p[m];if((za|0)==(Ua|0)){var Jb=(Ua|0)>0;k=(f|0)>>2;d:do{if(Jb){for(var Vb=0;;){p[((Vb<<3)+p[k]+4|0)>>2]=-1;var Pb=Vb+1|0,sb=p[m];if((Pb|0)>=(sb|0)){var db=sb;break d}Vb=Pb}}else{db=Ua}}while(0);for(var wb=H+8|0,ob=H+12|0,Kb=H+4|0,ub=0,Xb=-1,Sb=db;;){if((ub|0)>=(Sb|0)){var Qb=Xb;break c}for(var ac=p[wb>>2],Gb=0;;){if((Gb|0)>=(ac|0)){var xb=Xb;break}var Ta=p[k];if((qm(p[Ta+(ub<<3)>>2],p[(p[ob>>2]>>2)+(Gb*6|0)])|0)==0){p[((ub<<3)+Ta+4|0)>>2]=Gb;if((Gb|0)!=(p[Kb>>2]|0)){xb=Xb;break}xb=ub;break}Gb=Gb+1|0}if((Gb|0)<(p[wb>>2]|0)){var qb=xb}else{var bc=p[p[k]+(ub<<3)>>2];if((aA(bc)|0)==0){break}qb=ub}ub=ub+1|0;Xb=qb;Sb=p[m]}ym(b,R.ni|0,(z=a,a+=12,p[z>>2]=c,p[z+4>>2]=0,p[z+8>>2]=bc,z));l[b+17|0]=1;K=0;break a}ym(b,R.mi|0,(z=a,a+=8,p[z>>2]=za,p[z+4>>2]=Ua,z));K=0;break a}else{Qb=-1}}while(0);var $a=Y&(za|0)>0?p[q+1]:Qb,mb=E+12|0;if((p[mb>>2]&4096|0)==0){var Bb=0}else{var bb=b+72|0,jb=p[bb>>2]+1|0;p[bb>>2]=jb;V(L,7,0,jb);Bb=jb}c:do{if(P){var nb=0,zb=0}else{var Tb=p[b+68>>2],ec=Hx(b,H,Tb,40),Hb=zh(E,(ec<<2)+4|0),Eb=Hb;if((Hb|0)==0){K=Eb;break a}if((ec|0)>0){for(var Lb=b+72|0,gb=0;;){var Mb=p[Lb>>2]+1|0;p[Lb>>2]=Mb;p[((gb<<2)+Eb|0)>>2]=Mb;var vc=gb+1|0;if((vc|0)==(ec|0)){nb=Eb;zb=Tb;break c}gb=vc}}else{nb=Eb,zb=Tb}}}while(0);var hc=(Ja|0)!=0;if(hc){var kc=qw(L,72,Ba),pc=p[r+7],jc=kc}else{if(X){var mc=qw(L,4,ka),Fb=qw(L,27,Ea),pc=mc,jc=Fb}else{jc=pc=0}}j=(b+72|0)>>2;var Ub=p[j],Ya=Ub+1|0;i=(H+8|0)>>2;var Pa=Ya+p[i]|0;p[j]=Pa;if((l[cb]&16)<<24>>24==0){var yb=Ya}else{var Ka=Ub+2|0;p[j]=Pa+1|0;yb=Ka}var Ac=Xw(L);if((p[v>>2]&1|0)==0){w=90}else{var Jc=ox(b,p[i]+1|0);if(($a|0)<0){V(L,7,-1,Jc)}else{hc?gw(L,29,Ba,$a,Jc):ux(b,p[(p[d+12>>2]>>2)+($a*5|0)],Jc);var uc=qw(L,74,Jc);V(L,7,-1,Jc);fw(L,uc);qw(L,21,Jc)}var Tc=p[i],Yc=(Tc|0)>0;c:do{if(Yc){for(var ua=(d|0)==0&(hc^1),md=H+12|0,nd=Jc+1|0,Bc=f+4|0,Qc=d+12|0,Oc=f|0,ed=0;;){d:do{if(Y){var Fc=ed}else{for(var ud=p[Bc>>2],Rc=0;;){if((Rc|0)>=(ud|0)){Fc=Rc;break d}if((p[p[Oc>>2]+(Rc<<3)+4>>2]|0)==(ed|0)){Fc=Rc;break d}Rc=Rc+1|0}}}while(0);do{if(ua){w=82}else{if(Ob){if((Fc|0)>=(p[Bc>>2]|0)){w=82;break}}else{w=83}if(hc){gw(L,29,Ba,Fc,nd+ed|0)}else{var Yb=b,W=p[(p[Qc>>2]>>2)+(Fc*5|0)],bd=p[Yb+12>>2],hd=ux(Yb,W,nd+ed|0),eb=W|0;if(l[eb]<<24>>24!=-124){var Uc=Yb+72|0,cd=p[Uc>>2]+1|0;p[Uc>>2]=cd;V(bd,14,hd,cd);p[W+24>>2]=cd;l[W+35|0]=l[eb];l[eb]=-124}}w=86}}while(0);w==82&&ux(b,p[(p[md>>2]+4>>2)+(ed*6|0)],nd+ed|0);var vd=ed+1|0,id=p[i];if((vd|0)>=(id|0)){var Zc=id;break c}ed=vd}}else{Zc=Tc}}while(0);if(P){var td=Zc}else{V(L,30,Jc+1|0,Zc),qB(L,H),td=p[i]}rB(b,Q,105,0,1,H,Jc-1-td|0,g,Ac);tx(b,Jc,p[i]+1|0)}if(!P){(l[cb]&16)<<24>>24!=0&&V(L,10,0,Ya);var zd=($a|0)>-1;c:do{if(zd){do{if(hc){gw(L,29,Ba,$a,yb)}else{if(!X){ux(b,p[(p[d+12>>2]>>2)+($a*5|0)],yb);var Id=Zw(L,-1);h=Id>>2;if((Id|0)==0){break}var xc=Id|0;if(l[xc]<<24>>24!=10){break}if((l[cb]&16)<<24>>24!=0){break}l[xc]=56;p[h+1]=zb;p[h+2]=yb;p[h+3]=ha;var qc=1;break c}V(L,15,$a+La|0,yb)}}while(0);if((l[cb]&16)<<24>>24==0){var Gc=qw(L,74,yb);gw(L,56,zb,yb,ha);fw(L,Gc)}else{V(L,73,yb,p[r+7]+2|0)}qw(L,21,yb);qc=0}else{(l[cb]&16)<<24>>24==0?(gw(L,56,zb,yb,ha),qc=1):(V(L,10,0,yb),qc=0)}}while(0);(ha|0)>0&&V(p[b+12>>2],119,ha,yb);var Hc=(p[i]|0)>0;c:do{if(Hc){for(var zc=yb+1|0,Kc=H+4|0,wd=H+12|0,be=f+4|0,ge=d+12|0,Xd=f|0,rc=0,Lc=0;;){var Jd=zc+Lc|0,Qd=(Lc|0)==(p[Kc>>2]|0);d:do{if(Qd){V(L,10,0,Jd);var Fd=rc}else{e:do{if(Y){if(l[p[wd>>2]+Lc*24+23|0]<<24>>24==0){var Cd=Lc-rc|0;w=121}else{var ce=rc+1|0;w=124}}else{for(var Yd=p[be>>2],Mc=0;;){if((Mc|0)>=(Yd|0)){Cd=Mc;w=121;break e}if((p[p[Xd>>2]+(Mc<<3)+4>>2]|0)==(Lc|0)){Cd=Mc;w=121;break e}Mc=Mc+1|0}}}while(0);do{if(w==121){if((Cd|0)<0|$b){ce=rc}else{if(Ob){if((Cd|0)>=(p[be>>2]|0)){ce=rc;break}}else{w=125}if(hc){gw(L,29,Ba,Cd,Jd);Fd=rc;break d}if(X){V(L,15,Cd+La|0,Jd);Fd=rc;break d}ux(b,p[(p[ge>>2]>>2)+(Cd*5|0)],Jd);Fd=rc;break d}}}while(0);ux(b,p[(p[wd>>2]+4>>2)+(Lc*6|0)],Jd);Fd=ce}}while(0);var jd=Lc+1|0;if((jd|0)>=(p[i]|0)){break c}rc=Fd;Lc=jd}}}while(0);if((l[cb]&16)<<24>>24==0){QB(b,H,zb,Ya,nb,$a>>>31^1,0,g,Ac,A),TB(b,H,0,Ya),VB(b,H,zb,Ya,nb,0,qc,(p[A>>2]|0)==0&1)}else{var gc=iw(E,H);Jx(b,H);hw(L,140,1,p[i]+2|0,Ya,gc,-10);sw(L,(g|0)==99?2:g&255);Kx(b)}}(p[mb>>2]&4096|0)!=0&&V(L,20,Bb,1);(Q|0)!=0&&rB(b,Q,105,0,2,H,yb-1-p[i]|0,g,Ac);wx(L,Ac);hc?(V(L,95,Ba,pc),fw(L,jc),qw(L,45,Ba)):X&&(V(L,1,0,pc),fw(L,jc));if((l[cb]&16)<<24>>24!=0|P){da=nb,ga=Bb}else{qw(L,45,zb);var fd=p[q+4];if((fd|0)==0){da=nb,ga=Bb}else{for(var Sd=1,$c=fd;;){qw(L,45,Sd+zb|0);var Ad=p[$c+32>>2];if((Ad|0)==0){da=nb;ga=Bb;break b}Sd=Sd+1|0;$c=Ad}}}}}while(0);l[I]<<24>>24==0&&(p[b+432>>2]|0)==0&&Lx(b);(p[E+12>>2]&4096|0)!=0&&l[I]<<24>>24==0&&(p[b+432>>2]|0)==0&&(V(L,16,ga,1),Sx(L,1),Az(L,0,0,R.oi|0,0));K=da}}}}}}}}else{K=0}}while(0);Mu(E,c);Lu(E,d);Zf(E,e);Ef(E,f);vf(E,K);a=u}xv.X=1;function zv(b,c,d){p[b+4>>2]=c;p[b+8>>2]=p[d>>2]+p[d+4>>2]|0}function yv(b,c,d){var e,f=a;a+=4;if((c|0)==0){if(c=ni(b,12),(c|0)==0){e=0,c=7}else{p[c+8>>2]=0;var g=c,c=4}}else{g=c,c=4}c==4&&(e=(g|0)>>2,c=aC(b,p[e],8,5,g+4|0,g+8|0,f),p[e]=c,c=p[f>>2],(c|0)<0?(Ef(b,g),e=0):(b=Xu(b,d),p[((c<<3)+p[e]|0)>>2]=b,e=g));a=f;return e}function Av(b,c){var d,e=b>>2,f=a;a+=8;var g,h=p[e],i=(c|0)==0;a:do{if(!i){var j=p[c+4>>2],k=j+1|0,m=l[k]<<24>>24==0;do{if(m){var o=b+456|0,r=p[o>>2]+1|0;p[o>>2]=r;n[c+28>>1]=r&65535}else{o=ve(j);r=l[j]<<24>>24==63;b:do{if(r){var q=(Hk(k,f,o-1|0,1)|0)!=0;d=p[f>>2];var s=p[f+4>>2];g=d&65535;n[c+28>>1]=g;var u=p[h+108>>2];if(q|((s|0)<0||(s|0)==0&&d>>>0<1)){var w=u;g=8}else{if(q=(u|0)<0?-1:0,(s|0)>(q|0)||(s|0)==(q|0)&&d>>>0>u>>>0){w=u,g=8}else{var v=g;g=9}}g==8&&(ym(b,R.ji|0,(z=a,a+=4,p[z>>2]=w,z)),v=0);g=b+456|0;u=p[g>>2];q=(u|0)<0?-1:0;if((s|0)>(q|0)||(s|0)==(q|0)&&d>>>0>u>>>0){p[g>>2]=d}d=v}else{d=p[e+115];s=b+464|0;g=o+1|0;u=0;c:for(;;){q=u<<16>>16;if((q|0)>=(d|0)){var x=c+28|0;break}var q=p[p[s>>2]+(q<<2)>>2],A=(q|0)==0;do{if(!A&&(jm(q,j,g)|0)==0){d=u+1&65535;s=c+28|0;n[s>>1]=d;if(d<<16>>16==0){x=s;break c}break b}}while(0);u=u+1&65535}d=b+456|0;s=p[d>>2]+1|0;p[d>>2]=s;d=s&65535;n[x>>1]=d}}while(0);r=d<<16>>16;if(d<<16>>16>0){d=(b+460|0)>>2;if((r|0)>(p[d]|0)){g=b+464|0;s=u=Il(h,p[g>>2],r<<2);if((u|0)==0){break a}p[g>>2]=s;g=p[d];Ed((g<<2)+s|0,0,r-g<<2);p[d]=r}if(l[j]<<24>>24==63){r=r-1|0;d=p[p[e+116]+(r<<2)>>2];if((d|0)!=0){break}s=d}else{r=d=r-1|0,s=p[p[e+116]+(d<<2)>>2]}d=b+464|0;vf(h,s);o=Mm(h,j,o);p[((r<<2)+p[d>>2]|0)>>2]=o}}}while(0);(p[e+16]|0)==0&&(p[e+114]|0)>(p[h+108>>2]|0)&&ym(b,R.ki|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z))}}while(0);a=f}Av.X=1;function Bv(b,c,d){var e=p[b>>2],d=Xu(e,d),b=gv(b,d);bC(c,b);vf(e,d);return c}function Cv(b,c,d){var e=p[b>>2],d=Bw(e,151,d,1);(d|0)==0?(Lu(e,c),b=0):(p[(d+16|0)>>2]=c,Iv(b,d),b=d);return b}function Dv(b,c,d,e,f){c=$u(c,d,p[e>>2],p[f>>2],0);p[b>>2]=c;p[b+4>>2]=p[e+4>>2];p[b+8>>2]=p[f+8>>2]}function Ev(b,c,d,e,f){c=$u(c,d,p[e>>2],0,0);p[b>>2]=c;p[b+4>>2]=p[e+4>>2];p[b+8>>2]=p[f>>2]+p[f+4>>2]|0}function Fv(b,c,d,e){l[b+30|0]<<24>>24==0&&l[c|0]<<24>>24==98&&(l[d|0]=e&255,c=d+12|0,Df(b,p[c>>2]),p[c>>2]=0)}function Gv(b,c,d,e,f){c=$u(c,d,p[e>>2],0,0);p[b>>2]=c;p[b+4>>2]=p[f>>2];p[b+8>>2]=p[e+8>>2]}function Iv(b,c){cC(c);Dw(b,p[c+44>>2])}function Jv(b,c,d){var e,f,g=p[b>>2];if(l[g+30|0]<<24>>24==0&&(Hm(b)|0)==0){var h=p[c+4>>2];e=nw(g,p[c+8>>2],h);f=e>>2;if((e|0)==0){(d|0)==0?ym(b,R.di|0,(z=a,a+=8,p[z>>2]=c,p[z+4>>2]=0,z)):Kw(b,h),l[b+17|0]=1}else{if(l[e+25|0]<<24>>24==0){var d=rm(g,p[f+9]),i=p[f+4],j=g+8|0,k=p[p[j>>2]+(d<<4)>>2],h=(d|0)==1?R.n|0:R.o|0;if((Ru(b,9,h,0,k)|0)==0&&(e=(e|0)>>2,(Ru(b,(d|0)==0?10:12,p[e],p[i>>2],k)|0)==0)){i=Su(b),(i|0)!=0&&(pw(b,1,d),j=p[p[j>>2]+(d<<4)>>2],k=p[e],xw(b,R.fi|0,(z=a,a+=12,p[z>>2]=j,p[z+4>>2]=h,p[z+8>>2]=k,z)),Mw(b,d,R.yb|0,p[e]),yw(b,d),dC(b,p[f+5],d),hw(i,109,d,0,0,p[e],0))}}else{ym(b,R.ei|0,(z=a,a+=4,p[z>>2]=0,z))}}}Mu(g,c)}Jv.X=1;function Kv(b,c,d,e,f){var g,h,i,j,k,m,o,r,q,s,u,w,v,x=a;a+=24;var A,E=x+4;v=E>>2;var J=x+12,M=x+16,D=x+20;w=D>>2;u=(b|0)>>2;var K=y[u];s=K>>2;var H=Am(K);p[b+12>>2]=H;var N=(H|0)==0;do{if(!N){l[H+100|0]=1;q=(b+72|0)>>2;p[q]=2;var Q=lw(b,c,d,x);if((Q|0)>=0){r=(K+8|0)>>2;var P=y[r];o=P>>2;if(!((Q|0)==1&&(oi(b)|0)!=0)){var L=Xu(K,p[x>>2]);if((L|0)!=0){var I=(f|0)==0?Xu(K,e):zm(K,R.vg|0,(z=a,a+=4,p[z>>2]=e,z));m=(d+4|0)>>2;var X=(p[m]|0)==0?0:p[(Q<<4>>2)+o],Y=(Ru(b,19,L,I,X)|0)==0;a:do{if(Y){var da=(qm(L,R.wg|0)|0)==0;b:do{if(da){if((Hm(b)|0)!=0){break a}vm(H,Q);if((I|0)==0){Sx(H,1);Az(H,0,0,R.Ca|0,0);p[q]=p[q]+2|0;var ga=Bm(H,8,eC|0);sm(H,ga,Q);sm(H,ga+1|0,Q);sm(H,ga+6|0,2e3)}else{var ha=dp(I),ba=fC(ha);pw(b,0,Q);V(H,7,ba,1);gw(H,37,Q,3,1);var ea=(Q<<4)+P+12|0;p[(p[ea>>2]+80|0)>>2]=ba;var ja=p[((Q<<4)+4>>2)+o];gC(p[ja>>2],p[ja+4>>2],p[p[ea>>2]+80>>2])}}else{if((qm(L,R.Eb|0)|0)==0){var ra=p[((Q<<4)+4>>2)+o];k=ra>>2;if((I|0)==0){if((ra|0)==0){var Va=0,ta=0}else{var xa=p[p[k+1]+32>>2],Va=(xa|0)<0?-1:0,ta=xa}hC(b,R.Eb|0,ta,Va)}else{var Fa=dp(I);p[s+9]=Fa;(bi(p[k],p[k+1],Fa,-1,0)|0)==7&&(l[K+30|0]=1)}}else{if((qm(L,R.Fb|0)|0)==0){var Na=p[((Q<<4)+4>>2)+o],Ea=(I|0)==0;c:do{if(Ea){var La=-1}else{var za=Qo(I)&1;if((p[m]|0)!=0){La=za}else{var Ba=K+4|0;if((p[Ba>>2]|0)>0){for(var Ja=0;;){iC(p[p[r]+(Ja<<4)+4>>2],za);var ka=Ja+1|0;if((ka|0)>=(p[Ba>>2]|0)){La=za;break c}Ja=ka}}else{La=za}}}}while(0);var S=iC(Na,La);hC(b,R.Fb|0,S,(S|0)<0?-1:0)}else{var ib=(qm(L,R.xg|0)|0)==0;do{if(!ib&&(qm(L,R.yg|0)|0)!=0){if((qm(L,R.Gb|0)|0)==0){var Wa,Za=fa;if((I|0)==0){Za=4}else{if((qm(I,R.Ib|0)|0)==0){var Sa=1,Za=5}else{(qm(I,R.Hb|0)|0)==0?(Sa=0,Za=5):Za=4}}Za==4&&(Sa=-1);Wa=Sa;var tb=(p[m]|0)==0;if(tb&(Wa|0)==-1){var pb=t[K+31|0]&255}else{if(tb){var fb=K+4|0,Xa=(p[fb>>2]|0)>2;c:do{if(Xa){for(var Ab=2;;){jC(p[p[p[p[r]+(Ab<<4)+4>>2]+4>>2]>>2],Wa);var rb=Ab+1|0;if((rb|0)>=(p[fb>>2]|0)){break c}Ab=rb}}}while(0);l[K+31|0]=Wa&255}pb=jC(p[p[p[((Q<<4)+4>>2)+o]+4>>2]>>2],Wa)}var cb=(pb|0)==1?R.Ib|0:R.Hb|0;Sx(H,1);Az(H,0,0,R.Gb|0,0);hw(H,94,0,1,0,cb,0);V(H,16,1,1);break b}if((qm(L,R.Jb|0)|0)==0){if((Hm(b)|0)!=0){break a}Sx(H,1);Az(H,0,0,R.Jb|0,0);var Cb=(I|0)==0;c:do{if(Cb){A=54}else{for(var Zb=ve(I),dc=0;;){var kb=(dc|0)==6?0:p[kC+(dc<<2)>>2];if((kb|0)==0){A=54;break c}if((te(I,kb,Zb)|0)==0){break}dc=dc+1|0}if((dc|0)==-1){A=54}else{var Oa=Q,Db=dc;A=56}}}while(0);A==54&&((p[m]|0)!=0?Oa=Q:(p[m]=1,Oa=0),Db=-1);var Wb=p[s+1],Nb=(Wb|0)>0;c:do{if(Nb){for(var $b=Wb;;){var Rb=$b-1|0;(p[p[r]+(Rb<<4)+4>>2]|0)!=0&&!((Rb|0)!=(Oa|0)&&(p[m]|0)!=0)&&(vm(H,Rb),gw(H,126,Rb,1,Db));if((Rb|0)<=0){break c}$b=Rb}}}while(0);V(H,16,1,1);break b}if((qm(L,R.Kb|0)|0)==0){var Ra=p[p[p[((Q<<4)+4>>2)+o]+4>>2]>>2];p[v]=-2;p[v+1]=-1;if((I|0)==0){var Ob=-1,Ua=-2}else{Hk(I,E,1e6,1);var Jb=p[v],Vb=p[v+1];(Vb|0)<-1||(Vb|0)==-1&&Jb>>>0<4294967295?(p[v]=-1,Ua=Ob=p[v+1]=-1):(Ob=Vb,Ua=Jb)}var Pb,sb=Ra,db=Ua,wb=Ob,ob=sb+136|0;if((wb|0)>-1||(wb|0)==-1&&db>>>0>4294967294){var Kb=ob|0;p[Kb>>2]=db;var ub=ob+4|0;p[ub>>2]=wb;var Xb=p[sb+180>>2],Sb=wb;if((Xb|0)!=0){var Qb=Xb+16|0;p[Qb>>2]=db;p[Qb+4>>2]=Sb}}Kb=ob|0;ub=ob+4|0;Pb=[p[Kb>>2],p[ub>>2]];var ac=Pb[0],Gb=Pb[1];p[v]=ac;p[v+1]=Gb;hC(b,R.Kb|0,ac,Gb);break b}if((qm(L,R.Lb|0)|0)==0){var xb=p[((Q<<4)+4>>2)+o];if((Hm(b)|0)!=0){break a}if((I|0)==0){if((xb|0)==0){var Ta=0,qb=0}else{var bc=lC(xb),Ta=(bc|0)<0?-1:0,qb=bc}hC(b,R.Lb|0,qb,Ta);break b}var $a;if((qm(I,R.Xh|0)|0)==0){var mb=0}else{if((qm(I,R.Wb|0)|0)==0){mb=1}else{if((qm(I,R.Yh|0)|0)==0){mb=2}else{var Bb=dp(I),mb=Bb>>>0<3?Bb&255:0}}}$a=mb;l[K+32|0]=$a&255;if(($a|0)<=-1){break b}var bb=mC(p[xb>>2],p[xb+4>>2],$a),jb=$a-1|0;if(!((bb|0)==0&jb>>>0<2)){break b}var nb=Bm(H,6,nC|0);sm(H,nb,Q);sm(H,nb+1|0,Q);var zb=nb+4|0;tm(H,nb+2|0,zb);sm(H,zb,jb);sm(H,nb+5|0,Q);vm(H,Q);break b}else{if((qm(L,R.zg|0)|0)==0){if((Hm(b)|0)!=0){break a}if((I|0)==0){A=81}else{var Tb=No(I,J),ec=p[J>>2];if((Tb|0)==0|(ec|0)<1){A=81}else{var Hb=ec;A=82}}A==81&&(Hb=p[J>>2]=2147483647);pw(b,0,Q);V(H,7,Hb,1);var Eb=qw(H,128,Q);qw(H,16,1);V(H,20,1,-1);V(H,120,1,Eb);fw(H,Eb);break b}if((qm(L,R.Ca|0)|0)==0){if((Hm(b)|0)!=0){break a}if((I|0)==0){var Lb=p[p[((Q<<4)+12>>2)+o]+80>>2];hC(b,R.Ca|0,Lb,(Lb|0)<0?-1:0);break b}var gb=dp(I),Mb=(Q<<4)+P+12|0;p[(p[Mb>>2]+80|0)>>2]=gb;var vc=p[((Q<<4)+4>>2)+o];gC(p[vc>>2],p[vc+4>>2],p[p[Mb>>2]+80>>2]);break b}else{if((qm(L,R.Mb|0)|0)==0){if((I|0)==0){hC(b,R.Mb|0,l[K+29|0]&255,0);break b}var hc,kc=t[I];hc=(kc-48&255)<3?(kc<<24>>24)-48|0:(qm(I,R.Qb|0)|0)==0?1:(qm(I,R.Zb|0)|0)==0?2:0;var pc=p[b>>2]+29|0;(t[pc]&255|0)!=(hc|0)&&(oC(b)|0)==0&&(l[pc]=hc&255);break b}else{if((qm(L,R.Nb|0)|0)==0){if((I|0)==0){if((p[pC>>2]|0)==0){break b}Sx(H,1);Az(H,0,0,R.Nb|0,0);hw(H,94,0,1,0,p[pC>>2],0);V(H,16,1,1);break b}var jc=l[I]<<24>>24==0;do{if(!jc&&(Dq(p[s],I,1,M)|0)!=0|(p[M>>2]|0)==0){ym(b,R.Bg|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));break a}}while(0);(t[K+29|0]&255)<2&&oC(b);Lg(p[pC>>2]);if(l[I]<<24>>24==0){p[pC>>2]=0;break b}var mc=Bh(R.d|0,(z=a,a+=4,p[z>>2]=I,z));p[pC>>2]=mc;break b}else{if((qm(L,R.Ob|0)|0)==0){if((Hm(b)|0)!=0){break a}if((I|0)==0){var Fb=(t[(Q<<4)+P+9|0]&255)-1|0;hC(b,R.Ob|0,Fb,(Fb|0)<0?-1:0);break b}if(l[K+28|0]<<24>>24==0){ym(b,R.Cg|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));break b}var Ub=Qo(I);l[(Q<<4)+P+9|0]=Ub+1&255;break b}else{if((qC(b,L,I)|0)!=0){break b}var Ya=(I|0)==0;if((qm(L,R.Dg|0)|0)!=0|Ya){if((qm(L,R.Jg|0)|0)!=0|Ya){if((qm(L,R.Lg|0)|0)!=0|Ya){if((qm(L,R.Ng|0)|0)==0){if((Hm(b)|0)!=0){break a}Sx(H,3);p[q]=3;Az(H,0,0,R.la|0,0);Az(H,1,0,R.aa|0,0);Az(H,2,0,R.Qb|0,0);var Pa=K+4|0,yb=p[Pa>>2];if((yb|0)<=0){break b}for(var Ka=0,Ac=yb;;){if((p[p[r]+(Ka<<4)+4>>2]|0)==0){var Jc=Ac}else{V(H,7,Ka,1),hw(H,94,0,2,0,p[p[r]+(Ka<<4)>>2],0),hw(H,94,0,3,0,p[p[p[p[p[r]+(Ka<<4)+4>>2]+4>>2]>>2]+144>>2],0),V(H,16,1,3),Jc=p[Pa>>2]}var uc=Ka+1|0;if((uc|0)>=(Jc|0)){break b}Ka=uc;Ac=Jc}}else{if((qm(L,R.Og|0)|0)==0){Sx(H,2);p[q]=2;Az(H,0,0,R.la|0,0);Az(H,1,0,R.aa|0,0);var Tc=p[s+105];if((Tc|0)==0){break b}for(var Yc=0,ua=Tc;;){var md=p[ua+8>>2],nd=Yc+1|0;V(H,7,Yc,1);hw(H,94,0,2,0,p[md>>2],0);V(H,16,1,2);var Bc=p[ua>>2];if((Bc|0)==0){break b}Yc=nd;ua=Bc}}else{if((qm(L,R.Pg|0)|0)!=0|Ya){if((qm(L,R.Wg|0)|0)==0){if(Ya){break b}var Qc=Qo(I)&1,Oc=K,ed=(Qc|0)!=0,Fc=(ed?rC:sC)|0;fo(Oc,R.T|0,2,1,Fc,54,0,0,0);fo(Oc,R.T|0,3,1,Fc,54,0,0,0);fo(Oc,R.ya|0,2,1,tC|0,54,0,0,0);uC(Oc,R.ya|0,3);uC(Oc,R.T|0,ed?3:1);break b}var ud=(qm(L,R.Ub|0)|0)==0;do{if(!ud&&(qm(L,R.Xg|0)|0)!=0){if((qm(L,R.Vb|0)|0)!=0){var Rc=(qm(L,R.oh|0)|0)==0;do{if(!Rc&&(qm(L,R.ph|0)|0)!=0&&(qm(L,R.qh|0)|0)!=0){if((qm(L,R.rh|0)|0)==0){Sx(H,1);p[q]=1;Az(H,0,0,R.sh|0,0);var Yb=ze(0);if((Yb|0)==0){break b}for(var W=0,bd=Yb;;){var hd=W+1|0;hw(H,94,0,1,0,bd,0);V(H,16,1,1);var eb=ze(hd);if((eb|0)==0){break b}W=hd;bd=eb}}else{if((qm(L,R.uh|0)|0)==0){var Uc=(p[d>>2]|0)!=0?Q:10,cd=Ya?0:(qm(I,R.Wb|0)|0)==0?1:(qm(I,R.vh|0)|0)!=0?0:2;if((Hm(b)|0)!=0){break a}Sx(H,3);p[q]=3;Az(H,0,0,R.wh|0,0);Az(H,1,0,R.xh|0,0);Az(H,2,0,R.yh|0,0);gw(H,125,Uc,cd,1);V(H,16,1,3);break b}if((qm(L,R.Xb|0)|0)==0){if(!Ya){var vd=dp(I);ko(K,vd)}if((p[s+48]|0)==20){var id=p[s+49],Zc=(id|0)<0?-1:0,td=id}else{td=Zc=0}hC(b,R.Xb|0,td,Zc);break b}if((qm(L,R.zh|0)|0)!=0){break b}var zd=K;Ce(zd);var Id=zd+4|0,xc=p[Id>>2],qc=(xc|0)>0;c:do{if(qc){for(var Gc=zd+8|0,Hc=0,zc=xc;;){var Kc=p[p[Gc>>2]+(Hc<<4)+4>>2];if((Kc|0)==0){var wd=zc}else{var be=p[p[p[p[Kc+4>>2]>>2]+176>>2]+40>>2];if((be|0)!=0){Gd[p[of+144>>2]](be)}wd=p[Id>>2]}var ge=Hc+1|0;if((ge|0)>=(wd|0)){break c}Hc=ge;zc=wd}}}while(0);break b}}}while(0);vm(H,Q);var Xd=l[L]<<24>>24;if((Xd|0)==102||(Xd|0)==70){var rc=0;A=198}else{var Lc=(Xd|0)==115||(Xd|0)==83?1:6;A=196}do{if(A==196){if(Ya){rc=Lc}else{var Jd=Bm(H,3,vC|0);sm(H,Jd,Q);var Qd=Jd+1|0,Fd=dp(I);sm(H,Qd,Fd);var Cd=Jd+2|0;sm(H,Cd,Q);tm(H,Cd,Lc);break b}}}while(0);var ce=Bm(H,3,wC|0);sm(H,ce,Q);var Yd=ce+1|0;sm(H,Yd,Q);um(H,Yd,rc);Sx(H,1);Az(H,0,0,L,-1);break b}if(Ya){if((Hm(b)|0)!=0){break a}Sx(H,1);Az(H,0,0,R.Vb|0,0);V(H,94,0,1);Dm(H,-1,p[xC+((t[p[p[p[u]+8>>2]+12>>2]+77|0]&255)<<3)>>2],-2);V(H,16,1,1);break b}if((n[p[p[r]+12>>2]+78>>1]&5)<<16>>16==1){break b}for(var Mc=xC;;){var jd=Mc|0,gc=p[jd>>2];if((gc|0)==0){break}if((qm(I,gc)|0)==0){var fd=l[Mc+4|0];l[p[p[p[u]+8>>2]+12>>2]+77|0]=fd<<24>>24==0?2:fd;if((p[jd>>2]|0)==0){break}break b}else{Mc=Mc+8|0}}ym(b,R.nh|0,(z=a,a+=4,p[z>>2]=I,z));break b}}while(0);var Sd=l[L];if((Hm(b)|0)!=0){break a}p[q]=6;Sx(H,1);Az(H,0,0,R.Ub|0,0);p[w]=100;if(Ya){var $c=100}else{No(I,D);var Ad=p[w];$c=(Ad|0)<1?p[w]=100:Ad}V(H,7,$c,1);var Xe=K+4|0,ef=(p[Xe>>2]|0)>0;c:do{if(ef){for(var oe=0;;){ow(b,oe);var wf=qw(H,120,1);V(H,6,0,0);fw(H,wf);var Kd=p[p[r]+(oe<<4)+12>>2]+16|0,ue=p[Kd>>2],xf=(ue|0)==0;d:do{if(xf){var Ge=0}else{for(var yf=0,Re=ue;;){var Se=p[Re+8>>2];V(H,7,p[Se+20>>2],yf+2|0);var tc=p[Se+16>>2],ff=yf+1|0,he=(tc|0)==0;e:do{if(he){var je=ff}else{for(var de=yf,Me=tc,od=ff;;){V(H,7,p[Me+20>>2],de+3|0);var ke=p[Me+32>>2],Zd=od+1|0;if((ke|0)==0){je=Zd;break e}de=od;Me=ke;od=Zd}}}while(0);var le=p[Re>>2];if((le|0)==0){Ge=je;break d}yf=je;Re=le}}}while(0);var ye=Ge+4|0;(p[q]|0)<(ye|0)&&(p[q]=ye);gw(H,111,2,Ge,1);sw(H,oe&255);var zf=qw(H,73,2),Ye=p[p[r]+(oe<<4)>>2],Ze=zm(K,R.Zg|0,(z=a,a+=4,p[z>>2]=Ye,z));hw(H,94,0,3,0,Ze,-1);gw(H,13,2,4,1);gw(H,91,4,3,2);V(H,16,2,1);fw(H,zf);for(var Ae=Kd;;){var Sf=p[Ae>>2];if((Sf|0)==0){break}if(Sd<<24>>24==113||Sd<<24>>24==81){break}var cg=p[Sf+8>>2];j=(cg+16|0)>>2;var If=(p[j]|0)==0;d:do{if(!If){var Jf=cg,Cg=qw(H,120,1);V(H,6,0,0);fw(H,Cg);Hx(b,Jf,1,39);V(H,7,0,2);var Kf=V(H,72,1,0);V(H,20,2,1);var Sg=p[j],Lf=(Sg|0)==0;e:do{if(!Lf){var Te=0,gf=Sg;for(i=gf>>2;;){var sg=yC(b,gf,1,3,0),Mf=zC(H,52,Te+2|0,0,sg,p[i+1]+1|0),He=Bm(H,11,AC|0);Dm(H,He+1|0,R.$g|0,-2);Dm(H,He+3|0,R.ah|0,-2);Dm(H,He+4|0,p[i],0);fw(H,He+9|0);fw(H,Mf);var $e=p[i+8];if(($e|0)==0){break e}Te=Te+1|0;gf=$e;i=gf>>2}}}while(0);V(H,95,1,Kf+1|0);fw(H,Kf);var Ne=p[j];if((Ne|0)!=0){for(var Ue=0,hf=Ne;;){var Dg=qw(H,120,1);V(H,6,0,0);fw(H,Dg);var me=Bm(H,10,BC|0),jf=me+1|0,$d=Ue+2|0;sm(H,jf,$d);var Nf=me+4|0;tm(H,jf,Nf);var Eg=me+3|0;sm(H,Eg,$d);tm(H,Eg,me+2|0);fw(H,Nf);Dm(H,me+6|0,R.bh|0,-2);Dm(H,me+7|0,p[hf>>2],0);var tg=p[hf+32>>2];if((tg|0)==0){break d}Ue=Ue+1|0;hf=tg}}}}while(0);Ae=Sf|0}var dg=oe+1|0;if((dg|0)>=(p[Xe>>2]|0)){break c}oe=dg}}}while(0);var eg=Bm(H,4,CC|0);tm(H,eg,-$c|0);fw(H,eg+1|0);Dm(H,eg+2|0,R.dh|0,-2);break b}else{if((Hm(b)|0)!=0){break a}var Af=Im(K,I,X);if((Af|0)==0){break b}var Md=Su(b),Tf=p[Af+36>>2];if((Tf|0)==0){break b}Sx(Md,8);p[q]=8;Az(Md,0,0,R.Qg|0,0);Az(Md,1,0,R.la|0,0);Az(Md,2,0,R.Rb|0,0);Az(Md,3,0,R.Sb|0,0);Az(Md,4,0,R.Sg|0,0);Az(Md,5,0,R.Tg|0,0);Az(Md,6,0,R.Ug|0,0);Az(Md,7,0,R.Tb|0,0);var Tg=Af+12|0,Of=Tf;h=Of>>2;for(var Uf=0;;){var kf=Of+20|0,Vf=(p[kf>>2]|0)>0;c:do{if(Vf){for(var af=Of+25|0,Ug=Of+26|0,ug=Of+8|0,ie=0;;){var lf=p[((ie<<3)+40>>2)+h],mh=DC(l[af]),Fg=DC(l[Ug]);V(Md,7,Uf,1);V(Md,7,ie,2);hw(Md,94,0,3,0,p[ug>>2],0);hw(Md,94,0,4,0,p[(p[Tg>>2]>>2)+(p[((ie<<3)+36>>2)+h]*6|0)],0);hw(Md,(lf|0)!=0?94:10,0,5,0,lf,0);hw(Md,94,0,6,0,Fg,0);hw(Md,94,0,7,0,mh,0);hw(Md,94,0,8,0,R.Vg|0,0);V(Md,16,1,8);var fg=ie+1|0;if((fg|0)>=(p[kf>>2]|0)){break c}ie=fg}}}while(0);var gg=y[h+1];if((gg|0)==0){break b}Of=gg;h=Of>>2;Uf=Uf+1|0}}}}}else{if((Hm(b)|0)!=0){break a}var Ie=Im(K,I,X);if((Ie|0)==0){break b}var Pf=Su(b),Vg=p[Ie+16>>2];if((Vg|0)==0){break b}Sx(Pf,3);p[q]=3;Az(Pf,0,0,R.la|0,0);Az(Pf,1,0,R.aa|0,0);Az(Pf,2,0,R.Mg|0,0);for(var hg=Vg,Gg=0;;){V(Pf,7,Gg,1);hw(Pf,94,0,2,0,p[hg>>2],0);V(Pf,7,l[hg+24|0]<<24>>24!=0&1,3);V(Pf,16,1,3);var ig=y[hg+32>>2];if((ig|0)==0){break b}hg=ig;Gg=Gg+1|0}}}else{if((Hm(b)|0)!=0){break a}var jg=nw(K,I,X);if((jg|0)==0){break b}var Wf=p[jg+16>>2];Sx(H,3);p[q]=3;Az(H,0,0,R.Kg|0,0);Az(H,1,0,R.Pb|0,0);Az(H,2,0,R.aa|0,0);var vg=jg+4|0;if((p[vg>>2]|0)<=0){break b}for(var kg=jg+8|0,lg=Wf+12|0,Bf=0;;){var bf=p[p[kg>>2]+(Bf<<2)>>2];V(H,7,Bf,1);V(H,7,bf,2);hw(H,94,0,3,0,p[(p[lg>>2]>>2)+(bf*6|0)],0);V(H,16,1,3);var Xf=Bf+1|0;if((Xf|0)>=(p[vg>>2]|0)){break b}Bf=Xf}}}else{if((Hm(b)|0)!=0){break a}var mf=Im(K,I,X);if((mf|0)==0){break b}Sx(H,6);p[q]=6;Az(H,0,0,R.Pb|0,0);Az(H,1,0,R.aa|0,0);Az(H,2,0,R.Eg|0,0);Az(H,3,0,R.Fg|0,0);Az(H,4,0,R.Gg|0,0);Az(H,5,0,R.Hg|0,0);Lw(b,mf);var Eh=mf+8|0,wg=p[Eh>>2];if((wg|0)<=0){break b}var Cf=0,mg=0,Qf=p[mf+12>>2];g=Qf>>2;for(var ci=wg;;){if(l[Qf+23|0]<<24>>24==0){V(H,7,Cf-mg|0,1);hw(H,94,0,2,0,p[g],0);var di=p[g+3];hw(H,94,0,3,0,(di|0)==0?xh|0:di,0);V(H,7,l[Qf+20|0]<<24>>24!=0&1,4);var Fh=y[g+2];(Fh|0)==0?V(H,10,0,5):hw(H,94,0,5,0,Fh,0);V(H,7,t[Qf+21|0]&255,6);V(H,16,1,6);var Gh=mg,nh=p[Eh>>2]}else{Gh=mg+1|0,nh=ci}var nf=Cf+1|0;if((nf|0)>=(nh|0)){break b}Cf=nf;mg=Gh;Qf=Qf+24|0;g=Qf>>2;ci=nh}}}}}}}}}while(0);if((Hm(b)|0)!=0){break a}ow(b,Q);var Wg=p[q]+1|0;p[q]=Wg;var Hh=l[L];if(Hh<<24>>24==112||Hh<<24>>24==80){V(H,146,Q,Wg)}else{var Xg=dp(I);gw(H,147,Q,Wg,fC(Xg))}V(H,16,Wg,1);Sx(H,1);Az(H,0,0,L,-1)}}}}while(0);if(l[K+28|0]<<24>>24!=0){var xg=p[((Q<<4)+4>>2)+o],Yf=y[s+3],Hg=p[xg+4>>2],Yg=t[(Q<<4)+P+9|0]&255,ei=Yf>>>21&1,fi=Yf>>>22&1;li(p[xg>>2],Hg);EC(p[Hg>>2],Yg,ei,fi)}}}while(0);vf(K,L);vf(K,I)}}}}}while(0);a=x}Kv.X=1;function Lv(b,c,d){var e,f=a;a+=24;var g=f+16,h=b+508|0,i=p[h>>2];e=i>>2;var j=p[b>>2];p[h>>2]=0;h=(p[b+64>>2]|0)!=0|(i|0)==0;do{if(h){var k=i,m=c}else{var o=i|0,m=p[o>>2],k=i+20|0,r=rm(j,p[k>>2]),q=i+28|0;p[q>>2]=c;if((c|0)==0){o=m}else{for(var s=c;;){if(p[s+4>>2]=i,s=p[s+32>>2],(s|0)==0){break}}o=p[o>>2]}p[g>>2]=o;p[g+4>>2]=ve(o);if(o=(Fw(f,b,r,R.ia|0,g)|0)!=0){o=f;s=fa;q=p[q>>2];for(s=q>>2;;){if((q|0)==0){var u=0;break}if((Pw(o,p[s+2])|0)!=0){u=1;break}if((FC(o,p[s+5])|0)!=0){u=1;break}if((GC(o,p[s+6])|0)!=0){u=1;break}q=p[s+8];s=q>>2}o=(u|0)!=0}if(o){k=i}else{q=j+124|0;if(l[q]<<24>>24==0){o=Su(b);if((o|0)==0){k=i;m=0;break}pw(b,0,r);var w=Mm(j,p[d>>2],p[d+4>>2]),s=j+8|0,v=p[p[s>>2]+(r<<4)>>2],x=(r|0)==1?R.n|0:R.o|0,A=p[e+1];xw(b,R.tg|0,(z=a,a+=20,p[z>>2]=v,p[z+4>>2]=x,p[z+8>>2]=m,p[z+12>>2]=A,p[z+16>>2]=w,z));vf(j,w);yw(b,r);w=zm(j,R.ug|0,(z=a,a+=4,p[z>>2]=m,z));zw(o,r,w);if(l[q]<<24>>24==0){k=i;m=0;break}q=s}else{q=j+8|0}m=r=Ff(p[p[q>>2]+(r<<4)+12>>2]+40|0,m,ve(m),i);if((r|0)==0){r=p[e+6];if((p[k>>2]|0)!=(r|0)){k=m;m=0;break}k=p[e+1];k=Ao(r+8|0,k,ve(k))+64|0;p[(i+32|0)>>2]=p[k>>2];p[k>>2]=i}else{l[j+30|0]=1}k=m}m=0}}while(0);qf(j,k);uf(j,m);a=f}Lv.X=1;function Mv(b,c,d,e,f,g,h,i,j,k){var m,o=a;a+=20;var r=o+4,q=p[b>>2];if(j=(j|0)!=0){if((p[d+4>>2]|0)==0){p[o>>2]=c;var s=1,c=6}else{ym(b,R.jg|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));var u=m=0,c=40}}else{c=lw(b,c,d,o),(c|0)<0?(u=m=0,c=40):(s=c,c=6)}if(c==6){if((h|0)==0){u=m=0}else{if(m=q+30|0,l[m]<<24>>24!=0){u=m=0}else{if(u=q+124|0,l[u]<<24>>24==0|(s|0)==1||(c=h+4|0,vf(q,p[c>>2]),p[c>>2]=0),c=Ew(b,h),d=l[u]<<24>>24==0?(p[d+4>>2]|0)!=0|(c|0)==0?s:(p[c+68>>2]|0)!=(p[p[q+8>>2]+28>>2]|0)?s:1:s,l[m]<<24>>24!=0){u=m=0}else{if(u=p[o>>2],(Fw(r,b,d,R.ia|0,u)|0)!=0&&(Gw(r,h)|0)!=0){u=m=0}else{if(c=Ew(b,h),(c|0)==0){(p[q+116>>2]|0)==1&&(l[q+125|0]=1),u=m=0}else{if((l[c+34|0]&16)<<24>>24==0){if(r=Xu(q,u),(r|0)==0){u=m=0}else{if((mw(b,r)|0)!=0){m=r,u=0}else{if(s=q+8|0,m=p[s>>2]>>2,(Ao(p[((d<<4)+12>>2)+m]+40|0,r,ve(r))|0)==0){if(u=p[c>>2],(te(u,R.N|0,7)|0)==0){ym(b,R.mg|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),e=b+64|0,p[e>>2]=p[e>>2]+1|0,m=r,u=0}else{var w=(p[c+28>>2]|0)==0,k=(e|0)==48;if(w|k){if(w&k){ym(b,R.rg|0,(z=a,a+=8,p[z>>2]=h,p[z+4>>2]=0,z)),m=r,u=0}else{var c=c+68|0,v=rm(q,p[c>>2]),w=p[(v<<4>>2)+m],v=(v|0)==1;(Ru(b,v|j?5:7,r,u,j?p[m+4]:w)|0)!=0?(m=r,u=0):(Ru(b,18,v?R.n|0:R.o|0,0,w)|0)!=0?(m=r,u=0):(j=ni(q,36),(j|0)==0?m=r:(p[j>>2]=r,r=yl(q,p[h+8>>2]),p[(j+4|0)>>2]=r,p[(j+20|0)>>2]=p[p[s>>2]+(d<<4)+12>>2],p[(j+24|0)>>2]=p[c>>2],l[j+8|0]=f&255,l[j+9|0]=k|(e|0)==34?1:2,e=Pv(q,i,1),p[(j+12|0)>>2]=e,e=HC(q,g),p[(j+16|0)>>2]=e,p[b+508>>2]=j,m=0),u=j)}}else{e=(e|0)==34?R.og|0:R.pg|0,ym(b,R.ng|0,(z=a,a+=12,p[z>>2]=e,p[z+4>>2]=h,p[z+8>>2]=0,z)),m=r,u=0}}}else{(k|0)==0?ym(b,R.lg|0,(z=a,a+=4,p[z>>2]=u,z)):ow(b,d),m=r,u=0}}}}else{ym(b,R.kg|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),u=m=0}}}}}}}vf(q,m);Mu(q,h);Ef(q,g);Df(q,i);(p[b+508>>2]|0)==0&&qf(q,u);a=o}Mv.X=1;function Qv(b,c,d,e,f,g){var h=Nv(b,105,c),c=h>>2;if((h|0)==0){Ef(b,d)}else{var i=Qw(b,f,1);p[c+2]=i;p[c+7]=d;d=Ov(b,e,1);p[c+6]=d;l[h+1|0]=g}Lu(b,e);Zf(b,f);return h}function Rv(b,c,d){var e=y[b>>2],f=l[e+30|0]<<24>>24==0;do{if(f&&(Hm(b)|0)==0){var g=y[c+4>>2],h=y[c+8>>2],i=ve(h),j=y[e+4>>2],k=(g|0)==0,m=e+8|0;a:do{if(k){for(var o=0,r=0;;){if((o|0)>=(j|0)){var q=r;break a}var s=r=Ao(p[p[m>>2]+(((o|0)<2&1^o)<<4)+12>>2]+40|0,h,i);if((r|0)!=0){q=s;break a}o=o+1|0;r=s}}else{for(r=o=0;;){if((o|0)>=(j|0)){q=r;break a}var s=(o|0)<2&1^o,u=y[m>>2];if((qm(p[u+(s<<4)>>2],g)|0)==0){s=r=Ao(p[u+(s<<4)+12>>2]+40|0,h,i);if((r|0)!=0){q=s;break a}r=s}o=o+1|0}}}while(0);(q|0)==0?((d|0)==0?ym(b,R.ig|0,(z=a,a+=8,p[z>>2]=c,p[z+4>>2]=0,z)):Kw(b,g),l[b+17|0]=1):IC(b,q)}}while(0);Mu(e,c)}Rv.X=1;function Vv(b,c,d){var e=a;a+=4;var f,g=b|0,h=p[g>>2],i=(Hm(b)|0)==0;do{if(i){if((c|0)==0){JC(b,0)}else{f=(d|0)==0?6:(p[d>>2]|0)==0?6:10;if(f==6){f=Xu(p[g>>2],c);if((f|0)==0){break}if((wo(h,l[p[p[h+8>>2]+12>>2]+77|0],f,0)|0)!=0){JC(b,f);vf(h,f);break}vf(h,f)}f=lw(b,c,d,e);if((f|0)>=0){var j=Xu(h,p[e>>2]);if((j|0)!=0){var k=p[p[h+8>>2]+(f<<4)>>2],m=Im(h,j,k);(m|0)==0?(k=nw(h,j,k),vf(h,j),(k|0)==0?ym(b,R.Mf|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)):(pw(b,0,f),Iw(b,k,-1))):(KC(b,m,0),vf(h,j))}}}}}while(0);a=e}Vv.X=1;function Wv(b,c,d){var e=a;a+=4;var f=p[b>>2],g=(Hm(b)|0)==0;a:do{if(g){if((c|0)==0){var h=f+4|0,i=p[h>>2];if((i|0)>0){for(var j=0;;){if((j|0)!=1&&(LC(b,j),i=p[h>>2]),j=j+1|0,(j|0)>=(i|0)){break a}}}}else{(p[d+4>>2]|0)==0?(h=MC(f,c),(h|0)>-1?LC(b,h):(h=Xu(f,c),(h|0)!=0&&(j=nw(f,h,0),(j|0)==0?(j=xm(b,0,h,0),(j|0)!=0&&NC(b,j,0)):NC(b,p[j+16>>2],j),vf(f,h)))):(h=lw(b,c,d,e),(h|0)>-1&&(j=p[p[f+8>>2]+(h<<4)>>2],h=Xu(f,p[e>>2]),(h|0)!=0&&(i=nw(f,h,j),(i|0)==0?(j=xm(b,0,h,j),(j|0)!=0&&NC(b,j,0)):NC(b,p[i+16>>2],i),vf(f,h))))}}}while(0);a=e}Wv.X=1;function Xv(b,c,d){var e,f,g=b|0,h=y[g>>2];f=(h+12|0)>>2;var i=p[f],j=l[h+30|0]<<24>>24==0;a:do{if(j){var k=xm(b,0,p[c+8>>2],p[c+4>>2]);if((k|0)==0){e=0}else{var m=p[g>>2];e=(k+68|0)>>2;var o=rm(m,p[e]),r=y[p[h+8>>2]+(o<<4)>>2];p[f]|=268435456;m=Xu(h,d);if((m|0)==0){e=0}else{var q=(Im(h,m,r)|0)==0;do{if(q&&(nw(h,m,r)|0)==0){d=(k|0)>>2;if((OC(b,p[d])|0)!=0){e=m;break a}if((mw(b,m)|0)!=0){e=m;break a}g=p[d];if((p[k+28>>2]|0)==0){if((Ru(b,26,r,g,0)|0)!=0){e=m;break a}if((Lw(b,k)|0)!=0){e=m;break a}(l[k+34|0]&16)<<24>>24==0?g=0:(g=iw(h,k),g=(p[p[p[g+8>>2]>>2]+76>>2]|0)!=0?g:0);j=Su(b);if((j|0)==0){e=m;break a}q=(g|0)!=0;pw(b,q&1,o);yw(b,o);if(q){var q=b+72|0,s=p[q>>2]+1|0;p[q>>2]=s;hw(j,94,0,s,0,m,0);hw(j,139,s,0,0,g,-10);Kx(b)}g=y[d];j=un(g,-1);if((p[f]&67108864|0)!=0){var u,q=b,s=PC(g,p[e]),w=(s|0)==0;b:do{if(w){u=0}else{for(var v=q|0,x=s,A=0;;){if(A=QC(p[v>>2],A,p[p[x>>2]>>2]),x=p[x+12>>2],(x|0)==0){u=A;break b}}}}while(0);(u|0)!=0&&(q=(o|0)==1?R.n|0:R.o|0,xw(b,R.Ge|0,(z=a,a+=20,p[z>>2]=r,p[z+4>>2]=q,p[z+8>>2]=g,p[z+12>>2]=m,p[z+16>>2]=u,z)),vf(h,u))}o=(o|0)==1?R.n|0:R.o|0;xw(b,R.He|0,(z=a,a+=36,p[z>>2]=r,p[z+4>>2]=o,p[z+8>>2]=m,p[z+12>>2]=m,p[z+16>>2]=m,p[z+20>>2]=m,p[z+24>>2]=m,p[z+28>>2]=j,p[z+32>>2]=g,z));(Im(h,R.ob|0,r)|0)!=0&&(o=p[d],xw(b,R.Ie|0,(z=a,a+=12,p[z>>2]=r,p[z+4>>2]=m,p[z+8>>2]=o,z)));r=RC(b,k);(r|0)!=0&&(xw(b,R.Je|0,(z=a,a+=12,p[z>>2]=m,p[z+4>>2]=m,p[z+8>>2]=r,z)),vf(h,r));r=(p[f]&67108864|0)==0;b:do{if(!r&&(o=PC(p[d],p[e]),(o|0)!=0)){for(;;){if(u=p[o>>2],(u|0)!=(k|0)&&SC(b,u,p[u>>2]),o=p[o+12>>2],(o|0)==0){break b}}}}while(0);SC(b,k,m);e=m;break a}ym(b,R.Fe|0,(z=a,a+=4,p[z>>2]=g,z));e=m;break a}}while(0);ym(b,R.Ee|0,(z=a,a+=4,p[z>>2]=m,z));e=m}}}else{e=0}}while(0);Mu(h,c);vf(h,e);p[f]=i}Xv.X=1;function Yv(b,c){var d,e,f=a;a+=4;var g=y[b>>2],h=(p[b+64>>2]|0)==0;a:do{if(h){var i=g+30|0;if(l[i]<<24>>24==0){e=y[b+504>>2]>>2;var j=rm(g,p[e+17]),k=y[p[g+8>>2]+(j<<4)>>2],m=p[e]+16|0,o=p[e+2]-1|0,r=p[e+3];d=p[(r+4>>2)+(o*6|0)];var q=Im(g,m,k),s=q|0;if((Ru(b,26,k,p[s>>2],0)|0)==0){var u=(d|0)==0?0:l[d|0]<<24>>24!=98?d:0;if(l[r+o*24+21|0]<<24>>24==0){if((p[e+4]|0)==0){d=(g+12|0)>>2;var w=(p[d]&67108864|0)==0;do{if(!w){w=(u|0)==0;if((p[e+9]|0)==0|w){var v=w;break}ym(b,R.te|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));break a}v=(u|0)==0}while(0);if(l[r+o*24+20|0]<<24>>24!=0&v){ym(b,R.ue|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z))}else{if(o=(u|0)!=0){if((TC(g,u,1,98,f)|0)!=0){l[i]=1;break}i=p[f>>2];if((i|0)==0){ym(b,R.ve|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));break}Hn(i)}u=c+4|0;i=Mm(g,p[c>>2],p[u>>2]);if((i|0)!=0){r=p[d];for(u=i+(p[u>>2]-1)|0;;){if(u>>>0<=i>>>0){break}w=t[u];if(w<<24>>24!=59&&(l[R.e+(w&255)|0]&1)<<24>>24==0){break}l[u]=0;u=u-1|0}p[d]|=268435456;u=(j|0)==1?R.n|0:R.o|0;e=p[e+12];w=e+1|0;xw(b,R.ye|0,(z=a,a+=24,p[z>>2]=k,p[z+4>>2]=u,p[z+8>>2]=e,p[z+12>>2]=i,p[z+16>>2]=w,p[z+20>>2]=m,z));vf(g,i);p[d]=r}k=b;o=o?3:2;m=Su(k);(m|0)!=0&&(d=rx(k),e=rx(k),gw(m,36,j,d,2),vm(m,j),V(m,7,o,e),o=gw(m,80,e,0,d),gw(m,37,j,2,e),fw(m,o),sx(k,d),sx(k,e));SC(b,q,p[s>>2])}}else{ym(b,R.se|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z))}}else{ym(b,R.re|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z))}}}}}while(0);a=f}Yv.X=1;function Zv(b,c){var d,e,f,g=p[b>>2],h=g+30|0,i=l[h]<<24>>24==0;do{if(i&&(e=xm(b,0,p[c+8>>2],p[c+4>>2]),f=e>>2,(e|0)!=0)){if((l[e+34|0]&16)<<24>>24==0){if((p[f+7]|0)==0){var j=e|0;if((OC(b,p[j>>2])|0)==0){var k=rm(g,p[f+17]),m=ni(g,76);if((m|0)!=0){p[b+504>>2]=m;var o=m+32|0;n[o>>1]=1;d=p[f+2];e=(m+8|0)>>2;p[e]=d;var r=ni(g,((d-1|0)/8&-1)*192+192|0);d=(m+12|0)>>2;p[d]=r;j=p[j>>2];j=zm(g,R.oe|0,(z=a,a+=4,p[z>>2]=j,z));p[m>>2]=j;r=p[d];if((r|0)==0|(j|0)==0){l[h]=1}else{Ah(r,p[f+3],p[e]*24|0);j=(p[e]|0)>0;a:do{if(j){for(r=0;;){var q=p[d],s=q+r*24|0,u=yl(g,p[s>>2]);p[s>>2]=u;p[(q+r*24+16|0)>>2]=0;p[(q+r*24+12|0)>>2]=0;p[(q+r*24+4|0)>>2]=0;p[(q+r*24+8|0)>>2]=0;r=r+1|0;if((r|0)>=(p[e]|0)){break a}}}}while(0);p[(m+68|0)>>2]=p[p[g+8>>2]+(k<<4)+12>>2];p[(m+48|0)>>2]=p[f+12];n[o>>1]=1;pw(b,0,k);(Su(b)|0)!=0&&yw(b,k)}}}}else{ym(b,R.ne|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z))}}else{ym(b,R.le|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z))}}}while(0);Mu(g,c)}Zv.X=1;function $v(b,c){var d,e,f=b>>2,g=b+504|0;d=p[g>>2];e=d>>2;var h=p[f];if((d|0)!=0&&(bw(b),p[f+129]=0,(p[e+14]|0)>=1)){if(l[h+124|0]<<24>>24==0){(c|0)!=0&&(p[f+122]=p[c+4>>2]+p[c>>2]-p[f+121]|0);g=zm(h,R.ie|0,(z=a,a+=4,p[z>>2]=b+484|0,z));e=rm(h,p[e+17]);var i=p[p[h+8>>2]+(e<<4)>>2],j=(e|0)==1?R.n|0:R.o|0;d=(d|0)>>2;var k=p[d],f=p[f+103];xw(b,R.je|0,(z=a,a+=24,p[z>>2]=i,p[z+4>>2]=j,p[z+8>>2]=k,p[z+12>>2]=k,p[z+16>>2]=g,p[z+20>>2]=f,z));vf(h,g);f=Su(b);yw(b,e);V(f,129,0,0);g=p[d];h=zm(h,R.ke|0,(z=a,a+=4,p[z>>2]=g,z));zw(f,e,h);h=p[d];hw(f,133,e,0,0,h,ve(h)+1|0)}else{f=p[e],(Ff(p[e+17]+8|0,f,ve(f),d)|0)==0?p[g>>2]=0:l[h+30|0]=1}}}$v.X=1;function aw(b,c,d,e){Uu(b,c,d,0,0,1,0);var f=p[b+504>>2];if((f|0)!=0){var d=b|0,g=p[d>>2],h=rm(g,p[f+68>>2]);l[f+34|0]|=16;p[(f+56|0)>>2]=0;var i=Xu(g,e);UC(g,f,i);i=yl(g,p[p[g+8>>2]+(h<<4)>>2]);UC(g,f,i);var i=f|0,j=yl(g,p[i>>2]);UC(g,f,j);p[b+488>>2]=p[e>>2]+p[e+4>>2]-p[c>>2]|0;c=p[f+60>>2];(c|0)!=0&&Ru(b,29,p[i>>2],p[c>>2],p[p[p[d>>2]+8>>2]+(h<<4)>>2])}}aw.X=1;function bw(b){var c=p[b+516>>2];if((c|0)!=0){var d=p[b+504>>2];if((d|0)!=0){var e=p[b>>2],b=Mm(e,c,p[b+520>>2]);UC(e,d,b)}}}function UC(b,c,d){var e;e=(c+56|0)>>2;var f=p[e],g=f+1|0;p[e]=g;var c=(c+60|0)>>2,h=Il(b,p[c],(f<<2)+8|0);if((h|0)==0){g=(f|0)>0;a:do{if(g){for(var i=0;;){if(vf(b,p[p[c]+(i<<2)>>2]),i=i+1|0,(i|0)==(f|0)){break a}}}}while(0);vf(b,d);vf(b,p[c]);p[e]=0}else{p[((f<<2)+h|0)>>2]=d,p[((g<<2)+h|0)>>2]=0}p[c]=h}function Xu(b,c){if((c|0)==0){var d=0}else{d=Mm(b,p[c>>2],p[c+4>>2]),Qt(d)}return d}function Ru(b,c,d,e,f){var g=p[b>>2];if(l[g+124|0]<<24>>24==0){if(l[b+524|0]<<24>>24!=0){b=0}else{var h=p[g+268>>2];(h|0)==0?b=0:(c=Gd[h](p[g+272>>2],c,d,e,f,p[b+512>>2]),(c|0)==1?(ym(b,R.mb|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),p[b+4>>2]=23,b=1):(c|0)==2||(c|0)==0?b=c:(VC(b),b=1))}}else{b=0}return b}function VC(b){var c=a;ym(b,R.he|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));p[b+4>>2]=1;a=c}function xw(b,c){var d=a;a+=8;var e=d+4;p[e>>2]=0;var f=p[b>>2];if((p[b+64>>2]|0)==0){p[d>>2]=arguments[xw.length];var g=ji(f,c,p[d>>2]);if((g|0)!=0){var h=b+18|0;l[h]=l[h]+1&255;var i=b+456|0,j=i|0,j=t[j]|t[j+1]<<8|t[j+2]<<16|t[j+3]<<24|0,k=i+4|0,k=t[k]|t[k+1]<<8|t[k+2]<<16|t[k+3]<<24|0,m=i+8|0,m=t[m]|t[m+1]<<8|t[m+2]<<16|t[m+3]<<24|0,o=i+12|0,o=t[o]|t[o+1]<<8|t[o+2]<<16|t[o+3]<<24|0,r=i+16|0,r=t[r]|t[r+1]<<8|t[r+2]<<16|t[r+3]<<24|0,q=i+20|0,q=t[q]|t[q+1]<<8|t[q+2]<<16|t[q+3]<<24|0,s=i+24|0,s=t[s]|t[s+1]<<8|t[s+2]<<16|t[s+3]<<24|0,u=i+28|0,u=t[u]|t[u+1]<<8|t[u+2]<<16|t[u+3]<<24|0,w=i+32|0,w=t[w]|t[w+1]<<8|t[w+2]<<16|t[w+3]<<24|0,v=i+36|0,v=t[v]|t[v+1]<<8|t[v+2]<<16|t[v+3]<<24|0,x=i+40|0,x=t[x]|t[x+1]<<8|t[x+2]<<16|t[x+3]<<24|0,A=i+44|0,A=t[A]|t[A+1]<<8|t[A+2]<<16|t[A+3]<<24|0,E=i+48|0,E=t[E]|t[E+1]<<8|t[E+2]<<16|t[E+3]<<24|0,J=i+52|0,J=t[J]|t[J+1]<<8|t[J+2]<<16|t[J+3]<<24|0,M=i+56|0,M=t[M]|t[M+1]<<8|t[M+2]<<16|t[M+3]<<24|0,D=i+60|0,D=t[D]|t[D+1]<<8|t[D+2]<<16|t[D+3]<<24|0,K=i+64|0,K=t[K]|t[K+1]<<8|t[K+2]<<16|t[K+3]<<24|0,H=i+68|0,H=t[H]|t[H+1]<<8|t[H+2]<<16|t[H+3]<<24|0,N=i+72|0,N=t[N]|t[N+1]<<8|t[N+2]<<16|t[N+3]<<24|0,Q=i+76|0,Q=t[Q]|t[Q+1]<<8|t[Q+2]<<16|t[Q+3]<<24|0,P=i+80|0,P=t[P]|t[P+1]<<8|t[P+2]<<16|t[P+3]<<24|0,L=i+84|0,L=t[L]|t[L+1]<<8|t[L+2]<<16|t[L+3]<<24|0,I=i+88|0,I=t[I]|t[I+1]<<8|t[I+2]<<16|t[I+3]<<24|0,X=i+92|0,X=t[X]|t[X+1]<<8|t[X+2]<<16|t[X+3]<<24|0,Y=i+96|0,Y=t[Y]|t[Y+1]<<8|t[Y+2]<<16|t[Y+3]<<24|0;Ed(i,0,100);An(b,g,e);vf(f,p[e>>2]);vf(f,g);e=i|0;B=j;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255;e=i+4|0;B=k;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255;e=i+8|0;B=m;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255;e=i+12|0;B=o;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255;e=i+16|0;B=r;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255;e=i+20|0;B=q;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255;e=i+24|0;B=s;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255;e=i+28|0;B=u;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255;e=i+32|0;B=w;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255;e=i+36|0;B=v;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255;e=i+40|0;B=x;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255;e=i+44|0;B=A;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255;e=i+48|0;B=E;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255;e=i+52|0;B=J;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255;e=i+56|0;B=M;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255;e=i+60|0;B=D;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255;e=i+64|0;B=K;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255;e=i+68|0;B=H;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255;e=i+72|0;B=N;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255;e=i+76|0;B=Q;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255;e=i+80|0;B=P;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255;e=i+84|0;B=L;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255;e=i+88|0;B=I;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255;e=i+92|0;B=X;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255;i=i+96|0;B=Y;l[i]=B&255;B>>=8;l[i+1]=B&255;B>>=8;l[i+2]=B&255;B>>=8;l[i+3]=B&255;l[h]=l[h]-1&255}}a=d}xw.X=1;function Cl(b,c){return((c|0)==0?0:y[b+260>>2]>>>0>c>>>0?0:y[b+264>>2]>>>0>c>>>0)&1}function rx(b){var c=b+19|0,d=l[c];d<<24>>24==0?(b=b+72|0,c=p[b>>2]+1|0,b=p[b>>2]=c):(d=d-1&255,l[c]=d,b=p[b+((d&255)<<2)+24>>2]);return b}function sx(b,c){var d=(c|0)==0;a:do{if(!d){var e=b+19|0,f=t[e];if((f&255)<8){for(var g=b+100|0,h=0;;){if((h|0)>=10){l[e]=f+1&255;p[b+((f&255)<<2)+24>>2]=c;break a}if((p[g+16>>2]|0)==(c|0)){l[g+8|0]=1;break a}g=g+24|0;h=h+1|0}}}}while(0)}function Su(b){var c=b+12|0,d=p[c>>2];(d|0)==0?(b=Am(p[b>>2]),p[c>>2]=b,(b|0)==0?c=0:(ew(b,148),c=b)):c=d;return c}function yw(b,c){var d=rx(b),e=p[b+12>>2];V(e,7,p[p[p[p[b>>2]+8>>2]+(c<<4)+12>>2]>>2]+1|0,d);gw(e,37,c,1,d);sx(b,d)}function V(b,c,d,e){return gw(b,c,d,e,0)}function zw(b,c,d){c=gw(b,106,c,0,0);Dm(b,c,d,-1);d=b|0;c=(p[p[d>>2]+4>>2]|0)>0;a:do{if(c){for(var e=0;;){if(vm(b,e),e=e+1|0,(e|0)>=(p[p[d>>2]+4>>2]|0)){break a}}}}while(0)}function hw(b,c,d,e,f,g,h){c=gw(b,c,d,e,f);Dm(b,c,g,h);return c}function gw(b,c,d,e,f){var g,h;g=(b+28|0)>>2;var i=p[g];if((p[b+32>>2]|0)>(i|0)){k=i,h=4}else{if((Jm(b)|0)!=0){var j=1;h=5}else{var k=p[g];h=4}}h==4&&(p[g]=k+1|0,b=p[b+4>>2],l[b+i*20|0]=c&255,l[b+i*20+3|0]=0,p[(b+i*20+4|0)>>2]=d,p[(b+i*20+8|0)>>2]=e,p[(b+i*20+12|0)>>2]=f,p[(b+i*20+16|0)>>2]=0,l[b+i*20+1|0]=0,j=i);return j}function Jm(b){var c=b+32|0,d=p[c>>2],e=b|0,b=b+4|0,d=Il(p[e>>2],p[b>>2]|0,(d|0)==0?1020:d*40|0),f=(d|0)!=0;f&&(e=Dl(p[e>>2],d),p[c>>2]=Math.floor((e>>>0)/20),p[b>>2]=d);return f?0:7}function Dl(b,c){var d;if((b|0)==0){d=4}else{if((Cl(b,c)|0)==0){d=4}else{var e=Vc[b+232>>1]&65535;d=5}}d==4&&(e=Gd[p[of+40>>2]](c));return e}function ew(b,c){return gw(b,c,0,0,0)}function OC(b,c){if((ve(c)|0)>6){if((te(c,R.N|0,7)|0)!=0){var d=0}else{ym(b,R.qe|0,(z=a,a+=4,p[z>>2]=c,z)),d=1}}else{d=0}return d}function pw(b,c,d){var e=p[b+428>>2],e=(e|0)==0?b:e;ow(b,d);p[(e+340|0)>>2]|=1<<d;b=e+348|0;l[b]=(t[b]&255|c)&255}function ow(b,c){var d,e=p[b+428>>2],e=(e|0)==0?b:e;d=e+352|0;if((p[d>>2]|0)==0){var f=Su(e);(f|0)==0?d=8:(f=V(f,1,0,0)+1|0,p[d>>2]=f,d=4)}else{d=4}if(d==4&&(c|0)>-1){d=1<<c;var f=e+344|0,g=p[f>>2];if((g&d|0)==0){var h=p[e>>2];p[f>>2]=g|d;p[((c<<2)+e+356|0)>>2]=p[p[p[h+8>>2]+(c<<4)+12>>2]>>2];(c|0)==1&&oi(e)}}}function oi(b){var c=a;a+=4;var d=p[b>>2],e=d+8|0,f=(p[p[e>>2]+20>>2]|0)==0;do{if(f){if(l[b+480|0]<<24>>24!=0){var g=0}else{g=yo(p[d>>2],0,d,c,0,542);if((g|0)==0){g=p[c>>2];p[(p[e>>2]+20|0)>>2]=g;if((bi(p[g>>2],p[g+4>>2],p[d+36>>2],-1,0)|0)!=7){g=0;break}l[d+30|0]=1}else{ym(b,R.pe|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),p[b+4>>2]=g}g=1}}else{g=0}}while(0);a=c;return g}function Im(b,c,d){var e=ve(c),f=y[b+4>>2],g=(d|0)==0,b=b+8|0;a:do{if(g){for(var h=0,i=0;;){if((h|0)>=(f|0)){var j=i;break a}var k=i=Ao(p[p[b>>2]+(((h|0)<2&1^h)<<4)+12>>2]+8|0,c,e);if((i|0)!=0){j=k;break a}h=h+1|0;i=k}}else{for(i=h=0;;){if((h|0)>=(f|0)){j=i;break a}var k=(h|0)<2&1^h,m=y[b>>2];if((qm(d,p[m+(k<<4)>>2])|0)==0){k=i=Ao(p[m+(k<<4)+12>>2]+8|0,c,e);if((i|0)!=0){j=k;break a}i=k}h=h+1|0}}}while(0);return j}function TC(b,c,d,e,f){var g,h,i=a;a+=4;h=i>>2;p[h]=0;var j=(c|0)==0;a:do{if(j){var k=p[f>>2]=0}else{var k=l[c|0],k=k<<24>>24==-124?l[c+35|0]:k,m=k&255;if(k<<24>>24==-100){var o=y[c+8>>2],r=t[o|0];if((r+127&255)<2){k=R.De|0,s=q=-1,m=r&255}else{var k=xh|0,o=c,q=0,s=1}}else{k=xh|0,o=c,q=0,s=1}r=(m|0)==130;b:do{if((m|0)==130||(m|0)==129||(m|0)==94){if(g=hi(b),p[h]=g,(g|0)==0){var u=0;g=33}else{var w=(n[o+2>>1]&1024)<<16>>16==0;do{if(w){var v=p[o+4>>2],v=zm(b,R.$a|0,(z=a,a+=8,p[z>>2]=k,p[z+4>>2]=v,z));if((v|0)==0){u=g;g=33;break b}ii(g,-1,v,1,4);r&&(l[g+30|0]=2)}else{v=p[o+4>>2],v=(T.multiply(v,(v|0)<0?-1:0,s,q),T.result[0]),$k(g,v,T.result[1])}}while(0);(m-129|0)>>>0<2&e<<24>>24==98?WC(g,99,1):WC(g,e,1);var x=g+28|0,w=n[x>>1];(w&12)<<16>>16!=0&&(n[x>>1]=w&-3);d<<24>>24!=1&&Lk(g,d&255);x=g;g=30}}else{if((m|0)==156){g=TC(b,p[o+8>>2],d,e,i),x=y[h],(g|0)==0&&(XC(x),g=(x+16|0)>>2,w=p[g],v=p[g+1],w==0&&v==-2147483648?(g=x+28|0,n[g>>1]=n[g>>1]&4|8,g=x+8|0,xd[0]=0x7ffffffffffffc00,p[g>>2]=C[0],p[g+4>>2]=C[1],g=0x7ffffffffffffc00):(w=(T.b(0,0,w,v),T.result[0]),v=T.result[1],p[g]=w,p[g+1]=v,g=x+8|0,g=(C[0]=p[g>>2],C[1]=p[g+4>>2],xd[0])),w=x+8|0,xd[0]=-g,p[w>>2]=C[0],p[w+4>>2]=C[1],WC(x,e,d)),g=30}else{if((m|0)==98){if(g=hi(b),p[h]=g,(g|0)==0){u=0,g=33}else{var A=g;g=31}}else{if((m|0)==131){g=hi(b),p[h]=g,(g|0)==0?(u=0,g=33):(w=p[o+4>>2]+2|0,A=ve(w)-1|0,w=YC(b,w,A),Tk(g,w,(A|0)/2&-1,0,4),A=g,g=31)}else{var E=0;g=32}}}}}while(0);do{if(g==30){(x|0)==0?(E=0,g=32):(A=x,g=31)}else{if(g==33){l[b+30|0]=1;vf(b,0);Hn(u);p[f>>2]=0;k=7;break a}}}while(0);g==31&&(Ql(A),E=A);p[f>>2]=E;k=0}}while(0);a=i;return k}TC.X=1;function SC(b,c,d){var e,f,g=Su(b),h=(g|0)==0;do{if(!h){f=(b|0)>>2;var i=p[f],j=rm(i,p[c+68>>2]),i=ZC(p[p[i+8>>2]+28>>2],l[b+446|0],c),k=(i|0)==0;a:do{if(!k){e=i;for(e>>=2;;){hw(g,110,rm(p[f],p[e+5]),0,0,p[e],0);e=p[e+8];if((e|0)==0){break a}e>>=2}}}while(0);hw(g,108,j,0,0,p[c>>2],0);f=zm(p[f],R.ze|0,(z=a,a+=4,p[z>>2]=d,z));(f|0)!=0&&(zw(g,j,f),j=RC(b,c),(j|0)!=0&&zw(g,1,j))}}while(0)}function ZC(b,c,d){c=c<<24>>24==0;a:do{if(c){var e=d+68|0,f=p[e>>2],g=(f|0)==(b|0);do{if(!g){var h=p[b+48>>2];if((h|0)!=0){for(var i=d|0,j=d+64|0,k=0,m=f;;){var o=p[h+8>>2],r=o;(p[o+24>>2]|0)==(m|0)?(qm(p[o+4>>2],p[i>>2])|0)!=0?o=k:(p[(o+32|0)>>2]=(k|0)==0?p[j>>2]:k,o=r):o=k;h=p[h>>2];if((h|0)==0){break}k=o;m=p[e>>2]}if((o|0)!=0){e=o;break a}}}}while(0);e=p[d+64>>2]}else{e=0}}while(0);return e}ZC.X=1;function RC(b,c){var d,e;e=(b|0)>>2;var f=p[e],g=p[p[f+8>>2]+28>>2],h=(p[c+68>>2]|0)==(g|0);do{if(h){d=0}else{if(d=ZC(g,l[b+446|0],c),(d|0)==0){d=0}else{d>>=2;for(var i=0;;){var j=(p[d+5]|0)==(g|0)?QC(f,i,p[d]):i;d=p[d+8];if((d|0)==0){break}d>>=2;i=j}(j|0)==0?d=0:(d=zm(p[e],R.Ae|0,(z=a,a+=4,p[z>>2]=j,z)),vf(p[e],j))}}}while(0);return d}function QC(b,c,d){(c|0)==0?b=zm(b,R.Be|0,(z=a,a+=4,p[z>>2]=d,z)):(d=zm(b,R.Ce|0,(z=a,a+=8,p[z>>2]=c,p[z+4>>2]=d,z)),vf(b,c),b=d);return b}function fw(b,c){(c|0)>-1&&tm(b,c,p[b+28>>2])}function Ik(b){if(b<-0x7ffffffffffffc00|b>0x7ffffffffffffc00){var b=-2147483648,c=0}else{c=b>>>0,b=Math.min(Math.floor(b/4294967296),4294967295)}return[c,b]}function iw(b,c){for(var d=c+52|0;;){var e=p[d>>2];if((e|0)==0){break}if((p[e>>2]|0)==(b|0)){break}d=e+24|0}return e}function Kx(b){var c=p[b+428>>2];l[((c|0)==0?b:c)+349|0]=1}function XC(b){var c;c=(b+28|0)>>1;var d=n[c];if((d&13)<<16>>16==0){if((Hk(p[b+4>>2],b+16|0,p[b+24>>2],l[b+31|0])|0)==0){b=n[c]&-16640|4,n[c]=b}else{var d=Dk(b),e=b+8|0;xd[0]=d;p[e>>2]=C[0];p[e+4>>2]=C[1];n[c]=n[c]&-16640|8;$C(b);b=n[c]}}else{b=d}n[c]=b&-19}function YC(b,c,d){b=zh(b,((d|0)/2&-1)+1|0);d=d-1|0;if((b|0)!=0){if((d|0)>0){for(var e=0;;){l[b+((e|0)/2&-1)|0]=Op(l[c+(e|1)|0]<<24>>24)|Op(l[c+e|0]<<24>>24)<<4;var f=e+2|0;if((f|0)>=(d|0)){break}e=f}c=(f|0)/2&-1}else{c=0}l[b+c|0]=0}return b}function $C(b){var c=b+8|0,d=(C[0]=p[c>>2],C[1]=p[c+4>>2],xd[0]),e=Ik(d),c=e[0],e=e[1],f=b+16|0;p[f>>2]=c;p[f+4>>2]=e;d=d!=c+e*4294967296;c=(T.add(c,e,1,-2147483648),T.result[0]);e=T.result[1];d|(e>>>0<0||e>>>0==0&&c>>>0<2)||(n[(b+28|0)>>1]|=4)}function WC(b,c,d){if(c<<24>>24==97){var c=(b+28|0)>>1,e=Vc[c],f=e&65535;(f&2|0)!=0|(f&12|0)==0?b=e:(Kk(b,d&255),b=n[c]);n[c]=b&-13}else{c<<24>>24!=98&&(mm(b),(n[b+28>>1]&8)<<16>>16!=0&&$C(b))}}function Kk(b,c){var d;d=(b+28|0)>>1;var e=n[d];if((yk(b,32,0)|0)==0){var f=b+4|0,g=p[f>>2];if((e&4)<<16>>16==0){e=b+8|0,e=(C[0]=p[e>>2],C[1]=p[e+4>>2],xd[0]),Ch(32,g,R.nb|0,(z=a,a+=8,xd[0]=e,p[z>>2]=C[0],p[z+4>>2]=C[1],z))}else{var h=b+16|0,e=p[h>>2],h=p[h+4>>2];Ch(32,g,R.U|0,(z=a,a+=8,p[z>>2]=e,p[z+4>>2]=h,z))}p[b+24>>2]=ve(p[f>>2]);l[b+31|0]=1;n[d]|=514;Lk(b,c);d=0}else{d=7}return d}function nw(b,c,d){var e=ve(c),f=y[b+4>>2],b=b+8|0,g=(d|0)==0;a:do{if(g){for(var h=0,i=0;;){if((h|0)>=(f|0)){var j=i;break a}var k=i=Ao(p[p[b>>2]+(((h|0)<2&1^h)<<4)+12>>2]+24|0,c,e);if((i|0)!=0){j=k;break a}h=h+1|0;i=k}}else{for(i=h=0;;){if((h|0)>=(f|0)){j=i;break a}var k=(h|0)<2&1^h,m=y[b>>2];if((qm(d,p[m+(k<<4)>>2])|0)==0){k=i=Ao(p[m+(k<<4)+12>>2]+24|0,c,e);if((i|0)!=0){j=k;break a}i=k}h=h+1|0}}}while(0);return j}function mw(b,c){var d=p[b>>2];l[d+124|0]<<24>>24==0?l[b+18|0]<<24>>24!=0?d=0:(p[d+12>>2]&65536|0)!=0?d=0:(te(c,R.N|0,7)|0)!=0?d=0:(ym(b,R.zf|0,(z=a,a+=4,p[z>>2]=c,z)),d=1):d=0;return d}function Lw(b,c){var d,e,f=p[b>>2],g=a;a+=4;e=p[b>>2];if((l[c+34|0]&16)<<24>>24==0){e=0}else{if((iw(e,c)|0)!=0){e=0}else{var h=p[p[c+60>>2]>>2];d=Ao(e+288|0,h,ve(h));(d|0)==0?(ym(b,R.xb|0,(z=a,a+=4,p[z>>2]=h,z)),e=1):(p[g>>2]=0,h=aD(e,c,d,p[p[d>>2]+8>>2],g),d=p[g>>2],(h|0)!=0&&ym(b,R.d|0,(z=a,a+=4,p[z>>2]=d,z)),vf(e,d),e=h)}}a=g;if((e|0)==0){if((l[c+34|0]&16)<<24>>24!=0){f=0}else{if(e=(c+8|0)>>2,g=p[e],(g|0)>0){f=0}else{if((g|0)<0){f=p[c>>2],ym(b,R.Ke|0,(z=a,a+=4,p[z>>2]=f,z)),f=1}else{if(g=Qw(f,p[c+28>>2],0),(g|0)==0){f=1}else{var i=f+234|0,j=l[i],k=b+68|0,m=p[k>>2];bD(b,p[g+8>>2]);p[e]=-1;l[i]=0;d=(f+268|0)>>2;var o=p[d];p[d]=0;h=vw(b,g);p[d]=o;l[i]=j;p[k>>2]=m;(h|0)==0?(p[e]=0,e=1):(d=h+8|0,p[e]=p[d>>2],e=h+12|0,p[c+12>>2]=p[e>>2],p[d>>2]=0,p[e>>2]=0,rf(f,h),n[(p[c+68>>2]+78|0)>>1]|=2,e=0);Zf(f,g);f=e}}}}}else{f=1}return f}Lw.X=1;function PC(b,c){return Ao(c+56|0,b,ve(b))}function Qw(b,c,d){if((c|0)==0){c=0}else{var e=zh(b,76);if((e|0)==0){c=0}else{var f=Ov(b,p[c>>2],d);p[e>>2]=f;f=cD(b,p[c+8>>2],d);p[e+8>>2]=f;f=Pv(b,p[c+12>>2],d);p[e+12>>2]=f;f=Ov(b,p[c+16>>2],d);p[e+16>>2]=f;f=Pv(b,p[c+20>>2],d);p[e+20>>2]=f;f=Ov(b,p[c+24>>2],d);p[e+24>>2]=f;l[e+4|0]=l[c+4|0];f=Qw(b,p[c+28>>2],d);p[e+28>>2]=f;(f|0)!=0&&(p[(f+32|0)>>2]=e);p[e+32>>2]=0;f=Pv(b,p[c+40>>2],d);p[e+40>>2]=f;b=Pv(b,p[c+44>>2],d);p[e+44>>2]=b;p[e+48>>2]=0;p[e+52>>2]=0;n[e+6>>1]=n[c+6>>1]&-9;p[e+36>>2]=0;p[e+56>>2]=-1;p[e+60>>2]=-1;p[e+64>>2]=-1;c=e}}return c}Qw.X=1;function bD(b,c){var d=(c|0)==0;a:do{if(!d){for(var e=c|0,f=b+68|0,g=c+4|0,h=0;;){if((h|0)>=(n[e>>1]<<16>>16|0)){break a}var i=g+32|0;if((p[i>>2]|0)>-1){break a}var j=p[f>>2];p[f>>2]=j+1|0;p[i>>2]=j;i=p[g+16>>2];(i|0)!=0&&bD(b,p[i+8>>2]);g=g+60|0;h=h+1|0}}}while(0)}function vw(b,c){var d,e=b|0,f=p[e>>2];d=(f+12|0)>>2;var g=p[d];p[d]=g&-3073|2048;Rw(b,c,0);var h=(p[b+64>>2]|0)==0;do{if(h){for(var i=c;;){var j=p[i+28>>2];if((j|0)==0){break}i=j}p[d]=g;var k=j=ni(f,76);if((j|0)==0){i=0;break}n[j+32>>1]=1;p[j>>2]=0;p[(j+24|0)>>2]=1e6;var m=j+8|0,o=j+12|0;dD(p[e>>2],p[i>>2],m,o);eD(b,p[m>>2],p[o>>2],i);p[(j+4|0)>>2]=-1;if(l[f+30|0]<<24>>24==0){i=k;break}rf(f,k)}i=0}while(0);return i}vw.X=1;function Rw(b,c,d){if((c|0)!=0){var e=p[b>>2];if((n[c+6>>1]&32)<<16>>16==0){var f,g=a;a+=16;f=g>>2;p[f+1]=36;p[f]=38;p[f+2]=b;fD(g,c);a=g;f=b+64|0;(p[f>>2]|0)==0&&(e=e+30|0,l[e]<<24>>24==0&&(gD(b,c,d),(p[f>>2]|0)==0&&l[e]<<24>>24==0&&(e=a,a+=16,d=e>>2,p[d+1]=44,p[d]=38,p[d+2]=b,fD(e,c),a=e)))}}}function dD(b,c,d,e){var f=p[c>>2];p[d>>2]=f;var g=ni(b,f*24|0);p[e>>2]=g;var h=(g|0)==0;do{if(!h){for(var i=c+12|0,j=b+30|0,k=g,m=0;;){if((m|0)>=(f|0)){break}var o=p[i>>2],r=p[(o+4>>2)+(m*5|0)],q=(r|0)==0;a:do{if(q){for(var s=o+m*20|0;;){var u=p[s>>2],s=l[u|0];if(s<<24>>24==118){s=u+12|0}else{if(s<<24>>24==-104){s=p[u+40>>2];if((s|0)==0){break}o=n[u+28>>1];o=o<<16>>16<0?p[s+4>>2]:o<<16>>16;o=(o|0)>-1?p[(p[s+12>>2]>>2)+(o*6|0)]:R.Z|0;s=zm(b,R.d|0,(z=a,a+=4,p[z>>2]=o,z));break a}else{if(s<<24>>24==26){o=p[u+4>>2];s=zm(b,R.d|0,(z=a,a+=4,p[z>>2]=o,z));break a}else{break}}}}s=p[(o+8>>2)+(m*5|0)];s=zm(b,R.d|0,(z=a,a+=4,p[z>>2]=s,z))}else{s=yl(b,r)}}while(0);if(l[j]<<24>>24!=0){vf(b,s);break}o=ve(s);r=s;for(s=q=0;;){if((s|0)>=(m|0)){var w=r;break}if((qm(p[(g>>2)+(s*6|0)],r)|0)==0){l[r+o|0]=0;q=q+1|0;s=zm(b,R.Le|0,(z=a,a+=8,p[z>>2]=r,p[z+4>>2]=q,z));vf(b,r);if((s|0)==0){w=0;break}r=s;s=-1}s=s+1|0}p[k>>2]=w;k=k+24|0;m=m+1|0}if(l[j]<<24>>24!=0){i=(m|0)>0;a:do{if(i){for(j=0;;){if(vf(b,p[(g>>2)+(j*6|0)]),j=j+1|0,(j|0)==(m|0)){break a}}}}while(0);vf(b,g);p[e>>2]=0;p[d>>2]=0}}}while(0)}dD.X=1;function Yu(b){var c,d=(b|0)==0;a:do{if(d){var e=99}else{var f=b,g=0,h=99;b:for(;;){c=t[f];if(c<<24>>24==0){e=h;break a}var i=t[R.i+(c&255)|0]&255|g<<8,j=f+1|0;do{if((i|0)==1667785074||(i|0)==1668050786||(i|0)==1952807028){f=j;g=i;h=97;continue b}else{if((i|0)==1651273570){if(h<<24>>24==99||h<<24>>24==101){f=j;g=1651273570;h=98;continue b}c=9}else{if((i|0)==1919246700){if(h<<24>>24==99){f=j;g=1919246700;h=101;continue b}c=9}else{if((i|0)==1718382433){if(h<<24>>24==99){f=j;g=1718382433;h=101;continue b}c=8}else{if((i|0)==1685026146){if(h<<24>>24==99){f=j;g=1685026146;h=101;continue b}c=8}else{if((i&16777215|0)==6909556){e=100;break a}f=j;g=i;continue b}}}}}}while(0);c==8?(f=j,g=i):c==9&&(f=j,g=i)}}}while(0);return e}function eD(b,c,d,e){var f=a;a+=36;var g=p[b>>2],h=l[g+30|0]<<24>>24==0;a:do{if(h){for(var i=f>>2,j=i+9;i<j;i++){p[i]=0}p[f+4>>2]=p[e+8>>2];i=p[p[e>>2]+12>>2];if((c|0)>0){for(var j=d,k=0;;){var m=p[(i>>2)+(k*5|0)],o=hD(f,m,0,0,0),o=yl(g,o);p[j+12>>2]=o;o=iD(m);l[j+22|0]=o<<24>>24==0?98:o;m=bx(b,m);(m|0)!=0&&(m=yl(g,p[m>>2]),p[j+16>>2]=m);k=k+1|0;if((k|0)==(c|0)){break a}j=j+24|0}}}}while(0);a=f}function hD(b,c,d,e,f){var g,h,i,j,k,m,o=a;a+=84;m=o>>2;var r=o+4;k=r>>2;var q=o+8;j=q>>2;var s=o+12;i=s>>2;var u=o+48;h=u>>2;p[m]=0;p[k]=0;p[j]=0;var w=(c|0)==0;do{if(w){var v=0}else{if((p[b+4>>2]|0)==0){v=0}else{v=t[c|0]&255;a:do{if((v|0)==154||(v|0)==152){var x=Vc[c+28>>1],A=x<<16>>16,E=c+24|0,J=b,M=0,D=0;for(g=D>>2;;){if((D|0)!=0){break}b:for(;;){if((J|0)==0){J=0;break a}var K=p[J+4>>2];g=n[K>>1]<<16>>16;for(var H=0;;){if((H|0)>=(g|0)){break}if((p[(K+36>>2)+(H*15|0)]|0)==(p[E>>2]|0)){break b}H=H+1|0}J=p[J+32>>2]}M=p[(K+20>>2)+(H*15|0)];D=p[(K+16>>2)+(H*15|0)];g=D>>2}(M|0)==0?(E=p[g+17],(E|0)==0?J=0:(x=x<<16>>16<0?p[g+1]:A,(x|0)<0?(A=R.qb|0,x=R.Z|0):(M=p[g+3],A=p[(M+12>>2)+(x*6|0)],x=p[(M>>2)+(x*6|0)]),p[j]=x,p[k]=p[g],J=p[J>>2],(J|0)!=0&&(J=p[J>>2],p[m]=p[p[J+8>>2]+(rm(J,E)<<4)>>2]),J=A)):x<<16>>16>-1?(g=p[M>>2],(A|0)<(p[g>>2]|0)?(g=p[(p[g+12>>2]>>2)+(A*5|0)],p[i+1]=p[M+8>>2],p[i+8]=J,p[i]=p[J>>2],J=hD(s,g,o,r,q)):J=0):J=0}else{(v|0)==116?(J=p[c+16>>2],g=p[p[p[J>>2]+12>>2]>>2],p[h+1]=p[J+8>>2],p[h+8]=b,p[h]=p[b>>2],J=hD(u,g,o,r,q)):J=0}}while(0);(d|0)!=0&&(p[d>>2]=p[m],p[e>>2]=p[k],p[f>>2]=p[j]);v=J}}}while(0);a=o;return v}hD.X=1;function iD(b){for(var c;;){var d=l[b|0];if(d<<24>>24==116){b=p[p[p[p[b+16>>2]>>2]+12>>2]>>2]}else{if(d<<24>>24==37){var e=Yu(p[b+4>>2]);c=9}else{if(d<<24>>24==-102||d<<24>>24==-104||d<<24>>24==-124){c=p[b+40>>2];if((c|0)==0){c=8;break}e=n[b+28>>1];if(e<<16>>16<0){e=100;c=9;break}e=l[p[c+12>>2]+(e<<16>>16)*24+22|0];c=9}else{c=8}}break}}c==8&&(e=l[b+1|0]);return e}function bx(b,c){var d=c,e=0;a:for(;;){if((d|0)==0){var f=e;break}var g=p[d+20>>2];if((g|0)!=0){f=g;break}var h=l[d|0],e=p[d+40>>2],i=(e|0)==0;do{if(!i){if(!(h<<24>>24==-102||h<<24>>24==-104||h<<24>>24==-124||h<<24>>24==60)){if(h<<24>>24==-99||h<<24>>24==37){break}else{f=0;break a}}f=n[d+28>>1];if(f<<16>>16<=-1){f=0;break a}d=p[b>>2];f=wo(d,l[p[p[d+8>>2]+12>>2]+77|0],p[(p[e+12>>2]+16>>2)+((f<<16>>16)*6|0)],0);p[c+20>>2]=f;break a}if(!(h<<24>>24==-99||h<<24>>24==37)){f=g;break a}}while(0);d=p[d+8>>2];e=g}(f|0)==0?e=0:(e=p[f>>2],d=p[b>>2],(jD(d,l[p[p[d+8>>2]+12>>2]+77|0],f,e)|0)!=0?e=0:(ym(b,R.pb|0,(z=a,a+=4,p[z>>2]=e,z)),e=b+64|0,p[e>>2]=p[e>>2]+1|0,e=1));return(e|0)==0?f:0}function jD(b,c,d,e){if((d|0)==0){if(d=wo(b,c,e,0),(d|0)==0){d=4}else{var f=d,d=3}}else{f=d,d=3}if(d==3){if((p[f+12>>2]|0)==0){d=4}else{var g=f,d=8}}if(d==4){f=c&255;g=b+200|0;(p[g>>2]|0)==0?f=4:(d=yl(b,e),(d|0)==0?f=8:(Gd[p[g>>2]](p[b+208>>2],b,f,d),vf(b,d),f=4));if(f==4&&(f=b+204|0,(p[f>>2]|0)!=0)){g=hi(b);ii(g,-1,e,1,0);d=zk(g,2);if((d|0)!=0){Gd[p[f>>2]](p[b+208>>2],b,t[p[p[b+8>>2]+12>>2]+77|0]&255,d)}Hn(g)}c=wo(b,c,e,0);if((c|0)==0){b=0}else{if((p[c+12>>2]|0)!=0){b=c}else{e=p[c>>2];for(f=0;;){if((f|0)>=3){var h=1;break}g=wo(b,l[R.pr+f|0],e,0);if((p[g+12>>2]|0)!=0){Ah(c,g,20);h=p[c+16>>2]=0;break}f=f+1|0}b=(h|0)==0?c:0}}g=b}return g}function gD(b,c,d){var e,f=a;a+=16;e=f>>2;p[e]=40;p[e+1]=42;p[e+2]=b;p[e+3]=d;fD(f,c);a=f}function kD(b,c){var d=c+6|0,e=n[d>>1],f=(e&32)<<16>>16==0;a:do{if(f){n[d>>1]=e|32;var g=p[b+8>>2],h=p[c+8>>2],i=h|0,j=n[i>>1];if(j<<16>>16>0){for(var k=0,h=h+4|0;;){var m=p[h+12>>2],o=(m|0)==0;do{if(o){var r=j}else{if((l[m+34|0]&2)<<24>>24==0){r=j}else{for(r=p[h+16>>2];;){var q=p[r+28>>2];if((q|0)==0){break}r=q}eD(g,p[m+8>>2],p[m+12>>2],r);r=n[i>>1]}}}while(0);k=k+1|0;if((k|0)>=(r<<16>>16|0)){break a}h=h+60|0;j=r}}}}while(0);return 0}kD.X=1;function fD(b,c){var d=(c|0)==0;a:do{if(d){var e=0}else{if(e=b+4|0,(p[e>>2]|0)==0){e=0}else{for(var f=0,g=c;;){if((g|0)==0){var h=f;break}f=Gd[p[e>>2]](b,g);if((f|0)!=0){h=f;break}var i=b,j=g>>2;if((((lD(i,p[j])|0)==0?(mD(i,p[j+3])|0)!=0?2:(lD(i,p[j+4])|0)!=0?2:(mD(i,p[j+5])|0)!=0?2:(lD(i,p[j+6])|0)!=0?2:(mD(i,p[j+10])|0)!=0?2:(mD(i,p[j+11])|0)==0?0:2:2)|0)!=0){e=2;break a}var i=b,j=p[g+8>>2],k=(j|0)==0;b:do{if(k){var m=0}else{for(var o=j+4|0,r=n[j>>1]<<16>>16;;){if((r|0)<=0){m=0;break b}if((fD(i,p[o+16>>2])|0)!=0){m=2;break b}o=o+60|0;r=r-1|0}}}while(0);if((m|0)!=0){e=2;break a}g=p[g+28>>2]}e=h&2}}}while(0);return e}function lD(b,c){var d=(c|0)==0;a:do{if(d){var e=0}else{for(var f=p[c+12>>2],g=p[c>>2];;){if((g|0)<=0){e=0;break a}if((mD(b,p[f>>2])|0)!=0){e=2;break a}f=f+20|0;g=g-1|0}}}while(0);return e}function mD(b,c){var d=(c|0)==0;a:do{if(d){var e=0}else{var e=Gd[p[b>>2]](b,c),f=(e|0)==0;do{if(f){var g=c+2|0;if((n[g>>1]&16384)<<16>>16==0){if((mD(b,p[c+8>>2])|0)!=0){e=2;break a}if((mD(b,p[c+12>>2])|0)!=0){e=2;break a}var h=c+16|0;if((n[g>>1]&2048)<<16>>16==0){if((lD(b,p[h>>2])|0)!=0){e=2;break a}}else{if((fD(b,p[h>>2])|0)!=0){e=2;break a}}}}}while(0);e&=2}}while(0);return e}function nD(b,c){var d,e=c>>2,f,g=y[b+12>>2],h=y[g>>2];d=(c+2|0)>>1;var i=Vc[d];f=(i&4)<<16>>16==0;a:do{if(f){n[d]=i|4;var j=c|0,k=t[j]&255;do{if((k|0)==26){j=oD(h,0,0,p[e+1],g,c);break a}else{if((k|0)==118){var m=y[e+3];if(l[m|0]<<24>>24==26){var j=m,m=c,o=0}else{j=p[m+12>>2],o=p[p[e+2]+4>>2]}j=oD(h,o,p[p[m+8>>2]+4>>2],p[j+4>>2],g,c);break a}else{if((k|0)==155||(k|0)==151){d=y[e+4];f=h|0;var r=p[f>>2],k=t[p[p[r+8>>2]+12>>2]+77|0],e=y[e+1],i=ve(e),r=go(r,e,i,(d|0)==0?0:p[d>>2],k,0);if((r|0)==0){f=go(p[f>>2],e,i,-1,k,0);var k=(f|0)==0,r=k&1,q=r^1;if(k){var m=0,o=q,s=r;f=18}else{u=r,w=q,v=0,x=f,f=12}}else{var u=0,w=0,v=(p[r+12>>2]|0)==0&1,x=r;f=12}do{if(f==12){if(f=x+24|0,k=Ru(h,31,0,p[f>>2],0),(k|0)==0){(v|0)==0?(m=0,o=w,s=u,f=18):l[g+20|0]<<24>>24!=0?(m=v,o=w,s=u,f=18):(ym(h,R.We|0,(z=a,a+=8,p[z>>2]=i,p[z+4>>2]=e,z)),f=g+16|0,p[f>>2]=p[f>>2]+1|0,f=24)}else{(k|0)==1&&(m=p[f>>2],ym(h,R.Ve|0,(z=a,a+=4,p[z>>2]=m,z)),g=g+16|0,p[g>>2]=p[g>>2]+1|0);l[j]=98;j=1;break a}}}while(0);do{if(f==18&&((s|0)==0?(o|0)!=0&&(ym(h,R.Ze|0,(z=a,a+=8,p[z>>2]=i,p[z+4>>2]=e,z)),u=g+16|0,p[u>>2]=p[u>>2]+1|0):(ym(h,R.Ye|0,(z=a,a+=8,p[z>>2]=i,p[z+4>>2]=e,z)),u=g+16|0,p[u>>2]=p[u>>2]+1|0),(m|0)!=0)){l[j]=-103;l[g+21|0]=1;g=g+20|0;l[g]=0;lD(b,d);j=l[g]=1;break a}}while(0);lD(b,d);j=1;break a}else{(k|0)==116||(k|0)==20||(k|0)==72?(i&2048)<<16>>16!=0&&(r=g+12|0,q=p[r>>2],l[g+22|0]<<24>>24!=0&&ym(h,R.$e|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),fD(b,p[e+4]),(q|0)!=(p[r>>2]|0)&&(n[d]|=32)):(k|0)==133&&l[g+22|0]<<24>>24!=0&&ym(h,R.af|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z))}}}}while(0);j=(p[h+64>>2]|0)!=0?2:l[p[h>>2]+30|0]<<24>>24!=0?2:0}else{j=1}}while(0);return j}nD.X=1;function pD(b,c){var d,e,f,g=a;a+=36;var h,i=Vc[c+6>>1]&65535,j=(i&2|0)==0;a:do{if(j){var k=p[b+12>>2],m=y[b+8>>2];e=p[m>>2];if((i&16|0)==0){Rw(m,c,k);var o=(p[m+64>>2]|0)!=0?2:l[e+30|0]<<24>>24!=0?2:1}else{var r=(p[c+28>>2]|0)!=0,q=g,s=g|0,u=g+20|0,w=g+4|0,v=g+32|0;f=(m+512|0)>>2;var x=(k|0)==0,A=m+64|0,E=e+30|0,J=g+8|0,M=g+21|0,D=c;for(e=D>>2;;){if((D|0)==0){if(r&&(qD(m,c)|0)!=0){o=2;break a}o=1;break a}d=(D+6|0)>>1;n[d]|=2;for(var K=q>>2,H=K+9;K<H;K++){p[K]=0}p[s>>2]=m;if((tw(g,p[e+10])|0)!=0){o=2;break a}if((tw(g,p[e+11])|0)!=0){o=2;break a}l[u]=1;H=D+8|0;p[w>>2]=p[H>>2];p[v>>2]=k;K=D|0;h=p[K>>2];var N=h|0;h=h+12|0;for(var Q=0;;){if((Q|0)>=(p[N>>2]|0)){var P=0;break}if((tw(g,p[(p[h>>2]>>2)+(Q*5|0)])|0)!=0){o=2;break a}Q=Q+1|0}for(;;){N=y[H>>2];if((P|0)>=(n[N>>1]<<16>>16|0)){break}var Q=N+P*60+20|0,L=p[Q>>2];if((L|0)!=0){h=p[f];b:do{if(x){var I=0}else{for(var X=k,Y=0;;){if(Y=p[X+12>>2]+Y|0,X=p[X+32>>2],(X|0)==0){I=Y;break b}}}}while(0);X=p[(N+8>>2)+(P*15|0)];(X|0)==0?Q=L:(p[f]=X,Q=p[Q>>2]);gD(m,Q,k);p[f]=h;if((p[A>>2]|0)!=0){o=2;break a}if(l[E]<<24>>24!=0){o=2;break a}b:do{if(x){var da=I}else{h=k;for(Q=I;;){if(Q=Q-p[h+12>>2]|0,h=y[h+32>>2],(h|0)==0){da=Q;break b}}}}while(0);l[N+P*60+34|0]=(da|0)!=0&1}P=P+1|0}H=y[e+4];(N=(H|0)!=0)?h=27:l[M]<<24>>24!=0?h=27:(l[u]=0,h=29);h==27&&(n[d]|=4);d=D+20|0;if(!((p[d>>2]|0)==0|N)){ym(m,R.Me|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));o=2;break a}p[J>>2]=p[K>>2];if((tw(g,p[e+3])|0)!=0){o=2;break a}if((tw(g,p[d>>2])|0)!=0){o=2;break a}p[v>>2]=0;l[u]=1;if(!r&&(rD(g,D,p[e+6],R.ja|0)|0)!=0){o=2;break a}if(l[E]<<24>>24!=0){o=2;break a}b:do{if(N){if((rD(g,D,H,R.Oe|0)|0)!=0){o=2;break a}if(l[E]<<24>>24!=0){o=2;break a}D=p[H>>2];d=p[H+12>>2];for(K=0;;){if((K|0)>=(D|0)){break b}if((n[p[d>>2]+2>>1]&2)<<16>>16!=0){break}d=d+20|0;K=K+1|0}ym(m,R.Pe|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));o=2;break a}}while(0);D=p[e+7];e=D>>2}}}else{o=1}}while(0);a=g;return o}pD.X=1;function tw(b,c){var d,e,f,g,h=a;a+=16;g=h>>2;if((c|0)==0){e=0}else{f=(b|0)>>2;var i=p[f];e=(c+44|0)>>2;d=(i+536|0)>>2;if((Dw(i,p[d]+p[e]|0)|0)!=0){e=1}else{p[d]=p[d]+p[e]|0;d=b+21|0;i=l[d];l[d]=0;p[g]=40;p[g+1]=42;var j=h+8|0;p[j>>2]=p[f];p[g+3]=b;mD(h,c);f=p[f]+536|0;p[f>>2]=p[f>>2]-p[e]|0;e=(p[b+16>>2]|0)>0?5:(p[p[j>>2]+64>>2]|0)>0?5:6;e==5&&(n[(c+2|0)>>1]|=8);l[d]<<24>>24==0?i<<24>>24!=0&&(l[d]=1):n[(c+2|0)>>1]|=2;e=(Vc[c+2>>1]&65535)>>>3&1}}a=h;return e}tw.X=1;function rD(b,c,d,e){var f=a;a+=4;var g=(d|0)==0;a:do{if(g){var h=0}else{for(var i=c|0,j=p[p[i>>2]>>2],k=p[b>>2],m=d|0,o=p[d+12>>2],r=0;;){if((r|0)>=(p[m>>2]|0)){h=sD(k,c,d,e);break a}var q=p[o>>2],s=tD(p[i>>2],q);p[f>>2]=s;if((s|0)>0){n[o+14>>1]=s&65535}else{if((uD(q,f)|0)==0){if(n[o+14>>1]=0,(tw(b,q)|0)!=0){h=1;break a}}else{q=p[f>>2];if((q|0)<1){vD(k,e,r+1|0,j);h=1;break a}n[o+14>>1]=q&65535}}o=o+20|0;r=r+1|0}}}while(0);a=f;return h}rD.X=1;function qD(b,c){var d,e,f=a;a+=4;e=f>>2;var g=p[c+24>>2],h=(g|0)==0;a:do{if(h){d=0}else{var i=p[b>>2];d=(g|0)>>2;var j=p[d];if((j|0)>(p[i+80>>2]|0)){ym(b,R.Qe|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z))}else{j=(j|0)>0;b:do{if(j){for(var k=g+12|0,m=0;;){if(l[p[k>>2]+m*20+13|0]=0,m=m+1|0,(m|0)>=(p[d]|0)){break b}}}}while(0);p[c+32>>2]=0;j=c+28|0;k=p[j>>2];m=(k|0)==0;b:do{if(m){var o=c}else{for(var r=c,q=j,s=k;;){if(p[s+32>>2]=r,r=p[q>>2],q=r+28|0,s=p[q>>2],(s|0)==0){o=r;break b}}}}while(0);j=g+12|0;k=i+30|0;m=o;r=1;b:for(;;){if((m|0)==0|(r|0)==0){break}for(var s=m|0,q=p[s>>2],u=m+8|0,w=q|0,v=0,x=p[j>>2],A=0;;){if((v|0)>=(p[d]|0)){m=p[m+32>>2];r=A;continue b}p[e]=-1;var E=x+13|0,J=l[E]<<24>>24==0;c:do{if(J){var M=x|0,D=p[M>>2],K=(uD(D,f)|0)==0;do{if(!K){var K=p[e],H=p[w>>2];if(!((K|0)<1|(K|0)>(H|0))){break}vD(b,R.ja|0,v+1|0,H);d=1;break a}H=tD(q,D);p[e]=H;if((H|0)==0){H=Pv(i,D,0);if(l[k]<<24>>24==0){var N=b,Q=p[s>>2],P=p[u>>2],L=H,I=fa,X=a;a+=36;for(var I=X>>2,Y=X>>2,da=Y+9;Y<da;Y++){p[Y]=0}p[I]=N;p[I+1]=P;p[I+2]=Q;l[X+20|0]=1;p[I+4]=0;N=p[N>>2]+33|0;P=l[N];l[N]=1;I=tw(X,L);l[N]=P;N=(I|0)==0;d:do{if(N){P=Q+12|0;I=p[Q>>2];for(Y=0;;){if((Y|0)>=(I|0)){var ga=0;break d}da=Y+1|0;if((wD(p[(p[P>>2]>>2)+(Y*5|0)],L)|0)<2){ga=da;break d}Y=da}}else{ga=0}}while(0);a=X;p[e]=ga}Df(i,H);H=p[e]}if((H|0)<=0){M=1;break c}}while(0);K=p[D+20>>2];H=n[D+2>>1];Df(i,D);D=ov(i,129,0);p[M>>2]=D;if((D|0)==0){d=1;break a}M=H&256;p[(D+20|0)>>2]=K;K=D+2|0;n[K>>1]=M|n[K>>1]|1024;p[(D+4|0)>>2]=p[e];n[x+14>>1]=p[e]&65535;l[E]=1}M=A}while(0);v=v+1|0;x=x+20|0;A=M}}d=p[d];for(i=0;;){if((i|0)>=(d|0)){d=0;break a}var ha=i+1|0;if(l[p[j>>2]+i*20+13|0]<<24>>24==0){break}i=ha}ym(b,R.Re|0,(z=a,a+=4,p[z>>2]=ha,z))}d=1}}while(0);a=f;return d}qD.X=1;function xD(b,c){return(c&1|0)==0?48:(p[b+8>>2]|0)!=0?8216:(p[b+12>>2]|0)!=0?8216:(p[b+20>>2]|0)!=0?8216:(p[b+16>>2]|0)!=0?8216:16392}function uD(b,c){var d=a;a+=4;if((n[b+2>>1]&1024)<<16>>16==0){var e=t[b|0]&255;(e|0)==157?e=uD(p[b+8>>2],c):(e|0)==156?(uD(p[b+8>>2],d)|0)==0?e=0:(p[c>>2]=-p[d>>2]|0,e=1):e=0}else{p[c>>2]=p[b+4>>2],e=1}a=d;return e}function vD(b,c,d,e){var f=a;ym(b,R.Se|0,(z=a,a+=12,p[z>>2]=d,p[z+4>>2]=c,p[z+8>>2]=e,z));a=f}function tD(b,c){var d=l[c|0]<<24>>24==26;a:do{if(d){for(var e=p[c+4>>2],f=p[b>>2],g=b+12|0,h=0;;){if((h|0)>=(f|0)){e=0;break a}var i=p[(p[g>>2]+4>>2)+(h*5|0)];if((i|0)!=0&&(qm(i,e)|0)==0){break}h=h+1|0}e=h+1|0}else{e=0}}while(0);return e}function Pv(b,c,d){return yD(b,c,d,0)}function wD(b,c){var d=(b|0)==0|(c|0)==0;a:do{if(d){var e=(c|0)==(b|0)?0:2}else{var f=Vc[b+2>>1];if((f&2048)<<16>>16!=0){e=2}else{if(e=Vc[c+2>>1],(e&2048)<<16>>16!=0){e=2}else{if(((e^f)&16)<<16>>16!=0){e=2}else{var g=l[b|0];if(g<<24>>24!=l[c|0]<<24>>24){e=2}else{if((wD(p[b+8>>2],p[c+8>>2])|0)!=0){e=2}else{if((wD(p[b+12>>2],p[c+12>>2])|0)!=0){e=2}else{if((Vw(p[b+16>>2],p[c+16>>2])|0)!=0){e=2}else{if((p[b+24>>2]|0)!=(p[c+24>>2]|0)){e=2}else{if(n[b+28>>1]<<16>>16!=n[c+28>>1]<<16>>16){e=2}else{var h=(f&1024)<<16>>16==0;do{if(h){if(g<<24>>24!=-104){var i=p[b+4>>2];if((i|0)!=0){if((e&1024)<<16>>16!=0){e=2;break a}var j=p[c+4>>2];if((j|0)==0){e=2;break a}if((pg(i,j)|0)!=0){e=2;break a}}}}else{if((e&1024)<<16>>16==0){e=2;break a}if((p[b+4>>2]|0)!=(p[c+4>>2]|0)){e=2;break a}}}while(0);f&=256;e=(f|0)!=(e&256|0)?1:(f|0)!=0&&(p[b+20>>2]|0)!=(p[c+20>>2]|0)?2:0}}}}}}}}}}}while(0);return e}wD.X=1;function Vw(b,c){var d=(b|0)==0,e=(c|0)==0,f=d&e;a:do{if(f){var g=0}else{if(d|e){g=1}else{var h=p[b>>2];if((h|0)!=(p[c>>2]|0)){g=1}else{for(var i=b+12|0,j=c+12|0,k=0;;){if((k|0)>=(h|0)){g=0;break a}var m=p[i>>2],o=p[j>>2];if(l[m+k*20+12|0]<<24>>24!=l[o+k*20+12|0]<<24>>24){g=1;break a}if((wD(p[(m>>2)+(k*5|0)],p[(o>>2)+(k*5|0)])|0)!=0){g=1;break a}k=k+1|0}}}}}while(0);return g}function yD(b,c,d,e){var f,g,h,i,j=c>>2,k=a;a+=4;i=k>>2;var m=(c|0)==0;do{if(m){h=0}else{var o=d&1,r=(e|0)!=0;if(r){var q=32768,s=p[e>>2]}else{h=zh(b,zD(c,d)),q=0,s=h}h=s>>2;var u=p[i]=s;if((s|0)!=0){var w=xD(c,d),v=w&4095;g=(c+2|0)>>1;f=n[g];if((f&1024)<<16>>16==0){var x=p[j+1],x=(x|0)==0?0:ve(x)+1|0}else{x=0}(o|0)==0?(f&=65535,f=(f&16384|0)==0?(f&8192|0)==0?48:24:8,Ah(s,c|0,f),Ed(p[i]+f|0,0,48-f|0)):Ah(s,c|0,v);f=(s+2|0)>>1;q=(w&24576|q|n[f]&8191)&65535;n[f]=q;(x|0)==0?v=q:(q=p[i]+v|0,p[h+1]=q,Ah(q,p[j+1],x),v=n[f]);q=n[g];((v|q)&16384)<<16>>16==0&&(v=c+16|0,o=(q&2048)<<16>>16==0?Ov(b,p[v>>2],o):Qw(b,p[v>>2],o),p[h+4]=o);if((n[f]&24576)<<16>>16==0){l[s+34|0]=0;if((n[g]&16384)<<16>>16!=0){h=u;break}r=Pv(b,p[j+2],0);p[h+2]=r;r=Pv(b,p[j+3],0);p[h+3]=r}else{p[i]=p[i]+AD(c,d)|0;(n[f]&8192)<<16>>16!=0&&(g=yD(b,p[j+2],1,k),p[h+2]=g,g=yD(b,p[j+3],1,k),p[h+3]=g);if(!r){h=u;break}p[e>>2]=p[i]}}h=u}}while(0);a=k;return h}yD.X=1;function zD(b,c){if((b|0)==0){var d=0}else{if(d=AD(b,c),(c&1|0)!=0){return zD(p[b+8>>2],c)+d+zD(p[b+12>>2],c)|0}}return d}function Ov(b,c,d){var e,f,g=(c|0)==0;a:do{if(g){var h=0}else{var i=zh(b,16);f=i>>2;var j=i;if((i|0)==0){h=0}else{p[f+2]=0;e=(c|0)>>2;var k=p[e];p[f+1]=k;p[f]=k;var m=k=zh(b,p[e]*20|0);p[f+3]=m;if((k|0)==0){vf(b,i),h=0}else{if((p[e]|0)>0){f=m;i=p[c+12>>2];for(k=0;;){m=Pv(b,p[i>>2],d);p[f>>2]=m;m=yl(b,p[i+4>>2]);p[f+4>>2]=m;m=yl(b,p[i+8>>2]);p[f+8>>2]=m;l[f+12|0]=l[i+12|0];l[f+13|0]=0;n[f+14>>1]=n[i+14>>1];n[f+16>>1]=n[i+16>>1];k=k+1|0;if((k|0)>=(p[e]|0)){h=j;break a}f=f+20|0;i=i+20|0}}else{h=j}}}}}while(0);return h}Ov.X=1;function AD(b,c){var d=xD(b,c)&4095;if((n[b+2>>1]&1024)<<16>>16==0){var e=p[b+4>>2],d=(e|0)==0?d:ve(e)+(d+1)|0}return d+7&-8}function sD(b,c,d,e){var f=p[b>>2],g=(d|0)==0;a:do{if(g){var h=0}else{if(l[f+30|0]<<24>>24!=0){h=0}else{var h=d|0,i=p[h>>2];if((i|0)>(p[f+80>>2]|0)){ym(b,R.Te|0,(z=a,a+=4,p[z>>2]=e,z))}else{for(var j=y[c>>2],k=j|0,m=p[d+12>>2],o=0;;){if((o|0)>=(i|0)){h=0;break a}var r=Vc[m+14>>1];if(r<<16>>16!=0){var i=r&65535,q=p[k>>2];if((i|0)>(q|0)){break}BD(b,j,i-1|0,p[m>>2],e);i=p[h>>2]}m=m+20|0;o=o+1|0}vD(b,e,o+1|0,q)}h=1}}}while(0);return h}sD.X=1;function BD(b,c,d,e,f){var g,h;h=(c+12|0)>>2;g=y[(p[h]>>2)+(d*5|0)];c=y[b>>2];if(l[g|0]<<24>>24==-104){d=7}else{if(l[f]<<24>>24==71){d=7}else{if(f=Pv(c,g,0),f=$u(b,24,f,0,0),(f|0)==0){d=15}else{var i=n[(p[h]+16>>1)+(d*10|0)];i<<16>>16==0&&(i=b+472|0,b=p[i>>2]+1|0,p[i>>2]=b,n[(p[h]+16>>1)+(d*10|0)]=b&65535,i=n[(p[h]+16>>1)+(d*10|0)]);p[(f+24|0)>>2]=i&65535;i=f;d=12}}}a:do{if(d==7){b=(n[g+2>>1]&1024)<<16>>16==0;do{if(b&&(d=(g+4|0)>>2,h=y[d],(h|0)!=0)){p[d]=0;g=Pv(c,g,0);p[d]=h;if((g|0)==0){d=15;break a}l[g+34|0]|=1;i=yl(c,h);p[(g+4|0)>>2]=i;i=g;d=12;break a}}while(0);d=Pv(c,g,0);(d|0)==0?d=15:(i=d,d=12)}}while(0);d==12&&(g=(e+2|0)>>1,d=n[g],(d&256)<<16>>16!=0&&(p[i+20>>2]=p[e+20>>2],n[(i+2|0)>>1]|=256,d=n[g]),n[g]=d|-32768,Df(c,e),i|=0,Ah(e|0,i,48),vf(c,i))}BD.X=1;function Dw(b,c){var d=p[p[b>>2]+84>>2];(d|0)<(c|0)?(ym(b,R.Ue|0,(z=a,a+=4,p[z>>2]=d,z)),d=1):d=0;return d}function oD(b,c,d,e,f,g){var h,i,j,k,m,o,r,q,s,u=p[b>>2];q=(g+24|0)>>2;p[q]=-1;r=(g+40|0)>>2;p[r]=0;var w=(d|0)==0,v=((c|0)!=0|w)^1,x=b+432|0,A=b+444|0,E=g+1|0;o=(g+28|0)>>1;var J=b+436|0,M=b+440|0,D=(c|0)==0,K=u+8|0,H=f,N=0,Q=0,P=0,L=0;a:for(;;){var I=(H|0)!=0,X=H+4|0,Y=H+8|0,da=N,ga=0,ha=Q,ba=P,ea=L;b:for(;;){var ja=ga,ra=ha,Va=ba,ta=ea;c:for(;;){var xa=(ja|0)==0;if(I&xa){var Fa=p[X>>2],Na=(Fa|0)==0;d:do{if(Na){var Ea=0,La=ra,za=Va,Ba=ta}else{var Ja=Fa|0;if(n[Ja>>1]<<16>>16>0){var ka=ta,S=Fa+4|0;m=S>>2;for(var ib=Va,Wa=ra,Za=0,Sa=0;;){var tb=p[m+3];k=tb>>2;j=(tb+68|0)>>2;var pb=rm(u,p[j]);do{if(w){s=15}else{var fb=p[m+2];if((fb|0)==0){var Xa=p[k];if((Xa|0)==0){var Ab=Za,rb=Wa,cb=ib,Cb=ka;s=27;break}if((qm(Xa,d)|0)!=0){Ab=Za;rb=Wa;cb=ib;Cb=ka;s=27;break}if(D){s=15;break}if((qm(p[p[K>>2]+(pb<<4)>>2],c)|0)==0){s=15;break}}else{if((qm(fb,d)|0)==0){s=15;break}}Ab=Za;rb=Wa;cb=ib;Cb=ka;s=27}}while(0);e:do{if(s==15){var Zb=Wa+1|0;if((Wa|0)==0){p[q]=p[m+8];p[r]=tb;var dc=p[j],kb=S}else{dc=ib,kb=ka}var Oa=p[k+3],Db=p[k+2],Wb=(Za|0)==1,Nb=S+28|0,$b=S+40|0;f:do{if(Wb){for(var Rb=Oa,Ra=0;;){if((Ra|0)>=(Db|0)){Ab=Za;rb=Zb;cb=dc;Cb=kb;break e}var Ob=(qm(p[Rb>>2],e)|0)==0;do{var Ua;if(Ua=Ob&&(l[Nb]&4)<<24>>24==0){var Jb=p[$b>>2],Vb=(Jb|0)==0;g:do{if(Vb){var Pb=0}else{for(var sb=Jb|0,db=p[Jb+4>>2],wb=0;;){if((wb|0)>=(db|0)){Pb=0;break g}if((qm(p[p[sb>>2]+(wb<<3)>>2],e)|0)==0){Pb=1;break g}wb=wb+1|0}}}while(0);Ua=(Pb|0)==0}if(Ua){var ob=Ra;break f}}while(0);Rb=Rb+24|0;Ra=Ra+1|0}}else{for(var Kb=Oa,ub=0;;){if((ub|0)>=(Db|0)){Ab=Za;rb=Zb;cb=dc;Cb=kb;break e}if((qm(p[Kb>>2],e)|0)==0){ob=ub;break f}Kb=Kb+24|0;ub=ub+1|0}}}while(0);p[q]=p[m+8];p[r]=tb;var Xb=p[j];n[o]=(ob|0)==(p[k+1]|0)?-1:ob&65535;Ab=Za+1|0;rb=Zb;cb=Xb;Cb=S}}while(0);var Sb=Sa+1|0;if((Sb|0)>=(n[Ja>>1]<<16>>16|0)){Ea=Ab;La=rb;za=cb;Ba=Cb;break d}ka=Cb;S=S+60|0;m=S>>2;ib=cb;Wa=rb;Za=Ab;Sa=Sb}}else{Ea=0,La=ra,za=Va,Ba=ta}}}while(0);var Qb=(Ea|0)==0,ac=Qb&v;d:do{if(ac){if((p[x>>2]|0)==0){var Gb=La,xb=za;break}var Ta=l[A],qb=Ta<<24>>24==106;do{if(qb){s=33}else{if((qm(R.rb|0,d)|0)==0){var bc=1;s=34}else{if(Ta<<24>>24==105){Gb=La;xb=za;break d}s=33}}}while(0);if(s==33){if((qm(R.sb|0,d)|0)!=0){Gb=La;xb=za;break}bc=0}p[q]=bc;var $a=p[x>>2];i=$a>>2;if(($a|0)==0){Gb=La;xb=za;break}for(var mb=p[i+17],Bb=La+1|0,bb=p[i+2],jb=$a+12|0,nb=0;;){if((nb|0)>=(bb|0)){var zb=nb;break}if((qm(p[(p[jb>>2]>>2)+(nb*6|0)],e)|0)==0){if((nb|0)!=(p[i+1]|0)){zb=nb;break}zb=-1;break}nb=nb+1|0}var Tb=(zb|0)<(bb|0)?zb:(aA(e)|0)==0?zb:-1;if((Tb|0)>=(bb|0)){Gb=Bb;xb=mb;break}if((Tb|0)<0){l[E]=100}else{var ec=(Tb|0)>31?-1:1<<Tb;(bc|0)==0?p[J>>2]|=ec:p[M>>2]|=ec}n[o]=Tb&65535;p[r]=$a;ga=da=1;ha=Bb;ba=mb;ea=Ba;continue b}Gb=La;xb=za}while(0);var Hb=Qb&(Gb|0)==1;do{if(Hb){if((aA(e)|0)==0){break}n[o]=-1;l[E]=100;ja=1;ra=Gb;Va=xb;ta=Ba;continue c}s=54}while(0);if(Qb){break b}ja=Ea;ra=Gb;Va=xb;ta=Ba}else{var Eb=xa&w;do{if(Eb&&(n[g+2>>1]&64)<<16>>16!=0){l[g|0]=94;p[r]=0;var Lb=1;s=81;break a}}while(0);var gb=(ja|0)==1;if(!gb){var Mb=xa?R.cf|0:R.df|0;D?w?ym(b,R.ub|0,(z=a,a+=8,p[z>>2]=Mb,p[z+4>>2]=e,z)):ym(b,R.tb|0,(z=a,a+=12,p[z>>2]=Mb,p[z+4>>2]=d,p[z+8>>2]=e,z)):ym(b,R.ef|0,(z=a,a+=16,p[z>>2]=Mb,p[z+4>>2]=c,p[z+8>>2]=d,p[z+12>>2]=e,z));l[b+17|0]=1;var vc=f+16|0;p[vc>>2]=p[vc>>2]+1|0}var hc=n[o];if(!(hc<<16>>16<0|(ta|0)==0)){var kc=hc<<16>>16>63,pc=nc(1,0,"shl",hc<<16>>16),jc=kc?0:pc[0],mc=kc?-2147483648:pc[1];h=(ta+44|0)>>2;var Fb=p[h+1]|mc;p[h]|=jc;p[h+1]=Fb}var Ub=g+8|0;Df(u,p[Ub>>2]);p[Ub>>2]=0;var Ya=g+12|0;Df(u,p[Ya>>2]);p[Ya>>2]=0;l[g|0]=(da|0)!=0?60:-104;if(gb){var Pa=Va;s=79;break a}Lb=2;s=81;break a}}}var yb=p[Y>>2],Ka=(yb|0)!=0&w;b:do{if(Ka){for(var Ac=p[yb>>2],Jc=yb+12|0,uc=0;;){if((uc|0)>=(Ac|0)){break b}var Tc=p[Jc>>2],Yc=p[(Tc+4>>2)+(uc*5|0)];if((Yc|0)!=0&&(qm(Yc,e)|0)==0){break}uc=uc+1|0}var ua=l[H+20|0]<<24>>24==0;do{if(ua&&(n[p[(Tc>>2)+(uc*5|0)]+2>>1]&2)<<16>>16!=0){ym(b,R.bf|0,(z=a,a+=4,p[z>>2]=Yc,z));Lb=2;s=81;break a}}while(0);BD(b,yb,uc,g,xh|0);Pa=xb;s=79;break a}}while(0);H=p[H+32>>2];N=da;Q=Gb;P=xb;L=Ba}a:do{if(s==79){CD(b,g,Pa,p[X>>2]);var md=f+12|0;p[md>>2]=p[md>>2]+1|0;if((H|0)==(f|0)){Lb=1}else{for(var nd=f;;){var Bc=p[nd+32>>2],Qc=Bc+12|0;p[Qc>>2]=p[Qc>>2]+1|0;if((Bc|0)==(H|0)){Lb=1;break a}nd=Bc}}}}while(0);return Lb}oD.X=1;function aA(b){return(qm(b,R.jf|0)|0)==0?1:(qm(b,R.vb|0)|0)==0?1:(qm(b,R.kf|0)|0)==0&1}function CD(b,c,d,e){var f,g=p[b>>2],h=(p[g+268>>2]|0)==0;a:do{if(!h){var i=rm(g,d);if((i|0)>=0){var j=c|0;if(l[j]<<24>>24==60){f=b+432|0}else{f=n[e>>1]<<16>>16;for(var k=c+24|0,m=0;;){if((m|0)>=(f|0)){break a}if((p[k>>2]|0)==(p[(e+36>>2)+(m*15|0)]|0)){break}m=m+1|0}f=e+m*60+16|0}k=p[f>>2];f=k>>2;var m=n[c+28>>1],o=m<<16>>16;(k|0)!=0&&(m<<16>>16>-1?k=p[(p[f+3]>>2)+(o*6|0)]:(k=p[f+1],k=(k|0)>-1?p[(p[f+3]>>2)+(k*6|0)]:R.vb|0),(DD(b,p[f],k,i)|0)==2&&(l[j]=98))}}}while(0)}CD.X=1;function DD(b,c,d,e){var f;f=p[b>>2]>>2;var g=p[p[f+2]+(e<<4)>>2],h=Gd[p[f+67]](p[f+68],20,c,d,g,p[b+512>>2]);(h|0)==1?((p[f+1]|0)<3&(e|0)==0?ym(b,R.hf|0,(z=a,a+=8,p[z>>2]=c,p[z+4>>2]=d,z)):ym(b,R.gf|0,(z=a,a+=12,p[z>>2]=g,p[z+4>>2]=c,p[z+8>>2]=d,z)),p[b+4>>2]=23):(h|0)==2||(h|0)==0||VC(b);return h}function ED(b,c){var d,e,f,g,h,i=a;a+=8;var j,k=p[b+8>>2];h=(k|0)>>2;var m=p[h],o=m+30|0,r=l[o]<<24>>24==0;a:do{if(r){var q=p[c+8>>2];if((q|0)==0){q=1}else{if(f=c+6|0,g=n[f>>1],(g&16)<<16>>16!=0){q=1}else{n[f>>1]=g|16;g=(c|0)>>2;var s=p[g];bD(k,q);var u=q+4|0;f=(q|0)>>1;var w=0,v=u;for(e=v>>2;;){if((w|0)>=(n[f]<<16>>16|0)){break}d=(v+12|0)>>2;if((p[d]|0)!=0){q=1;break a}var x=p[e+1],A=(x|0)==0;do{if(A){var E=p[e+4];fD(b,E);var J=ni(m,76);p[d]=J;if((J|0)==0){q=2;break a}n[J+32>>1]=1;var M=zm(m,R.lf|0,(z=a,a+=4,p[z>>2]=J,z));for(p[J>>2]=M;;){M=p[E+28>>2];if((M|0)==0){break}E=M}dD(p[h],p[E>>2],J+8|0,J+12|0);p[(J+4|0)>>2]=-1;p[(J+24|0)>>2]=1e6;l[J+34|0]|=2}else{J=xm(k,0,x,p[e]);p[d]=J;if((J|0)==0){q=2;break a}E=J+32|0;n[E>>1]=n[E>>1]+1&65535;E=J+28|0;if(!((p[E>>2]|0)==0&&(l[J+34|0]&16)<<24>>24==0)){if((Lw(k,J)|0)!=0){q=2;break a}J=Qw(m,p[E>>2],0);p[e+4]=J;fD(b,J)}}}while(0);if((FD(k,v)|0)!=0){q=2;break a}w=w+1|0;v=v+60|0;e=v>>2}if(l[o]<<24>>24!=0){q=2}else{if((GD(k,c)|0)!=0){q=2}else{d=s|0;e=p[d>>2];w=s+12|0;for(v=0;;){if((v|0)>=(e|0)){var D=p[g];j=64;break}var K=p[w>>2],x=p[(K>>2)+(v*5|0)],A=l[x|0];if(A<<24>>24==113){j=26;break}else{if(A<<24>>24==118&&l[p[x+12>>2]|0]<<24>>24==113){j=26;break}}v=v+1|0}if(j==26){D=p[p[h]+12>>2];D=(D&1024|0)==0?0:(D&2048|0)==0;e=(e|0)>0;b:do{if(e){w=i|0;v=i+4|0;for(A=x=0;;){J=K+A*20|0;E=p[J>>2];j=l[E|0];if(j<<24>>24==113){var H=0;j=36}else{j<<24>>24==118?l[p[E+12>>2]|0]<<24>>24!=113?j=32:(H=p[p[E+8>>2]+4>>2],j=36):j=32}do{if(j==32){var N=mv(p[h],x,E);if((N|0)!=0){var M=K+A*20+4|0,Q=N|0,P=N+12|0;p[(p[P>>2]+(p[Q>>2]-1)*20+4|0)>>2]=p[M>>2];var L=K+A*20+8|0;p[(p[P>>2]+(p[Q>>2]-1)*20+8|0)>>2]=p[L>>2];p[M>>2]=0;p[L>>2]=0}p[J>>2]=0}else{if(j==36){for(var N=(H|0)==0,M=0,Q=u,I=0,P=x;;){if((M|0)>=(n[f]<<16>>16|0)){break}var L=p[Q+12>>2],X=p[Q+8>>2],X=(X|0)==0?p[L>>2]:X;if(l[o]<<24>>24!=0){break}if(N){j=43}else{if((qm(H,X)|0)==0){j=43}else{var Y=I,da=P;j=56}}c:do{if(j==43){if(I=L+8|0,(p[I>>2]|0)>0){for(var ga=L+12|0,ha=(M|0)>0&N,ba=Q+28|0,ea=Q+40|0,ja=P,ra=0;;){var Va=p[ga>>2],ta=p[(Va>>2)+(ra*6|0)],Va=l[Va+ra*24+23|0]<<24>>24==0;do{if(Va){if(ha){if((l[ba]&4)<<24>>24!=0&&(HD(q,M,ta,0,0)|0)!=0){var xa=ja;break}if((ID(p[ea>>2],ta)|0)>-1){xa=ja;break}}xa=ov(m,26,ta);if(D){j=52}else{if(n[f]<<16>>16>1){j=52}else{var Fa=0,Na=ta,Ea=xa;j=54}}j==52&&(Fa=ov(m,26,X),Ea=$u(k,118,Fa,xa,0),D?Fa=Na=zm(m,R.wb|0,(z=a,a+=8,p[z>>2]=X,p[z+4>>2]=ta,z)):(Fa=0,Na=ta));xa=mv(p[h],ja,Ea);p[w>>2]=Na;p[v>>2]=ve(Na);nv(k,xa,i,0);vf(m,Fa)}else{xa=ja}}while(0);ra=ra+1|0;if((ra|0)>=(p[I>>2]|0)){Y=1;da=xa;break c}ja=xa}}else{Y=1,da=P}}}while(0);M=M+1|0;Q=Q+60|0;I=Y;P=da}(I|0)==0&&(N?ym(k,R.of|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)):ym(k,R.mf|0,(z=a,a+=4,p[z>>2]=H,z)));N=P}}}while(0);A=A+1|0;if((A|0)>=(p[d>>2]|0)){var La=N;break b}x=N}}else{La=0}}while(0);Lu(m,s);D=p[g]=La}(D|0)!=0&&(p[D>>2]|0)>(p[m+80>>2]|0)&&ym(k,R.pf|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));q=0}}}}}else{q=2}}while(0);a=i;return q}ED.X=1;function FD(b,c){var d=p[c+12>>2],e=(d|0)==0;a:do{if(e){var f=0}else{var g=p[c+52>>2];if((g|0)==0){f=0}else{for(var h=d+16|0;;){h=p[h>>2];if((h|0)==0){ym(b,R.tf|0,(z=a,a+=8,p[z>>2]=g,p[z+4>>2]=0,z));f=l[b+17|0]=1;break a}if((qm(p[h>>2],g)|0)==0){p[c+56>>2]=h;f=0;break a}h=h+32|0}}}}while(0);return f}function GD(b,c){var d,e=a;a+=16;var f=e+4,g=e+8,h=e+12,i=y[c+8>>2],j=i|0,k=c+12|0,m=b|0,o=i+64|0,r=i+4|0,q=0;a:for(;;){if((q|0)>=((n[j>>1]<<16>>16)-1|0)){var s=0;break}var u=y[o+12>>2],w=(p[r+12>>2]|0)==0|(u|0)==0;b:do{if(!w){d=t[o+28|0]&255;var v=d&32,x=(v|0)==0;v>>>=5;var A=(d&4|0)==0;d=(o+36|0)>>2;c:do{if(!A){var E=(p[d]|0)==0;do{if(E&&(A=o+40|0,(p[A>>2]|0)==0)){var J=u+8|0;if((p[J>>2]|0)<=0){E=A;break c}for(var M=u+12|0,D=q+1|0,K=0;;){if((HD(i,D,p[(p[M>>2]>>2)+(K*6|0)],e,f)|0)!=0&&JD(b,i,p[e>>2],p[f>>2],D,K,v,k),K=K+1|0,(K|0)>=(p[J>>2]|0)){E=A;break c}}}}while(0);ym(b,R.qf|0,(z=a,a+=4,p[z>>2]=0,z));s=1;break a}E=o+40|0}while(0);A=p[d];if((A|0)!=0){if((p[E>>2]|0)!=0){ym(b,R.rf|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));s=1;break a}x?x=A:(KD(A,p[o+32>>2]),x=p[d]);x=Jw(p[m>>2],p[k>>2],x);p[k>>2]=x;p[d]=0}d=p[E>>2];if((d|0)!=0){w=d+4|0;d|=0;x=q+1|0;for(E=0;;){if((E|0)>=(p[w>>2]|0)){break b}var H=p[p[d>>2]+(E<<3)>>2],A=LD(u,H);if((A|0)<0){break}if((HD(i,x,H,g,h)|0)==0){break}JD(b,i,p[g>>2],p[h>>2],x,A,v,k);E=E+1|0}ym(b,R.sf|0,(z=a,a+=4,p[z>>2]=H,z));s=1;break a}}}while(0);o=o+60|0;r=r+60|0;q=q+1|0}a=e;return s}GD.X=1;function HD(b,c,d,e,f){for(var g=0;;){if((g|0)>=(c|0)){var h=0;break}var i=LD(p[(b+16>>2)+(g*15|0)],d);if((i|0)>-1){if((e|0)==0){h=1;break}p[e>>2]=g;p[f>>2]=i;h=1;break}g=g+1|0}return h}function ID(b,c){var d=(b|0)==0;a:do{if(d){var e=-1}else{for(var f=b|0,g=p[b+4>>2],h=0;;){if((h|0)>=(g|0)){e=-1;break a}if((qm(p[p[f>>2]+(h<<3)>>2],c)|0)==0){e=h;break a}h=h+1|0}}}while(0);return e}function LD(b,c){for(var d=b+12|0,e=p[b+8>>2],f=0;;){if((f|0)>=(e|0)){var g=-1;break}if((qm(p[(p[d>>2]>>2)+(f*6|0)],c)|0)==0){g=f;break}f=f+1|0}return g}function JD(b,c,d,e,f,g,h,i){var j=p[b>>2],d=MD(j,c,d,e),c=MD(j,c,f,g),b=$u(b,76,d,c,0);(b|0)==0|(h|0)==0||(n[(b+2|0)>>1]|=1,n[b+32>>1]=p[c+24>>2]&65535);h=Jw(j,p[i>>2],b);p[i>>2]=h}function KD(b,c){var d=(b|0)==0;a:do{if(!d){for(var e=c&65535,f=b;;){if(n[(f+2|0)>>1]|=1,n[f+32>>1]=e,KD(p[f+8>>2],c),f=p[f+12>>2],(f|0)==0){break a}}}}while(0)}function Jw(b,c,d){if((c|0)==0){b=d}else{if((d|0)==0){b=c}else{var e=Bw(b,69,0,0);Cw(b,e,c,d);b=e}}return b}function Bw(b,c,d,e){var f=a;a+=4;p[f>>2]=0;var g=(d|0)!=0;a:do{if(g){var h=(c|0)==129;do{if(h){var i=p[d>>2];if((i|0)!=0&&(No(i,f)|0)!=0){h=0;break a}}}while(0);h=p[d+4>>2]+1|0}else{h=0}}while(0);b=ni(b,h+48|0);if((b|0)!=0){l[b]=c&255;n[b+30>>1]=-1;if(g){if((h|0)==0){n[(b+2|0)>>1]|=1024,p[b+4>>2]=p[f>>2]}else{g=b+48|0;c=b+4|0;p[c>>2]=g;var i=d+4|0,j=p[i>>2];(j|0)==0?g=48:(Ah(g,p[d>>2],j),g=p[i>>2]+48|0);l[b+g|0]=0;if((e|0)!=0&(h|0)>2&&(d=l[p[d>>2]],d<<24>>24==39||d<<24>>24==96||d<<24>>24==91||d<<24>>24==34)){Qt(p[c>>2]),d<<24>>24==34&&(n[(b+2|0)>>1]|=64)}}}p[b+44>>2]=1}a=f;return b}Bw.X=1;function ND(b,c){if((b|0)!=0){var d=p[b+44>>2];(d|0)>(p[c>>2]|0)&&(p[c>>2]=d)}}function Cw(b,c,d,e){(c|0)==0?(Df(b,d),Df(b,e)):((e|0)!=0&&(p[c+12>>2]=e,(n[e+2>>1]&256)<<16>>16!=0&&(n[(c+2|0)>>1]|=256,p[c+20>>2]=p[e+20>>2])),(d|0)!=0&&(p[c+8>>2]=d,(n[d+2>>1]&256)<<16>>16!=0&&(n[(c+2|0)>>1]|=256,p[c+20>>2]=p[d+20>>2])),cC(c))}function cC(b){var c=a;a+=4;p[c>>2]=0;ND(p[b+8>>2],c);ND(p[b+12>>2],c);var d=b+16|0;(n[b+2>>1]&2048)<<16>>16==0?OD(p[d>>2],c):PD(p[d>>2],c);p[b+44>>2]=p[c>>2]+1|0;a=c}function PD(b,c){var d,e=(b|0)==0;a:do{if(!e){d=b;for(d>>=2;;){ND(p[d+3],c);ND(p[d+5],c);ND(p[d+10],c);ND(p[d+11],c);OD(p[d],c);OD(p[d+4],c);OD(p[d+6],c);d=p[d+7];if((d|0)==0){break a}d>>=2}}}while(0)}function OD(b,c){var d=(b|0)==0;a:do{if(!d){var e=b|0;if((p[e>>2]|0)>0){for(var f=b+12|0,g=0;;){if(ND(p[(p[f>>2]>>2)+(g*5|0)],c),g=g+1|0,(g|0)>=(p[e>>2]|0)){break a}}}}}while(0)}function MD(b,c,d,e){b=Bw(b,152,0,0);if((b|0)!=0){var f=p[(c+16>>2)+(d*15|0)];p[b+40>>2]=f;p[b+24>>2]=p[(c+36>>2)+(d*15|0)];if((p[f+4>>2]|0)==(e|0)){n[b+28>>1]=-1}else{n[b+28>>1]=e&65535;var f=(e|0)>63,g=nc(1,0,"shl",e),e=f?0:g[0],f=f?-2147483648:g[1],c=(c+d*60+48|0)>>2,d=p[c+1]|f;p[c]|=e;p[c+1]=d}n[(b+2|0)>>1]|=4}return b}function cD(b,c,d){var e,f,g=c>>2,h=(c|0)==0;a:do{if(h){var i=0}else{f=(c|0)>>1;var j=n[f],j=e=zh(b,j<<16>>16>0?(j<<16>>16)*60+4|0:64);if((e|0)==0){i=0}else{var k=n[f];n[e+2>>1]=k;n[e>>1]=k;if(n[f]<<16>>16>0){k=e+4|0;e=k>>2;for(var m=0;;){var o=yl(b,p[g+(m*15|0)+1]);p[e+(m*15|0)]=o;o=yl(b,p[g+(m*15|0)+2]);p[e+(m*15|0)+1]=o;o=yl(b,p[g+(m*15|0)+3]);p[e+(m*15|0)+2]=o;l[k+m*60+28|0]=l[c+m*60+32|0];p[e+(m*15|0)+8]=p[g+(m*15|0)+9];p[e+(m*15|0)+5]=p[g+(m*15|0)+6];p[e+(m*15|0)+6]=p[g+(m*15|0)+7];l[k+m*60+30|0]=l[c+m*60+34|0];o=yl(b,p[g+(m*15|0)+14]);p[e+(m*15|0)+13]=o;l[k+m*60+29|0]=l[c+m*60+33|0];p[e+(m*15|0)+14]=p[g+(m*15|0)+15];o=p[g+(m*15|0)+4];p[e+(m*15|0)+3]=o;(o|0)!=0&&(o=o+32|0,n[o>>1]=n[o>>1]+1&65535);o=Qw(b,p[g+(m*15|0)+5],d);p[e+(m*15|0)+4]=o;o=Pv(b,p[g+(m*15|0)+10],d);p[e+(m*15|0)+9]=o;o=HC(b,p[g+(m*15|0)+11]);p[e+(m*15|0)+10]=o;var o=c+m*60+48|0,r=p[o+4>>2],q=k+m*60+44|0;p[q>>2]=p[o>>2];p[q+4>>2]=r;m=m+1|0;if((m|0)>=(n[f]<<16>>16|0)){i=j;break a}}}else{i=j}}}}while(0);return i}cD.X=1;function HC(b,c){var d,e=(c|0)==0;a:do{if(e){var f=0}else{var g=zh(b,12),h=g;if((g|0)==0){f=0}else{d=(c+4|0)>>2;var i=p[d];p[g+8>>2]=i;p[g+4>>2]=i;var j=zh(b,p[d]<<3),k=j,i=g;p[i>>2]=k;if((j|0)==0){vf(b,g),f=0}else{if((p[d]|0)>0){g=c|0;for(j=0;;){var m=p[g>>2],o=yl(b,p[m+(j<<3)>>2]);p[k+(j<<3)>>2]=o;p[k+(j<<3)+4>>2]=p[m+(j<<3)+4>>2];j=j+1|0;if((j|0)>=(p[d]|0)){f=h;break a}k=p[i>>2]}}else{f=h}}}}}while(0);return f}function aD(b,c,d,e,f){var g,h,i=a;a+=12;var j,k=i+8;h=k>>2;var m=p[c+60>>2],o=p[c+56>>2];p[h]=0;var r=c|0,q=p[r>>2],q=zm(b,R.d|0,(z=a,a+=4,p[z>>2]=q,z));if((q|0)==0){b=7}else{var s=ni(b,28);g=s>>2;if((s|0)==0){vf(b,q),b=7}else{p[g]=b;p[g+1]=d;var u=i|0;p[u>>2]=c;p[i+4>>2]=s;var w=b+304|0;p[w>>2]=i;var v=s+8|0,e=Gd[e](b,p[d+8>>2],o,m,v,k);p[w>>2]=0;a:do{if((e|0)==7){l[b+30|0]=1,j=6}else{if((e|0)==0){if(k=p[v>>2],(k|0)==0){var x=0;j=30}else{if(p[(k|0)>>2]=p[d>>2],p[g+3]=1,(p[u>>2]|0)!=0){x=p[r>>2],x=zm(b,R.vf|0,(z=a,a+=4,p[z>>2]=x,z)),p[f>>2]=x,Jr(s),x=1,j=30}else{if(k=c+52|0,p[g+6]=p[k>>2],p[k>>2]=s,k=c+8|0,w=p[k>>2],(w|0)>0){m=c+12|0;for(o=0;;){var A=y[(p[m>>2]+12>>2)+(o*6|0)],E=(A|0)==0;do{if(E){var J=w}else{J=ve(A);if((te(R.wf|0,A,6)|0)==0){if(j=l[A+6|0],j<<24>>24==0||j<<24>>24==32){var M=0;j=23}else{var D=0;j=18}}else{D=0,j=18}b:do{if(j==18){for(;;){if((D|0)>=(J|0)){M=D;break b}if((te(R.yf|0,A+D|0,7)|0)==0&&(M=l[D+(A+7)|0],M<<24>>24==0||M<<24>>24==32)){break}D=D+1|0}M=D+1|0}}while(0);if((M|0)<(J|0)){var K=l[M+(A+6)|0]<<24>>24!=0&1|6,H=M+K|0,N=(H|0)>(J|0);b:do{if(!N){for(var Q=M,P=H;;){if(l[A+Q|0]=l[A+P|0],Q=Q+1|0,P=Q+K|0,(P|0)>(J|0)){break b}}}}while(0);l[A+M|0]<<24>>24==0&(M|0)>0&&(l[A+(M-1)|0]=0);l[p[m>>2]+o*24+23|0]=1;J=p[k>>2]}else{J=w}}}while(0);o=o+1|0;if((o|0)>=(J|0)){x=e;j=30;break a}w=J}}else{x=e,j=30}}}}else{j=6}}}while(0);j==6&&(c=p[h],(c|0)==0?(h=zm(b,R.uf|0,(z=a,a+=4,p[z>>2]=q,z)),p[f>>2]=h):(c=zm(b,R.d|0,(z=a,a+=4,p[z>>2]=c,z)),p[f>>2]=c,Lg(p[h])),vf(b,s),x=e);vf(b,q);b=x}}a=i;return b}aD.X=1;function Hm(b){var c=p[b>>2];l[c+124|0]<<24>>24==0?(c=QD(c,b+8|0),(c|0)==0?b=0:(p[b+4>>2]=c,b=b+64|0,p[b>>2]=p[b>>2]+1|0,b=c)):b=0;return b}function LC(b,c){var d=p[p[p[b>>2]+8>>2]+(c<<4)+12>>2];pw(b,0,c);var e=b+68|0,f=p[e>>2];p[e>>2]=f+3|0;RD(b,c,f,0,0);var e=p[b+72>>2]+1|0,d=p[d+16>>2],g=(d|0)==0;a:do{if(!g){for(var h=d;;){if(SD(b,p[h+8>>2],0,f,e),h=p[h>>2],(h|0)==0){break a}}}}while(0);f=Su(b);(f|0)!=0&&qw(f,107,c)}function MC(b,c){var d=Xu(b,c),e=mi(b,d);vf(b,d);return e}function NC(b,c,d){var e=rm(p[b>>2],p[c+68>>2]);pw(b,0,e);var f=b+68|0,g=p[f>>2];p[f>>2]=g+3|0;(d|0)==0?RD(b,e,g,p[c>>2],R.zb|0):RD(b,e,g,p[d>>2],R.yb|0);SD(b,c,d,g,p[b+72>>2]+1|0);b=Su(b);(b|0)!=0&&qw(b,107,e)}function lw(b,c,d,e){var f=p[b>>2];if((d|0)==0){b=7}else{if((p[d+4>>2]|0)==0){b=7}else{if(l[f+124|0]<<24>>24==0){p[e>>2]=d;var g=MC(f,c);(g|0)<0&&(ym(b,R.Bf|0,(z=a,a+=4,p[z>>2]=c,z)),b=b+64|0,p[b>>2]=p[b>>2]+1|0,g=-1)}else{ym(b,R.Af|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),b=b+64|0,p[b>>2]=p[b>>2]+1|0,g=-1}b=8}}b==7&&(f=p[f+116>>2],p[e>>2]=c,g=f);return g}function RD(b,c,d,e,f){var g=p[b>>2],h=Su(b);if((h|0)!=0){var i=(c<<4)+p[g+8>>2]|0,j=p[i>>2],g=Im(g,R.$|0,j);(g|0)==0?(e=b+416|0,xw(b,R.Df|0,(z=a,a+=12,p[z>>2]=j,p[z+4>>2]=R.$|0,p[z+8>>2]=R.Cf|0,z)),b=p[e>>2],e=1):(j=(e|0)==0,g=p[g+20>>2],kx(b,c,g,1,R.$|0),j?V(h,103,g,c):(i=p[i>>2],xw(b,R.ka|0,(z=a,a+=16,p[z>>2]=i,p[z+4>>2]=R.$|0,p[z+8>>2]=f,p[z+12>>2]=e,z))),b=g,e=0);gw(h,40,d,b,c);Dm(h,-1,3,-14);sw(h,e)}}function sw(b,c){var d=p[b+4>>2];(d|0)!=0&&(l[d+(p[b+28>>2]-1)*20+3|0]=c)}function wx(b,c){var d=p[b+44>>2];(d|0)!=0&&(p[(((c^-1)<<2)+d|0)>>2]=p[b+28>>2])}function SD(b,c,d,e,f){var g,h,i,j,k=p[b>>2],m=f+1|0,o=f+2|0,r=f+3|0,q=f+4|0,s=f+5|0,u=f+6|0,w=f+7|0,v=Su(b),x=(v|0)==0|(c|0)==0;do{if(!x&&(i=(c+20|0)>>2,(p[i]|0)!=0)){h=(c|0)>>2;var A=p[h];if((jm(A,R.N|0,7)|0)!=0){var E=rm(k,p[c+68>>2]);if((Ru(b,28,A,0,p[p[k+8>>2]+(E<<4)>>2])|0)==0){kx(b,E,p[i],0,p[h]);var J=b+68|0,A=p[J>>2];p[J>>2]=A+1|0;hw(v,94,0,f,0,p[h],0);h=c+16|0;var J=p[h>>2],M=(J|0)==0;do{if(M){var D=b+72|0;j=35}else{j=(d|0)==0;var K=f+8|0,H=b+72|0,N=v+28|0,Q=-1,P=J;for(g=P>>2;;){var L=j|(P|0)==(d|0);do{if(L){var I=p[g+1],X=zh(k,I<<2),Y=X;if((X|0)==0){I=Q}else{var da=lx(b,P),ga=(I<<1)+K|0;(ga|0)>(p[H>>2]|0)&&(p[H>>2]=ga);hw(v,39,A,p[g+5],E,da,-16);hw(v,94,0,m,0,p[g],0);da=(I|0)<0;a:do{if(da){var ha=0}else{for(var ga=I+1|0,ba=0;;){if(V(v,7,0,ba+w|0),ba=ba+1|0,(ba|0)==(ga|0)){break}}if(ga=(I|0)>0){for(var ba=K+I|0,ea=0;;){if(V(v,10,0,ba+ea|0),ea=ea+1|0,(ea|0)==(I|0)){ha=ga;break a}}}else{ha=0}}}while(0);da=Xw(v);V(v,72,A,da);ga=p[N>>2];V(v,20,w,1);a:do{if(ha){for(var ea=P+44|0,ba=K+I|0,ja=0,ra=0;;){gw(v,29,A,ja,r);var Va=(ja|0)==0?qw(v,28,K):ra,ra=gv(b,p[p[ea>>2]+(ja<<2)>>2]),ra=hw(v,75,r,0,ba+ja|0,ra,-4);p[((ja<<2)+Y|0)>>2]=ra;sw(v,-128);ja=ja+1|0;if((ja|0)==(I|0)){break}ra=Va}V(v,1,0,da);for(ea=0;;){if(fw(v,p[Y+(ea<<2)>>2]),(ea|0)==0&&fw(v,Va),V(v,20,K+ea|0,1),gw(v,29,A,ea,ba+ea|0),ea=ea+1|0,(ea|0)==(I|0)){break a}}}else{V(v,1,0,da)}}while(0);vf(k,X);wx(v,da);V(v,95,A,ga);qw(v,45,A);V(v,15,w,o);X=(Q|0)<0?qw(v,28,w):Q;a:do{if(ha){for(Y=0;;){if(hw(v,94,0,s,0,R.W|0,0),gw(v,91,s,o,o),da=K+Y|0,gw(v,86,w,da,s),V(v,20,s,-1),gw(v,89,da,s,s),qw(v,144,s),gw(v,91,s,o,o),Y=Y+1|0,(Y|0)==(I|0)){break a}}}}while(0);hw(v,31,f,3,q,R.Ab|0,0);V(v,56,e,u);gw(v,57,e,q,u);sw(v,8);I=X}}else{I=Q}}while(0);g=p[g+8];if((g|0)==0){break}Q=I;P=g;g=P>>2}if((p[h>>2]|0)==0){D=H,j=35}else{fw(v,I);var ta=ew(v,1),xa=H;j=37}}}while(0);j==35&&(gw(v,39,A,p[i],E),V(v,32,A,o),qw(v,45,A),ta=qw(v,28,o),xa=D);V(v,10,0,m);hw(v,31,f,3,q,R.Ab|0,0);V(v,56,e,u);gw(v,57,e,q,u);sw(v,8);(p[xa>>2]|0)<(q|0)&&(p[xa>>2]=q);fw(v,ta)}}}}while(0)}SD.X=1;function qw(b,c,d){return gw(b,c,d,0,0)}function kx(b,c,d,e,f){var g;g=p[b+428>>2];var h=(g|0)==0?b:g,b=(h+404|0)>>2,i=y[b];g=(h+408|0)>>2;var j=0;a:for(;;){if((j|0)<(i|0)){var k=p[g],m=(p[k+(j<<4)>>2]|0)==(c|0);do{if(m&&(p[k+(j<<4)+4>>2]|0)==(d|0)){c=(j<<4)+k+8|0;l[c]=(l[c]|e)<<24>>24!=0&1;break a}}while(0);j=j+1|0}else{h|=0;i=j=Gl(p[h>>2],p[g],(i<<4)+16|0);p[g]=i;if((j|0)==0){p[b]=0;l[p[h>>2]+30|0]=1;break}g=p[b];p[b]=g+1|0;p[((g<<4)+i|0)>>2]=c;p[((g<<4)+i+4|0)>>2]=d;l[(g<<4)+i+8|0]=e;p[((g<<4)+i+12|0)>>2]=f;break}}}kx.X=1;function lx(b,c){var d=p[c+4>>2],e=b|0,f=p[e>>2],g=ni(f,(d<<2)+d+12|0);if((g|0)!=0){p[g>>2]=p[e>>2];var e=g+12|0,h=g+8|0;p[h>>2]=(d<<2)+e|0;var i=(d|0)>0;a:do{if(i){for(var j=c+44|0,k=c+40|0,m=0;;){var o=gv(b,p[p[j>>2]+(m<<2)>>2]);p[((m<<2)+e|0)>>2]=o;l[p[h>>2]+m|0]=l[p[k>>2]+m|0];m=m+1|0;if((m|0)==(d|0)){break a}}}}while(0);n[g+6>>1]=d&65535}(p[b+64>>2]|0)==0?d=g:(vf(f,g),d=0);return d}lx.X=1;function Xw(b){var c=b+36|0,d=y[c>>2];p[c>>2]=d+1|0;var c=b+40|0,e=p[c>>2];if((d|0)<(e|0)){c=b+44|0}else{var f=b|0,b=b+44|0,e=Gl(p[f>>2],p[b>>2],(e<<3)+20|0);p[b>>2]=e;f=Dl(p[f>>2],e)>>>2;p[c>>2]=f;c=b}c=p[c>>2];(c|0)!=0&&(p[((d<<2)+c|0)>>2]=-1);return d^-1}function gv(b,c){var d=y[b>>2],e=l[p[p[d+8>>2]+12>>2]+77|0],f=t[d+124|0],g=wo(d,e,c,f&255);f<<24>>24==0?(g|0)!=0&&(p[g+12>>2]|0)!=0?d=g:(d=jD(d,e,g,c),(d|0)==0&&(ym(b,R.pb|0,(z=a,a+=4,p[z>>2]=c,z)),d=0)):d=g;return d}function Gl(b,c,d){d=Il(b,c,d);(d|0)==0&&vf(b,c);return d}function QD(b,c){var d,e=p[b+12>>2]&512,f=b+124|0;l[f]=1;var g=b+4|0,h=b+8|0,i=0,j=0;a:for(;;){if((i|0)!=0){var k=i;d=12;break}i=p[g>>2];if((j|0)>=(i|0)){d=(i|0)>1;do{if(d&&(n[p[p[h>>2]+28>>2]+78>>1]&1)<<16>>16==0&&(g=TD(b,1,c),(g|0)!=0)){Bi(b,1);k=g;d=12;break a}}while(0);l[f]=0;if((e|0)!=0){var m=0;d=15;break}p[(b+12|0)>>2]&=-513;m=0;d=15;break}(n[p[p[h>>2]+(j<<4)+12>>2]+78>>1]&1)<<16>>16!=0|(j|0)==1?i=0:(i=TD(b,j,c),(i|0)==0?i=0:Bi(b,j));j=j+1|0}d==12&&(l[f]=0,m=k);return m}QD.X=1;function fC(b){return(b|0)>-1?b:(b|0)==-2147483648?2147483647:-b|0}function Hw(b){var c;c=y[b+12>>2]>>2;var d=y[p[b+16>>2]+24>>2];p[c]=d>>>0<10?10:d;var d=b+4|0,e=y[d>>2],f=(e|0)<1;a:do{if(f){var g=e}else{for(var h=1,i=10;;){p[(h<<2>>2)+c]=i;var h=h+1|0,j=p[d>>2];if((h|0)>(j|0)){g=j;break a}i=((i>>>0>5)<<31>>31)+i|0}}}while(0);l[b+24|0]<<24>>24!=0&&(p[(g<<2>>2)+c]=1)}function TD(b,c,d){var e,f,g,h,i,j=a;a+=52;var k;i=j>>2;var m=j+16,o=j+36;h=o>>2;var r=(c|0)==1,q=r?R.ir|0:R.hr|0,s=r?R.n|0:R.o|0,u=j|0;p[u>>2]=s;p[i+1]=R.Bb|0;p[i+2]=q;p[i+3]=0;p[h]=b;p[h+1]=c;i=(o+12|0)>>2;p[i]=0;p[h+2]=d;UD(o,0,u);u=y[i];q=(u|0)==0;do{if(q){if(h=(b+8|0)>>2,g=p[h],e=Im(b,s,p[g+(c<<4)>>2]),(e|0)==0?f=g:(l[e+34|0]|=1,f=p[h]),g=((c<<4)+f+4|0)>>2,e=p[g],(e|0)==0){if(r){n[(p[f+28>>2]+78|0)>>1]|=1,w=0}else{var w=0}k=36}else{li(p[e>>2],p[e+4>>2]);e=p[g];if((ki(l[e+8|0])|0)==0){var v=qi(e,0);if((v|0)!=0){c=ok(v);En(d,b,R.d|0,(z=a,a+=4,p[z>>2]=c,z));k=34;break}v=1;e=p[g]}else{v=0}k=m|0;ri(p[e>>2],p[e+4>>2],1,k);var x=p[g];e=m+4|0;ri(p[x>>2],p[x+4>>2],2,e);var A=p[g],x=m+8|0;ri(p[A>>2],p[A+4>>2],3,x);A=p[g];ri(p[A>>2],p[A+4>>2],4,m+12|0);var E=p[g],A=m+16|0;ri(p[E>>2],p[E+4>>2],5,A);k=p[k>>2];f=((c<<4)+f+12|0)>>2;p[(p[f]|0)>>2]=k;k=y[A>>2];if((k|0)==0){n[(p[p[h]+(c<<4)+12>>2]+78|0)>>1]|=4,k=17}else{if((c|0)==0){k&=3,l[p[p[h]+12>>2]+77|0]=k<<24>>24==0?1:k,k=wo(b,1,R.w|0,0),p[b+44>>2]=k,k=17}else{if((k|0)==(t[p[p[h]+12>>2]+77|0]&255|0)){k=17}else{En(d,b,R.Cb|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));var J=1;k=32}}}if(k==17){if(l[p[f]+77|0]=l[p[p[h]+12>>2]+77|0],k=y[f],J=k+80|0,(p[J>>2]|0)==0?(x=fC(p[x>>2]),p[J>>2]=(x|0)==0?2e3:x,J=p[g],gC(p[J>>2],p[J+4>>2],p[p[f]+80>>2]),x=p[f]):x=k,J=y[e>>2],l[x+76|0]=J&255,e=p[f]+76|0,x=l[e],x<<24>>24==0?(l[e]=1,e=l[p[f]+76|0]):e=x,(e&255)>4){En(d,b,R.Ff|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),J=1}else{(c|0)==0&(J|0)>3&&(p[(b+12|0)>>2]&=-1048577);J=p[p[h]+(c<<4)>>2];J=zm(b,R.Gf|0,(z=a,a+=8,p[z>>2]=J,p[z+4>>2]=s,z));e=(b+268|0)>>2;f=p[e];p[e]=0;x=Ym(b,J,46,o,0);p[e]=f;e=(x|0)==0?p[i]:x;vf(b,J);(J=(e|0)==0)&&VD(b,c);if(l[b+30|0]<<24>>24==0){J?k=31:(M=e,k=30)}else{Bi(b,-1);var M=7;k=30}k==30&&(p[b+12>>2]&8388608|0)==0?J=M:(n[(p[p[h]+(c<<4)+12>>2]+78|0)>>1]|=1,J=0)}}(v|0)!=0&&WD(p[g]);v=J;k=34}}else{v=u,k=34}}while(0);if(k==34){if((v|0)==3082||(v|0)==7){l[b+30|0]=1}w=v}a=j;return w}TD.X=1;function UD(b,c,d){var e=d>>2,c=a;a+=4;var f=p[b>>2],g=p[b+4>>2],h=f+8|0;n[(p[p[h>>2]+(g<<4)+12>>2]+78|0)>>1]&=-5;var i=f+30|0,j=l[i]<<24>>24==0;a:do{if(j){if((d|0)==0){var k=0}else{var m=d+4|0,o=p[m>>2];if((o|0)==0){XD(b,p[e],0)}else{var k=d+8|0,r=p[k>>2],q=(r|0)==0;do{if(!q&&l[r]<<24>>24!=0){d=f+116|0;p[d>>2]=g;g=dp(p[m>>2]);p[(f+120|0)>>2]=g;g=f+125|0;l[g]=0;$m(f,p[k>>2],-1,c,0);h=p[f+20>>2];p[d>>2]=0;(h|0)!=0&&l[g]<<24>>24==0&&(p[b+12>>2]=h,(h|0)==7?l[i]=1:(h|0)!=9&&(h&255|0)!=6&&(e=p[e],f=Tm(f),XD(b,e,f)));Zj(p[c>>2]);k=0;break a}}while(0);k=p[e];if((k|0)==0){XD(b,0,0)}else{k=nw(f,k,p[p[h>>2]+(g<<4)>>2]);if((k|0)==0){k=0;break}if((No(o,k+20|0)|0)!=0){k=0;break}XD(b,p[e],R.Jf|0)}}k=0}}else{XD(b,p[e],0),k=1}}while(0);a=c;return k}UD.X=1;function gC(b,c,d){li(b,c);Vp(p[p[c>>2]+176>>2],d)}function VD(b,c){var d=a;a+=8;var e=b+8|0,f=p[e>>2],g=p[p[f+(c<<4)+12>>2]+32>>2];if((g|0)==0){e=f}else{for(f=g;;){if(Hw(p[f+8>>2]),f=p[f>>2],(f|0)==0){break}}e=p[e>>2]}p[d>>2]=b;e=p[e+(c<<4)>>2];p[d+4>>2]=e;f=(Im(b,R.$|0,e)|0)==0;do{if(f){g=1}else{g=zm(b,R.Hf|0,(z=a,a+=4,p[z>>2]=e,z));if((g|0)!=0){var h=Ym(b,g,48,d,0);vf(b,g);if((h|0)!=7){g=h;break}}l[b+30|0]=1;g=7}}while(0);a=d;return g}function WD(b){li(p[b>>2],p[b+4>>2]);var c=Ji(b,0);return(c|0)==0?Ii(b,0):c}function YD(b,c,d){var e=(d|0)==0;a:do{if(!e&&(c=p[d>>2],(c|0)!=0)){var f=y[d+8>>2];if((f|0)!=0){var g=p[b>>2],h=p[b+4>>2],i=Im(g,c,h);if((i|0)!=0){var j=p[d+4>>2],k=(j|0)==0;do{if(!k&&(c=nw(g,j,h),(c|0)!=0)){for(var b=p[c+4>>2],d=i+24|0,m=c+12|0,e=f,f=0;;){g=t[e];if(g<<24>>24==0|(f|0)>(b|0)){break a}h=(g-48&255)<10;b:do{if(h){i=0;j=e;for(k=g;;){if(i=(k<<24>>24)+(i*10-48)|0,j=j+1|0,k=t[j],(k-48&255)>=10){var o=i,r=j;break b}}}else{o=0,r=e}}while(0);(f|0)==0&&(p[d>>2]=o);p[((f<<2)+p[m>>2]|0)>>2]=o;e=l[r]<<24>>24==32?r+1|0:r;if((jm(e,R.If|0,10)|0)==0){break}f=f+1|0}l[c+26|0]=1;break a}}while(0);c=i+24|0;g=t[f];if(g<<24>>24!=0){h=(g-48&255)<10;b:do{if(h){i=0;j=f;for(k=g;;){if(i=(k<<24>>24)+(i*10-48)|0,j=j+1|0,k=t[j],(k-48&255)>=10){m=i;break b}}}else{m=0}}while(0);p[c>>2]=m}}}}}while(0);return 0}YD.X=1;function XD(b,c,d){var e=p[b>>2],f=e+30|0;if(l[f]<<24>>24==0){if((p[e+12>>2]&8388608|0)==0){var g=(c|0)==0?R.Ba|0:c,c=(b+8|0)>>2;En(p[c],e,R.Kf|0,(z=a,a+=4,p[z>>2]=g,z));(d|0)!=0&&(g=p[p[c]>>2],d=ZD(e,g,R.Lf|0,(z=a,a+=8,p[z>>2]=g,p[z+4>>2]=d,z)),p[p[c]>>2]=d)}l[f]<<24>>24!=0?f=7:(aj(93506),f=11)}else{f=7}p[b+12>>2]=f}function ZD(b,c,d){var e=a;a+=4;p[e>>2]=arguments[ZD.length];var f=ji(b,d,p[e>>2]);vf(b,c);a=e;return f}function JC(b,c){var d=p[b>>2],e=d+4|0,f=p[e>>2],g=(f|0)>0;a:do{if(g){for(var h=p[d+8>>2],i=0,j=f;;){var k=p[p[h+12>>2]+16>>2];if((k|0)!=0){for(j=k;;){if(KC(b,p[j+8>>2],c),j=p[j>>2],(j|0)==0){break}}j=p[e>>2]}i=i+1|0;if((i|0)>=(j|0)){break a}h=h+16|0}}}while(0)}function KC(b,c,d){var e=p[c+16>>2],f=(e|0)==0;a:do{if(!f){var g=b|0,h=c+68|0;if((d|0)==0){for(var i=e;;){if(pw(b,0,rm(p[g>>2],p[h>>2])),Iw(b,i,-1),i=p[i+32>>2],(i|0)==0){break a}}}else{for(i=e;;){for(var j=i+44|0,k=p[i+4>>2],m=0;;){if((m|0)>=(k|0)){var o=0;break}if((qm(p[p[j>>2]+(m<<2)>>2],d)|0)==0){o=1;break}m=m+1|0}(o|0)!=0&&(pw(b,0,rm(p[g>>2],p[h>>2])),Iw(b,i,-1));i=p[i+32>>2];if((i|0)==0){break a}}}}}while(0)}function ox(b,c){var d=b+60|0,e=p[d>>2],f=b+56|0,g=p[f>>2];(g|0)<(c|0)?(d=b+72|0,e=p[d>>2],p[d>>2]=e+c|0,d=e+1|0):(p[d>>2]=e+c|0,p[f>>2]=g-c|0,d=e);return d}function $D(b,c){var d=c+8|0;if(l[d]<<24>>24!=0){var e=b+19|0,f=t[e];if((f&255)<8){var g=p[c+16>>2];l[e]=f+1&255;p[b+((f&255)<<2)+24>>2]=g}l[d]=0}}function Iw(b,c,d){var e,f=p[c+16>>2];e=(b+68|0)>>2;var g=p[e],h=g+1|0;p[e]=g+2|0;var i=p[b>>2],j=rm(i,p[c+36>>2]);if((Ru(b,27,p[c>>2],0,p[p[i+8>>2]+(j<<4)>>2])|0)==0&&(kx(b,j,p[f+20>>2],1,p[f>>2]),i=Su(b),(i|0)!=0)){var k=(d|0)>-1;if(k){var m=d}else{d=p[c+20>>2],V(i,103,d,j),m=d}d=lx(b,c);hw(i,40,h,m,j,d,-16);k&&sw(i,1);k=p[e];p[e]=k+1|0;hw(i,43,k,0,0,d,-6);eA(b,g,j,f,39);f=V(i,72,g,0);e=rx(b);yC(b,c,g,e,1);V(i,96,k,e);V(i,95,g,f+1|0);fw(i,f);f=V(i,70,k,0);j=i+28|0;d=p[j>>2];l[c+24|0]<<24>>24==0?c=d:(c=d+3|0,V(i,1,0,c),j=p[j>>2],gw(i,61,k,c,e),aE(b,2,R.Nf|0,-2),c=j);V(i,62,k,e);gw(i,97,h,e,1);sw(i,16);sx(b,e);V(i,81,k,c);fw(i,f);qw(i,45,g);qw(i,45,h);qw(i,45,k)}}Iw.X=1;function eA(b,c,d,e,f){if((l[e+34|0]&16)<<24>>24==0){var g=Su(b),h=e+20|0;kx(b,d,p[h>>2],(f|0)==40&1,p[e>>2]);gw(g,f,c,p[h>>2],d);Dm(g,-1,p[e+8>>2],-14)}}function yC(b,c,d,e,f){var g=p[b+12>>2],h=p[c+16>>2],i=p[c+4>>2],j=i+1|0,k=ox(b,j),m=k+i|0;V(g,65,d,m);var o=(i|0)>0;a:do{if(o){for(var r=c+8|0,q=h+4|0,s=0;;){var u=p[p[r>>2]+(s<<2)>>2],w=s+k|0;(u|0)==(p[q>>2]|0)?V(g,15,m,w):(gw(g,29,d,u,w),XA(g,h,u,-1));s=s+1|0;if((s|0)==(i|0)){break a}}}}while(0);(f|0)!=0&&(c=(p[h+28>>2]|0)==0?(p[p[b>>2]+12>>2]&128|0)!=0?0:bE(g,c):0,gw(g,31,k,j,e),Dm(g,-1,c,0));tx(b,k,j);return k}yC.X=1;function aE(b,c,d,e){var f=Su(b);(c|0)==2&&Kx(b);hw(f,6,19,c,0,d,e)}function XA(b,c,d,e){var f=a;a+=4;if((p[c+28>>2]|0)==0){var g=p[b>>2],c=c+12|0,h=p[c>>2];TC(g,p[(h+4>>2)+(d*6|0)],l[p[p[g+8>>2]+12>>2]+77|0],l[h+d*24+22|0],f);g=p[f>>2];(g|0)!=0&&Dm(b,-1,g,-8);(e|0)>-1&&l[p[c>>2]+d*24+22|0]<<24>>24==101&&qw(b,22,e)}a=f}function bE(b,c){var d,e;e=(c+28|0)>>2;d=p[e];if((d|0)==0){var f=p[c+16>>2],g=p[b>>2];d=(c+4|0)>>2;var h=zh(0,p[d]+2|0);p[e]=h;if((h|0)==0){l[g+30|0]=1,e=0}else{g=(p[d]|0)>0;a:do{if(g){for(var i=c+8|0,j=f+12|0,k=0,m=h;;){if(l[m+k|0]=l[p[j>>2]+p[p[i>>2]+(k<<2)>>2]*24+22|0],k=k+1|0,m=p[e],(k|0)>=(p[d]|0)){var o=k,r=m;break a}}}else{o=0,r=h}}while(0);l[r+o|0]=100;l[p[e]+o+1|0]=0;e=p[e]}}else{e=d}return e}bE.X=1;function tx(b,c,d){cE(b,c,d);var e=b+56|0;(p[e>>2]|0)<(d|0)&&(p[e>>2]=d,p[b+60>>2]=c)}function cE(b,c,d){var d=c-1+d|0,e=b+116|0,f=p[e>>2];(f|0)<(c|0)|(f|0)>(d|0)||($D(b,b+100|0),p[e>>2]=0);e=b+140|0;f=p[e>>2];(f|0)<(c|0)|(f|0)>(d|0)||($D(b,b+124|0),p[e>>2]=0);e=b+164|0;f=p[e>>2];(f|0)<(c|0)|(f|0)>(d|0)||($D(b,b+148|0),p[e>>2]=0);e=b+188|0;f=p[e>>2];(f|0)<(c|0)|(f|0)>(d|0)||($D(b,b+172|0),p[e>>2]=0);e=b+212|0;f=p[e>>2];(f|0)<(c|0)|(f|0)>(d|0)||($D(b,b+196|0),p[e>>2]=0);e=b+236|0;f=p[e>>2];(f|0)<(c|0)|(f|0)>(d|0)||($D(b,b+220|0),p[e>>2]=0);e=b+260|0;f=p[e>>2];(f|0)<(c|0)|(f|0)>(d|0)||($D(b,b+244|0),p[e>>2]=0);e=b+284|0;f=p[e>>2];(f|0)<(c|0)|(f|0)>(d|0)||($D(b,b+268|0),p[e>>2]=0);e=b+308|0;f=p[e>>2];(f|0)<(c|0)|(f|0)>(d|0)||($D(b,b+292|0),p[e>>2]=0);e=b+332|0;f=p[e>>2];(f|0)<(c|0)|(f|0)>(d|0)||($D(b,b+316|0),p[e>>2]=0)}cE.X=1;function dE(b,c,d){c=a;a+=128;var e,f=wk(p[d>>2]),d=rl(b),f=(f|0)==0?xh|0:f,g=p[d+4>>2],h=d+8|0,i=0;a:for(;;){if((i|0)>=(g|0)){Ch(128,c|0,R.Yf|0,(z=a,a+=4,p[z>>2]=f,z));e=15;break}var j=p[h>>2],k=(i<<4)+j+4|0,m=p[k>>2],o=(m|0)==0;do{if(!o&&(qm(p[j+(i<<4)>>2],f)|0)==0){if((i|0)<2){Ch(128,c|0,R.Zf|0,(z=a,a+=4,p[z>>2]=f,z));e=15;break a}if(l[d+28|0]<<24>>24==0){Ch(128,c|0,R.$f|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));e=15;break a}e=(ki(l[m+8|0])|0)==0;do{if(e&&((p[m+16>>2]|0)!=0&1|0)==0){Wn(m);p[k>>2]=0;p[((i<<4)+j+12|0)>>2]=0;Bi(d,-1);e=16;break a}}while(0);Ch(128,c|0,R.ag|0,(z=a,a+=4,p[z>>2]=f,z));e=15;break a}}while(0);i=i+1|0}e==15&&Yk(b,c|0,-1);a=c}dE.X=1;function Sv(b,c,d,e,f,g,h){var i=a;a+=36;for(var j=p[b>>2],k=i>>2,m=k+9;k<m;k++){p[k]=0}p[i>>2]=b;if((eE(i,f)|0)==0){if((eE(i,g)|0)!=0){c=4}else{if((eE(i,h)|0)!=0){c=4}else{if(!((e|0)!=0&&(Ru(b,c,l[e|0]<<24>>24==94?p[e+4>>2]:0,0,0)|0)!=0)){e=Su(b),k=ox(b,4),ux(b,f,k),ux(b,g,k+1|0),ux(b,h,k+2|0),(e|0)!=0&&(k=k+3|0,m=d|0,gw(e,18,0,k-(n[m>>1]<<16>>16)|0,k),sw(e,n[m>>1]&255),Dm(e,-1,d,-5),qw(e,129,(c|0)==24&1))}c=11}}}else{c=4}c==4&&(b=b+64|0,p[b>>2]=p[b>>2]+1|0);Df(j,f);Df(j,g);Df(j,h);a=i}Sv.X=1;function eE(b,c){if((c|0)==0){var d=0}else{d=c|0,l[d]<<24>>24==26?(l[d]=94,d=0):(d=tw(b,c),(d|0)==0&&((Aw(c,1)|0)!=0?d=0:(d=p[c+4>>2],ym(p[b>>2],R.Xf|0,(z=a,a+=4,p[z>>2]=d,z)),d=1)))}return d}function ux(b,c,d){var e;(c|0)==0?e=4:l[c|0]<<24>>24!=-124?e=4:(V(p[b+12>>2],14,p[c+24>>2],d),e=7);e==4&&(c=fE(b,c,d),(c|0)!=(d|0)&&(b=p[b+12>>2],(b|0)!=0&&V(b,15,c,d)));return d}function gE(b){b=b+88|0;p[b>>2]=p[b>>2]+1|0}function fE(b,c,d){var e,f,g,h,i=b>>2,j=a;a+=104;var k;h=j>>2;var m=j+4;g=m>>2;var o=j+8,r=j+56,q=y[i+3];p[h]=0;p[g]=0;var s=p[i],u=(q|0)==0;a:do{if(u){var w=0}else{var v=(c|0)==0;b:do{if(v){k=14}else{var x=t[c|0],A=x&255;do{if((A|0)==154){var E=p[c+36>>2],J=n[c+30>>1]<<16>>16,M=y[E+20>>2];if(l[E|0]<<24>>24==0){var D=p[(M+16>>2)+(J*6|0)];k=89;break b}if(l[E+1|0]<<24>>24!=0){gw(q,29,p[E+8>>2],p[(M+12>>2)+(J*6|0)],d);D=d;k=89;break b}}else{if((A|0)!=152){if((A|0)==129){hE(q,c,0,d),D=d,k=89}else{if((A|0)==130){iE(q,p[c+4>>2],0,d),D=d,k=89}else{if((A|0)==94){hw(q,94,0,d,0,p[c+4>>2],0),D=d,k=89}else{if((A|0)==98){k=14}else{if((A|0)==131){var K=p[c+4>>2]+2|0,H=ve(K)-1|0,N=YC(p[q>>2],K,H);hw(q,11,(H|0)/2&-1,d,0,N,-1);D=d}else{if((A|0)==133){var Q=c+28|0;V(q,12,n[Q>>1]<<16>>16,d);if(l[p[c+4>>2]+1|0]<<24>>24==0){D=d;k=89;break b}Dm(q,-1,p[p[i+116]+((n[Q>>1]<<16>>16)-1<<2)>>2],-2);D=d}else{if((A|0)==132){D=p[c+24>>2]}else{if((A|0)==24){D=fE(b,p[c+8>>2],d)}else{if((A|0)==37){var P=fE(b,p[c+8>>2],d),L=(Yu(p[c+4>>2])<<24>>24)+44|0;if((P|0)==(d|0)){var I=P}else{V(q,15,P,d),I=d}qw(q,L,I);cE(b,I,1);D=I}else{if((A|0)==79||(A|0)==78||(A|0)==77||(A|0)==80||(A|0)==75||(A|0)==76){var X=c+8|0,Y=jE(b,p[X>>2],j),da=c+12|0,ga=jE(b,p[da>>2],m);kE(b,p[X>>2],p[da>>2],A,Y,ga,d,16);D=d}else{if((A|0)==70||(A|0)==146){var ha=c+8|0,ba=jE(b,p[ha>>2],j),ea=c+12|0,ja=jE(b,p[ea>>2],m);kE(b,p[ha>>2],p[ea>>2],x<<24>>24==70?76:75,ba,ja,d,144);D=d}else{if((A|0)==69||(A|0)==68||(A|0)==86||(A|0)==88||(A|0)==87||(A|0)==90||(A|0)==82||(A|0)==83||(A|0)==89||(A|0)==84||(A|0)==85||(A|0)==91){var ra=jE(b,p[c+8>>2],j),Va=jE(b,p[c+12>>2],m);gw(q,A,Va,ra,d);D=d}else{if((A|0)==156){var ta=c+8|0,xa=p[ta>>2],Fa=l[xa|0];if(Fa<<24>>24==-127){hE(q,xa,1,d)}else{if(Fa<<24>>24==-126){iE(q,p[xa+4>>2],1,d)}else{var Na=rx(b);p[h]=Na;V(q,7,0,Na);var Ea=jE(b,p[ta>>2],m);gw(q,87,Ea,Na,d)}}D=d}else{if((A|0)==93||(A|0)==19){var La=jE(b,p[c+8>>2],j);V(q,A,La,d);D=d}else{if((A|0)==73||(A|0)==74){V(q,7,1,d);var za=jE(b,p[c+8>>2],j),Ba=qw(q,A,za);V(q,20,d,-1);fw(q,Ba);D=d}else{if((A|0)==153){var Ja=p[c+36>>2];if((Ja|0)==0){var ka=p[c+4>>2];ym(b,R.Pf|0,(z=a,a+=4,p[z>>2]=ka,z));D=d;k=89;break b}D=p[p[Ja+36>>2]+(n[c+30>>1]<<16>>16<<4)+8>>2]}else{if((A|0)==155||(A|0)==151){var S=l[p[p[s+8>>2]+12>>2]+77|0],ib=c+2|0;if((n[ib>>1]&16384)<<16>>16==0){var Wa=p[c+16>>2];if((Wa|0)==0){var Za=0,Sa=0;f=Sa>>2;var tb=0}else{Za=p[Wa>>2],Sa=Wa,f=Sa>>2,tb=1}}else{Sa=Za=0,f=Sa>>2,tb=0}var pb=p[c+4>>2],fb=ve(pb),Xa=go(s,pb,fb,Za,S,0);if((Xa|0)==0){ym(b,R.Qf|0,(z=a,a+=8,p[z>>2]=fb,p[z+4>>2]=pb,z));D=d;k=89;break b}if((l[Xa+3|0]&64)<<24>>24==0){if(tb){var Ab=ox(b,Za);gE(b);ax(b,p[f],p[f+3],Ab,1);lE(b);var rb=Ab}else{rb=0}if((Za|0)>1){if((n[ib>>1]&128)<<16>>16==0){k=48}else{var cb=mE(s,Xa,Za,p[p[f+3]+20>>2]);if((Za|0)>0){var Cb=cb;k=52}else{var Zb=cb;k=51}}}else{k=48}k==48&&((Za|0)>0?(Cb=mE(s,Xa,Za,p[p[f+3]>>2]),k=52):(Zb=Xa,k=51));c:do{if(k==51){var dc=0,kb=0,Oa=Zb+3|0,Db=Zb}else{if(k==52){for(var Wb=Sa+12|0,Nb=Cb+3|0,$b=0,Rb=0,Ra=0;;){var Ob=(Rb|0)<32?(Aw(p[(p[Wb>>2]>>2)+(Rb*5|0)],1)|0)==0?$b:1<<Rb|$b:$b,Ua=(l[Nb]&8)<<24>>24!=0&(Ra|0)==0?bx(b,p[(p[Wb>>2]>>2)+(Rb*5|0)]):Ra,Jb=Rb+1|0;if((Jb|0)==(Za|0)){dc=Ob;kb=Ua;Oa=Nb;Db=Cb;break c}$b=Ob;Rb=Jb;Ra=Ua}}}}while(0);(l[Oa]&8)<<24>>24!=0&&hw(q,17,0,0,0,(kb|0)==0?p[s+44>>2]:kb,-4);hw(q,18,dc,rb,d,Db,-5);sw(q,Za&255);if((Za|0)==0){D=d;k=89;break b}tx(b,rb,Za);D=d;k=89;break b}var Vb=Xw(q),Pb=Sa+12|0;ux(b,p[p[Pb>>2]>>2],d);var sb=(Za|0)>1;c:do{if(sb){for(var db=1;;){V(q,74,d,Vb);cE(b,d,1);gE(b);ux(b,p[(p[Pb>>2]>>2)+(db*5|0)],d);lE(b);var wb=db+1|0;if((wb|0)==(Za|0)){break c}db=wb}}}while(0);wx(q,Vb);D=d}else{if((A|0)==20||(A|0)==116){D=nE(b,c,0,0)}else{if((A|0)==72){var ob=Xw(q),Kb=Xw(q);V(q,10,0,d);oE(b,c,ob,Kb);V(q,7,1,d);wx(q,ob);V(q,20,d,0);wx(q,Kb);D=d}else{if((A|0)==71){var ub=p[c+8>>2],Xb=p[p[c+16>>2]+12>>2],Sb=p[Xb>>2],Qb=jE(b,ub,j),ac=jE(b,Sb,m),Gb=rx(b),xb=rx(b);kE(b,ub,Sb,80,Qb,ac,Gb,16);var Ta=p[Xb+20>>2];sx(b,p[g]);var qb=jE(b,Ta,m);kE(b,ub,Ta,78,Qb,qb,xb,16);gw(q,69,Gb,xb,d);sx(b,Gb);sx(b,xb);D=d}else{if((A|0)==157){D=fE(b,p[c+8>>2],d)}else{if((A|0)==60){var bc=p[c+40>>2],$a=c+28|0;V(q,116,(n[$a>>1]<<16>>16)+(p[bc+8>>2]+1)*p[c+24>>2]+1|0,d);var mb=n[$a>>1];if(mb<<16>>16<=-1){D=d;k=89;break b}if(l[p[bc+12>>2]+(mb<<16>>16)*24+22|0]<<24>>24!=101){D=d;k=89;break b}qw(q,22,d)}else{if((A|0)==56){if((p[i+108]|0)==0){ym(b,R.Rf|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));w=0;break a}var Bb=c+1|0,bb=l[Bb];if(bb<<24>>24==2){Kx(b);var jb=l[Bb]}else{jb=bb}if(jb<<24>>24==4){hw(q,6,0,4,0,p[c+4>>2],0);D=d;k=89;break b}aE(b,jb<<24>>24,p[c+4>>2],0)}else{var nb=p[c+16>>2];e=p[nb+12>>2]>>2;var zb=p[nb>>2],Tb=Xw(q),ec=p[c+8>>2],Hb=(ec|0)!=0;if(Hb){for(var Eb=r|0,Lb=(ec|0)>>2,gb=Eb>>2,Mb=Lb+12;Lb<Mb;Lb++,gb++){p[gb]=p[Lb]}var vc=jE(b,ec,j);p[r+24>>2]=vc;l[Eb]=-124;l[o|0]=76;p[o+8>>2]=r;p[h]=0;var hc=o}else{hc=0}var kc=(zb|0)>0;c:do{if(kc){var pc=o+12|0;if(Hb){for(var jc=0;;){gE(b);p[pc>>2]=p[e+(jc*5|0)];var mc=Xw(q);mx(b,hc,mc,8);ux(b,p[e+((jc|1)*5|0)],d);V(q,1,0,Tb);lE(b);wx(q,mc);var Fb=jc+2|0;if((Fb|0)>=(zb|0)){break c}jc=Fb}}else{for(var Ub=0;;){gE(b);var Ya=p[e+(Ub*5|0)],Pa=Xw(q);mx(b,Ya,Pa,8);ux(b,p[e+((Ub|1)*5|0)],d);V(q,1,0,Tb);lE(b);wx(q,Pa);var yb=Ub+2|0;if((yb|0)>=(zb|0)){break c}Ub=yb}}}}while(0);var Ka=c+12|0;(p[Ka>>2]|0)==0?V(q,10,0,d):(gE(b),ux(b,p[Ka>>2],d),lE(b));wx(q,Tb)}}D=d}}}}}}}}}}}}}}}}}k=89}}}}break b}}}while(0);var Ac=p[c+24>>2],D=(Ac|0)<0?(n[c+28>>1]<<16>>16)+p[i+21]|0:qx(b,p[c+40>>2],n[c+28>>1]<<16>>16,Ac,d);k=89}}while(0);k==14&&(V(q,10,0,d),D=d);sx(b,p[h]);sx(b,p[g]);w=D}}while(0);a=j;return w}fE.X=1;function qx(b,c,d,e,f){var g,h,i=p[b+12>>2],j=b+100|0;h=j>>2;var k=0;a:for(;;){if((k|0)>=10){LA(i,c,e,d,f);pE(b,e,d,f);var m=f;break}g=(j+16|0)>>2;var o=(p[g]|0)>0;do{if(o&&(p[h]|0)==(e|0)&&(p[h+1]|0)==(d|0)){c=b+92|0;d=p[c>>2];p[c>>2]=d+1|0;p[h+5]=d;qE(b,p[g]);m=p[g];break a}}while(0);j=j+24|0;h=j>>2;k=k+1|0}return m}function hE(b,c,d,e){var f,g=a;a+=8;var h;f=g>>2;var i=(n[c+2>>1]&1024)<<16>>16==0,c=c+4|0;do{if(i){var j=p[c>>2];h=Hk(j,g,ve(j),1);if((h|0)==0){if((d|0)==0){h=8}else{var k=(T.b(0,0,p[f],p[f+1]),T.result[0]),m=T.result[1];h=7}}else{(h|0)==2?(d|0)==0?h=9:(m=-2147483648,k=0,h=7):h=9}if(h==7){p[f]=k,p[f+1]=m}else{if(h==9){iE(b,j,d,e);break}}j=rE(p[b>>2],g);hw(b,8,0,e,0,j,-13)}else{j=p[c>>2],V(b,7,(d|0)==0?j:-j|0,e)}}while(0);a=g}function iE(b,c,d,e){var f,g=a;a+=8;f=g>>2;(c|0)!=0&&(Ek(c,g,ve(c),1),(d|0)!=0&&(c=-(C[0]=p[f],C[1]=p[f+1],xd[0]),xd[0]=c,p[f]=C[0],p[f+1]=C[1]),f=rE(p[b>>2],g),hw(b,130,0,e,0,f,-12));a=g}function jE(b,c,d){var e=rx(b),c=fE(b,c,e);(c|0)==(e|0)?b=e:(sx(b,e),b=0);p[d>>2]=b;return c}function kE(b,c,d,e,f,g,h,i){var j=sE(b,c,d),c=(tE(c,iD(d))&255|i)&255,b=b+12|0;hw(p[b>>2],e,g,h,f,j,-4);sw(p[b>>2],c)}function lE(b){var c,d=b>>2;c=(b+88|0)>>2;var e=p[c]-1|0;p[c]=e;var f=b+100|0,g=b+116|0;(p[g>>2]|0)!=0&&(p[d+28]|0)>(e|0)&&($D(b,f),p[g>>2]=0);e=b+124|0;f=b+140|0;(p[f>>2]|0)!=0&&(p[d+34]|0)>(p[c]|0)&&($D(b,e),p[f>>2]=0);e=b+148|0;f=b+164|0;(p[f>>2]|0)!=0&&(p[d+40]|0)>(p[c]|0)&&($D(b,e),p[f>>2]=0);e=b+172|0;f=b+188|0;(p[f>>2]|0)!=0&&(p[d+46]|0)>(p[c]|0)&&($D(b,e),p[f>>2]=0);e=b+196|0;f=b+212|0;(p[f>>2]|0)!=0&&(p[d+52]|0)>(p[c]|0)&&($D(b,e),p[f>>2]=0);e=b+220|0;f=b+236|0;(p[f>>2]|0)!=0&&(p[d+58]|0)>(p[c]|0)&&($D(b,e),p[f>>2]=0);e=b+244|0;f=b+260|0;(p[f>>2]|0)!=0&&(p[d+64]|0)>(p[c]|0)&&($D(b,e),p[f>>2]=0);e=b+268|0;f=b+284|0;(p[f>>2]|0)!=0&&(p[d+70]|0)>(p[c]|0)&&($D(b,e),p[f>>2]=0);e=b+292|0;f=b+308|0;(p[f>>2]|0)!=0&&(p[d+76]|0)>(p[c]|0)&&($D(b,e),p[f>>2]=0);e=b+332|0;(p[e>>2]|0)!=0&&(p[d+82]|0)>(p[c]|0)&&($D(b,b+316|0),p[e>>2]=0)}lE.X=1;function ax(b,c,d,e,f){var g=(c|0)>0;a:do{if(g){for(var h=b+12|0,i=(f|0)!=0?14:15,j=d,k=0;;){var m=k+e|0,o=fE(b,p[j>>2],m);(o|0)!=(m|0)&&V(p[h>>2],i,o,m);k=k+1|0;if((k|0)==(c|0)){break a}j=j+20|0}}}while(0)}function mE(b,c,d,e){var f,g=a;a+=8;var h=g+4;p[g>>2]=0;p[h>>2]=0;var i=(e|0)==0;do{if(i){f=c}else{if(l[e|0]<<24>>24!=-104){f=c}else{if(f=p[e+40>>2],(f|0)==0){f=c}else{if((l[f+34|0]&16)<<24>>24==0){f=c}else{var j=y[iw(b,f)+8>>2],k=p[j>>2]+72|0;if((p[k>>2]|0)==0){f=c}else{f=(c+24|0)>>2;var m=yl(b,p[f]);if((m|0)==0){f=c}else{var o=l[m],r=o<<24>>24==0;a:do{if(!r){for(var q=m,s=o;;){if(l[q]=l[R.i+(s&255)|0],q=q+1|0,s=t[q],s<<24>>24==0){break a}}}}while(0);j=Gd[p[k>>2]](j,d,m,g,h);vf(b,m);if((j|0)==0){f=c}else{if(m=ni(b,ve(p[f])+37|0),(m|0)==0){f=c}else{j=m;k=c>>2;o=m>>2;for(r=k+9;k<r;k++,o++){p[o]=p[k]}k=m+36|0;p[(m+24|0)>>2]=k;f=p[f];Ah(k,f,ve(f)+1|0);p[(m+12|0)>>2]=p[g>>2];p[(m+4|0)>>2]=p[h>>2];l[m+3|0]|=4;f=j}}}}}}}}}while(0);a=g;return f}mE.X=1;function nE(b,c,d,e){var f,g,h,i,j,k=a;a+=56;var m=k+4,o=k+20,r=k+36,q=k+40;j=q>>2;var s=Su(b),u=(s|0)==0;a:do{if(u){var w=0}else{gE(b);var w=c+2|0,v=(n[w>>1]&32)<<16>>16==0?Uw(b):-1;if(l[b+480|0]<<24>>24==2){var x=(v|0)>-1?xh|0:R.Tf|0,A=c|0;i=l[A]<<24>>24==72?R.Uf|0:R.Wf|0;h=p[b+552>>2];x=zm(p[b>>2],R.Sf|0,(z=a,a+=12,p[z>>2]=x,p[z+4>>2]=i,p[z+8>>2]=h,z));hw(s,150,p[b+548>>2],0,0,x,-1)}else{A=c|0}x=l[A]<<24>>24==72;do{if(x){i=(c+8|0)>>2;h=p[i];var E=(d|0)==0;E||V(s,10,0,d);l[k]=iD(h);h=b+68|0;var J=y[h>>2];p[h>>2]=J+1|0;h=(c+24|0)>>2;p[h]=J;var M=(e|0)!=0,J=V(s,42,J,M&1^1);E&&sw(s,16);E=m;g=E>>2;p[g]=0;p[g+1]=0;p[g+2]=0;p[g+3]=0;n[m+6>>1]=1;g=(n[w>>1]&2048)<<16>>16==0;do{if(g){if(f=p[c+16>>2],(f|0)==0){f=v}else{l[k]<<24>>24==0&&(l[k]=98);var D=bx(b,p[i]);p[m+12>>2]=D;var D=rx(b),K=rx(b);V(s,10,0,K);var H=p[f>>2],N=(H|0)>0;b:do{if(N){for(var Q=s+28|0,P=v,L=H,I=p[f+12>>2];;){var X=p[I>>2];(P|0)>-1&&(Aw(X,1)|0)==0&&(Em(s,P),P=-1);M?(uD(X,r)|0)==0?(X=fE(b,X,D),V(s,21,X,p[Q>>2]+2|0),gw(s,57,p[h],K,X)):gw(s,58,p[h],K,p[r>>2]):(X=fE(b,X,D),hw(s,31,X,1,K,k,1),cE(b,X,1),V(s,97,p[h],K));L=L-1|0;if((L|0)<=0){var Y=P;break b}I=I+20|0}}else{Y=v}}while(0);sx(b,D);sx(b,K);f=Y}}else{uw(o,7,p[h]);l[o+1|0]=l[k];f=(c+16|0)>>2;p[(p[f]+48|0)>>2]=0;if((kv(b,p[f],o)|0)!=0){w=0;break a}f=p[p[f]>>2];(f|0)!=0&&(p[f>>2]|0)>0&&(f=sE(b,p[i],p[p[f+12>>2]>>2]),p[m+12>>2]=f);f=v}}while(0);M||Dm(s,J,E,-6);i=0;h=f}else{i=p[c+16>>2];h=b+72|0;M=p[h>>2]+1|0;p[h>>2]=M;uw(q,0,M);h=q|0;l[A]<<24>>24==116?(l[h]=6,V(s,10,0,p[j+1])):(l[h]=3,V(s,7,0,p[j+1]));h=i+40|0;Df(p[b>>2],p[h>>2]);M=$u(b,129,0,0,Hv+8|0);p[h>>2]=M;p[(i+48|0)>>2]=0;if((kv(b,i,q)|0)!=0){w=0;break a}i=p[j+1];h=v}}while(0);(h|0)>-1&&fw(s,h);lE(b);w=i}}while(0);a=k;return w}nE.X=1;function oE(b,c,d,e){var f,g=a;a+=8;f=g>>2;var h=g+4;p[f]=0;var i=p[b+12>>2],j=uE(b,c,g);l[h]=vE(c);gE(b);var k=rx(b);ux(b,p[c+8>>2],k);if((e|0)==(d|0)){V(i,73,k,e)}else{var m=qw(i,74,k);V(i,72,p[c+24>>2],d);V(i,1,0,e);fw(i,m)}(j|0)==1?(V(i,21,k,d),gw(i,54,p[c+24>>2],d,k)):(hw(i,30,k,1,0,h,1),c=c+24|0,h=p[c>>2],(p[f]|0)==0|(d|0)==(e|0)?zC(i,51,h,d,k,1):(h=zC(i,52,h,0,k,1),j=qw(i,74,p[f]),c=zC(i,52,p[c>>2],0,p[f],1),V(i,7,-1,p[f]),fw(i,c),V(i,20,p[f],1),fw(i,j),V(i,27,p[f],e),V(i,1,0,d),fw(i,h)));sx(b,k);lE(b);a=g}oE.X=1;function mx(b,c,d,e){var f=c>>2,g=a;a+=8;var h=g+4,i=y[b+12>>2];p[g>>2]=0;p[h>>2]=0;if(!((i|0)==0|(c|0)==0)){var j=c|0,k=t[j]&255,m=(k+1^1)-1|0;(k|0)==69?(mx(b,p[f+2],d,e),mx(b,p[f+3],d,e)):(k|0)==68?(c=Xw(i),gE(b),wE(b,p[f+2],c,e^8),mx(b,p[f+3],d,e),wx(i,c),lE(b)):(k|0)==19?wE(b,p[f+2],d,e):(k|0)==79||(k|0)==78||(k|0)==77||(k|0)==80||(k|0)==75||(k|0)==76?(i=c+8|0,j=jE(b,p[i>>2],g),c=c+12|0,f=jE(b,p[c>>2],h),kE(b,p[i>>2],p[c>>2],m,j,f,d,e)):(k|0)==70||(k|0)==146?(e=c+8|0,m=jE(b,p[e>>2],g),c=c+12|0,i=jE(b,p[c>>2],h),kE(b,p[e>>2],p[c>>2],l[j]<<24>>24==70?75:76,m,i,d,128)):(k|0)==73||(k|0)==74?(e=jE(b,p[f+2],g),V(i,m,e,d)):(k|0)==71?(c=p[p[f+4]+12>>2],xE(b,p[f+2],p[c>>2],p[c+20>>2],d,0,e)):(k|0)==72?(e|0)==0?(e=Xw(i),oE(b,c,d,e),wx(i,e)):oE(b,c,d,d):(c=jE(b,c,g),gw(i,28,c,d,(e|0)!=0&1));sx(b,p[g>>2]);sx(b,p[h>>2])}a=g}mx.X=1;function yE(b){if((b|0)==0){b=0}else{if((p[b+28>>2]|0)!=0){b=0}else{if((n[b+6>>1]&5)<<16>>16!=0){b=0}else{if((p[b+40>>2]|0)!=0){b=0}else{if((p[b+12>>2]|0)!=0){b=0}else{var c=p[b+8>>2];n[c>>1]<<16>>16!=1?b=0:(p[c+20>>2]|0)!=0?b=0:(c=p[c+16>>2],(c|0)==0?b=0:(l[c+34|0]&16)<<24>>24!=0?b=0:(b=p[b>>2],b=(p[b>>2]|0)!=1?0:l[p[p[b+12>>2]>>2]|0]<<24>>24==-104&1))}}}}}return b}yE.X=1;function uw(b,c,d){l[b|0]=c&255;p[b+4>>2]=d;l[b+1|0]=0;p[b+8>>2]=0;p[b+12>>2]=0}function qE(b,c){var d=b>>2;(p[d+29]|0)==(c|0)&&(l[b+108|0]=0);(p[d+35]|0)==(c|0)&&(l[b+132|0]=0);(p[d+41]|0)==(c|0)&&(l[b+156|0]=0);(p[d+47]|0)==(c|0)&&(l[b+180|0]=0);(p[d+53]|0)==(c|0)&&(l[b+204|0]=0);(p[d+59]|0)==(c|0)&&(l[b+228|0]=0);(p[d+65]|0)==(c|0)&&(l[b+252|0]=0);(p[d+71]|0)==(c|0)&&(l[b+276|0]=0);(p[d+77]|0)==(c|0)&&(l[b+300|0]=0);(p[d+83]|0)==(c|0)&&(l[b+324|0]=0)}qE.X=1;function pE(b,c,d,e){var f,g=b>>2,h=(p[p[g]+12>>2]&2|0)==0;a:do{if(h){var i=b+100|0;f=i>>2;for(var j=0;;){if((j|0)>=10){h=p[g+30];f=p[g+36];f=(i=(f|0)<(h|0))?f:h;h=i?1:((h|0)==2147483647)<<31>>31;j=p[g+42];f=(i=(j|0)<(f|0))?j:f;h=i?2:h;j=p[g+48];f=(i=(j|0)<(f|0))?j:f;h=i?3:h;j=p[g+54];f=(i=(j|0)<(f|0))?j:f;h=i?4:h;j=p[g+60];f=(i=(j|0)<(f|0))?j:f;h=i?5:h;j=p[g+66];f=(i=(j|0)<(f|0))?j:f;h=i?6:h;j=p[g+72];f=(i=(j|0)<(f|0))?j:f;j=i?7:h;h=p[g+78];j=(i=(h|0)<(f|0))?8:j;f=(p[g+84]|0)<((i?h:f)|0)?9:j;if((f|0)<=-1){break a}p[(b+f*24+112|0)>>2]=p[g+22];p[(b+f*24+100|0)>>2]=c;p[(b+f*24+104|0)>>2]=d;p[(b+f*24+116|0)>>2]=e;l[b+f*24+108|0]=0;c=b+92|0;d=p[c>>2];p[c>>2]=d+1|0;p[(b+f*24+120|0)>>2]=d;break a}var k=i+16|0;if((p[k>>2]|0)==0){p[f+3]=p[g+22];p[f]=c;p[f+1]=d;p[k>>2]=e;l[i+8|0]=0;b=b+92|0;c=p[b>>2];p[b>>2]=c+1|0;p[f+5]=c;break a}i=i+24|0;f=i>>2;j=j+1|0}}}while(0)}pE.X=1;function wE(b,c,d,e){var f=c>>2,g=a;a+=8;var h=g+4,i=y[b+12>>2];p[g>>2]=0;p[h>>2]=0;if(!((i|0)==0|(c|0)==0)){var j=t[c|0],k=j&255;(k|0)==69?(c=Xw(i),gE(b),mx(b,p[f+2],c,e^8),wE(b,p[f+3],d,e),wx(i,c),lE(b)):(k|0)==68?(wE(b,p[f+2],d,e),wE(b,p[f+3],d,e)):(k|0)==19?mx(b,p[f+2],d,e):(k|0)==79||(k|0)==78||(k|0)==77||(k|0)==80||(k|0)==75||(k|0)==76?(i=c+8|0,j=jE(b,p[i>>2],g),c=c+12|0,f=jE(b,p[c>>2],h),kE(b,p[i>>2],p[c>>2],k,j,f,d,e)):(k|0)==70||(k|0)==146?(e=c+8|0,k=jE(b,p[e>>2],g),c=c+12|0,i=jE(b,p[c>>2],h),kE(b,p[e>>2],p[c>>2],j<<24>>24==70?76:75,k,i,d,128)):(k|0)==73||(k|0)==74?(e=jE(b,p[f+2],g),V(i,k,e,d)):(k|0)==71?(c=p[p[f+4]+12>>2],xE(b,p[f+2],p[c>>2],p[c+20>>2],d,1,e)):(k|0)==72?(k=Xw(i),oE(b,c,k,(e|0)!=0?d:k),V(i,1,0,d),wx(i,k)):(c=jE(b,c,g),gw(i,27,c,d,(e|0)!=0&1));sx(b,p[g>>2]);sx(b,p[h>>2])}a=g}wE.X=1;function xE(b,c,d,e,f,g,h){var i=a;a+=196;var j=i+48,k=i+96,m=i+144,o=i+192;p[o>>2]=0;for(var r=m|0,c=(c|0)>>2,q=r>>2,s=c+12;c<s;c++,q++){p[q]=p[c]}l[i|0]=69;p[i+8>>2]=j;p[i+12>>2]=k;l[j|0]=80;p[j+8>>2]=m;p[j+12>>2]=d;l[k|0]=78;p[k+8>>2]=m;p[k+12>>2]=e;d=jE(b,m,o);p[m+24>>2]=d;l[r]=-124;(g|0)==0?mx(b,i,f,h):wE(b,i,f,h);sx(b,p[o>>2]);a=i}function uE(b,c,d){var e,f,g,h,i=b+68|0;e=y[i>>2];p[i>>2]=e+1|0;var j=(d|0)==0,i=Su(b),k=c+2|0,m=(n[k>>1]&2048)<<16>>16==0?0:p[c+16>>2],o=(p[b+64>>2]|0)==0;a:do{if(o){if((yE(m)|0)==0){h=18}else{var r=p[b>>2],q=p[p[m+8>>2]+16>>2];g=q>>2;var s=p[p[p[m>>2]+12>>2]>>2],u=n[s+28>>1],w=u<<16>>16;h=rm(r,p[g+17]);ow(b,h);kx(b,h,p[g+5],0,p[g]);var v=u<<16>>16<0;b:do{if(v){var x=Uw(b);eA(b,e,h,q,39);fw(i,x);x=1}else{var A=sE(b,p[c+8>>2],s),E=vE(c),u=q+12|0;f=p[g+4];if((f|0)==0|E<<24>>24!=98&l[p[u>>2]+w*24+22|0]<<24>>24!=E<<24>>24){h=18;break a}var J=r+8|0,E=b+72|0,M=f;for(f=M>>2;;){var D=(p[p[f+2]>>2]|0)==(w|0);do{if(D&&(wo(r,l[p[p[J>>2]+12>>2]+77|0],p[p[f+11]>>2],0)|0)==(A|0)){if(j){if((p[f+1]|0)!=1){break}if(l[M+24|0]<<24>>24==0){break}var w=lx(b,M),K=Uw(b);hw(i,39,e,p[f+5],h,w,-16);fw(i,K);x=3;break b}K=lx(b,M);x=Uw(b);hw(i,39,e,p[f+5],h,K,-16);fw(i,x);if(l[p[u>>2]+w*24+20|0]<<24>>24!=0){x=3;break b}h=p[E>>2]+1|0;p[E>>2]=h;p[d>>2]=h;V(i,10,0,h);x=3;break b}}while(0);f=y[f+8];if((f|0)==0){h=18;break a}M=f;f=M>>2}}}while(0);p[c+24>>2]=e;K=x;h=25}}else{h=18}}while(0);h==18&&(e=(b+448|0)>>2,m=(C[0]=p[e],C[1]=p[e+1],xd[0]),j?(xd[0]=1,p[e]=C[0],p[e+1]=C[1],n[p[c+8>>2]+28>>1]<<16>>16<0?(n[k>>1]&2048)<<16>>16!=0?(d=0,i=2):(d=0,i=1):(d=0,i=2)):(j=b+72|0,k=p[j>>2]+1|0,p[j>>2]=k,p[d>>2]=k,V(i,10,0,k),d=k,i=2),nE(b,c,d,(i|0)==1&1),xd[0]=m,p[e]=C[0],p[e+1]=C[1],K=i);return K}uE.X=1;function vE(b){var c=iD(p[b+8>>2]),d=p[b+12>>2];return(d|0)==0?(n[b+2>>1]&2048)<<16>>16==0?c<<24>>24!=0?c:98:tE(p[p[p[p[b+16>>2]>>2]+12>>2]>>2],c):tE(d,c)}function zC(b,c,d,e,f,g){c=gw(b,c,d,e,f);Dm(b,c,g,-14);return c}function tE(b,c){var d=iD(b);return d<<24>>24==0|c<<24>>24==0?(d|c)<<24>>24==0?98:d+c&255:d<<24>>24>98|c<<24>>24>98?99:98}function Uw(b){var c=Su(b),b=b+80|0,d=p[b>>2];p[b>>2]=d+1|0;return qw(c,26,d)}function sE(b,c,d){var e=(n[c+2>>1]&256)<<16>>16==0;a:do{if(e){var f=(d|0)==0;do{if(!f&&(n[d+2>>1]&256)<<16>>16!=0){f=p[d+20>>2];break a}}while(0);f=bx(b,c);f=(f|0)!=0?f:bx(b,d)}else{f=p[c+20>>2]}}while(0);return f}function Aw(b,c){var d=a;a+=16;var e=d+12|0;p[e>>2]=c;p[d>>2]=50;p[d+4>>2]=52;mD(d,b);e=p[e>>2];a=d;return e}function rE(b,c){var d=zh(b,8);if((d|0)!=0){var e=c|0,f=c+4|0,f=t[f]|t[f+1]<<8|t[f+2]<<16|t[f+3]<<24|0,g=d|0;B=t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24|0;l[g]=B&255;B>>=8;l[g+1]=B&255;B>>=8;l[g+2]=B&255;B>>=8;l[g+3]=B&255;e=d+4|0;B=f;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255}return d}function LA(b,c,d,e,f){var g;(e|0)<0?g=3:(p[c+4>>2]|0)==(e|0)?g=3:(gw(b,(l[c+34|0]&16)<<24>>24!=0?137:29,d,e,f),g=5);g==3&&V(b,65,d,f);(e|0)>-1&&XA(b,c,e,f)}function Fw(b,c,d,e,f){if((d|0)<0|(d|0)==1){b=0}else{var g=p[c>>2];p[b>>2]=c;p[b+4>>2]=p[p[g+8>>2]+(d<<4)>>2];p[b+8>>2]=e;p[b+12>>2]=f;b=1}return b}function zE(b,c,d){var e,f,g,h,i,j=a;a+=20;var k;i=j>>2;var m=j+4,o=j+8;e=o>>2;var r=j+12,c=r>>2,q=j+16,s=rl(b);h=s>>2;p[i]=0;p[m>>2]=0;p[c]=0;g=wk(p[d>>2]);f=wk(p[d+4>>2]);var d=(g|0)==0?xh|0:g,u=(f|0)==0?xh|0:f;g=(s+4|0)>>2;var w=p[g],v=p[h+25],x=(w|0)<(v+2|0);a:do{if(x){if(l[s+28|0]<<24>>24==0){var A=zm(s,R.dg|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));p[c]=A;K=0;k=32}else{f=(s+8|0)>>2;for(var E=p[f],J=0;;){if((J|0)>=(w|0)){if((E|0)==(s+444|0)){k=zh(s,48);if((k|0)==0){k=36;break a}Ah(k,p[f],32)}else{if(k=Il(s,E,(w<<4)+16|0),(k|0)==0){k=36;break a}}w=k;p[f]=w;v=y[g];x=k=(v<<4)+w|0;for(E=x+16;x<E;x++){l[x]=0}p[e]=p[h+4];h=xo(p[p[h]+16>>2],d,o,q,j,m);if((h|0)==0){m=p[e]|256;p[e]=m;q=p[q>>2];h=p[i];o=(v<<4)+w+4|0;e=o>>2;q=yo(q,h,s,o,0,m);Lg(p[i]);p[g]=p[g]+1|0;(q|0)==19?(i=zm(s,R.gg|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),p[c]=i,i=1):(q|0)==0?(i=zo(s,p[e]),p[w+(v<<4)+12>>2]=i,(i|0)==0?i=7:l[i+76|0]<<24>>24==0?i=0:l[i+77|0]<<24>>24==l[p[p[f]+12>>2]+77|0]<<24>>24?i=0:(i=zm(s,R.Cb|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),p[c]=i,i=1),jC(p[p[p[e]+4>>2]>>2],t[s+31|0]&255),e=p[e],q=iC(p[p[f]+4>>2],-1),iC(e,q)):i=q;l[(v<<4)+w+9|0]=3;u=yl(s,u);p[k>>2]=u;u=(i|0)==0&(u|0)==0?7:i;if((u|0)==0){if(Ce(s),r=QD(s,r),(r|0)==0){k=36;break a}}else{r=u}u=p[g]-1|0;i=p[p[f]+(u<<4)+4>>2];(i|0)!=0&&(Wn(i),p[((u<<4)+p[f]+4|0)>>2]=0,p[((u<<4)+p[f]+12|0)>>2]=0);Bi(s,-1);p[g]=u;if((r|0)==3082||(r|0)==7){l[s+30|0]=1;vf(s,p[c]);A=zm(s,R.ca|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));p[c]=A;K=r;k=32;break a}g=p[c];if((g|0)!=0){var M=g,D=r;k=33;break a}A=zm(s,R.hg|0,(z=a,a+=4,p[z>>2]=d,z));p[c]=A;K=r;k=32;break a}else{(h|0)==7&&(l[s+30|0]=1)}d=p[m>>2];Yk(b,d,-1);Lg(d);k=36;break a}if((qm(p[E+(J<<4)>>2],u)|0)==0){A=zm(s,R.eg|0,(z=a,a+=4,p[z>>2]=u,z));p[c]=A;K=0;k=32;break a}J=J+1|0}}}else{A=zm(s,R.cg|0,(z=a,a+=4,p[z>>2]=v,z));p[c]=A;var K=0;k=32}}while(0);if(k==32){if((A|0)==0){var H=K;k=34}else{M=A,D=K,k=33}}k==33&&(Yk(b,M,-1),vf(s,p[c]),H=D,k=34);k==34&&(H|0)!=0&&ol(b,H);a=j}zE.X=1;function jC(b,c){(c|0)>-1&&l[b+13|0]<<24>>24==0&&(((p[b+180>>2]|0)==0?0:l[p[b+180>>2]+43|0]<<24>>24==2)&1|0)==0&&(l[b+4|0]=c&255);return t[b+4|0]&255}function iC(b,c){var d;if((b|0)==0){d=0}else{var e=p[b>>2];d=(b+4|0)>>2;li(e,p[d]);(c|0)>-1&&(n[(p[d]+22|0)>>1]&=-5,(c|0)!=0&&(n[(p[d]+22|0)>>1]|=4));d=(Vc[p[d]+22>>1]&65535)>>>2&1}return d}function Kw(b,c){var d,e=p[b>>2];d=(e+4|0)>>2;var f=p[d],g=(f|0)>0;a:do{if(g){var h=e+8|0;if((c|0)==0){for(var i=0,j=f;;){if((p[p[h>>2]+(i<<4)+4>>2]|0)!=0&&(ow(b,i),j=p[d]),i=i+1|0,(i|0)>=(j|0)){break a}}}else{i=0;for(j=f;;){var k=p[h>>2];(p[k+(i<<4)+4>>2]|0)!=0&&(qm(c,p[k+(i<<4)>>2])|0)==0&&(ow(b,i),j=p[d]);i=i+1|0;if((i|0)>=(j|0)){break a}}}}}while(0)}function IC(b,c){var d;d=p[b>>2];var e=rm(d,p[c+20>>2]),f=Ao(p[c+24>>2]+8|0,p[c+4>>2],ve(p[c+4>>2])),g=p[p[d+8>>2]+(e<<4)>>2],h=(e|0)==1;d=(c|0)>>2;if((Ru(b,h?14:16,p[d],p[f>>2],g)|0)==0&&(Ru(b,9,h?R.n|0:R.o|0,0,g)|0)==0){f=Su(b),(f|0)!=0&&(pw(b,0,e),rw(b,e),g=Bm(f,9,AE|0),Dm(f,g+1|0,p[d],0),Dm(f,g+4|0,R.ia|0,-2),yw(b,e),V(f,45,0,0),hw(f,110,e,0,0,p[d],0),e=b+72|0,(p[e>>2]|0)<3&&(p[e>>2]=3))}}function rw(b,c){var d=Su(b);kx(b,c,1,1,(c|0)==1?R.n|0:R.o|0);gw(d,40,0,1,c);Dm(d,-1,5,-14);d=b+68|0;(p[d>>2]|0)==0&&(p[d>>2]=1)}function Nv(b,c,d){var e;e=(d+4|0)>>2;b=ni(b,p[e]+40|0);if((b|0)!=0){var f=b+40|0;Ah(f,p[d>>2],p[e]);p[(b+12|0)>>2]=f;p[(b+16|0)>>2]=p[e];l[b]=c}return b}function Ew(b,c){var d=c+4|0,e=xm(b,0,p[c+8>>2],p[d>>2]),f=c+16|0;rf(p[b>>2],p[f>>2]);p[f>>2]=e;(e|0)!=0&&(f=e+32|0,n[f>>1]=n[f>>1]+1&65535);return(FD(b,d)|0)==0?e:0}function Gw(b,c){var d=(c|0)==0;a:do{if(d){var e=0}else{for(var f=p[b+4>>2],g=c|0,e=b|0,h=c+4|0,i=0;;){if((i|0)>=(n[g>>1]<<16>>16|0)){e=0;break a}var j=h|0,k=p[j>>2];if((k|0)==0){var m=yl(p[p[e>>2]>>2],f);p[j>>2]=m}else{if((qm(k,f)|0)!=0){break}}if((Pw(b,p[h+16>>2])|0)!=0){e=1;break a}if((FC(b,p[h+36>>2])|0)!=0){e=1;break a}h=h+60|0;i=i+1|0}f=p[b+8>>2];g=p[b+12>>2];ym(p[e>>2],R.sg|0,(z=a,a+=12,p[z>>2]=f,p[z+4>>2]=g,p[z+8>>2]=k,z));e=1}}while(0);return e}function Pw(b,c){var d,e=c;for(d=e>>2;;){if((e|0)==0){var f=0;break}if((GC(b,p[d])|0)!=0){f=1;break}if((Gw(b,p[d+2])|0)!=0){f=1;break}if((FC(b,p[d+3])|0)!=0){f=1;break}if((FC(b,p[d+5])|0)!=0){f=1;break}e=p[d+7];d=e>>2}return f}function FC(b,c){for(var d=c;;){if((d|0)==0){var e=0;break}var f=Vc[d+2>>1]&65535;if((f&16384|0)!=0){e=0;break}var g=d+16|0;if((f&2048|0)==0){if((GC(b,p[g>>2])|0)!=0){e=1;break}}else{if((Pw(b,p[g>>2])|0)!=0){e=1;break}}if((FC(b,p[d+12>>2])|0)!=0){e=1;break}d=p[d+8>>2]}return e}function GC(b,c){var d=(c|0)==0;a:do{if(d){var e=0}else{for(var f=c|0,g=p[c+12>>2],h=0;;){if((h|0)>=(p[f>>2]|0)){e=0;break a}if((FC(b,p[g>>2])|0)!=0){e=1;break a}g=g+20|0;h=h+1|0}}}while(0);return e}function Sx(b,c){var d,e=b|0,f=p[e>>2];d=(b+16|0)>>2;var g=b+48|0;ag(p[d],(Vc[g>>1]&65535)<<1);vf(f,p[d]);var h=c<<1;n[g>>1]=c&65535;f=ni(f,c*80|0);p[d]=f;d=(f|0)!=0&(h|0)>0;a:do{if(d){for(var g=f,i=h;;){i=i-1|0;n[g+28>>1]=1;p[g>>2]=p[e>>2];if((i|0)<=0){break a}g=g+40|0}}}while(0)}function Az(b,c,d,e,f){l[p[b>>2]+30|0]<<24>>24==0&&Tk(p[b+16>>2]+((Vc[b+48>>1]&65535)*d+c)*40|0,e,-1,1,f)}function hC(b,c,d,e){var f=Su(b),g=b+72|0,h=p[g>>2]+1|0;p[g>>2]=h;b=zh(p[b>>2],8);(b|0)!=0&&(g=b|0,B=d,l[g]=B&255,B>>=8,l[g+1]=B&255,B>>=8,l[g+2]=B&255,B>>=8,l[g+3]=B&255,d=b+4|0,B=e,l[d]=B&255,B>>=8,l[d+1]=B&255,B>>=8,l[d+2]=B&255,B>>=8,l[d+3]=B&255);hw(f,8,0,h,0,b,-13);Sx(f,1);Az(f,0,0,c,0);V(f,16,h,1)}function DC(b){b&=255;return(b|0)==7?R.Ah|0:(b|0)==8?R.Bh|0:(b|0)==9?R.Dh|0:(b|0)==6?R.Eh|0:R.Fh|0}function EC(b,c,d,e){if((c|0)==1){var f=b+8|0;l[f]=1;c=0}else{var g=t[b+13|0],f=b+8|0;l[f]=g<<24>>24!=0&1;c=(c|0)!=3?0:g<<24>>24==0}l[b+9|0]=c&1;l[f]<<24>>24==0?(d|0)==0?(l[b+12|0]=2,d=b+10|0,l[d]=(e|0)==0?2:3,e=2):(l[b+12|0]=3,e=l[b+10|0]=3):(l[b+12|0]=0,e=l[b+10|0]=0);l[b+11|0]=c?e|32:e}EC.X=1;function bC(b,c){(b|0)==0|(c|0)==0||(p[b+20>>2]=c,n[(b+2|0)>>1]|=256);return b}function lC(b){var c=b+4|0;li(p[b>>2],p[c>>2]);b=p[c>>2];return l[b+17|0]<<24>>24==0?0:l[b+18|0]<<24>>24==0?1:2}function mC(b,c,d){var e;li(b,c);b=d&255;d=(b|0)!=0;if((n[c+22>>1]&2)<<16>>16==0){var f=c+17|0;e=4}else{if(e=c+17|0,(d&1|0)==(t[e]&255|0)){f=e,e=4}else{var g=8;e=5}}e==4&&(l[f]=d&1,l[c+18|0]=(b|0)==2&1,g=0);return g}function oC(b){var c=p[b>>2],d=c+8|0,e=p[p[d>>2]+20>>2],f=(e|0)==0;a:do{if(f){var g=0}else{g=l[c+28|0]<<24>>24==0;do{if(!g&&(ki(l[e+8|0])|0)==0){Wn(e);p[(p[d>>2]+20|0)>>2]=0;Bi(c,-1);g=0;break a}}while(0);ym(b,R.Vh|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));g=1}}while(0);return g}function qC(b,c,d){for(var e=BE|0,f=0;;){if((f|0)>=15){var g=0;break}var h=e|0;if((qm(c,p[h>>2])|0)==0){c=p[b>>2];f=Su(b);if((f|0)==0){g=1;break}if((d|0)==0){hC(b,p[h>>2],(p[e+4>>2]&p[c+12>>2]|0)!=0&1,0);g=1;break}b=p[e+4>>2];b=l[c+28|0]<<24>>24==0?b&-67108865:b;(Qo(d)&1)<<24>>24==0?p[(c+12|0)>>2]&=b^-1:p[(c+12|0)>>2]|=b;V(f,129,0,0);g=1;break}else{e=e+8|0,f=f+1|0}}return g}qC.X=1;function Hx(b,c,d,e){if((l[c+34|0]&16)<<24>>24==0){var f=rm(p[b>>2],p[c+68>>2]),g=Su(b);eA(b,d,f,c,e);var c=p[c+16>>2],h=(c|0)==0;a:do{if(h){var i=1}else{for(var j=1,k=c;;){var m=lx(b,k);hw(g,e,j+d|0,p[k+20>>2],f,m,-16);j=j+1|0;k=p[k+32>>2];if((k|0)==0){i=j;break a}}}}while(0);b=b+68|0;d=i+d|0;(p[b>>2]|0)<(d|0)&&(p[b>>2]=d);i=i-1|0}else{i=0}return i}function uC(b,c,d){b=go(b,c,ve(c),2,1,0);(b|0)!=0&&(l[b+3|0]=d)}function ag(b,c){var d=(b|0)==0|(c|0)==0;a:do{if(!d){var e=y[b>>2],f=e+30|0,g=l[f],h=b+c*40|0,i=(c|0)>0;if((p[e+500>>2]|0)==0){b:do{if(i){for(var j=b;;){var k=j+28|0;if((n[k>>1]&9312)<<16>>16==0){var m=j+36|0,o=p[m>>2];(o|0)!=0&&(vf(e,o),p[m>>2]=0)}else{tk(j)}n[k>>1]=128;j=j+40|0;if(j>>>0>=h>>>0){break b}}}}while(0);l[f]=g}else{if(i){for(f=b;;){if(vf(e,p[f+36>>2]),f=f+40|0,f>>>0>=h>>>0){break a}}}}}}while(0)}function Mw(b,c,d,e){var f,g=a;a+=24;f=(b|0)>>2;var c=p[p[p[f]+8>>2]+(c<<4)>>2],h=g|0;Ch(24,h,R.Da|0,(z=a,a+=4,p[z>>2]=1,z));(Im(p[f],h,c)|0)!=0&&xw(b,R.ka|0,(z=a,a+=16,p[z>>2]=c,p[z+4>>2]=h,p[z+8>>2]=d,p[z+12>>2]=e,z));Ch(24,h,R.Da|0,(z=a,a+=4,p[z>>2]=2,z));(Im(p[f],h,c)|0)!=0&&xw(b,R.ka|0,(z=a,a+=16,p[z>>2]=c,p[z+4>>2]=h,p[z+8>>2]=d,p[z+12>>2]=e,z));Ch(24,h,R.Da|0,(z=a,a+=4,p[z>>2]=3,z));(Im(p[f],h,c)|0)!=0&&xw(b,R.ka|0,(z=a,a+=16,p[z>>2]=c,p[z+4>>2]=h,p[z+8>>2]=d,p[z+12>>2]=e,z));a=g}function dC(b,c,d){var e=a,f=Su(b),g=rx(b);gw(f,102,c,g,d);Kx(b);f=p[p[p[b>>2]+8>>2]+(d<<4)>>2];d=(d|0)==1?R.n|0:R.o|0;xw(b,R.hi|0,(z=a,a+=20,p[z>>2]=f,p[z+4>>2]=d,p[z+8>>2]=c,p[z+12>>2]=g,p[z+16>>2]=g,z));sx(b,g);a=e}function aC(b,c,d,e,f,g,h){f>>=2;var i=p[f],j=p[g>>2];if((i|0)<(j|0)){var k=c,m=i,g=5}else{if(e=Il(b,c,((j<<1)+e)*d|0),(e|0)==0){p[h>>2]=-1;var o=c,g=6}else{k=(Dl(b,e)|0)/(d|0)&-1,p[g>>2]=k,k=e,m=p[f],g=5}}g==5&&(Ed(k+m*d|0,0,d),p[h>>2]=p[f],p[f]=p[f]+1|0,o=k);return o}function Cx(b,c,d,e,f){var g=p[b>>2],h=(p[g+12>>2]&1073741824|0)==0;a:do{if(h){var i=0,j=0}else{var k=ZC(p[p[g+8>>2]+28>>2],l[b+446|0],c);if((k|0)==0){j=i=0}else{for(var m=0,o=k;;){if(m=(t[o+8|0]&255|0)==(d|0)?(CE(p[o+16>>2],e)|0)==0?m:t[o+9|0]&255|m:m,o=y[o+32>>2],(o|0)==0){i=m;j=k;break a}}}}}while(0);(f|0)!=0&&(p[f>>2]=i);return(i|0)!=0?j:0}function Dx(b,c,d){var e,f=l[c+34|0];e=(f&16)<<24>>24==0?3:(p[p[p[iw(p[b>>2],c)+4>>2]>>2]+52>>2]|0)==0?6:3;a:do{if(e==3){e=(f&1)<<24>>24==0;do{if(!e&&(p[p[b>>2]+12>>2]&65536|0)==0&&l[b+18|0]<<24>>24==0){e=6;break a}}while(0);if((d|0)!=0){var g=0}else{(p[c+28>>2]|0)==0?g=0:(g=p[c>>2],ym(b,R.Zi|0,(z=a,a+=4,p[z>>2]=g,z)),g=1)}e=10}}while(0);e==6&&(c=p[c>>2],ym(b,R.Yi|0,(z=a,a+=4,p[z>>2]=c,z)),g=1);return g}function Zw(b,c){var d=(c|0)<0?p[b+28>>2]-1|0:c;return l[p[b>>2]+30|0]<<24>>24==0?p[b+4>>2]+d*20|0:DE}function YB(b,c,d,e,f){var g,h,i,j=c>>2,k,m=(d|0)==0;a:do{if(m){var o=0}else{var r=b|0;if((ZC(p[p[p[r>>2]+8>>2]+28>>2],l[b+446|0],c)|0)!=0){o=0}else{if((l[c+34|0]&16)<<24>>24!=0){o=0}else{var q=(e|0)==99;do{if(q){if((p[j+1]|0)>-1&&(o=t[c+35|0],o<<24>>24!=99)){o&=255;break}o=2}else{o=e}}while(0);q=y[d+8>>2];if(n[q>>1]<<16>>16!=1){o=0}else{if((p[q+20>>2]|0)!=0){o=0}else{if((p[d+12>>2]|0)!=0){o=0}else{if((p[d+24>>2]|0)!=0){o=0}else{if((p[d+16>>2]|0)!=0){o=0}else{if((p[d+40>>2]|0)!=0){o=0}else{if((p[d+28>>2]|0)!=0){o=0}else{if((n[d+6>>1]&1)<<16>>16!=0){o=0}else{if(h=p[d>>2],(p[h>>2]|0)!=1){o=0}else{if(l[p[p[h+12>>2]>>2]|0]<<24>>24!=113){o=0}else{var s=xm(b,0,p[q+8>>2],p[q+4>>2]);i=s>>2;if((s|0)==0|(s|0)==(c|0)){o=0}else{if((l[s+34|0]&16)<<24>>24!=0){o=0}else{if((p[i+7]|0)!=0){o=0}else{if(q=p[j+2],(q|0)!=(p[i+2]|0)){o=0}else{if(h=(c+4|0)>>2,(p[h]|0)!=(p[i+1]|0)){o=0}else{g=c+12|0;for(var u=s+12|0,w=0;;){if((w|0)>=(q|0)){break}var v=p[g>>2];k=p[u>>2];if(l[v+w*24+22|0]<<24>>24!=l[k+w*24+22|0]<<24>>24){o=0;break a}if((EE(p[(v+16>>2)+(w*6|0)],p[(k+16>>2)+(w*6|0)])|0)==0){o=0;break a}if(l[v+w*24+20|0]<<24>>24!=0&&l[k+w*24+20|0]<<24>>24==0){o=0;break a}w=w+1|0}u=c+16|0;g=u>>2;q=s+16|0;for(v=0;;){u=p[u>>2];if((u|0)==0){break}w=l[u+24|0]<<24>>24==0?v:1;for(v=q;;){v=p[v>>2];if((v|0)==0){o=0;break a}if((FE(u,v)|0)!=0){break}v=v+32|0}v=w;u=u+32|0}u=p[j+11];if((u|0)!=0&&(wD(p[i+11],u)|0)!=0){o=0}else{if(r=p[r>>2],u=p[r+12>>2],(u&67108864|0)!=0&&(p[j+9]|0)!=0){o=0}else{if((u&4096|0)!=0){o=0}else{r=rm(r,p[i+17]);i=Su(b);ow(b,r);k=b+68|0;u=y[k>>2];w=u+1|0;p[k>>2]=u+2|0;var x=ZB(b,f,c);eA(b,w,f,c,40);var A=(p[h]|0)<0;do{if(A){if((p[g]|0)==0&(v|0)==0){k=45;break}}else{if((v|0)==0){k=45;break}}k=46}while(0);if(k==45){if((o-1|0)>>>0>1){k=46}else{var E=0;k=47}}k==46&&(E=V(i,72,w,0),v=V(i,1,0,0),fw(i,E),E=v);eA(b,u,r,s,39);s=V(i,72,u,0);v=rx(b);k=rx(b);(p[h]|0)>-1?(h=V(i,65,u,k),A=gw(i,54,w,0,k),aE(b,o,R.bc|0,-2),fw(i,A),(x|0)>0&&V(p[b+12>>2],119,x,k),o=h):o=(p[g]|0)==0?V(i,56,w,k):V(i,65,u,k);V(i,64,u,v);gw(i,57,w,v,k);sw(i,11);Dm(i,-1,p[j],0);V(i,95,u,o);o=p[g];h=(o|0)==0;b:do{if(!h){for(g=o;;){for(x=q;;){var J=p[x>>2];if((J|0)==0){break}if((FE(g,J)|0)!=0){break}x=J+32|0}V(i,45,u,0);V(i,45,w,0);x=lx(b,J);hw(i,39,u,p[J+20>>2],r,x,-16);x=lx(b,g);hw(i,40,w,p[g+20>>2],f,x,-16);x=V(i,72,u,0);V(i,63,u,v);gw(i,97,w,v,1);V(i,95,u,x+1|0);fw(i,x);g=p[g+32>>2];if((g|0)==0){break b}}}}while(0);fw(i,s);sx(b,k);sx(b,v);V(i,45,u,0);V(i,45,w,0);(E|0)==0?o=1:(V(i,6,0,0),fw(i,E),V(i,45,w,0),o=0)}}}}}}}}}}}}}}}}}}}}}}while(0);return o}YB.X=1;function ZB(b,c,d){var e,f=(l[d+34|0]&8)<<24>>24==0;a:do{if(f){e=0}else{e=p[b+428>>2];e=(e|0)==0?b:e;for(var g=e+420|0,h=g;;){h=p[h>>2];if((h|0)==0){var i=zh(p[b>>2],16),h=i;if((i|0)==0){e=0;break a}p[i>>2]=p[g>>2];p[g>>2]=h;p[(i+4|0)>>2]=d;p[(i+8|0)>>2]=c;e=(e+72|0)>>2;g=p[e]+2|0;p[e]=g;p[(i+12|0)>>2]=g;p[e]=p[e]+1|0;i=h;break}if((p[h+4>>2]|0)==(d|0)){i=h;break}h|=0}e=p[i+12>>2]}}while(0);return e}ZB.X=1;function $B(b,c,d,e){var f=Su(b),g=p[f+28>>2],b=(l[e+34|0]&16)<<24>>24==0?0:iw(p[b>>2],e),h=e+20|0,e=e+16|0,i=c;a:for(;;){if((i|0)>=(g|0)){var j=0;break}var k=Zw(f,i),c=k>>2,k=l[k|0];b:do{if(k<<24>>24==39){if((p[c+3]|0)==(d|0)){var m=p[c+2];if((m|0)==(p[h>>2]|0)){j=1;break a}for(var o=e;;){o=p[o>>2];if((o|0)==0){break b}if((m|0)==(p[o+20>>2]|0)){j=1;break a}o=o+32|0}}}else{if(k<<24>>24==-121&&(p[c+4]|0)==(b|0)){j=1;break a}}}while(0);i=i+1|0}return j}$B.X=1;function qB(b,c){var d,e=c+40|0,f=p[e>>2],g=(f|0)==0;do{if(g){var h=p[b>>2];d=(c+8|0)>>2;var i=zh(0,p[d]+1|0);if((i|0)==0){l[h+30|0]=1,d=9}else{var j=p[d],h=(j|0)>0;a:do{if(h){for(var k=c+12|0,m=0;;){l[i+m|0]=l[p[k>>2]+m*24+22|0];var m=m+1|0,o=p[d];if((m|0)>=(o|0)){var r=o;break a}}}else{r=j}}while(0);l[i+r|0]=0;j=p[e>>2]=i;d=8}}else{j=f,d=8}}while(0);d==8&&Dm(b,-1,j,0)}function rB(b,c,d,e,f,g,h,i,j){var k=(c|0)==0;a:do{if(!k){for(var m=c;;){if((t[m+8|0]&255|0)==(d|0)&&(t[m+9|0]&255|0)==(f|0)&&(CE(p[m+16>>2],e)|0)!=0&&GE(b,m,g,h,i,j),m=y[m+32>>2],(m|0)==0){break a}}}}while(0)}function Jx(b,c){var d,e;e=p[b+428>>2];var f=(e|0)==0?b:e;e=(f+528|0)>>2;var g=p[e];d=(f+532|0)>>2;for(var h=0;;){if((h|0)<(g|0)){if((p[p[d]+(h<<2)>>2]|0)==(c|0)){break}h=h+1|0}else{g=dh(p[d],(g<<2)+4|0);if((g|0)==0){l[p[f>>2]+30|0]=1;break}f=g;p[d]=f;d=p[e];p[e]=d+1|0;p[((d<<2)+f|0)>>2]=c;break}}}function QB(b,c,d,e,f,g,h,i,j,k){var m,o,r=a;a+=28;var q,s=(g|0)!=0,u=(h|0)==0|s^1?e:g,w=Su(b),v=y[c+8>>2],x=e+1|0,A=(v|0)>0;a:do{if(A){var E=c+4|0;o=(c+12|0)>>2;m=(i|0)==99;for(var J=b|0,M=c|0,D=0;;){var K=(D|0)==(p[E>>2]|0);b:do{if(!K){var H=y[o];q=t[H+D*24+20|0];var N=q&255;if(q<<24>>24!=0){if(m){if(q<<24>>24==99){q=9}else{var Q=N;q=7}}else{Q=i,q=7}do{if(q==7){if((Q|0)==5){if((p[(H+4>>2)+(D*6|0)]|0)==0){q=9;break}}else{if((Q|0)==2){q=9;break}else{if((Q|0)==1||(Q|0)==3){var P=Q;q=10;break}else{if((Q|0)==4){V(w,73,D+x|0,j);break b}}}}q=D+x|0;K=qw(w,74,q);ux(b,p[(p[o]+4>>2)+(D*6|0)],q);fw(w,K);break b}}while(0);q==9&&(Kx(b),P=2);gw(w,5,19,P,D+x|0);q=p[M>>2];H=p[(p[o]>>2)+(D*6|0)];q=zm(p[J>>2],R.Pi|0,(z=a,a+=8,p[z>>2]=q,p[z+4>>2]=H,z));Dm(w,-1,q,-1)}}}while(0);D=D+1|0;if((D|0)==(v|0)){break a}}}}while(0);v=c+44|0;if((p[v>>2]|0)!=0&&(p[p[b>>2]+12>>2]&262144|0)==0){o=Xw(w);p[b+84>>2]=x;wE(b,p[v>>2],o,8);v=(i|0)!=99?i:2;if((v|0)==4){V(w,1,0,j),q=20}else{var L=(v|0)==5?2:v;q=19}q==19&&aE(b,L,0,0);wx(w,o)}do{if(s){L=t[c+35|0];A=(i|0)==99?L<<24>>24!=99?L&255:2:i;o=(L=(h|0)!=0)?gw(w,76,e,0,g):0;v=gw(w,54,d,0,e);a:do{if((A|0)==1||(A|0)==2||(A|0)==3){var I=A;q=29}else{if((A|0)==5){var X=b|0,E=p[p[X>>2]+12>>2];if((E&33554432|0)==0){da=E,q=33}else{if(E=Cx(b,c,106,0,0),(E|0)!=0){var Y=E;q=34}else{var da=p[p[X>>2]+12>>2];q=33}}do{if(q==33){if((Gx(da,c,0,0)|0)!=0){Y=0}else{X=c+16|0;if((p[X>>2]|0)==0){X=1;q=38;break a}HE(b);UB(b,p[X>>2],d,0);X=1;q=38;break a}}}while(0);HE(b);Ix(b,c,d,e,0,Y,5);X=1;q=38}else{(A|0)==4?(V(w,1,0,j),X=0,q=38):(I=2,q=29)}}}while(0);q==29&&(aE(b,I,R.bc|0,-2),X=0);fw(w,v);L&&fw(w,o);L=X}else{L=0}}while(0);g=p[c+16>>2];h=(g|0)==0;a:do{if(h){var ga=L}else{s=(i|0)==99;I=d+1|0;Y=b|0;da=r|0;X=c+12|0;o=c+4|0;v=0;E=L;for(A=g;;){J=(v<<2)+f|0;if((p[J>>2]|0)!=0){m=(A+4|0)>>2;Q=ox(b,p[m]+1|0);M=(p[m]|0)>0;b:do{if(M){P=A+8|0;for(D=0;;){if(q=p[p[P>>2]+(D<<2)>>2],(q|0)==(p[o>>2]|0)?V(w,15,e,D+Q|0):V(w,15,q+x|0,D+Q|0),D=D+1|0,(D|0)>=(p[m]|0)){var ha=D;break b}}}else{ha=0}}while(0);V(w,15,e,ha+Q|0);gw(w,31,Q,p[m]+1|0,p[J>>2]);J=bE(w,A);Dm(w,-1,J,0);cE(b,Q,p[m]+1|0);J=t[A+24|0];M=J&255;if(J<<24>>24==0){tx(b,Q,p[m]+1|0)}else{J=s?J<<24>>24!=99?M:2:i;P=(E|0)==0?J:(J|0)==4?5:(J|0)!=3?J:2;J=rx(b);V(w,15,u,J);M=hw(w,53,I+v|0,0,J,Q,-14);tx(b,Q,p[m]+1|0);if((P|0)==1||(P|0)==2||(P|0)==3){Zg(r,0,0,200);p[da>>2]=p[Y>>2];Q=p[m];D=(Q|0)>0;b:do{if(D){q=A+8|0;K=0;for(H=(Q|0)>1?R.Qi|0:R.Ri|0;;){N=p[(p[X>>2]>>2)+(p[p[q>>2]+(K<<2)>>2]*6|0)];uh(r,H,-1);uh(r,N,-1);K=K+1|0;H=p[m];if((K|0)>=(H|0)){var ba=H;break b}H=R.Ti|0}}else{ba=Q}}while(0);uh(r,(ba|0)>1?R.Ui|0:R.Vi|0,-1);m=th(r);aE(b,P,m,0);vf(p[da>>2],m)}else{(P|0)==4?V(w,1,0,j):(HE(b),E=(p[p[Y>>2]+12>>2]&33554432|0)==0?0:Cx(b,c,106,0,0),Ix(b,c,d,J,0,E,5),E=1)}fw(w,M);sx(b,J)}}A=y[A+32>>2];if((A|0)==0){ga=E;break a}v=v+1|0}}}while(0);(k|0)!=0&&(p[k>>2]=ga);a=r}QB.X=1;function TB(b,c,d,e){var f,g,h,i,j,k,m,o=a;a+=20;m=o>>2;var r=o+4;k=r>>2;var q=o+8,s=o+12;j=s>>2;var u=o+16;i=u>>2;var w=y[b>>2],v=b+446|0,x=(p[w+12>>2]&67108864|0)==0;a:do{if(!x){var A=c+68|0,E=rm(w,p[A>>2]),J=p[p[w+8>>2]+(E<<4)>>2],M=l[v]<<24>>24==0,D=w+30|0,K=d+1|0,H=c+4|0,N=w+268|0;h=(b+68|0)>>2;var Q=(d|0)==0,P=(e|0)==0;for(g=c+36|0;;){var L=y[g>>2];g=L>>2;if((L|0)==0){break}p[m]=0;p[k]=0;var I=p[g+2],X=l[v]<<24>>24==0?xm(b,0,I,J):Im(w,I,J),I=(X|0)==0;do{if(I){f=9}else{if((IE(b,X,L,o,r)|0)!=0){f=9}else{f=y[k];if((f|0)==0){p[q>>2]=p[g+9];var Y=q}else{Y=f}f=(L+20|0)>>2;var da=(p[f]|0)>0;b:do{if(da){var ga=p[m],ha=X+4|0,ba=X+12|0,ea=X|0,ja=ga+8|0;if((ga|0)==0){for(ga=ja=0;;){var ra=(ja<<2)+Y|0;(p[ra>>2]|0)==(p[H>>2]|0)&&(p[ra>>2]=-1);ga=(p[N>>2]|0)==0?ga:(DD(b,p[ea>>2],p[(p[ba>>2]>>2)+(p[ha>>2]*6|0)],E)|0)==2&1;ja=ja+1|0;if((ja|0)>=(p[f]|0)){var Va=ga,ta=ea;break b}}}else{for(ga=ha=0;;){if(ra=(ha<<2)+Y|0,(p[ra>>2]|0)==(p[H>>2]|0)&&(p[ra>>2]=-1),ga=(p[N>>2]|0)==0?ga:(DD(b,p[ea>>2],p[(p[ba>>2]>>2)+(p[p[ja>>2]+(ha<<2)>>2]*6|0)],E)|0)==2&1,ha=ha+1|0,(ha|0)>=(p[f]|0)){Va=ga;ta=ea;break b}}}}else{Va=0,ta=X|0}}while(0);kx(b,E,p[X+20>>2],0,p[ta>>2]);p[h]=p[h]+1|0;Q||JE(b,E,X,p[m],L,Y,d,-1,Va);P||JE(b,E,X,p[m],L,Y,e,1,Va);vf(w,p[k]);f=35}}}while(0);do{if(f==9){if(M){break a}if(l[D]<<24>>24!=0){break a}if(I){X=Su(b);Y=L+20|0;ba=p[Y>>2];da=ba+(p[X+28>>2]+1)|0;ba=(ba|0)>0;b:do{if(ba){for(ea=0;;){if(V(X,73,K+p[((ea<<3)+36>>2)+g]|0,da),ea=ea+1|0,(ea|0)>=(p[Y>>2]|0)){break b}}}}while(0);V(X,117,t[L+24|0]&255,-1)}}}while(0);g=L+4|0}E=b+428|0;J=b+348|0;for(A=PC(p[c>>2],p[A>>2]);;){if((A|0)==0){break a}p[j]=0;p[i]=0;f=l[A+24|0]<<24>>24==0?(p[E>>2]|0)!=0?41:l[J]<<24>>24==0?51:41:41;if(f==41){if((IE(b,c,A,s,u)|0)==0){K=sv(w,0,0,0),(K|0)!=0&&(N=A|0,g=p[N>>2],p[K+16>>2]=g,H=K+8|0,p[H>>2]=p[p[N>>2]>>2],N=g+32|0,n[N>>1]=n[N>>1]+1&65535,N=p[h],p[h]=N+1|0,p[K+36>>2]=N,P||KE(b,K,c,p[j],A,p[i],e,-1),Q||KE(b,K,c,p[j],A,p[i],d,1),p[H>>2]=0,Mu(w,K)),vf(w,p[i])}else{if(M){break a}if(l[D]<<24>>24!=0){break a}}}A=p[A+12>>2]}}}while(0);a=o}TB.X=1;function VB(b,c,d,e,f,g,h,i){var j=Su(b),k=p[c+16>>2],m=(k|0)==0;a:do{if(!m){for(var o=0,r=k;;){var q=o+1|0,r=p[r+32>>2];if((r|0)==0){break}o=q}if((q|0)>0){if((i|0)==0){for(r=q;;){var s=p[f+(o<<2)>>2];(s|0)!=0&&V(j,97,r+d|0,s);if((o|0)<=0){break a}r=o;o=o-1|0}}else{for(r=q;;){s=p[f+(o<<2)>>2];(s|0)!=0&&(V(j,97,r+d|0,s),sw(j,16));if((o|0)<=0){break a}r=o;o=o-1|0}}}}}while(0);k=e+1|0;f=rx(b);m=c+8|0;gw(j,31,k,p[m>>2],f);qB(j,c);cE(b,k,p[m>>2]);b=b+18|0;g=l[b]<<24>>24==0?(g|0)!=0?5:3:0;h=(h|0)==0?g:g|8;i=(i|0)==0?h:h|16;gw(j,57,d,f,e);l[b]<<24>>24==0&&Dm(j,-1,p[c>>2],0);sw(j,i)}VB.X=1;function Lx(b){var c=p[b+12>>2],d=p[b+420>>2],e=(d|0)==0;a:do{if(!e){for(var f=p[b>>2]+8|0,g=d;;){var h=g+8|0,i=p[h>>2],j=p[f>>2],k=p[g+12>>2],m=rx(b);eA(b,0,p[h>>2],p[p[j+(i<<4)+12>>2]+72>>2],40);var h=k+1|0,i=qw(c,74,h),j=ew(c,72),o=gw(c,29,0,0,m),k=k-1|0,r=gw(c,76,k,0,m);V(c,95,0,o);fw(c,j);V(c,56,0,h);j=ew(c,1);fw(c,r);V(c,65,0,h);fw(c,i);fw(c,j);gw(c,31,k,2,m);gw(c,57,0,m,h);sw(c,8);ew(c,45);sx(b,m);g=p[g>>2];if((g|0)==0){break a}}}}while(0)}function IE(b,c,d,e,f){d>>=2;var g=p[d+5],h=p[d+10];if((g|0)==1){f=p[c+4>>2],(f|0)>-1?(h|0)==0?(k=0,f=33):(qm(p[(p[c+12>>2]>>2)+(f*6|0)],h)|0)==0?(k=0,f=33):(i=0,f=8):(i=0,f=8)}else{if((f|0)==0){var i=0,f=8}else{var j=zh(p[b>>2],g<<2);if((j|0)==0){var k=1,f=33}else{i=p[f>>2]=j,f=8}}}a:do{if(f==8){var j=(h|0)==0,m=c+12|0,k=(i|0)==0,o=c+16|0;b:for(;;){var r=p[o>>2];if((r|0)==0){l[b+446|0]<<24>>24==0&&ym(b,R.Oi|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));vf(p[b>>2],i);k=1;break a}o=(p[r+4>>2]|0)==(g|0);do{if(o&&l[r+24|0]<<24>>24!=0){if(j){if(l[r+25|0]<<24>>24==2){f=15;break b}}else{for(var q=r+8|0,s=r+44|0,u=0;;){if((u|0)>=(g|0)){break}var w=p[p[q>>2]+(u<<2)>>2],v=p[m>>2],x=p[(v+16>>2)+(w*6|0)];if((qm(p[p[s>>2]+(u<<2)>>2],(x|0)==0?R.w|0:x)|0)!=0){break}w=p[(v>>2)+(w*6|0)];for(v=0;;){if((v|0)>=(g|0)){break}if((qm(p[((v<<3)+40>>2)+d],w)|0)==0){if(k){break}p[i+(u<<2)>>2]=p[((v<<3)+36>>2)+d];break}v=v+1|0}if((v|0)==(g|0)){break}u=u+1|0}if((u|0)==(g|0)){f=32;break b}}}}while(0);o=r+32|0}b:do{if(f==15&&(g|0)>0&(k^1)){for(j=0;;){if(p[i+(j<<2)>>2]=p[((j<<3)+36>>2)+d],j=j+1|0,(j|0)==(g|0)){break b}}}}while(0);p[e>>2]=r;k=0}}while(0);return k}IE.X=1;function JE(b,c,d,e,f,g,h,i,j){var k=Su(b),m=p[b+68>>2]-1|0,o=Xw(k);(i|0)<0&&V(k,118,t[f+24|0]&255,o);var r=f+20|0,q=y[r>>2],s=(q|0)>0;a:do{if(s){for(var u=h+1|0,w=0;;){V(k,73,u+p[g+(w<<2)>>2]|0,o);var w=w+1|0,v=p[r>>2];if((w|0)>=(v|0)){var x=v;break a}}}else{x=q}}while(0);if((j|0)==0){if((e|0)==0){x=rx(b),V(k,15,h+p[g>>2]+1|0,x),g=V(k,21,x,0),(p[f>>2]|0)==(d|0)&(i|0)==1&&gw(k,76,h,o,x),eA(b,m,c,d,39),gw(k,54,m,0,x),V(k,1,0,o),fw(k,p[k+28>>2]-2|0),fw(k,g),sx(b,x)}else{j=ox(b,x);r=rx(b);q=lx(b,e);gw(k,39,m,p[e+20>>2],c);Dm(k,-1,q,-16);c=(x|0)>0;a:do{if(c){q=h+1|0;for(s=0;;){if(V(k,14,q+p[g+(s<<2)>>2]|0,s+j|0),s=s+1|0,(s|0)==(x|0)){break a}}}}while(0);if((p[f>>2]|0)==(d|0)&(i|0)==1){q=p[k+28>>2]+(x+1)|0;a:do{if(c){s=h+1|0;u=e+8|0;w=d+4|0;for(v=0;;){var A=p[p[u>>2]+(v<<2)>>2];gw(k,75,s+p[g+(v<<2)>>2]|0,q,((A|0)==(p[w>>2]|0)?0:A+1|0)+h|0);sw(k,8);v=v+1|0;if((v|0)==(x|0)){break a}}}}while(0);V(k,1,0,o)}gw(k,31,j,x,r);d=bE(k,e);Dm(k,-1,d,0);zC(k,52,m,o,r,0);sx(b,r);tx(b,j,x)}}f=f+24|0;d=l[f];h=d<<24>>24==0;a:do{if(h){g=p[b+428>>2];x=(g|0)==0;do{if(x&&l[b+348|0]<<24>>24==0){aE(b,2,R.ma|0,-2);g=27;break a}}while(0);if((i|0)<1){var E=d}else{l[(x?b:g)+349|0]=1,E=l[f]}}else{E=d}g=26}while(0);g==26&&V(k,117,E&255,i);wx(k,o);qw(k,45,m)}JE.X=1;function KE(b,c,d,e,f,g,h,i){var j,k=a;a+=36;var m=y[b>>2],o=Su(b),r=(i|0)<0?V(o,118,t[f+24|0]&255,0):0,q=f+20|0,s=(p[q>>2]|0)>0;a:do{if(s){for(var u=(g|0)==0,w=f+36|0,v=f|0,x=(e|0)==0,A=e+8|0,E=d+12|0,J=d+4|0,M=h+1|0,D=0,K=0;;){var H=ov(m,132,0);j=H>>2;if((H|0)!=0){if(x){p[j+6]=h,l[H+1|0]=100}else{var N=p[p[A>>2]+(D<<2)>>2],Q=p[E>>2];p[j+6]=M+((p[J>>2]|0)==(N|0)?-1:N)|0;l[H+1|0]=l[Q+N*24+22|0];N=gv(b,p[(Q+16>>2)+(N*6|0)]);p[j+5]=N}}j=ov(m,26,p[(p[p[v>>2]+12>>2]>>2)+(p[(u?w:(D<<2)+g|0)>>2]*6|0)]);H=$u(b,76,H,j,0);K=Jw(m,K,H);D=D+1|0;if((D|0)>=(p[q>>2]|0)){var P=K,L=v;break a}}}else{P=0,L=f|0}}while(0);e=(i|0)>0;(p[L>>2]|0)==(d|0)&e&&(d=ov(m,132,0),L=ov(m,152,0),(d|0)==0|(L|0)==0||(p[d+24>>2]=h,l[d+1|0]=100,p[L+24>>2]=p[c+36>>2],n[L+28>>1]=-1),h=$u(b,75,d,L,0),P=Jw(m,P,h));h=k>>2;for(d=h+9;h<d;h++){p[h]=0}p[k+4>>2]=c;p[k>>2]=b;tw(k,P);c=$w(b,c,P,0,0,0);f=f+24|0;e&&l[f]<<24>>24==0&&(h=p[b+428>>2],l[((h|0)==0?b:h)+349|0]=1);V(o,117,t[f]&255,i);(c|0)!=0&&dx(c);Df(m,P);(r|0)!=0&&fw(o,r);a=k}KE.X=1;function $w(b,c,d,e,f,g){var h,i,j,k,m,o,r,q,s,u,w,v,x=c>>2,A=a;a+=36;var E=y[b+12>>2];v=(c|0)>>1;var J=n[v],M=J<<16>>16>64;a:do{if(M){ym(b,R.pi|0,(z=a,a+=4,p[z>>2]=64,z));var D=0}else{var K=g&65535,H=(K&64|0)==0?J<<16>>16:1,N=y[b>>2],Q=H-1|0,P=Q*72+131&-8,L=ni(N,P+616|0);w=L>>2;var I=L,X=N+30|0;if(l[X]<<24>>24==0){p[w+7]=H;p[w]=b;p[w+3]=c;var Y=Xw(E),da=L+24|0;p[da>>2]=Y;var ga=L+P|0;p[w+8]=ga;n[(L+4|0)>>1]=g;u=(b+448|0)>>2;var ha=(C[0]=p[u],C[1]=p[u+1],xd[0]);s=(L+36|0)>>2;xd[0]=ha;p[s]=C[0];p[s+1]=C[1];var ba=P+(L+356)|0,ea=ba,ja=(p[N+12>>2]&128|0)==0?f:0;Ed(ba,0,260);LE(ga,b,ea,g);var ra=b,Va=d,ta=fa,xa=a;a+=16;ta=xa>>2;(p[ra+352>>2]|0)==0&&(p[p[ra>>2]+12>>2]&64|0)==0&&(p[ta]=56,p[ta+1]=0,p[ta+2]=ra,mD(xa,Va));a=xa;ME(ga,d,69);if((d|0)==0){var Fa=0}else{(H|0)!=0&&(Aw(d,3)|0)==0?Fa=d:(mx(b,d,p[da>>2],8),Fa=0)}var Na=n[v]<<16>>16>0;b:do{if(Na){q=(P+(L+8)|0)>>2;for(var Ea=0;;){var La=ea,za=p[x+(Ea*15|0)+9],Ba=La|0,Ja=p[Ba>>2];p[Ba>>2]=Ja+1|0;p[((Ja<<2)+La+4|0)>>2]=za;var ka=p[x+(Ea*15|0)+4];if((ka|0)!=0&&(l[ka+34|0]&16)<<24>>24!=0){var S=nc(1,0,"shl",Ea),ib=p[q+1]|S[1];p[q]|=S[0];p[q+1]=ib}var Wa=Ea+1|0;if((Wa|0)>=(n[v]<<16>>16|0)){break b}Ea=Wa}}}while(0);NE(ga);var Za=l[X]<<24>>24==0;b:do{if(Za){if((ja|0)==0){var Sa=0}else{(OE(b,c,ga,ja)|0)==0?Sa=ja:(l[L+8|0]=1,Sa=0)}var tb=L+52|0,pb=tb,fb=tb,Xa=(e|0)==0;r=(A|0)>>2;var Ab=A+28|0,rb=A+4|0;o=(A+8|0)>>2;var cb=A+16|0,Cb=A+20|0,Zb=b+68|0,dc=L+8|0,kb=0,Oa=-1,Db=-1,Wb=-1,Nb=0,$b=fb;for(m=$b>>2;;){if((kb|0)>=(H|0)){break}for(var Rb=(kb|0)==0,Ra=Xa|Rb^1,Ob=Rb?Sa:0,Ua=1e+99,Jb=0,Vb=0,Pb=0,sb=0,db=Nb,wb=-1,ob=(Nb|0)<(Q|0)&1,Kb=0,ub=0,Xb=0;;){for(var Sb=(ob|0)!=0,Qb=ub,ac=Xb,Gb=Kb,xb=wb,Ta=db,qb=db,bc=c+db*60+4|0,$a=sb,mb=Pb,Bb=Vb,bb=Jb,jb=Ua;;){if((Ta|0)>=(H|0)){var nb=Qb,zb=ac,Tb=Gb,ec=xb,Hb=$a,Eb=mb,Lb=Bb,gb=bb,Mb=jb;break}var vc=(l[bc+28|0]&10)<<24>>24!=0,hc=(Ta|0)==(qb|0);if(!(hc|vc^1)){nb=Qb;zb=ac;Tb=Gb;ec=xb;Hb=$a;Eb=mb;Lb=Bb;gb=bb;Mb=jb;break}var kc=PE(ea,p[bc+32>>2]),pc=kc[0],jc=kc[1];if((pc&Db)==0&&(jc&Oa)==0){var mc=Qb,Fb=ac,Ub=Gb,Ya=xb,Pa=(hc&1)+qb|0,yb=$a,Ka=mb,Ac=Bb,Jc=bb,uc=jb}else{var Tc=Sb?pc:Db,Yc=Sb?jc:Oa,ua=Ra?0:p[e>>2],md=bc+56|0,nd=((p[md>>2]|0)==0&1)+Gb|0;(l[p[bc+12>>2]+34|0]&16)<<24>>24==0?QE(b,ga,bc,Tc,Yc,Db,Oa,ua,Ob,A):RE(b,ga,bc,Tc,Yc,Db,Oa,ua,A,pb+Ta*72+68|0);if(Sb){var Bc=(p[r]&269430784|0)==0,Qc=(Bc?jc:0)|Qb,Oc=(Bc?pc:0)|ac}else{Qc=Qb,Oc=ac}var ed=(p[Ab>>2]&Db)==0&&(p[Ab+4>>2]&Oa)==0;c:do{if(ed){var Fc=(xb|0)<0;do{if(!Fc&&(Oc&pc)==0&&(Qc&jc)==0&&($a&269430784|0)!=0&&(p[r]&269430784|0)==0){var ud=xb,Rc=$a,Yb=mb,W=Bb,bd=bb,hd=jb;break c}}while(0);var eb=(nd|0)==0;do{if(!eb&&(p[md>>2]|0)!=0&&(p[r]&269430784|0)==0){ud=xb;Rc=$a;Yb=mb;W=Bb;bd=bb;hd=jb;break c}}while(0);var Uc=(C[0]=p[Cb>>2],C[1]=p[Cb+4>>2],xd[0]);if(Fc|Uc<jb){var cd=(C[0]=p[o],C[1]=p[o+1],xd[0])}else{if(Uc>jb){ud=xb;Rc=$a;Yb=mb;W=Bb;bd=bb;hd=jb;break}var vd=(C[0]=p[o],C[1]=p[o+1],xd[0]);if(vd>=Bb){ud=xb;Rc=$a;Yb=mb;W=Bb;bd=bb;hd=jb;break}cd=vd}ud=Ta;Rc=p[r];Yb=p[rb>>2];W=cd;bd=p[cb>>2];hd=Uc}else{ud=xb,Rc=$a,Yb=mb,W=Bb,bd=bb,hd=jb}}while(0);if(vc){nb=Qc;zb=Oc;Tb=nd;ec=ud;Hb=Rc;Eb=Yb;Lb=W;gb=bd;Mb=hd;break}mc=Qc;Fb=Oc;Ub=nd;Ya=ud;Pa=qb;yb=Rc;Ka=Yb;Ac=W;Jc=bd;uc=hd}Qb=mc;ac=Fb;Gb=Ub;xb=Ya;Ta=Ta+1|0;qb=Pa;bc=bc+60|0;$a=yb;mb=Ka;Bb=Ac;bb=Jc;jb=uc}if(!((ob|0)>0&(ec|0)<0)){break}Ua=Mb;Jb=gb;Vb=Lb;Pb=Eb;sb=Hb;db=qb;wb=ec;ob=ob-1|0;Kb=Tb;ub=nb;Xb=zb}(Hb&16777216|0)==0|Xa||(p[e>>2]=0);(Hb&1073741824|0)!=0&&(l[dc]=2);var id=Hb&Wb;p[m]=Hb;p[m+1]=Eb;var Zc=$b+8|0;xd[0]=Lb;p[Zc>>2]=C[0];p[Zc+4>>2]=C[1];p[m+4]=gb;if((Hb&537853952|0)==0){p[m+7]=-1}else{var td=p[Zb>>2];p[Zb>>2]=td+1|0;p[m+7]=td}var zd=PE(ea,p[x+(ec*15|0)+9]),Id=Db&(zd[0]^-1),xc=Oa&(zd[1]^-1);l[$b+48|0]=ec&255;if(Lb>=1){var qc=(C[0]=p[u],C[1]=p[u+1],xd[0])*Lb;xd[0]=qc;p[u]=C[0];p[u+1]=C[1]}var Gc=p[x+(ec*15|0)+15],Hc=(Gc|0)==0;do{if(!Hc&&(Hb&983040|0)==0){var zc=p[Gc>>2];ym(b,R.ri|0,(z=a,a+=4,p[z>>2]=zc,z));break b}}while(0);kb=kb+1|0;Oa=xc;Db=Id;Wb=id;Nb=qb;$b=$b+72|0;m=$b>>2}if((p[b+64>>2]|0)==0&&l[X]<<24>>24==0){var Kc=(Wb&67108864|0)==0;Kc|Xa||(p[e>>2]=0);(K&4|0)==0|Kc||(l[L+6|0]=1,p[tb>>2]&=-8388609);ow(b,-1);k=(L+44|0)>>2;xd[0]=1;p[k]=C[0];p[k+1]=C[1];var wd=(H|0)>0;c:do{if(wd){var be=K&16,ge=L+6|0,Xd=E+28|0,rc=L+(P|4)|0,Lc=fb;j=Lc>>2;for(var Jd=-1,Qd=-1,Fd=0;;){var Cd=t[Lc+48|0]&255,ce=c+Cd*60+4|0,Yd=y[x+(Cd*15|0)+4];i=Yd>>2;h=(c+Cd*60+36|0)>>2;p[j+6]=p[h];var Mc=Lc+8|0,jd=(C[0]=p[Mc>>2],C[1]=p[Mc+4>>2],xd[0]),gc=(C[0]=p[k],C[1]=p[k+1],xd[0])*jd;xd[0]=gc;p[k]=C[0];p[k+1]=C[1];var fd=rm(N,p[i+17]),Sd=(l[Yd+34|0]&2)<<24>>24==0;do{if(Sd&&(p[i+7]|0)==0){var $c=p[j];if(($c&134217728|0)==0){if(($c&8388608|be|0)==0){if(eA(b,p[h],fd,Yd,l[ge]<<24>>24!=0?40:39),l[ge]<<24>>24==0&&(p[i+2]|0)<64){var Ad=c+Cd*60+48|0,Xe=p[Ad>>2],ef=p[Ad+4>>2];if(Xe==0&&ef==0){var oe=0}else{for(var wf=ef,Kd=Xe,ue=0;;){var xf=Kd>>>1|wf<<31,Ge=wf>>>1|0,yf=ue+1|0;if(xf==0&&Ge==0){break}wf=Ge;Kd=xf;ue=yf}oe=yf}Dm(E,p[Xd>>2]-1|0,oe,-14)}}else{kx(b,fd,p[i+5],0,p[i])}}else{hw(E,135,p[h],0,0,iw(N,Yd),-10)}}}while(0);var Re=p[j];if((Re&536870912|0)==0){if((Re&983040|0)!=0){var Se=p[j+4],tc=lx(b,Se);hw(E,39,p[j+7],p[Se+20>>2],fd,tc,-16)}}else{SE(b,ga,ce,Qd,Jd,Lc)}ow(b,fd);var ff=PE(p[rc>>2],p[h]),he=Fd+1|0;if((he|0)==(H|0)){var je=Xd;break c}Lc=Lc+72|0;j=Lc>>2;Jd&=ff[1]^-1;Qd&=ff[0]^-1;Fd=he}}else{je=E+28|0}}while(0);p[w+4]=p[je>>2];if(l[X]<<24>>24==0){if(!wd){D=I;break a}for(var de=L+20|0,Me=-1,od=-1,ke=0;;){TE(b,c,pb+ke*72|0,ke,t[pb+ke*72+48|0]&255,g);var Zd=UE(I,ke,g,od,Me,Fa),le=Zd[0],ye=Zd[1];p[de>>2]=p[(pb+40>>2)+(ke*18|0)];var zf=ke+1|0;if((zf|0)==(H|0)){D=I;break a}Me=ye;od=le;ke=zf}}}}}while(0);if((L|0)==0){D=0;break}var Ye=(C[0]=p[s],C[1]=p[s+1],xd[0]);xd[0]=Ye;p[u]=C[0];p[u+1]=C[1];VE(N,I)}else{vf(N,L)}D=0}}while(0);a=A;return D}$w.X=1;function LE(b,c,d,e){p[b>>2]=c;p[b+4>>2]=d;p[b+16>>2]=0;p[b+24>>2]=0;p[b+28>>2]=8;p[b+32>>2]=b+36|0;c=b+8|0;p[c>>2]=0;p[c+4>>2]=0;n[b+22>>1]=e}function PE(b,c){for(var d=p[b>>2],e=0;;){if((e|0)>=(d|0)){var f=0,g=0;break}if((p[b+(e<<2)+4>>2]|0)==(c|0)){d=nc(1,0,"shl",e);f=d[1];g=d[0];break}e=e+1|0}return[g,f]}function dx(b){var c,d,e,f,g;d=b>>2;var h=y[d],i=y[h+12>>2];g=y[d+3]>>2;var j=y[h>>2];px(h);f=(b+28|0)>>2;var k=p[f],m=(k|0)>0;a:do{if(m){for(var o=k;;){o=o-1|0;wx(i,p[d+(o*18|0)+23]);var r=b+o*72+101|0,q=t[r];q<<24>>24!=-107&&(V(i,q&255,p[d+(o*18|0)+26],p[d+(o*18|0)+27]),sw(i,l[b+o*72+102|0]));var q=b+o*72+52|0,s=(p[q>>2]&987136|0)==0;do{if(!s){var u=b+o*72+112|0;if((p[u>>2]|0)>0){wx(i,p[d+(o*18|0)+22]);var u=p[u>>2],w=b+o*72+116|0,v=(u|0)>0;b:do{if(v){for(var x=(u-1<<3)+p[w>>2]|0,A=u;;){e=(x+4|0)>>2;fw(i,p[e]+1|0);V(i,95,p[x>>2],p[e]);fw(i,p[e]-1|0);e=A-1|0;if((e|0)<=0){break b}x=x-8|0;A=e}}}while(0);vf(j,p[w>>2])}}}while(0);wx(i,p[d+(o*18|0)+21]);s=p[d+(o*18|0)+18];(s|0)!=0&&(s=qw(i,120,s),(p[q>>2]&8388608|0)==0&&qw(i,66,p[g+(o*15|0)+9]),q=p[d+(o*18|0)+20],(q|0)>-1&&qw(i,66,q),l[r]<<24>>24==3?V(i,2,p[d+(o*18|0)+26],p[d+(o*18|0)+24]):V(i,1,0,p[d+(o*18|0)+24]),fw(i,s));if((o|0)<=0){break a}}}}while(0);wx(i,p[d+6]);k=(p[f]|0)>0;a:do{if(k){m=b+4|0;o=b+6|0;r=j+30|0;q=b+16|0;s=i+28|0;u=b+52|0;d=u>>2;for(w=0;;){v=t[u+48|0]&255;x=y[g+(v*15|0)+4];(l[x+34|0]&2)<<24>>24==0&&(p[x+28>>2]|0)==0&&(n[m>>1]&16)<<16>>16==0&&(x=p[d],l[o]<<24>>24==0&&(x&8388608|0)==0&&qw(i,45,p[g+(v*15|0)+9]),(x&983040|0)!=0&(x&536870912|0)==0&&qw(i,45,p[d+7]));v=(p[d]&983040|0)==0;b:do{if(!v&&l[r]<<24>>24==0){var E=p[d+4],J=p[q>>2],x=p[s>>2];if((J|0)<(x|0)){e=u+24|0;for(var A=u+28|0,M=E+4|0,E=E+8|0,D=J,J=Zw(i,J);;){c=(J+4|0)>>2;var K=(p[c]|0)==(p[e>>2]|0);c:do{if(K){var H=J|0,N=l[H];if(N<<24>>24==29){for(var H=p[M>>2],N=J+8|0,Q=0;;){if((Q|0)>=(H|0)){break c}if((p[N>>2]|0)==(p[p[E>>2]+(Q<<2)>>2]|0)){break}Q=Q+1|0}p[N>>2]=Q;p[c]=p[A>>2]}else{N<<24>>24==65&&(p[c]=p[A>>2],l[H]=99)}}}while(0);D=D+1|0;if((D|0)==(x|0)){break b}J=J+20|0}}}}while(0);w=w+1|0;if((w|0)>=(p[f]|0)){break a}u=u+72|0;d=u>>2}}}while(0);f=b+36|0;f=(C[0]=p[f>>2],C[1]=p[f+4>>2],xd[0]);h=h+448|0;xd[0]=f;p[h>>2]=C[0];p[h+4>>2]=C[1];VE(j,b)}dx.X=1;function px(b){var c=b+116|0;(p[c>>2]|0)!=0&&($D(b,b+100|0),p[c>>2]=0);c=b+140|0;(p[c>>2]|0)!=0&&($D(b,b+124|0),p[c>>2]=0);c=b+164|0;(p[c>>2]|0)!=0&&($D(b,b+148|0),p[c>>2]=0);c=b+188|0;(p[c>>2]|0)!=0&&($D(b,b+172|0),p[c>>2]=0);c=b+212|0;(p[c>>2]|0)!=0&&($D(b,b+196|0),p[c>>2]=0);c=b+236|0;(p[c>>2]|0)!=0&&($D(b,b+220|0),p[c>>2]=0);c=b+260|0;(p[c>>2]|0)!=0&&($D(b,b+244|0),p[c>>2]=0);c=b+284|0;(p[c>>2]|0)!=0&&($D(b,b+268|0),p[c>>2]=0);c=b+308|0;(p[c>>2]|0)!=0&&($D(b,b+292|0),p[c>>2]=0);c=b+332|0;(p[c>>2]|0)!=0&&($D(b,b+316|0),p[c>>2]=0)}px.X=1;function VE(b,c){if((c|0)!=0){var d=c+28|0,e=(p[d>>2]|0)>0;a:do{if(e){for(var f=0;;){var g=p[(c+120>>2)+(f*18|0)];(g|0)!=0&&((p[g+28>>2]|0)!=0&&Lg(p[g+24>>2]),vf(b,g));(p[(c+52>>2)+(f*18|0)]&536870912|0)!=0&&(g=p[(c+68>>2)+(f*18|0)],(g|0)!=0&&(vf(b,p[g+28>>2]),vf(b,g)));f=f+1|0;if((f|0)>=(p[d>>2]|0)){break a}}}}while(0);WE(p[c+32>>2]);vf(b,c)}}function WE(b){var c,d=y[p[b>>2]>>2],e=p[b+24>>2],f=b+32|0,g=(e|0)>0;a:do{if(g){var h=p[f>>2];c=h>>2;for(var i=e;;){var i=i-1|0,j=h+18|0,k=l[j];(k&1)<<24>>24==0?j=k:(Df(d,p[c]),j=l[j]);j&=255;(j&16|0)==0?(j&32|0)!=0&&(j=d,c=p[c+3],WE(c|0),vf(j,c)):(j=d,c=p[c+3],WE(c|0),vf(j,c));if((i|0)<=0){break a}h=h+40|0;c=h>>2}}}while(0);e=p[f>>2];(e|0)!=(b+36|0)&&vf(d,e)}WE.X=1;function ME(b,c,d){for(var e=d&255,f=b+20|0;;){l[f]=e;if((c|0)==0){break}if((t[c|0]&255|0)!=(d|0)){XE(b,c,0);break}ME(b,p[c+8>>2],d);c=p[c+12>>2]}}function NE(b){var c=p[b+24>>2],d=(c|0)>0;a:do{if(d){for(var e=c;;){if(e=e-1|0,YE(b,e),(e|0)<=0){break a}}}}while(0)}function OE(b,c,d,e){var f=n[c>>1]<<16>>16==1;a:do{if(f){for(var g=p[c+36>>2],h=p[c+16>>2],i=p[e>>2],j=e+12|0,k=0;;){if((k|0)>=(i|0)){break}var m=p[(p[j>>2]>>2)+(k*5|0)],o=l[m|0]<<24>>24==-104;do{if(o&&(p[m+24>>2]|0)==(g|0)&&n[m+28>>1]<<16>>16<0){var r=1;break a}}while(0);k=k+1|0}for(h=h+16|0;;){h=p[h>>2];if((h|0)==0){r=0;break a}if(l[h+24|0]<<24>>24!=0){i=h+4|0;j=h+8|0;k=0;b:for(;;){m=p[i>>2];if((k|0)>=(m|0)){var q=m;break}m=(ZE(d,g,p[p[j>>2]+(k<<2)>>2],-1,-1,2,h)|0)==0;do{if(m&&($E(b,e,g,h,k)|0)<0){q=p[i>>2];break b}}while(0);k=k+1|0}if((k|0)==(q|0)){r=1;break a}}h=h+32|0}}else{r=0}}while(0);return r}OE.X=1;function RE(b,c,d,e,f,g,h,i,j,k){var m,o,r,q,s,u,w=p[d+12>>2];Ed(j,0,36);u=(j|0)>>2;p[u]=134217728;s=p[k>>2];if((s|0)==0){if(s=aF(b,c,d,i),p[k>>2]=s,(s|0)==0){k=22}else{var v=s,k=3}}else{v=s,k=3}do{if(k==3){m=v+4|0;var x=p[v+16>>2];s=(v|0)>>2;o=y[s];q=(o|0)>0;a:do{if(q){var A=c+32|0,E=p[m>>2];for(r=0;;){var J=p[A>>2]+p[E+8>>2]*40+24|0;l[E+5|0]=((p[J>>2]&e)==0&&(p[J+4>>2]&f)==0)&1;r=r+1|0;J=p[s];if((r|0)>=(J|0)){var M=J;break a}E=E+12|0}}else{M=o}}while(0);Ed(x,0,M<<3);o=v+28|0;q=v+24|0;(p[o>>2]|0)!=0&&Lg(p[q>>2]);p[q>>2]=0;p[v+20>>2]=0;p[o>>2]=0;q=(v+32|0)>>2;p[q]=0;r=(v+36|0)>>2;xd[0]=5e+98;p[r]=C[0];p[r+1]=C[1];o=(v+8|0)>>2;A=p[o];(E=(i|0)!=0)||(p[o]=0);if((bF(b,w,v)|0)==0){var J=p[m>>2],D=p[s],K=(D|0)>0;a:do{if(K){var H=c+32|0;m=(j+28|0)>>2;for(var N=0,Q=D;;){if((p[x+(N<<3)>>2]|0)>0){var Q=p[H>>2]+p[(J+8>>2)+(N*3|0)]*40+24|0,P=p[m+1]|p[Q+4>>2];p[m]|=p[Q>>2];p[m+1]=P;Q=p[s]}N=N+1|0;if((N|0)>=(Q|0)){break a}}}}while(0);s=(C[0]=p[r],C[1]=p[r+1],xd[0]);s=E?(p[q]|0)!=0?s:s+cF(s)*s:s;x=j+20|0;xd[0]=s>5e+98?5e+98:s;p[x>>2]=C[0];p[x+4>>2]=C[1];p[j+16>>2]=v;(p[q]|0)!=0&&(p[u]|=16777216);p[j+4>>2]=0;p[o]=A;dF(b,c,d,e,f,g,h,i,j)}}}while(0)}RE.X=1;function QE(b,c,d,e,f,g,h,i,j,k){var m,o,r,q,s,u,w=a;a+=72;var v;u=w>>2;var x=w+48,A=w+56,E=w+60,J=w+64;s=J>>2;var M=y[d+32>>2];p[A>>2]=-1;Ed(k,0,36);q=(k+20|0)>>2;xd[0]=1e+99;p[q]=C[0];p[q+1]=C[1];var D=(l[d+28|0]&8)<<24>>24==0?131:3,K=d+56|0,H=p[K>>2];if((H|0)==0){for(var N=w>>2,Q=N+12;N<Q;N++){p[N]=0}p[u+1]=1;p[u+2]=A;var P=x|0;p[u+3]=P;l[w+24|0]=5;var L=p[d+12>>2];p[u+4]=L;p[P>>2]=p[L+24>>2];p[x+4>>2]=1;if(l[d+29|0]<<24>>24!=0){var I=w,X=0,Y=3,da=-983041}else{p[u+8]=p[L+16>>2],I=w,X=0,Y=3,da=-983041}}else{X=I=H,Y=D,da=-12289}var ga=(i|0)!=0&1,ha=(j|0)!=0,ba=c+4|0,ea=c+32|0,ja=c+24|0,ra=k+28|0;r=(k+8|0)>>2;o=(k|0)>>2;for(var Va=k+4|0,ta=k+16|0,xa=d+44|0,Fa=I,Na=X,Ea=Y,La=da;;){if((Fa|0)==0){break}m=y[Fa+12>>2]>>2;xd[0]=1;p[s]=C[0];p[s+1]=C[1];for(var za=Fa+8|0,Ba=Fa+4|0,Ja=1,ka=0,S=0,ib=0,Wa=0,Za=0;;){var Sa=y[Ba>>2];if((Wa|0)>=(Sa|0)){var tb=Sa;break}var pb=ZE(c,M,p[p[za>>2]+(Wa<<2)>>2],e,f,Ea,Na);if((pb|0)==0){tb=p[Ba>>2];break}var fb=Vc[pb+16>>1]&65535;if((fb&1|0)==0){var Xa=Ja,Ab=ka|fb<<12&524288|69632,rb=Za}else{var cb=y[pb>>2],Cb=ka|331776;if((n[cb+2>>1]&2048)<<16>>16==0){var Zb=p[cb+16>>2];if((Zb|0)==0){Xa=Ja}else{var dc=p[Zb>>2],Xa=(dc|0)==0?Ja:dc*Ja|0}Ab=Cb;rb=Za}else{Xa=Ja*25|0,Ab=Cb,rb=1}}var kb=pb+24|0,Ja=Xa,ka=Ab;S|=p[kb+4>>2];ib|=p[kb>>2];Wa=Wa+1|0;Za=rb}var Oa=(Wa|0)==(tb|0);if(Oa){if(l[Fa+24|0]<<24>>24==0){v=21}else{var Db=0,Wb=(ka&786432|0)==0?ka|67108864:ka,Nb=S,$b=ib;v=30}}else{v=21}if(v==21){if(l[Fa+26|0]<<24>>24!=0){Db=0,Wb=ka,Nb=S,$b=ib}else{var Rb=Oa?-1:p[p[za>>2]+(Wa<<2)>>2];if((ZE(c,M,Rb,e,f,60,Na)|0)==0){Db=0,Wb=ka,Nb=S,$b=ib}else{var Ra=ZE(c,M,Rb,e,f,24,Na),Ob=ZE(c,M,Rb,e,f,36,Na),Ua=J,Jb=(Ob|0)==0?1:4;xd[0]=(Ra|0)==0?Jb:Jb*4;p[Ua>>2]=C[0];p[Ua+4>>2]=C[1];if((Ra|0)==0){var Vb=0,Pb=ka,sb=S,db=ib}else{var wb=Ra+24|0,Vb=1,Pb=ka|1048576,sb=p[wb+4>>2]|S,db=p[wb>>2]|ib}if((Ob|0)==0){var ob=Vb,Kb=Pb,ub=sb,Xb=db}else{var Sb=Ob+24|0,ob=Vb+1|0,Kb=Pb|2097152,ub=p[Sb+4>>2]|sb,Xb=p[Sb>>2]|db}Db=ob;Wb=Kb|139264;Nb=ub;$b=Xb}}}if((eF(b,p[ba>>2],Fa,M,i,Wa,Wb,E)|0)==0){var Qb=ga,ac=Wb}else{var Gb=(p[E>>2]|0)!=0?33554432:0,Qb=0,ac=Wb|Gb|16916480}var xb=(fF(b,c,Fa,M,j,Wa)|0)==0,Ta=xb?ac:ac|1073881088,qb=(Na|0)!=0,bc=(Ta|0)==0|qb^1;do{if(bc){var $a=0,mb=Ta}else{var Bb=p[xa>>2],bb=p[xa+4>>2],jb=p[Na+4>>2],nb=(jb|0)>0;a:do{if(nb){for(var zb=p[Na+8>>2],Tb=bb,ec=Bb,Hb=0;;){var Eb=p[zb+(Hb<<2)>>2];if((Eb|0)<63){var Lb=nc(1,0,"shl",Eb),gb=Tb&(Lb[1]^-1),Mb=ec&(Lb[0]^-1)}else{gb=Tb,Mb=ec}var vc=Hb+1|0;if((vc|0)>=(jb|0)){var hc=gb,kc=Mb;break a}Tb=gb;ec=Mb;Hb=vc}}else{hc=bb,kc=Bb}}while(0);var pc=kc==0&&hc==0,jc=pc?Ta|8388608:Ta,$a=pc?0:1,mb=jc}}while(0);var mc=y[(Wa<<2>>2)+m],Fb=(mc*Ja|0)>>>0;if((Za|0)==0){var Ub=Ja,Ya=Fb,Pa=p[m]}else{var yb=y[m];if(Fb*2>yb>>>0){var Ka=yb>>>1>>>0,Ub=Ka/(mc>>>0)&-1,Ya=Ka}else{Ub=Ja,Ya=Fb}Pa=yb}var Ac=(C[0]=p[s],C[1]=p[s+1],xd[0]),Jc=Ya/Ac,uc=Jc<1?1:Jc;if((mb&269430784|0)==0){var Tc=Pa<<2>>>0}else{var Yc=cF(Pa>>>0);if(qb){var ua=Ub|0,Tc=($a|0)==0?uc+ua*Yc:uc+(ua+uc)*Yc}else{Tc=uc+(Ub|0)*Yc}}var md=(Qb|0)==0?Tc:Tc+uc*cF(uc)*3,nd=ha&xb?md+uc*cF(uc)*3:md,Bc=uc>2;do{if(Bc){var Qc=(C[0]=p[q],C[1]=p[q+1],xd[0]);if(nd>Qc){var Oc=uc}else{var ed=PE(p[ba>>2],M),Fc=ed[0],ud=ed[1],Rc=y[ja>>2],Yb=uc<=2|(Rc|0)==0;a:do{if(Yb){var W=uc}else{for(var bd=uc,hd=p[ea>>2],eb=Rc,Uc=Wa,cd=Db;;){if((l[hd+18|0]&2)<<24>>24==0){var vd=hd+32|0,id=vd|0,Zc=vd+4|0;if((p[id>>2]&g)==Fc&&(p[Zc>>2]&h)==ud){var td=Vc[hd+16>>1],zd=td&65535;(zd&131|0)==0?(zd&60|0)==0?td<<16>>16==2048?(Id=cd,xc=Uc,qc=bd):(Id=cd,xc=Uc,qc=bd*.5):(cd|0)==0?(Id=0,xc=Uc,qc=bd/3):(Id=cd-1|0,xc=Uc,qc=bd):(Uc|0)==0?(Id=cd,xc=0,qc=bd/10):(Id=cd,xc=Uc-1|0,qc=bd)}else{var Id=cd,xc=Uc,qc=bd}}else{Id=cd,xc=Uc,qc=bd}var Gc=eb-1|0;if(qc<=2|(Gc|0)==0){W=qc;break a}bd=qc;hd=hd+40|0;eb=Gc;Uc=xc;cd=Id}}}while(0);Oc=W<2?2:W}}else{Oc=uc}}while(0);var Hc=qb&(mb|0)==0;do{if(!Hc){var zc=(C[0]=p[q],C[1]=p[q+1],xd[0]);if(nd>=zc){if(nd>zc){break}var Kc=(C[0]=p[r],C[1]=p[r+1],xd[0]);if(Oc>=Kc){break}}xd[0]=nd;p[q]=C[0];p[q+1]=C[1];id=ra|0;p[id>>2]=$b;Zc=ra+4|0;p[Zc>>2]=Nb;xd[0]=Oc;p[r]=C[0];p[r+1]=C[1];p[o]=mb&La;p[Va>>2]=Wa;p[ta>>2]=Na}}while(0);if((p[K>>2]|0)!=0){break}var wd=p[Fa+32>>2],Na=Fa=wd,Ea=D,La=-12289}(i|0)==0&&(p[p[b>>2]+12>>2]&16777216|0)!=0&&(p[o]|=33554432);dF(b,c,d,e,f,g,h,i,k);gF(b,c,d,e,f,k);p[o]|=Ea;a=w}QE.X=1;function SE(b,c,d,e,f,g){var h,i,j,k,m=p[b+12>>2],o=Uw(b),r=y[d+12>>2],q=p[c+24>>2],s=c+32|0;k=p[s>>2];c=k+q*40|0;q=(q|0)>0;a:do{if(q){var u=0,w=k;for(h=i=0;;){if((hF(w,d,e,f)|0)!=0){var v=p[w+12>>2];if((v|0)>63){var v=-2147483648,x=0}else{x=nc(1,0,"shl",v),v=x[1],x=x[0]}(x&h)==0&&(v&i)==0&&(i|=v,h|=x,u=u+1|0)}w=w+40|0;if(w>>>0>=c>>>0){var A=u;j=i;var E=h;break a}}}else{E=j=A=0}}while(0);p[g+4>>2]=A;k=(d+44|0)>>2;i=p[k];h=p[k+1];E=i&(E^-1);q=h&((j|-2147483648)^2147483647);j=(r+8|0)>>2;u=y[j];w=(u|0)>0;a:do{if(w){for(var v=(u|0)<63?u:63,x=A,J=0;;){var M=nc(1,0,"shl",J),x=(((M[0]&E)!=0||(M[1]&q)!=0)&1)+x|0,J=J+1|0;if((J|0)==(v|0)){var D=x;break a}}}else{D=A}}while(0);D=(h|0)<0||(h|0)==0&&i>>>0<0?D-63+u|0:D;p[(g|0)>>2]|=8454146;A=ni(p[b>>2],(D<<3)+D+48|0);if((A|0)!=0){p[g+16>>2]=A;h=A+48|0;i=(A+44|0)>>2;p[i]=h;v=(D<<2)+h|0;h=(A+8|0)>>2;p[h]=v;p[(A+40|0)>>2]=(D<<2)+v|0;p[A>>2]=R.Mi|0;p[(A+4|0)>>2]=D;p[(A+16|0)>>2]=r;r=y[s>>2];s=r>>>0<c>>>0;a:do{if(s){for(var v=r,K=J=x=0;;){if((hF(v,d,e,f)|0)==0){M=K}else{M=y[v+12>>2];if((M|0)>63){var H=-2147483648,N=0}else{var Q=nc(1,0,"shl",M),H=Q[1],N=Q[0]}(N&K)==0&&(H&J)==0?(Q=p[v>>2],K|=N,J|=H,p[((x<<2)+p[h]|0)>>2]=M,M=sE(b,p[Q+8>>2],p[Q+12>>2]),p[((x<<2)+p[i]|0)>>2]=(M|0)==0?R.w|0:p[M>>2],M=K,x=x+1|0):M=K}v=v+40|0;if(v>>>0>=c>>>0){var P=x;break a}K=M}}else{P=0}}while(0);a:do{if(w){d=(u|0)<63?u:63;e=P;for(f=0;;){if(c=nc(1,0,"shl",f),(c[0]&E)==0&&(c[1]&q)==0||(p[((e<<2)+p[h]|0)>>2]=f,p[((e<<2)+p[i]|0)>>2]=R.w|0,e=e+1|0),f=f+1|0,(f|0)==(d|0)){var L=e;break a}}}else{L=P}}while(0);P=p[k+1];P=(P|0)<0||(P|0)==0&&p[k]>>>0<0;a:do{if(P&&(p[j]|0)>63){d=L;for(e=63;;){p[((d<<2)+p[h]|0)>>2]=e;p[((d<<2)+p[i]|0)>>2]=R.w|0;e=e+1|0;if((e|0)>=(p[j]|0)){break a}d=d+1|0}}}while(0);P=lx(b,A);L=g+28|0;hw(m,41,p[L>>2],D+1|0,0,P,-16);g=(g+24|0)>>2;P=qw(m,72,p[g]);d=rx(b);yC(b,A,p[g],d,1);V(m,97,p[L>>2],d);sw(m,16);V(m,95,p[g],P+1|0);sw(m,3);fw(m,P);sx(b,d);fw(m,o)}}SE.X=1;function TE(b,c,d,e,f,g){if(l[b+480|0]<<24>>24==2){var h=y[d>>2],i=t[d+48|0]&255,j=p[b+12>>2],k=y[b>>2],b=p[b+548>>2];if((h&268435456|0)==0&&(g&=65535,(g&64|0)==0)){var m=(p[d+4>>2]|0)==0?(h&3145728|0)!=0?R.Ea|0:(g&3|0)!=0?R.Ea|0:R.si|0:R.Ea|0,m=zm(k,R.d|0,(z=a,a+=4,p[z>>2]=m,z));if((p[(c+20>>2)+(i*15|0)]|0)==0){var o=p[(c+8>>2)+(i*15|0)],m=ZD(k,m,R.ui|0,(z=a,a+=8,p[z>>2]=m,p[z+4>>2]=o,z))}else{o=t[c+i*60+35|0]&255,m=ZD(k,m,R.ti|0,(z=a,a+=8,p[z>>2]=m,p[z+4>>2]=o,z))}o=p[(c+12>>2)+(i*15|0)];m=(o|0)==0?m:ZD(k,m,R.vi|0,(z=a,a+=8,p[z>>2]=m,p[z+4>>2]=o,z));if((h&983040|0)==0){(h&12288|0)==0?(h&134217728|0)==0?h=m:(c=p[d+16>>2],h=p[c+20>>2],c=p[c+24>>2],h=ZD(k,m,R.Fi|0,(z=a,a+=12,p[z>>2]=m,p[z+4>>2]=h,p[z+8>>2]=c,z))):(m=ZD(k,m,R.zi|0,(z=a,a+=4,p[z>>2]=m,z)),h=(h&4096|0)==0?(h&3145728|0)==3145728?ZD(k,m,R.Ci|0,(z=a,a+=4,p[z>>2]=m,z)):(h&2097152|0)==0?(h&1048576|0)==0?m:ZD(k,m,R.Ei|0,(z=a,a+=4,p[z>>2]=m,z)):ZD(k,m,R.Di|0,(z=a,a+=4,p[z>>2]=m,z)):ZD(k,m,R.Bi|0,(z=a,a+=4,p[z>>2]=m,z)))}else{var c=iF(k,d,p[p[(c+16>>2)+(i*15|0)]+12>>2]),i=(o=(h&536870912|0)!=0)?R.xi|0:xh|0,h=(h&8388608|0)!=0?R.yi|0:xh|0,r=o?xh|0:R.W|0,o=o?xh|0:p[p[d+16>>2]>>2],h=ZD(k,m,R.wi|0,(z=a,a+=24,p[z>>2]=m,p[z+4>>2]=i,p[z+8>>2]=h,p[z+12>>2]=r,p[z+16>>2]=o,p[z+20>>2]=c,z));vf(k,c)}(g&3|0)==0?(d=d+8|0,g=(C[0]=p[d>>2],C[1]=p[d+4>>2],xd[0]),d=g>>>0,g=Math.min(Math.floor(g/4294967296),4294967295)):(g=0,d=1);k=ZD(k,h,R.Gi|0,(z=a,a+=12,p[z>>2]=h,p[z+4>>2]=d,p[z+8>>2]=g,z));hw(j,150,b,e,f,k,-1)}}}TE.X=1;function UE(b,c,d,e,f,g){var h,i,j,k,m,o,r,q,s,u,w=b>>2,v=a;a+=8;var x,A=v+4,E=y[w];u=E>>2;var J=y[u+3];s=J>>2;var M=y[w+8],D=b+c*72+52|0,K=b+c*72+100|0,H=t[K]&255;q=(b+12|0)>>2;var N=y[q],Q=N+H*60+4|0,P=y[(N+36>>2)+(H*15|0)];r=(D|0)>>2;var L=y[r],I=L&33554432,X=(I|0)!=0,Y=I>>>25,da=(L&8388608|0)==0?0:(d&32)<<16>>16==0,ga=Xw(J);o=(b+c*72+88|0)>>2;p[o]=ga;var ha=b+c*72+84|0;p[ha>>2]=ga;var ba=Xw(J);p[w+(c*18|0)+23]=ba;if(l[K]<<24>>24!=0&&(l[N+H*60+32|0]&8)<<24>>24!=0){var ea=E+72|0,ja=p[ea>>2]+1|0;p[ea>>2]=ja;p[w+(c*18|0)+18]=ja;V(J,7,0,ja)}var ra=y[r],Va=(ra&134217728|0)==0;a:do{if(Va){if((ra&4096|0)!=0){var ta=rx(E),xa=ZE(M,P,-1,e,f,3,0),Fa=jF(E,xa,D,ta),Na=p[o];V(J,21,Fa,Na);gw(J,54,P,Na,Fa);pE(E,P,-1,Fa);l[b+c*72+101|0]=-107;$c=ta}else{if((ra&8192|0)!=0){var Ea=ZE(M,P,-1,e,f,36,0),La=ZE(M,P,-1,e,f,24,0),za=X?La:Ea,Ba=X?Ea:La,Ja=(za|0)==0;if(Ja){V(J,X?67:72,P,ga)}else{var ka=p[za>>2],S=jE(E,p[ka+12>>2],v);gw(J,t[R.Vq+((t[ka|0]&255)-77)|0]&255,P,ga,S);cE(E,S,1);sx(E,p[v>>2]);kF(D,za)}var ib=(Ba|0)==0;if(ib){var Wa=0,Za=149}else{var Sa=p[Ba>>2],tb=E+72|0,pb=p[tb>>2]+1|0;p[tb>>2]=pb;ux(E,p[Sa+12>>2],pb);var fb=l[Sa|0],Xa=fb<<24>>24==79||fb<<24>>24==77?(I>>>24^2)+78|0:I>>>24|77;kF(D,Ba);Wa=pb;Za=Xa}var Ab=p[s+7];l[b+c*72+101|0]=X?92:95;p[w+(c*18|0)+26]=P;p[w+(c*18|0)+27]=Ab;Ja&ib&&(l[b+c*72+102|0]=1);if((Za|0)==149){$c=0}else{var rb=rx(E);V(J,65,P,rb);pE(E,P,-1,rb);gw(J,Za,Wa,ga,rb);sw(J,107);$c=rb}}else{if((ra&196608|0)!=0){var cb=y[w+(c*18|0)+14],Cb=y[w+(c*18|0)+17],Zb=y[w+(c*18|0)+20],dc=Cb+4|0,kb=p[dc>>2],Oa=(cb|0)==(kb|0)?-1:p[p[Cb+8>>2]+(cb<<2)>>2],Db=(d&1)<<16>>16==0?0:(ra&16777216|0)!=0&(kb|0)>(cb|0)?1:0;if((ra&1048576|0)==0){var Wb=Db,Nb=0,$b=ra}else{var Rb=ZE(M,P,Oa,e,f,24,Cb),Wb=1,Nb=Rb,$b=p[r]}if(($b&2097152|0)==0){var Ra=Wb,Ob=0}else{var Ua=ZE(M,P,Oa,e,f,36,Cb),Ra=1,Ob=Ua}var Jb=lF(E,D,M,e,f,Ra,A);k=(E|0)>>2;var Vb=y[A>>2],Pb=yl(p[k],Vb),sb=y[o],db=y[dc>>2];x=(cb|0)<(db|0)?(Y|0)==(l[p[Cb+40>>2]+cb|0]<<24>>24==0&1|0)?48:47:47;if(x==47){if(X&(db|0)==(cb|0)){x=48}else{var wb=Nb,ob=Ob;x=49}}x==48&&(wb=Ob,ob=Nb);var Kb=(ob|0)!=0,ub=(Kb?(n[ob+16>>1]&40)<<16>>16!=0:1)&1,Xb=(wb|0)!=0,Sb=(Xb?(n[wb+16>>1]&40)<<16>>16!=0:1)&1,Qb=(Kb|(cb|0)>0)&1;if(Kb){var ac=y[p[ob>>2]+12>>2],Gb=Jb+cb|0;ux(E,ac,Gb);(mF(ac)|0)!=0&&V(J,73,Gb,sb);if((Vb|0)!=0){var xb=Vb+cb|0,Ta=l[xb];var qb=tE(ac,Ta)<<24>>24==98?l[xb]=98:Ta;(nF(ac,qb)|0)!=0&&(l[xb]=98)}var bc=cb+1|0,$a=Qb,mb=ub}else{(Db|0)==0?(bc=cb,$a=Qb,mb=ub):(V(J,10,0,Jb+cb|0),bc=cb+1|0,$a=1,mb=0)}oF(E,Jb,bc,Vb);zC(J,t[R.Xq+(mb<<1|Y|$a<<2)|0]&255,Zb,sb,Jb,bc);if(Xb){var Bb=y[p[wb>>2]+12>>2],bb=Jb+cb|0;cE(E,bb,1);ux(E,Bb,bb);(mF(Bb)|0)!=0&&V(J,73,bb,sb);if((Pb|0)!=0){var jb=Pb+cb|0,nb=l[jb];var zb=tE(Bb,nb)<<24>>24==98?l[jb]=98:nb;(nF(Bb,zb)|0)!=0&&(l[jb]=98)}var Tb=cb+1|0;oF(E,Jb,Tb,Pb);var ec=Tb}else{ec=cb}vf(p[k],Vb);vf(p[k],Pb);p[w+(c*18|0)+27]=p[s+7];var Hb=(Xb|(cb|0)!=0)<<31>>31&Y+1;(Hb-1|0)>>>0<2&&(zC(J,t[R.Uq+Hb|0]&255,Zb,sb,Jb,ec),sw(J,(Sb|0)!=(Y|0)&1));var Eb=rx(E);(p[r]&3145728|0)!=0&&(gw(J,29,Zb,cb,Eb),V(J,73,Eb,ba));sx(E,Eb);kF(D,ob);kF(D,wb);if(da){var Lb=0}else{var gb=rx(E);V(J,99,Zb,gb);pE(E,P,-1,gb);V(J,50,P,gb);Lb=gb}l[b+c*72+101|0]=(p[r]&67108864|0)==0?X?92:95:-107;p[w+(c*18|0)+26]=Zb;$c=Lb}else{if((ra&268435456|0)==0){l[b+c*72+101|0]=l[R.Yq+Y|0];p[w+(c*18|0)+26]=P;var Mb=V(J,t[R.Wq+Y|0]&255,P,ga);p[w+(c*18|0)+27]=Mb+1|0;l[b+c*72+102|0]=1}else{j=(E+72|0)>>2;var vc=p[j]+1|0;p[j]=vc;var hc=Xw(J),kc=y[w+(c*18|0)+17],pc=p[kc+12>>2];l[b+c*72+101|0]=3;p[w+(c*18|0)+26]=vc;var jc=b+28|0,mc=p[jc>>2],Fb=(mc|0)>1;b:do{if(Fb){var Ub=mc-c|0,Ya=Ub-1|0,Pa=zh(p[u],Ya*60+64|0),yb=Pa;if((Pa|0)==0){var Ka=f,Ac=e;x=126;break a}var Jc=Ub&65535;n[Pa+2>>1]=Jc;n[Pa>>1]=Jc;var uc=Pa+4|0,Tc=uc;Ah(uc,Q,60);var Yc=p[q];if((Ya|0)<1){var ua=yb}else{for(var md=1;;){Ah(Tc+md*60|0,Yc+(t[b+(md+c)*72+100|0]&255)*60+4|0,60);var nd=md+1|0;if((nd|0)==(Ub|0)){ua=yb;break b}md=nd}}}else{ua=p[q]}}while(0);var Bc=(d&8)<<16>>16==0;if(Bc){var Qc=p[j],Oc=Qc+1|0,ed=Qc+2|0;p[j]=ed;V(J,10,0,Oc);var Fc=ed,ud=Oc}else{ud=Fc=0}var Rc=V(J,7,0,vc);if((p[M+24>>2]|0)>1){var Yb=Bw(p[u],69,0,0);p[(Yb+12|0)>>2]=g;var W=Yb}else{W=0}i=(pc+24|0)>>2;var bd=(p[i]|0)>0;b:do{if(bd){for(var hd=pc+32|0,eb=(W|0)==0,Uc=N+H*60+16|0,cd=J+28|0,vd=W+8|0,id=0,Zc=0;;){var td=p[hd>>2];if((p[(td+8>>2)+(Zc*10|0)]|0)==(P|0)){x=96}else{if(n[(td+16>>1)+(Zc*20|0)]<<16>>16==512){x=96}else{var zd=id;x=102}}if(x==96){var Id=p[(td>>2)+(Zc*10|0)];if(eb){var xc=Id}else{p[vd>>2]=Id,xc=W}var qc=$w(E,ua,xc,0,0,240);if((qc|0)==0){zd=id}else{TE(E,ua,qc+52|0,c,t[K]&255,0);if(Bc){var Gc=(Zc|0)==(p[i]-1|0)?-1:Zc,Hc=qx(E,p[Uc>>2],-1,P,Fc);zC(J,114,ud,p[cd>>2]+2|0,Hc,Gc)}V(J,2,vc,hc);var zc=l[qc+7|0]<<24>>24==0?id:1;dx(qc);zd=zc}}var Kc=Zc+1|0;if((Kc|0)>=(p[i]|0)){var wd=zd,be=cd;break b}id=zd;Zc=Kc}}else{wd=0,be=J+28|0}}while(0);var ge=E|0;vf(p[ge>>2],W|0);sm(J,Rc,p[be>>2]);V(J,1,0,p[ha>>2]);wx(J,hc);(p[jc>>2]|0)>1&&vf(p[ge>>2],ua);(wd|0)==0&&kF(D,kc)}$c=0}}}}else{var Xd=y[w+(c*18|0)+17];m=Xd>>2;var rc=y[m],Lc=y[m+4],Jd=y[m+1];gE(E);for(var Qd=rc+2|0,Fd=ox(E,Qd),Cd=M+32|0,ce=Fd+1|0,Yd=1;;){if((Yd|0)>(rc|0)){break}for(var Mc=0;;){if((Mc|0)>=(rc|0)){break}if((p[Lc+(Mc<<3)>>2]|0)==(Yd|0)){ux(E,p[p[(p[Cd>>2]>>2)+(p[(Jd+8>>2)+(Mc*3|0)]*10|0)]+12>>2],ce+Yd|0);break}Mc=Mc+1|0}if((Mc|0)==(rc|0)){break}Yd=Yd+1|0}V(J,7,p[m+5],Fd);V(J,7,Yd-1|0,ce);var jd=Xd+28|0;hw(J,136,P,ga,Fd,p[m+6],(p[jd>>2]|0)!=0?-11:-2);p[jd>>2]=0;var gc=(rc|0)>0;b:do{if(gc){for(var fd=0;;){l[(fd<<3)+Lc+4|0]<<24>>24!=0&&kF(D,p[Cd>>2]+p[(Jd+8>>2)+(fd*3|0)]*40|0);var Sd=fd+1|0;if((Sd|0)==(rc|0)){break b}fd=Sd}}}while(0);l[b+c*72+101|0]=-118;p[w+(c*18|0)+26]=P;p[w+(c*18|0)+27]=p[s+7];tx(E,Fd,Qd);lE(E);var $c=0}x=108}while(0);if(x==108){var Ad=PE(p[M+4>>2],P),Xe=(Ad[0]^-1)&e,ef=(Ad[1]^-1)&f,oe=M+32|0;h=(M+24|0)>>2;var wf=p[h],Kd=(wf|0)>0;a:do{if(Kd){for(var ue=b+c*72+72|0,xf=b+7|0,Ge=p[oe>>2],yf=wf;;){var Re=Ge+18|0;if((l[Re]&6)<<24>>24==0){var Se=Ge+32|0,tc=Se|0,ff=Se+4|0;if((p[tc>>2]&Xe)==0&&(p[ff>>2]&ef)==0){var he=p[Ge>>2];(p[ue>>2]|0)!=0&&(n[he+2>>1]&1)<<16>>16==0||(mx(E,he,ba,8),l[Re]|=4)}else{l[xf]=1}}var je=yf-1|0;if((je|0)<=0){var de=ue;break a}Ge=Ge+40|0;yf=je}}else{de=b+c*72+72|0}}while(0);var Me=p[de>>2],od=(Me|0)==0;a:do{if(!od){p[w+(c*18|0)+24]=p[s+7];V(J,7,1,Me);px(E);var ke=p[h];if((ke|0)>0){for(var Zd=p[oe>>2],le=0,ye=ke;;){var zf=Zd+18|0;if((l[zf]&6)<<24>>24==0){var Ye=Zd+32|0,tc=Ye|0,ff=Ye+4|0;if((p[tc>>2]&Xe)==0&&(p[ff>>2]&ef)==0){mx(E,p[Zd>>2],ba,8),l[zf]|=4,Ze=p[h]}else{var Ze=ye}}else{Ze=ye}var Ae=le+1|0;if((Ae|0)>=(Ze|0)){break a}Zd=Zd+40|0;le=Ae;ye=Ze}}}}while(0);sx(E,$c);Ka=ef;Ac=Xe}a=v;return[Ac,Ka]}UE.X=1;function kF(b,c){var d,e=b+20|0,f=c;for(d=f>>2;;){if((f|0)==0){break}var f=f+18|0,g=l[f];if((g&4)<<24>>24!=0){break}if((p[e>>2]|0)!=0&&(n[p[d]+2>>1]&1)<<16>>16==0){break}l[f]=g|4;f=p[d+1];if((f|0)<=-1){break}d=p[p[d+5]+32>>2];var g=d+f*40+19|0,h=l[g]-1&255;l[g]=h;if(h<<24>>24!=0){break}f=d+f*40|0;d=f>>2}}function nF(b,c){var d=c<<24>>24==98;do{if(d){var e=1}else{var e=t[b|0],f=(e+100&255)<2;a:do{if(f){for(var g=b;;){var g=y[g+8>>2],h=t[g|0];if((h+100&255)>=2){var i=g,j=h;break a}}}else{i=b,j=e}}while(0);e=(j<<24>>24==-124?l[i+35|0]:j)&255;e=(e|0)==129?(c-99&255)<2&1:(e|0)==130?(c<<24>>24==101|c<<24>>24==99)&1:(e|0)==94?c<<24>>24==97&1:(e|0)==131?1:(e|0)==152?(n[i+28>>1]<<16>>16<0?c<<24>>24==100?1:c<<24>>24==99:0)&1:0}}while(0);return e}nF.X=1;function mF(b){var c=t[b|0],d=(c+100&255)<2;a:do{if(d){for(var e=b;;){var e=y[e+8>>2],f=t[e|0];if((f+100&255)>=2){var g=e,h=f;break a}}}else{g=b,h=c}}while(0);b=(h<<24>>24==-124?l[g+35|0]:h)&255;return(b|0)==129||(b|0)==94||(b|0)==130||(b|0)==131?0:1}function ZE(b,c,d,e,f,g,h){g&=4095;var i=(d|0)<0|(h|0)==0,j=h+16|0,k=h+8|0,m=h+4|0,h=h+44|0,o=b,b=o>>2;a:for(;;){if((o|0)==0){var r=0;break}o|=0;for(var q=p[b+6],s=p[b+8];;){if((q|0)==0){break}var u=(p[s+8>>2]|0)==(c|0);do{if(u){var w=s+24|0;if((p[w>>2]&e)==0&&(p[w+4>>2]&f)==0&&(p[s+12>>2]|0)==(d|0)&&(w=Vc[s+16>>1],(g&w&65535|0)!=0)){if(i|w<<16>>16==128){r=s;break a}w=y[s>>2];if((pF(w,l[p[p[j>>2]+12>>2]+d*24+22|0])|0)!=0){for(var w=sE(p[o>>2],p[w+8>>2],p[w+12>>2]),v=p[k>>2],x=0;;){if((p[v+(x<<2)>>2]|0)==(d|0)){break}if((x|0)>=(p[m>>2]|0)){r=0;break a}x=x+1|0}if((w|0)==0){r=s;break a}if((qm(p[w>>2],p[p[h>>2]+(x<<2)>>2])|0)==0){r=s;break a}}}}}while(0);q=q-1|0;s=s+40|0}o=p[b+4];b=o>>2}return r}ZE.X=1;function jF(b,c,d,e){var f,g=p[c>>2],h=p[b+12>>2],i=l[g|0];if(i<<24>>24==76){e=fE(b,p[g+12>>2],e)}else{if(i<<24>>24==73){V(h,10,0,e)}else{i=uE(b,g,0);g=p[g+24>>2];V(h,72,g,0);f=(d+60|0)>>2;var j=p[f];(j|0)==0&&(j=Xw(h),p[d+36>>2]=j,j=p[f]);var k=j+1|0;p[f]=k;j=d+64|0;b=Gl(p[b>>2],p[j>>2],k<<3);p[j>>2]=b;(b|0)==0?p[f]=0:(f=p[f]-1|0,p[((f<<3)+b|0)>>2]=g,i=(i|0)==1?V(h,65,g,e):gw(h,29,g,0,e),p[((f<<3)+b+4|0)>>2]=i,qw(h,73,e))}}kF(d,c);return e}jF.X=1;function lF(b,c,d,e,f,g,h){var i=p[c+4>>2],j=p[b+12>>2],k=p[c+24>>2],m=p[c+16>>2],o=b+72|0,r=p[o>>2],q=r+1|0,s=i+g|0;p[o>>2]=r+s|0;g=b|0;o=p[g>>2];r=bE(j,m);o=yl(o,r);(r=(o|0)!=0)||(l[p[g>>2]+30|0]=1);for(var g=m+8|0,u=c|0,w=c+32|0,s=(s|0)==1,v=q,q=0;;){if((q|0)>=(i|0)){break}var x=ZE(d,k,p[p[g>>2]+(q<<2)>>2],e,f,p[u>>2],m);if((x|0)==0){break}var A=v+q|0,E=jF(b,x,c,A);(E|0)!=(A|0)&&(s?(sx(b,v),v=E):V(j,15,E,A));(n[x+16>>1]&129)<<16>>16==0&&(x=p[p[x>>2]+12>>2],(mF(x)|0)!=0&&V(j,73,v+q|0,p[w>>2]),r&&(A=o+q|0,E=l[A],tE(x,E)<<24>>24==98&&(E=l[A]=98),(nF(x,E)|0)!=0&&(l[A]=98)));q=q+1|0}p[h>>2]=o;return v}lF.X=1;function oF(b,c,d,e){var f=p[b+12>>2],g=(e|0)==0;a:do{if(!g){for(var h=e,i=c,j=d;;){if((j|0)<=0){var k=j;break}if(l[h]<<24>>24!=98){k=j;break}h=h+1|0;i=i+1|0;j=j-1|0}for(;;){if((k|0)>1){j=k-1|0;if(l[h+j|0]<<24>>24!=98){break}k=j}else{if((k|0)>0){break}break a}}V(f,30,i,k);Dm(f,-1,h,k);cE(b,i,k)}}while(0)}function pF(b,c){var d=vE(b)<<24>>24;return(d|0)==98?1:(d|0)==97?c<<24>>24==97&1:c<<24>>24>98&1}function iF(b,c,d){var e,f,g=a;a+=28;var h;f=p[c+16>>2]>>2;var i=p[c+4>>2];e=p[f+2]>>2;if((i|0)==0){if((p[c>>2]&3145728|0)==0){var j=0;h=14}else{h=3}}else{h=3}if(h==3){Zg(g,0,0,1e9);p[g>>2]=b;uh(g,R.Hi|0,2);b=(i|0)>0;a:do{if(b){for(h=0;;){if(qF(g,h,p[(d>>2)+(p[(h<<2>>2)+e]*6|0)],R.Ii|0),h=h+1|0,(h|0)==(i|0)){var k=i;break a}}}else{k=0}}while(0);c|=0;b=p[c>>2];(b&2097152|0)==0?(i=k,c=b):(i=k+1|0,qF(g,k,(k|0)==(p[f+1]|0)?R.Z|0:p[(d>>2)+(p[(k<<2>>2)+e]*6|0)],R.Ji|0),c=p[c>>2]);(c&1048576|0)!=0&&qF(g,i,(k|0)==(p[f+1]|0)?R.Z|0:p[(d>>2)+(p[(k<<2>>2)+e]*6|0)],R.Ki|0);uh(g,R.ac|0,1);j=th(g)}a=g;return j}iF.X=1;function qF(b,c,d,e){(c|0)!=0&&uh(b,R.Li|0,5);uh(b,d,-1);uh(b,e,1);uh(b,R.Ba|0,1)}function hF(b,c,d,e){if((p[b+8>>2]|0)==(p[c+32>>2]|0)){if(n[b+16>>1]<<16>>16!=2){b=0}else{var f=b+24|0,b=(p[f>>2]&d)==0&&(p[f+4>>2]&e)==0?(pF(p[b>>2],l[p[p[c+12>>2]+12>>2]+p[b+12>>2]*24+22|0])|0)!=0&1:0}}else{b=0}return b}function eF(b,c,d,e,f,g,h,i){var j,k,m=p[b>>2],o=(f|0)==0;a:do{if(!o&&(h&262144|0)==0&&l[d+26|0]<<24>>24==0){var r=y[f>>2];j=(d+4|0)>>2;var q=m+44|0,s=d|0,u=d+8|0,w=d+16|0,v=d+40|0,x=d+44|0,A=p[f+12>>2],E=0,J=0,M=0;b:for(;;){if((J|0)>=(r|0)){p[i>>2]=(E|0)!=0&1;j=1;break a}if((M|0)>(p[j]|0)){var D=(E|0)!=0&1;k=28;break}var K=y[A>>2];if(l[K|0]<<24>>24!=-104){k=27;break}if((p[K+24>>2]|0)!=(e|0)){k=27;break}var H=bx(b,K),H=(H|0)==0?p[q>>2]:H;if((p[s>>2]|0)==0){k=16}else{if((M|0)<(p[j]|0)){var N=p[p[u>>2]+(M<<2)>>2],Q=(M<<2)+p[x>>2]|0,P=t[p[v>>2]+M|0]&255,N=(N|0)==(p[p[w>>2]+4>>2]|0)?-1:N;k=17}else{k=16}}k==16&&(Q=H|0,P=0,N=-1);K=(n[K+28>>1]<<16>>16|0)==(N|0);do{if(K){if((qm(p[H>>2],p[Q>>2])|0)!=0){k=19}else{var L=t[A+12|0]&255^P;if((M|0)>(g|0)){if((L|0)!=(E|0)){j=0;break a}var I=E}else{I=L}var X=J+1|0,L=A+20|0;(N|0)<0&&(rF(f,c,X,e)|0)==0&&(X=r);k=26}}else{k=19}}while(0);do{if(k==19){if((M|0)<(g|0)){L=A,I=E,X=J}else{if((M|0)==(p[j]|0)){k=27;break b}j=0;break a}}}while(0);A=L;E=I;J=X;M=M+1|0}k==27&&(D=(E|0)!=0&1);p[i>>2]=D;r=l[d+24|0]<<24>>24==0;do{if(!r&&(M|0)==(p[j]|0)&&(h&524288|0)==0&&(rF(f,c,J,e)|0)==0){j=1;break a}}while(0)}j=0}while(0);return j}eF.X=1;function cF(b){var c=b>10;a:do{if(c){for(var d=1,e=10;;){if(d+=1,e*=10,e>=b){var f=d;break a}}}else{f=1}}while(0);return f}function fF(b,c,d,e,f,g){var h,i=(p[d>>2]|0)==0|(f|0)==0;a:do{if(i){var j=0}else{var k=f|0,m=p[k>>2];if((m|0)>63){j=0}else{for(var o=f+12|0,r=0,q=0,j=0;;){if((r|0)>=(m|0)){break}h=p[(p[o>>2]>>2)+(r*5|0)];if(l[h|0]<<24>>24!=-104){j=0;break a}var m=h+24|0,s=ZE(c,p[m>>2],n[h+28>>1]<<16>>16,-1,-1,2,0);if((s|0)==0){h=9}else{if(s=p[s>>2],s=sE(b,p[s+8>>2],p[s+12>>2]),h=bx(b,h),(s|0)==(h|0)){var u=q,w=j;h=11}else{h=9}}if(h==9){if((p[m>>2]|0)!=(e|0)){j=0;break a}w=nc(1,0,"shl",r);u=w[1]|q;w=w[0]|j}r=r+1|0;q=u;j=w;m=p[k>>2]}k=d+4|0;for(o=g;;){var v=j==0&&q==0;if(v){break}if((o|0)>=(p[k>>2]|0)){break}r=$E(b,f,e,d,o);if((r|0)<0){break}r=nc(1,0,"shl",r);j&=r[0]^-1;q&=r[1]^-1;o=o+1|0}j=v&1}}}while(0);return j}fF.X=1;function dF(b,c,d,e,f,g,h,i,j){var k,m=a;a+=392;var o,r=m+36,q=y[d+32>>2],s=c+4|0;k=PE(p[s>>2],q);var u=k[0],w=k[1],v=p[c+24>>2],x=p[c+32>>2],A=x+v*40|0,E=l[d+29|0]<<24>>24==0;a:do{if(E&&(p[d+56>>2]|0)==0&&(n[c+22>>1]&128)<<16>>16==0&(v|0)>0){var J=(u^-1)&e,M=(w^-1)&f,D=m+20|0,K=m+8|0,H=m+28|0;k=(j+20|0)>>2;for(var N=c|0,Q=r|0,P=r+4|0,L=r+16|0,I=r+20|0,X=r+32|0,Y=r+22|0,da=r+24|0,ga=(i|0)==0,ha=j+28|0,ba=j+8|0,ea=j|0,ja=j+16|0,ra=x;;){var Va=n[ra+16>>1]<<16>>16==256;do{if(Va){var ta=ra+32|0,xa=ta|0,ta=ta+4|0;if((J&p[xa>>2])==0&&(M&p[ta>>2])==0){xa=p[ra+12>>2];ta=xa+356|0;o=ta|0;var Fa=ta+4|0;if(!((p[o>>2]&u)==0&&(p[Fa>>2]&w)==0)){for(var ta=p[xa+32>>2],xa=ta+p[xa+24>>2]*40|0,Na=0,Ea=0,La=0,za=0;;){if(ta>>>0>=xa>>>0){var Ba=Na,Ja=Ea,ka=La,S=za;break}if(n[ta+16>>1]<<16>>16==512){sF(b,p[ta+12>>2]|0,d,e,f,g,h,m),o=14}else{if((p[ta+8>>2]|0)!=(q|0)){var ib=Na,Wa=Ea,Za=La,Sa=za;o=15}else{p[Q>>2]=p[N>>2],p[P>>2]=p[s>>2],p[L>>2]=c,l[I]=69,p[X>>2]=ta,n[Y>>1]=0,p[da>>2]=1,sF(b,r,d,e,f,g,h,m),o=14}}if(o==14){o=(C[0]=p[D>>2],C[1]=p[D+4>>2],xd[0]);za+=o;o=(C[0]=p[K>>2],C[1]=p[K+4>>2],xd[0]);La+=o;o=H|0;Fa=H+4|0;Ea|=p[o>>2];Na|=p[Fa>>2];o=(C[0]=p[k],C[1]=p[k+1],xd[0]);if(za>=o){Ba=Na;Ja=Ea;ka=La;S=za;break}ib=Na;Wa=Ea;Za=La;Sa=za}Na=ib;Ea=Wa;La=Za;za=Sa;ta=ta+40|0}xa=ga?S:S+ka*cF(ka);ta=(C[0]=p[k],C[1]=p[k+1],xd[0]);xa<ta&&(xd[0]=xa,p[k]=C[0],p[k+1]=C[1],xa=ha|0,p[xa>>2]=Ja,ta=ha+4|0,p[ta>>2]=Ba,xd[0]=ka,p[ba>>2]=C[0],p[ba+4>>2]=C[1],p[ea>>2]=268435456,p[ja>>2]=ra)}}}}while(0);ra=ra+40|0;if(ra>>>0>=A>>>0){break a}}}}while(0);a=m}dF.X=1;function gF(b,c,d,e,f,g){var h,i=b+448|0,i=(C[0]=p[i>>2],C[1]=p[i+4>>2],xd[0]),j=i>1;a:do{if(j&&(p[p[b>>2]+12>>2]&134217728|0)!=0){var k=g|0;if((p[k>>2]&269430784|0)==0&&l[d+29|0]<<24>>24==0&&l[d+30|0]<<24>>24==0){h=y[p[d+12>>2]+24>>2]>>>0;var m=cF(h),o=m*2*(h/i+1);h=(g+20|0)>>2;var r=(C[0]=p[h],C[1]=p[h+1],xd[0]);if(o<r){for(var q=p[c+32>>2],r=q+p[c+24>>2]*40|0;;){if(q>>>0>=r>>>0){break a}if((hF(q,d,e,f)|0)!=0){break}q=q+40|0}xd[0]=o;p[h]=C[0];p[h+1]=C[1];h=g+8|0;xd[0]=m+1;p[h>>2]=C[0];p[h+4>>2]=C[1];p[k>>2]=536870912;k=q+24|0;m=p[k+4>>2];h=g+28|0;p[h>>2]=p[k>>2];p[h+4>>2]=m}}}}while(0)}gF.X=1;function sF(b,c,d,e,f,g,h,i){var j=a;a+=4;(l[p[d+12>>2]+34|0]&16)<<24>>24==0?QE(b,c,d,e,f,g,h,0,0,i):(p[j>>2]=0,RE(b,c,d,e,f,g,h,0,i,j),c=p[j>>2],(p[c+28>>2]|0)!=0&&Lg(p[c+24>>2]),vf(p[b>>2],c));a=j}function $E(b,c,d,e,f){var g=p[p[e+44>>2]+(f<<2)>>2],h=c|0,c=c+12|0,e=e+8|0,i=0;a:for(;;){if((i|0)>=(p[h>>2]|0)){var j=-1;break}var k=p[(p[c>>2]>>2)+(i*5|0)],m=l[k|0]<<24>>24==-104;do{if(m&&(n[k+28>>1]<<16>>16|0)==(p[p[e>>2]+(f<<2)>>2]|0)&&(p[k+24>>2]|0)==(d|0)){var o=bx(b,k);if((o|0)!=0&&(qm(p[o>>2],g)|0)==0){j=i;break a}}}while(0);i=i+1|0}return j}function rF(b,c,d,e){for(var f=PE(c,e),e=f[0]^-1,f=f[1]^-1,g=p[b>>2],b=b+12|0,h=d;;){if((h|0)>=(g|0)){var i=0;break}d=h+1|0;h=tF(c,p[(p[b>>2]>>2)+(h*5|0)]);if(!((h[0]&e)==0&&(h[1]&f)==0)){i=1;break}h=d}return i}function tF(b,c){if((c|0)==0){var d=0,e=0}else{if(l[c|0]<<24>>24==-104){e=PE(b,p[c+24>>2]),d=e[1],e=e[0]}else{var f=tF(b,p[c+12>>2]),e=f[0],d=f[1],g=tF(b,p[c+8>>2]),f=g[0],g=g[1],h=c+16|0,i=(n[c+2>>1]&2048)<<16>>16==0?uF(b,p[h>>2]):vF(b,p[h>>2]),h=i[1],i=i[0],d=g|d|h,e=f|e|i}}return[e,d]}tF.X=1;function vF(b,c){var d,e=(c|0)==0;a:do{if(e){var f=0,g=0}else{var h=0,i=0;d=c;for(d>>=2;;){var j=p[d+2],k=uF(b,p[d]),m=k[0],k=k[1],o=uF(b,p[d+4]),r=o[0],o=o[1],q=uF(b,p[d+6]),s=q[0],q=q[1],u=tF(b,p[d+3]),w=u[0],u=u[1],v=tF(b,p[d+5]),i=m|i|r|s|w|v[0],h=k|h|o|q|u|v[1],m=(j|0)==0;b:do{if(m){var x=h,A=i}else{if(k=n[j>>1],k<<16>>16>0){k=k<<16>>16;r=h;s=i;for(o=0;;){if(w=vF(b,p[(j+20>>2)+(o*15|0)]),q=w[0],w=w[1],u=tF(b,p[(j+40>>2)+(o*15|0)]),s=q|s|u[0],r=w|r|u[1],o=o+1|0,(o|0)>=(k|0)){x=r;A=s;break b}}}else{x=h,A=i}}}while(0);d=p[d+7];if((d|0)==0){f=x;g=A;break a}h=x;i=A;d>>=2}}}while(0);return[g,f]}vF.X=1;function uF(b,c){var d=(c|0)==0;a:do{if(d){var e=0,f=0}else{var g=p[c>>2];if((g|0)>0){for(var h=p[c+12>>2],i=0,j=0,k=0;;){var m=tF(b,p[(h>>2)+(i*5|0)]);k|=m[0];j|=m[1];i=i+1|0;if((i|0)>=(g|0)){e=j;f=k;break a}}}else{f=e=0}}}while(0);return[f,e]}function aF(b,c,d,e){var f=c+32|0,c=(c+24|0)>>2,g=y[c],h=(g|0)>0;a:do{if(h){for(var i=p[d+32>>2],j=0,k=0,m=p[f>>2];;){k=(p[m+8>>2]|0)==(i|0)?((n[m+16>>1]&129)<<16>>16==0&1)+k|0:k;j=j+1|0;if((j|0)>=(g|0)){var o=k;break a}m=m+40|0}}else{o=0}}while(0);h=(e|0)==0;do{if(h){g=0}else{g=e+12|0;i=y[e>>2];m=d+32|0;for(j=0;;){if((j|0)>=(i|0)){break}k=p[(p[g>>2]>>2)+(j*5|0)];if(l[k|0]<<24>>24!=-104){break}if((p[k+24>>2]|0)!=(p[m>>2]|0)){break}j=j+1|0}g=(j|0)!=(i|0)?0:i}}while(0);h=ni(p[b>>2],(g<<3)+o*20+44|0);i=(h|0)==0;a:do{if(i){ym(b,R.ca|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));var r=0}else{j=h+44|0;m=j+o*12|0;k=(g<<3)+m|0;p[h>>2]=o;p[(h+8|0)>>2]=g;p[(h+4|0)>>2]=j;p[(h+12|0)>>2]=m;p[(h+16|0)>>2]=k;var k=p[c],q=(k|0)>0;b:do{if(q){for(var s=d+32|0,u=0,w=0,v=p[f>>2],x=k;;){if((p[v+8>>2]|0)==(p[s>>2]|0)){var A=v+16|0;(n[A>>1]&129)<<16>>16==0&&(p[(j+w*12|0)>>2]=p[v+12>>2],p[(j+w*12+8|0)>>2]=u,l[j+w*12+4|0]=n[A>>1]&255,w=w+1|0,x=p[c])}u=u+1|0;if((u|0)>=(x|0)){break b}v=v+40|0}}}while(0);if((g|0)>0){j=e+12|0;for(k=0;;){if(p[((k<<3)+m|0)>>2]=n[p[(p[j>>2]>>2)+(k*5|0)]+28>>1]<<16>>16,l[(k<<3)+m+4|0]=l[p[j>>2]+k*20+12|0],k=k+1|0,(k|0)==(g|0)){r=h;break a}}}else{r=h}}}while(0);return r}aF.X=1;function bF(b,c,d){var e=b|0,f=p[iw(p[e>>2],c)+8>>2],g=Gd[p[p[f>>2]+12>>2]](f,d);(g|0)!=0&&((g|0)==7?l[p[e>>2]+30|0]=1:(e=p[f+8>>2],(e|0)==0?(g=ok(g),ym(b,R.d|0,(z=a,a+=4,p[z>>2]=g,z))):ym(b,R.d|0,(z=a,a+=4,p[z>>2]=e,z))));f=f+8|0;Lg(p[f>>2]);p[f>>2]=0;f=d|0;g=p[f>>2];e=(g|0)>0;a:do{if(e){for(var h=d+4|0,i=d+16|0,j=c|0,k=0,m=g;;){if(l[p[h>>2]+k*12+5|0]<<24>>24==0&&(p[p[i>>2]+(k<<3)>>2]|0)>0&&(m=p[j>>2],ym(b,R.Ni|0,(z=a,a+=4,p[z>>2]=m,z)),m=p[f>>2]),k=k+1|0,(k|0)>=(m|0)){break a}}}}while(0);return p[b+64>>2]}bF.X=1;function wF(b){return((b|0)==72|(b-76|0)>>>0<5?1:(b|0)==73)&1}function xF(b){return(b|0)==72?1:(b|0)==73?128:2<<b-76&65535}function YE(b,c){var d,e,f,g,h,i,j,k=a;a+=12;var m,o=k+4;j=o>>2;var r=k+8;i=r>>2;p[k>>2]=0;p[j]=0;p[i]=0;var q=y[b>>2],s=y[q>>2],u=s+30|0,w=l[u]<<24>>24==0;a:do{if(w){h=(b+32|0)>>2;var v=y[h],x=v+c*40|0,A=y[b+4>>2],E=y[x>>2];g=(E+8|0)>>2;var J=tF(A,p[g]),M=J[0],D=J[1],K=E|0,H=t[K],N=H&255;if(H<<24>>24==72){var Q=E+16|0;if((n[E+2>>1]&2048)<<16>>16==0){var P=uF(A,p[Q>>2]),L=P[0],I=P[1],X=v+c*40+24|0,Y=X|0;f=Y>>2;p[f]=L;var da=X+4|0;e=da>>2;var ga=p[e]=I,ha=L}else{var ba=vF(A,p[Q>>2]),ea=ba[0],ja=ba[1],ra=v+c*40+24|0,Y=ra|0;f=Y>>2;p[f]=ea;da=ra+4|0;e=da>>2;ga=p[e]=ja;ha=ea}}else{if(H<<24>>24==73){var Va=v+c*40+24|0;p[Va>>2]=0;ha=ga=p[Va+4>>2]=0}else{var ta=tF(A,p[E+12>>2]),xa=ta[0],Fa=ta[1],Na=v+c*40+24|0,Y=Na|0;f=Y>>2;p[f]=xa;da=Na+4|0;e=da>>2;ga=p[e]=Fa;ha=xa}}var Ea=tF(A,E),La=Ea[0],za=Ea[1];if((n[E+2>>1]&1)<<16>>16==0){var Ba=0,Ja=0,ka=za,S=La}else{var ib=PE(A,n[E+32>>1]<<16>>16),Wa=ib[0],Za=ib[1],Sa=Wa|La,tb=Za|za,pb=(T.add(Wa,Za,-1,-1),T.result[0]),Ba=T.result[1],Ja=pb,ka=tb,S=Sa}var fb=v+c*40+32|0,Xa=fb|0;p[Xa>>2]=S;var Ab=fb+4|0;p[Ab>>2]=ka;var rb=v+c*40+8|0;p[rb>>2]=-1;p[(v+4>>2)+(c*10|0)]=-1;var cb=v+c*40+16|0;n[cb>>1]=0;var Cb=(wF(N)|0)==0;do{if(Cb){m=22}else{if((ha&M)==0&&(ga&D)==0){var Zb=p[g],dc=p[E+12>>2];if(l[Zb|0]<<24>>24==-104){var kb=p[Zb+24>>2];p[rb>>2]=kb;p[(v+12>>2)+(c*10|0)]=n[Zb+28>>1]<<16>>16;n[cb>>1]=xF(N);var Oa=kb}else{Oa=-1}if((dc|0)==0){var Db=x}else{if(l[dc|0]<<24>>24!=-104){Db=x}else{if((Oa|0)>-1){var Wb=Pv(s,E,0);if(l[u]<<24>>24!=0){Df(s,Wb);break a}var Nb=XE(b,Wb,3);if((Nb|0)==0){break a}var $b=p[h],Rb=$b+Nb*40|0;p[($b+Nb*40+4|0)>>2]=c;var Ra=p[h],Ob=Ra+c*40|0;l[Ra+c*40+19|0]=1;l[Ra+c*40+18|0]|=8;var Ua=Wb,Jb=Ob,Vb=Rb}else{Ua=E,Vb=Jb=x}yF(q,Ua);var Pb=p[Ua+8>>2];p[Vb+8>>2]=p[Pb+24>>2];p[Vb+12>>2]=n[Pb+28>>1]<<16>>16;var sb=Ba|D,db=Vb+24|0;p[db>>2]=Ja|M;p[db+4>>2]=sb;var wb=Vb+32|0;p[wb>>2]=S;p[wb+4>>2]=ka;n[Vb+16>>1]=xF(t[Ua|0]&255);Db=Jb}}m=26}else{m=22}}}while(0);if(m==22){var ob=l[K];if(ob<<24>>24==71){if(l[b+20|0]<<24>>24!=69){Db=x}else{var Kb=p[E+16>>2]+12|0,ub=Pv(s,p[g],0),Xb=Pv(s,p[p[Kb>>2]>>2],0),Sb=$u(q,80,ub,Xb,0),Qb=XE(b,Sb,3);YE(b,Qb);p[(p[h]+Qb*40+4|0)>>2]=c;var ac=Pv(s,p[g],0),Gb=Pv(s,p[p[Kb>>2]+20>>2],0),xb=$u(q,78,ac,Gb,0),Ta=XE(b,xb,3);YE(b,Ta);var qb=p[h];p[(qb+Ta*40+4|0)>>2]=c;var bc=qb+c*40|0;l[qb+c*40+19|0]=2;Db=bc}}else{ob<<24>>24==68?(zF(b,c),Db=p[h]+c*40|0):Db=x}}if(l[b+20|0]<<24>>24==69){if((AF(q,E,k,o,r)|0)==0){var $a=Db}else{var mb=p[p[p[E+16>>2]+12>>2]+20>>2],Bb=y[k>>2],bb=Pv(s,Bb,0);if(l[u]<<24>>24==0){var jb=p[bb+4>>2],nb=jb+(ve(jb)-1)|0,zb=t[nb],Tb=y[i];if((Tb|0)==0){var ec=zb}else{var Hb=zb&255;zb<<24>>24==64&&(p[j]=0);ec=l[R.i+Hb|0]}l[nb]=ec+1&255;var Eb=Tb}else{Eb=p[i]}var Lb=wo(s,1,(Eb|0)!=0?R.Db|0:R.w|0,0),gb=Pv(s,mb,0),Mb=bC(gb,Lb),vc=$u(q,80,Mb,Bb,0),hc=XE(b,vc,3);YE(b,hc);var kc=Pv(s,mb,0),pc=bC(kc,Lb),jc=$u(q,79,pc,bb,0),mc=XE(b,jc,3);YE(b,mc);var Fb=p[h],Ub=Fb+c*40|0;(p[j]|0)!=0&&(p[(Fb+hc*40+4|0)>>2]=c,p[(p[h]+mc*40+4|0)>>2]=c,l[Fb+c*40+19|0]=2);$a=Ub}}else{$a=Db}if(l[E|0]<<24>>24==-105){if((qm(p[E+4>>2],R.Tb|0)|0)!=0){var Ya=0}else{var Pa=p[E+16>>2],Ya=(p[Pa>>2]|0)!=2?0:l[p[p[Pa+12>>2]+20>>2]|0]<<24>>24==-104&1}}else{Ya=0}if((Ya|0)==0){var yb=$a}else{var Ka=p[p[E+16>>2]+12>>2],Ac=p[Ka>>2],Jc=p[Ka+20>>2],uc=tF(A,Ac),Tc=uc[0],Yc=uc[1],ua=tF(A,Jc);if((ua[0]&Tc)==0&&(ua[1]&Yc)==0){var md=Pv(s,Ac,0),nd=$u(q,50,0,md,0),Bc=XE(b,nd,3),Qc=p[h],Oc=Qc+Bc*40+24|0,Xa=Oc|0;p[Xa>>2]=Tc;Ab=Oc+4|0;p[Ab>>2]=Yc;p[(Qc+Bc*40+8|0)>>2]=p[Jc+24>>2];p[(Qc+Bc*40+12|0)>>2]=n[Jc+28>>1]<<16>>16;n[(Qc+16>>1)+(Bc*20|0)]=64;p[(Qc+Bc*40+4|0)>>2]=c;var ed=p[h],Fc=ed+c*40|0;l[ed+c*40+19|0]=1;l[ed+c*40+18|0]|=8;var ud=ed+c*40+32|0,Rc=p[ud+4>>2],Yb=Qc+Bc*40+32|0;p[(Yb|0)>>2]=p[ud>>2];p[(Yb+4|0)>>2]=Rc;yb=Fc}else{yb=$a}}d=(yb+24|0)>>2;var W=p[d+1]|Ba;p[d]|=Ja;p[d+1]=W}}while(0);a=k}YE.X=1;function XE(b,c,d){var e,f,g;f=(b+24|0)>>2;var h=y[f];g=b+28|0;var i=p[g>>2];e=(b+32|0)>>2;if((h|0)<(i|0)){var j=h;g=9}else{var h=p[e],k=p[p[b>>2]>>2],i=zh(k,i*80|0);p[e]=i;if((i|0)==0){(d&1)<<24>>24!=0&&Df(k,c);p[e]=h;var m=0;g=10}else{Ah(i,h,p[f]*40|0),(h|0)!=(b+36|0)&&vf(k,h),j=Dl(k,p[e]),p[g>>2]=Math.floor((j>>>0)/40),j=p[f],g=9}}g==9&&(p[f]=j+1|0,f=y[e],e=f>>2,p[e+(j*10|0)]=c,l[f+j*40+18|0]=d,p[e+(j*10|0)+5]=b,p[e+(j*10|0)+1]=-1,m=j);return m}XE.X=1;function yF(b,c){var d,e;e=(c+12|0)>>2;var f=p[e],g=n[f+2>>1]&256;d=(c+8|0)>>2;var h=n[p[d]+2>>1]&256,f=bx(b,f);p[(p[e]+20|0)>>2]=f;f=bx(b,p[d]);p[(p[d]+20|0)>>2]=f;var f=p[e]+20|0,i=p[f>>2];p[f>>2]=p[p[d]+20>>2];p[(p[d]+20|0)>>2]=i;f=p[e]+2|0;n[f>>1]=n[f>>1]&-257|h;h=p[d]+2|0;n[h>>1]=n[h>>1]&-257|g;g=p[e];p[e]=p[d];p[d]=g;d=c|0;e=t[d];(e&255)>76&&(l[d]=(e-77&255^2)+77&255)}yF.X=1;function zF(b,c){var d,e,f,g,h,i;i=(b|0)>>2;var j=y[i],k=y[j>>2],m=b+32|0,o=y[m>>2],r=o+c*40|0,q=y[r>>2],s=y[b+4>>2],u=ni(k,364);p[(o+12>>2)+(c*10|0)]=u;var w=(u|0)==0;do{if(!w){l[o+c*40+18|0]|=16;var v=u,x=b+22|0;LE(v,p[i],s,n[x>>1]);ME(v,q,68);NE(v);var A=k+30|0;if(l[A]<<24>>24==0){var E=b+8|0,J=p[E>>2]^-1,M=p[E+4>>2]^-1;h=(u+24|0)>>2;var D=p[h];g=(u+32|0)>>2;if((D|0)<1){var K=-1,H=-1,N=M,Q=J,P=256}else{var L=-1,I=-1,X=M,Y=J,da=p[g];f=da>>2;for(var ga=D;;){var ha=ga-1|0,ba=da+16|0,ea=Vc[ba>>1],ja=(ea&255)<<16>>16==0;do{if(ja){var ra=zh(k,356);e=ra>>2;if((ra|0)==0){var Va=0,ta=0,xa=L,Fa=I}else{p[f+3]=ra;l[da+18|0]|=32;n[ba>>1]=512;var Na=ra;LE(Na,p[i],s,n[x>>1]);ME(Na,p[f],69);NE(Na);p[e+4]=b;var Ea=l[A]<<24>>24==0;a:do{if(Ea){var La=y[e+6];if((La|0)>0){for(var za=p[e+8],Ba=0,Ja=0,ka=0;;){if((wF(t[p[za>>2]|0]&255)|0)==0){var S=Ja,ib=ka}else{var Wa=PE(s,p[za+8>>2]),S=Wa[1]|Ja,ib=Wa[0]|ka}var Za=Ba+1|0;if((Za|0)>=(La|0)){Sa=S;tb=ib;break a}za=za+40|0;Ba=Za;Ja=S;ka=ib}}else{var Sa=0,tb=0}}else{tb=Sa=0}}while(0);ta=Va=0;xa=Sa&L;Fa=tb&I}}else{var pb=l[da+18|0];if((pb&8)<<24>>24!=0){Va=X,ta=Y,xa=L,Fa=I}else{var fb=PE(s,p[f+2]),Xa=fb[0],Ab=fb[1];if((pb&2)<<24>>24==0){var rb=Ab,cb=Xa}else{var Cb=PE(s,p[(p[g]+8>>2)+(p[f+1]*10|0)]),rb=Cb[1]|Ab,cb=Cb[0]|Xa}var Zb=ea<<16>>16==2,dc=Zb?cb&Y:0,Va=Zb?rb&X:0,ta=dc,xa=rb&L,Fa=cb&I}}}while(0);var kb=Fa==0&&xa==0;if((ha|0)<1|kb){break}L=xa;I=Fa;X=Va;Y=ta;da=da+40|0;f=da>>2;ga=ha}var Oa=kb?0:256,K=xa,H=Fa,N=Va,Q=ta,P=Oa}var Db=u+356|0;p[Db>>2]=H;p[Db+4>>2]=K;n[(o+16>>1)+(c*20|0)]=P;if(!(Q==0&&N==0)){for(var Wb=0,Nb=-1,$b=-1,Rb=0;;){var Ra=(Rb|0)==0;if(!((Wb|0)<2&Ra)){break}var Ob=p[h],Ua=p[g];a:for(;;){var Jb=Ob-1|0;if((Ob|0)<=0){var Vb=Nb,Pb=$b;break}l[Ua+18|0]&=-65;var sb=p[Ua+8>>2],db=(sb|0)==(Nb|0);do{if(!db){var wb=PE(s,sb);if(!((wb[0]&Q)==0&&(wb[1]&N)==0)){Vb=sb;Pb=p[Ua+12>>2];break a}}}while(0);Ob=Jb;Ua=Ua+40|0}if((Jb|0)<0){break}var ob=Ua;d=ob>>2;for(var Kb=Jb;;){if((p[d+2]|0)==(Vb|0)){if((p[d+3]|0)!=(Pb|0)){var ub=0;break}var Xb=p[d],Sb=iD(p[Xb+12>>2]);if(!(Sb<<24>>24==0|Sb<<24>>24==iD(p[Xb+8>>2])<<24>>24)){ub=0;break}l[ob+18|0]|=64}else{l[ob+18|0]&=-65}var Qb=Kb-1|0;if((Qb|0)<0){ub=1;break}ob=ob+40|0;d=ob>>2;Kb=Qb}Wb=Wb+1|0;Nb=Vb;$b=Pb;Rb=ub}if(!Ra){var ac=p[h],Gb=(ac|0)>0;a:do{if(Gb){for(var xb=p[g],Ta=0,qb=0,bc=ac;;){var $a=bc-1|0;if((l[xb+18|0]&64)<<24>>24==0){var mb=qb,Bb=Ta}else{var bb=xb|0,jb=Pv(k,p[p[bb>>2]+12>>2],0),nb=mv(p[p[i]>>2],Ta,jb),mb=p[p[bb>>2]+8>>2],Bb=nb}if(($a|0)<=0){var zb=Bb,Tb=mb;break a}xb=xb+40|0;Ta=Bb;qb=mb;bc=$a}}else{Tb=zb=0}}while(0);var ec=Pv(k,Tb,0),Hb=$u(j,72,ec,0,0);if((Hb|0)==0){Lu(k,zb);var Eb=r}else{var Lb=Hb,gb=q;n[(Lb+2|0)>>1]|=n[gb+2>>1]&1;n[Lb+32>>1]=n[gb+32>>1];p[Hb+16>>2]=zb;var Mb=XE(b,Hb,3);YE(b,Mb);var vc=p[m>>2],hc=vc+c*40|0;p[(vc+Mb*40+4|0)>>2]=c;l[vc+c*40+19|0]=1;Eb=hc}n[Eb+16>>1]=2048}}}}}while(0)}zF.X=1;function BF(b,c){(c|0)>32?p[b+180>>2]=-1:p[(b+180|0)>>2]|=1<<c-1}function HE(b){var c=p[b+428>>2];l[((c|0)==0?b:c)+348|0]=1}function AF(b,c,d,e,f){var g=a;a+=4;var h,i=y[b>>2],j=g|0;if(l[c|0]<<24>>24==-105){var k=p[c+16>>2];if((k|0)==0){f=0}else{if((p[k>>2]|0)!=2){f=0}else{var k=p[c+4>>2],m=go(i,k,ve(k),2,1,0);(m|0)==0?f=0:(k=m+3|0,(l[k]&1)<<24>>24==0?f=0:(m=p[m+4>>2],l[j]=l[m],l[j+1]=l[m+1],l[j+2]=l[m+2],p[f>>2]=((t[k]&255)>>>1&1^1)&255,f=1))}}}else{f=0}f=(f|0)==0;do{if(f){k=0}else{if(k=p[p[c+16>>2]+12>>2],m=p[k+20>>2],l[m|0]<<24>>24!=-104){k=0}else{if(iD(m)<<24>>24!=97){k=0}else{k=y[k>>2];m=l[k|0];h=m<<24>>24==-124?l[k+35|0]:m;if(m=h<<24>>24==-123){var o=n[k+28>>1]<<16>>16;h=p[b+468>>2];if((h|0)==0){var r=0}else{var q=o-1|0,s=p[h+72>>2],r=s+q*40|0;(n[(s+28>>1)+(q*20|0)]&1)<<16>>16!=0?r=0:(h=hi(p[h>>2]),(h|0)==0?r=0:(ll(h,r),WC(h,98,1),Ql(h),r=h))}h=r;r=(h|0)==0?0:(lk(h)|0)!=3?0:wk(h);BF(p[b+12>>2],o);o=h;h=13}else{if(h<<24>>24!=94){var u=0,w=0;h=28}else{o=0,r=p[k+4>>2],h=13}}do{if(h==13){if((r|0)==0){u=0}else{w=l[j];q=l[g+1|0];s=l[g+2|0];for(u=0;;){var v=l[r+u|0],x=v<<24>>24==w<<24>>24;if(v<<24>>24==0|x){break}if(v<<24>>24==q<<24>>24|v<<24>>24==s<<24>>24){break}u=u+1|0}(u|0)==0?u=0:l[r+(u-1)|0]<<24>>24==-1?u=0:(p[e>>2]=(x?l[u+(r+1)|0]<<24>>24==0:0)&1,w=ov(i,94,r),(w|0)!=0&&(l[p[w+4>>2]+u|0]=0),p[d>>2]=w,m&&(u=y[b+12>>2],BF(u,n[k+28>>1]<<16>>16),(p[e>>2]|0)!=0&&l[p[k+4>>2]+1|0]<<24>>24!=0&&(w=rx(b),fE(b,k,w),um(u,p[u+28>>2]-1|0,0),sx(b,w))),u=r)}w=o}}while(0);Hn(w);k=(u|0)!=0&1}}}}while(0);a=g;return k}AF.X=1;function CF(b,c){var d,e=p[b+8>>2],f=c|0,g=t[f]&255;a:do{if((g|0)==72||(g|0)==132){var h=1;d=12}else{if((g|0)==151||(g|0)==153||(g|0)==155){var i=y[c+16>>2];if((i|0)==0){d=8}else{var j=y[i>>2];if((j|0)>0){for(i=p[i+12>>2];;){var k=p[i>>2];(k|0)!=0&&(n[(k+2|0)>>1]|=512);j=j-1|0;if((j|0)<=0){d=8;break a}i=i+20|0}}else{d=8}}}else{d=8}}}while(0);if(d==8){d=(Aw(c,3)|0)==0;do{if(d){g=0}else{if((n[c+2>>1]&512)<<16>>16==0){g=1}else{g=l[c|0];h=g<<24>>24==-99;a:do{if(h){for(j=c;;){if(j=p[j+8>>2],i=l[j|0],i<<24>>24!=-99){var m=j,o=i;break a}}}else{m=c,o=g}}while(0);g=o&255;g=(g|0)==131||(g|0)==133||(g|0)==129||(g|0)==130||(g|0)==98||(g|0)==94?0:(g|0)==156&&(l[p[m+8>>2]|0]+127&255)<2?0:1}}}while(0);(g|0)==0?h=0:(o=e+72|0,m=p[o>>2]+1|0,p[o>>2]=m,o=fE(e,c,m),(m|0)!=(o|0)&&sx(e,m),l[c+35|0]=l[f],l[f]=-124,p[c+24>>2]=o,h=1)}return h}CF.X=1;function Gx(b,c,d,e){var f,g,h=d>>2,i=c>>2,j=(b&67108864|0)==0;a:do{if(j){var k=0}else{if((d|0)==0){k=((PC(p[i],p[i+17])|0)==0?(p[i+9]|0)!=0:1)&1}else{var b=(c+4|0)>>2,m=(e|0)==0;for(g=c+36|0;;){var o=y[g>>2];g=o>>2;if((o|0)==0){break}f=y[g+5];b:do{if(m){for(var r=0;;){if((r|0)>=(f|0)){break b}if((p[(p[((r<<3)+36>>2)+g]<<2>>2)+h]|0)>-1){k=1;break a}r=r+1|0}}else{for(r=0;;){if((r|0)>=(f|0)){break b}var q=p[((r<<3)+36>>2)+g];if((p[(q<<2>>2)+h]|0)>-1){k=1;break a}if((q|0)==(p[b]|0)){k=1;break a}r=r+1|0}}}while(0);g=o+4|0}f=PC(p[i],p[i+17]);o=c+8|0;g=(c+12|0)>>2;r=f;for(f=r>>2;;){if((r|0)==0){k=0;break a}r=p[f+5];for(q=0;;){if((q|0)>=(r|0)){break}var s=y[((q<<3)+40>>2)+f],u=p[o>>2],w=(s|0)==0;b:do{if(w){if(m){for(var v=0;;){if((v|0)>=(u|0)){break b}if(l[p[g]+v*24+21|0]<<24>>24!=0&&(p[(v<<2>>2)+h]|0)>-1){k=1;break a}v=v+1|0}}else{for(v=0;;){if((v|0)>=(u|0)){break b}if(l[p[g]+v*24+21|0]<<24>>24!=0){if((p[(v<<2>>2)+h]|0)>-1){k=1;break a}if((v|0)==(p[b]|0)){k=1;break a}}v=v+1|0}}}else{if(m){for(v=0;;){if((v|0)>=(u|0)){break b}if((qm(p[(p[g]>>2)+(v*6|0)],s)|0)==0&&(p[(v<<2>>2)+h]|0)>-1){k=1;break a}v=v+1|0}}else{for(v=0;;){if((v|0)>=(u|0)){break b}if((qm(p[(p[g]>>2)+(v*6|0)],s)|0)==0){if((p[(v<<2>>2)+h]|0)>-1){k=1;break a}if((v|0)==(p[b]|0)){k=1;break a}}v=v+1|0}}}}while(0);q=q+1|0}r=p[f+3];f=r>>2}}}}while(0);return k}Gx.X=1;function Ix(b,c,d,e,f,g,h){var i,j=y[b+12>>2],k=Xw(j);gw(j,54,d,k,e);if((Gx(p[p[b>>2]+12>>2],c,0,0)|0)==0&(g|0)==0){e=0}else{i=jA(b,g,0,0,3,c,h);var m=hA(b,c)|i,o=b+72|0,r=p[o>>2],q=r+1|0;i=(c+8|0)>>2;p[o>>2]=q+p[i]|0;V(j,14,e,q);var o=p[i],s=(o|0)>0;a:do{if(s){var u=r+2|0;if((m|0)==-1){for(var w=0;;){if(LA(j,c,d,w,u+w|0),w=w+1|0,(w|0)>=(p[i]|0)){break a}}}else{for(var w=0,v=o;;){if((1<<w&m|0)!=0&&(LA(j,c,d,w,u+w|0),v=p[i]),w=w+1|0,(w|0)>=(v|0)){break a}}}}}while(0);rB(b,g,106,0,1,c,q,h,k);gw(j,54,d,k,e);TB(b,c,q,0);e=q}(p[c+28>>2]|0)==0&&(UB(b,p[c+16>>2],d,0),f=(f|0)!=0,V(j,59,d,f&1),f&&Dm(j,-1,p[c>>2],0));WB(b,c,0,e);rB(b,g,106,0,2,c,e,h,k);wx(j,k)}Ix.X=1;function UB(b,c,d,e){var f=(c|0)==0;a:do{if(!f){var g=b+12|0;if((e|0)==0){for(var h=1,i=c;;){var j=yC(b,i,d,0,0);gw(p[g>>2],98,h+d|0,j,p[i+4>>2]+1|0);i=p[i+32>>2];if((i|0)==0){break a}h=h+1|0}}else{h=1;for(i=c;;){(p[e+(h-1<<2)>>2]|0)!=0&&(j=yC(b,i,d,0,0),gw(p[g>>2],98,h+d|0,j,p[i+4>>2]+1|0));i=p[i+32>>2];if((i|0)==0){break a}h=h+1|0}}}}while(0)}function jA(b,c,d,e,f,g,h){var i=(d|0)!=0?107:106,j=(c|0)==0;a:do{if(j){var k=0}else{for(var m=0,o=c;;){if((t[o+8|0]&255|0)==(i|0)&&(t[o+9|0]&255&f|0)!=0&&(CE(p[o+16>>2],d)|0)!=0){var r=DF(b,o,g,h),m=(r|0)==0?m:p[r+(e<<2)+12>>2]|m}o=y[o+32>>2];if((o|0)==0){k=m;break a}}}}while(0);return k}function hA(b,c){var d,e=a;a+=4;var f=(p[p[b>>2]+12>>2]&67108864|0)==0;a:do{if(f){var g=0}else{var h=p[c+36>>2],i=(h|0)==0;b:do{if(i){var j=0}else{var k=0;d=h;for(d>>=2;;){var m=p[d+5],o=(m|0)>0;c:do{if(o){for(var r=k,q=0;;){var s=p[((q<<3)+36>>2)+d];r|=(s|0)>31?-1:1<<s;q=q+1|0;if((q|0)>=(m|0)){var u=r;break c}}}else{u=k}}while(0);d=p[d+1];if((d|0)==0){j=u;break b}k=u;d>>=2}}}while(0);i=PC(p[c>>2],p[c+68>>2]);if((i|0)==0){g=j}else{for(h=j;;){p[e>>2]=0;IE(b,c,i,e,0);k=p[e>>2];d=(k|0)==0;b:do{if(d){var w=h}else{if(m=p[k+4>>2],(m|0)>0){o=p[k+8>>2];r=h;for(q=0;;){if(s=p[o+(q<<2)>>2],r|=(s|0)>31?-1:1<<s,q=q+1|0,(q|0)>=(m|0)){w=r;break b}}}else{w=h}}}while(0);i=p[i+12>>2];if((i|0)==0){g=w;break a}h=w}}}}while(0);a=e;return g}hA.X=1;function WB(b,c,d,e){var f=(p[p[b>>2]+12>>2]&67108864|0)==0;a:do{if(!f){var g=PC(p[c>>2],p[c+68>>2]);if((g|0)!=0){for(;;){var h=EF(b,c,g,d);(h|0)!=0&&GE(b,h,c,e,2,0);g=p[g+12>>2];if((g|0)==0){break a}}}}}while(0)}function EF(b,c,d,e){var f,g,h=a;a+=48;var i,j=h+4;g=j>>2;var k=h+8,m=h+16,o=h+24,r=h+32,q=h+40;f=(b|0)>>2;var s=p[f],e=(e|0)!=0,u=e&1,w=t[d+(u+25)|0],v=w&255,u=(u<<2)+d+28|0,x=y[u>>2],A=w<<24>>24!=0&(x|0)==0;do{if(A){if(p[h>>2]=0,p[g]=0,(IE(b,c,d,h,j)|0)!=0){var E=0}else{var E=d+20|0,J=(p[E>>2]|0)>0;a:do{if(J){for(var M=k,D=FF,K=p[D>>2],D=p[D+4>>2],H=m,N=GF,Q=N|0,P=p[Q>>2],Q=N+4|0,N=p[Q>>2],L=d+36|0,I=p[h>>2],X=(I|0)==0,Y=r|0,da=d|0,ga=o|0,ha=r+4|0,ba=o+4|0,I=I+8|0,ea=c+12|0,ja=0,ra=0,Va=0,ta=0;;){p[M>>2]=K;p[M+4>>2]=D;Q=H|0;p[Q>>2]=P;Q=H+4|0;p[Q>>2]=N;Q=p[g];Q=p[((Q|0)==0?L:(Va<<2)+Q|0)>>2];i=X?R.Xi|0:p[(p[ea>>2]>>2)+(p[p[I>>2]+(Va<<2)>>2]*6|0)];p[Y>>2]=i;var xa=p[(p[p[da>>2]+12>>2]>>2)+(Q*6|0)];p[ga>>2]=xa;p[ha>>2]=ve(i);p[ba>>2]=ve(xa);i=$u(b,26,0,0,k);xa=$u(b,26,0,0,r);i=$u(b,118,i,xa,0);xa=$u(b,26,0,0,o);i=$u(b,76,i,xa,0);ja=Jw(s,ja,i);if(e){i=$u(b,26,0,0,k);xa=$u(b,26,0,0,r);i=$u(b,118,i,xa,0);var xa=$u(b,26,0,0,m),Fa=$u(b,26,0,0,r),xa=$u(b,118,xa,Fa,0);i=$u(b,70,i,xa,0);ta=Jw(s,ta,i)}do{if(w<<24>>24==6){var Na=ra;i=20}else{if(w<<24>>24==9){if(!e){Na=ra;i=20;break}var Ea=$u(b,26,0,0,m);i=$u(b,26,0,0,r);Ea=$u(b,118,Ea,i,0)}else{if(w<<24>>24==8){Ea=p[(p[p[da>>2]+12>>2]+4>>2)+(Q*6|0)];if((Ea|0)==0){Ea=$u(b,98,0,0,0);i=19;break}Ea=Pv(s,Ea,0)}else{Ea=$u(b,98,0,0,0)}}i=19}}while(0);i==19&&(Na=mv(p[f],ra,Ea),nv(b,Na,o,0));Va=Va+1|0;if((Va|0)>=(p[E>>2]|0)){var La=ja,za=Na,Ba=ta,Ja=da;break a}ra=Na}}else{Ba=za=La=0,Ja=d|0}}while(0);vf(s,p[g]);N=p[p[Ja>>2]>>2];L=ve(N);w<<24>>24==6?(p[q>>2]=N,p[q+4>>2]=L,E=ov(s,56,R.ma|0),(E|0)!=0&&(l[E+1|0]=2),E=mv(p[f],0,E),J=sv(s,0,q,0),M=lv(b,E,J,La,0,0,0,0,0,0),K=0):(M=0,K=La);D=s+234|0;H=l[D];l[D]=0;J=E=ni(s,L+77|0);(E|0)==0?(N=Ba,P=0):(P=E+36|0,p[(E+28|0)>>2]=P,X=E+76|0,p[(E+48|0)>>2]=X,p[(E+52|0)>>2]=L,Ah(X,N,L),N=Pv(s,K,1),p[(E+56|0)>>2]=N,N=Ov(s,za,1),p[(E+60|0)>>2]=N,N=Qw(s,M,1),p[(E+44|0)>>2]=N,(Ba|0)==0?N=0:(N=$u(b,19,Ba,0,0),L=Pv(s,N,1),p[(E+12|0)>>2]=L));l[D]=H;Df(s,K);Df(s,N);Lu(s,za);Zf(s,M);l[s+30|0]<<24>>24==1?(HF(s,J),E=0):((v|0)==6?(l[P|0]=116,i=35):(v|0)==9?e?i=34:(l[P|0]=106,i=35):i=34,i==34&&(l[P|0]=107),p[P+4>>2]=J,M=c+68|0,p[(E+20|0)>>2]=p[M>>2],p[(E+24|0)>>2]=p[M>>2],p[u>>2]=J,l[E+8|0]=e?107:106,E=J)}}else{E=x}}while(0);a=h;return E}EF.X=1;function GE(b,c,d,e,f,g){var h=Su(b),d=DF(b,c,d,f);(d|0)!=0&&(c=(p[c>>2]|0)==0?0:(p[p[b>>2]+12>>2]&33554432|0)==0,b=b+72|0,f=p[b>>2]+1|0,p[b>>2]=f,gw(h,115,e,g,f),Dm(h,-1,p[d+8>>2],-18),sw(h,c&1))}function DF(b,c,d,e){for(var f=p[b+428>>2],f=((f|0)==0?b:f)+544|0;;){f=p[f>>2];if((f|0)==0){var g=IF(b,c,d,e);break}if((p[f>>2]|0)==(c|0)&&(p[f+4>>2]|0)==(e|0)){g=f;break}f=f+20|0}return g}function IF(b,c,d,e){var f,g=a;a+=36;var h=p[b+428>>2],h=(h|0)==0?b:h,i=p[b>>2],j=ni(i,24);if((j|0)==0){c=0}else{var k=h+544|0;p[(j+20|0)>>2]=p[k>>2];p[k>>2]=j;k=ni(i,28);p[(j+8|0)>>2]=k;if((k|0)==0){c=0}else{f=p[h+12>>2]+184|0;p[k+24>>2]=p[f>>2];p[f>>2]=k;p[j>>2]=c;p[(j+4|0)>>2]=e;var m=j+12|0;p[m>>2]=-1;var o=j+16|0;p[o>>2]=-1;var r=ni(i,556);f=r>>2;if((r|0)==0){c=0}else{for(var q=g>>2,s=q+9;q<s;q++){p[q]=0}p[g>>2]=r;p[r>>2]=i;p[(r+432|0)>>2]=d;p[(r+428|0)>>2]=h;q=c|0;p[(r+512|0)>>2]=p[q>>2];l[r+444|0]=l[c+8|0];d=b+448|0;d=(C[0]=p[d>>2],C[1]=p[d+4>>2],xd[0]);s=r+448|0;xd[0]=d;p[s>>2]=C[0];p[s+4>>2]=C[1];d=Su(r);(d|0)!=0&&(q=p[q>>2],q=zm(i,R.Wi|0,(z=a,a+=4,p[z>>2]=q,z)),Dm(d,-1,q,-1),q=p[c+12>>2],(q|0)==0?q=0:(q=Pv(i,q,0),(tw(g,q)|0)==0?l[i+30|0]<<24>>24!=0?s=0:(s=Xw(d),mx(r,q,s,8)):s=0,Df(i,q),q=s),JF(r,p[c+28>>2],e),(q|0)!=0&&wx(d,q),ew(d,6),e=b+64|0,(p[e>>2]|0)==0?(p[b+8>>2]=p[r+8>>2],p[e>>2]=p[r+64>>2]):vf(p[r>>2],p[r+8>>2]),l[i+30|0]<<24>>24==0&&(b=k+4|0,e=d+4|0,q=p[e>>2],Pm(d,h+424|0),p[b>>2]=p[d+28>>2],p[e>>2]=0,p[k>>2]=q),p[(k+8|0)>>2]=p[f+18],p[(k+12|0)>>2]=p[f+17],p[(k+16|0)>>2]=p[f+20],p[(k+20|0)>>2]=c,p[m>>2]=p[f+109],p[o>>2]=p[f+110],jk(d));vf(i,r);c=j}}}a=g;return c}IF.X=1;function JF(b,c,d){var e,f=a;a+=16;var g=p[b+12>>2],h=y[b>>2],i=(c|0)==0;a:do{if(!i){var j=(d|0)==99,k=b+445|0,m=d&255,o=c;for(e=o>>2;;){l[k]=(j?t[o+1|0]&255:m)&255;var r=o|0,q=t[r]&255;if((q|0)==107){var o=KF(b,o),q=Ov(h,p[e+6],0),s=Pv(h,p[e+5],0);wv(b,o,q,s,t[k]&255)}else{if((q|0)==105){var o=KF(b,o),q=Ov(h,p[e+6],0),s=Qw(h,p[e+2],0),u=HC(h,p[e+7]);xv(b,o,q,s,u,t[k]&255)}else{(q|0)==106?(o=KF(b,o),q=Pv(h,p[e+5],0),uv(b,o,q)):(o=Qw(h,p[e+2],0),uw(f,4,0),kv(b,o,f),Zf(h,o))}}l[r]<<24>>24!=116&&ew(g,60);e=y[e+8];if((e|0)==0){break a}o=e;e=o>>2}}}while(0);a=f}JF.X=1;function Pm(b,c){var d,e,f,g=y[c>>2];e=(b+44|0)>>2;var h=p[e],i=b+104|0;l[i]=1;var j=p[b+28>>2];if((j|0)>0){var k=g,g=p[b+4>>2];for(d=g>>2;;){var j=j-1|0,m=t[g|0];f=t[R.wc+(m&255)|0];var o=g+2|0;l[o]=f;if(m<<24>>24==18||m<<24>>24==123){var r=t[g+3|0]&255;if((r|0)>(k|0)){q=f}else{var r=k,q=f}f=14}else{m<<24>>24==35?(p[d+2]|0)==0?(r=k,q=f,f=14):f=7:m<<24>>24==127?f=7:(m<<24>>24==-116?(r=y[d+2],r=(r|0)>(k|0)?r:k):m<<24>>24==-120?(r=p[g-20+4>>2],r=(r|0)>(k|0)?r:k):(m<<24>>24==95||m<<24>>24==81?(p[d+4]=58,l[g+1|0]=-19):m<<24>>24==92&&(p[d+4]=60,l[g+1|0]=-19),r=k),q=f,f=14)}f==7&&(l[i]=0,r=k,q=l[o]);(q&1)<<24>>24!=0&&(k=g+8|0,o=p[k>>2],(o|0)<0&&(p[k>>2]=p[h+((o^-1)<<2)>>2]));if((j|0)<=0){break}k=r;g=g+20|0;d=g>>2}i=r;h=p[e]}else{i=g}vf(p[b>>2],h);p[e]=0;p[c>>2]=i}Pm.X=1;function LF(b,c){var d,e=c>>2,f=b+79|0,g=b+72|0;d=(b+86|0)>>1;var h=b+58|0,i=b+78|0;a:for(;;){var j=t[f];if((j&255)>1){j=Wm(b);if((j|0)!=0){var k=j;break}j=l[f]}if(j<<24>>24==0){p[e]=1;k=0;break}j=(p[g>>2]|0)>0;p[g>>2]=0;if(j){k=p[e]=0;break}var m=n[d]<<16>>16,j=y[b+(m<<2)+128>>2],m=(m<<1)+b+88|0,o=n[m>>1]+1&65535;n[m>>1]=o;n[h>>1]=0;l[i]=0;if((o&65535)<(Vc[j+16>>1]&65535)){p[e]=0;if(l[j+3|0]<<24>>24!=0){k=0;break}k=MF(b);break}if(l[j+3|0]<<24>>24==0){d=NF(b,Xi(p[j+64>>2]+(t[j+5|0]&255)+8|0));if((d|0)!=0){k=d;break}d=MF(b);p[e]=0;k=d;break}for(j=n[d];;){if(j<<16>>16==0){p[e]=1;k=l[f]=0;break a}OF(b);j=n[d];m=j<<16>>16;o=y[b+(m<<2)+128>>2];if((Vc[b+(m<<1)+88>>1]&65535)<(Vc[o+16>>1]&65535)){p[e]=0;if(l[o+2|0]<<24>>24==0){k=0;break a}continue a}}}return k}LF.X=1;function PF(b,c){var d,e,f,g=b+79|0;f=t[g];if((f&255)>1){if(f=Wm(b),(f|0)!=0){e=f,f=19}else{var h=l[g];f=4}}else{h=f,f=4}a:do{if(f==4){if(l[b+77|0]=0,h<<24>>24==0){p[c>>2]=1,e=0}else{e=b+72|0;var i=(p[e>>2]|0)<0;p[e>>2]=0;if(i){e=p[c>>2]=0}else{e=(b+86|0)>>1;var i=Vc[e],j=i<<16>>16,k=y[b+(j<<2)+128>>2],m=l[k+3|0]<<24>>24==0;b:do{if(m){var o=(Vc[b+(j<<1)+88>>1]&65535)<<1;d=y[k+72>>2];o=NF(b,Xi(p[k+64>>2]+(((t[d+o|0]&255)<<8|t[d+(o|1)|0]&255)&Vc[k+18>>1]&65535)|0));if((o|0)!=0){e=o;break a}o=QF(b)}else{for(var r=i;;){d=((r<<16>>16<<1)+b+88|0)>>1;if(n[d]<<16>>16!=0){n[b+58>>1]=0;l[b+78|0]=0;n[d]=n[d]-1&65535;o=p[b+(n[e]<<16>>16<<2)+128>>2];if(l[o+2|0]<<24>>24==0){o=0;break b}if(l[o+3|0]<<24>>24!=0){o=0;break b}o=PF(b,c);break b}if(r<<16>>16==0){l[g]=0;p[c>>2]=1;e=0;break a}OF(b);r=n[e]}}}while(0);p[c>>2]=0;e=o}}}}while(0);return e}PF.X=1;function Wm(b){var c;c=b+79|0;if(l[c]<<24>>24==3){b=p[b+72>>2]}else{l[c]=0;c=(b+68|0)>>2;var d=b+60|0,b=RF(b,p[c],p[d>>2],p[d+4>>2],0,b+72|0);(b|0)==0&&(Lg(p[c]),b=p[c]=0)}return b}function NF(b,c){var d,e=a;a+=4;d=(b+86|0)>>1;var f=n[d],g=f<<16>>16;if(f<<16>>16>18){aj(53389),d=11}else{if(f=SF(p[b+4>>2],c,e),(f|0)!=0){d=f}else{var f=p[e>>2],h=g+1|0;p[b+(h<<2)+128>>2]=f;n[((h<<1)+b+88|0)>>1]=0;n[d]=n[d]+1&65535;n[b+58>>1]=0;l[b+78|0]=0;n[f+16>>1]<<16>>16!=0&&l[f+2|0]<<24>>24==l[p[b+(g<<2)+128>>2]+2|0]<<24>>24?d=0:(aj(53400),d=11)}}a=e;return d}function QF(b){for(var c=b+86|0,d=0;;){if((d|0)!=0){var e=d;break}var d=n[c>>1]<<16>>16,f=y[b+(d<<2)+128>>2];if(l[f+3|0]<<24>>24!=0){n[((d<<1)+b+88|0)>>1]=n[f+16>>1]-1&65535;n[b+58>>1]=0;e=l[b+78|0]=0;break}var g=Xi(p[f+64>>2]+(t[f+5|0]&255)+8|0);n[((d<<1)+b+88|0)>>1]=n[f+16>>1];d=NF(b,g)}return e}function OF(b){var c;c=(b+86|0)>>1;Yj(p[b+(n[c]<<16>>16<<2)+128>>2]);n[c]=n[c]-1&65535;n[b+58>>1]=0;l[b+78|0]=0}function SF(b,c,d){p[b+44>>2]>>>0<c>>>0?(aj(50820),d=11):(b=Xj(b,c,d,0),(b|0)!=0?d=b:(b=lr(p[d>>2]),(b|0)==0?d=0:(Yj(p[d>>2]),d=b)));return d}function Xj(b,c,d,e){var f=a;a+=4;e=ti(p[b>>2],c,f,e);(e|0)==0?(b=TF(p[f>>2],c,b),p[d>>2]=b,d=0):d=e;a=f;return d}function TF(b,c,d){var e=p[b+8>>2];p[(e+64|0)>>2]=p[b+4>>2];p[(e+76|0)>>2]=b;p[(e+60|0)>>2]=d;p[(e+80|0)>>2]=c;l[e+5|0]=(c|0)==1?100:0;return e}function RF(b,c,d,e,f,g){var h,i=a;a+=156;var j=i+152;p[j>>2]=0;if((c|0)==0){h=UF(b,0,d,e,f,g)}else{h=(b+16|0)>>2;var k=VF(p[h],i|0,150,j);(k|0)==0?h=7:(WF(p[h],d,c,k),c=p[j>>2],b=UF(b,k,d,e,f,g),(c|0)!=0&&vf(p[p[h]>>2],c),h=b)}a=i;return h}function VF(b,c,d,e){var f=-c&7,g=b+6|0,h=(Vc[g>>1]&65535)*40+64|0;if((h|0)>(f+d|0)){if(c=zh(p[b>>2],h),p[e>>2]=c,(c|0)==0){var i=0,e=5}else{j=c,e=4}}else{p[e>>2]=0;var j=c+f|0,e=4}e==4&&(p[j+16>>2]=j+24|0,p[j>>2]=b,n[j+4>>1]=n[g>>1]+1&65535,i=j);return i}function WF(b,c,d,e){var f,g=a;a+=8;f=g>>2;var h=g+4,i=p[e+16>>2];l[e+6|0]=0;var j=t[d];if(j<<24>>24>-1){j&=255;p[f]=j;var k=1,m=j}else{k=XF(d,g)&255,m=p[f]}e=e+4|0;j=b+4|0;b|=0;for(var o=0,r=m;;){if(k>>>0>=m>>>0){break}if((o&65535)>=(Vc[e>>1]&65535)|(r|0)>(c|0)){break}var m=d+k|0,q=t[m];q<<24>>24>-1?(p[h>>2]=q&255,m=1):m=XF(m,h)&255;k=m+k|0;l[i+31|0]=l[j];p[i>>2]=p[b>>2];p[i+36>>2]=0;r=YF(d+r|0,p[h>>2],i)+r|0;i=i+40|0;o=o+1&65535;m=p[f]}n[e>>1]=o;a=g}WF.X=1;function ZF(b,c){var d=c>>2,e=t[b],f=e&255;if((f&128|0)==0){p[d]=e&255,p[d+1]=0,d=1}else{if(e=t[b+1|0]&255,(e&128|0)==0){p[(c|0)>>2]=e|f<<7&16256,p[(c+4|0)>>2]=0,d=2}else{var g=t[b+2|0]&255,f=(g|f<<14)&2080895;if((g&128|0)==0){p[(c|0)>>2]=f|e<<7&16256,p[(c+4|0)>>2]=0,d=3}else{var h=t[b+3|0]&255,g=(h|e<<14)&2080895;if((h&128|0)==0){p[d]=g|f<<7,p[d+1]=0,d=4}else{if(e=t[b+4|0]&255,h=e|f<<14,(e&128|0)==0){p[d]=h|g<<7|0,p[d+1]=0|f>>>18,d=5}else{var f=g|f<<7,i=t[b+5|0]&255,g=i|g<<14;(i&128|0)==0?(p[(c|0)>>2]=g|h<<7&266354560|0,p[(c+4|0)>>2]=0|f>>>18,d=6):(i=t[b+6|0]&255,h=i|h<<14,(i&128|0)==0?(p[d]=h&-266354561|g<<7&266354560|0,p[d+1]=0|f>>>11,d=7):(h&=2080895,i=t[b+7|0]&255,g=i|g<<14,(i&128|0)==0?(p[(c|0)>>2]=g&-266354561|h<<7|0,p[(c+4|0)>>2]=0|f>>>4,d=8):(p[d]=g<<8&532709120|h<<15|t[b+8|0]&255|0,p[d+1]=0|e>>>3&15|f<<4,d=9)))}}}}}return d}ZF.X=1;function UF(b,c,d,e,f,g){var h,i,j;g>>=2;var k=a;a+=12;var m,o=k+8,r=b+79|0;if(l[r]<<24>>24==1){if(l[b+78|0]<<24>>24==0){m=8}else{if(l[p[b+128>>2]+2|0]<<24>>24==0){m=8}else{if(j=b+32|0,m=p[j>>2],j=p[j+4>>2],m==d&&j==e){var q=p[g]=0;m=47}else{l[b+77|0]<<24>>24!=0&((j|0)<(e|0)||(j|0)==(e|0)&&m>>>0<d>>>0)?(p[g]=-1,q=0,m=47):m=8}}}}else{m=8}a:do{if(m==8){if(j=$F(b),(j|0)!=0){q=j}else{if(l[r]<<24>>24==0){p[g]=-1,q=0}else{j=(b+86|0)>>1;var s=(f|0)==0,u=b+32|0,w=b+58|0,v=u|0,x=b+78|0;b:for(;;){i=n[j]<<16>>16;var A=y[b+(i<<2)+128>>2],E=A+16|0,J=(Vc[E>>1]&65535)-1|0;if(s){var M=(J|0)/2&-1;n[((i<<1)+b+88|0)>>1]=M&65535;var D=M}else{n[((i<<1)+b+88|0)>>1]=J&65535,D=J}i=(A+64|0)>>2;for(var M=A+18|0,K=A+72|0,H=A+6|0,N=A+2|0,Q=A+7|0,P=A+8|0,L=A+4|0,I=0;;){n[w>>1]=0;var X=y[i],Y=D<<1,da=y[K>>2],Y=((t[da+Y|0]&255)<<8|t[da+(Y|1)|0]&255)&Vc[M>>1]&65535,da=Y+(t[H]&255)|0,ga=X+da|0,ha=l[N]<<24>>24==0;c:do{if(ha){var ba=t[ga],ea=ba&255,ja=da+(X+1)|0;if((ba&255)>(t[Q]&255)){ba=t[ja]&255;ja=(ba&128|0)==0;do{if(ja&&(h=ba+(ea<<7&16256)|0,(h|0)<=(Vc[P>>1]&65535|0))){ea=aG(h,da+(X+2)|0,c);break c}}while(0);bG(A,X+Y|0,u);h=v|0;h>>=2;var ra=v+4|0,ba=p[h],ea=bh(ba);if((ea|0)==0){q=7;break a}ja=Xm(b,0,ba,ea,0);if((ja|0)!=0){Lg(ea);q=ja;break a}ba=aG(ba,ea,c);Lg(ea);ea=ba}else{ea=aG(ea,ja,c)}}else{l[L]<<24>>24==0?ea=ga:(ea=t[ga],ea<<24>>24>-1?(p[o>>2]=ea&255,ea=1):ea=XF(ga,o)&255,ea=X+ea+da|0),ZF(ea,k),h=k|0,h>>=2,ea=p[h],ra=k+4|0,ba=p[ra>>2],ja=ea==d&&ba==e?0:(ba|0)<(e|0)||(ba|0)==(e|0)&&ea>>>0<d>>>0?-1:1,l[x]=1,h=v|0,h>>=2,p[h]=ea,ra=v+4|0,p[ra>>2]=ba,ea=ja}}while(0);if((ea|0)==0){if(l[N]<<24>>24!=0&&l[A+3|0]<<24>>24==0){var Va=0,ta=D;m=41;break}q=p[g]=0;break a}J=(X=(ea|0)<0)?J:D-1|0;I=X?D+1|0:I;if((I|0)>(J|0)){if(l[A+3|0]<<24>>24==0){Va=ea;ta=I;m=41;break}var xa=ea;m=45;break}else{D=(I+J|0)/2&-1,n[((n[j]<<16>>16<<1)+b+88|0)>>1]=D&65535}}do{if(m==41){if((ta|0)<(Vc[E>>1]&65535|0)?(H=ta<<1,N=y[K>>2],H=Xi(p[i]+(((t[N+H|0]&255)<<8|t[N+(H|1)|0]&255)&Vc[M>>1]&65535)|0)):H=Xi(p[i]+(t[A+5|0]&255)+8|0),(H|0)==0){xa=Va}else{n[((n[j]<<16>>16<<1)+b+88|0)>>1]=ta&65535;n[w>>1]=0;l[x]=0;A=NF(b,H);if((A|0)==0){continue b}q=A;break a}}}while(0);p[g]=xa;q=0;break a}}}}}while(0);a=k;return q}UF.X=1;function $F(b){var c,d,e=p[p[b>>2]+4>>2],f=b+79|0;d=t[f];(d&255)>1?d<<24>>24==3?(c=p[b+72>>2],d=21):(Cr(b),d=5):d=5;a:do{if(d==5){c=(b+86|0)>>1;var g=n[c],h=g<<16>>16>-1;do{if(h){var i=g<<16>>16<1;b:do{if(!i){for(var j=1;;){if(Yj(p[b+(j<<2)+128>>2]),j=j+1|0,(j|0)>(n[c]<<16>>16|0)){break b}}}}while(0);n[c]=0;i=p[b+128>>2]}else{h=p[b+20>>2];if((h|0)==0){c=l[f]=0;break a}g=b+128|0;h=SF(e,h,g);if((h|0)==0){n[c]=0;c=y[g>>2];if(((p[b+16>>2]|0)==0&1|0)==(t[c+2|0]&255|0)){i=c;break}aj(53521);c=11;break a}l[f]=0;c=h;break a}}while(0);n[b+88>>1]=0;n[b+58>>1]=0;l[b+77|0]=0;l[b+78|0]=0;c=Vc[i+16>>1];g=c<<16>>16==0;do{if(g&&l[i+3|0]<<24>>24==0){if((p[i+80>>2]|0)==1){e=Xi(p[i+64>>2]+(t[i+5|0]&255)+8|0);l[f]=1;c=NF(b,e);break a}aj(53542);c=11;break a}}while(0);l[f]=c<<16>>16!=0&1;c=0}}while(0);return c}$F.X=1;function XF(b,c){var d=a;a+=8;var e=t[b]&255,f=t[b+1|0]&255;if((f&128|0)==0){p[c>>2]=e<<7&16256|f,e=2}else{var g=t[b+2|0]&255;(g&128|0)==0?(p[c>>2]=(g|e<<14)&2080895|f<<7&16256,e=3):(e=ZF(b,d),f=p[d>>2],g=p[d+4>>2],p[c>>2]=(f&-1)==f&&(g&0)==g?f:-1)}a=d;return e}function aG(b,c,d){var e=a;a+=48;var f=e+4,g=e+44,h=y[d>>2];l[f+31|0]=l[h+4|0];p[f>>2]=p[h>>2];var i=t[c];if(i<<24>>24>-1){i&=255;p[e>>2]=i;var j=1,k=i}else{j=XF(c,e)&255,k=p[e>>2]}var m=Vc[h+6>>1]&65535,i=d+4|0,o=d+16|0,r=0,q=k;a:for(;;){var s=j>>>0<k>>>0;do{if(s){if((r|0)<(Vc[i>>1]&65535|0)){var u=c+j|0,w=t[u];w<<24>>24>-1?(w&=255,p[g>>2]=w,u=1):(u=XF(u,g)&255,w=p[g>>2]);u=u+j|0;if((q|0)<(b|0)||(Rm(w)|0)==0){q=YF(c+q|0,w,f)+q|0;j=(r|0)<(m|0);s=Cu(f,p[o>>2]+r*40|0,j?p[h+(r<<2)+12>>2]:0);if((s|0)==0){r=r+1|0;j=u;continue a}b=p[h+8>>2];b=(b|0)==0|j^1?s:l[b+r|0]<<24>>24==0?s:-s|0;c=d+6|0;g=t[c];if((g&4)<<24>>24==0){var v=b;break a}if((r|0)!=((Vc[i>>1]&65535)-1|0)){v=b;break a}l[c]=g&-5;f=f+16|0;i=p[f+4>>2];d=d+8|0;p[d>>2]=p[f>>2];p[d+4>>2]=i;v=b;break a}}else{u=j}}else{u=j}}while(0);d=t[d+6|0]&255;if((d&1|0)!=0){v=-1;break}if(!((d&2|0)==0&u>>>0<k>>>0)){v=0;break}v=1;break}a=e;return v}aG.X=1;function cG(b,c){if(c>>>0<2){var d=0}else{var d=c-2|0,d=d-(d>>>0)%((Math.floor((y[b+36>>2]>>>0)/5)+1|0)>>>0)|0,e=d+2|0,d=(e|0)==(Math.floor((y[si>>2]>>>0)/(y[b+32>>2]>>>0))+1|0)?d+3|0:e}return d}function bG(b,c,d){var e,f=a;a+=4;e=f>>2;p[d+8>>2]=c;var g=t[b+6|0]&255;if(l[b+2|0]<<24>>24==0){p[d+12>>2]=0;var c=c+g|0,h=t[c];h<<24>>24>-1?(h&=255,p[e]=h,c=1,e=h):(c=XF(c,f)&255,e=p[e]);h=d|0;p[h>>2]=e;p[h+4>>2]=0;g=c+g|0}else{if(l[b+4|0]<<24>>24==0){e=p[e]=0}else{var h=c+g|0,i=t[h];i<<24>>24>-1?(i&=255,p[e]=i,h=1,e=i):(h=XF(h,f)&255,e=p[e]);g=h+g|0}g&=65535;g=(ZF(c+g|0,d|0)&255)+g|0;p[d+12>>2]=e}c=e;p[d+16>>2]=c;n[d+20>>1]=g&65535;e=Vc[b+8>>1]&65535;c>>>0>e>>>0?(h=Vc[b+10>>1],i=h&65535,b=((c-i|0)>>>0)%((p[p[b+60>>2]+36>>2]-4|0)>>>0)+i|0,(b|0)>(e|0)?b=n[d+22>>1]=h:(b&=65535,n[d+22>>1]=b),b=(b&65535)+g|0,n[d+24>>1]=b&65535,n[d+26>>1]=b+4&65535):(b=c+g|0,n[d+26>>1]=(b&65532)>>>0<4?4:b&65535,n[d+22>>1]=c&65535,n[d+24>>1]=0);a=f}bG.X=1;function Xm(b,c,d,e,f){var g,h,i=a;a+=8;var j;h=i>>2;var k=i+4,m=n[b+86>>1]<<16>>16,o=y[b+(m<<2)+128>>2],r=y[b+4>>2],q=b+32|0;n[b+58>>1]<<16>>16==0&&(dG(o,Vc[b+(m<<1)+88>>1]&65535,q),l[b+78|0]=1);var m=y[b+40>>2],s=Vc[b+52>>1]&65535,u=d+c|0,q=u>>>0>(p[b+44>>2]+(l[o+2|0]<<24>>24==0?p[(q|0)>>2]:0)|0)>>>0;do{if(q){j=7}else{var w=b+54|0,v=Vc[w>>1]&65535,x=r+36|0;if((m+v+s|0)>>>0>(p[o+64>>2]+p[x>>2]|0)>>>0){j=7}else{if(v>>>0>c>>>0){var A=u>>>0>v>>>0?v-c|0:d;g=eG(m+s+c|0,e,A,f,p[o+76>>2]);var E=0,v=d-A|0,A=e+A|0,J=g}else{E=c-v|0,v=d,A=e,J=0}var M=(J|0)!=0|(v|0)==0;a:do{if(M){var D=v,K=J}else{var H=y[x>>2],N=H-4|0,Q=Vc[w>>1]&65535;p[h]=Xi(m+Q+s|0);var P=l[b+84|0]<<24>>24==0;g=(b+80|0)>>2;var L=y[g];if(P){Y=0,da=L,j=16}else{if((L|0)!=0){var I=L,X=0;j=17}else{Y=Math.floor(((H-5+p[b+48>>2]-Q|0)>>>0)/(N>>>0));da=H=qo(Y<<2);p[g]=da;if((Y|0)!=0&(H|0)==0){Y=7}else{var Y=0,da=da}j=16}}if(j==16){if((da|0)==0){var ga=E,ha=0,ba=Y;j=19}else{I=da,X=Y,j=17}}j==17&&(ha=Math.floor((E>>>0)/(N>>>0)),ga=y[I+(ha<<2)>>2],(ga|0)==0?(ga=E,ha=0):(p[h]=ga,ga=(E>>>0)%(N>>>0)),ba=X);var H=r|0,ea=ga,P=v,L=A;j=ba;for(Q=ha;;){if((j|0)!=0|(P|0)==0){D=P;K=j;break a}var ja=y[h];if((ja|0)==0){D=P;K=j;break a}j=p[g];(j|0)!=0&&(p[((Q<<2)+j|0)>>2]=ja);if(ea>>>0<N>>>0){j=(ea+P|0)>>>0>N>>>0?N-ea|0:P;var ra=ti(p[H>>2],ja,k,0);(ra|0)==0?(ja=y[k>>2],ra=p[ja+4>>2],p[h]=Xi(ra),ea=eG(ea+(ra+4)|0,L,j,f,ja),vi(p[k>>2]),ja=0):(ja=ea,ea=ra);P=P-j|0;L=L+j|0;j=ea}else{j=y[g];if((j|0)==0){j=28}else{if(j=p[j+(Q+1<<2)>>2],(j|0)==0){j=28}else{p[h]=j;var Va=0;j=29}}j==28&&(Va=fG(r,ja,0,i));ja=ea-N|0;j=Va}ea=ja;Q=Q+1|0}}}while(0);(K|0)!=0|(D|0)==0?E=K:(aj(53225),E=11);j=36}}}while(0);j==7&&(aj(53091),E=11);a=i;return E}Xm.X=1;function dG(b,c,d){c<<=1;var e=y[b+72>>2];bG(b,p[b+64>>2]+(((t[e+c|0]&255)<<8|t[e+(c|1)|0]&255)&Vc[b+18>>1]&65535)|0,d)}function eG(b,c,d,e,f){(e|0)==0?(Ah(c,b,d),b=0):(e=Yi(f),(e|0)!=0?b=e:(Ah(b,c,d),b=0));return b}function fG(b,c,d,e){var f=a;a+=12;var g,h=f+4,i=f+8;p[f>>2]=0;var j=l[b+17|0]<<24>>24==0;do{if(j){g=6}else{g=Math.floor((y[si>>2]>>>0)/(y[b+32>>2]>>>0))+1|0;for(var k=c;;){var m=k+1|0;if(!((cG(b,m)|0)==(m|0)|(m|0)==(g|0))){break}k=m}if(m>>>0>p[b+44>>2]>>>0){g=6}else{var o=gG(b,m,i,h);g=(o|0)==0;var r=(k=g&l[i]<<24>>24==4&(p[h>>2]|0)==(c|0))?m:0,o=k?101:o;if(k|g^1){var q=o,s=r,u=0;g=8}else{g=6}}}}while(0);g==6&&(q=Xj(b,c,f,0),b=p[f>>2],(q|0)!=0?s=0:(s=Xi(p[b+64>>2]),q=0),u=b);p[e>>2]=s;(d|0)==0?Yj(u):p[d>>2]=u;a=f;return(q|0)==101?0:q}fG.X=1;function gG(b,c,d,e){var f=a;a+=4;var g=cG(b,c),b=ti(p[b>>2],g,f,0);if((b|0)==0){var b=p[f>>2],h=p[b+4>>2],c=(c-g)*5|0,g=c-5|0;(g|0)<0?(vi(b),aj(50042),d=11):(l[d]=l[h+g|0],(e|0)!=0&&(p[e>>2]=Xi(h+(c-4)|0)),vi(b),d=t[d],d<<24>>24==0|(d&255)>5?(aj(50050),d=11):d=0)}else{d=b}a=f;return d}function Yi(b){var c=a;a+=4;var d,e=y[b+20>>2],f=e+128|0,g=Math.floor((y[e+124>>2]>>>0)/(y[f>>2]>>>0));if(g>>>0>1){var h=e+21|0;l[h]=l[h]+1&255;var b=b+16|0,i=y[b>>2],j=i-1&-g,k=j+1|0,m=j^-1,o=y[e+24>>2],g=i>>>0>o>>>0?m+(i+1)|0:(j+g|0)>>>0>o>>>0?m+(o+1)|0:g,j=(g|0)>0;a:do{if(j){var o=e+56|0,m=e+176|0,r=0,q=0,s=0;for(d=i;;){var u=r+k|0;if((u|0)==(d|0)){d=10}else{if((wj(p[o>>2],u)|0)==0){d=10}else{var w=Lq(p[m>>2],u);p[c>>2]=w;if((w|0)==0){var w=s,v=q}else{v=(n[w+24>>1]&4)<<16>>16==0?s:1,vi(w),w=v,v=q}d=15}}do{if(d==10){if((u|0)==(((p[si>>2]|0)/(p[f>>2]|0)&-1)+1|0)){w=s,v=q}else{w=ti(e,u,c,0);if((w|0)!=0){var x=w;break a}var w=p[c>>2],v=hG(w),A=(n[w+24>>1]&4)<<16>>16==0?s:1;vi(w);w=A}}}while(0);r=r+1|0;if(!((r|0)<(g|0)&(v|0)==0)){break}q=v;s=w;d=p[b>>2]}if((v|0)!=0|(w|0)==0){x=v}else{for(o=0;;){if(r=Lq(p[m>>2],o+k|0),(r|0)!=0&&(n[(r+24|0)>>1]|=4,vi(r)),o=o+1|0,(o|0)==(g|0)){x=v;break a}}}}else{x=0}}while(0);l[h]=l[h]-1&255;e=x}else{e=hG(b)}a=c;return e}Yi.X=1;function hG(b){var c,d,e,f,g,h,i,j=p[b+4>>2];h=(b+20|0)>>2;var k=y[h];g=k>>2;var m=y[g+10],o=(m|0)==0;a:do{if(o){if(l[k+14|0]<<24>>24!=0){f=3}else{d=k+16|0;if(l[d]<<24>>24==2&&(f=iG(k),(f|0)!=0)){break}Nq(b);f=(b+16|0)>>2;var r=y[f],q=y[h],s=(wj(p[q+56>>2],r)|0)==0;b:do{if(s){if((uj(p[g+45])|0)==0){c=r>>>0>y[g+7]>>>0;do{if(!c&&(e=(k+64|0)>>2,(p[p[e]>>2]|0)!=0)){d=(k+72|0)>>2;s=p[d];i=p[d+1];q=p[g+12];c=(k+128|0)>>2;q=Jq(q,p[c],j);n[(b+24|0)>>1]|=4;r=qr(p[e],s,i,r);if((r|0)!=0){f=r;break a}var u=p[e],w=p[c],r=(T.add(s,i,4,0),T.result[0]),s=T.result[1];i=Ei(u,j,w,r,s);if((i|0)!=0){f=i;break a}e=p[e];i=p[c];r=(T.add(r,s,i,(i|0)<0?-1:0),T.result[0]);e=qr(e,r,T.result[1],q);if((e|0)!=0){f=e;break a}c=p[c]+8|0;c=(T.add(c,(c|0)<0?-1:0,p[d],p[d+1]),T.result[0]);e=T.result[1];p[d]=c;p[d+1]=e;d=k+44|0;p[d>>2]=p[d>>2]+1|0;d=ej(p[g+14],p[f]);d|=fj(k,p[f]);if((d|0)!=0){f=d;break a}c=p[f];e=p[h];i=17;break b}}while(0);l[d]<<24>>24!=4&&(n[(b+24|0)>>1]|=4)}c=r;e=q;i=17}else{if((or(r,q)|0)==0){var v=0,x=r;i=19}else{c=r,e=q,i=17}}}while(0);i==17&&((or(c,e)|0)==0?(v=0,x=c):(v=pr(b),x=p[f]));f=k+24|0;y[f>>2]>>>0<x>>>0&&(p[f>>2]=x);f=v}}else{f=m}}while(0);return f}hG.X=1;function Rm(b){return b>>>0>11?(b-12|0)>>>1:t[R.mr+b|0]&255}function Ex(b,c,d){p[c+4>>2]=b;b=b+512|0;p[c>>2]=p[b>>2];p[b>>2]=d}function Kz(b){var c=b+4|0,d=p[c>>2];(d|0)!=0&&(p[(d+512|0)>>2]=p[b>>2],p[c>>2]=0)}function iG(b){var c,d=b>>2,e,f=p[d],g=p[d+10],h=(g|0)==0;a:do{if(h){c=(uj(p[d+45])|0)==0;do{if(c&&(e=b+5|0,l[e]<<24>>24!=2)){var i=Ko(p[d+6]);c=(b+56|0)>>2;p[c]=i;if((i|0)==0){c=7;break a}i=p[d+16];if((p[i>>2]|0)==0){if(l[e]<<24>>24==4){Aq(i),e=9}else{if(e=Wp(f,p[d+37],i,l[b+13|0]<<24>>24!=0?4110:2054,0),(e|0)==0){e=9}else{var j=e;e=10}}}else{e=9}if(e==9){p[d+11]=0;e=b+72|0;p[e>>2]=0;p[e+4>>2]=0;l[b+19|0]=0;e=b+80|0;p[e>>2]=0;p[e+4>>2]=0;e=ur(b);if((e|0)==0){break}j=e}Mo(p[c]);p[c]=0;c=j;break a}}while(0);l[b+16|0]=3;c=0}else{c=g}}while(0);return c}iG.X=1;function YF(b,c,d){if((c|0)==10||(c|0)==11||(c|0)==0){n[d+28>>1]=1,d=0}else{if((c|0)==1){var e=l[b],b=d+16|0;p[(b|0)>>2]=e;p[(b+4|0)>>2]=(e|0)<0?-1:0;n[d+28>>1]=4;d=1}else{if((c|0)==2){e=l[b]<<24>>24<<8|t[b+1|0]&255,b=d+16|0,p[b>>2]=e,p[b+4>>2]=(e|0)<0?-1:0,n[d+28>>1]=4,d=2}else{if((c|0)==3){e=t[b+2|0]&255|l[b]<<24>>24<<16|(t[b+1|0]&255)<<8,b=d+16|0,p[b>>2]=e,p[b+4>>2]=(e|0)<0?-1:0,n[d+28>>1]=4,d=3}else{if((c|0)==4){e=(t[b+1|0]&255)<<16|(t[b]&255)<<24|t[b+3|0]&255|(t[b+2|0]&255)<<8,b=d+16|0,p[b>>2]=e,p[b+4>>2]=(e|0)<0?-1:0,d=n[d+28>>1]=4}else{if((c|0)==5){e=0|l[b]<<24>>24<<8|t[b+1|0]&255,c=d+16|0,p[c>>2]=(t[b+3|0]&255)<<16|(t[b+2|0]&255)<<24|t[b+5|0]&255|(t[b+4|0]&255)<<8|0,p[c+4>>2]=e,n[d+28>>1]=4,d=6}else{if((c|0)==6||(c|0)==7){e=(t[b+5|0]&255)<<16|(t[b+4|0]&255)<<24|t[b+7|0]&255|(t[b+6|0]&255)<<8|0;b=0|(t[b+1|0]&255)<<16|(t[b]&255)<<24|t[b+3|0]&255|(t[b+2|0]&255)<<8;if((c|0)==6){c=d+16|0,p[c>>2]=e,p[c+4>>2]=b,n[d+28>>1]=4}else{var c=d+8|0,f=c|0;B=e;l[f]=B&255;B>>=8;l[f+1]=B&255;B>>=8;l[f+2]=B&255;B>>=8;l[f+3]=B&255;c=c+4|0;B=b;l[c]=B&255;B>>=8;l[c+1]=B&255;B>>=8;l[c+2]=B&255;B>>=8;l[c+3]=B&255;e=(C[0]=e,C[1]=b,xd[0]);n[d+28>>1]=(e!=e&1|0)!=0?1:8}d=8}else{(c|0)==8||(c|0)==9?(e=d+16|0,p[(e|0)>>2]=c-8|0,p[(e+4|0)>>2]=0,n[d+28>>1]=4,d=0):(e=(c-12|0)>>>1,p[d+4>>2]=b,p[d+24>>2]=e,p[d+32>>2]=0,n[d+28>>1]=(c&1|0)==0?4112:4098,d=e)}}}}}}}return d}YF.X=1;function MF(b){for(var c=b+86|0,d=0;;){if((d|0)!=0){break}var e=n[c>>1]<<16>>16,f=y[b+(e<<2)+128>>2];if(l[f+3|0]<<24>>24!=0){break}d=(Vc[b+(e<<1)+88>>1]&65535)<<1;e=y[f+72>>2];d=NF(b,Xi(p[f+64>>2]+(((t[e+d|0]&255)<<8|t[e+(d|1)|0]&255)&Vc[f+18>>1]&65535)|0))}return d}function KF(b,c){var d=b|0,e=sv(p[d>>2],0,c+12|0,0);if((e|0)!=0){var d=p[d>>2],f=rm(d,p[p[c+4>>2]+20>>2]);(f|0)==0|(f|0)>1&&(d=yl(d,p[p[d+8>>2]+(f<<4)>>2]),p[(e+((n[e>>1]<<16>>16)-1)*60+4|0)>>2]=d)}return e}function HF(b,c){var d;(c|0)!=0&&(d=p[c+28>>2]>>2,Df(b,p[d+5]),Lu(b,p[d+6]),Zf(b,p[d+2]),Df(b,p[c+12>>2]),vf(b,c))}function CE(b,c){var d=(b|0)==0|(c|0)==0;a:do{if(d){var e=1}else{for(var f=c+12|0,g=p[c>>2],h=0;;){if((h|0)>=(g|0)){e=0;break a}if((ID(b,p[(p[f>>2]+4>>2)+(h*5|0)])|0)>-1){e=1;break a}h=h+1|0}}}while(0);return e}function EE(b,c){var d=(c|0)==0;return(b|0)==0?d&1:d?0:(qm(b,c)|0)==0&1}function FE(b,c){var d=p[c+4>>2],e=(p[b+4>>2]|0)==(d|0);a:do{if(e){if(l[b+24|0]<<24>>24!=l[c+24|0]<<24>>24){var f=0}else{for(var g=c+44|0,h=c+40|0,i=c+8|0,j=b+8|0,k=b+40|0,m=b+44|0,o=0;;){if((o|0)>=(d|0)){f=1;break a}if((p[p[i>>2]+(o<<2)>>2]|0)!=(p[p[j>>2]+(o<<2)>>2]|0)){f=0;break a}if(l[p[h>>2]+o|0]<<24>>24!=l[p[k>>2]+o|0]<<24>>24){f=0;break a}if((EE(p[p[g>>2]+(o<<2)>>2],p[p[m>>2]+(o<<2)>>2])|0)==0){f=0;break a}o=o+1|0}}}else{f=0}}while(0);return f}FE.X=1;function XB(b,c,d,e,f,g,h,i){var j,k=a;a+=16;var m=p[b+12>>2];j=(b|0)>>2;var o=y[j],r=iw(o,d),q=ov(o,26,R.bj|0),s=mv(p[j],0,q);if(q=(f|0)!=0){f=Pv(o,f,0),s=mv(p[j],s,f)}var f=(d+8|0)>>2,u=(p[f]|0)>0;a:do{if(u){for(var w=e+12|0,v=d+12|0,x=s,A=0;;){var E=p[g+(A<<2)>>2],E=(E|0)>-1?Pv(o,p[(p[w>>2]>>2)+(E*5|0)],0):ov(o,26,p[(p[v>>2]>>2)+(A*6|0)]),x=mv(p[j],x,E),A=A+1|0;if((A|0)>=(p[f]|0)){var J=x;break a}}}else{J=s}}while(0);c=lv(b,J,c,h,0,0,0,0,0,0);g=b+68|0;e=y[g>>2];p[g>>2]=e+1|0;g=q&1;V(m,42,e,(q?2:1)+p[f]|0);sw(m,16);uw(k,8,e);kv(b,c,k);j=(b+72|0)>>2;q=y[j];h=q+1|0;p[j]=h;J=q+2|0;p[j]=J+p[f]|0;j=V(m,72,e,0);gw(m,29,e,0,h);gw(m,29,e,g,J);J=(p[f]|0)>0;a:do{if(J){s=q+3|0;for(u=0;;){w=u+1|0;gw(m,29,e,w+g|0,s+u|0);if((w|0)>=(p[f]|0)){break a}u=w}}}while(0);Jx(b,d);hw(m,140,0,p[f]+2|0,h,r,-10);sw(m,(i|0)==99?2:i&255);Kx(b);V(m,95,e,j+1|0);fw(m,j);V(m,45,e,0);Zf(o,c);a=k}XB.X=1;function Fx(b,c,d,e){var f=a;a+=16;var g=p[b>>2],h=Qw(g,p[c+28>>2],0);if((d|0)!=0){var d=Pv(g,d,0),i=sv(g,0,0,0);(i|0)==0?Zf(g,h):(c=yl(g,p[c>>2]),p[(i+12|0)>>2]=c,p[(i+20|0)>>2]=h);h=lv(b,0,i,d,0,0,0,0,0,0)}uw(f,9,e);kv(b,h,f);Zf(g,h);a=f}function Ax(b,c,d,e){var f=Vc[c>>1],g=(f<<16>>16)+d|0;if((g|0)>(n[c+2>>1]<<16>>16|0)){if(f=Il(b,c,g*60+4|0),(f|0)==0){var h=c,b=9}else{var i=Dl(b,f)-64|0;n[f+2>>1]=Math.floor((i>>>0)/60)+1&65535;var i=f,j=n[f>>1],b=4}}else{i=c,j=f,b=4}a:do{if(b==4){c=i|0;f=(j<<16>>16)-1|0;if((f|0)<(e|0)){f=j}else{for(;;){for(var g=(i+f*60+4|0)>>2,k=(i+(f+d)*60+4|0)>>2,m=g+15;g<m;g++,k++){p[k]=p[g]}f=f-1|0;if((f|0)<(e|0)){break}}f=n[c>>1]}n[c>>1]=(f&65535)+d&65535;Ed(i+e*60+4|0,0,d*60|0);c=e+d|0;if((d|0)>0){for(f=e;;){if(p[(i+36>>2)+(f*15|0)]=-1,f=f+1|0,(f|0)>=(c|0)){h=i;break a}}}else{h=i}}}while(0);return h}Ax.X=1;function Sw(b){var c=a;a+=4;p[c>>2]=0;PD(b,c);b=p[c>>2];a=c;return b}function Tw(b,c,d,e,f){var g,h,i,j,k,m,o,r,q,s,u,w;w=(b+512|0)>>2;var v=p[w],x=p[b>>2],A=(p[x+12>>2]&1|0)==0;a:do{if(A){u=(c+8|0)>>2;var E=p[u],J=p[(E+36>>2)+(d*15|0)];s=(E+d*60+20|0)>>2;var M=p[s],D=(e|0)!=0;if((f|0)==0|D^1){var K=(f|0)!=0;if(K&&n[E>>1]<<16>>16>1){Mb=0}else{var H=(p[M+40>>2]|0)==0;if(!H&&(p[c+40>>2]|0)!=0){Mb=0}else{if((p[M+44>>2]|0)!=0){Mb=0}else{var N=c+36|0;if((p[N>>2]|0)==0|H){if(n[p[M+8>>2]>>1]<<16>>16==0){Mb=0}else{if((n[M+6>>1]&1)<<16>>16!=0){Mb=0}else{if(!H&&n[E>>1]<<16>>16>1|D){Mb=0}else{var Q=(n[c+6>>1]&1)<<16>>16==0;if(Q|K^1){q=(c+24|0)>>2;var P=p[q],L=(P|0)==0;if(!L&&(p[M+24>>2]|0)!=0){Mb=0}else{if(D&&(p[M+24>>2]|0)!=0){Mb=0}else{if(!H&&(p[c+12>>2]|0)!=0|Q^1){Mb=0}else{var I=E+d*60+32|0;if((l[I]&32)<<24>>24!=0){Mb=0}else{var X=M+28|0,Y=(p[X>>2]|0)==0;b:do{if(!Y){if((p[M+24>>2]|0)!=0|D|Q^1){Mb=0;break a}if(n[E>>1]<<16>>16!=1){Mb=0;break a}for(var da=M;;){if((da|0)==0){break}if((n[da+6>>1]&5)<<16>>16!=0){Mb=0;break a}var ga=p[da+28>>2];if((ga|0)!=0&&l[da+4|0]<<24>>24!=113){Mb=0;break a}if(n[p[da+8>>2]>>1]<<16>>16<1){Mb=0;break a}da=ga}if(!L){for(var ha=p[P>>2],ba=P+12|0,ea=0;;){if((ea|0)>=(ha|0)){break b}if(n[(p[ba>>2]+14>>1)+(ea*10|0)]<<16>>16==0){Mb=0;break a}ea=ea+1|0}}}}while(0);r=(E+d*60+8|0)>>2;p[w]=p[r];Ru(b,21,0,0,0);p[w]=v;o=(c+40|0)>>2;m=(c+28|0)>>2;for(var ja=c+4|0,ra=x+30|0,Va=X;;){var ta=p[Va>>2];if((ta|0)==0){break}var xa=p[q],Fa=p[o],Na=p[m];p[q]=0;p[u]=0;p[m]=0;p[o]=0;var Ea=Qw(x,c,0);p[o]=Fa;p[q]=xa;p[u]=E;l[ja]=113;p[N>>2]=0;if((Ea|0)==0){var La=Na}else{p[(Ea+28|0)>>2]=Na,p[(Ea+36|0)>>2]=0,La=Ea}p[m]=La;if(l[ra]<<24>>24!=0){Mb=1;break a}Va=ta+28|0}var za=p[s],Ba=E+d*60+4|0;vf(x,p[Ba>>2]);vf(x,p[r]);var Ja=E+d*60+12|0;vf(x,p[Ja>>2]);p[Ba>>2]=0;p[r]=0;p[Ja>>2]=0;p[s]=0;var ka=E+d*60+16|0,S=p[ka>>2];if((S|0)!=0){var ib=S+32|0,Wa=n[ib>>1];if(Wa<<16>>16==1){var Za=p[b+428>>2],Sa=((Za|0)==0?b:Za)+540|0;p[(S+72|0)>>2]=p[Sa>>2];p[Sa>>2]=S}else{n[ib>>1]=Wa-1&65535}p[ka>>2]=0}var tb=d+1|0,pb=c;k=pb>>2;for(var fb=za;;){if((pb|0)==0){break}var Xa=p[fb+8>>2],Ab=n[Xa>>1],rb=Ab<<16>>16;j=(pb+8|0)>>2;var cb=p[j];if((cb|0)==0){var Cb=sv(x,0,0,0);p[j]=Cb;if((Cb|0)==0){break}var Zb=0,dc=Cb}else{Zb=l[I],dc=cb}if(Ab<<16>>16>1){var kb=Ax(x,dc,rb-1|0,tb);p[j]=kb;if(l[ra]<<24>>24!=0){break}var Oa=kb}else{Oa=dc}var Db=Ab<<16>>16>0;b:do{if(Db){for(var Wb=0;;){var Nb=Wb+d|0,$b=Oa+Nb*60+4|0;Ef(x,p[(Oa+44>>2)+(Nb*15|0)]);for(var Rb=Xa+Wb*60+4|0,Ra=Rb>>2,Ob=$b>>2,Ua=Ra+15;Ra<Ua;Ra++,Ob++){p[Ob]=p[Ra]}Ed(Rb,0,60);var Jb=Wb+1|0;if((Jb|0)==(rb|0)){break b}Wb=Jb}}}while(0);l[Oa+d*60+32|0]=Zb;var Vb=pb|0,Pb=p[Vb>>2],sb=Pb|0,db=p[sb>>2];if((db|0)>0){for(var wb=Pb+12|0,ob=0,Kb=db;;){var ub=p[wb>>2];if((p[(ub+4>>2)+(ob*5|0)]|0)==0){var Xb=p[(ub+8>>2)+(ob*5|0)];if((Xb|0)==0){var Sb=Kb}else{var Qb=yl(x,Xb);p[(p[wb>>2]+ob*20+4|0)>>2]=Qb;Sb=p[sb>>2]}}else{Sb=Kb}var ac=ob+1|0;if((ac|0)>=(Sb|0)){break}ob=ac;Kb=Sb}var Gb=p[Vb>>2]}else{Gb=Pb}i=(fb|0)>>2;jG(x,Gb,J,p[i]);if(D){jG(x,p[k+4],J,p[i]);var xb=pb+20|0,Ta=kG(x,p[xb>>2],J,p[i]);p[xb>>2]=Ta}var qb=fb+24|0,bc=p[qb>>2],$a=pb+24|0;if((bc|0)==0){var mb=p[$a>>2];(mb|0)!=0&&jG(x,mb,J,p[i])}else{p[$a>>2]=bc,p[qb>>2]=0}var Bb=p[fb+12>>2],bb=(Bb|0)==0?0:Pv(x,Bb,0);h=(pb+12|0)>>2;var jb=p[h];if(K){g=(pb+20|0)>>2;p[g]=jb;p[h]=bb;var nb=kG(x,jb,J,p[i]);p[g]=nb;var zb=Pv(x,p[fb+20>>2],0),Tb=Jw(x,nb,zb);p[g]=Tb;var ec=Ov(x,p[fb+16>>2],0);p[k+4]=ec}else{var Hb=kG(x,jb,J,p[i]);p[h]=Hb;var Eb=Jw(x,Hb,bb);p[h]=Eb}n[(pb+6|0)>>1]|=n[fb+6>>1]&1;var Lb=fb+40|0,gb=p[Lb>>2];(gb|0)!=0&&(p[k+10]=gb,p[Lb>>2]=0);pb=p[k+7];k=pb>>2;fb=p[fb+28>>2]}Zf(x,za);Mb=1}}}}}else{Mb=0}}}}}else{Mb=0}}}}}else{var Mb=0}}else{Mb=0}}while(0);return Mb}Tw.X=1;function zx(b,c,d){var e,f,g,h,i,j,k,m,o,r,q,s,u,w,v,x=a;a+=52;var A;v=x>>2;var E=x+16,J=x+20,M=x+36,D=y[b>>2];w=(c+28|0)>>2;var K=y[w];u=K>>2;var H=x|0;s=H>>2;q=(d|0)>>2;p[s]=p[q];p[s+1]=p[q+1];p[s+2]=p[q+2];p[s+3]=p[q+3];var N=(p[u+6]|0)==0;a:do{if(N){if(r=(K+40|0)>>2,(p[r]|0)!=0){var Q=lG(t[c+4|0]&255);ym(b,R.sj|0,(z=a,a+=4,p[z>>2]=Q,z));yb=1;Ka=0;A=55}else{var P=Su(b),L=t[H];if(L<<24>>24==9){var I=c|0;V(P,42,p[v+1],p[p[I>>2]>>2]);sw(P,16);var X=l[H]=8,Y=I}else{X=L,Y=c|0}o=Y>>2;if((p[p[o]>>2]|0)!=(p[p[u]>>2]|0)){var da=lG(t[c+4|0]&255);ym(b,R.tj|0,(z=a,a+=4,p[z>>2]=da,z));yb=1;Ka=0;A=55}else{if(m=(c+24|0)>>2,(p[m]|0)==0){var ga=c+4|0,ha=t[ga]&255;do{if((ha|0)==113){var ba=c+40|0;p[r]=p[ba>>2];var ea=c+44|0;p[u+11]=p[ea>>2];var ja=b+552|0,ra=p[ja>>2],Va=kv(b,K,x);p[ba>>2]=0;p[ea>>2]=0;if((Va|0)!=0){yb=Va;Ka=0;A=55;break a}p[w]=0;var ta=p[u+12];p[c+48>>2]=ta;p[c+52>>2]=p[u+13];var xa=(ta|0)==0?0:qw(P,122,ta),Fa=p[ja>>2],Na=kv(b,c,x),Ea=p[w];p[w]=K;var La=K+68|0,za=(C[0]=p[La>>2],C[1]=p[La+4>>2],xd[0]);k=(c+68|0)>>2;var Ba=(C[0]=p[k],C[1]=p[k+1],xd[0])+za;xd[0]=Ba;p[k]=C[0];p[k+1]=C[1];var Ja=p[r];if((Ja|0)!=0&&(uD(Ja,E)|0)!=0){var ka=(C[0]=p[k],C[1]=p[k+1],xd[0]),S=p[E>>2]|0;ka>S&&(xd[0]=S,p[k]=C[0],p[k+1]=C[1])}if((xa|0)==0){var ib=Na,Wa=Ea,Za=ra,Sa=Fa}else{fw(P,xa),ib=Na,Wa=Ea,Za=ra,Sa=Fa}}else{if((ha|0)==114||(ha|0)==112){if(X<<24>>24==1){if((p[c+40>>2]|0)!=0){A=26}else{if((p[c+44>>2]|0)!=0){A=26}else{var tb=p[v+1];A=27}}}else{A=26}if(A==26){var pb=b+68|0,fb=p[pb>>2];p[pb>>2]=fb+1|0;var Xa=V(P,42,fb,0);p[c+56>>2]=Xa;n[(p[c+36>>2]+6|0)>>1]|=8;tb=fb}uw(J,1,tb);var Ab=b+552|0,rb=p[Ab>>2],cb=kv(b,K,J);if((cb|0)!=0){yb=cb;Ka=0;A=55;break a}var Cb=l[ga]<<24>>24==114?2:1;p[w]=0;j=(c+40|0)>>2;var Zb=p[j];p[j]=0;i=(c+44|0)>>2;var dc=p[i];p[i]=0;l[J|0]=Cb;var kb=p[Ab>>2],Oa=kv(b,c,J);Lu(D,p[m]);var Db=p[w];p[w]=K;p[m]=0;if(l[ga]<<24>>24==112){var Wb=K+68|0,Nb=(C[0]=p[Wb>>2],C[1]=p[Wb+4>>2],xd[0]);h=(c+68|0)>>2;var $b=(C[0]=p[h],C[1]=p[h+1],xd[0])+Nb;xd[0]=$b;p[h]=C[0];p[h+1]=C[1]}Df(D,p[j]);p[j]=Zb;p[i]=dc;p[c+48>>2]=0;p[c+52>>2]=0;if(X<<24>>24!=1){if(X<<24>>24==5){for(var Rb=c;;){var Ra=p[Rb+28>>2];if((Ra|0)==0){break}Rb=Ra}yx(b,0,p[Rb>>2])}var Ob=Xw(P),Ua=Xw(P);Yw(b,c,Ob);V(P,72,tb,Ob);var Jb=p[P+28>>2],Vb=p[o];cx(b,c,Vb,tb,p[Vb>>2],0,-1,x,Ua,Ob);wx(P,Ua);V(P,95,tb,Jb);wx(P,Ob);V(P,45,tb,0)}ib=Oa;Wa=Db;Za=rb;Sa=kb}else{var Pb=b+68|0,sb=p[Pb>>2],db=sb+1|0;p[Pb>>2]=sb+2|0;var wb=V(P,42,sb,0);p[c+56>>2]=wb;n[(p[c+36>>2]+6|0)>>1]|=8;uw(M,1,sb);var ob=b+552|0,Kb=p[ob>>2],ub=kv(b,K,M);if((ub|0)!=0){yb=ub;Ka=0;A=55;break a}var Xb=V(P,42,db,0);p[c+60>>2]=Xb;p[w]=0;g=(c+40|0)>>2;var Sb=p[g];p[g]=0;f=(c+44|0)>>2;var Qb=p[f];p[f]=0;p[M+4>>2]=db;var ac=p[ob>>2],Gb=kv(b,c,M),xb=p[w];p[w]=K;e=(c+68|0)>>2;var Ta=(C[0]=p[e],C[1]=p[e+1],xd[0]),qb=K+68|0,bc=(C[0]=p[qb>>2],C[1]=p[qb+4>>2],xd[0]);Ta>bc&&(xd[0]=bc,p[e]=C[0],p[e+1]=C[1]);Df(D,p[g]);p[g]=Sb;p[f]=Qb;if(X<<24>>24==5){for(var $a=c;;){var mb=p[$a+28>>2];if((mb|0)==0){break}$a=mb}yx(b,0,p[$a>>2])}var Bb=Xw(P),bb=Xw(P);Yw(b,c,Bb);V(P,72,sb,Bb);var jb=rx(b),nb=V(P,63,sb,jb);zC(P,51,db,bb,jb,0);sx(b,jb);var zb=p[o];cx(b,c,zb,sb,p[zb>>2],0,-1,x,bb,Bb);wx(P,bb);V(P,95,sb,nb);wx(P,Bb);V(P,45,db,0);V(P,45,sb,0);ib=Gb;Wa=xb;Za=Kb;Sa=ac}}}while(0);var Tb=t[ga];mG(b,Tb&255,Za,Sa,Tb<<24>>24!=113&1);if((n[c+6>>1]&8)<<16>>16==0){yb=ib}else{var ec=y[p[o]>>2],Hb=ni(D,ec*5+16|0);if((Hb|0)==0){yb=7}else{l[Hb+4|0]=l[p[p[D+8>>2]+12>>2]+77|0];n[Hb+6>>1]=ec&65535;var Eb=(ec|0)>0;b:do{if(Eb){for(var Lb=D+44|0,gb=0,Mb=Hb+12|0;;){var vc=nG(b,c,gb);p[Mb>>2]=vc;(vc|0)==0&&(p[Mb>>2]=p[Lb>>2]);var hc=gb+1|0;if((hc|0)==(ec|0)){break b}gb=hc;Mb=Mb+4|0}}}while(0);var kc=(c|0)==0;b:do{if(!kc){for(var pc=c;;){for(var jc=0;;){if((jc|0)>=2){break}var mc=(jc<<2)+pc+56|0,Fb=p[mc>>2];if((Fb|0)<0){break}tm(P,Fb,ec);Dm(P,Fb,Hb,-6);p[mc>>2]=-1;jc=jc+1|0}var Ub=p[pc+28>>2];if((Ub|0)==0){break b}pc=Ub}}}while(0);vf(D,Hb);yb=ib}}Ka=Wa;A=55}else{var Ya=oG(b,c,d);A=56}}}}else{var Pa=lG(t[c+4|0]&255);ym(b,R.rj|0,(z=a,a+=4,p[z>>2]=Pa,z));var yb=1,Ka=0;A=55}}while(0);A==55&&(p[d+8>>2]=p[v+2],p[d+12>>2]=p[v+3],Zf(D,Ka),Ya=yb);a=x;return Ya}zx.X=1;function Ww(b,c){var d=p[b>>2],e=p[c>>2],f=ni(d,e*5+16|0),g=(f|0)==0;a:do{if(!g){var h=f+12|0,i=f+8|0;p[i>>2]=(e<<2)+h|0;n[f+6>>1]=e&65535;l[f+4|0]=l[p[p[d+8>>2]+12>>2]+77|0];p[f>>2]=d;if((e|0)>0){for(var j=d+44|0,k=p[c+12>>2],m=0;;){var o=bx(b,p[k>>2]);p[((m<<2)+h|0)>>2]=(o|0)==0?p[j>>2]:o;l[p[i>>2]+m|0]=l[k+12|0];m=m+1|0;if((m|0)==(e|0)){break a}k=k+20|0}}}}while(0);return f}Ww.X=1;function Yw(b,c,d){var e,f,g=a;a+=4;var h=c+48|0;if((p[h>>2]|0)==0&&(px(b),f=(c+40|0)>>2,(p[f]|0)!=0)){e=(b+72|0)>>2;var i=p[e]+1|0;p[e]=i;p[h>>2]=i;h=Su(b);if((h|0)!=0){if((uD(p[f],g)|0)==0){ux(b,p[f],i),qw(h,21,i),V(h,122,i,d)}else{if(V(h,7,p[g>>2],i),f=p[g>>2],(f|0)==0){V(h,1,0,d)}else{var d=(c+68|0)>>2,j=(C[0]=p[d],C[1]=p[d+1],xd[0]);f|=0;j>f&&(xd[0]=f,p[d]=C[0],p[d+1]=C[1])}}j=c+44|0;(p[j>>2]|0)!=0&&(f=p[e],d=f+1|0,p[e]=d,p[c+52>>2]=d,p[e]=p[e]+1|0,ux(b,p[j>>2],d),qw(h,21,d),b=qw(h,120,d),V(h,7,0,d),fw(h,b),b=f+2|0,gw(h,86,i,d,b),i=qw(h,120,i),V(h,7,-1,b),fw(h,i))}}a=g}Yw.X=1;function cx(b,c,d,e,f,g,h,i,j,k){var m,o,r,q=y[b+12>>2],s=t[i|0],u=s&255,w=i+4|0,v=p[w>>2],x=(q|0)==0;a:do{if(!x){r=(h|0)>-1;var A=(g|0)==0;r|A^1||pG(q,c,j);var E=(f|0)>0,J=E?f:p[d>>2];o=(i+8|0)>>2;m=p[o];(m|0)==0?(m=(b+72|0)>>2,p[o]=p[m]+1|0,p[i+12>>2]=J,p[m]=p[m]+J|0,o=p[o]):o=m;b:do{if(E){for(m=0;;){if(gw(q,29,e,m,m+o|0),m=m+1|0,(m|0)==(f|0)){break b}}}else{s<<24>>24!=3&&(px(b),ax(b,p[d>>2],p[d+12>>2],o,s<<24>>24==5&1))}}while(0);r&&(qG(b,h,j,J,o),A&&pG(q,c,j));do{if((u|0)==1){r=rx(b),gw(q,31,o,J,r),V(q,97,v,r),sx(b,r),r=34}else{if((u|0)==2){gw(q,98,v,o,J),r=34}else{if((u|0)==8||(u|0)==9){r=rx(b),gw(q,31,o,J,r),A?(E=rx(b),V(q,56,v,E),gw(q,57,v,r,E),sw(q,8),sx(b,E)):rG(b,g,c,r),sx(b,r),r=34}else{if((u|0)==7){if(r=c+5|0,l[r]=tE(p[p[d+12>>2]>>2],l[i+1|0]),A){E=rx(b),hw(q,31,o,1,E,r,1),cE(b,o,1),V(q,97,v,E),sx(b,E),r=35}else{rG(b,g,c,o);break a}}else{if((u|0)==3){V(q,7,1,v),r=34}else{if((u|0)==6){if(A){vx(b,o,v,1),r=35}else{rG(b,g,c,o);break a}}else{if((u|0)==10||(u|0)==5){if(!A){d=rx(b);gw(q,31,o,J,d);rG(b,g,c,d);sx(b,d);break a}s<<24>>24==10?(qw(q,4,p[w>>2]),r=35):(V(q,16,o,J),cE(b,o,J),r=34)}else{r=34}}}}}}}}while(0);if(r!=34||A){J=p[c+48>>2],(J|0)!=0&&gw(q,122,J,k,-1)}}}while(0)}cx.X=1;function ex(b,c){var d=(c|0)==0;a:do{if(!d){var e=c|0;if((p[e>>2]|0)>0){for(var f=p[c+12>>2],g=0;;){fx(b,p[f>>2]);g=g+1|0;if((g|0)>=(p[e>>2]|0)){break a}f=f+20|0}}}}while(0)}function fx(b,c){var d,e=a;a+=16;d=e>>2;p[d]=62;p[d+1]=64;p[d+3]=b;mD(e,c);a=e}function nx(b,c){if(l[b+480|0]<<24>>24==2){var d=p[b+12>>2],e=zm(p[b>>2],R.qj|0,(z=a,a+=4,p[z>>2]=c,z));hw(d,150,p[b+548>>2],0,0,e,-1)}}function gx(b,c){if((p[b+12>>2]|0)==0){var d=p[b>>2];if((p[d>>2]|0)!=1){d=0}else{var e=p[b+8>>2];n[e>>1]<<16>>16!=1?d=0:(p[e+20>>2]|0)!=0?d=0:(e=p[e+16>>2],d=p[p[d+12>>2]>>2],d=(l[e+34|0]&16)<<24>>24!=0?0:l[d|0]<<24>>24!=-103?0:(l[p[c+4>>2]+3|0]&32)<<24>>24==0?0:(n[d+2>>1]&16)<<16>>16==0?e:0)}}else{d=0}return d}gx.X=1;function vx(b,c,d,e){if((c|0)!=(d|0)){gw(p[b+12>>2],13,c,d,e);var e=e+c|0,d=d-c|0,f=b+116|0,g=p[f>>2];(g|0)>=(c|0)&(g|0)<(e|0)&&(p[f>>2]=d+g|0);f=b+140|0;g=p[f>>2];(g|0)>=(c|0)&(g|0)<(e|0)&&(p[f>>2]=d+g|0);f=b+164|0;g=p[f>>2];(g|0)>=(c|0)&(g|0)<(e|0)&&(p[f>>2]=d+g|0);f=b+188|0;g=p[f>>2];(g|0)>=(c|0)&(g|0)<(e|0)&&(p[f>>2]=d+g|0);f=b+212|0;g=p[f>>2];(g|0)>=(c|0)&(g|0)<(e|0)&&(p[f>>2]=d+g|0);f=b+236|0;g=p[f>>2];(g|0)>=(c|0)&(g|0)<(e|0)&&(p[f>>2]=d+g|0);f=b+260|0;g=p[f>>2];(g|0)>=(c|0)&(g|0)<(e|0)&&(p[f>>2]=d+g|0);f=b+284|0;g=p[f>>2];(g|0)>=(c|0)&(g|0)<(e|0)&&(p[f>>2]=d+g|0);f=b+308|0;g=p[f>>2];(g|0)>=(c|0)&(g|0)<(e|0)&&(p[f>>2]=d+g|0);b=b+332|0;f=p[b>>2];(f|0)>=(c|0)&(f|0)<(e|0)&&(p[b>>2]=d+f|0)}}vx.X=1;function ix(b,c){var d,e=p[b+12>>2],f=c|0;l[f]=1;px(b);var g=c+40|0,h=(p[g>>2]|0)>0;a:do{if(h){for(var i=b|0,j=p[c+36>>2],k=0;;){var m=p[p[j>>2]+16>>2];if((m|0)==0){var o=0,r=0}else{var o=m|0,q=p[o>>2],r=ox(b,q);ax(b,p[o>>2],p[m+12>>2],r,1);o=q}q=j+12|0;if((p[q>>2]|0)>-1){var s=Xw(e);qG(b,p[q>>2],s,1,r);q=s}else{q=0}var s=j+4|0,u=p[s>>2];if((l[u+3|0]&8)<<24>>24==0){m=u}else{u=(o|0)>0;do{if(u){d=p[m+12>>2];for(var w=0;;){var v=bx(b,p[d>>2]),w=w+1|0,x=(v|0)!=0;if(!((w|0)<(o|0)&(x^1))){break}d=d+20|0}if(x){var A=v;d=13}else{d=12}}else{d=12}}while(0);d==12&&(A=p[p[i>>2]+44>>2]);hw(e,17,0,0,0,A,-4);m=p[s>>2]}hw(e,123,0,r,p[j+8>>2],m,-5);sw(e,o&255);cE(b,r,o);tx(b,r,o);(q|0)!=0&&(wx(e,q),px(b));k=k+1|0;if((k|0)>=(p[g>>2]|0)){break a}j=j+16|0}}}while(0);px(b);e=c+32|0;g=(p[e>>2]|0)>0;a:do{if(g){h=p[c+20>>2];for(i=0;;){ux(b,p[h+20>>2],p[h+16>>2]);i=i+1|0;if((i|0)>=(p[e>>2]|0)){break a}h=h+24|0}}}while(0);l[f]=0;px(b)}ix.X=1;function jx(b,c){var d,e=c+40|0,f=(p[e>>2]|0)>0;a:do{if(f){var g=0,h=p[c+36>>2];for(d=h>>2;;){var i=p[p[d]+16>>2];hw(b,124,p[d+2],(i|0)==0?0:p[i>>2],0,p[d+1],-5);d=g+1|0;if((d|0)>=(p[e>>2]|0)){break a}g=d;h=h+16|0;d=h>>2}}}while(0)}function hx(b,c){var d,e,f=p[b+12>>2];e=(c+40|0)>>2;var g=p[e],h=c+24|0,i=p[h>>2],j=(g|0)==(-i|0);a:do{if(!j){if((i|0)>0){var k=c+20|0;for(d=0;;){if(V(f,10,0,p[(p[k>>2]+16>>2)+(d*6|0)]),d=d+1|0,(d|0)>=(p[h>>2]|0)){break}}k=p[e]}else{k=g}if((k|0)>0){for(var m=0,k=p[c+36>>2];;){V(f,10,0,p[k+8>>2]);d=(k+12|0)>>2;var o=(p[d]|0)>-1;b:do{if(o){var r=p[p[k>>2]+16>>2],q=(r|0)==0;do{if(!q&&(p[r>>2]|0)==1){o=Ww(b,r);hw(f,42,p[d],0,0,o,-16);break b}}while(0);ym(b,R.pj|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));p[d]=-1}}while(0);d=m+1|0;if((d|0)>=(p[e]|0)){break a}m=d;k=k+16|0}}}}while(0)}hx.X=1;function xx(b,c,d,e,f){var g=Xw(d),h=Xw(d),i=p[c+24>>2],j=t[f|0],k=j&255,m=f+4|0,o=p[m>>2],r=p[i+8>>2],q=rx(b),s=j<<24>>24==5;if(j<<24>>24==10||j<<24>>24==5){var u=b+68|0,w=p[u>>2];p[u>>2]=w+1|0;gw(d,44,w,q,e);u=0}else{u=rx(b),w=0}var v=c+6|0;if((n[v>>1]&64)<<16>>16==0){var x=V(d,71,r,g);pG(d,c,h);gw(d,29,r,p[i>>2]+1|0,q);i=x}else{var A=b+72|0,x=p[A>>2]+1|0;p[A>>2]=x;var E=b+68|0,A=p[E>>2];p[E>>2]=A+1|0;i|=0;gw(d,44,A,x,p[i>>2]+2|0);E=V(d,70,r,g);pG(d,c,h);V(d,62,r,x);gw(d,29,A,p[i>>2]+1|0,q);sw(d,32);i=E}i=i+1|0;if((k|0)==8||(k|0)==9){V(d,56,o,u),gw(d,57,o,q,u),sw(d,8)}else{if((k|0)==7){hw(d,31,q,1,u,c+5|0,1),cE(b,q,1),V(d,97,o,u)}else{if((k|0)==6){vx(b,q,o,1)}else{c=(e|0)>0;a:do{if(c){k=f+8|0;for(o=0;;){if(gw(d,29,w,o,p[k>>2]+o|0),(o|0)==0&&sw(d,32),o=o+1|0,(o|0)==(e|0)){break a}}}}while(0);s?(f=f+8|0,V(d,16,p[f>>2],e),cE(b,p[f>>2],e)):qw(d,4,p[m>>2])}}}sx(b,q);sx(b,u);wx(d,h);(n[v>>1]&64)<<16>>16==0?V(d,95,r,i):V(d,81,r,i);wx(d,g);(j<<24>>24==10||j<<24>>24==5)&&V(d,45,w,0)}xx.X=1;function yx(b,c,d){var e,f,g,h=p[b+12>>2],i=p[b>>2],j=l[b+480|0]<<24>>24==0;do{if(j&&(g=b+16|0,!(l[g]<<24>>24!=0|(h|0)==0)&&l[i+30|0]<<24>>24==0)){l[g]=1;var k=p[i+12>>2],m=(k&1024|0)==0;g=(d|0)>>2;Sx(h,p[g]);var o=(p[g]|0)>0;a:do{if(o){for(var r=d+12|0,q=(c|0)==0,s=c|0,u=(k&3072|0)==0,w=0;;){f=p[r>>2]>>2;e=p[f+(w*5|0)];var v=(e|0)==0;b:do{if(!v){var x=p[f+(w*5|0)+1];if((x|0)==0){x=l[e|0];do{if((x<<24>>24==-104||x<<24>>24==-102)&&!q){var v=n[e+28>>1],x=v<<16>>16,A=n[s>>1]<<16>>16;e=e+24|0;for(var E=0;;){if((E|0)>=(A|0)){break}if((p[(c+36>>2)+(E*15|0)]|0)==(p[e>>2]|0)){break}E=E+1|0}e=p[(c+16>>2)+(E*15|0)]>>2;v=v<<16>>16<0?p[e+1]:x;v=(v|0)<0?R.Z|0:p[(p[e+3]>>2)+(v*6|0)];if(u){f=yl(i,p[f+(w*5|0)+2]);Az(h,w,0,f,4);break b}if(m){Az(h,w,0,v,-1);break b}f=p[e];f=zm(i,R.wb|0,(z=a,a+=8,p[z>>2]=f,p[z+4>>2]=v,z));Az(h,w,0,f,4);break b}}while(0);x=yl(i,p[f+(w*5|0)+2]);Az(h,w,0,x,4)}else{Az(h,w,0,x,-1)}}}while(0);w=w+1|0;if((w|0)>=(p[g]|0)){break a}}}}while(0);o=b;r=c;g=d;k=a;a+=36;m=p[o+12>>2];p[k+4>>2]=r;p[k>>2]=o;o=g|0;r=(p[o>>2]|0)>0;a:do{if(r){q=g+12|0;for(s=0;;){if(u=hD(k,p[(p[q>>2]>>2)+(s*5|0)],0,0,0),Az(m,s,1,u,-1),s=s+1|0,(s|0)>=(p[o>>2]|0)){break a}}}}while(0);a=k}}while(0)}yx.X=1;function pG(b,c,d){var c=c+52|0,e=p[c>>2];(e|0)==0|(d|0)==0||(V(b,20,e,-1),c=qw(b,121,p[c>>2]),V(b,1,0,d),fw(b,c))}function lG(b){return(b|0)==113?R.xj|0:(b|0)==115?R.yj|0:(b|0)==114?R.zj|0:R.Aj|0}function qG(b,c,d,e,f){var g=p[b+12>>2],h=rx(b);zC(g,52,c,d,f,e);gw(g,31,f,e,h);V(g,97,c,h);sx(b,h)}function sG(b,c){var d,e,f,g,h,i;h=y[b+12>>2]>>2;var j=p[h],k=p[h+1],m=p[h+7];g=m>>2;var o=c|0,r=t[o]&255;a:do{if((r|0)==154||(r|0)==152){if((k|0)!=0){e=n[k>>1]<<16>>16;f=(c+24|0)>>2;var q=0;for(d=k+4|0;;){if((q|0)>=(e|0)){f=1;break a}var s=y[f];if((s|0)==(p[d+32>>2]|0)){break}q=q+1|0;d=d+60|0}q=m+20|0;d=p[g+6];e=(c+28|0)>>1;for(var u=0,w=p[q>>2];;){if((u|0)>=(d|0)){i=11;break}if((p[w+4>>2]|0)==(s|0)&&(p[w+8>>2]|0)==(n[e]<<16>>16|0)){var v=u;i=21;break}u=u+1|0;w=w+24|0}b:do{if(i==11&&(u=p[j>>2],w=m,v=a,a+=4,d=w+20|0,u=aC(u,p[d>>2],24,3,w+24|0,w+28|0,v),p[d>>2]=u,d=p[v>>2],a=v,v=d,(v|0)>-1)){u=p[q>>2];p[(u+v*24|0)>>2]=p[c+40>>2];p[(u+v*24+4|0)>>2]=p[f];p[(u+v*24+8|0)>>2]=n[e]<<16>>16;d=j+72|0;w=p[d>>2]+1|0;p[d>>2]=w;p[(u+v*24+16|0)>>2]=w;d=(u+v*24+12|0)>>2;p[d]=-1;p[(u+v*24+20|0)>>2]=c;u=p[g+3];w=(u|0)==0;c:do{if(!w){var x=p[u>>2],A=p[u+12>>2],E=0;d:for(;;){if((E|0)>=(x|0)){break c}var J=p[A>>2],M=l[J|0]<<24>>24==-104;do{if(M&&(p[J+24>>2]|0)==(p[f]|0)&&n[J+28>>1]<<16>>16==n[e]<<16>>16){break d}}while(0);A=A+20|0;E=E+1|0}p[d]=E;if((E|0)>=0){break b}}}while(0);u=m+16|0;w=p[u>>2];p[u>>2]=w+1|0;p[d]=w}}while(0);p[c+36>>2]=m;l[o]=-102;n[c+30>>1]=v&65535}f=1}else{if((r|0)==153){if((p[h+6]|0)!=0){f=0}else{e=m+36|0;f=p[g+10];q=p[e>>2];for(d=0;;){if((d|0)<(f|0)){if((wD(p[q>>2],c)|0)==0){var D=d;break}q=q+16|0;d=d+1|0}else{D=j|0;q=p[D>>2];f=l[p[p[q+8>>2]+12>>2]+77|0];u=q;w=m;q=a;a+=4;d=w+36|0;u=aC(u,p[d>>2],16,3,w+40|0,w+44|0,q);p[d>>2]=u;d=p[q>>2];a=q;q=d;if((q|0)<=-1){D=q;break}e=p[e>>2];p[((q<<4)+e|0)>>2]=c;d=j+72|0;u=p[d>>2]+1|0;p[d>>2]=u;p[((q<<4)+e+8|0)>>2]=u;d=p[c+4>>2];u=p[c+16>>2];D=go(p[D>>2],d,ve(d),(u|0)==0?0:p[u>>2],f,0);p[((q<<4)+e+4|0)>>2]=D;if((n[c+2>>1]&16)<<16>>16==0){p[((q<<4)+e+12|0)>>2]=-1;D=q;break}D=j+68|0;f=p[D>>2];p[D>>2]=f+1|0;p[((q<<4)+e+12|0)>>2]=f;D=q;break}}n[c+30>>1]=D&65535;p[c+36>>2]=m;f=1}}else{f=0}}}while(0);return f}sG.X=1;function rG(b,c,d,e){var f=p[b+12>>2],g=c|0,h=p[g>>2],i=h+2|0,j=ox(b,i),k=rx(b);px(b);ax(b,p[g>>2],p[c+12>>2],j,0);c=(c+8|0)>>2;h=j+h|0;V(f,55,p[c],h);vx(b,e,h+1|0,1);gw(f,31,j,i,k);V(f,(n[d+6>>1]&64)<<16>>16==0?97:96,p[c],k);sx(b,k);tx(b,j,i);b=p[d+48>>2];(b|0)!=0&&(d=p[d+52>>2],b=(d|0)==0?b:d+1|0,d=qw(f,122,b),V(f,20,b,-1),b=ew(f,1),fw(f,d),qw(f,67,p[c]),qw(f,59,p[c]),fw(f,b))}function oG(b,c,d){var e,f,g,h,i,j,k,m,o,r,q,s=a;a+=32;var u,w=s+16;q=(b|0)>>2;var v=y[q],x=y[b+12>>2],A=Xw(x),E=Xw(x),J=c+4|0,M=t[J];r=(c+28|0)>>2;var D=y[r];o=(c+24|0)>>2;var K=y[o],H=y[K>>2],N=M<<24>>24==113;a:do{if(N){var Q=H,P=K;u=13}else{for(var L=v+30|0,I=c|0,X=1,Y=H,da=K;;){if(l[L]<<24>>24!=0){Q=Y;P=da;u=13;break a}if((X|0)>(p[p[I>>2]>>2]|0)){Q=Y;P=da;u=13;break a}for(var ga=0,ha=p[da+12>>2];;){if((ga|0)>=(Y|0)){break}if((Vc[ha+14>>1]&65535|0)==(X|0)){break}ga=ga+1|0;ha=ha+20|0}if((ga|0)==(Y|0)){var ba=ov(v,129,0);if((ba|0)==0){var ea=7;u=58;break a}n[(ba+2|0)>>1]|=1024;p[ba+4>>2]=X;var ja=mv(p[q],da,ba);n[(p[ja+12>>2]+14>>1)+(Y*10|0)]=X&65535;var ra=Y+1|0,Va=ja}else{ra=Y,Va=da}X=X+1|0;Y=ra;da=Va}}}while(0);if(u==13){var ta=zh(v,Q<<2),xa=(ta|0)==0;a:do{if(xa){var Fa=0}else{m=(P+12|0)>>2;var Na=(Q|0)>0;b:do{if(Na){for(var Ea=0,La=p[m];;){p[ta+(Ea<<2)>>2]=(Vc[La+14>>1]&65535)-1|0;var za=Ea+1|0;if((za|0)==(Q|0)){break b}Ea=za;La=La+20|0}}}while(0);var Ba=zh(v,Q*5+16|0),Ja=Ba;if((Ba|0)==0){Fa=Ja}else{var ka=Ba+12|0,S=Ba+8|0;p[S>>2]=(Q<<2)+ka|0;n[Ba+6>>1]=Q&65535;l[Ba+4|0]=l[p[p[v+8>>2]+12>>2]+77|0];if(Na){for(var ib=0;;){var Wa=p[(p[m]>>2)+(ib*5|0)];k=(Wa+2|0)>>1;if((n[k]&256)<<16>>16==0){var Za=nG(b,c,p[ta+(ib<<2)>>2]);n[k]|=256;var Sa=p[(Wa+20|0)>>2]=Za}else{Sa=p[Wa+20>>2]}p[ka+(ib<<2)>>2]=Sa;l[p[S>>2]+ib|0]=l[p[m]+ib*20+12|0];var tb=ib+1|0;if((tb|0)==(Q|0)){Fa=Ja;break a}ib=tb}}else{Fa=Ja}}}}while(0);p[o]=P;var pb=Ov(p[q],P,0),fb=D+24|0;p[fb>>2]=pb;a:do{if(N){var Xa=0,Ab=0}else{var rb=p[p[c>>2]>>2],cb=ox(b,rb+1|0);V(x,7,0,cb);var Cb=ni(v,rb*5+16|0),Zb=Cb;if((Cb|0)==0){Xa=Zb,Ab=cb}else{var dc=Cb+12|0,kb=Cb+8|0;p[kb>>2]=(rb<<2)+dc|0;n[Cb+6>>1]=rb&65535;l[Cb+4|0]=l[p[p[v+8>>2]+12>>2]+77|0];if((rb|0)>0){for(var Oa=0;;){var Db=nG(b,c,Oa);p[((Oa<<2)+dc|0)>>2]=Db;l[p[kb>>2]+Oa|0]=0;var Wb=Oa+1|0;if((Wb|0)==(rb|0)){Xa=Zb;Ab=cb;break a}Oa=Wb}}else{Xa=Zb,Ab=cb}}}}while(0);p[r]=0;sD(b,c,p[o],R.ja|0);(p[D+28>>2]|0)==0&&sD(b,D,p[fb>>2],R.ja|0);Yw(b,c,A);j=(c+48|0)>>2;i=(b+72|0)>>2;if((p[j]|0)==0|N^1){var Nb=0,$b=0,Rb=c+52|0}else{var Ra=p[i],Ob=Ra+1|0,Ua=Ra+2|0;p[i]=Ua;var Jb=c+52|0,Vb=p[Jb>>2];V(x,14,(Vb|0)==0?p[j]:Vb+1|0,Ob);V(x,14,Ob,Ua);Nb=Ua;$b=Ob;Rb=Jb}h=Rb>>2;var Pb=c+40|0;Df(v,p[Pb>>2]);p[Pb>>2]=0;var sb=c+44|0;Df(v,p[sb>>2]);p[sb>>2]=0;var db=p[i],wb=db+1|0,ob=db+2|0,Kb=db+3|0,ub=db+4|0,Xb=db+5|0,Sb=db+6|0;p[i]=Sb;uw(s,10,wb);uw(w,10,Kb);var Qb=ew(x,1);g=(x+28|0)>>2;var ac=p[g];p[D+48>>2]=$b;var Gb=b+552|0,xb=p[Gb>>2];kv(b,D,s);V(x,7,1,ob);qw(x,4,wb);var Ta=p[g],qb=p[j],bc=p[h];p[j]=Nb;p[h]=0;var $a=p[Gb>>2];kv(b,c,w);p[j]=qb;p[h]=bc;V(x,7,1,ub);qw(x,4,Kb);var mb=tG(b,c,s,d,Xb,Ab,Xa,-16,A),Bb=(M-112&255)<2,bb=Bb?tG(b,c,w,d,Sb,Ab,Xa,-17,A):0,jb=M<<24>>24==115;if((M-114&255)<2){var nb=V(x,1,0,A)}else{var zb=V(x,27,ub,A);V(x,2,Sb,bb);qw(x,4,Kb);V(x,1,0,zb);var Tb=D+68|0,ec=(C[0]=p[Tb>>2],C[1]=p[Tb+4>>2],xd[0]);f=(c+68|0)>>2;var Hb=(C[0]=p[f],C[1]=p[f+1],xd[0])+ec;xd[0]=Hb;p[f]=C[0];p[f+1]=C[1];nb=zb}if(jb){e=(c+68|0)>>2;var Eb=(C[0]=p[e],C[1]=p[e+1],xd[0]),Lb=D+68|0,gb=(C[0]=p[Lb>>2],C[1]=p[Lb+4>>2],xd[0]);if(Eb>gb){xd[0]=gb,p[e]=C[0],p[e+1]=C[1],Mb=nb}else{var Mb=nb}}else{var vc=V(x,27,ob,A);V(x,2,Xb,mb);qw(x,4,wb);V(x,1,0,vc);Mb=vc}var hc=V(x,2,Xb,mb);qw(x,4,wb);V(x,27,ob,nb);V(x,1,0,E);if(N){var kc=hc,pc=hc}else{if(jb){kc=hc,pc=hc+1|0}else{var jc=qw(x,4,wb);V(x,27,ob,nb);V(x,1,0,E);kc=jc;pc=hc}}var mc=p[g];Bb&&V(x,2,Sb,bb);qw(x,4,Kb);V(x,27,ub,Mb);V(x,1,0,E);fw(x,Qb);V(x,7,0,ob);V(x,7,0,ub);V(x,2,wb,ac);V(x,2,Kb,Ta);V(x,27,ob,nb);V(x,27,ub,Mb);wx(x,E);hw(x,23,0,0,0,ta,-15);hw(x,24,p[s+8>>2],p[w+8>>2],Q,Fa,-16);gw(x,25,pc,kc,mc);(Ab|0)!=0&&tx(b,Ab,Q+1|0);wx(x,A);if(l[d|0]<<24>>24==5){for(var Fb=D;;){var Ub=p[Fb+28>>2];if((Ub|0)==0){break}Fb=Ub}yx(b,0,p[Fb>>2])}var Ya=p[r];(Ya|0)!=0&&Zf(v,Ya);p[r]=D;mG(b,t[J]&255,xb,$a,0);ea=0}a=s;return ea}oG.X=1;function mG(b,c,d,e,f){if(l[b+480|0]<<24>>24==2){var g=p[b+12>>2],f=(f|0)!=0?R.vj|0:xh|0,c=lG(c),d=zm(p[b>>2],R.uj|0,(z=a,a+=16,p[z>>2]=d,p[z+4>>2]=e,p[z+8>>2]=f,p[z+12>>2]=c,z));hw(g,150,p[b+548>>2],0,0,d,-1)}}function nG(b,c,d){var e;e=p[c+28>>2];if((e|0)==0){e=3}else{if(e=nG(b,e,d),(e|0)==0){e=3}else{var f=e;e=5}}e==3&&(c=p[c>>2],f=(p[c>>2]|0)>(d|0)?bx(b,p[(p[c+12>>2]>>2)+(d*5|0)]):0);return f}function uG(b){for(var c=0;;){var d=l[b];if(d<<24>>24==0){break}else{c=d<<24>>24==34?c+1|0:c}b=b+1|0;c=c+1|0}return c+2|0}function tG(b,c,d,e,f,g,h,i,j){var k=e>>2,m=y[b+12>>2],o=p[m+28>>2],r=Xw(m);if((g|0)!=0){var q=qw(m,28,g),s=d+8|0,u=g+1|0,w=d+12|0,h=hw(m,24,p[s>>2],u,p[w>>2],h,i)+2|0;gw(m,25,h,r,h);fw(m,q);q=p[s>>2];w=p[w>>2];s=(q|0)!=(u|0)&(w|0)>0;a:do{if(s){h=b+12|0;for(i=0;;){if(V(p[h>>2],14,i+q|0,i+u|0),i=i+1|0,(i|0)==(w|0)){break a}}}}while(0);V(m,7,1,g)}l[p[b>>2]+30|0]<<24>>24==0?(pG(m,c,r),g=t[e|0]&255,(g|0)==8||(g|0)==9?(k=rx(b),g=rx(b),gw(m,31,p[d+8>>2],p[d+12>>2],k),d=e+4|0,V(m,56,p[d>>2],g),gw(m,57,p[d>>2],k,g),sw(m,8),sx(b,g),sx(b,k)):(g|0)==7?(g=c+5|0,l[g]=tE(p[p[p[c>>2]+12>>2]>>2],l[e+1|0]),e=rx(b),d=d+8|0,hw(m,31,p[d>>2],1,e,g,1),cE(b,p[d>>2],1),V(m,97,p[k+1],e),sx(b,e)):(g|0)==6?vx(b,p[d+8>>2],p[k+1],1):(g|0)==10?(e=e+8|0,g=p[e>>2],(g|0)==0?(u=d+12|0,g=ox(b,p[u>>2]),p[e>>2]=g,e=p[u>>2],p[k+3]=e):e=p[k+3],vx(b,p[d+8>>2],g,e),qw(m,4,p[k+1])):(k=d+8|0,d=d+12|0,V(m,16,p[k>>2],p[d>>2]),cE(b,p[k>>2],p[d>>2])),b=p[c+48>>2],(b|0)!=0&&gw(m,122,b,j,-1),wx(m,r),qw(m,3,f),f=o):f=0;return f}tG.X=1;function jG(b,c,d,e){var f=(c|0)==0;a:do{if(!f){var g=c|0;if((p[g>>2]|0)>0){for(var h=c+12|0,i=0;;){var j=kG(b,p[(p[h>>2]>>2)+(i*5|0)],d,e);p[(p[h>>2]+i*20|0)>>2]=j;i=i+1|0;if((i|0)>=(p[g>>2]|0)){break a}}}}}while(0)}function kG(b,c,d,e){var f=(c|0)==0;a:do{if(f){var g=0}else{var g=c|0,h=l[g]<<24>>24==-104;do{if(h&&(p[c+24>>2]|0)==(d|0)){d=n[c+28>>1];if(d<<16>>16<0){l[g]=98;g=c;break a}e=Pv(b,p[(p[e+12>>2]>>2)+((d<<16>>16)*5|0)],0);(e|0)!=0&&(d=p[c+20>>2],(d|0)!=0&&(p[(e+20|0)>>2]=d));Df(b,c);g=e;break a}}while(0);g=c+8|0;h=kG(b,p[g>>2],d,e);p[g>>2]=h;g=c+12|0;h=kG(b,p[g>>2],d,e);p[g>>2]=h;g=c+16|0;(n[c+2>>1]&2048)<<16>>16==0?jG(b,p[g>>2],d,e):vG(b,p[g>>2],d,e);g=c}}while(0);return g}kG.X=1;function vG(b,c,d,e){var f=c>>2,g=(c|0)==0;a:do{if(!g){jG(b,p[f],d,e);jG(b,p[f+4],d,e);jG(b,p[f+6],d,e);var h=c+20|0,i=kG(b,p[h>>2],d,e);p[h>>2]=i;h=c+12|0;i=kG(b,p[h>>2],d,e);p[h>>2]=i;vG(b,p[f+7],d,e);h=p[f+2];if((h|0)!=0&&(i=n[h>>1],i<<16>>16>0)){h=h+4|0;for(i=i<<16>>16;;){vG(b,p[h+16>>2],d,e);i=i-1|0;if((i|0)<=0){break a}h=h+60|0}}}}while(0)}function Nw(b,c,d){var e=p[b>>2],f=(p[e+12>>2]&67108864|0)==0;a:do{if(!f&&(l[d+34|0]&16)<<24>>24==0&&(p[d+28>>2]|0)==0){var g=Su(b);if((PC(p[d>>2],p[d+68>>2])|0)==0){for(var h=d+36|0;;){h=p[h>>2];if((h|0)==0){break a}if(l[h+24|0]<<24>>24!=0){break}h=h+4|0}h=Xw(g);V(g,118,1,h)}else{h=0}var i=b+446|0;l[i]=1;var j=cD(e,c,0);uv(b,j,0);l[i]=0;V(g,118,0,p[g+28>>2]+2|0);aE(b,2,R.ma|0,-2);(h|0)!=0&&wx(g,h)}}while(0)}Nw.X=1;function Ow(b,c,d,e){var f,g=b|0,h=p[g>>2];f=p[h+8>>2];var i=Su(b);pw(b,1,d);var j=c+34|0;(l[j]&16)<<24>>24!=0&&ew(i,132);var g=ZC(p[p[p[g>>2]+8>>2]+28>>2],l[b+446|0],c),k=(g|0)==0;a:do{if(!k){for(var m=g;;){if(IC(b,m),m=p[m+32>>2],(m|0)==0){break a}}}}while(0);g=(d<<4)+f|0;(l[j]&8)<<24>>24==0?f=c|0:(f=p[g>>2],k=c|0,m=p[k>>2],xw(b,R.Jj|0,(z=a,a+=8,p[z>>2]=f,p[z+4>>2]=m,z)),f=k);f>>=2;g=p[g>>2];k=(d|0)==1?R.n|0:R.o|0;m=p[f];xw(b,R.Kj|0,(z=a,a+=12,p[z>>2]=g,p[z+4>>2]=k,p[z+8>>2]=m,z));if((e|0)==0&&(l[j]&16)<<24>>24==0){e=p[c+20>>2];g=c+16|0;k=b|0;c=c+68|0;for(m=0;;){var o=(m|0)==0,r=o|(e|0)<(m|0)?e:0,q=p[g>>2],s=(q|0)==0;a:do{if(s){var u=r}else{if(o){for(var w=r,v=q;;){var x=p[v+20>>2],w=(x|0)>(w|0)?x:w,v=p[v+32>>2];if((v|0)==0){u=w;break a}}}else{w=r;for(v=q;;){if(x=p[v+20>>2],w=(x|0)<(m|0)&(x|0)>(w|0)?x:w,v=p[v+32>>2],(v|0)==0){u=w;break a}}}}}while(0);if((u|0)==0){break}dC(b,u,rm(p[k>>2],p[c>>2]));m=u}}(l[j]&16)<<24>>24!=0&&hw(i,134,d,0,0,p[f],0);hw(i,108,d,0,0,p[f],0);yw(b,d);b=h+8|0;j=p[p[b>>2]+(d<<4)+12>>2];i=n[j+78>>1];if((i&2)<<16>>16!=0){u=p[j+16>>2];if((u|0)==0){d=j,h=i}else{for(i=u;;){if(j=p[i+8>>2],(p[j+28>>2]|0)!=0&&(Rf(h,j),p[(j+12|0)>>2]=0,p[(j+8|0)>>2]=0),i=p[i>>2],(i|0)==0){break}}d=h=p[p[b>>2]+(d<<4)+12>>2];h=n[h+78>>1]}n[d+78>>1]=h&-3}}Ow.X=1;function Rf(b,c){var d,e=c+12|0,f=p[e>>2];if((f|0)!=0){var g=c+8|0;if((p[g>>2]|0)>0){var h=0;for(d=f>>2;;){vf(b,p[d]);Df(b,p[d+1]);vf(b,p[d+2]);vf(b,p[d+3]);vf(b,p[d+4]);h=h+1|0;if((h|0)>=(p[g>>2]|0)){break}f=f+24|0;d=f>>2}e=p[e>>2]}else{e=f}vf(b,e)}}function ww(b,c){var d,e,f=a;a+=4;e=f>>2;var g=c+12|0;d=(c+8|0)>>2;var h=p[d],i=(h|0)>0;a:do{if(i){for(var j=0,k=0,m=p[g>>2];;){j=uG(p[m>>2])+(j+5)|0;k=k+1|0;if((k|0)>=(h|0)){var o=j;break a}m=m+24|0}}else{o=0}}while(0);k=c|0;j=uG(p[k>>2])+o|0;i=(o=(j|0)<50)?R.fb|0:R.ok|0;m=o?R.ac|0:R.pk|0;h=h*6+j+35|0;j=zh(0,h);if((j|0)==0){l[b+30|0]=1,d=0}else{Ch(h,j,R.qk|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));p[e]=ve(j);wG(j,f,p[k>>2]);var r=p[e],k=r+1|0;p[e]=k;l[j+r|0]=40;var r=(p[d]|0)>0,q=h-k|0,s=j+k|0;a:do{if(r){for(var u=o?xh|0:R.nk|0,w=0,v=p[g>>2],x=q,A=s,E=k;;){Ch(x,A,u,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));p[e]=ve(j+E|0)+E|0;wG(j,f,p[v>>2]);u=p[xG+((l[v+22|0]<<24>>24)-97<<2)>>2];E=ve(u);x=p[e];Ah(j+x|0,u,E);E=x+E|0;p[e]=E;w=w+1|0;x=h-E|0;A=j+E|0;if((w|0)>=(p[d]|0)){var J=x,M=A;break a}u=i;v=v+24|0}}else{J=q,M=s}}while(0);Ch(J,M,R.d|0,(z=a,a+=4,p[z>>2]=m,z));d=j}a=f;return d}ww.X=1;function wG(b,c,d){for(var e,f=p[c>>2],g=0;;){e=t[d+g|0];if(e<<24>>24==0){break}if(!((l[R.e+(e&255)|0]&6)<<24>>24!=0|e<<24>>24==95)){break}g=g+1|0}var h=t[d];if(((h&255)-48|0)>>>0<10){e=7}else{if(g=(Ho(d,g)|0)!=26,((g?g&1:e&255)|0)==0){var i=f,j=0,k=h;e=8}else{e=7}}e==7&&(l[b+f|0]=34,i=f+1|0,j=1,k=l[d]);f=k<<24>>24==0;a:do{if(f){var m=i}else{e=i;for(var h=0,o=d,g=k;;){var r=e+1|0;l[b+e|0]=g;l[o]<<24>>24==34?(l[b+r|0]=34,e=e+2|0):e=r;h=h+1|0;o=d+h|0;g=l[o];if(g<<24>>24==0){m=e;break a}}}}while(0);j?(l[b+m|0]=34,d=m+1|0):d=m;l[b+d|0]=0;p[c>>2]=d}wG.X=1;function Ki(b,c,d){var e=p[b+4>>2],f=l[b+9|0]<<24>>24==0;a:do{if(f){var g=0}else{if(!((p[e+76>>2]|0)!=(b|0)&&(n[e+22>>1]&32)<<16>>16!=0)){g=e+72|0;b:for(;;){g=p[g>>2];if((g|0)==0){g=0;break a}var h=(p[g>>2]|0)==(b|0);do{if(!h&&(p[g+4>>2]|0)==(c|0)&&l[g+8|0]<<24>>24!=d<<24>>24){break b}}while(0);g=g+12|0}d<<24>>24==2&&(n[(e+22|0)>>1]|=64)}g=262}}while(0);return g}function $f(b,c){var d,e;e=(c+52|0)>>2;var f=p[e];p[e]=0;var g=f,f=0;a:for(;;){for(var h=g;;){if((h|0)==0){break a}g=p[h>>2];d=(h+24|0)>>2;var i=p[d];if((g|0)==(b|0)){break}g=g+316|0;p[d]=p[g>>2];p[g>>2]=h;h=i}p[e]=h;p[d]=0;g=i;f=h}return f}function Qm(b,c,d,e,f){if((b|0)==0){var c=c+7&-8,g=y[d>>2],h=g+c|0;h>>>0>e>>>0?p[f>>2]=p[f>>2]+c|0:(p[d>>2]=h,b=g)}return b}function jw(b){var c,d=p[b+12>>2],e=p[b+420>>2],f=(e|0)==0;a:do{if(!f){var g=p[b>>2]+8|0,h=d+28|0;c=e;for(c>>=2;;){var i=p[c+2],j=p[c+3];eA(b,0,i,p[p[p[g>>2]+(i<<4)+12>>2]+72>>2],39);i=j+1|0;gw(d,10,0,j,i);var k=p[h>>2],m=j-1|0;hw(d,94,0,m,0,p[p[c+1]>>2],0);var o=k+9|0;V(d,72,0,o);gw(d,29,0,0,j);gw(d,75,m,k+7|0,j);sw(d,8);V(d,65,0,i);gw(d,29,0,1,j);V(d,1,0,o);V(d,95,0,k+2|0);V(d,7,0,j);ew(d,45);c=p[c];if((c|0)==0){break a}c>>=2}}}while(0)}jw.X=1;function nn(b,c,d,e,f,g,h){var i,j,k,m=a;a+=4;p[m>>2]=0;var o=ni(b,556);k=o>>2;var r=(o|0)==0;a:do{if(r){var q=7}else{p[k+117]=f;j=b+4|0;i=b+8|0;for(var s=0;;){if((s|0)>=(p[j>>2]|0)){break}var u=p[p[i>>2]+(s<<4)+4>>2],w=(u|0)==0;do{if(!w){var v;v=u;li(p[v>>2],p[v+4>>2]);v=Ki(v,1,1);if((v|0)!=0){c=p[p[i>>2]+(s<<4)>>2];$h(b,v,R.Dk|0,(z=a,a+=4,p[z>>2]=c,z));q=v;break a}}}while(0);s=s+1|0}tj(b);p[k]=b;j=o+448|0;xd[0]=1;p[j>>2]=C[0];p[j+4>>2]=C[1];j=(d|0)>-1;do{if(j){if((d|0)!=0&&l[c+(d-1)|0]<<24>>24==0){i=16}else{if((p[b+76>>2]|0)<(d|0)){$h(b,18,R.Ek|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));q=hk(b,18);break a}i=Mm(b,c,d);(i|0)==0?p[k+125]=c+d|0:(An(o,i,m),vf(b,i),s=o+500|0,p[s>>2]=c+(p[s>>2]-i)|0);i=17}}else{i=16}}while(0);i==16&&An(o,c,m);i=b+30|0;s=l[i]<<24>>24==0;j=(o+4|0)>>2;s?(p[j]|0)==101&&(p[j]=0):p[j]=7;l[o+17|0]<<24>>24!=0&&yG(o);l[i]<<24>>24!=0&&(p[j]=7);(h|0)!=0&&(p[h>>2]=p[k+125]);j=p[j];s=(j|0)==0;u=o+12|0;b:do{if(s){if(w=p[u>>2],(w|0)==0){var x=u}else{if(v=l[o+480|0],v<<24>>24==0){x=u}else{v<<24>>24==2?(Sx(w,4),w=12,v=8):(Sx(w,8),w=8,v=0);for(var A=v;;){if(Az(p[u>>2],A-v|0,0,p[zG+(A<<2)>>2],0),A=A+1|0,(A|0)>=(w|0)){x=u;break b}}}}}else{x=u}}while(0);l[b+124|0]<<24>>24==0&&(u=p[x>>2],w=e,(u|0)!=0&&(v=Mm(p[u>>2],c,p[k+125]-c|0),p[u+160>>2]=v,l[u+105|0]=w&255));u=p[x>>2];(u|0)==0?i=40:s&&l[i]<<24>>24==0?i=40:(gk(u),i=41);i==40&&(p[g>>2]=u);i=p[m>>2];(i|0)==0?$h(b,j,0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)):($h(b,j,R.d|0,(z=a,a+=4,p[z>>2]=i,z)),vf(b,i));i=(o+544|0)>>2;s=p[i];if((s|0)==0){q=j}else{for(;;){if(p[i]=p[s+20>>2],vf(b,s),s=p[i],(s|0)==0){q=j;break a}}}}}while(0);vf(b,o);b=hk(b,q);a=m;return b}nn.X=1;function tj(b){var c=b+316|0,d=p[c>>2];p[c>>2]=0;c=(d|0)==0;a:do{if(!c){Nm(p[b+136>>2]);for(var e=d;;){var f=p[e+24>>2];Jr(e);if((f|0)==0){break a}e=f}}}while(0)}function yG(b){var c=a;a+=4;var d=p[b>>2],e=d+4|0,f=d+8|0,g=d+30|0,b=b+4|0,h=0;a:for(;;){if((h|0)>=(p[e>>2]|0)){break}var i=p[p[f>>2]+(h<<4)+4>>2],j=(i|0)==0;do{if(!j){var k=(ki(l[i+8|0])|0)==0;do{if(k){var m=qi(i,0);if(!((m|0)==3082||(m|0)==7)){if((m|0)==0){m=1;break}else{break a}}l[g]=1;if((m|0)!=0){break a}m=1}else{m=0}}while(0);ri(p[i>>2],p[i+4>>2],1,c);(p[c>>2]|0)!=(p[p[p[f>>2]+(h<<4)+12>>2]>>2]|0)&&(Bi(d,h),p[b>>2]=17);(m|0)!=0&&WD(i)}}while(0);h=h+1|0}a=c}yG.X=1;function Gf(b,c){vf(b,p[c+28>>2]);vf(b,c)}function Hf(b,c){var d,e,f=p[c+36>>2],g=(f|0)==0;a:do{if(!g){var h=c+68|0,i=b+500|0;if((b|0)==0){i=f;for(e=i>>2;;){d=i+16|0;var j=p[d>>2],k=i+12|0,m=p[k>>2];(j|0)==0?(j=p[((m|0)==0?i:m)+8>>2],Ff(p[h>>2]+56|0,j,ve(j),m)):p[(j+12|0)>>2]=m;k=p[k>>2];(k|0)!=0&&(p[(k+16|0)>>2]=p[d>>2]);HF(0,p[e+7]);HF(0,p[e+8]);e=p[e+1];vf(0,i);if((e|0)==0){break a}i=e;e=i>>2}}else{e=f;for(d=e>>2;;){if((p[i>>2]|0)==0){var k=e+16|0,o=p[k>>2],m=e+12|0,j=p[m>>2];(o|0)==0?(o=p[((j|0)==0?e:j)+8>>2],Ff(p[h>>2]+56|0,o,ve(o),j)):p[(o+12|0)>>2]=j;m=p[m>>2];(m|0)!=0&&(p[(m+16|0)>>2]=p[k>>2])}HF(b,p[d+7]);HF(b,p[d+8]);d=p[d+1];vf(b,e);if((d|0)==0){break a}e=d;d=e>>2}}}}while(0)}Hf.X=1;function Km(b,c,d){(d|0)!=0&&((c|0)==-12||(c|0)==-13||(c|0)==-1||(c|0)==-6||(c|0)==-15||(c|0)==-16?vf(b,d):(c|0)==-11?(p[b+500>>2]|0)==0&&Lg(d):(c|0)==-7?(AG(b,p[d>>2]),(p[b+500>>2]|0)==0&&BG(d,0),vf(b,d)):(c|0)==-5?AG(b,d):(c|0)==-8?(p[b+500>>2]|0)==0?Hn(d):(vf(b,p[d+36>>2]),vf(b,d)):(c|0)==-10&&(p[b+500>>2]|0)==0&&Jr(d))}function Lm(b){b=b+12|0;p[b>>2]=p[b>>2]+1|0}function AG(b,c){(c|0)!=0&&(l[c+3|0]&4)<<24>>24!=0&&vf(b,c)}function BG(b,c){var d,e=b+4|0,f=p[e>>2],g=(f|0)>0;a:do{if(g){for(var h=0,i=f;;){if((h|0)>31){d=4}else{if((1<<h&c|0)==0){d=4}else{var j=i;d=8}}if(d==4){j=(h<<3)+b+8|0;d=p[j>>2];if((d|0)!=0){var k=p[b+(h<<3)+12>>2];(k|0)!=0&&(Gd[k](d),i=p[e>>2]);p[j>>2]=0}j=i}h=h+1|0;if((h|0)>=(j|0)){break a}i=j}}}while(0)}function km(b,c){tk(b);Ah(b,c,40);n[c+28>>1]=1;p[c+32>>2]=0;p[c+36>>2]=0}function Fl(b,c){var d=a;a+=60;if((c|0)==0){var e=0}else{if(e=p[c+20>>2],(e|0)==0){e=0}else{for(var f=d>>2,g=f+15;f<g;f++){p[f]=0}f=d+8|0;n[d+36>>1]=1;g=b|0;p[f>>2]=p[g>>2];p[d+48>>2]=b;p[d>>2]=c;Gd[e](d);vf(p[g>>2],p[b+36>>2]);Ah(b,f,40);e=p[d+52>>2]}}a=d;return e}function cl(b){var c=b|0,d=p[c>>2],e=(d|0)==0;a:do{if(!e){for(var f=b+4|0,g=d;;){var h=p[g>>2];vf(p[f>>2],g);if((h|0)==0){break a}g=h}}}while(0);p[c>>2]=0;n[b+24>>1]=0;p[b+8>>2]=0;p[b+12>>2]=0;p[b+20>>2]=0;l[b+26|0]=1}function Bl(b){var c,d,e,f,g=y[b>>2];f=(b+8|0)>>2;var h=y[f],i=h+40|0;ag(i,8);var j=b+20|0;p[j>>2]=0;e=(b+92|0)>>2;var k=(p[e]|0)==7;a:do{if(k){var m=l[g+30|0]=1}else{var o=b+28|0;c=y[o>>2];var m=b+97|0,r=l[m],q=r<<24>>24==1;b:do{if(q){var s=y[f],u=s+360|0;if((n[s+388>>1]&16)<<16>>16==0){var w=c,v=0;d=0;d>>=2;var x=u}else{var A=y[s+384>>2]>>>2,s=p[s+364>>2];if((A|0)==0){w=c,v=0,d=s,d>>=2,x=u}else{for(var E=0,J=c;;){if(J=p[p[s+(E<<2)>>2]+4>>2]+J|0,E=E+1|0,(E|0)>=(A|0)){w=J;v=A;d=s;d>>=2;x=u;break b}}}}}else{w=c,d=v=0,d>>=2,x=0}}while(0);q=b+88|0;c=b+4|0;u=r<<24>>24==2;for(r=p[q>>2];;){A=r+1|0;p[q>>2]=A;if((r|0)>=(w|0)){p[e]=0;m=101;break a}if(!u){break}if(l[p[c>>2]+r*20|0]<<24>>24==-106){break}r=A}if((p[g+224>>2]|0)==0){o=p[o>>2];if((r|0)<(o|0)){q=r,o=p[c>>2]+r*20|0}else{o=r-o|0;r=p[d];c=p[r+4>>2];q=(o|0)<(c|0);b:do{if(q){var M=o,D=r}else{A=o;s=0;for(u=c;;){if(A=A-u|0,s=s+1|0,E=p[(s<<2>>2)+d],u=p[E+4>>2],(A|0)<(u|0)){M=A;D=E;break b}}}}while(0);q=M;o=p[D>>2]+M*20|0}c=o>>2;u=l[m]<<24>>24==1;do{if(u){if(n[h+68>>1]=4,l[h+70|0]=1,r=(q|0)<0?-1:0,A=h+56|0,p[A>>2]=q,p[A+4>>2]=r,n[h+108>>1]=2562,r=p[CG+((t[o|0]&255)<<2)>>2],p[h+84>>2]=r,p[h+104>>2]=ve(r),l[h+110|0]=3,l[h+111|0]=1,r=h+120|0,l[o+1|0]<<24>>24==-18){A=(v<<2)+4|0;s=o+16|0;for(E=0;;){if((E|0)>=(v|0)){break}if((p[(E<<2>>2)+d]|0)==(p[s>>2]|0)){break}E=E+1|0}(E|0)==(v|0)&&(yk(x,A,1)|0)==0&&(p[((v<<2)+p[x+4>>2]|0)>>2]=p[s>>2],n[(x+28|0)>>1]|=16,p[x+24>>2]=A)}}else{r=i}}while(0);n[r+28>>1]=4;q=p[c+1];u=(q|0)<0?-1:0;A=r+16|0;p[A>>2]=q;p[A+4>>2]=u;l[r+30|0]=1;n[r+68>>1]=4;q=p[c+2];u=(q|0)<0?-1:0;A=r+56|0;p[A>>2]=q;p[A+4>>2]=u;l[r+70|0]=1;n[r+108>>1]=4;c=p[c+3];q=(c|0)<0?-1:0;u=r+96|0;p[u>>2]=c;p[u+4>>2]=q;l[r+110|0]=1;c=r+120|0;if((yk(c,32,0)|0)!=0){m=1}else{n[r+148>>1]=1538;u=r+124|0;q=DG(o,p[u>>2]);u=p[u>>2];(q|0)==(u|0)?(p[r+144>>2]=ve(u),l[r+151|0]=1):Tk(c,q,-1,1,0);l[r+150|0]=3;c=t[m];if(c<<24>>24==1){if((yk(r+160|0,4,0)|0)!=0){m=1;break}n[r+188>>1]=1538;p[r+184>>2]=2;o=t[o+3|0]&255;Ch(3,p[r+164>>2],R.wm|0,(z=a,a+=4,p[z>>2]=o,z));l[r+190|0]=3;l[r+191|0]=1;n[r+228>>1]=1;l[r+230|0]=5;m=l[m]}else{m=c}n[b+48>>1]=12-((m&255)<<2)&65535;p[j>>2]=p[f]+40|0;p[e]=0;m=100}}else{p[e]=9,m=ok(9),En(b+56|0,g,R.d|0,(z=a,a+=4,p[z>>2]=m,z)),m=1}}}while(0);return m}Bl.X=1;function Al(b){var c,d,e,f,g,h,i,j,k,m,o,r,q,s,u,w,v,x,A,E,J,M,D,K,H,N,Q,P,L,I,X,Y,da,ga,ha,ba,ea,ja,ra,Va,ta,xa,Fa,Na,Ea,La,za,Ba,Ja,ka,S,ib,Wa,Za,Sa,tb,pb,fb,Xa,Ab,rb,cb,Cb,Zb,dc,kb,Oa,Db,Wb,Nb,$b,Rb,Ra,Ob,Ua,Jb,Vb,Pb,sb,db,wb,ob,Kb,ub,Xb,Sb,Qb,ac,Gb,xb,Ta,qb,bc,$a,mb,Bb,bb,jb,nb,zb,Tb,ec,Hb,Eb,Lb,gb,Mb,vc,hc,kc,pc,jc,mc,Fb,Ub,Ya,Pa,yb,Ka,Ac,Jc,uc,Tc,Yc,ua,md,nd,Bc,Qc,Oc,ed,Fc,ud,Rc,Yb=a;a+=196;var W,bd=Yb+192;Rc=(b+4|0)>>2;var hd=p[Rc];ud=(b|0)>>2;var eb=y[ud];Fc=(eb+8|0)>>2;var Uc=t[p[p[Fc]+12>>2]+77|0];ed=(b+8|0)>>2;var cd=p[ed],vd=eb+48|0,id=vd|0;Oc=id>>2;var Zc=y[Oc],td=vd+4|0;Qc=td>>2;var zd=y[Qc];Bc=(b+92|0)>>2;var Id=(p[Bc]|0)==7;a:do{if(Id){var xc=0,qc=zd,Gc=Zc,Hc=0,zc=eb+30|0,Kc=b+56|0;W=835}else{p[Bc]=0;var wd=b+20|0;p[wd>>2]=0;p[eb+436>>2]=0;nd=(eb+224|0)>>2;var be=(p[nd]|0)==0;b:do{if(be){var ge=eb+276|0,Xd=(p[ge>>2]|0)==0;md=(b+88|0)>>2;var rc=eb+30|0,Lc=Yb|0;ua=Lc>>2;var Jd=b+168|0;Yc=Jd>>2;Tc=(b+176|0)>>2;uc=(b+108|0)>>2;var Qd=Uc&255,Fd=Uc<<24>>24==1;Jc=(eb+72|0)>>2;var Cd=b+72|0;Ac=Yb>>2;var ce=Yb+4|0;Ka=ce>>2;var Yd=ce;yb=Yd>>2;var Mc=Yb+8|0;Pa=Mc>>2;var jd=Yb+12|0;Ya=jd>>2;Ub=Yb>>2;var gc=Yb,fd=Yb+20|0;Fb=fd>>2;var Sd=Yb+28|0;mc=Sd>>2;var $c=ce,Ad=jd,Xe=eb+152|0;jc=(b+160|0)>>2;var ef=eb+156|0;pc=(Yb+72|0)>>2;kc=(b+12|0)>>2;hc=(Yb+68|0)>>2;var oe=Mc+4|0,wf=Mc,Kd=Mc+8|0,ue=Kd;vc=(Mc+36|0)>>1;var xf=eb,Ge=Mc+40|0,yf=Mc+44|0;Mb=(Mc+52|0)>>2;var Re=Mc,Se=oe,tc=b+56|0,ff=Mc+56|0,he=Yb+16|0;gb=he>>2;var je=he,de=Yb+24|0,Me=de,od=Mc,ke=Yb+6|0,Zd=Mc,le=ce,ye=jd;Lb=ye>>2;var zf=fd;Eb=(fd|0)>>2;var Ye=de;Hb=Sd>>2;ec=(b+192|0)>>2;Tb=he>>2;zb=fd>>2;var Ze=Yb+60|0,Ae=Ze,Sf=Yb+56|0;nb=Sf>>2;jb=de>>2;bb=(b+68|0)>>2;Bb=Sd>>2;var cg=Yb+128|0;mb=(b+84|0)>>2;var If=Yb+40|0;$a=If>>2;bc=(Yb+32|0)>>2;var Jf=Yb+36|0;qb=Jf>>2;var Cg=Yb+96|0,Kf=Yb+64|0;Ta=Kf>>2;var Sg=Yb+44|0;xb=Sg>>2;Gb=(Yb+52|0)>>2;var Lf=Yb+120|0;ac=Lf>>2;var Te=Yb+108|0;Qb=Te>>2;Sb=(Yb+116|0)>>2;var gf=Yb+88|0,sg=Ze;Xb=(Yb+104|0)>>2;ub=(Yb+100|0)>>2;Kb=(Yb+48|0)>>2;var Mf=Yb+124|0;ob=Mf>>2;var He=Yb+112|0;wb=If>>2;db=Sg>>2;var $e=b+101|0;sb=Sf>>2;var Ne=Yb+32|0,Ue=fd;Pb=Ze>>2;var hf=Jf,Dg=Kf;Vb=(eb+144|0)>>2;Jb=(eb+484|0)>>2;Ua=(eb+480|0)>>2;var me=eb+28|0,jf=eb+476|0;Ob=jf>>2;var $d=eb+492|0,Nf=eb+488|0;Ra=de>>2;Rb=(eb+140|0)>>2;var Eg=eb+4|0;$b=(eb+12|0)>>2;var tg=fd,dg=Yb,eg=b+103|0;Nb=(b+120|0)>>2;var Af=b+152|0;Wb=Yb>>2;var Md=b+99|0,Tf=Sd,Tg=fd;Db=de>>2;Oa=Yb>>2;var Of=eb|0;kb=Mc>>2;var Uf=Yb+32|0,kf=jd,Vf=jd+4|0,af=Vf,Ug=kf+6|0,ug=jd+16|0,ie=Jf,lf=Yb+26|0,mh=Yb+40|0,Fg=Mc,fg=jd,gg=Yb,Ie=If;dc=(Yb+20|0)>>2;Zb=fd>>2;var Pf=de,Vg=Yb;Cb=(eb+188|0)>>2;var hg=Sd,Gg=Yb+32|0,ig=eb+184|0,jg=b+128|0,Wf=Yb,vg=Mc,kg=oe,lg=vg+6|0,Bf=Mc+16|0;cb=(eb+136|0)>>2;var bf=b+96|0,Xf=eb,mf=jd+8|0,Eh=tc,wg=Mc,Cf=eb+124|0,mg=jd+12|0,Qf=jd,ci=mg;rb=de>>2;Ab=Mc>>2;var di=eb+112|0;Xa=fd>>2;var Fh=b+24|0,Gh=b+50|0;fb=(b+28|0)>>2;var nh=b+188|0,nf=b+144|0;pb=(Yb+76|0)>>2;var Wg=he,Hh=he+48|0,Xg=he+8|0,xg=Xg,Yf=he+36|0,Hg=he+12|0,Yg=he+44|0,ei=he+40|0,fi=eb,Ui=he+52|0,zj=Ui,Aj=he+56|0,Vi=ce,wi=ce+8|0,fl=wi,mk=ce+4|0,nm=mk,om=Yb,gi=b+102|0,xi=ce,Bj=Mc,gl=Sd,Wi=fd,yi=de,hl=Mc;tb=(Yb+32|0)>>2;Sa=If>>2;Za=Yb>>2;var il=jd,nk=mf,jl=jd+36|0,kl=jd+52|0,Cj=eb+34|0;Wa=de>>2;ib=Sd>>2;var Dj=eb+284|0,pm=eb+280|0,O=p[md],aa=hd;S=aa>>2;var Z=zd,$=Zc,Ej=0,wa=0,ia=0,Aa=0,Fj=0,zi=0,U=cd;c:for(;;){if((Ej|0)!=0){var oh=O,Ih=Z,ph=$,qh=Ej,rh=ia;W=829;break a}if(l[rc]<<24>>24!=0){xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}if(Xd){var Gj=zi}else{if((p[Dj>>2]|0)==(zi|0)){if((Gd[p[ge>>2]](p[pm>>2])|0)!=0){oh=O;Ih=Z;ph=$;qh=9;rh=ia;W=829;break a}var ro=0}else{ro=zi}Gj=ro+1|0}if((l[aa+O*20+2|0]&2)<<24>>24==0){var va=Fj}else{var Om=p[S+(O*5|0)+2],so=U+Om*40|0,ar=U+Om*40+28|0;(n[ar>>1]&9312)<<16>>16!=0&&uk(so);n[ar>>1]=4;va=so}var zg=aa+O*20|0,Qa=t[zg]&255;d:do{if((Qa|0)==1){if((p[nd]|0)!=0){var Dr=O,Er=Z,Fr=$,Gr=ia,Hr=tc;break b}var ma=p[S+(O*5|0)+2]-1|0,na=aa,oa=Z,pa=$,qa=0,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=U;W=828}else{if((Qa|0)==2){var KI=p[S+(O*5|0)+1];n[(U+28>>1)+(KI*20|0)]=4;var NX=(O|0)<0?-1:0,LI=U+KI*40+16|0,Uh=LI|0;ka=Uh>>2;p[ka]=O;var Vh=LI+4|0;Ja=Vh>>2;p[Ja]=NX;ma=p[S+(O*5|0)+2]-1|0;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==3){var MI=U+p[S+(O*5|0)+1]*40+16|0,Ud=MI|0;Ba=Ud>>2;var Vd=MI+4|0;za=Vd>>2;ma=p[Ba];na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==4){var NI=p[S+(O*5|0)+1];n[(U+28>>1)+(NI*20|0)]=4;var Ir=U+NI*40+16|0,Ee=Ir|0;La=Ee>>2;var Fe=Ir+4|0;Ea=Fe>>2;p[ua]=p[La];var OX=(O|0)<0?-1:0,Sl=Ir|0;Na=Sl>>2;p[Na]=O;var Tl=Ir+4|0;Fa=Tl>>2;p[Fa]=OX;ma=p[ua];na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==5){(n[(U+28>>1)+(p[S+(O*5|0)+3]*20|0)]&1)<<16>>16==0?(ma=O,na=aa,oa=Z,pa=$,qa=0,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=U,W=828):W=24}else{if((Qa|0)==6){W=24}else{if((Qa|0)==7){var OI=p[S+(O*5|0)+1],PX=OI,QX=(OI|0)<0?-1:0,PI=va+16|0,Ee=PI|0;La=Ee>>2;p[La]=PX;Fe=PI+4|0;Ea=Fe>>2;p[Ea]=QX;ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==8){var QI=p[S+(O*5|0)+4],Ud=QI|0;Ba=Ud>>2;var RX=p[Ba],Vd=QI+4|0;za=Vd>>2;var SX=p[za],RI=va+16|0,Pi=RI|0;xa=Pi>>2;p[xa]=RX;var Qi=RI+4|0;ta=Qi>>2;p[ta]=SX;ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==130){n[va+28>>1]=8;var SI=p[S+(O*5|0)+4],TX=(C[0]=p[SI>>2],C[1]=p[SI+4>>2],xd[0]),TI=va+8|0;xd[0]=TX;p[TI>>2]=C[0];p[TI+4>>2]=C[1];ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==94){l[zg]=9;var UI=aa+O*20+16|0,Mx=UI,VI=p[Mx>>2],WI=ve(VI),Nx=aa+O*20+4|0;p[Nx>>2]=WI;if(Fd){var XI=0,YI=WI}else{var ZI=Tk(va,VI,-1,1,0);if((ZI|0)==18){var Ri=Z,Si=$;W=834;break}if((Lk(va,Qd)|0)!=0){xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}p[va+36>>2]=0;var $I=va+28|0;n[$I>>1]=n[$I>>1]&-3073|2048;var aJ=aa+O*20+1|0;l[aJ]<<24>>24==-1&&vf(eb,p[Mx>>2]);l[aJ]=-1;p[UI>>2]=p[va+4>>2];var bJ=p[va+24>>2];p[Nx>>2]=bJ;XI=ZI;YI=bJ}if((YI|0)>(p[Jc]|0)){Ri=Z,Si=$,W=834}else{var cJ=XI,dJ=Mx,eJ=Nx;W=46}}else{if((Qa|0)==9){cJ=0,dJ=aa+O*20+16|0,eJ=aa+O*20+4|0,W=46}else{if((Qa|0)==10){if(p[ua]=p[S+(O*5|0)+3]-p[S+(O*5|0)+2]|0,n[va+28>>1]=1,(p[ua]|0)>0){for(var Ox=va;;){var Px=Ox+40|0,fJ=Ox+68|0;(n[fJ>>1]&9312)<<16>>16!=0&&uk(Px);n[fJ>>1]=1;var gJ=p[ua]-1|0;p[ua]=gJ;if((gJ|0)<=0){ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=Px;Ia=U;W=828;break d}Ox=Px}}else{ma=O,na=aa,oa=Z,pa=$,qa=0,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=U,W=828}}else{if((Qa|0)==11){Tk(va,p[S+(O*5|0)+4],p[S+(O*5|0)+1],0,0),l[va+31|0]=Uc,ma=O,na=aa,oa=Z,pa=$,qa=0,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=U,W=828}else{if((Qa|0)==12){var Qx=p[Cd>>2]+(p[S+(O*5|0)+1]-1)*40|0;p[ua]=Qx;(EG(Qx)|0)!=0?(Ri=Z,Si=$,W=834):(Du(va,Qx,2048),ma=O,na=aa,oa=Z,pa=$,qa=0,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=U,W=828)}else{if((Qa|0)==13){var Rx=p[S+(O*5|0)+3];p[Ka]=Rx;var hJ=p[S+(O*5|0)+1];p[Pa]=hJ;var iJ=p[S+(O*5|0)+2];p[Ya]=iJ;var jJ=U+iJ*40|0;p[Ka]=Rx-1|0;if((Rx|0)==0){ma=O,na=aa,oa=Z,pa=$,qa=0,Ca=wa,Da=ia,Ga=Aa,Ha=jJ,Ia=U,W=828}else{for(var Kr=U+hJ*40|0,Lr=jJ;;){var kJ=Lr+36|0;p[ua]=p[kJ>>2];p[kJ>>2]=0;km(Lr,Kr);p[Kr+36>>2]=p[Ub];var lJ=Lr+40|0,mJ=p[yb];p[Ka]=mJ-1|0;if((mJ|0)==0){ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=lJ;Ia=U;W=828;break d}Kr=Kr+40|0;Lr=lJ}}}else{if((Qa|0)==14){var nJ=p[S+(O*5|0)+2],Mr=U+nJ*40|0;Du(Mr,U+p[S+(O*5|0)+1]*40|0,4096);if((n[(U+28>>1)+(nJ*20|0)]&4096)<<16>>16==0){ma=O,na=aa,oa=Z,pa=$,qa=0,Ca=wa,Da=ia,Ga=Aa,Ha=Mr,Ia=U,W=828}else{if((Mk(Mr)|0)==0){ma=O,na=aa,oa=Z,pa=$,qa=0,Ca=wa,Da=ia,Ga=Aa,Ha=Mr,Ia=U,W=828}else{xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}}}else{if((Qa|0)==15){var oJ=U+p[S+(O*5|0)+2]*40|0;Du(oJ,U+p[S+(O*5|0)+1]*40|0,4096);ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=oJ;Ia=U;W=828}else{if((Qa|0)==16){var pJ=FG(b,0);if((pJ|0)!=0){ma=O,na=aa,oa=Z,pa=$,qa=pJ}else{var qJ=GG(b,1);if((qJ|0)==0){W=62;break c}ma=O;na=aa;oa=Z;pa=$;qa=qJ}Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==91){var Nr=y[S+(O*5|0)+1],rJ=U+Nr*40|0,Ro=y[S+(O*5|0)+2],sJ=U+Ro*40|0,en=y[S+(O*5|0)+3],Or=U+en*40|0,tJ=U+Nr*40+28|0,uJ=n[tJ>>1];Va=(U+Ro*40+28|0)>>1;var vJ=n[Va];if(((vJ|uJ)&1)<<16>>16==0){if((uJ&16384)<<16>>16==0){var wJ=vJ}else{if((xk(rJ)|0)!=0){xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}wJ=n[Va]}if((wJ&16384)<<16>>16!=0&&(xk(sJ)|0)!=0){xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}if((n[tJ>>1]&18)<<16>>16==0&&(Kk(rJ,Qd)|0)!=0){xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}if((n[Va]&18)<<16>>16==0&&(Kk(sJ,Qd)|0)!=0){xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}var xJ=U+Nr*40+24|0;ra=(U+Ro*40+24|0)>>2;var Tx=p[ra]+p[xJ>>2]|0,UX=Tx,VX=(Tx|0)<0?-1:0,Uh=gc|0;ka=Uh>>2;p[ka]=UX;Vh=gc+4|0;Ja=Vh>>2;p[Ja]=VX;if((Tx|0)>(p[Jc]|0)){Ri=Z,Si=$,W=834}else{ja=(U+en*40+28|0)>>1;n[ja]=n[ja]&-16640|2;Ee=gc|0;La=Ee>>2;Fe=gc+4|0;Ea=Fe>>2;var yJ=(en|0)==(Ro|0);if((yk(Or,p[La]+2|0,yJ&1)|0)!=0){xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}ea=(U+en*40+4|0)>>2;yJ||Ah(p[ea],p[(U+4>>2)+(Ro*10|0)],p[ra]);Ah(p[ea]+p[ra]|0,p[(U+4>>2)+(Nr*10|0)],p[xJ>>2]);Uh=gc|0;ka=Uh>>2;Vh=gc+4|0;Ja=Vh>>2;l[p[ea]+p[ka]|0]=0;var So=gc|0;ba=So>>2;var Ux=gc+4|0,WX=(T.add(p[ba],p[Ux>>2],1,0),T.result[0]);l[p[ea]+WX|0]=0;n[ja]|=512;p[(U+24>>2)+(en*10|0)]=p[gc>>2];l[U+en*40+31|0]=Uc;ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=Or;Ia=U;W=828}}else{Xk(Or),ma=O,na=aa,oa=Z,pa=$,qa=0,Ca=wa,Da=ia,Ga=Aa,Ha=Or,Ia=U,W=828}}else{if((Qa|0)==86||(Qa|0)==87||(Qa|0)==88||(Qa|0)==89||(Qa|0)==90){var Vx=y[S+(O*5|0)+1],zJ=U+Vx*40|0;mm(zJ);var Wx=y[S+(O*5|0)+2],AJ=U+Wx*40|0;mm(AJ);var To=y[S+(O*5|0)+3],fn=U+To*40|0,BJ=U+Vx*40+28|0,CJ=U+Wx*40+28|0,DJ=(n[CJ>>1]|n[BJ>>1])&65535;p[ua]=DJ;var XX=(DJ&1|0)==0;e:do{if(XX){var YX=(n[BJ>>1]&4&n[CJ>>1])<<16>>16==0;do{if(!YX){var EJ=U+Vx*40+16|0,Oe=EJ|0;ha=Oe>>2;var mj=y[ha],Pe=EJ+4|0;ga=Pe>>2;var nj=y[ga],Ee=$c|0;La=Ee>>2;p[La]=mj;Fe=$c+4|0;Ea=Fe>>2;p[Ea]=nj;var FJ=U+Wx*40+16|0,Wh=FJ|0;da=Wh>>2;var Pr=p[da],Xh=FJ+4|0;Y=Xh>>2;var Qr=p[Y],Sl=Ad|0;Na=Sl>>2;p[Na]=Pr;Tl=Ad+4|0;Fa=Tl>>2;p[Fa]=Qr;var Rr=t[zg]&255;if((Rr|0)==86){if((Ot(Ad,mj,nj)|0)!=0){break}}else{if((Rr|0)==87){var Uo=Ad,GJ=mj,HJ=nj;if(GJ==0&&HJ==-2147483648){var IJ=p[Uo>>2],Xx=p[Uo+4>>2];if((Xx|0)>-1||(Xx|0)==-1&&IJ>>>0>4294967295){var Yx=1}else{var ZX=Xx^-2147483648;p[Uo>>2]=IJ^0;p[Uo+4>>2]=ZX;Yx=0}}else{var $X=(T.b(0,0,GJ,HJ),T.result[0]),Yx=Ot(Uo,$X,T.result[1])}if((Yx|0)!=0){break}}else{if((Rr|0)==88){if((HG(Ad,mj,nj)|0)!=0){break}}else{if((Rr|0)==89){if(mj==0&&nj==0){break e}else{if(mj==-1&&nj==-1&&Pr==0&&Qr==-2147483648){break}}var aY=(T.j(Pr,Qr,mj,nj),T.result[0]),bY=T.result[1],Oe=Ad|0;ha=Oe>>2;p[ha]=aY;Pe=Ad+4|0;ga=Pe>>2;p[ga]=bY}else{if(mj==0&&nj==0){break e}else{if(mj==-1&&nj==-1){var we=$c|0;X=we>>2;p[X]=1;var xe=$c+4|0;I=xe>>2;var KJ=p[I]=0,LJ=1}else{KJ=nj,LJ=mj}}var cY=(T.k(Pr,Qr,LJ,KJ),T.result[0]),dY=T.result[1],Ud=Ad|0;Ba=Ud>>2;p[Ba]=cY;Vd=Ad+4|0;za=Vd>>2;p[za]=dY}}}}var qd=Ad|0;L=qd>>2;var eY=p[L],sd=Ad+4|0;P=sd>>2;var fY=p[P],MJ=U+To*40+16|0,Ee=MJ|0;La=Ee>>2;p[La]=eY;Fe=MJ+4|0;Ea=Fe>>2;p[Ea]=fY;var NJ=U+To*40+28|0;n[NJ>>1]=n[NJ>>1]&-16640|4;ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=fn;Ia=U;W=828;break d}}while(0);var gY=Dk(zJ);xd[0]=gY;p[Fb]=C[0];p[Fb+1]=C[1];var Ul=Dk(AJ);xd[0]=Ul;p[mc]=C[0];p[mc+1]=C[1];var Sr=t[zg]&255;if((Sr|0)==86){var hY=(C[0]=p[Fb],C[1]=p[Fb+1],xd[0]),OJ=Ul+hY;xd[0]=OJ;p[mc]=C[0];p[mc+1]=C[1];var gn=OJ}else{if((Sr|0)==87){var iY=(C[0]=p[Fb],C[1]=p[Fb+1],xd[0]),PJ=Ul-iY;xd[0]=PJ;p[mc]=C[0];p[mc+1]=C[1];gn=PJ}else{if((Sr|0)==88){var jY=(C[0]=p[Fb],C[1]=p[Fb+1],xd[0]),QJ=Ul*jY;xd[0]=QJ;p[mc]=C[0];p[mc+1]=C[1];gn=QJ}else{if((Sr|0)==89){var RJ=(C[0]=p[Fb],C[1]=p[Fb+1],xd[0]);if(RJ==0){break}var SJ=Ul/RJ;xd[0]=SJ;p[mc]=C[0];p[mc+1]=C[1];gn=SJ}else{var TJ=(C[0]=p[Fb],C[1]=p[Fb+1],xd[0]),Tr=TJ>>>0,Ur=Math.min(Math.floor(TJ/4294967296),4294967295),we=$c|0;X=we>>2;p[X]=Tr;xe=$c+4|0;I=xe>>2;p[I]=Ur;var UJ=Ul>>>0,VJ=Math.min(Math.floor(Ul/4294967296),4294967295),Uh=Ad|0;ka=Uh>>2;p[ka]=UJ;Vh=Ad+4|0;Ja=Vh>>2;p[Ja]=VJ;if(Tr==0&&Ur==0){break}else{if(Tr==-1&&Ur==-1){we=$c|0;X=we>>2;p[X]=1;xe=$c+4|0;I=xe>>2;var WJ=p[I]=0,XJ=1}else{WJ=Ur,XJ=Tr}}var YJ=(T.k(UJ,VJ,XJ,WJ),T.result[0])+T.result[1]*4294967296;xd[0]=YJ;p[mc]=C[0];p[mc+1]=C[1];gn=YJ}}}}if((gn!=gn&1|0)==0){var kY=(C[0]=p[mc],C[1]=p[mc+1],xd[0]),ZJ=U+To*40+8|0;xd[0]=kY;p[ZJ>>2]=C[0];p[ZJ+4>>2]=C[1];var $J=U+To*40+28|0;n[$J>>1]=n[$J>>1]&-16640|8;if((p[ua]&8|0)!=0){ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=fn;Ia=U;W=828;break d}$C(fn);ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=fn;Ia=U;W=828;break d}}}while(0);Xk(fn);ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=fn;Ia=U;W=828}else{if((Qa|0)==148){if((p[Xe>>2]|0)!=0){var aK=p[S+(O*5|0)+4];if((aK|0)==0){var Zx=p[jc];p[ua]=Zx;if((Zx|0)==0){ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break}var bK=Zx}else{bK=p[ua]=aK}var dK=IG(b,bK);p[Ka]=dK;Gd[p[Xe>>2]](p[ef>>2],dK);vf(eb,p[Ka])}ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==18){var eK=t[aa+O*20+3|0]&255;p[pc]=eK;p[hc]=p[kc];var Vr=U+p[S+(O*5|0)+3]*40|0,fK=U+p[S+(O*5|0)+2]*40|0;p[Ka]=fK;for(var $x=p[ua]=0,gK=eK,hK=fK;;){if(($x|0)>=(gK|0)){break}p[(($x<<2)+p[hc]|0)>>2]=hK;var ay=p[Ka];if((n[ay+28>>1]&4096)<<16>>16==0){var iK=ay}else{if((Mk(ay)|0)!=0){xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}iK=p[Ka]}Ql(iK);var jK=p[ua]+1|0;p[ua]=jK;var kK=p[Ka]+40|0;p[Ka]=kK;$x=jK;gK=p[pc];hK=kK}var lK=aa+O*20+1|0;Q=(aa+O*20+16|0)>>2;if(l[lK]<<24>>24==-5){p[Pa]=p[Q],p[oe>>2]=0}else{var mK=p[Q];p[oe>>2]=mK;p[Pa]=p[mK>>2]}n[vc]=1;p[Kd>>2]=xf;p[Ge>>2]=0;p[yf>>2]=0;km(ue,Vr);n[vc]=n[vc]&-16640|1;p[Mb]=0;(l[p[Re>>2]+3|0]&8)<<24>>24!=0&&(p[ff>>2]=p[S+((O-1)*5|0)+4]);qd=vd|0;L=qd>>2;p[L]=$;sd=vd+4|0;P=sd>>2;p[P]=Z;Gd[p[p[Re>>2]+12>>2]](wf,p[pc],p[hc]);Wh=vd|0;da=Wh>>2;var by=y[da],Xh=vd+4|0;Y=Xh>>2;var cy=y[Y],nK=p[Se>>2];(nK|0)!=0&&(BG(nK,p[S+(O*5|0)+1]),p[Q]=p[Se>>2],l[lK]=-7);if(l[rc]<<24>>24!=0){tk(ue);xc=O;qc=cy;Gc=by;Hc=ia;zc=rc;Kc=tc;W=835;break a}if((p[Mb]|0)==0){var oK=0}else{var lY=wk(ue);En(tc,eb,R.d|0,(z=a,a+=4,p[z>>2]=lY,z));oK=p[Mb]}Lk(ue,Qd);km(Vr,ue);(EG(Vr)|0)==0?(ma=O,na=aa,oa=cy,pa=by,qa=oK,Ca=wa,Da=ia,Ga=Aa,Ha=Vr,Ia=U,W=828):(Ri=cy,Si=by,W=834)}else{if((Qa|0)==82||(Qa|0)==83||(Qa|0)==84||(Qa|0)==85){var pK=p[S+(O*5|0)+1],qK=p[S+(O*5|0)+2],dy=y[S+(O*5|0)+3],rK=U+dy*40|0;if(((n[(U+28>>1)+(qK*20|0)]|n[(U+28>>1)+(pK*20|0)])&1)<<16>>16==0){var mY=U+pK*40|0,sK=Gk(U+qK*40|0),nY=sK[0],oY=sK[1],Ee=gc|0;La=Ee>>2;p[La]=nY;Fe=gc+4|0;Ea=Fe>>2;p[Ea]=oY;var tK=Gk(mY),Pk=tK[0],oj=tK[1],ak=je|0;N=ak>>2;p[N]=Pk;var bk=je+4|0;H=bk>>2;p[H]=oj;var Vo=l[zg];l[Me]=Vo;if(Vo<<24>>24==82){qd=gc|0;L=qd>>2;sd=gc+4|0;P=sd>>2;var uK=p[L]&Pk,pY=p[P]&oj,fh=gc|0;K=fh>>2;p[K]=uK;var gh=gc+4|0;D=gh>>2;var Wo=p[D]=pY,Xo=uK}else{if(Vo<<24>>24==83){qd=gc|0;L=qd>>2;sd=gc+4|0;P=sd>>2;var vK=p[L]|Pk,qY=p[P]|oj,fh=gc|0;K=fh>>2;p[K]=vK;gh=gc+4|0;D=gh>>2;Wo=p[D]=qY;Xo=vK}else{if(Pk==0&&oj==0){qd=gc|0,L=qd>>2,sd=gc+4|0,P=sd>>2,Wo=p[P],Xo=p[L]}else{if((oj|0)<0||(oj|0)==0&&Pk>>>0<0){var wK=-87-Vo&255;l[Me]=wK;var rY=(T.b(0,0,Pk,oj),T.result[0]),sY=T.result[1],xK=(oj|0)>-1||(oj|0)==-1&&Pk>>>0>4294967232,yK=xK?rY:64,tY=xK?sY:0,ak=je|0;N=ak>>2;p[N]=yK;bk=je+4|0;H=bk>>2;var Wr=p[H]=tY,Yo=yK,ey=wK}else{Wr=oj,Yo=Pk,ey=Vo}fh=gc|0;K=fh>>2;var Zo=p[K],gh=gc+4|0;D=gh>>2;var Vl=p[D];if((Wr|0)>0||(Wr|0)==0&&Yo>>>0>63){if((Vl|0)>-1||(Vl|0)==-1&&Zo>>>0>4294967295){var zK=0,fy=0}else{var AK=ey<<24>>24!=84,zK=(AK|0)<0?-1:0,fy=AK}we=gc|0;X=we>>2;p[X]=fy;xe=gc+4|0;I=xe>>2;Wo=p[I]=zK;Xo=fy}else{qd=od|0;L=qd>>2;p[L]=Zo;sd=od+4|0;P=sd>>2;p[P]=Vl;if(ey<<24>>24==84){var BK=nc(Zo,Vl,"shl",Yo),CK=BK[0],uY=BK[1],Oe=od|0;ha=Oe>>2;p[ha]=CK;Pe=od+4|0;ga=Pe>>2;var gy=p[ga]=uY,Xr=CK}else{var DK=nc(Zo,Vl,"lshr",Yo),hy=DK[0],iy=DK[1],Oe=od|0;ha=Oe>>2;p[ha]=hy;Pe=od+4|0;ga=Pe>>2;p[ga]=iy;if((Vl|0)<0||(Vl|0)==0&&Zo>>>0<0){var vY=(T.b(64,0,Yo,Wr),T.result[0]),EK=nc(-1,-1,"shl",vY),FK=EK[0]|hy,wY=EK[1]|iy,Pi=od|0;xa=Pi>>2;p[xa]=FK;Qi=od+4|0;ta=Qi>>2;gy=p[ta]=wY;Xr=FK}else{gy=iy,Xr=hy}}we=gc|0;X=we>>2;p[X]=Xr;xe=gc+4|0;I=xe>>2;Wo=p[I]=gy;Xo=Xr}}}}var GK=U+dy*40+16|0,Ud=GK|0;Ba=Ud>>2;p[Ba]=Xo;Vd=GK+4|0;za=Vd>>2;p[za]=Wo;var HK=U+dy*40+28|0;n[HK>>1]=n[HK>>1]&-16640|4}else{Xk(rK)}ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=rK;Ia=U;W=828}else{if((Qa|0)==20){var IK=p[S+(O*5|0)+1];JG(U+IK*40|0);var JK=p[S+(O*5|0)+2],xY=JK,yY=(JK|0)<0?-1:0,Yr=U+IK*40+16|0,Wl=Yr|0;M=Wl>>2;var zY=p[M],Xl=Yr+4|0;J=Xl>>2;var AY=(T.add(zY,p[J],xY,yY),T.result[0]),BY=T.result[1],Sl=Yr|0;Na=Sl>>2;p[Na]=AY;Tl=Yr+4|0;Fa=Tl>>2;p[Fa]=BY;ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==21){var KK=p[S+(O*5|0)+1];WC(U+KK*40|0,99,Uc);var LK=U+KK*40+28|0,MK=n[LK>>1];if((MK&4)<<16>>16==0){var NK=p[S+(O*5|0)+2];if((NK|0)==0){var sf=20;W=836;break c}ma=NK-1|0}else{n[LK>>1]=MK&-16640|4,ma=O}na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==22){var OK=p[S+(O*5|0)+1];(n[(U+28>>1)+(OK*20|0)]&4)<<16>>16!=0&&KG(U+OK*40|0);ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==141){var QK=p[S+(O*5|0)+1],RK=U+QK*40|0;E=(U+QK*40+28|0)>>1;var jy=Vc[E];if((jy&1)<<16>>16!=0){ma=O,na=aa,oa=Z,pa=$,qa=0}else{n[E]=(jy&65535)>>>3&2|jy;WC(RK,97,Uc);var SK=Vc[E];if((SK&16384)<<16>>16==0){var TK=0,UK=SK}else{TK=xk(RK),UK=n[E]}n[E]=UK&-16413;ma=O;na=aa;oa=Z;pa=$;qa=TK}Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==142){var VK=p[S+(O*5|0)+1],CY=U+VK*40|0;A=(U+VK*40+28|0)>>1;var WK=Vc[A],XK=WK&65535;(XK&1|0)==0&&((XK&16|0)==0?(WC(CY,97,Uc),n[A]=n[A]&-16640|16):n[A]=WK&-240);ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==143){XC(U+p[S+(O*5|0)+1]*40|0),ma=O,na=aa,oa=Z,pa=$,qa=0,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=U,W=828}else{if((Qa|0)==144){var YK=p[S+(O*5|0)+1];(n[(U+28>>1)+(YK*20|0)]&1)<<16>>16==0&&JG(U+YK*40|0);ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==145){var ZK=p[S+(O*5|0)+1];(n[(U+28>>1)+(ZK*20|0)]&1)<<16>>16==0&&KG(U+ZK*40|0);ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==76||(Qa|0)==75||(Qa|0)==79||(Qa|0)==78||(Qa|0)==77||(Qa|0)==80){var $K=p[S+(O*5|0)+1],ky=U+$K*40|0,aL=p[S+(O*5|0)+3],ly=U+aL*40|0;x=(U+$K*40+28|0)>>1;var my=Vc[x];n[ke>>1]=my;v=(U+aL*40+28|0)>>1;var ny=Vc[v];n[Zd>>1]=ny;var bL=aa+O*20+3|0,cL=t[bL],oy=cL&255;if(((my|ny)&1)<<16>>16==0){var py=cL&103;l[le]=py;if(py<<24>>24!=0&&(WC(ky,py,Uc),WC(ly,l[le],Uc),l[rc]<<24>>24!=0)){xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}(n[x]&16384)<<16>>16!=0&&xk(ky);(n[v]&16384)<<16>>16!=0&&xk(ly);var Rk=Cu(ly,ky,p[S+(O*5|0)+4])}else{if((oy&128|0)==0){if((oy&16|0)==0){if((oy&8|0)==0){ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break}ma=p[S+(O*5|0)+2]-1|0;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break}var dL=p[S+(O*5|0)+2],DY=U+dL*40|0,eL=U+dL*40+28|0;n[eL>>1]=n[eL>>1]&-16640|1;ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=DY;Ia=U;W=828;break}else{Rk=(ny&1&my^1)&65535}}p[ua]=Rk;var $o=t[zg]&255;if(($o|0)==76){var EY=(Rk|0)==0&1,hn=p[ua]=EY}else{if(($o|0)==75){var FY=(Rk|0)!=0&1,hn=p[ua]=FY}else{if(($o|0)==79){var GY=Rk>>>31,hn=p[ua]=GY}else{if(($o|0)==78){var HY=(Rk|0)<1&1,hn=p[ua]=HY}else{if(($o|0)==77){var IY=(Rk|0)>0&1,hn=p[ua]=IY}else{var JY=Rk>>>31^1,hn=p[ua]=JY}}}}}if((l[bL]&16)<<24>>24==0){if((hn|0)==0){var qy=O,ry=va}else{qy=p[S+(O*5|0)+2]-1|0,ry=va}}else{var sy=y[S+(O*5|0)+2],KY=U+sy*40|0,fL=U+sy*40+28|0;n[fL>>1]=n[fL>>1]&-16640|4;var gL=p[ua],LY=gL,MY=(gL|0)<0?-1:0,hL=U+sy*40+16|0,ak=hL|0;N=ak>>2;p[N]=LY;bk=hL+4|0;H=bk>>2;p[H]=MY;qy=O;ry=KY}n[x]=n[ke>>1]&255|n[x]&-256;n[v]=n[Zd>>1]&255|n[v]&-256;ma=qy;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=ry;Ia=U;W=828}else{if((Qa|0)==23){ma=O,na=aa,oa=Z,pa=$,qa=0,Ca=p[S+(O*5|0)+4],Da=ia,Ga=Aa,Ha=va,Ia=U,W=828}else{if((Qa|0)==24){var ty=y[S+(O*5|0)+3];p[ua]=ty;p[gb]=p[S+(O*5|0)+4];p[Pa]=p[S+(O*5|0)+1];p[Ya]=p[S+(O*5|0)+2];var NY=(wa|0)==0;e:do{if(NY){for(var iL=Aa,uy=0,jL=ty;;){var ap=p[Ka]=uy;if((ap|0)>=(jL|0)){ma=O;na=aa;oa=Z;pa=$;Ca=qa=0;Da=ia;Ga=iL;Ha=va;Ia=U;W=828;break d}p[Eb]=uy;var kL=p[gb],lL=y[kL+(ap<<2)+12>>2];p[Ye>>2]=lL;p[Hb]=t[p[kL+8>>2]+ap|0]&255;var mL=Cu(U+(ap+p[Pa])*40|0,U+(p[Lb]+ap)*40|0,lL);if((mL|0)!=0){var vy=mL;break e}iL=0;uy=p[yb]+1|0;jL=p[ua]}}else{for(var nL=Aa,oL=0,pL=ty;;){var Zr=p[Ka]=oL;if((Zr|0)>=(pL|0)){ma=O;na=aa;oa=Z;pa=$;Ca=qa=0;Da=ia;Ga=nL;Ha=va;Ia=U;W=828;break d}var wy=y[wa+(Zr<<2)>>2];p[Eb]=wy;var qL=p[gb],rL=y[qL+(Zr<<2)+12>>2];p[Ye>>2]=rL;p[Hb]=t[p[qL+8>>2]+Zr|0]&255;var sL=Cu(U+(wy+p[Pa])*40|0,U+(p[Lb]+wy)*40|0,rL);if((sL|0)!=0){vy=sL;break e}nL=0;oL=p[yb]+1|0;pL=p[ua]}}}while(0);var OY=(p[Hb]|0)==0?vy:-vy|0,ma=O,na=aa,oa=Z,pa=$,Ca=qa=0,Da=ia,Ga=OY,Ha=va,Ia=U;W=828}else{if((Qa|0)==25){(Aa|0)<0?(ma=p[S+(O*5|0)+1]-1|0,na=aa,oa=Z,pa=$,qa=0,Ca=wa,Da=ia,Ga=Aa):(Aa|0)==0?(ma=p[S+(O*5|0)+2]-1|0,na=aa,oa=Z,pa=$,qa=0,Ca=wa,Da=ia,Ga=0):(ma=p[S+(O*5|0)+3]-1|0,na=aa,oa=Z,pa=$,qa=0,Ca=wa,Da=ia,Ga=Aa),Ha=va,Ia=U,W=828}else{if((Qa|0)==69||(Qa|0)==68){var tL=p[S+(O*5|0)+1];if((n[(U+28>>1)+(tL*20|0)]&1)<<16>>16==0){var uL=Gk(U+tL*40|0),xy=(uL[0]!=0||uL[1]!=0)&1}else{xy=2}p[ua]=xy;var vL=y[S+(O*5|0)+2];if((n[(U+28>>1)+(vL*20|0)]&1)<<16>>16==0){var wL=Gk(U+vL*40|0),xL=(wL[0]!=0||wL[1]!=0)&1;p[Ka]=xL;var yL=p[ua],zL=xL}else{p[Ka]=2,yL=xy,zL=2}var yy=t[(l[zg]<<24>>24==69?R.kr:R.lr)+yL*3+zL|0];p[ua]=yy&255;var $r=y[S+(O*5|0)+3],PY=U+$r*40|0;if(yy<<24>>24==2){var AL=U+$r*40+28|0;n[AL>>1]=n[AL>>1]&-16640|1}else{var BL=U+$r*40+16|0,Ud=BL|0;Ba=Ud>>2;p[Ba]=yy&255;Vd=BL+4|0;za=Vd>>2;p[za]=0;var CL=U+$r*40+28|0;n[CL>>1]=n[CL>>1]&-16640|4}ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=PY;Ia=U;W=828}else{if((Qa|0)==19){var DL=p[S+(O*5|0)+1],zy=U+p[S+(O*5|0)+2]*40|0;if((n[(U+28>>1)+(DL*20|0)]&1)<<16>>16==0){var EL=Gk(U+DL*40|0);$k(zy,(EL[0]==0&&EL[1]==0)&1,0)}else{Xk(zy)}ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=zy;Ia=U;W=828}else{if((Qa|0)==93){var FL=p[S+(O*5|0)+1],Ay=U+p[S+(O*5|0)+2]*40|0;if((n[(U+28>>1)+(FL*20|0)]&1)<<16>>16==0){var GL=Gk(U+FL*40|0);$k(Ay,GL[0]^-1,GL[1]^-1)}else{Xk(Ay)}ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=Ay;Ia=U;W=828}else{if((Qa|0)==26){var HL=p[ec]+p[S+(O*5|0)+1]|0;l[HL]<<24>>24==0?(l[HL]=1,ma=O):ma=p[S+(O*5|0)+2]-1|0;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==27||(Qa|0)==28){var IL=p[S+(O*5|0)+1];if((n[(U+28>>1)+(IL*20|0)]&1)<<16>>16==0){var By=Dk(U+IL*40|0)!=0&1;p[ua]=By;if(l[zg]<<24>>24!=28){var Cy=By}else{var QY=By^1,Cy=p[ua]=QY}}else{var RY=y[S+(O*5|0)+3],Cy=p[ua]=RY}ma=(Cy|0)==0?O:p[S+(O*5|0)+2]-1|0;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==73){ma=(n[(U+28>>1)+(p[S+(O*5|0)+1]*20|0)]&1)<<16>>16==0?O:p[S+(O*5|0)+2]-1|0,na=aa,oa=Z,pa=$,qa=0,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=U,W=828}else{if((Qa|0)==74){ma=(n[(U+28>>1)+(p[S+(O*5|0)+1]*20|0)]&1)<<16>>16!=0?O:p[S+(O*5|0)+2]-1|0,na=aa,oa=Z,pa=$,qa=0,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=U,W=828}else{if((Qa|0)==29){var JL=p[S+(O*5|0)+1];p[Ya]=JL;p[gb]=p[S+(O*5|0)+2];p[Eb]=0;for(var ck=Ze>>2,Dy=ck+10;ck<Dy;ck++){p[ck]=0}p[nb]=U+p[S+(O*5|0)+3]*40|0;p[jb]=0;var bp=y[p[bb]+(JL<<2)>>2];p[Eb]=bp;var KL=p[bp>>2];p[Bb]=KL;var SY=(KL|0)==0;do{if(SY){var as=p[bp+16>>2];if((as|0)>0){p[cg>>2]=U+as*40|0;p[ua]=p[(U+24>>2)+(as*10|0)];p[jb]=p[(U+4>>2)+(as*10|0)];p[(bp+76|0)>>2]=(l[aa+O*20+3|0]&32)<<24>>24==0?p[mb]:0;var Ey=0;W=250}else{var Fy=p[ua]=0;W=252}}else{var cp=LG(bp);if((cp|0)!=0){sf=cp;W=836;break c}var Gy=p[zb];w=Gy>>2;if(l[Gy+28|0]<<24>>24!=0){p[ua]=0,Fy=cp,W=252}else{if((p[w+19]|0)==(p[mb]|0)){p[ua]=p[w+20],p[jb]=p[w+23],Ey=cp,W=250}else{var LL=p[Bb];if(l[Gy+31|0]<<24>>24==0){MG(LL,Lc),Ey=0,W=250}else{NG(LL,$c);Oe=$c|0;ha=Oe>>2;Pe=$c+4|0;ga=Pe>>2;var NL=p[ha];p[ua]=NL;var OL=cp,Hy=NL;W=251}}}}}while(0);W==250&&(OL=Ey,Hy=p[ua],W=251);do{if(W==251){if((Hy|0)==0){Fy=OL}else{if(Hy>>>0>y[Jc]>>>0){Ri=Z;Si=$;W=834;break d}u=y[zb]>>2;var PL=y[u+5];p[$a]=PL;var QL=y[u+21];p[bc]=QL;var TY=(p[u+19]|0)==(p[mb]|0);e:do{if(!TY){p[ac]=0;var RL=(PL<<2)+QL|0;p[qb]=RL;p[u+22]=RL;p[(p[zb]+80|0)>>2]=p[ua];p[(p[zb]+76|0)>>2]=p[mb];var SL=p[jb];if((SL|0)==0){var bs=p[Bb],Iy=l[p[zb]+31|0]<<24>>24==0?l[bs+79|0]<<24>>24==1?OG(bs,Lf,1):0:l[bs+79|0]<<24>>24==1?OG(bs,Lf,0):0;p[Gb]=Iy;y[ua]>>>0>y[ac]>>>0?p[(p[zb]+92|0)>>2]=0:(p[jb]=Iy,p[(p[zb]+92|0)>>2]=Iy)}else{p[Gb]=SL}var TL=y[Gb],UL=t[TL],UY=UL<<24>>24>-1;do{if(!UY){var VL=XF(TL,Te)&255,WL=y[Qb];p[Sb]=VL;if(WL>>>0<=98307){var Jy=WL,Ky=VL;break}aj(67033);ma=O;na=aa;oa=Z;pa=$;qa=11;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break d}var XL=UL&255;p[Qb]=XL;p[Sb]=1;Jy=XL;Ky=1}while(0);var YL=p[$a]*5+3|0,ep=(YL|0)>(Jy|0)?Jy:YL;p[xb]=ep;var VY=(p[jb]|0)==0;do{if(VY){if((p[ac]|0)<(ep|0)){n[gf>>1]=0;p[sg>>2]=0;var ZL=PG(p[Bb],0,ep,t[p[zb]+31|0]&255,Ae);if((ZL|0)!=0){ma=O;na=aa;oa=Z;pa=$;qa=ZL;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break d}p[Gb]=p[Ta];Ly=p[xb];My=p[Sb]}else{var Ly=ep,My=Ky}}else{Ly=ep,My=Ky}}while(0);var $L=p[Gb];p[Xb]=$L+Ly|0;p[ub]=$L+My|0;var gp=0;f:for(;;){p[Kb]=gp;if((gp|0)>=(p[$a]|0)){break}var WY=y[ub]>>>0<y[Xb]>>>0;do{if(WY){p[((gp<<2)+p[qb]|0)>>2]=p[Qb];var Ny=y[ub],aM=t[Ny];if(aM<<24>>24>-1){var bM=aM&255;p[ob]=bM;var cM=Ny+1|0,dM=bM}else{var XY=XF(Ny,Mf),cM=p[ub]+(XY&255)|0,dM=p[ob]}p[ub]=cM;p[((p[Kb]<<2)+p[bc]|0)>>2]=dM;var eM=Rm(p[ob]);p[He>>2]=eM;var Oy=p[Qb],Py=eM;Oy>>>=0;Py>>>=0;c=Oy+Py>>>0;d=Oy+Py>4294967295;p[Qb]=c;if(!d){break}p[ub]=p[Xb]+1|0;break f}p[((gp<<2)+p[qb]|0)>>2]=0}while(0);gp=p[Kb]+1|0}tk(Ae);n[gf>>1]=1;var fM=y[ub],gM=y[Xb],YY=fM>>>0>gM>>>0;do{if(!YY){var hM=y[Qb],iM=y[ua];if(hM>>>0<=iM>>>0&&(fM|0)!=(gM|0)|(hM|0)==(iM|0)){var jM=p[qb];break e}}}while(0);aj(67113);ma=O;na=aa;oa=Z;pa=$;qa=11;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break d}var ZY=p[u+22],jM=p[qb]=ZY}while(0);var Qy=y[Tb],kM=y[jM+(Qy<<2)>>2];if((kM|0)==0){var lM=p[nb];if(l[aa+O*20+1|0]<<24>>24==-8){Du(lM,p[S+(O*5|0)+4],2048)}else{var mM=lM+28|0;n[mM>>1]=n[mM>>1]&-16640|1}}else{var nM=y[jb];if((nM|0)==0){p[xb]=Rm(p[p[bc]+(Qy<<2)>>2]);km(Ae,p[nb]);var oM=PG(p[Bb],p[p[qb]+(p[Tb]<<2)>>2],p[xb],t[p[zb]+31|0]&255,Ae);if((oM|0)!=0){ma=O;na=aa;oa=Z;pa=$;qa=oM;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break d}var pM=y[Ta];p[Gb]=pM;YF(pM,p[p[bc]+(p[Tb]<<2)>>2],p[nb])}else{var Ry=p[nb];if((n[Ry+28>>1]&9312)<<16>>16==0){var qM=Qy,rM=kM,sM=nM,tM=Ry}else{uk(Ry);var uM=p[Tb],qM=uM,rM=p[p[qb]+(uM<<2)>>2],sM=p[jb],tM=p[nb]}YF(sM+rM|0,p[p[bc]+(qM<<2)>>2],tM)}l[p[nb]+31|0]=Uc}(p[Cg>>2]|0)!=0&&(n[(p[nb]+28|0)>>1]&=-6145,n[(p[nb]+28|0)>>1]|=512,p[(p[nb]+4|0)>>2]=p[Ta],p[(p[nb]+36|0)>>2]=p[Cg>>2]);var $Y=Mk(p[nb]),ma=O,na=aa,oa=Z,pa=$,qa=$Y,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=U;W=828;break d}}}while(0);var vM=p[nb]+28|0;n[vM>>1]=n[vM>>1]&-16640|1;ma=O;na=aa;oa=Z;pa=$;qa=Fy;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==30){var Sy=p[S+(O*5|0)+4];p[ua]=Sy;var aZ=p[S+(O*5|0)+1];p[ua]=Sy+1|0;var Ty=l[Sy];l[le]=Ty;if(Ty<<24>>24==0){ma=O,na=aa,oa=Z,pa=$,qa=0,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=U,W=828}else{for(var hp=U+aZ*40|0,wM=Ty;;){if((n[hp+28>>1]&16384)<<16>>16==0){var xM=wM}else{xk(hp),xM=l[le]}WC(hp,xM,Uc);var yM=p[Ub];p[ua]=yM+1|0;var Uy=l[yM];l[le]=Uy;if(Uy<<24>>24==0){ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break d}hp=hp+40|0;wM=Uy}}}else{if((Qa|0)==31){we=od|0;X=we>>2;p[X]=0;xe=od+4|0;I=xe>>2;p[I]=0;p[gb]=0;p[Hb]=0;var cs=y[S+(O*5|0)+1];p[Kb]=cs;var zM=y[S+(O*5|0)+4];p[Gb]=zM;var Vy=U+cs*40|0;p[wb]=Vy;var AM=p[S+(O*5|0)+2];p[Kb]=AM;var BM=cs+(AM-1)|0;p[db]=U+BM*40|0;p[sb]=t[$e]&255;var Zl=y[S+(O*5|0)+3],CM=U+Zl*40|0,DM=Vy;p[Ka]=DM;if((cs|0)>(BM|0)){var EM=0,FM=0,GM=0,HM=0,IM=0}else{for(var Wy=Vy,JM=DM,Xy=zM;;){if((Xy|0)==0){var kn=JM}else{WC(Wy,l[Xy+((Wy-p[wb]|0)/40&-1)|0],Uc),kn=p[Ka]}var bZ=kn;if((n[kn+28>>1]&16384)<<16>>16==0){var ln=kn}else{(p[kn+24>>2]|0)>0?(xk(bZ),ln=p[Ka]):ln=kn}var Yy=QG(ln,p[sb]);p[qb]=Yy;var Zy=Rm(Yy),cZ=p[Dg>>2]=Zy,dZ=(Zy|0)<0?-1:0,Wh=od|0;da=Wh>>2;var eZ=p[da],Xh=od+4|0;Y=Xh>>2;var KM=(T.add(eZ,p[Y],cZ,dZ),T.result[0]),LM=T.result[1],id=od|0;Oc=id>>2;p[Oc]=KM;td=od+4|0;Qc=td>>2;p[Qc]=LM;var $y=p[Tb]+RG(Yy,0)|0;p[gb]=$y;(n[ln+28>>1]&16384)<<16>>16==0?(Zy|0)!=0&&(p[Hb]=0):p[Hb]=p[Hb]+p[ln+16>>2]|0;var MM=ln+40|0,NM=MM,OM=MM;p[Ka]=OM;if(NM>>>0>y[db]>>>0){break}Wy=NM;JM=OM;Xy=p[Gb]}EM=($y|0)<0?-1:0;GM=FM=$y;HM=LM;IM=KM}var az=RG(FM,EM);p[Ne>>2]=az;var es=GM+az|0,bz=(az|0)<(RG(es,(es|0)<0?-1:0)|0)?es+1|0:es;p[gb]=bz;var PM=p[Hb],fZ=PM,gZ=(PM|0)<0?-1:0,hZ=(T.add(bz,(bz|0)<0?-1:0,IM,HM),T.result[0]),cz=(T.b(hZ,T.result[1],fZ,gZ),T.result[0]),dz=T.result[1];p[Ue>>2]=cz;p[Ue+4>>2]=dz;var QM=p[Jc],RM=(QM|0)<0?-1:0;if((dz|0)>(RM|0)||(dz|0)==(RM|0)&&cz>>>0>QM>>>0){Ri=Z,Si=$,W=834}else{if((yk(CM,cz,0)|0)!=0){xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}var ez=y[(U+4>>2)+(Zl*10|0)];p[ua]=ez;var fz=y[Tb];if(fz>>>0<128){l[ez]=fz&255;var fs=1}else{fs=SG(ez,fz)&255}p[Pb]=fs;var gs=y[wb];p[Ka]=gs;var TM=y[db];if(gs>>>0>TM>>>0){var hs=gs,UM=TM,VM=fs}else{for(var WM=gs,gz=fs;;){var is=QG(WM,p[sb]);p[qb]=is;if(is>>>0<128){l[p[Ub]+gz|0]=is&255;var XM=1}else{XM=SG(p[Ub]+gz|0,is)&255}var hz=p[Pb]+XM|0;p[Pb]=hz;var YM=p[Ka]+40|0,ZM=YM;p[Ka]=YM;var $M=y[db];if(ZM>>>0>$M>>>0){break}WM=ZM;gz=hz}hs=p[wb];UM=$M;VM=hz}p[Ka]=hs;var iZ=hs>>>0>UM>>>0;e:do{if(!iZ){for(var aN=hs,iz=VM;;){var jZ=p[Ub]+iz|0,hh=Ue|0;s=hh>>2;var kZ=p[s],ih=Ue+4|0;q=ih>>2;var lZ=(T.b(kZ,p[q],iz,0),T.result[0]),mZ=TG(jZ,lZ,aN,p[sb]),cN=p[Pb]+mZ|0;p[Pb]=cN;var dN=p[Ka]+40|0,eN=dN;p[Ka]=dN;if(eN>>>0>y[db]>>>0){break e}aN=eN;iz=cN}}}while(0);qd=Ue|0;L=qd>>2;sd=Ue+4|0;P=sd>>2;p[(U+24>>2)+(Zl*10|0)]=p[L];var fN=U+Zl*40+28|0;n[fN>>1]=1040;p[(U+32>>2)+(Zl*10|0)]=0;var gN=p[Hb];(gN|0)!=0&&(p[(U+16>>2)+(Zl*10|0)]=gN,n[fN>>1]=17424);l[U+Zl*40+31|0]=1;ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=CM;Ia=U;W=828}}else{if((Qa|0)==32){var jz=p[p[p[bb]+(p[S+(O*5|0)+1]<<2)>>2]>>2];p[Pa]=jz;if((jz|0)==0){we=gc|0;X=we>>2;p[X]=0;xe=gc+4|0;I=xe>>2;var hN=p[I]=0,iN=0,jN=0}else{var nZ=UG(jz,gc),Oe=gc|0;ha=Oe>>2;Pe=gc+4|0;ga=Pe>>2;hN=nZ;iN=p[ga];jN=p[ha]}var lN=va+16|0,hh=lN|0;s=hh>>2;p[s]=jN;ih=lN+4|0;q=ih>>2;p[q]=iN;ma=O;na=aa;oa=Z;pa=$;qa=hN;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==33){var js=y[S+(O*5|0)+1];p[ua]=js;var ks=y[S+(O*5|0)+4];p[Ka]=ks;if((js|0)!=0){p[Ra]=0;for(var mN=jf,kz=0;;){var jp=p[mN>>2];p[gb]=jp;if((jp|0)==0){En(tc,eb,R.fl|0,(z=a,a+=4,p[z>>2]=ks,z));ma=O;na=aa;oa=Z;pa=$;qa=1;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break d}if((qm(p[jp>>2],ks)|0)==0){break}var nN=kz+1|0;p[Ra]=nN;mN=jp+12|0;kz=nN}var oZ=(p[Vb]|0)>0,oN=(js|0)==2;do{if(oZ){var pN=oN?R.ic|0:R.hl|0}else{if(oN&&(p[Rb]|0)>1){pN=R.ic|0}else{var pZ=(p[jp+12>>2]|0)==0;do{if(pZ){var qN=l[Nf]<<24>>24!=0;if(qN){if((js|0)!=1){lz=1,W=365}else{var rN=FG(b,1);if((rN|0)!=0){var pj=Z,qj=$,rj=rN;W=833;break a}l[me]=1;if((rk(b)|0)==5){p[md]=O;l[me]=0;p[Bc]=5;pj=Z;qj=$;rj=5;W=833;break a}l[Nf]=0;var mz=p[Bc],nz=qN;W=372}}else{var lz=0;W=365}}else{lz=0,W=365}}while(0);do{if(W==365){p[Ra]=p[Ua]-1-kz|0;for(var ls=0;;){p[Hb]=ls;if((ls|0)>=(p[Eg>>2]|0)){break}var sN=VG(p[p[Fc]+(ls<<4)+4>>2],p[ua],p[Ra]);if((sN|0)!=0){sf=sN;W=836;break c}ls=p[Hb]+1|0}(p[ua]|0)==2&&(p[$b]&512|0)!=0&&(Nm(p[cb]),Bi(eb,-1),p[$b]|=512);mz=0;nz=lz}}while(0);var tN=p[Ob],uN=p[gb],vN=uN,qZ=(tN|0)==(vN|0);e:do{if(qZ){var wN=uN,xN=vN}else{for(var oz=tN;;){p[Eb]=oz;p[Ob]=p[oz+12>>2];vf(eb,p[tg>>2]);p[Ua]=p[Ua]-1|0;var yN=p[Ob],zN=p[gb],AN=zN;if((yN|0)==(AN|0)){wN=zN;xN=AN;break e}oz=yN}}}while(0);if((p[ua]|0)==1){p[Ob]=p[xN+12>>2];vf(eb,p[gb]);if(nz){ma=O;na=aa;oa=Z;pa=$;qa=mz;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break d}p[Ua]=p[Ua]-1|0}else{var BN=wN+4|0,we=BN|0;X=we>>2;var rZ=p[X],xe=BN+4|0;I=xe>>2;var sZ=p[I],fh=$d|0;K=fh>>2;p[K]=rZ;gh=$d+4|0;D=gh>>2;p[D]=sZ;if(nz){ma=O;na=aa;oa=Z;pa=$;qa=mz;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break d}}var CN=WG(eb,p[ua],p[Ra]);if((CN|0)==0){ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break d}sf=CN;W=836;break c}}}while(0);En(tc,eb,R.gl|0,(z=a,a+=4,p[z>>2]=pN,z));ma=O;na=aa;oa=Z;pa=$;qa=5}else{if((p[Vb]|0)>0){En(tc,eb,R.el|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),ma=O,na=aa,oa=Z,pa=$,qa=5}else{p[Pa]=ve(ks);var pz=WG(eb,0,p[Ua]+p[Jb]|0);if((pz|0)!=0){sf=pz;W=836;break c}var ns=zh(eb,p[Pa]+17|0);p[Ya]=ns;if((ns|0)==0){ma=O,na=aa,oa=Z,pa=$,qa=0}else{p[ns>>2]=ns+16|0;Ah(p[p[Ya]>>2],p[Ka],p[Pa]+1|0);l[me]<<24>>24==0?p[Ua]=p[Ua]+1|0:(l[me]=0,l[Nf]=1);p[(p[Ya]+12|0)>>2]=p[Ob];p[Ob]=p[Ya];Pi=$d|0;xa=Pi>>2;var tZ=p[xa],Qi=$d+4|0;ta=Qi>>2;var uZ=p[ta],DN=p[Ya]+4|0,id=DN|0;Oc=id>>2;p[Oc]=tZ;td=DN+4|0;Qc=td>>2;p[Qc]=uZ;ma=O;na=aa;oa=Z;pa=$;qa=pz}}}Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==34){var qz=y[S+(O*5|0)+1];p[ua]=qz;var os=y[S+(O*5|0)+2];p[Ka]=os;var EN=(qz|0)==0;do{if(!EN){var rz=l[me]<<24>>24==0;p[Pa]=rz&1;var FN=(os|0)==0,vZ=FN|rz^1;do{if(!vZ&&(p[Rb]|0)>1){En(tc,eb,R.il|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));ma=O;na=aa;oa=Z;pa=$;qa=5;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break d}}while(0);if(!(rz&FN)){break}if((p[Vb]|0)<=0){break}En(tc,eb,R.jl|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));ma=O;na=aa;oa=Z;pa=$;qa=5;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break d}p[Pa]=0}while(0);if((qz|0)==(t[me]&255|0)){En(tc,eb,EN?R.kl|0:(os|0)!=0?R.ml|0:R.nl|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),ma=O,na=aa,oa=Z,pa=$,qa=1,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=U,W=828}else{var wZ=(os|0)==0;do{if(wZ){var GN=FG(b,1);if((GN|0)!=0){pj=Z;qj=$;rj=GN;W=833;break a}l[me]=p[ua]&255;if((rk(b)|0)!=5){break}p[md]=O;l[me]=1-p[ua]&255;p[Bc]=5;pj=Z;qj=$;rj=5;W=833;break a}XG(eb);l[me]=1}while(0);Vn(eb);var xZ=(p[Bc]|0)==0?101:1,pj=Z,qj=$,rj=xZ;W=833;break a}}else{if((Qa|0)==35){var sz=p[p[Fc]+(p[S+(O*5|0)+1]<<4)+4>>2];p[ua]=sz;if((sz|0)==0){ma=O,na=aa,oa=Z,pa=$,qa=0,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=U,W=828}else{var HN=aa+O*20+8|0,kp=qi(sz,p[HN>>2]);if((kp|0)==5){p[md]=O;p[Bc]=5;pj=Z;qj=$;rj=5;W=833;break a}else{if((kp|0)==0){if((p[HN>>2]|0)==0){ma=O,na=aa,oa=Z,pa=$,qa=0}else{if(l[eg]<<24>>24==0){ma=O,na=aa,oa=Z,pa=$,qa=kp}else{if(l[me]<<24>>24!=0&&(p[Rb]|0)<=1){ma=O,na=aa,oa=Z,pa=$,qa=kp}else{var IN=p[Nb];if((IN|0)==0){var JN=p[Jb]+1|0;p[Jb]=JN;var yZ=p[Ua]+JN|0,KN=p[Nb]=yZ}else{KN=IN}var LN=WG(eb,0,KN-1|0);if((LN|0)==0){var MN=p[dg>>2],tz,NN=p[MN+4>>2],zZ=p[Nb];li(p[MN>>2],NN);tz=$i(p[NN>>2],zZ)}else{tz=LN}Oe=$d|0;ha=Oe>>2;var AZ=p[ha],Pe=$d+4|0;ga=Pe>>2;var BZ=p[ga],Ee=Af|0;La=Ee>>2;p[La]=AZ;Fe=Af+4|0;Ea=Fe>>2;p[Ea]=BZ;ma=O;na=aa;oa=Z;pa=$;qa=tz}}}Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{sf=kp;W=836;break c}}}}else{if((Qa|0)==36){var ON=p[S+(O*5|0)+1];p[Ka]=ON;var PN=p[S+(O*5|0)+3];p[Pa]=PN;var QN=p[p[Fc]+(ON<<4)+4>>2];ri(p[QN>>2],p[QN+4>>2],PN,Lc);var RN=p[ua],CZ=(RN|0)<0?-1:0,SN=va+16|0,uz=SN|0;p[uz>>2]=RN;var vz=SN+4|0;p[vz>>2]=CZ;ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==37){var TN=aa+O*20+4|0;p[ua]=(p[TN>>2]<<4)+p[Fc]|0;var UN=p[S+(O*5|0)+3];JG(U+UN*40|0);var VN=p[p[Wb]+4>>2],WN=aa+O*20+8|0,DZ=p[WN>>2],mn=U+UN*40+16|0,So=mn|0;ba=So>>2;var Ux=mn+4|0,EZ=Ai(p[VN>>2],p[VN+4>>2],DZ,p[ba]),XN=p[WN>>2];(XN|0)==1?(qd=mn|0,L=qd>>2,sd=mn+4|0,P=sd>>2,p[(p[p[Wb]+12>>2]|0)>>2]=p[L],p[$b]|=512):(XN|0)==2&&(qd=mn|0,L=qd>>2,sd=mn+4|0,P=sd>>2,l[p[p[Wb]+12>>2]+76|0]=p[L]&255);(p[TN>>2]|0)==1&&(Nm(p[cb]),l[Md]=0);ma=O;na=aa;oa=Z;pa=$;qa=EZ;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==38){r=(aa+O*20+4|0)>>2;var ps=p[p[Fc]+(p[r]<<4)+4>>2];p[Pa]=ps;if((ps|0)==0){p[ua]=0;var YN=p[Ka]=0,ZN=0}else{ri(p[ps>>2],p[ps+4>>2],1,Lc);var $N=p[p[p[Fc]+(p[r]<<4)+12>>2]+4>>2];p[Ka]=$N;YN=p[ua];ZN=$N}if((YN|0)==(p[S+(O*5|0)+2]|0)&&(ZN|0)==(p[S+(O*5|0)+3]|0)){ma=O,na=aa,oa=Z,pa=$,qa=0}else{vf(eb,p[tc>>2]);var FZ=yl(eb,R.kc|0);p[tc>>2]=FZ;var aO=p[r];(p[p[p[Fc]+(aO<<4)+12>>2]>>2]|0)!=(p[ua]|0)&&Bi(eb,aO);l[Md]=1;ma=O;na=aa;oa=Z;pa=$;qa=17}Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==39||(Qa|0)==40){if(l[Md]<<24>>24!=0){ma=O,na=aa,oa=Z,pa=$,qa=4}else{p[ua]=0;p[Ka]=0;var wz=y[S+(O*5|0)+2];p[Pa]=wz;var qs=p[S+(O*5|0)+3];p[Ya]=qs;var xz=p[Fc];p[Tf>>2]=(qs<<4)+xz|0;p[Eb]=p[xz+(qs<<4)+4>>2];if(l[zg]<<24>>24==40){p[gb]=1;var bO=t[p[xz+(qs<<4)+12>>2]+76|0];(bO&255)<(t[$e]&255)&&(l[$e]=bO)}else{p[gb]=0}var GZ=l[aa+O*20+3|0]<<24>>24==0;do{if(!GZ){JG(U+wz*40|0);var cO=U+wz*40+16|0,Ud=cO|0;Ba=Ud>>2;Vd=cO+4|0;za=Vd>>2;var dO=p[Ba];p[Pa]=dO;if((dO|0)<2){aj(67903);sf=11;W=836;break c}}}while(0);var eO=aa+O*20+1|0,fO=l[eO];if(fO<<24>>24==-6){var gO=p[S+(O*5|0)+4];p[Ka]=gO;l[gO+4|0]=l[p[p[p[ud]+8>>2]+12>>2]+77|0];var HZ=(Vc[p[Ka]+6>>1]&65535)+1|0,yz=p[ua]=HZ}else{if(fO<<24>>24==-14){var IZ=p[S+(O*5|0)+4],yz=p[ua]=IZ}else{yz=p[ua]}}var zz=YG(b,p[S+(O*5|0)+1],yz,p[Lb],1);p[Db]=zz;if((zz|0)==0){xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}l[zz+28|0]=1;l[p[Db]+32|0]=1;var JZ=ZG(p[Tg>>2],p[Pa],p[Tb],p[Ka],p[p[Db]>>2]);p[(p[Db]+8|0)>>2]=p[Ka];l[p[Db]+30|0]=l[eO]<<24>>24!=-6&1;var hO=y[Db];l[hO+31|0]=l[hO+30|0]<<24>>24==0&1;ma=O;na=aa;oa=Z;pa=$;qa=JZ}Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==41||(Qa|0)==42){var Bz=YG(b,p[S+(O*5|0)+1],p[S+(O*5|0)+2],-1,1);p[ua]=Bz;if((Bz|0)==0){xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}l[Bz+28|0]=1;var Cz=aa+O*20+3|0,iO=yo(p[Of>>2],0,eb,p[Oa]+4|0,t[Cz]&255|9,1054);if((iO|0)==0){var jO=qi(p[p[Oa]+4>>2],1);if((jO|0)!=0){var rs=jO}else{var kO=aa+O*20+16|0,lO=kO,mO=y[Oa],nO=y[mO+4>>2];if((p[lO>>2]|0)==0){var KZ=ZG(nO,1,1,0,p[mO>>2]);l[p[Oa]+30|0]=1;rs=KZ}else{var pO=$G(nO,bd,t[Cz]&255|2);if((pO|0)==0){var qO=y[Oa],LZ=ZG(p[qO+4>>2],p[bd>>2],1,p[kO>>2],p[qO>>2]);p[(p[Oa]+8|0)>>2]=p[lO>>2];l[p[p[Oa]+8>>2]+4|0]=l[p[p[p[ud]+8>>2]+12>>2]+77|0];var rO=LZ}else{rO=pO}l[p[Oa]+30|0]=0;rs=rO}}}else{rs=iO}l[p[Oa]+32|0]=l[Cz]<<24>>24!=16&1;var sO=y[Oa];l[sO+31|0]=l[sO+30|0]<<24>>24==0&1;ma=O;na=aa;oa=Z;pa=$;qa=rs;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==43){var Dz=YG(b,p[S+(O*5|0)+1],p[S+(O*5|0)+2],-1,1);p[ua]=Dz;if((Dz|0)==0){xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}p[(Dz+8|0)>>2]=p[S+(O*5|0)+4];l[p[p[Oa]+8>>2]+4|0]=l[p[p[p[ud]+8>>2]+12>>2]+77|0];l[p[Oa]+33|0]=1;var tO,Ez=eb,uO=p[Oa],ss=fa,vO=a;a+=4;var Fz=ni(Ez,56),ss=Fz>>2;p[uO+68>>2]=Fz;if((Fz|0)==0){var Gz=7}else{var wO=VF(p[uO+8>>2],0,0,vO);p[ss+13]=wO;if((wO|0)==0){Gz=7}else{if((l[Ez+29|0]<<24>>24==2&1|0)==0){var xO=Ez+8|0,yO=p[p[p[p[xO>>2]+4>>2]+4>>2]+32>>2];p[ss+11]=yO*10|0;var zO=p[p[p[xO>>2]+12>>2]+80>>2];p[ss+12]=((zO|0)<10?10:zO)*yO|0}Gz=0}}a=vO;tO=Gz;ma=O;na=aa;oa=Z;pa=$;qa=tO;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==44){var Hz=YG(b,p[S+(O*5|0)+1],p[S+(O*5|0)+3],-1,0);p[ua]=Hz;if((Hz|0)==0){xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}l[Hz+28|0]=1;p[(p[Oa]+16|0)>>2]=p[S+(O*5|0)+2];l[p[Oa]+30|0]=1;l[p[Oa]+31|0]=0;ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==45){var AO=aa+O*20+4|0;aH(b,p[p[bb]+(p[AO>>2]<<2)>>2]);p[((p[AO>>2]<<2)+p[bb]|0)>>2]=0;ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==46||(Qa|0)==47||(Qa|0)==48||(Qa|0)==49){var Iz=y[p[bb]+(p[S+(O*5|0)+1]<<2)>>2];p[Pa]=Iz;if((p[Iz>>2]|0)==0){ma=p[S+(O*5|0)+2]-1|0,na=aa,oa=Z,pa=$,qa=0}else{p[Ka]=t[zg]&255;l[Iz+28|0]=0;var Jz=y[kb],MZ=l[Jz+30|0]<<24>>24==0;do{if(MZ){var BO=p[S+(O*5|0)+4];p[Uf>>2]=BO;p[Ya]=p[Jz+8>>2];n[af>>1]=BO&65535;l[Ug]=p[yb]&1;var CO=p[S+(O*5|0)+3],DO=U+CO*40|0;p[ug>>2]=DO;if((n[(U+28>>1)+(CO*20|0)]&16384)<<16>>16==0){var EO=Jz}else{xk(DO),EO=p[kb]}var FO=UF(p[EO>>2],kf,0,0,0,Lc);if((FO|0)!=0){sf=FO;W=836;break c}var us=l[p[kb]+25|0]=0}else{var lp=y[S+(O*5|0)+3],GO=U+lp*40|0;mm(GO);var HO=Gk(GO),NZ=HO[1],Uh=ie|0;ka=Uh>>2;p[ka]=HO[0];Vh=ie+4|0;Ja=Vh>>2;p[Ja]=NZ;l[p[kb]+25|0]=0;var IO=Vc[(U+28>>1)+(lp*20|0)]&65535,OZ=(IO&4|0)==0;do{if(OZ){if((IO&8|0)==0){ma=p[S+(O*5|0)+2]-1|0;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break d}qd=ie|0;L=qd>>2;var bm=p[L],sd=ie+4|0;P=sd>>2;var cm=p[P],PZ=bm==0&&cm==-2147483648;do{if(PZ){o=(U+lp*40+8|0)>>2;var JO=(C[0]=p[o],C[1]=p[o+1],xd[0]);if(JO<-0x7ffffffffffffc00|JO>0){p[ua]=1;var QZ=(C[0]=p[o],C[1]=p[o+1],xd[0])<0,KO=p[yb];do{if(QZ){if((KO|0)>47){var MO=bH(p[p[kb]>>2],Lc);if((MO|0)!=0){sf=MO;W=836;break c}}}else{if((KO|0)<48){var NO=cH(p[p[kb]>>2],Lc);if((NO|0)!=0){sf=NO;W=836;break c}}}}while(0);if((p[ua]|0)==0){ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break d}ma=p[S+(O*5|0)+2]-1|0;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break d}}}while(0);var OO=p[yb];if((OO|0)==46||(OO|0)==48){var PO=U+lp*40+8|0;if((C[0]=p[PO>>2],C[1]=p[PO+4>>2],xd[0])>bm+cm*4294967296){var QO=(T.add(bm,cm,1,0),T.result[0]),RZ=T.result[1],Ud=ie|0;Ba=Ud>>2;p[Ba]=QO;Vd=ie+4|0;za=Vd>>2;mp=p[za]=RZ;np=QO}else{var mp=cm,np=bm}}else{var RO=U+lp*40+8|0;if((C[0]=p[RO>>2],C[1]=p[RO+4>>2],xd[0])<bm+cm*4294967296){var SO=(T.add(bm,cm,-1,-1),T.result[0]),SZ=T.result[1],Ud=ie|0;Ba=Ud>>2;p[Ba]=SO;Vd=ie+4|0;za=Vd>>2;mp=p[za]=SZ;np=SO}else{mp=cm,np=bm}}}else{qd=ie|0,L=qd>>2,sd=ie+4|0,P=sd>>2,mp=p[P],np=p[L]}}while(0);var Lz=UF(p[p[kb]>>2],0,np,mp,0,Lc);if((Lz|0)!=0){sf=Lz;W=836;break c}if((p[ua]|0)!=0){us=0}else{l[p[kb]+25|0]=1;Ud=ie|0;Ba=Ud>>2;var TZ=p[Ba],Vd=ie+4|0;za=Vd>>2;var UZ=p[za],TO=p[kb]+60|0,Wl=TO|0;M=Wl>>2;p[M]=TZ;Xl=TO+4|0;J=Xl>>2;p[J]=UZ;us=Lz}}}while(0);l[p[kb]+29|0]=0;p[(p[kb]+76|0)>>2]=0;var Mz=p[yb],VZ=(Mz|0)>47,vs=p[ua];e:do{if(VZ){var WZ=(vs|0)<0;do{if(!WZ&&!((vs|0)==0&(Mz|0)==49)){p[ua]=0;ma=O;na=aa;oa=Z;pa=$;qa=us;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break d}}while(0);var UO=LF(p[p[kb]>>2],Lc);if((UO|0)!=0){sf=UO;W=836;break c}}else{var XZ=(vs|0)>0;do{if(!XZ&&!((vs|0)==0&(Mz|0)==46)){var VO=l[p[p[kb]>>2]+79|0]<<24>>24!=1&1;p[ua]=VO;var WO=us,XO=VO;W=490;break e}}while(0);var YO=PF(p[p[kb]>>2],Lc);if((YO|0)!=0){sf=YO;W=836;break c}}l[p[kb]+25|0]=0;W=489}while(0);W==489&&(WO=0,XO=p[ua]);ma=(XO|0)==0?O:p[S+(O*5|0)+2]-1|0;na=aa;oa=Z;pa=$;qa=WO}Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==50){var Nz=p[p[bb]+(p[S+(O*5|0)+1]<<2)>>2];p[ua]=Nz;if((p[Nz>>2]|0)!=0){l[Nz+28|0]=0;var ZO=Gk(U+p[S+(O*5|0)+2]*40|0),YZ=ZO[0],ZZ=ZO[1],$O=p[Oa]+52|0,Wh=$O|0;da=Wh>>2;p[da]=YZ;Xh=$O+4|0;Y=Xh>>2;p[Y]=ZZ;l[p[Oa]+25|0]=0;l[p[Oa]+29|0]=1}ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==51||(Qa|0)==52){p[ua]=0;var ws=p[p[bb]+(p[S+(O*5|0)+1]<<2)>>2];p[Ka]=ws;var Oz=p[S+(O*5|0)+3],$Z=U+Oz*40|0;if((p[ws>>2]|0)==0){var Pz=0}else{m=(aa+O*20+16|0)>>2;var aP=p[ws+8>>2];if((p[m]|0)>0){p[Eb]=aP;n[de>>1]=p[m]&65535;p[qb]=$Z;l[lf]=2;p[gb]=fd;var bP=ws,cP=fd}else{var Qz=VF(aP,mh,151,jd);p[gb]=Qz;if((Qz|0)==0){xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}WF(p[p[Ka]+8>>2],p[(U+24>>2)+(Oz*10|0)],p[(U+4>>2)+(Oz*10|0)],Qz);l[p[gb]+6|0]|=2;bP=p[Ka];cP=p[gb]}var dP=UF(p[bP>>2],cP,0,0,0,Mc);(p[m]|0)==0&&vf(eb,p[Ya]);if((dP|0)!=0){ma=O;na=aa;oa=Z;pa=$;qa=dP;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break}p[ua]=(p[Pa]|0)==0&1;l[p[Ka]+29|0]=0;p[(p[Ka]+76|0)>>2]=0;Pz=(p[ua]|0)!=0}ma=l[zg]<<24>>24==52?Pz?p[S+(O*5|0)+2]-1|0:O:Pz?O:p[S+(O*5|0)+2]-1|0;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==53){var eP=y[S+(O*5|0)+3],a_=U+eP*40|0;p[gb]=U+p[S+(O*5|0)+4]*40|0;var fP=p[p[bb]+(p[S+(O*5|0)+1]<<2)>>2];p[Ka]=fP;p[(fP+72|0)>>2]=0;p[(p[Ka]+76|0)>>2]=0;var gP=p[Ka],hP=y[gP>>2];p[Pa]=hP;var iP=gP+8|0,Rz=Vc[p[iP>>2]+6>>1];n[fg>>1]=Rz;for(var op=0;;){n[gg>>1]=op;if((op&65535)>=(Rz&65535)){if((hP|0)==0){ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break d}p[Eb]=p[iP>>2];n[de>>1]=Rz+1&65535;l[lf]=4;p[qb]=p[gb];JG(a_);var xs=U+eP*40+16|0,Wh=xs|0;da=Wh>>2;var b_=p[da],Xh=xs+4|0;Y=Xh>>2;var c_=p[Y],Sl=Ie|0;Na=Sl>>2;p[Na]=b_;Tl=Ie+4|0;Fa=Tl>>2;p[Fa]=c_;var jP=UF(p[Fg>>2],fd,0,0,0,p[Ka]+72|0),d_=(l[lf]&4)<<24>>24==0;do{if(d_){qd=Sd|0;L=qd>>2;var kP=p[L],sd=Sd+4|0;P=sd>>2;var lP=p[P],hh=Ie|0;s=hh>>2;ih=Ie+4|0;q=ih>>2;if(!(kP==p[s]&&lP==p[q])){qd=xs|0;L=qd>>2;p[L]=kP;sd=xs+4|0;P=sd>>2;p[P]=lP;ma=O;na=aa;oa=Z;pa=$;qa=jP;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break d}}}while(0);ma=p[S+(O*5|0)+2]-1|0;na=aa;oa=Z;pa=$;qa=jP;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break d}if((n[(p[gb]+28>>1)+((op&65535)*20|0)]&1)<<16>>16!=0){var e_=p[S+(O*5|0)+2]-1|0;p[Pa]=0;ma=e_;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break d}op=op+1&65535}}else{if((Qa|0)==54){var f_=p[S+(O*5|0)+3],Sz=y[p[bb]+(p[S+(O*5|0)+1]<<2)>>2];p[ua]=Sz;var Tz=p[Sz>>2];p[Ka]=Tz;if((Tz|0)==0){var g_=p[S+(O*5|0)+2]-1|0;p[(Sz+72|0)>>2]=0;ma=g_;na=aa;oa=Z;pa=$;qa=0}else{p[Pa]=0;var ys=U+f_*40+16|0,we=ys|0;X=we>>2;var mP=p[X],xe=ys+4|0;I=xe>>2;var nP=p[I],fh=Ad|0;K=fh>>2;p[K]=mP;gh=Ad+4|0;D=gh>>2;p[D]=nP;var h_=UF(Tz,0,mP,nP,0,Mc),ak=ys|0;N=ak>>2;var i_=p[N],bk=ys+4|0;H=bk>>2;var j_=p[H],oP=p[Oa]+60|0,dm=oP|0;k=dm>>2;p[k]=i_;var em=oP+4|0;j=em>>2;p[j]=j_;l[p[Oa]+25|0]=(p[Pa]|0)==0&1;l[p[Oa]+28|0]=0;p[(p[Oa]+76|0)>>2]=0;l[p[Oa]+29|0]=0;var pP=p[Pa],k_=(pP|0)==0?O:p[S+(O*5|0)+2]-1|0;p[(p[Oa]+72|0)>>2]=pP;ma=k_;na=aa;oa=Z;pa=$;qa=h_}Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==55){var zs=p[p[bb]+(p[S+(O*5|0)+1]<<2)>>2]+44|0,fh=zs|0;K=fh>>2;var qP=p[K],gh=zs+4|0;D=gh>>2;var rP=p[D],l_=(T.add(qP,rP,1,0),T.result[0]),m_=T.result[1],Uz=zs|0;p[Uz>>2]=l_;var Vz=zs+4|0;p[Vz>>2]=m_;var sP=va+16|0,dm=sP|0;k=dm>>2;p[k]=qP;em=sP+4|0;j=em>>2;p[j]=rP;ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==56){we=gc|0;X=we>>2;p[X]=0;xe=gc+4|0;I=xe>>2;p[I]=0;p[Ya]=0;var As=y[p[bb]+(p[S+(O*5|0)+1]<<2)>>2];p[Pa]=As;var tP=As|0,uP=p[tP>>2];if((uP|0)==0){var vP=0,wP=0,xP=0}else{var n_=l[As+27|0]<<24>>24==0;do{if(n_){var yP=uP+24|0,Oe=yP|0;ha=Oe>>2;var o_=p[ha],Pe=yP+4|0;ga=Pe>>2;var zP=[o_,p[ga]],AP=zP[0],BP=zP[1],Pi=gc|0;xa=Pi>>2;p[xa]=AP;Qi=gc+4|0;ta=Qi>>2;p[ta]=BP;if(AP==0&&BP==0){var Wz=cH(p[tP>>2],ye);if((Wz|0)!=0){sf=Wz;W=836;break c}if((p[Lb]|0)==0){NG(p[p[kb]>>2],gc);hh=gc|0;s=hh>>2;var CP=p[s],ih=gc+4|0;q=ih>>2;var DP=p[q];if(CP==-1&&DP==2147483647){l[p[kb]+27|0]=1;var Bs=0}else{var p_=(T.add(CP,DP,1,0),T.result[0]),q_=T.result[1],Ud=gc|0;Ba=Ud>>2;p[Ba]=p_;Vd=gc+4|0;za=Vd>>2;p[za]=q_;Bs=0}}else{we=gc|0,X=we>>2,p[X]=1,xe=gc+4|0,I=xe>>2,p[I]=0,Bs=Wz}}else{Bs=0}var EP=aa+O*20+12|0,FP=p[EP>>2];if((FP|0)!=0){var GP=p[Yc];if((GP|0)==0){var Xz=U+FP*40|0}else{for(var Cs=GP;;){p[Pf>>2]=Cs;var HP=p[Cs+64>>2];if((HP|0)==0){break}Cs=HP}Xz=p[Cs+16>>2]+p[EP>>2]*40|0}p[dc]=Xz;JG(Xz);var Ds=p[Zb]+16|0,fh=Ds|0;K=fh>>2;var IP=p[K],gh=Ds+4|0;D=gh>>2;var JP=p[D];if(IP==-1&&JP==2147483647){sf=13;W=836;break c}if(l[p[kb]+27|0]<<24>>24!=0){sf=13;W=836;break c}qd=gc|0;L=qd>>2;var KP=p[L],sd=gc+4|0;P=sd>>2;var Yz=p[P],Zz=(T.add(IP,JP,1,0),T.result[0]),$z=T.result[1];if((Yz|0)<($z|0)||(Yz|0)==($z|0)&&KP>>>0<Zz>>>0){qd=gc|0;L=qd>>2;p[L]=Zz;sd=gc+4|0;P=sd>>2;var LP=p[P]=$z,MP=Zz}else{LP=Yz,MP=KP}we=Ds|0;X=we>>2;p[X]=MP;xe=Ds+4|0;I=xe>>2;p[I]=LP}var r_=p[p[kb]>>2],Ud=gc|0;Ba=Ud>>2;var NP=p[Ba],Vd=gc+4|0;za=Vd>>2;var OP=p[za],s_=(T.add(NP,OP,1,0),T.result[0]),t_=T.result[1],PP=NP==-1&&OP==2147483647;dH(r_,PP?0:s_,PP?0:t_);var bA=p[kb];if(l[bA+27|0]<<24>>24==0){var QP=Bs,RP=bA;W=551}else{var SP=bA;W=545}}else{SP=As,W=545}}while(0);if(W==545){var TP=(T.add($&-1,Z&1073741823,1,0),T.result[0]),UP=T.result[1],Pi=gc|0;xa=Pi>>2;p[xa]=TP;Qi=gc+4|0;ta=Qi>>2;p[ta]=UP;p[gb]=0;for(var VP=SP,WP=UP,XP=TP;;){var YP=UF(p[VP>>2],0,XP,WP,0,ye);if((YP|0)!=0){var ZP=YP;break}if((p[Lb]|0)!=0){ZP=0;break}var $P=p[Tb]+1|0;p[gb]=$P;if(($P|0)>=100){sf=13;W=836;break c}Dh(8,Vg);var aQ=(p[Tb]|0)<5,Ud=gc|0;Ba=Ud>>2;Vd=gc+4|0;za=Vd>>2;var bQ=(T.add((aQ?16777215:-1)&p[Ba],(aQ?0:1073741823)&p[za],1,0),T.result[0]),cQ=T.result[1],dm=gc|0;k=dm>>2;p[k]=bQ;em=gc+4|0;j=em>>2;p[j]=cQ;VP=p[kb];WP=cQ;XP=bQ}QP=ZP;RP=p[kb]}l[RP+25|0]=0;l[p[kb]+29|0]=0;p[(p[kb]+76|0)>>2]=0;Wh=gc|0;da=Wh>>2;Xh=gc+4|0;Y=Xh>>2;vP=QP;wP=p[Y];xP=p[da]}var dQ=va+16|0,hh=dQ|0;s=hh>>2;p[s]=xP;ih=dQ+4|0;q=ih>>2;p[q]=wP;ma=O;na=aa;oa=Z;pa=$;qa=vP;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==57||(Qa|0)==58){var eQ=U+p[S+(O*5|0)+2]*40|0;p[ua]=eQ;p[gb]=p[p[bb]+(p[S+(O*5|0)+1]<<2)>>2];var Es=p[S+(O*5|0)+3];if(l[zg]<<24>>24==57){p[Ka]=U+Es*40|0;var fQ=U+Es*40+16|0,hh=fQ|0;s=hh>>2;ih=fQ+4|0;q=ih>>2;var cA=p[q],Fs=p[s]}else{cA=(Es|0)<0?-1:0,Fs=Es}we=od|0;X=we>>2;p[X]=Fs;xe=od+4|0;I=xe>>2;p[I]=cA;var pp=aa+O*20+3|0,gQ=l[pp];if((gQ&1)<<24>>24==0){var hQ=gQ}else{p[uc]=p[uc]+1|0,hQ=l[pp]}if((hQ&2)<<24>>24==0){var Gs=Z,Hs=$,dA=eQ}else{qd=vd|0,L=qd>>2,p[L]=Fs,sd=vd+4|0,P=sd>>2,Gs=p[P]=cA,Hs=Fs,dA=p[Ac]}(n[dA+28>>1]&1)<<16>>16!=0&&(p[dA+4>>2]=0,p[(p[Ac]+24|0)>>2]=0);p[Ra]=(l[pp]&16)<<24>>24==0?0:p[p[gb]+72>>2];var iQ=p[Ac];p[dc]=(n[iQ+28>>1]&16384)<<16>>16==0?0:p[iQ+16>>2];dH(p[p[gb]>>2],0,0);var jQ=p[Ac],fA=eH(p[p[gb]>>2],0,p[od>>2],p[od+4>>2],p[jQ+4>>2],p[jQ+24>>2],p[zf>>2],t[pp]&8,p[Ra]);l[p[gb]+25|0]=0;l[p[gb]+29|0]=0;p[(p[gb]+76|0)>>2]=0;if((fA|0)!=0){ma=O,na=aa,oa=Gs,pa=Hs,qa=fA}else{if((p[Cb]|0)==0){ma=O,na=aa,oa=Gs,pa=Hs,qa=0}else{var kQ=aa+O*20+16|0;if((p[kQ>>2]|0)!=0){var lQ=p[p[Fc]+(p[p[gb]+12>>2]<<4)>>2];p[hg>>2]=lQ;var mQ=p[kQ>>2];p[Gg>>2]=mQ;var nQ=(l[pp]&4)<<24>>24!=0?23:18;p[qb]=nQ;var u_=p[Cb],v_=p[ig>>2],dm=od|0;k=dm>>2;var w_=p[k],em=od+4|0;j=em>>2;Gd[u_](v_,nQ,lQ,mQ,w_,p[j])}ma=O;na=aa;oa=Gs;pa=Hs;qa=fA}}Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==59){we=gc|0;X=we>>2;p[X]=0;xe=gc+4|0;I=xe>>2;p[I]=0;var gA=p[p[bb]+(p[S+(O*5|0)+1]<<2)>>2];p[Pa]=gA;if((p[Cb]|0)!=0&&(p[S+(O*5|0)+4]|0)!=0){var oQ=gA+60|0,Oe=oQ|0;ha=Oe>>2;var x_=p[ha],Pe=oQ+4|0;ga=Pe>>2;var y_=p[ga],Ee=gc|0;La=Ee>>2;p[La]=x_;Fe=gc+4|0;Ea=Fe>>2;p[Ea]=y_}var pQ=LG(gA);if((pQ|0)!=0){sf=pQ;W=836;break c}dH(p[p[kb]>>2],0,0);var qQ=fH(p[p[kb]>>2]);p[(p[kb]+76|0)>>2]=0;if((qQ|0)==0){var rQ=p[Cb];if((rQ|0)!=0){var sQ=p[S+(O*5|0)+4];if((sQ|0)!=0){var z_=p[p[Fc]+(p[p[kb]+12>>2]<<4)>>2],A_=p[ig>>2],Uh=gc|0;ka=Uh>>2;var B_=p[ka],Vh=gc+4|0;Ja=Vh>>2;Gd[rQ](A_,9,z_,sQ,B_,p[Ja])}}}(p[S+(O*5|0)+2]&1|0)!=0&&(p[uc]=p[uc]+1|0);ma=O;na=aa;oa=Z;pa=$;qa=qQ;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==60){gH(eb,p[uc]),p[uc]=0,ma=O,na=aa,oa=Z,pa=$,qa=0,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=U,W=828}else{if((Qa|0)==61){var C_=p[p[bb]+(p[S+(O*5|0)+1]<<2)>>2],tQ=p[ua]=C_,uQ=U+p[S+(O*5|0)+3]*40|0,D_=Yd,iA=a;a+=4;var vQ=tQ+68|0,E_=hH(p[vQ>>2],iA);iH(p[tQ+8>>2],p[p[vQ>>2]+52>>2],1,p[uQ+4>>2],p[uQ+24>>2],E_,p[iA>>2],D_);a=iA;ma=(p[yb]|0)==0?O:p[S+(O*5|0)+2]-1|0;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==62){var xQ=U+p[S+(O*5|0)+2]*40|0,yQ=p[p[bb]+(p[S+(O*5|0)+1]<<2)>>2];p[ua]=yQ;var zQ,F_=p[yQ+68>>2],Js=xQ,kA=a;a+=4;var G_=hH(F_,kA),lA=p[kA>>2];if((yk(Js,lA,0)|0)==0){p[Js+24>>2]=lA;var AQ=Js+28|0;n[AQ>>1]=n[AQ>>1]&-16640|16;Ah(p[Js+4>>2],G_,lA);var BQ=0}else{BQ=7}a=kA;zQ=BQ;ma=O;na=aa;oa=Z;pa=$;qa=zQ;Ca=wa;Da=ia;Ga=Aa;Ha=xQ;Ia=U;W=828}else{if((Qa|0)==63||(Qa|0)==64){var qp=y[S+(O*5|0)+2],CQ=U+qp*40|0,mA=p[p[bb]+(p[S+(O*5|0)+1]<<2)>>2];p[ua]=mA;p[Ka]=p[mA>>2];var DQ=LG(mA);if((DQ|0)!=0){sf=DQ;W=836;break c}var EQ=p[Ka];if(l[p[Oa]+31|0]<<24>>24==0){MG(EQ,Mc);var FQ=y[Pa];if(FQ>>>0>y[Jc]>>>0){Ri=Z;Si=$;W=834;break}var GQ=FQ}else{NG(EQ,Ad);Oe=Ad|0;ha=Oe>>2;var HQ=p[ha],Pe=Ad+4|0;ga=Pe>>2;var IQ=p[ga],JQ=p[Jc],KQ=(JQ|0)<0?-1:0;if((IQ|0)>(KQ|0)||(IQ|0)==(KQ|0)&&HQ>>>0>JQ>>>0){Ri=Z;Si=$;W=834;break}var H_=HQ,GQ=p[Pa]=H_}if((yk(CQ,GQ,0)|0)!=0){xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}p[(U+24>>2)+(qp*10|0)]=p[Pa];var LQ=U+qp*40+28|0;n[LQ>>1]=n[LQ>>1]&-16640|16;var MQ=p[Ka],NQ=p[Pa],OQ=p[(U+4>>2)+(qp*10|0)],I_=l[p[Oa]+31|0]<<24>>24==0?Vm(MQ,0,NQ,OQ):Xm(MQ,0,NQ,OQ,0);l[U+qp*40+31|0]=1;ma=O;na=aa;oa=Z;pa=$;qa=I_;Ca=wa;Da=ia;Ga=Aa;Ha=CQ;Ia=U;W=828}else{if((Qa|0)==65){var on=y[p[bb]+(p[S+(O*5|0)+1]<<2)>>2];p[ua]=on;if(l[on+28|0]<<24>>24==0){if(l[on+29|0]<<24>>24==0){var PQ=on+36|0,QQ=p[PQ>>2];if((QQ|0)==0){var nA=LG(on);if((nA|0)!=0){sf=nA;W=836;break c}var oA=p[Oa];if(l[oA+25|0]<<24>>24==0){NG(p[oA>>2],$c);var Ks=0}else{var RQ=oA+60|0,Oe=RQ|0;ha=Oe>>2;var J_=p[ha],Pe=RQ+4|0;ga=Pe>>2;var K_=p[ga],Ee=$c|0;La=Ee>>2;p[La]=J_;Fe=$c+4|0;Ea=Fe>>2;p[Ea]=K_;Ks=nA}}else{var SQ=p[QQ>>2];p[Ya]=SQ;var TQ=p[SQ>>2];p[gb]=TQ;var L_=Gd[p[TQ+48>>2]](p[PQ>>2],$c);jH(b,p[Ya]);Ks=L_}}else{var UQ=on+52|0,Oe=UQ|0;ha=Oe>>2;var M_=p[ha],Pe=UQ+4|0;ga=Pe>>2;var N_=p[ga],Ee=$c|0;La=Ee>>2;p[La]=M_;Fe=$c+4|0;Ea=Fe>>2;p[Ea]=N_;Ks=0}Oe=$c|0;ha=Oe>>2;var O_=p[ha],Pe=$c+4|0;ga=Pe>>2;var P_=p[ga],VQ=va+16|0,fh=VQ|0;K=fh>>2;p[K]=O_;gh=VQ+4|0;D=gh>>2;p[D]=P_;ma=O;na=aa;oa=Z;pa=$;qa=Ks}else{n[va+28>>1]=1,ma=O,na=aa,oa=Z,pa=$,qa=0}Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==66){var WQ=p[p[bb]+(p[S+(O*5|0)+1]<<2)>>2];p[ua]=WQ;l[WQ+28|0]=1;l[p[Oa]+25|0]=0;var XQ=p[p[Oa]>>2];(XQ|0)!=0&&Cr(XQ);ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==67){var pA=p[p[bb]+(p[S+(O*5|0)+1]<<2)>>2];p[ua]=pA;var qA=p[pA>>2];p[Ka]=qA;p[Pa]=0;if((qA|0)==0){var YQ=0,ZQ=0,$Q=pA}else{YQ=cH(qA,Mc),ZQ=p[Pa]&255,$Q=p[Oa]}l[$Q+28|0]=ZQ;l[p[Oa]+29|0]=0;l[p[Oa]+25|0]=0;p[(p[Oa]+76|0)>>2]=0;var aR=p[S+(O*5|0)+2],ma=(aR|0)>0?(p[Pa]|0)==0?O:aR-1|0:O,na=aa,oa=Z,pa=$,qa=YQ,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=U;W=828}else{if((Qa|0)==70||(Qa|0)==71){p[jg>>2]=p[jg>>2]+1|0,W=612}else{if((Qa|0)==72){W=612}else{if((Qa|0)==81||(Qa|0)==92||(Qa|0)==95){if((p[nd]|0)!=0){Dr=O;Er=Z;Fr=$;Gr=ia;Hr=tc;break b}var rp=p[p[bb]+(p[S+(O*5|0)+1]<<2)>>2];p[ua]=rp;if((rp|0)==0){ma=O,na=aa,oa=Z,pa=$,qa=0}else{if((p[rp+68>>2]|0)==0){p[Ka]=1;var bR=Gd[p[S+(O*5|0)+4]](p[rp>>2],Yd)}else{bR=kH(eb,rp,Yd)}l[p[Oa]+28|0]=p[yb]&255;p[(p[Oa]+76|0)>>2]=0;if((p[yb]|0)==0){var dR=p[S+(O*5|0)+2]-1|0,eR=t[aa+O*20+3|0];if(eR<<24>>24==0){var rA=dR}else{var fR=((eR&255)-1<<2)+b+124|0;p[fR>>2]=p[fR>>2]+1|0;rA=dR}}else{rA=O}l[p[Oa]+25|0]=0;ma=rA;na=aa;oa=Z;pa=$;qa=bR}Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==96||(Qa|0)==97){var sA=y[p[bb]+(p[S+(O*5|0)+1]<<2)>>2];p[ua]=sA;var Ls=y[S+(O*5|0)+2],gR=U+Ls*40|0,hR=p[sA>>2];p[Ka]=hR;if((hR|0)==0){ma=O,na=aa,oa=Z,pa=$,qa=0}else{if((n[(U+28>>1)+(Ls*20|0)]&16384)<<16>>16==0){var Ms=sA}else{var iR=xk(gR);if((iR|0)!=0){ma=O;na=aa;oa=Z;pa=$;qa=iR;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break}Ms=p[Oa]}if((p[Ms+68>>2]|0)==0){var tA=p[(U+24>>2)+(Ls*10|0)];p[Pa]=tA;var jR=p[(U+4>>2)+(Ls*10|0)];p[Ya]=jR;var Q_=eH(p[Ka],jR,tA,(tA|0)<0?-1:0,xh|0,0,0,p[S+(O*5|0)+3],(l[aa+O*20+3|0]&16)<<24>>24==0?0:p[Ms+72>>2]);p[(p[Oa]+76|0)>>2]=0;ma=O;na=aa;oa=Z;pa=$;qa=Q_}else{var R_=lH(eb,Ms,gR),ma=O,na=aa,oa=Z,pa=$,qa=R_}}Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==98){var uA=p[p[bb]+(p[S+(O*5|0)+1]<<2)>>2];p[ua]=uA;var vA=p[uA>>2];p[Ka]=vA;if((vA|0)==0){ma=O,na=aa,oa=Z,pa=$,qa=0}else{p[Ya]=p[uA+8>>2];n[af>>1]=p[S+(O*5|0)+3]&65535;l[Ug]=0;p[ug>>2]=U+p[S+(O*5|0)+2]*40|0;var lR=UF(vA,kf,0,0,0,Mc),S_=(p[Pa]|lR|0)==0?fH(p[Ka]):lR;p[(p[Oa]+76|0)>>2]=0;ma=O;na=aa;oa=Z;pa=$;qa=S_}Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==99){var mR=p[p[bb]+(p[S+(O*5|0)+1]<<2)>>2];p[Ka]=mR;p[ua]=p[mR>>2];var nR=va+28|0;n[nR>>1]=1;if((p[Wf>>2]|0)!=0){var oR=LG(p[Ka]);if((oR|0)!=0){sf=oR;W=836;break c}if(l[p[Ka]+28|0]<<24>>24==0){var qR=mH(p[Wf>>2],od);if((qR|0)!=0){sf=qR;W=836;break c}qd=od|0;L=qd>>2;var T_=p[L],sd=od+4|0;P=sd>>2;var U_=p[P],rR=va+16|0,Ee=rR|0;La=Ee>>2;p[La]=T_;Fe=rR+4|0;Ea=Fe>>2;p[Ea]=U_;n[nR>>1]=4}}ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==100||(Qa|0)==101){var Ns=p[p[bb]+(p[S+(O*5|0)+1]<<2)>>2];p[ua]=Ns;if((p[Ns>>2]|0)==0){ma=O,na=aa,oa=Z,pa=$,qa=0}else{p[Pa]=p[Ns+8>>2];n[kg>>1]=p[S+(O*5|0)+4]&65535;l[lg]=l[aa+O*20+3|0]<<24>>24==0?2:3;p[Bf>>2]=U+p[S+(O*5|0)+3]*40|0;var sR,V_=Ns,W_=vg,tR=Yd,sp=fa,Os=a;a+=48;var sp=Os>>2,tp=Os+8;p[sp]=0;p[sp+1]=0;var uR=V_|0;NG(p[uR>>2],Os);var vR=p[sp],X_=(T.add(vR,p[sp+1],-1,-1),T.result[0]),wR=T.result[1];if(wR>>>0>0||wR>>>0==0&&X_>>>0>2147483646){p[tR>>2]=0;aj(62536);var wA=11}else{for(var Ps=tp>>2,Y_=Ps+10;Ps<Y_;Ps++){p[Ps]=0}var xR=PG(p[uR>>2],0,vR,1,tp);if((xR|0)!=0){wA=xR}else{var Z_=aG(p[tp+24>>2],p[tp+4>>2],W_);p[tR>>2]=Z_;tk(tp);wA=0}}a=Os;sR=wA;var yR=p[yb],zR=l[zg]<<24>>24==100?-yR|0:yR+1|0;p[Ka]=zR;ma=(zR|0)>0?p[S+(O*5|0)+2]-1|0:O;na=aa;oa=Z;pa=$;qa=sR}Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==102){p[Ka]=0;var xA=p[cb];p[Pa]=xA;var $_=(xA|0)==0;e:do{if(!$_){var up=0,Qs=xA;for(i=Qs>>2;;){if((p[i+13]|0)==-1108210269){if((t[Qs+102|0]&255)<2){if((p[i+22]|0)>-1){var a0=up+1|0,Rs=p[Ka]=a0}else{Rs=up}}else{var Rs=up}}else{Rs=up}var yA=y[i+16];p[Pa]=yA;if((yA|0)==0){break e}up=Rs;Qs=yA;i=Qs>>2}}}while(0);var AR=va+28|0;n[AR>>1]=1;if((p[yb]|0)>1){l[bf]=2,ma=O,na=aa,oa=Z,pa=$,qa=6,Ca=wa,Da=ia}else{var BR=p[S+(O*5|0)+3];p[Ya]=BR;var CR=aa+O*20+4|0,Ss,zA=p[p[Fc]+(BR<<4)+4>>2],b0=p[CR>>2],c0=Lc;li(p[zA>>2],p[zA+4>>2]);Ss=nH(zA,b0,c0);n[AR>>1]=4;var ER=p[ua],d0=ER,e0=(ER|0)<0?-1:0,FR=va+16|0,id=FR|0;Oc=id>>2;p[Oc]=d0;td=FR+4|0;Qc=td>>2;p[Qc]=e0;if((Ss|0)!=0){ma=O,na=aa,oa=Z,pa=$,qa=Ss,Ca=wa,Da=ia}else{var GR=p[ua];if((GR|0)==0){ma=O,na=aa,oa=Z,pa=$,qa=0,Ca=wa,Da=ia}else{var HR=GR,IR=p[CR>>2],JR=(p[Lb]<<4)+p[Fc]+12|0,KR=p[JR>>2],LR=p[KR+16>>2];if((LR|0)==0){var MR=KR}else{for(var AA=LR;;){var NR=p[AA+8>>2]+20|0;(p[NR>>2]|0)==(HR|0)&&(p[NR>>2]=IR);var OR=p[AA>>2];if((OR|0)==0){break}AA=OR}MR=p[JR>>2]}var PR=p[MR+32>>2],f0=(PR|0)==0;e:do{if(!f0){for(var BA=PR;;){var QR=p[BA+8>>2]+20|0;(p[QR>>2]|0)==(HR|0)&&(p[QR>>2]=IR);var RR=p[BA>>2];if((RR|0)==0){break e}BA=RR}}}while(0);ma=O;na=aa;oa=Z;pa=$;qa=Ss;Ca=wa;Da=p[Lb]+1&255}}}Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==103){p[ua]=0;var g0=p[p[Fc]+(p[S+(O*5|0)+2]<<4)+4>>2],h0=p[S+(O*5|0)+1];h=(aa+O*20+12|0)>>2;var i0=oH(g0,h0,(p[h]|0)==0?0:Lc);if((p[h]|0)!=0){var CA=p[ua];p[uc]=p[uc]+CA|0;var TR=p[h];if((TR|0)>0){var j0=CA,k0=(CA|0)<0?-1:0,Ts=U+TR*40+16|0,Ud=Ts|0;Ba=Ud>>2;var l0=p[Ba],Vd=Ts+4|0;za=Vd>>2;var m0=(T.add(l0,p[za],j0,k0),T.result[0]),n0=T.result[1],Pi=Ts|0;xa=Pi>>2;p[xa]=m0;Qi=Ts+4|0;ta=Qi>>2;p[ta]=n0}}ma=O;na=aa;oa=Z;pa=$;qa=i0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==104||(Qa|0)==105){p[ua]=0;var UR=p[S+(O*5|0)+1],VR=p[Fc];p[Pa]=(UR<<4)+VR|0;var WR=l[zg]<<24>>24==105?1:2;p[Ka]=WR;var o0=$G(p[VR+(UR<<4)+4>>2],Lc,WR),XR=p[ua],p0=XR,q0=(XR|0)<0?-1:0,YR=va+16|0,uz=YR|0;p[uz>>2]=p0;vz=YR+4|0;p[vz>>2]=q0;ma=O;na=aa;oa=Z;pa=$;qa=o0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==106){var ZR=aa+O*20+4|0,DA=p[ZR>>2];p[ua]=DA;var $R=(DA|0)==1?R.n:R.o;p[Ka]=$R;p[Ya]=Xf;p[Vf>>2]=p[ZR>>2];p[mf>>2]=Eh;var r0=p[p[Fc]+(DA<<4)>>2],s0=p[S+(O*5|0)+4],aS=zm(eb,R.ol|0,(z=a,a+=12,p[z>>2]=r0,p[z+4>>2]=$R,p[z+8>>2]=s0,z));p[Pa]=aS;if((aS|0)==0){xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}l[Cf]=1;p[mg>>2]=0;var bS=Ym(eb,p[wg>>2],46,Qf,0),cS=(bS|0)==0?p[ci>>2]:bS;vf(eb,p[wg>>2]);l[Cf]=0;if((cS|0)==7){xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}ma=O;na=aa;oa=Z;pa=$;qa=cS;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==107){var t0=VD(eb,p[S+(O*5|0)+1]),ma=O,na=aa,oa=Z,pa=$,qa=t0,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=U;W=828}else{if((Qa|0)==108){var EA=eb,dS=p[S+(O*5|0)+4],u0=Ff(p[p[EA+8>>2]+(p[S+(O*5|0)+1]<<4)+12>>2]+8|0,dS,ve(dS),0);rf(EA,u0);p[(EA+12|0)>>2]|=512;ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==109){var FA=eb,eS=p[S+(O*5|0)+4],Us=fa,vp=Ff(p[p[FA+8>>2]+(p[S+(O*5|0)+1]<<4)+12>>2]+24|0,eS,ve(eS),0),Us=vp>>2;if((vp|0)!=0){var fS=p[Us+4]+16|0,gS=p[fS>>2],v0=(gS|0)==(vp|0);e:do{if(v0){p[fS>>2]=p[Us+8]}else{for(var GA=gS;;){if((GA|0)==0){break e}var hS=GA+32|0,iS=p[hS>>2];if((iS|0)==(vp|0)){break}GA=iS}p[hS>>2]=p[Us+8]}}while(0);Gf(FA,vp)}p[(FA+12|0)>>2]|=512;ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==110){var HA=eb,jS=p[S+(O*5|0)+4],wp=fa,Vs=Ff(p[p[HA+8>>2]+(p[S+(O*5|0)+1]<<4)+12>>2]+40|0,jS,ve(jS),0),wp=Vs>>2;if((Vs|0)!=0){var kS=p[wp+6];if((p[wp+5]|0)==(kS|0)){for(var IA=Ao(kS+8|0,p[wp+1],ve(p[wp+1]))+64|0;;){var lS=p[IA>>2],mS=lS+32|0;if((lS|0)==(Vs|0)){break}IA=mS}p[IA>>2]=p[mS>>2]}qf(HA,Vs);p[(HA+12|0)>>2]|=512}ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==111){var nS=p[S+(O*5|0)+2];p[ua]=nS;var oS=zh(eb,(nS<<2)+4|0),pS=oS;p[Ka]=pS;if((oS|0)==0){xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}p[Eb]=U+p[S+(O*5|0)+3]*40|0;var qS=p[S+(O*5|0)+1],JA=U+qS*40|0;p[Pa]=0;if((p[ua]|0)>0){for(var rS=0;;){var w0=Gk(U+(rS+qS)*40|0)[0];p[((p[Pa]<<2)+p[Ka]|0)>>2]=w0;var Ws=p[Pa]+1|0;p[Pa]=Ws;if((Ws|0)>=(p[ua]|0)){break}rS=Ws}var sS=Ws,tS=p[Ka]}else{sS=0,tS=pS}p[tS+(sS<<2)>>2]=0;var uS=p[p[Fc]+((t[aa+O*20+3|0]&255)<<4)+4>>2],x0=p[Ka],y0=p[ua],vS=p[Zb]+16|0,So=vS|0;ba=So>>2;var Ux=vS+4|0,z0=pH(p[uS>>2],p[uS+4>>2],x0,y0,p[ba],ye);p[gb]=z0;vf(eb,p[Ka]);var xS=p[Lb],Xs=p[Zb]+16|0,A0=(T.b(p[Xs>>2],p[Xs+4>>2],xS,(xS|0)<0?-1:0),T.result[0]),B0=T.result[1];p[(Xs|0)>>2]=A0;p[(Xs+4|0)>>2]=B0;Xk(JA);if((p[Lb]|0)!=0){var yS=p[gb];if((yS|0)==0){xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}Tk(JA,yS,-1,1,34)}Lk(JA,Qd);ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==112){var KA=p[S+(O*5|0)+1],C0=p[S+(O*5|0)+2],zS=U+KA*40+28|0;if((n[zS>>1]&32)<<16>>16==0&&(qH(U+KA*40|0),(n[zS>>1]&32)<<16>>16==0)){xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}var D0=p[(U+16>>2)+(KA*10|0)],BS=U+C0*40+16|0,hh=BS|0;s=hh>>2;var E0=p[s],ih=BS+4|0;q=ih>>2;rH(D0,E0,p[q]);ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==113){if((p[nd]|0)!=0){Dr=O;Er=Z;Fr=$;Gr=ia;Hr=tc;break b}var MA=p[S+(O*5|0)+1],F0=U+MA*40|0,G0=(n[(U+28>>1)+(MA*20|0)]&32)<<16>>16==0;do{var NA;if(NA=!G0){var OA=p[(U+16>>2)+(MA*10|0)],CS=gc,Ys=fa;sH(OA);var Ys=(OA+8|0)>>2,ES=p[Ys];if((ES|0)==0){var FS=0}else{var GS=ES|0,H0=p[GS+4>>2];p[CS>>2]=p[GS>>2];p[CS+4>>2]=H0;var HS=p[p[Ys]+8>>2];p[Ys]=HS;(HS|0)==0&&cl(OA);FS=1}NA=(FS|0)!=0}if(NA){var I0=U+p[S+(O*5|0)+3]*40|0,Ud=gc|0;Ba=Ud>>2;var J0=p[Ba],Vd=gc+4|0;za=Vd>>2;$k(I0,J0,p[za]);ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break d}}while(0);Xk(F0);ma=p[S+(O*5|0)+2]-1|0;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==114){var PA=p[S+(O*5|0)+1],IS=p[S+(O*5|0)+3],JS=p[S+(O*5|0)+4];p[ua]=JS;var KS=U+PA*40+28|0;if((n[KS>>1]&32)<<16>>16==0){qH(U+PA*40|0);if((n[KS>>1]&32)<<16>>16==0){xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}var Zs=p[ua]}else{Zs=JS}var QA=U+PA*40+16|0;if((Zs|0)==0){var LS=QA,RA=U+IS*40+16|0}else{var K0=p[QA>>2],L0=(Zs|0)>-1?Zs&15:-1,SA=U+IS*40+16|0,we=SA|0;X=we>>2;var M0=p[X],xe=SA+4|0;I=xe>>2;var TA,pn=K0,MS=L0,NS=M0,$s=p[I],at=fa,OS=pn+27|0;if(l[OS]<<24>>24!=MS<<24>>24){at=(pn+8|0)>>2;if((p[at]|0)!=0){sH(pn);var bt=p[at],ct=fa,UA=a;a+=4;var ct=UA>>2,PS=bt+8|0,VA=p[PS>>2];p[ct]=VA;p[PS>>2]=0;p[bt+12>>2]=0;var N0=(VA|0)==0;e:do{if(N0){var QS=bt}else{for(var RS=bt,WA=1,xp=VA;;){var SS=xp+8|0;p[ct]=p[SS>>2];p[xp+12>>2]=RS;var O0=tH(UA,WA);p[SS>>2]=O0;var TS=p[ct];if((TS|0)==0){QS=xp;break e}RS=xp;WA=WA+1|0;xp=TS}}}while(0);a=UA;p[pn+20>>2]=QS;p[at]=0;p[pn+12>>2]=0}l[OS]=MS}for(var YA=pn+20|0;;){var dt=p[YA>>2];if((dt|0)==0){var US=0;break}var VS=dt|0,WS=p[VS>>2],et=p[VS+4>>2];if((et|0)<($s|0)||(et|0)==($s|0)&&WS>>>0<NS>>>0){YA=dt+8|0}else{if(!((et|0)>($s|0)||(et|0)==($s|0)&&WS>>>0>NS>>>0)){US=1;break}YA=dt+12|0}}TA=US;p[Ka]=TA;if((TA|0)!=0){ma=p[S+(O*5|0)+2]-1|0;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break}if((p[ua]|0)<=-1){ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break}LS=QA;RA=SA}var P0=p[LS>>2],Ud=RA|0;Ba=Ud>>2;var Q0=p[Ba],Vd=RA+4|0;za=Vd>>2;rH(P0,Q0,p[za]);ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==115){var ZA=p[S+(O*5|0)+4];g=ZA>>2;p[rb]=ZA;var $A=p[S+(O*5|0)+3];p[Pa]=U+$A*40|0;var R0=l[aa+O*20+3|0]<<24>>24==0;e:do{if(!R0){var XS=p[g+5];p[hg>>2]=XS;for(var YS=Jd;;){var ft=p[YS>>2];p[Eb]=ft;if((ft|0)==0){break e}if((p[ft+40>>2]|0)==(XS|0)){ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break d}YS=ft+64|0}}}while(0);var ZS=p[Tc];if((ZS|0)<(p[di>>2]|0)){if((n[(U+28>>1)+($A*20|0)]&64)<<16>>16==0){var $S=ZA+12|0,aT=p[$S>>2]+p[g+2]|0;p[ua]=aT;var bT=(p[$S>>2]<<2)+aT*40+p[g+4]+72|0;p[Ka]=bT;var cT=ni(eb,bT);p[Eb]=cT;if((cT|0)==0){xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}tk(p[Ab]);n[p[Ab]+28>>1]=64;p[(p[Ab]+16|0)>>2]=p[Xa];p[(p[Xa]|0)>>2]=b;p[(p[Xa]+44|0)>>2]=p[ua];p[(p[Xa]+48|0)>>2]=p[p[rb]+12>>2];p[(p[Xa]+4|0)>>2]=O;p[(p[Xa]+16|0)>>2]=p[ed];p[(p[Xa]+20|0)>>2]=p[Fh>>2];p[(p[Xa]+32|0)>>2]=p[bb];n[p[Xa]+36>>1]=n[Gh>>1];p[(p[Xa]+8|0)>>2]=p[Rc];p[(p[Xa]+12|0)>>2]=p[fb];p[(p[Xa]+40|0)>>2]=p[p[rb]+20>>2];p[(p[Xa]+24|0)>>2]=p[ec];p[(p[Xa]+28|0)>>2]=p[nh>>2];var aB=p[Xa],bB=aB+72|0,dT=bB+p[aB+44>>2]*40|0;p[gb]=dT;var eT=bB;p[Ya]=eT;if((bB|0)==(dT|0)){var fT=aB}else{for(var gT=eT;;){n[gT+28>>1]=128;p[p[Ya]>>2]=eb;var cB=p[Ya]+40|0;p[Ya]=cB;if((cB|0)==(p[gb]|0)){break}gT=cB}fT=p[Xa]}var hT=p[Tc],iT=fT}else{var jT=p[(U+16>>2)+($A*10|0)];p[dc]=jT;hT=ZS;iT=jT}p[Tc]=hT+1|0;p[iT+64>>2]=p[Yc];var kT=p[Xa]+52|0,Wl=kT|0;M=Wl>>2;p[M]=$;Xl=kT+4|0;J=Xl>>2;p[J]=Z;p[(p[Xa]+60|0)>>2]=p[uc];p[uc]=0;var gt=p[Xa];p[Yc]=gt;var dB=gt+72-40|0;p[ed]=dB;var lT=p[gt+44>>2];p[Fh>>2]=lT;var mT=p[gt+48>>2];n[Gh>>1]=mT&65535;var nT=dB+(lT+1)*40|0;p[bb]=nT;var eB=p[rb],oT=y[eB>>2];p[Rc]=oT;var pT=eB+4|0;p[fb]=p[pT>>2];var qT=((mT&65535)<<2)+nT|0;p[ec]=qT;var rT=p[eB+16>>2];p[nh>>2]=rT;p[fb]=p[pT>>2];Ed(qT,0,rT);ma=-1;na=oT;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=dB}else{En(tc,eb,R.pl|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),ma=O,na=aa,oa=Z,pa=$,qa=1,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=U}W=828}else{if((Qa|0)==116){var sT=p[Yc];f=sT>>2;p[ua]=sT;var tT=p[f+4]+(p[(p[f+2]+4>>2)+(p[f+1]*5|0)]+p[S+(O*5|0)+1])*40|0;p[Ka]=tT;Du(va,tT,4096);ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==117){var uT=p[S+(O*5|0)+2],vT=uT,wT=(uT|0)<0?-1:0;if((p[S+(O*5|0)+1]|0)==0){qd=nf|0;L=qd>>2;var S0=p[L],sd=nf+4|0;P=sd>>2;var T0=(T.add(S0,p[P],vT,wT),T.result[0]),U0=T.result[1],Ee=nf|0;La=Ee>>2;p[La]=T0;Fe=nf+4|0;Ea=Fe>>2;p[Ea]=U0}else{qd=$d|0;L=qd>>2;var V0=p[L],sd=$d+4|0;P=sd>>2;var W0=(T.add(V0,p[P],vT,wT),T.result[0]),X0=T.result[1],Ee=$d|0;La=Ee>>2;p[La]=W0;Fe=$d+4|0;Ea=Fe>>2;p[Ea]=X0}ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==118){(p[S+(O*5|0)+1]|0)==0?(qd=nf|0,L=qd>>2,sd=nf+4|0):(qd=$d|0,L=qd>>2,sd=$d+4|0),P=sd>>2,ma=p[L]==0&&p[P]==0?p[S+(O*5|0)+2]-1|0:O,na=aa,oa=Z,pa=$,qa=0,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=U,W=828}else{if((Qa|0)==119){var xT=p[Yc];if((xT|0)==0){var fB=U+p[S+(O*5|0)+1]*40|0}else{for(var ht=xT;;){p[Ka]=ht;var yT=p[ht+64>>2];if((yT|0)==0){break}ht=yT}fB=p[ht+16>>2]+p[S+(O*5|0)+1]*40|0}p[ua]=fB;JG(fB);var zT=p[S+(O*5|0)+2];JG(U+zT*40|0);var it=p[Ac]+16|0,Wh=it|0;da=Wh>>2;Xh=it+4|0;Y=Xh>>2;var AT=p[Y],BT=U+zT*40+16|0,id=BT|0;Oc=id>>2;var CT=p[Oc],td=BT+4|0;Qc=td>>2;var gB=p[Qc];if((AT|0)<(gB|0)||(AT|0)==(gB|0)&&p[da]>>>0<CT>>>0){qd=it|0,L=qd>>2,p[L]=CT,sd=it+4|0,P=sd>>2,p[P]=gB}ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==120){var DT=U+p[S+(O*5|0)+1]*40+16|0,Ud=DT|0;Ba=Ud>>2;Vd=DT+4|0;za=Vd>>2;var ET=p[za],ma=(ET|0)>0||(ET|0)==0&&p[Ba]>>>0>0?p[S+(O*5|0)+2]-1|0:O,na=aa,oa=Z,pa=$,qa=0,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=U;W=828}else{if((Qa|0)==121){var FT=U+p[S+(O*5|0)+1]*40+16|0,Ud=FT|0;Ba=Ud>>2;Vd=FT+4|0;za=Vd>>2;var GT=p[za],ma=(GT|0)<0||(GT|0)==0&&p[Ba]>>>0<0?p[S+(O*5|0)+2]-1|0:O,na=aa,oa=Z,pa=$,qa=0,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=U;W=828}else{if((Qa|0)==122){var HT=p[S+(O*5|0)+3],Y0=HT,Z0=(HT|0)<0?-1:0,jt=U+p[S+(O*5|0)+1]*40+16|0,Uh=jt|0;ka=Uh>>2;var $0=p[ka],Vh=jt+4|0;Ja=Vh>>2;var IT=(T.add($0,p[Ja],Y0,Z0),T.result[0]),JT=T.result[1],ak=jt|0;N=ak>>2;p[N]=IT;bk=jt+4|0;H=bk>>2;p[H]=JT;ma=IT==0&&JT==0?p[S+(O*5|0)+2]-1|0:O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==123){var KT=t[aa+O*20+3|0];p[ua]=KT&255;var LT=U+p[S+(O*5|0)+2]*40|0;p[Ya]=LT;var MT=p[kc];p[pb]=MT;p[Ka]=0;var a1=KT<<24>>24==0;e:do{if(!a1){for(var NT=0,OT=LT,PT=MT;;){p[PT+(NT<<2)>>2]=OT;Ql(p[Ya]);var hB=p[yb]+1|0;p[Ka]=hB;var QT=p[Ya]+40|0;p[Ya]=QT;if((hB|0)>=(p[ua]|0)){break e}NT=hB;OT=QT;PT=p[pb]}}}while(0);p[gb]=p[S+(O*5|0)+4];var RT=p[S+(O*5|0)+3],ST=U+RT*40|0;p[Pa]=ST;p[Hh>>2]=ST;var TT=U+RT*40+24|0;p[TT>>2]=p[TT>>2]+1|0;n[Yf>>1]=1;p[Hg>>2]=0;p[Yg>>2]=0;p[ei>>2]=0;p[Xg>>2]=fi;p[Ui>>2]=0;p[Aj>>2]=0;var UT=p[gb];(l[UT+3|0]&8)<<24>>24!=0&&(p[Aj>>2]=p[S+((O-1)*5|0)+4]);Gd[p[UT+16>>2]](Wg,p[ua],p[pb]);if((p[zj>>2]|0)==0){var VT=0}else{var b1=wk(xg);En(tc,eb,R.d|0,(z=a,a+=4,p[z>>2]=b1,z));VT=p[zj>>2]}tk(xg);ma=O;na=aa;oa=Z;pa=$;qa=VT;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==124){var WT=U+p[S+(O*5|0)+1]*40|0;p[ua]=WT;var XT=Fl(WT,p[S+(O*5|0)+4]);if((XT|0)!=0){var c1=wk(p[Ac]);En(tc,eb,R.d|0,(z=a,a+=4,p[z>>2]=c1,z))}Lk(p[Ac],Qd);(EG(p[Ac])|0)==0?(ma=O,na=aa,oa=Z,pa=$,qa=XT,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=U,W=828):(Ri=Z,Si=$,W=834)}else{if((Qa|0)==125){p[Ka]=0;p[wi>>2]=-1;p[mk>>2]=-1;var YT=mo(eb,p[S+(O*5|0)+1],p[S+(O*5|0)+2],nm,fl);if((YT|0)==5){p[Ka]=1;var ZT=0}else{ZT=YT}p[ua]=0;for(var d1=U+p[S+(O*5|0)+3]*40|0,$T=p[gb]=d1,aU=0;;){var bU=p[Vi+(aU<<2)>>2];$k($T,bU,(bU|0)<0?-1:0);var iB=p[ua]+1|0;p[ua]=iB;var cU=p[gb]+40|0,e1=cU;p[gb]=cU;if((iB|0)>=3){ma=O;na=aa;oa=Z;pa=$;qa=ZT;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break d}$T=e1;aU=iB}}else{if((Qa|0)==126){var jB=p[S+(O*5|0)+3];p[Pa]=jB;var dU=p[p[Fc]+(p[S+(O*5|0)+1]<<4)+4>>2];p[ua]=dU;var sj=p[p[dU+4>>2]>>2];p[Ka]=sj;var dk=l[sj+5|0]&255;p[Ya]=dk;var eU=(jB|0)==-1?p[Pa]=dk:jB;var f1=(t[sj+16|0]&255)>2;do{if(f1){var kB=0}else{if((p[p[sj+64>>2]>>2]|0)!=0){var fU=sj+72|0,gU=p[fU+4>>2];if((gU|0)>0||(gU|0)==0&&p[fU>>2]>>>0>0){kB=0;break}}kB=1}}while(0);var kt=(kB|0)==0?p[Pa]=dk:eU;var hU=p[sj+144>>2];p[gb]=hU;var lB=(kt|0)==5;if(lB){if((ve(hU)|0)!=0&&(uH(l[sj+4|0],p[p[sj+60>>2]>>2])|0)!=0){W=756}else{p[Pa]=dk;var lt=0,mt=dk;W=767}}else{W=756}e:do{if(W==756){if((kt|0)!=(dk|0)&((dk|0)==5|lB)){var g1=l[me]<<24>>24==0;do{if(!g1&&(p[Rb]|0)<=1){if((dk|0)==5){var mB,ek=sj,yp=fa,nt=a;a+=4;var qn=fa,yp=(ek+180|0)>>2;if((p[yp]|0)==0){p[nt>>2]=0;var jU=vr(ek,1);if((jU|0)!=0){var zp=jU,qn=9}else{var kU=Dq(p[ek>>2],p[ek+184>>2],0,nt),mU=(kU|0)!=0|(p[nt>>2]|0)==0?kU:vH(ek);(mU|0)!=0?(zp=mU,qn=9):(p[yp]|0)==0?(zp=0,qn=9):qn=7}}else{qn=7}if(qn==7){var oU=wH(ek);if((oU|0)!=0){zp=oU}else{var h1=$p(p[yp],t[ek+10|0]&255,p[ek+128>>2],p[ek+172>>2]);p[yp]=0;zp=h1}}a=nt;mB=zp;if((mB|0)!=0){var pU=mB;W=766}else{xH(p[Ka],p[Pa]),W=764}}else{(dk|0)==4&&xH(sj,2),W=764}do{if(W==764){var qU=Ci(p[dg>>2],(p[Pa]|0)==5?2:1);if((qU|0)!=0){pU=qU}else{lt=0;mt=p[Pa];break e}}}while(0);var rU=p[Lb];p[Pa]=rU;lt=pU;mt=rU;break e}}while(0);var i1=lB?R.rl|0:R.sl|0;En(tc,eb,R.ql|0,(z=a,a+=4,p[z>>2]=i1,z));ma=O;na=aa;oa=Z;pa=$;qa=1;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break d}else{lt=0,mt=kt}}}while(0);var j1=xH(p[Ka],mt);p[Pa]=j1;var Ap=p[S+(O*5|0)+2],sU=U+Ap*40|0;n[(U+28>>1)+(Ap*20|0)]=2562;var tU=(p[Pa]|0)==6?0:p[kC+(p[Pa]<<2)>>2];p[(U+Ap*40+4|0)>>2]=tU;p[(U+Ap*40+24|0)>>2]=ve(tU);l[U+Ap*40+31|0]=1;Lk(sU,Qd);ma=O;na=aa;oa=Z;pa=$;qa=lt;Ca=wa;Da=ia;Ga=Aa;Ha=sU;Ia=U;W=828}else{if((Qa|0)==127){var k1=yH(tc,eb),ma=O,na=aa,oa=Z,pa=$,qa=k1,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=U;W=828}else{if((Qa|0)==128){var nB=p[p[Fc]+(p[S+(O*5|0)+1]<<4)+4>>2];p[ua]=nB;var oB,rn=p[nB+4>>2];li(p[nB>>2],rn);if(l[rn+17|0]<<24>>24==0){var pB=101}else{zH(p[rn+8>>2]);var vU=rn+44|0,wU=AH(rn,0,p[vU>>2]);if((wU|0)!=0){pB=wU}else{var xU=rn+12|0,l1=Yi(p[p[xU>>2]+76>>2]);Zi(p[p[xU>>2]+64>>2]+28|0,p[vU>>2]);pB=l1}}oB=pB;(oB|0)!=101?(ma=O,na=aa,oa=Z,pa=$,qa=oB):(ma=p[S+(O*5|0)+2]-1|0,na=aa,oa=Z,pa=$,qa=0);Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==129){(p[S+(O*5|0)+1]|0)==0?Nm(p[cb]):l[Md]=1,ma=O,na=aa,oa=Z,pa=$,qa=0,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=U,W=828}else{if((Qa|0)==131){var yU=p[S+(O*5|0)+3],m1=yU&255;if((yU&255|0)==0&&(p[$b]&524288|0)!=0){ma=O,na=aa,oa=Z,pa=$,qa=0}else{var sB,Bp=p[p[Fc]+(p[S+(O*5|0)+1]<<4)+4>>2],zU=p[S+(O*5|0)+2];if(l[Bp+9|0]<<24>>24==0){var AU=0}else{var BU=m1+1&255;li(p[Bp>>2],p[Bp+4>>2]);var CU=Ki(Bp,zU,BU),tB;if((CU|0)!=0){tB=CU}else{for(var uB=Bp,DU=zU,EU=BU,pt=fa,qt=fa,vB=p[uB+4>>2]+72|0,FU=vB;;){var Cp=p[FU>>2];if((Cp|0)==0){var wB=qo(16),pt=wB>>2,n1=wB;if((wB|0)==0){var GU=7,qt=10;break}p[pt+1]=DU;p[pt]=uB;p[pt+3]=p[vB>>2];var HU=p[vB>>2]=n1,qt=8;break}if((p[Cp+4>>2]|0)==(DU|0)&&(p[Cp>>2]|0)==(uB|0)){HU=Cp;qt=8;break}FU=Cp+12|0}if(qt==8){var IU=HU+8|0;(t[IU]&255)<(EU&255)&&(l[IU]=EU);GU=0}tB=GU}AU=tB}sB=AU;if((sB&255|0)==6){var o1=p[S+(O*5|0)+4];En(tc,eb,R.tl|0,(z=a,a+=4,p[z>>2]=o1,z))}ma=O;na=aa;oa=Z;pa=$;qa=sB}Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==132){var JU=p[S+(O*5|0)+4];p[ua]=JU;var KU,Dp=eb,rt=JU,st=fa,LU=p[Dp+312>>2];if((LU|0)>0){if((p[Dp+308>>2]|0)==0){var fm=6,st=12}else{st=3}}else{st=3}e:do{if(st==3){if((rt|0)==0){fm=0}else{var MU=rt+8|0,NU=p[p[MU>>2]>>2]+56|0;if((p[NU>>2]|0)==0){fm=0}else{for(var p1=Dp+308|0,tt=0;;){if((tt|0)>=(LU|0)){break}if((p[p[p1>>2]+(tt<<2)>>2]|0)==(rt|0)){fm=0;break e}tt=tt+1|0}var PU=BH(Dp);if((PU|0)!=0){fm=PU}else{var QU=Gd[p[NU>>2]](p[MU>>2]);(QU|0)!=0?fm=QU:(CH(Dp,rt),fm=0)}}}}}while(0);KU=fm;var SU=p[om>>2];(SU|0)!=0&&jH(b,p[SU+8>>2]);ma=O;na=aa;oa=Z;pa=$;qa=KU;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==133){var TU,fk=eb,UU=tc,ut=Im(fk,p[S+(O*5|0)+4],p[p[fk+8>>2]+(p[S+(O*5|0)+1]<<4)>>2]),xB=p[p[ut+60>>2]>>2],yB=Ao(fk+288|0,xB,ve(xB));if((yB|0)==0){var q1=zm(fk,R.xb|0,(z=a,a+=4,p[z>>2]=xB,z));p[UU>>2]=q1;var Ep=1}else{var VU=aD(fk,ut,yB,p[p[yB>>2]+4>>2],UU);if((VU|0)!=0){Ep=VU}else{if((iw(fk,ut)|0)==0){Ep=0}else{var WU=BH(fk);(WU|0)!=0?Ep=WU:(CH(fk,iw(fk,ut)),Ep=0)}}}TU=Ep;ma=O;na=aa;oa=Z;pa=$;qa=TU;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==134){l[gi]=2;var XU,zB=Im(eb,p[S+(O*5|0)+4],p[p[eb+8>>2]+(p[S+(O*5|0)+1]<<4)>>2]);if((zB|0)==0){var vt=0}else{var YU=zB+52|0;if((p[YU>>2]|0)==0){vt=0}else{var AB=$f(eb,zB),ZU=AB+8|0,$U=Gd[p[p[p[AB+4>>2]>>2]+20>>2]](p[ZU>>2]);($U|0)!=0?vt=$U:(p[ZU>>2]=0,p[YU>>2]=0,Jr(AB),vt=0)}}XU=vt;l[gi]=0;ma=O;na=aa;oa=Z;pa=$;qa=XU;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==135){p[ua]=0;p[Ka]=0;var BB=p[p[S+(O*5|0)+4]+8>>2];p[Pa]=BB;var aV=p[BB>>2];p[Ya]=aV;var CB=Gd[p[aV+24>>2]](BB,xi);jH(b,p[Bj>>2]);if((CB|0)!=0){ma=O,na=aa,oa=Z,pa=$,qa=CB}else{p[(p[Ka]|0)>>2]=p[Bj>>2];var DB=YG(b,p[S+(O*5|0)+1],0,-1,0);p[ua]=DB;(DB|0)==0?(l[rc]=1,Gd[p[p[Ya]+28>>2]](p[Ka]),ma=O,na=aa,oa=Z,pa=$,qa=0):(p[(DB+36|0)>>2]=p[Ka],p[(p[Oa]+40|0)>>2]=p[p[p[Ka]>>2]>>2],ma=O,na=aa,oa=Z,pa=$,qa=CB)}Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==136){var EB=p[S+(O*5|0)+3];p[Ya]=U+EB*40|0;var bV=EB+1|0,cV=U+bV*40|0;p[gb]=cV;var dV=p[p[bb]+(p[S+(O*5|0)+1]<<2)>>2];p[gl>>2]=dV;var FB=p[dV+36>>2];p[Eb]=FB;var eV=p[FB>>2];p[yi>>2]=eV;var fV=p[eV>>2];p[Pa]=fV;var GB=p[(U+bV*40+16|0)>>2];p[ua]=GB;var gV=p[(U+EB*40+16|0)>>2];p[Ka]=gV;p[tb]=0;var HB=p[kc];p[Sa]=HB;p[qb]=0;if((GB|0)>0){for(var IB=0,hV=cV,iV=HB;;){p[iV+(IB<<2)>>2]=hV+(IB+1)*40|0;Ql(p[p[Sa]+(p[hf>>2]<<2)>>2]);var JB=p[hf>>2]+1|0;p[qb]=JB;var jV=p[ua];if((JB|0)>=(jV|0)){break}IB=JB;hV=p[gb];iV=p[Sa]}var kV=p[hl>>2],lV=p[Wi>>2],mV=p[yb],nV=jV,oV=p[Sa]}else{kV=fV,lV=FB,mV=gV,nV=GB,oV=HB}l[gi]=1;var pV=Gd[p[kV+32>>2]](lV,mV,p[S+(O*5|0)+4],nV,oV);l[gi]=0;jH(b,p[yi>>2]);if((pV|0)==0){var r1=Gd[p[p[hl>>2]+40>>2]](p[Wi>>2]),qV=p[tb]=r1}else{qV=p[tb]}var s1=(qV|0)==0?O:p[S+(O*5|0)+2]-1|0;l[p[gl>>2]+28|0]=0;ma=s1;na=aa;oa=Z;pa=$;qa=pV;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}else{if((Qa|0)==137){var rV=p[p[bb]+(p[S+(O*5|0)+1]<<2)>>2],KB=U+p[S+(O*5|0)+3]*40|0;p[Pa]=KB;if(l[rV+28|0]<<24>>24!=0){Xk(KB),ma=O,na=aa,oa=Z,pa=$,qa=0,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=U,W=828}else{var sV=rV+36|0,tV=p[p[sV>>2]>>2];p[ua]=tV;p[Ka]=p[tV>>2];ck=Qf>>2;for(Dy=ck+15;ck<Dy;ck++){p[ck]=0}km(nk,KB);n[jl>>1]=n[jl>>1]&-16640|1;var t1=Gd[p[p[Ka]+44>>2]](p[sV>>2],il,p[S+(O*5|0)+2]);jH(b,p[Za]);var uV=p[kl>>2],u1=(uV|0)==0?t1:uV;Lk(nk,Qd);km(p[Ab],nk);(EG(p[Ab])|0)==0?(ma=O,na=aa,oa=Z,pa=$,qa=u1,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=U,W=828):(Ri=Z,Si=$,W=834)}}else{if((Qa|0)==138){p[Pa]=0;var LB=p[p[bb]+(p[S+(O*5|0)+1]<<2)>>2];p[Ya]=LB;if(l[LB+28|0]<<24>>24!=0){ma=O,na=aa,oa=Z,pa=$,qa=0}else{var vV=LB+36|0,wV=p[p[vV>>2]>>2];p[ua]=wV;var xV=p[wV>>2];p[Ka]=xV;l[gi]=1;var yV=Gd[p[xV+36>>2]](p[vV>>2]);l[gi]=0;jH(b,p[Za]);if((yV|0)==0){var v1=Gd[p[p[Ka]+40>>2]](p[p[Ya]+36>>2]),zV=p[Pa]=v1}else{zV=p[Pa]}ma=(zV|0)!=0?O:p[S+(O*5|0)+2]-1|0;na=aa;oa=Z;pa=$;qa=yV}}else{if((Qa|0)==139){p[ua]=p[p[S+(O*5|0)+4]+8>>2];var AV=U+p[S+(O*5|0)+1]*40|0;p[Ka]=AV;var BV=Lk(AV,1);if((BV|0)!=0){ma=O,na=aa,oa=Z,pa=$,qa=BV}else{var CV=p[Za],w1=Gd[p[p[CV>>2]+76>>2]](CV,p[p[Ka]+4>>2]);jH(b,p[Za]);l[Md]=0;ma=O;na=aa;oa=Z;pa=$;qa=w1}}else{if((Qa|0)==140){var EV=aa+O*20+16|0,FV=p[p[EV>>2]+8>>2];p[ua]=FV;var GV=p[FV>>2];p[Ka]=GV;var HV=p[S+(O*5|0)+2];p[Pa]=HV;if((p[GV+52>>2]|0)==0){ma=O,na=aa,oa=Z,pa=$,qa=0}else{var x1=l[Cj];p[Wa]=p[kc];var IV=U+p[S+(O*5|0)+3]*40|0;p[ib]=IV;p[Ya]=0;var y1=(HV|0)>0;e:do{if(y1){for(var JV=IV;;){Ql(JV);p[((p[Lb]<<2)+p[Wa]|0)>>2]=p[ib];var KV=p[ib]+40|0;p[ib]=KV;var LV=p[Lb]+1|0;p[Ya]=LV;if((LV|0)>=(p[Pa]|0)){break e}JV=KV}}}while(0);var MV=aa+O*20+3|0;l[Cj]=l[MV];var wt=Gd[p[p[Ka]+52>>2]](p[Za],p[Pa],p[Wa],je);l[Cj]=x1;jH(b,p[Za]);do{if((wt|0)==0){if((p[S+(O*5|0)+1]|0)==0){var xt=Z,yt=$}else{qd=je|0;L=qd>>2;var NV=p[L],sd=je+4|0;P=sd>>2;var z1=p[P],hh=vd|0;s=hh>>2;p[s]=NV;ih=vd+4|0;q=ih>>2;xt=p[q]=z1;yt=NV}}else{if((wt|0)==19){if(l[p[EV>>2]+16|0]<<24>>24==0){xt=Z,yt=$}else{var MB=l[MV];if(MB<<24>>24==4){ma=O;na=aa;oa=Z;pa=$;qa=0;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break d}else{var A1=MB<<24>>24==5?2:MB}l[bf]=A1;ma=O;na=aa;oa=Z;pa=$;qa=wt;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828;break d}}else{xt=Z,yt=$}}}while(0);p[uc]=p[uc]+1|0;ma=O;na=aa;oa=xt;pa=yt;qa=wt}}else{if((Qa|0)==146){var B1=p[p[p[p[Fc]+(p[S+(O*5|0)+1]<<4)+4>>2]+4>>2]+44>>2],OV=va+16|0,Uz=OV|0;p[Uz>>2]=B1;Vz=OV+4|0;p[Vz>>2]=0}else{if((Qa|0)==147){var NB=y[p[Fc]+(p[S+(O*5|0)+1]<<4)+4>>2],OB=y[S+(O*5|0)+3];if((OB|0)==0){var PV=0}else{var QV=p[p[NB+4>>2]+44>>2],PV=QV>>>0<OB>>>0?OB:QV}var RV,C1=PV,SV=NB+4|0;li(p[NB>>2],p[SV>>2]);var TV=C1,UV=p[p[SV>>2]>>2]+132|0;var VV=(TV|0)>0?p[UV>>2]=TV:p[UV>>2];var D1=RV=VV,E1=(RV|0)<0?-1:0,WV=va+16|0,Ee=WV|0;La=Ee>>2;p[La]=D1;Fe=WV+4|0;Ea=Fe>>2;p[Ea]=E1}}ma=O;na=aa;oa=Z;pa=$;qa=0}}}Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U;W=828}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}while(0);d:do{if(W==24){e=(aa+O*20+4|0)>>2;var XV=p[e],YV=(XV|0)==0;do{if(YV){var PB=p[Yc];if((PB|0)!=0){p[Yc]=p[PB+64>>2];p[Tc]=p[Tc]-1|0;gH(eb,p[uc]);var ZV=DH(PB),Wl=vd|0;M=Wl>>2;Xl=vd+4|0;J=Xl>>2;var $V=y[Rc],ma=(p[S+(O*5|0)+2]|0)==4?p[($V+8>>2)+(ZV*5|0)]-1|0:ZV,na=$V,oa=p[J],pa=p[M],qa=0,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=p[ed];break d}}}while(0);p[Bc]=XV;l[bf]=p[S+(O*5|0)+2]&255;p[md]=O;var aW=aa+O*20+16|0,bW=p[aW>>2];if((bW|0)==0){if(!YV){var F1=p[jc];cf(p[e],R.dl|0,(z=a,a+=8,p[z>>2]=O,p[z+4>>2]=F1,z))}}else{En(tc,eb,R.d|0,(z=a,a+=4,p[z>>2]=bW,z));var G1=p[jc],H1=p[aW>>2];cf(p[e],R.cl|0,(z=a,a+=12,p[z>>2]=O,p[z+4>>2]=G1,p[z+8>>2]=H1,z))}if((rk(b)|0)==5){p[Bc]=5;pj=Z;qj=$;rj=5;W=833;break a}var I1=(p[Bc]|0)!=0?1:101,pj=Z,qj=$,rj=I1;W=833;break a}else{if(W==46){n[va+28>>1]=2562,p[va+4>>2]=p[dJ>>2],p[va+24>>2]=p[eJ>>2],l[va+31|0]=Uc,ma=O,na=aa,oa=Z,pa=$,qa=cJ,Ca=wa,Da=ia,Ga=Aa,Ha=va,Ia=U}else{if(W==612){var zt=p[p[bb]+(p[S+(O*5|0)+1]<<2)>>2];p[ua]=zt;p[Pa]=1;if((p[zt+68>>2]|0)==0){var cW=p[zt>>2];p[Ka]=cW;var J1=bH(cW,Mc);l[p[Oa]+26|0]=(p[Pa]|0)==0&1;l[p[Oa]+29|0]=0;p[(p[Oa]+76|0)>>2]=0;l[p[Oa]+25|0]=0;var dW=J1}else{dW=EH(eb,zt,Mc)}l[p[Oa]+28|0]=p[Pa]&255;ma=(p[Pa]|0)==0?O:p[S+(O*5|0)+2]-1|0;na=aa;oa=Z;pa=$;qa=dW;Ca=wa;Da=ia;Ga=Aa;Ha=va;Ia=U}else{if(W==834){En(tc,eb,R.Fa|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z));oh=O;Ih=Ri;ph=Si;qh=18;rh=ia;W=829;break a}}}}}while(0);O=ma+1|0;aa=na;S=aa>>2;Z=oa;$=pa;Ej=qa;wa=Ca;ia=Da;Aa=Ga;Fj=Ha;zi=Gj;U=Ia}if(W==62){p[mb]=p[mb]+2|1;var fW=U+p[S+(O*5|0)+1]*40|0;p[wd>>2]=fW;p[ua]=fW;for(var K1=aa+O*20+8|0,gW=0;;){var At=p[Ka]=gW;if((At|0)>=(p[K1>>2]|0)){break}var RB=p[Ac];if((n[(RB+28>>1)+(At*20|0)]&4096)<<16>>16==0){var hW=At,iW=RB}else{if((Mk(RB+At*40|0)|0)!=0){xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}hW=p[yb];iW=p[Ac]}Nk(iW+hW*40|0);Ql(p[Ac]+p[yb]*40|0);gW=p[yb]+1|0}if(l[rc]<<24>>24!=0){xc=O;qc=Z;Gc=$;Hc=ia;zc=rc;Kc=tc;W=835;break a}p[md]=O+1|0;pj=Z;qj=$;rj=100;W=833;break a}else{if(W==836){var SB=l[rc]<<24>>24==0?sf:7;if((SB|0)==3082){oh=O;Ih=Z;ph=$;qh=3082;rh=ia;W=829;break a}var L1=ok(SB);En(tc,eb,R.d|0,(z=a,a+=4,p[z>>2]=L1,z));oh=O;Ih=Z;ph=$;qh=SB;rh=ia;W=829;break a}}}else{Dr=0,Er=zd,Fr=Zc,Gr=0,Hr=b+56|0}}while(0);p[Bc]=9;var M1=ok(9);En(Hr,eb,R.d|0,(z=a,a+=4,p[z>>2]=M1,z));oh=Dr;Ih=Er;ph=Fr;qh=9;rh=Gr;W=829}}while(0);W==835&&(l[zc]=1,En(Kc,eb,R.ca|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),oh=xc,Ih=qc,ph=Gc,qh=7,rh=Hc,W=829);if(W==829){p[Bc]=qh;var N1=p[b+160>>2],O1=p[b+56>>2];cf(qh,R.ul|0,(z=a,a+=12,p[z>>2]=oh,p[z+4>>2]=N1,p[z+8>>2]=O1,z));rk(b);(qh|0)==3082&&(l[eb+30|0]=1);rh<<24>>24!=0&&Bi(eb,(rh&255)-1|0);pj=Ih;qj=ph;rj=1}Ud=vd|0;Ba=Ud>>2;p[Ba]=qj;Vd=vd+4|0;za=Vd>>2;p[za]=pj;a=Yb;return rj}Al.X=1;function gH(b,c){p[b+60>>2]=c;var d=b+64|0;p[d>>2]=p[d>>2]+c|0}function DH(b){var c=p[b>>2];p[(c+192|0)>>2]=p[b+24>>2];p[(c+188|0)>>2]=p[b+28>>2];p[(c+4|0)>>2]=p[b+8>>2];p[(c+28|0)>>2]=p[b+12>>2];p[(c+8|0)>>2]=p[b+16>>2];p[(c+24|0)>>2]=p[b+20>>2];p[(c+68|0)>>2]=p[b+32>>2];n[c+50>>1]=n[b+36>>1];var d=b+52|0,e=p[d+4>>2],f=p[c>>2]+48|0;p[(f|0)>>2]=p[d>>2];p[(f+4|0)>>2]=e;p[(c+108|0)>>2]=p[b+60>>2];return p[b+4>>2]}DH.X=1;function EG(b){var c=Vc[b+28>>1]&65535;if((c&18|0)==0){b=0}else{var d=p[b+24>>2],b=(((c&16384|0)==0?d:p[b+16>>2]+d|0)|0)>(p[p[b>>2]+72>>2]|0)&1}return b}function sk(b){var c=p[b>>2],d=p[b+92>>2],b=b+56|0;if((p[b>>2]|0)==0){$h(c,d,0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z))}else{var e=c+30|0,f=l[e];dj();ii(p[c+212>>2],-1,p[b>>2],1,-1);gj();l[e]=f;p[(c+20|0)>>2]=d}return d}function rk(b){var c,d,e,f,g=b|0,h=y[g>>2];e=h>>2;l[h+30|0]<<24>>24!=0&&(p[b+92>>2]=7);var i=p[b+192>>2];(i|0)!=0&&Ed(i,0,p[b+188>>2]);FH(b);var i=b+52|0,j=(p[i>>2]|0)==-1108210269;a:do{if(j){var k=b+88|0,m=(p[k>>2]|0)>-1,o=b+92|0;d=o>>2;do{if(m){f=p[d];c=f&255;if((c|0)==10||(c|0)==9||(c|0)==7||(c|0)==13){if(l[b+104|0]<<24>>24!=0&(c|0)==9){c=0;var r=1}else{((c|0)==13||(c|0)==7)&&l[b+103|0]<<24>>24!=0?(c=2,r=1):(GH(h),XG(h),Vn(h),l[h+28|0]=1,c=0,r=1,f=p[d])}}else{r=c=0}(f|0)==0&&FG(b,0);f=(p[e+78]|0)>0?(p[e+77]|0)==0?27:16:16;do{if(f==16){if(l[h+28|0]<<24>>24==0){f=27}else{var q=b+104|0;if((p[e+36]|0)!=(l[q]<<24>>24==0&1|0)){f=27}else{(p[d]|0)==0?f=20:l[b+96|0]<<24>>24!=3|r?(XG(h),f=32):f=20;b:do{if(f==20){var s=(FG(b,1)|0)==0;do{if(s){var u=HH(h,b);if((u|0)==5){if(l[q]<<24>>24!=0){d=5;break a}u=5}else{if((u|0)==0){f=h+492|0;p[f>>2]=0;p[f+4>>2]=0;p[(h+12|0)>>2]&=-513;break b}}}else{if(l[q]<<24>>24!=0){d=1;break a}u=19}}while(0);p[d]=u;XG(h)}}while(0);p[e+121]=0;if((c|0)==0){var w=0;f=37}else{var v=c;f=33}}}}}while(0);f==27&&((c|0)!=0?(v=c,f=33):(p[d]|0)==0?(v=1,f=33):(c=l[b+96|0],c<<24>>24==3?(v=1,f=33):c<<24>>24==2?(v=2,f=33):(GH(h),XG(h),Vn(h),l[h+28|0]=1,w=0,f=37)));if(f==33){w=GG(b,v);if((w|0)!=0){c=p[d];if((c|0)==0||(c|0)==19){p[d]=w,w=b+56|0,vf(h,p[w>>2]),p[w>>2]=0}GH(h);XG(h);Vn(h);l[h+28|0]=1}w=v}l[b+98|0]<<24>>24!=0&&((w|0)==2?(gH(h,0),c=b+108|0):(c=b+108|0,gH(h,p[c>>2])),p[c>>2]=0);(p[d]|0)!=0&&(c=(h+12|0)>>2,(p[c]&512|0)!=0&&(Bi(h,-1),p[c]|=512));if((p[k>>2]|0)<=-1){c=o;break}c=h+140|0;p[c>>2]=p[c>>2]-1|0;if(l[b+104|0]<<24>>24!=0){c=o;break}c=h+144|0;p[c>>2]=p[c>>2]-1|0}c=o}while(0);p[i>>2]=1369188723;l[p[g>>2]+30|0]<<24>>24==0?d=(p[c>>2]|0)==5?5:0:(p[c>>2]=7,d=0)}else{d=0}}while(0);return d}rk.X=1;function FG(b,c){var d,e=p[b>>2],f=(c|0)==0;do{if(f){var g=b+144|0;d=g|0;g=g+4|0;g=p[g>>2];if((g|0)>0||(g|0)==0&&p[d>>2]>>>0>0){d=4;break}var h=0}else{g=e+492|0;d=g|0;g=g+4|0;g=p[g>>2];if((g|0)>0||(g|0)==0&&p[d>>2]>>>0>0){d=4;break}h=0}d=5}while(0);d==4&&(p[b+92>>2]=19,l[b+96|0]=2,En(b+56|0,e,R.ma|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),h=1);return h}function GG(b,c){var d,e,f,g,h=p[b>>2];f=(h+484|0)>>2;var i=p[f],j=(i|0)==0;a:do{if(j){e=0}else{e=(b+120|0)>>2;var k=p[e];if((k|0)==0){e=0}else{k=k-1|0;d=(h+4|0)>>2;var m=(p[d]|0)>0;do{if(m){g=h+8|0;var o=(c|0)==2;b:do{if(o){for(var r=0,q=0;;){var s=p[p[g>>2]+(q<<4)+4>>2];if((s|0)!=0){var u=VG(s,2,k),s=(u|0)==0?VG(s,1,k):u,r=(r|0)!=0?r:s}q=q+1|0;if((q|0)>=(p[d]|0)){var w=r;break b}}}else{for(q=r=0;;){if(s=p[p[g>>2]+(q<<4)+4>>2],(s|0)!=0&&(s=VG(s,1,k),r=(r|0)!=0?r:s),q=q+1|0,(q|0)>=(p[d]|0)){w=r;break b}}}}while(0);p[f]=p[f]-1|0;p[e]=0;if((w|0)==0){g=o?19:21}else{if(o){var v=w;g=22}else{e=w;break a}}}else{p[f]=i-1|0,p[e]=0,g=(c|0)==2?19:21}}while(0);do{if(g==19){v=WG(h,2,k),v=(v|0)!=0?v:WG(h,1,k)}else{if(g==21){e=WG(h,1,k);break a}}}while(0);e=b+152|0;k=p[e+4>>2];d=h+492|0;p[(d|0)>>2]=p[e>>2];p[(d+4|0)>>2]=k;e=v}}}while(0);return e}GG.X=1;function Nk(b){var c,d;d=(b+28|0)>>1;(n[d]&514)<<16>>16==2&&(c=(b+24|0)>>2,(yk(b,p[c]+2|0,1)|0)==0&&(b=b+4|0,l[p[b>>2]+p[c]|0]=0,l[p[b>>2]+p[c]+1|0]=0,n[d]|=512))}function HG(b,c,d){var e,f=a;a+=8;e=f>>2;var g=p[b>>2],h=p[b+4>>2],i=(T.j(g,h,0,1),T.result[0]),j=T.result[1],g=(T.k(g,h,0,1),T.result[0]),h=T.result[1],k=(T.j(c,d,0,1),T.result[0]),m=T.result[1],c=(T.k(c,d,0,1),T.result[0]),d=T.result[1],o=(T.multiply(k,m,i,j),T.result[0]),r=T.result[1];o==0&&r==0?(i=(T.multiply(c,d,i,j),T.result[0]),j=T.result[1],k=(T.multiply(k,m,g,h),T.result[0]),i=(T.add(i,j,k,T.result[1]),T.result[0]),j=T.result[1],p[e]=i,p[e+1]=j,j=(T.add(i,j,-2147483648,0),T.result[0]),k=T.result[1],k>>>0>0||k>>>0==0&&j>>>0>4294967295?b=1:(p[e]=0,p[e+1]=i,g=(T.multiply(c,d,g,h),T.result[0]),(Ot(f,g,T.result[1])|0)!=0?b=1:(g=p[e+1],p[b>>2]=p[e],p[b+4>>2]=g,b=0))):b=1;a=f;return b}HG.X=1;function JG(b){var c=Gk(b),d=c[1],e=b+16|0;p[e>>2]=c[0];p[e+4>>2]=d;b=b+28|0;n[b>>1]=n[b>>1]&-16640|4}function KG(b){var c=Dk(b),d=b+8|0;xd[0]=c;p[d>>2]=C[0];p[d+4>>2]=C[1];b=b+28|0;n[b>>1]=n[b>>1]&-16640|8}function LG(b){var c,d=a;a+=8;c=d+4;var e=b+29|0,f=p[b>>2];if(l[e]<<24>>24==0){if((f|0)==0){b=0}else{var e=f+79|0,g=t[e];if((g&255)>1){if(g=Wm(f),(g|0)!=0){var h=g,i=1,e=7}else{var j=l[e],e=4}}else{j=g,e=4}e==4&&(j<<24>>24!=1?(h=0,i=1):(p[f+72>>2]|0)!=0?(h=0,i=1):i=h=0);p[c>>2]=i;f=h;(f|0)!=0?b=f:((p[c>>2]|0)!=0&&(p[b+76>>2]=0,l[b+28|0]=1),b=0)}}else{c=(b+52|0)>>2,f=UF(f,0,p[c],p[c+1],0,d),(f|0)!=0?b=f:(f=p[c+1],h=b+60|0,p[h>>2]=p[c],p[h+4>>2]=f,(p[d>>2]|0)==0?(l[b+25|0]=1,l[e]=0,b=p[b+76>>2]=0):(aj(61901),b=11))}a=d;return b}LG.X=1;function NG(b,c){if(l[b+79|0]<<24>>24==1){var d=b+32|0;if(n[b+58>>1]<<16>>16==0){var e=n[b+86>>1]<<16>>16;dG(p[b+(e<<2)+128>>2],Vc[b+(e<<1)+88>>1]&65535,d);l[b+78|0]=1}e=d|0;d=p[e+4>>2];e=p[e>>2]}else{e=d=0}p[c>>2]=e;p[c+4>>2]=d}function MG(b,c){if(n[b+58>>1]<<16>>16==0){var d=n[b+86>>1]<<16>>16;dG(p[b+(d<<2)+128>>2],Vc[b+(d<<1)+88>>1]&65535,b+32|0);l[b+78|0]=1}p[c>>2]=p[b+44>>2]}function RG(b,c){for(var d=c,e=b,f=0;;){var g=f+1|0,e=e>>>7|d<<25,d=d>>>7|0;if(!((e!=0||d!=0)&(g|0)<9)){break}f=g}return g}function QG(b,c){var d=Vc[b+28>>1]&65535,e=(d&1|0)==0;a:do{if(e){if((d&4|0)==0){if((d&8|0)!=0){var f=7}else{f=p[b+24>>2],f=(((d&16384|0)==0?f:p[b+16>>2]+f|0)<<1)+12|d>>>1&1}}else{var g=b+16|0,f=y[g>>2],g=y[g+4>>2],h=(c|0)>3;do{if(h&&(f&1)==f&&(g&0)==g){f=f+8|0;break a}}while(0);if((g|0)<0||(g|0)==0&&f>>>0<0){if((g|0)<-32768||(g|0)==-32768&&f>>>0<1){f=6;break}f=(T.b(0,0,f,g),T.result[0]);g=T.result[1]}f=g>>>0<0||g>>>0==0&&f>>>0<128?1:g>>>0<0||g>>>0==0&&f>>>0<32768?2:g>>>0<0||g>>>0==0&&f>>>0<8388608?3:g>>>0<0||g>>>0==0&&f>>>0<2147483648?4:g>>>0<32768||g>>>0==32768&&f>>>0<0?5:6}}else{f=0}}while(0);return f}QG.X=1;function dH(b,c,d){var e=p[p[b+4>>2]+8>>2],f=(e|0)==0;a:do{if(!f){for(var g=b+20|0,h=e;;){if((p[h+20>>2]|0)==(p[g>>2]|0)){var i=h+24|0;p[i>>2]=c;p[i+4>>2]=d}h=p[h+8>>2];if((h|0)==0){break a}}}}while(0)}function PG(b,c,d,e,f){var g,h=a;a+=4;var i;p[h>>2]=0;i=(e=(e|0)!=0)?l[b+79|0]<<24>>24==1?OG(b,h,0):0:l[b+79|0]<<24>>24==1?OG(b,h,1):0;if((d+c|0)>(p[h>>2]|0)){i=7}else{var j=f+28|0;(n[j>>1]&1024)<<16>>16!=0?i=7:(tk(f),p[f+4>>2]=i+c|0,n[j>>1]=4112,g=0,i=13)}i==7&&(g=yk(f,d+2|0,0),(g|0)==0&&(n[f+28>>1]=1552,l[f+31|0]=0,l[f+30|0]=4,g=(f+4|0)>>2,i=p[g],b=e?Xm(b,c,d,i,0):Vm(b,c,d,i),l[p[g]+d|0]=0,l[p[g]+d+1|0]=0,(b|0)==0?g=0:(tk(f),g=b)));p[f+24>>2]=d;a=h;return g}PG.X=1;function SG(b,c){if(c>>>0<16384){l[b]=(c>>>7|128)&255;l[b+1|0]=c&127;var d=2}else{d=IH(b,c,0)}return d}function TG(b,c,d,e){var e=QG(d,e),f=e>>>0<8&(e|0)!=0;a:do{if(f){var g=(e|0)==7?d+8|0:d+16|0,h=Rm(e);if((h|0)==0){var i=0}else{for(var j=g|0,g=g+4|0,g=t[g]|t[g+1]<<8|t[g+2]<<16|t[g+3]<<24|0,j=t[j]|t[j+1]<<8|t[j+2]<<16|t[j+3]<<24|0,k=h;;){k=k-1|0;l[b+k|0]=j&255;j=j>>>8|g<<24;if((k|0)==0){i=h;break a}g=g>>>8|0}}}else{e>>>0>11?(i=d+24|0,h=y[i>>2],Ah(b,p[d+4>>2],h),(n[d+28>>1]&16384)<<16>>16!=0&&(h=p[d+16>>2]+h|0,h=h>>>0>c>>>0?c:h,i=y[i>>2],Ed(b+i|0,0,h-i|0)),i=h):i=0}}while(0);return i}TG.X=1;function UG(b,c){var d,e=(p[b+20>>2]|0)==0;a:do{if(e){p[c>>2]=0,p[c+4>>2]=0}else{var f=$F(b);d=(b+86|0)>>1;var g=f,h=f=0;b:for(;;){if((g|0)!=0){d=g;break a}var g=Vc[d],i=y[b+(g<<16>>16<<2)+128>>2],j=l[i+3|0]<<24>>24==0;do{if(j){if(l[i+2|0]<<24>>24!=0){var k=i,m=g,o=f,r=h}else{r=(T.add(n[i+16>>1]&65535,0,h,f),T.result[0]),o=T.result[1],k=i,m=g}}else{for(var q=(T.add(n[i+16>>1]&65535,0,h,f),T.result[0]),s=T.result[1],k=g;;){if(k<<16>>16==0){break b}OF(b);var k=Vc[d],o=k<<16>>16,u=(o<<1)+b+88|0,w=Vc[u>>1];if((w&65535)<(Vc[p[b+(o<<2)+128>>2]+16>>1]&65535)){break}}n[u>>1]=w+1&65535;o=Vc[d];k=p[b+(o<<16>>16<<2)+128>>2];m=o;o=s;r=q}}while(0);f=Vc[b+(m<<16>>16<<1)+88>>1];f<<16>>16==n[k+16>>1]<<16>>16?g=NF(b,Xi(p[k+64>>2]+(t[k+5|0]&255)+8|0)):(f=(f&65535)<<1,h=y[k+72>>2],g=NF(b,Xi(p[k+64>>2]+(((t[h+f|0]&255)<<8|t[h+(f|1)|0]&255)&Vc[k+18>>1]&65535)|0)));f=o;h=r}p[c>>2]=q;p[c+4>>2]=s}d=0}while(0);return d}UG.X=1;function WG(b,c,d){var e,f,g=b+308|0,h=(p[g>>2]|0)==0;a:do{if(h){var i=0}else{var j=b+312|0,k=d+1|0,m=0;for(f=0;;){if((f|0)!=0){i=f;break a}if((m|0)>=(p[j>>2]|0)){i=0;break a}var o=p[p[g>>2]+(m<<2)>>2];f=o>>2;e=p[p[f+1]>>2]>>2;var r=p[f+2];(r|0)==0?f=0:(p[e]|0)>1?((c|0)==0?(e=p[e+20],p[(o+20|0)>>2]=k,o=e):o=(c|0)==2?p[e+22]:p[e+21],f=(o|0)==0?0:(p[f+5]|0)>(d|0)?Gd[o](r,d):0):f=0;m=m+1|0}}}while(0);return i}WG.X=1;function VG(b,c,d){if((b|0)==0){var e=0}else{l[b+8|0]<<24>>24!=2?e=0:(e=p[b+4>>2],li(p[b>>2],e),b=nq(p[e>>2],c,d),(b|0)!=0?e=b:((d|0)<0&&(n[e+22>>1]&8)<<16>>16!=0&&(p[(e+44|0)>>2]=0),d=Ni(e),p[(e+44|0)>>2]=Xi(p[p[e+12>>2]+64>>2]+28|0),e=d))}return e}function XG(b){dj();var c=b+4|0,d=p[c>>2],e=(d|0)>0;a:do{if(e){for(var f=b+8|0,g=0,h=0,i=d;;){var j=p[p[f>>2]+(g<<4)+4>>2];(j|0)!=0&&(h=(JH(j)|0)==0?h:1,Tj(j),l[(g<<4)+p[f>>2]+8|0]=0,i=p[c>>2]);g=g+1|0;if((g|0)>=(i|0)){var k=h;break a}}}else{k=0}}while(0);Un(b,68);gj();(p[b+12>>2]&512|0)!=0&&(Nm(p[b+136>>2]),Bi(b,-1));c=b+492|0;p[c>>2]=0;p[c+4>>2]=0;c=p[b+180>>2];if((c|0)!=0&&!((k|0)==0&&l[b+28|0]<<24>>24!=0)){Gd[c](p[b+176>>2])}}XG.X=1;function YG(b,c,d,e,f){var g;g=p[b+24>>2]-c|0;var h=p[b+8>>2],i=h+g*40|0,j=(f|0)!=0,k=d<<3,m=(j?304:96)+k|0,f=(b+68|0)>>2,o=p[p[f]+(c<<2)>>2];(o|0)!=0&&(aH(b,o),p[((c<<2)+p[f]|0)>>2]=0);(yk(i,m,0)|0)==0?(g=(h+g*40+4|0)>>2,b=p[g],p[((c<<2)+p[f]|0)>>2]=b,Ed(b,0,96),p[(b+12|0)>>2]=e,p[(b+20|0)>>2]=d,(d|0)!=0&&(p[(b+84|0)>>2]=p[g]+96|0),j&&(c=p[g]+k+96|0,p[b>>2]=c,Ed(c,0,86)),c=b):c=0;return c}YG.X=1;function ZG(b,c,d,e,f){li(p[b>>2],p[b+4>>2]);return KH(b,c,d,e,f)}function $G(b,c,d){li(p[b>>2],p[b+4>>2]);return LH(b,c,d)}function aH(b,c){if((c|0)!=0){var d=p[b>>2],e,f=c+68|0,g=p[f>>2];e=g>>2;if((g|0)!=0){var h=g+8|0,i=p[h>>2];if((i|0)!=0){var j=g+4|0,k=(p[j>>2]|0)>0;a:do{if(k){for(var m=0,o=i;;){if(o=o+m*36|0,vf(d,p[o+24>>2]),Ed(o,0,36),m=m+1|0,o=p[h>>2],(m|0)>=(p[j>>2]|0)){var r=o;break a}}}else{r=i}}while(0);vf(d,r)}h=p[e+8];(h|0)!=0&&MH(h);NH(d,p[e+10]);vf(d,p[e+13]);vf(d,g);p[f>>2]=0}d=p[c+4>>2];(d|0)==0?(d=p[c>>2],(d|0)!=0&&Zn(d)):Wn(d);d=p[c+36>>2];(d|0)!=0&&(e=p[c+40>>2],f=b+102|0,l[f]=1,Gd[p[e+28>>2]](d),l[f]=0)}}function bH(b,c){var d=$F(b);(d|0)==0&&(l[b+79|0]<<24>>24==0?p[c>>2]=1:(p[c>>2]=0,d=MF(b)));return d}function cH(b,c){var d,e=b+79|0;if(l[e]<<24>>24==1){if(l[b+77|0]<<24>>24==0){d=3}else{var f=0;d=7}}else{d=3}d==3&&(d=$F(b),(d|0)!=0?f=d:l[e]<<24>>24==0?(p[c>>2]=1,f=d):(p[c>>2]=0,e=QF(b),l[b+77|0]=(e|0)==0&1,f=e));return f}function eH(b,c,d,e,f,g,h,i,j){var k,m,o=a;a+=12;m=o>>2;var r=o+4,q=o+8;p[r>>2]=j;p[q>>2]=0;var s=p[p[b>>2]+4>>2],u=b+79|0,w=l[u]<<24>>24==3;a:do{if(w){k=p[b+72>>2]}else{if((p[b+16>>2]|0)==0&&OH(p[s+8>>2],d,e,0),k=Uj(s,p[b+20>>2],b),p[m]=k,(k|0)==0){if((j|0)==0&&(k=RF(b,c,d,e,i,r),p[m]=k,(k|0)!=0)){break}k=(b+86|0)>>1;var v=y[b+(n[k]<<16>>16<<2)+128>>2];PH(s);var x=y[s+80>>2];if((x|0)==0){k=7}else{var A=QH(v,x,c,d,e,f,g,h,q);p[m]=A;if((A|0)!=0){k=A}else{var A=(n[k]<<16>>16<<1)+b+88|0,E=Vc[A>>1],J=E&65535,M=y[r>>2],D=(M|0)==0;do{if(D){var K=Yi(p[v+76>>2]);p[m]=K;if((K|0)!=0){k=K;break a}var K=J<<1,H=y[v+72>>2],K=p[v+64>>2]+(((t[H+K|0]&255)<<8|t[H+(K|1)|0]&255)&Vc[v+18>>1]&65535)|0;if(l[v+3|0]<<24>>24==0){var H=K,N=x;B=t[H]|t[H+1]<<8|t[H+2]<<16|t[H+3]<<24|0;l[N]=B&255;B>>=8;l[N+1]=B&255;B>>=8;l[N+2]=B&255;B>>=8;l[N+3]=B&255}H=RH(v,K);K=SH(v,K);p[m]=K;TH(v,J,H&65535,o);K=y[m];if((K|0)!=0){k=K;break a}K=J}else{(M|0)<0?n[v+16>>1]<<16>>16==0?K=J:(K=E+1&65535,n[A>>1]=K,K&=65535):K=J}}while(0);UH(v,K,x,p[q>>2],0,0,o);n[b+58>>1]=0;l[b+78|0]=0;x=y[m];(x|0)!=0?k=x:l[v+1|0]<<24>>24==0?k=0:(v=VH(b),p[m]=v,l[p[b+(n[k]<<16>>16<<2)+128>>2]+1|0]=0,l[u]=0,k=v)}}}}}while(0);a=o;return k}eH.X=1;function fH(b){var c,d,e=a;a+=8;d=e>>2;var f=e+4,g=y[p[b>>2]+4>>2];c=(b+86|0)>>1;var h=Vc[c],i=h<<16>>16,j=Vc[b+(i<<1)+88>>1],i=y[b+(i<<2)+128>>2],k=(j&65535)<(Vc[i+16>>1]&65535);do{if(k){if(l[b+79|0]<<24>>24!=1){var m=1}else{if((p[b+16>>2]|0)==0){m=b+32|0;OH(p[g+8>>2],p[m>>2],p[m+4>>2],0);var m=n[c],o=m<<16>>16,r=n[b+(o<<1)+88>>1],o=p[b+(o<<2)+128>>2]}else{m=h,r=j,o=i}var q=m<<16>>16;r&=65535;var s=r<<1,u=y[o+72>>2],u=p[o+64>>2]+(((t[u+s|0]&255)<<8|t[u+(s|1)|0]&255)&Vc[o+18>>1]&65535)|0,s=o+3|0;if(l[s]<<24>>24==0){var w=PF(b,f);p[d]=w;if((w|0)!=0){m=w;break}}w=Uj(g,p[b+20>>2],b);p[d]=w;if((w|0)!=0){m=w}else{if(w=Yi(p[o+76>>2]),p[d]=w,(w|0)!=0){m=w}else{if(w=SH(o,u),p[d]=w,u=RH(o,u)&65535,TH(o,r,u,e),u=y[d],(u|0)!=0){m=u}else{if(l[s]<<24>>24==0){var s=y[b+(n[c]<<16>>16<<2)+128>>2],q=p[p[b+(q+1<<2)+128>>2]+80>>2],u=y[s+64>>2],w=s+16|0,v=(Vc[w>>1]&65535)<<1,x=y[s+72>>2],v=((t[x+(v-2)|0]&255)<<8|t[x+(v-1)|0]&255)&Vc[s+18>>1]&65535,x=RH(s,u+v|0)&65535;PH(g);var A=p[g+80>>2],E=Yi(p[s+76>>2]);p[d]=E;UH(o,r,u+(v-4)|0,x+4|0,A,q,e);TH(s,(Vc[w>>1]&65535)-1|0,x,e);o=y[d];if((o|0)!=0){m=o;break}}o=VH(b);p[d]=o;if((o|0)!=0){m=o}else{o=n[c];if(o<<16>>16>m<<16>>16){for(;;){if(n[c]=o-1&65535,Yj(p[b+(o<<16>>16<<2)+128>>2]),o=n[c],o<<16>>16<=m<<16>>16){break}}m=VH(b);p[d]=m;if((m|0)!=0){break}}$F(b);m=0}}}}}}else{m=1}}while(0);a=e;return m}fH.X=1;function jH(b,c){var d,e=p[b>>2],f=b+56|0;vf(e,p[f>>2]);d=(c+8|0)>>2;e=yl(e,p[d]);p[f>>2]=e;Lg(p[d]);p[d]=0}function EH(b,c,d){var e,f,g,h,i,j=a;a+=24;var k;i=j>>2;var m=j+4;h=m>>2;var o=j+12,r=j+20,q=y[c+68>>2];p[i]=0;p[(m|0)>>2]=0;p[(m+4|0)>>2]=0;g=(q+36|0)>>2;var s=(p[g]|0)==0;do{if(s){p[d>>2]=(p[q+40>>2]|0)==0&1,f=WH(c)}else{if(f=XH(b,c),(f|0)==0){f=p[g];if((f|0)>16){var u=16;k=6}else{if((f|0)>2){u=f,k=6}else{var w=2;k=8}}a:do{if(k==6){for(f=2;;){if(f<<=1,(f|0)>=(u|0)){w=f;break a}}}}while(0);var v=e=ni(b,w*40|0);f=(q+8|0)>>2;p[f]=v;if((e|0)==0){f=7}else{e=(q+12|0)>>2;p[e]=v+w*36|0;p[q+4>>2]=w;var v=q+32|0,x=b|0,A=q+16|0,E=q+24|0,J=0,M=0;a:for(;;){var D=(M|0)==0;do{if(D){k=y[g];if((J<<4|0)>=(k|0)){var K=0,H=k;k=25;break}k=YH(b,c,o);if((k|0)!=0){var N=k;k=24;break}if((p[g]|0)<17){var Q=0;break a}k=p[i];if((k|0)==0){if(k=ZH(p[x>>2],j),(k|0)!=0){var P=k;k=23}else{var L=p[i];k=17}}else{L=k,k=17}do{if(k==17&&(M=o|0,P=o+4|0,P=$H(L,p[M>>2],p[P>>2],m),(P|0)==0)){p[r>>2]=0;M=m|0;P=m+4|0;P=p[P>>2];M=p[M>>2];for(D=0;;){var I=p[p[e]+4>>2],X=p[f],Y=p[(X+28>>2)+(I*9|0)],Y=RG(Y,(Y|0)<0?-1:0)+Y|0,da=Ei(L,p[(X+24>>2)+(I*9|0)],Y,M,P),I=(T.add(M,P,Y,(Y|0)<0?-1:0),T.result[0]),X=T.result[1];(da|0)==0?(Y=kH(b,c,r),D=p[r>>2]):Y=da;if((D|Y|0)!=0){break}P=X;M=I}p[h]=I;p[h+1]=X;P=Y}}while(0);J=J+1|0;M=P;continue a}N=M;k=24}while(0);k==24&&(K=N,H=p[g]);if((H|0)<17){Q=K;break}k=p[v>>2];p[g]=J;p[v>>2]=p[i];p[i]=k;M=p[h];J=p[h+1];k=A|0;p[k>>2]=M;k=A+4|0;p[k>>2]=J;p[E>>2]=0;p[E+4>>2]=0;p[h]=0;p[h+1]=0;if((K|0)!=0){Q=K;break}M=J=0}v=p[i];(v|0)!=0&&MH(v);p[d>>2]=(p[(p[f]+16>>2)+(p[p[e]+4>>2]*9|0)]|0)==0&1;f=Q}}}}while(0);a=j;return f}EH.X=1;function kH(b,c,d){var e,f=y[c+68>>2];e=f+12|0;var g=p[e>>2];if((g|0)==0){e=(f+40|0)>>2,c=y[e],g=c+8|0,p[e]=p[g>>2],p[g>>2]=0,NH(b,c),c=0,e=(p[e]|0)==0&1}else{var h=p[g+4>>2],g=f+8|0,b=aI(b,p[g>>2]+h*36|0),f=p[f+4>>2]+h|0,h=(b|0)==0&(f|0)>1;a:do{if(h){for(var i=f;;){var j=(i|0)/2&-1;bI(c,j);if((i|0)<=3){var k=0;break a}i=j}}else{k=b}}while(0);c=k;e=(p[(p[g>>2]+16>>2)+(p[p[e>>2]+4>>2]*9|0)]|0)==0&1}p[d>>2]=e;return c}function lH(b,c,d){var e,f,g=p[c+68>>2];f=(d+24|0)>>2;var h=p[f],i=RG(h,(h|0)<0?-1:0);e=(g|0)>>2;p[e]=i+h+p[e]|0;h=zh(b,p[f]+12|0);i=(h|0)==0;do{if(i){var j=7}else{var j=h,k=h+12|0;p[h>>2]=k;Ah(k,p[d+4>>2],p[f]);p[(h+4|0)>>2]=p[f];k=g+40|0;p[(h+8|0)>>2]=p[k>>2];p[k>>2]=j;j=p[g+48>>2];if((j|0)>0){k=p[e];if((k|0)<=(j|0)){if((k|0)<=(p[g+44>>2]|0)){j=0;break}if((p[Qg+32>>2]|0)==0){j=0;break}}j=XH(b,c);p[e]=0}else{j=0}}}while(0);return j}lH.X=1;function mH(b,c){var d,e,f=a;a+=96;e=f>>2;var g=f+8,h=f+12,i=f+16,j=f+56;p[e]=0;p[e+1]=0;NG(b,f);var k=i>>2;for(d=k+10;k<d;k++){p[k]=0}e=PG(b,0,p[e],1,i);k=(e|0)==0;a:do{if(k){d=(i+4|0)>>2;var m=y[d],o=t[m];o<<24>>24>-1?(m=o&255,p[g>>2]=m):(XF(m,g),m=p[g>>2]);o=m>>>0<3;do{if(!o){var r=i+24|0;if((m|0)<=(p[r>>2]|0)){var q=p[d]+(m-1)|0,s=t[q];s<<24>>24>-1?(q=s&255,p[h>>2]=q):(XF(q,h),q=p[h>>2]);if(q>>>0<=9&&!((q|0)==7||(q|0)==0)){if(s=Rm(q),r=y[r>>2],r>>>0>=(m+s|0)>>>0){YF(p[d]+(r-s)|0,q,j);g=j+16|0;h=p[g+4>>2];p[c>>2]=p[g>>2];p[c+4>>2]=h;tk(i);d=0;break a}}}}}while(0);tk(i);aj(62505);d=11}else{d=e}}while(0);a=f;return d}mH.X=1;function uH(b,c){return(b<<24>>24==0?(p[c>>2]|0)>1?(p[c+52>>2]|0)!=0:0:1)&1}function oH(b,c,d){var e=b+4|0,f=p[e>>2];li(p[b>>2],f);OH(p[p[e>>2]+8>>2],0,0,1);b=Uj(f,c,0);return(b|0)==0?cI(f,c,0,d):b}function pH(b,c,d,e,f,g){var h,i,j,k=a;a+=156;var m=k+56;li(b,c);var o=c|0;i=p[o>>2];b=p[p[i+176>>2]+12>>2];p[k>>2]=c;p[k+4>>2]=i;h=p[c+44>>2];j=(k+8|0)>>2;p[j]=h;i=(k+16|0)>>2;p[i]=f;f=(k+20|0)>>2;p[f]=0;var r=k+24|0;p[r>>2]=0;p[g>>2]=0;if((h|0)==0){g=0}else{var q=bh((h<<2)+4|0);h=(k+12|0)>>2;p[h]=q;if((q|0)==0){p[g>>2]=1,g=0}else{for(var s=0;;){p[q+(s<<2)>>2]=0;var s=s+1|0,u=y[j];if(s>>>0>u>>>0){break}q=p[h]}s=Math.floor((y[si>>2]>>>0)/(y[c+32>>2]>>>0))+1|0;s>>>0>u>>>0||(p[((s<<2)+p[h]|0)>>2]=1);u=k+28|0;Zg(u,m|0,100,2e4);l[k+53|0]=2;m=p[p[c+12>>2]+64>>2];dI(k,1,Xi(m+32|0),Xi(m+36|0),R.Pl|0);m=c+17|0;for(s=0;;){if((s|0)>=(e|0)){var w=1;break}if((p[i]|0)==0){w=1;break}var q=(s<<2)+d|0,v=p[q>>2];(v|0)!=0&&(l[m]<<24>>24!=0&(v|0)>1?(eI(k,v,1,0,0),q=p[q>>2]):q=v,fI(k,q,R.Ql|0,0,0));s=s+1|0}for(;;){if(w>>>0>y[j]>>>0){break}if((p[i]|0)==0){break}(p[p[h]+(w<<2)>>2]|0)==0?(cG(c,w)|0)==(w|0)&&l[m]<<24>>24!=0?d=25:(gI(k,0,R.Sl|0,(z=a,a+=4,p[z>>2]=w,z)),d=(p[p[h]+(w<<2)>>2]|0)==0?25:22):d=22;d==22&&(cG(c,w)|0)==(w|0)&&l[m]<<24>>24!=0&&gI(k,0,R.Tl|0,(z=a,a+=4,p[z>>2]=w,z));w=w+1|0}c=p[p[p[o>>2]+176>>2]+12>>2];(b|0)!=(c|0)&&gI(k,0,R.Ul|0,(z=a,a+=8,p[z>>2]=b,p[z+4>>2]=c,z));Lg(p[h]);(p[r>>2]|0)==0?(c=p[f],p[g>>2]=c,(c|0)==0&&Bu(u),g=th(u)):(Bu(u),p[g>>2]=p[f]+1|0,g=0)}}a=k;return g}pH.X=1;function qH(b){var c=p[b>>2];tk(b);var d=zh(c,64);p[b+36>>2]=d;if(l[c+30|0]<<24>>24==0){var e=Dl(c,d);p[d>>2]=0;p[d+4>>2]=c;p[d+8>>2]=0;p[d+12>>2]=0;p[d+20>>2]=0;p[d+16>>2]=d+32|0;n[d+24>>1]=(e+1048544|0)>>>4&65535;l[d+26|0]=1;l[d+27|0]=0;p[b+16>>2]=d;n[b+28>>1]=32}else{n[b+28>>1]=1}}function rH(b,c,d){var e,f=b>>2,g;e=(b+24|0)>>1;g=n[e];if(g<<16>>16==0){if(g=zh(p[f+1],1012),(g|0)==0){g=12}else{var h=b|0;p[g>>2]=p[h>>2];p[h>>2]=g;h=g+4|0;p[f+4]=h;n[e]=63;var i=62;g=5}}else{i=g-1&65535,h=p[f+4],g=5}g==5&&(p[f+4]=h+16|0,n[e]=i,e=h|0,p[e>>2]=c,p[e+4>>2]=d,p[h+8>>2]=0,e=b+12|0,i=p[e>>2],(i|0)==0?p[f+2]=h:(b=b+26|0,l[b]<<24>>24!=0&&(f=i|0,g=p[f+4>>2],(g|0)<(d|0)||(g|0)==(d|0)&&p[f>>2]>>>0<c>>>0||(l[b]=0)),p[(i+8|0)>>2]=h),p[e>>2]=h)}rH.X=1;function xH(b,c){var d=b>>2,e,f=b+5|0,g=t[f];e=l[b+15|0]<<24>>24==0?3:(c|0)==4||(c|0)==2?3:18;a:do{if(e==3){var h=g&255;if((h|0)!=(c|0)&&(l[f]=c&255,l[b+4|0]<<24>>24==0&&(h&5|0)==1&&(c&1|0)==0)){if(Yp(p[d+16]),(t[b+17|0]&255)>1){hq(p[d],p[d+37],0)}else{var i=b+16|0,h=t[i],j=h<<24>>24==0;if(j){var k=hI(b),i=l[i]}else{k=0,i=h}k=((i<<24>>24==1?vr(b,2):k)|0)==0;do{if(k){hq(p[d],p[d+37],0);if(h<<24>>24!=1){break}kq(b,1);break a}e=16}while(0);j&&cq(b)}}}}while(0);return t[f]&255}xH.X=1;function yH(b,c){var d,e,f,g,h,i,j,k=a;a+=4;var m=c+28|0;if(l[m]<<24>>24==0){En(b,c,R.Bl|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),g=1}else{if((p[c+140>>2]|0)>1){En(b,c,R.Cl|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),g=1}else{j=(c+12|0)>>2;var o=y[j],r=c+60|0,q=p[r>>2],s=c+64|0,u=p[s>>2];i=(c+152|0)>>2;var w=p[i];p[j]=o&-352649217|268763136;p[i]=0;h=(c+8|0)>>2;var v=y[p[h]+4>>2];g=(v+4|0)>>2;var x=l[p[p[g]>>2]+15|0]&255,A=c+4|0,E=p[A>>2],J=iI(c,b,(l[c+29|0]<<24>>24==2&1|0)==0?R.El|0:R.Dl|0),A=p[A>>2],E=(A|0)>(E|0)?(A-1<<4)+p[h]|0:0,M=(J|0)==0;a:do{if(M){var D=y[p[h]+(A-1<<4)+4>>2];WD(D);var K;K=v+4|0;li(p[v>>2],p[K>>2]);K=p[K>>2];K=p[K+32>>2]-p[K+36>>2]|0;e=p[g];(l[p[e>>2]+5|0]&255|0)==5&&(p[c+36>>2]=0,e=p[g]);d=p[e+32>>2];f=(D|0)>>2;var H=p[f];e=(D+4|0)>>2;if((bi(H,p[e],d,K,0)|0)!=0){D=7}else{if((x|0)==0&&(bi(p[f],p[e],p[c+36>>2],K,0)|0)!=0){D=7}else{if(l[c+30|0]<<24>>24!=0){D=7}else{if(d=iI(c,b,R.Fl|0),(d|0)!=0){D=d}else{if(d=l[c+32|0],d=d<<24>>24>-1?d<<24>>24:lC(v),mC(p[f],p[e],d),d=iI(c,b,R.Hl|0),(d|0)!=0){D=d}else{if(d=jI(c,b,R.Il|0),(d|0)!=0){D=d}else{if(d=jI(c,b,R.Jl|0),(d|0)!=0){D=d}else{if(d=jI(c,b,R.Kl|0),(d|0)!=0){D=d}else{if(d=jI(c,b,R.Ll|0),(d|0)!=0){D=d}else{if(d=jI(c,b,R.Ml|0),(d|0)!=0){D=d}else{if(d=jI(c,b,R.Nl|0),(d|0)!=0){D=d}else{if(d=iI(c,b,R.Ol|0),(d|0)!=0){D=d}else{d=(v|0)>>2;for(H=0;;){if((H|0)>=8){break}var N=t[R.xc+H|0]&255;ri(p[d],p[g],N,k);N=Ai(p[f],p[e],N,(t[R.xc+(H|1)|0]&255)+p[k>>2]|0);if((N|0)!=0){D=N;break a}H=H+2|0}f=kI(v,D);(f|0)!=0?D=f:(f=WD(D),(f|0)!=0?D=f:(D=lC(D),mC(p[d],p[g],D),D=bi(p[d],p[g],p[p[e]+32>>2],K,1)))}}}}}}}}}}}}}else{D=J}}while(0);p[j]=o;p[r>>2]=q;p[s>>2]=u;p[i]=w;bi(p[v>>2],p[g],-1,-1,1);l[m]=1;(E|0)!=0&&(g=E+4|0,Wn(p[g>>2]),p[g>>2]=0,p[E+12>>2]=0);Bi(c,-1);g=D}}a=k;return g}yH.X=1;function IG(b,c){var d,e=a;a+=176;d=e>>2;var f=e+4,g=e+8,h=e+136;p[d]=0;var i=y[b>>2];Zg(g,e+36|0,100,p[i+72>>2]);p[g>>2]=i;var j=(p[i+148>>2]|0)>1;a:do{if(j){var k=l[c];if(k<<24>>24!=0){for(var m=c,o=k;;){for(k=m;;){var r=k+1|0;if(o<<24>>24==10){break}o=l[r];if(o<<24>>24==0){break}k=r}uh(g,R.vl|0,3);uh(g,m,r-m|0);k=l[r];if(k<<24>>24==0){break a}m=r;o=k}}}else{for(var m=b+72|0,k=i+8|0,o=h,q=h|0,s=h+24|0,u=h+4|0,w=c,v=1;;){if(l[w]<<24>>24==0){break a}var x,A=w;x=f;var E=a;a+=4;for(var J=p[x>>2]=0;;){if(l[A]<<24>>24==0){break}var M=Bn(A,E);if((p[E>>2]|0)==133){p[x>>2]=M;break}J=M+J|0;A=A+M|0}a=E;x=J;uh(g,w,x);A=w+x|0;E=p[f>>2];if((E|0)==0){break a}l[A]<<24>>24==63?(E|0)>1?(No(x+(w+1)|0,e),E=p[f>>2],A=p[d]):A=p[d]=v:(v=im(b,A,E),A=p[d]=v);w=w+E+x|0;v=A+1|0;x=A-1|0;E=y[m>>2];A=Vc[(E+28>>1)+(x*20|0)]&65535;if((A&1|0)==0){if((A&4|0)==0){if((A&8|0)==0){if((A&2|0)==0){if((A&16384|0)==0){uh(g,R.yl|0,2);A=E+x*40+24|0;M=(p[A>>2]|0)>0;b:do{if(M){for(var J=E+x*40+4|0,D=0;;){var K=t[p[J>>2]+D|0]&255;lI(g,R.zl|0,(z=a,a+=4,p[z>>2]=K,z));D=D+1|0;if((D|0)>=(p[A>>2]|0)){break b}}}}while(0);uh(g,R.Al|0,1)}else{x=p[(E+16>>2)+(x*10|0)],lI(g,R.xl|0,(z=a,a+=4,p[z>>2]=x,z))}}else{if(A=l[p[p[k>>2]+12>>2]+77|0],A<<24>>24==1){A=p[(E+24>>2)+(x*10|0)],x=p[(E+4>>2)+(x*10|0)],lI(g,R.jc|0,(z=a,a+=8,p[z>>2]=A,p[z+4>>2]=x,z))}else{M=o>>2;for(J=M+10;M<J;M++){p[M]=0}p[q>>2]=i;Tk(h,p[(E+4>>2)+(x*10|0)],p[(E+24>>2)+(x*10|0)],A,0);Lk(h,1);x=p[s>>2];E=p[u>>2];lI(g,R.jc|0,(z=a,a+=8,p[z>>2]=x,p[z+4>>2]=E,z));tk(h)}}}else{x=E+x*40+8|0,x=(C[0]=p[x>>2],C[1]=p[x+4>>2],xd[0]),lI(g,R.nb|0,(z=a,a+=8,xd[0]=x,p[z>>2]=C[0],p[z+4>>2]=C[1],z))}}else{E=E+x*40+16|0,x=p[E>>2],E=p[E+4>>2],lI(g,R.U|0,(z=a,a+=8,p[z>>2]=x,p[z+4>>2]=E,z))}}else{uh(g,R.V|0,4)}}}}while(0);d=th(g);a=e;return d}IG.X=1;function lI(b,c){var d=a;a+=4;p[d>>2]=arguments[lI.length];sh(b,1,c,p[d>>2]);a=d}function BH(b){var c=b+312|0,d=p[c>>2],e=(d%5|0)==0;do{if(e){var f=b+308|0,g=Il(b,p[f>>2],(d<<2)+20|0),h=g;if((g|0)==0){f=7;break}Ed((p[c>>2]<<2)+h|0,0,20);p[f>>2]=h}f=0}while(0);return f}function CH(b,c){var d=b+312|0,e=p[d>>2];p[d>>2]=e+1|0;p[((e<<2)+p[b+308>>2]|0)>>2]=c;Lm(c)}function zH(b){var c=(b|0)==0;a:do{if(!c){for(var d=b;;){if(Sm(d),d=p[d+8>>2],(d|0)==0){break a}}}}while(0)}function AH(b,c,d){var e=a;a+=32;var f,g=e+4,h=e+8,i=e+12,j=e+16,k=e+20,m=e+24,o=e+28,r=(cG(b,d)|0)==(d|0);do{if(r){f=20}else{if((Math.floor((y[si>>2]>>>0)/(y[b+32>>2]>>>0))+1|0)==(d|0)){f=20}else{if((Xi(p[p[b+12>>2]+64>>2]+36|0)|0)==0){var q=101;f=28}else{var s=gG(b,d,e,g);if((s|0)!=0){q=s,f=28}else{if(s=t[e],s<<24>>24==1){aj(52130),q=11,f=28}else{if(s<<24>>24==2){(c|0)!=0?(q=0,f=28):(f=mI(b,i,h,d,1),(f|0)!=0?(q=f,f=28):(Yj(p[i>>2]),f=20))}else{var u=Xj(b,d,k,0);if((u|0)!=0){q=u,f=28}else{u=(c|0)!=0;a:do{if(u){for(;;){var w=mI(b,m,j,0,0);if((w|0)!=0){v=w;f=15;break a}Yj(p[m>>2]);if(y[j>>2]>>>0<=c>>>0){f=17;break a}}}else{if(f=mI(b,m,j,0,0),(f|0)!=0){var v=f;f=15}else{Yj(p[m>>2]),f=17}}}while(0);f==15?(Yj(p[k>>2]),q=v,f=28):f==17&&(f=y[k>>2],w=Yi(p[f+76>>2]),(w|0)!=0?(Yj(f),q=w,f=28):(s=nI(b,f,s,p[g>>2],p[j>>2],u&1),Yj(f),(s|0)==0?f=20:(q=s,f=28)))}}}}}}}}while(0);a:do{if(f==20){if((c|0)==0){g=b+32|0;for(h=d;;){var x=h-1|0;if((x|0)!=(Math.floor((y[si>>2]>>>0)/(y[g>>2]>>>0))+1|0)&&(cG(b,x)|0)!=(x|0)){break}if((cG(b,x)|0)==(x|0)){h=Xj(b,x,o,0);if((h|0)!=0){q=h;break a}h=p[o>>2];i=Yi(p[h+76>>2]);Yj(h);if((i|0)!=0){q=i;break a}}h=x}p[p[b>>2]+24>>2]=x;p[b+44>>2]=x}q=0}}while(0);a=e;return q}AH.X=1;function mI(b,c,d,e,f){var g,h,i,j,k,m,o,r=d>>2,q=c>>2,s=a;a+=16;var u;o=s>>2;var w=s+4,v=s+8,x=s+12;p[o]=0;var A=b+12|0,E=y[A>>2];m=(b+44|0)>>2;var J=p[m];k=(E+64|0)>>2;var M=Xi(p[k]+36|0),D=M>>>0<J>>>0;a:do{if(D){var K=(M|0)==0;b:do{if(K){var H=Yi(p[E+76>>2]);if((H|0)!=0){var N=H;break a}var Q=y[m],P=Q+1|0;p[m]=P;var L=b+32|0;if((P|0)==(Math.floor((y[si>>2]>>>0)/(y[L>>2]>>>0))+1|0)){var I=Q+2|0,X=p[m]=I}else{X=P}var Y=l[b+17|0]<<24>>24==0;do{if(Y){var da=X}else{if((cG(b,X)|0)!=(X|0)){da=X}else{p[x>>2]=0;var ga=Xj(b,X,x,1);if((ga|0)!=0){N=ga;break a}var ha=p[x>>2],ba=Yi(p[ha+76>>2]);Yj(ha);if((ba|0)!=0){N=ba;break a}var ea=y[m],ja=ea+1|0;p[m]=ja;if((ja|0)!=(Math.floor((y[si>>2]>>>0)/(y[L>>2]>>>0))+1|0)){da=ja}else{var ra=ea+2|0,da=p[m]=ra}}}}while(0);Zi(p[p[A>>2]+64>>2]+28|0,da);var Va=p[m];p[r]=Va;var ta=Xj(b,Va,c,1);if((ta|0)!=0){N=ta;break a}var xa=Yi(p[p[q]+76>>2]);if((xa|0)==0){var Fa=0,Na=0,Ea=0}else{Yj(p[q]),Fa=0,Na=xa,Ea=0}}else{if(f<<24>>24==0|J>>>0<e>>>0){var La=0}else{var za=gG(b,e,w,0);if((za|0)!=0){N=za;break a}var Ba=l[w]<<24>>24==2&1;p[r]=e;La=Ba}var Ja=Yi(p[E+76>>2]);if((Ja|0)!=0){N=Ja;break a}Zi(p[k]+36|0,M-1|0);var ka=La<<24>>24==0,S=b+36|0,ib=La<<24>>24!=0,Wa=(e|0)!=0,Za=0;j=Za>>2;c:for(;;){var Sa=(Za|0)!=0,tb=Sa?Xi(p[j+16]):Xi(p[k]+32|0);if(tb>>>0>J>>>0){aj(54113);var pb=11;u=15;break}var fb=Xj(b,tb,s,0);if((fb|0)!=0){pb=fb;u=15;break}var Xa=y[o];i=Xa>>2;h=(Xa+64|0)>>2;var Ab=y[h],rb=Ab+4|0,cb=Xi(rb),Cb=(cb|0)==0,Zb=Cb&ka;do{if(Zb){var dc=Yi(p[i+19]);if((dc|0)!=0){Fa=Za;Na=dc;Ea=Xa;break b}p[r]=tb;var kb=p[h],Oa=p[k]+32|0;B=t[kb]|t[kb+1]<<8|t[kb+2]<<16|t[kb+3]<<24|0;l[Oa]=B&255;B>>=8;l[Oa+1]=B&255;B>>=8;l[Oa+2]=B&255;B>>=8;l[Oa+3]=B&255;p[q]=Xa;var Db=p[o]=0}else{if(cb>>>0>((y[S>>2]>>>2)-2|0)>>>0){aj(54141);Fa=Za;Na=11;Ea=Xa;break b}if(ib&(tb|0)==(e|0)){p[q]=Xa;var Wb=Yi(p[i+19]);if((Wb|0)!=0){Fa=Za;Na=Wb;Ea=Xa;break b}if(Cb){if(Sa){var Nb=Yi(p[j+19]);if((Nb|0)!=0){Fa=Za;Na=Nb;Ea=Xa;break b}var $b=p[h],Rb=p[j+16];B=t[$b]|t[$b+1]<<8|t[$b+2]<<16|t[$b+3]<<24|0;l[Rb]=B&255;B>>=8;l[Rb+1]=B&255;B>>=8;l[Rb+2]=B&255;B>>=8;l[Rb+3]=B&255;var Ra=0}else{var Ob=p[h],Ua=p[k]+32|0;B=t[Ob]|t[Ob+1]<<8|t[Ob+2]<<16|t[Ob+3]<<24|0;l[Ua]=B&255;B>>=8;l[Ua+1]=B&255;B>>=8;l[Ua+2]=B&255;B>>=8;l[Ua+3]=B&255;Ra=0}}else{var Jb=Xi(p[h]+8|0);if(Jb>>>0>J>>>0){aj(54173);Fa=Za;Na=11;Ea=Xa;break b}var Vb=Xj(b,Jb,v,0);if((Vb|0)!=0){Fa=Za;Na=Vb;Ea=Xa;break b}var Pb=y[v>>2],sb=Yi(p[Pb+76>>2]);if((sb|0)!=0){Yj(Pb);Fa=Za;Na=sb;Ea=Xa;break b}g=(Pb+64|0)>>2;var db=p[h],wb=p[g];B=t[db]|t[db+1]<<8|t[db+2]<<16|t[db+3]<<24|0;l[wb]=B&255;B>>=8;l[wb+1]=B&255;B>>=8;l[wb+2]=B&255;B>>=8;l[wb+3]=B&255;var ob=cb-1|0;Zi(p[g]+4|0,ob);Ah(p[g]+8|0,p[h]+12|0,ob<<2);Yj(Pb);if(Sa){var Kb=Yi(p[j+19]);if((Kb|0)!=0){Fa=Za;Na=Kb;Ea=Xa;break b}Zi(p[j+16],Jb);Ra=0}else{Zi(p[k]+32|0,Jb),Ra=sb}}p[o]=0;var ub=Ra,Xb=0;u=51;break c}if(Cb){Db=Xa}else{var Sb=Wa&cb>>>0>1;d:do{if(Sb){for(var Qb=0,ac=1,Gb=fC(Xi(Ab+8|0)-e|0);;){var xb=fC(Xi((ac<<2)+Ab+8|0)-e|0),Ta=(xb|0)<(Gb|0),qb=Ta?ac:Qb,bc=Ta?xb:Gb,$a=ac+1|0;if(($a|0)==(cb|0)){var mb=qb;break d}Qb=qb;ac=$a;Gb=bc}}else{mb=0}}while(0);var Bb=(mb<<2)+Ab+8|0,bb=Xi(Bb);if(bb>>>0>J>>>0){aj(54228);Fa=Za;Na=11;Ea=Xa;break b}if(ka|(bb|0)==(e|0)){p[r]=bb;var jb=Yi(p[i+19]);if((jb|0)!=0){Fa=Za;Na=jb;Ea=Xa;break b}var nb=cb-1|0;if(mb>>>0<nb>>>0){var zb=(cb<<2)+Ab+4|0,Tb=Bb;B=t[zb]|t[zb+1]<<8|t[zb+2]<<16|t[zb+3]<<24|0;l[Tb]=B&255;B>>=8;l[Tb+1]=B&255;B>>=8;l[Tb+2]=B&255;B>>=8;l[Tb+3]=B&255}Zi(rb,nb);var ec=y[r],Hb=Xj(b,ec,c,(((p[b+60>>2]|0)==0?0:p[p[b+60>>2]>>2]>>>0<ec>>>0?1:(wj(p[b+60>>2],ec)|0)!=0)&1|0)==0&1);if((Hb|0)!=0){ub=Hb;Xb=Xa;u=51;break c}var Eb=Yi(p[p[q]+76>>2]);if((Eb|0)==0){ub=0;Xb=Xa;u=51;break c}Yj(p[q]);ub=Eb;Xb=Xa;u=51;break c}else{Db=Xa}}}}while(0);Yj(Za);if(ka){Na=Fa=0;Ea=Db;break b}Za=Db;j=Za>>2}u==15?(p[o]=0,Fa=Za,Na=pb,Ea=0):u==51&&(Yj(Za),Fa=0,Na=ub,Ea=Xb)}}while(0);Yj(Ea);Yj(Fa);if((Na|0)==0){var Lb=p[q];(n[p[Lb+76>>2]+26>>1]<<16>>16|0)>1?(Yj(Lb),aj(54306),N=11):(l[Lb|0]=0,N=Na)}else{p[q]=0,N=Na}}else{aj(54068),N=11}}while(0);a=s;return N}mI.X=1;function nI(b,c,d,e,f,g){var h,i=a;a+=8;var j=i+4;h=j>>2;var k=c+80|0,m=p[k>>2],g=oI(p[b>>2],p[c+76>>2],f,g);p[h]=g;var o=(g|0)==0;a:do{if(o){p[k>>2]=f;do{if(d<<24>>24==5||d<<24>>24==1){var r=pI(c);p[h]=r;if((r|0)!=0){break a}}else{if(r=Xi(p[c+64>>2]),(r|0)!=0&&(qI(b,r,4,f,j),r=p[h],(r|0)!=0)){break a}}}while(0);if(d<<24>>24==1){r=0}else{if(r=Xj(b,e,i,0),p[h]=r,(r|0)==0){var r=p[i>>2],q=Yi(p[r+76>>2]);p[h]=q;(q|0)==0?(q=rI(r,m,f,d),p[h]=q,Yj(r),(q|0)!=0?r=q:(qI(b,f,d,e,j),r=p[h])):(Yj(r),r=q)}}}else{r=g}}while(0);a=i;return r}nI.X=1;function oI(b,c,d,e){var f,g=b>>2,h=a;a+=4;var i,j=b+15|0;l[j]<<24>>24==0?i=3:(i=Yi(c),(i|0)==0?i=3:(f=i,i=20));a:do{if(i==3){f=(c+24|0)>>1;var k=n[f],m=(k&2)<<16>>16==0;do{if(m){var o=k}else{if((or(p[c+16>>2],p[c+20>>2])|0)==0){o=k}else{o=pr(c);if((o|0)!=0){f=o;break a}o=n[f]}}}while(0);k=(o&4)<<16>>16!=0&(e|0)==0?p[c+16>>2]:0;n[f]=o&-5;m=Lq(p[g+44],d);(m|0)!=0&&(n[f]|=n[m+24>>1]&4,l[j]<<24>>24==0?hj(m):sI(m,p[g+6]+1|0));f=p[c+16>>2];sI(c,d);Nq(c);l[j]<<24>>24!=0&&(sI(m,f),vi(m));(k|0)==0?f=0:(f=ti(b,k,h,0),(f|0)==0?(f=p[h>>2],n[(f+24|0)>>1]|=4,Nq(f),vi(f),f=0):k>>>0>y[g+7]>>>0||Lo(p[g+14],k,p[g+43]))}}while(0);a=h;return f}oI.X=1;function pI(b){var c=a;a+=4;var d=y[b+60>>2],e=b|0,f=l[e],g=y[b+80>>2],h=lr(b);p[c>>2]=h;h=(h|0)==0;do{if(h){var i=Vc[b+16>>1],j=i&65535,i=i<<16>>16==0;a:do{if(i){var k=b+3|0}else{for(var m=b+64|0,o=b+18|0,r=b+72|0,q=b+3|0,s=0;;){var u=s<<1,w=y[r>>2],u=p[m>>2]+(((t[w+u|0]&255)<<8|t[w+(u|1)|0]&255)&Vc[o>>1]&65535)|0;tI(b,u,c);l[q]<<24>>24==0&&qI(d,Xi(u),5,g,c);s=s+1|0;if((s|0)>=(j|0)){k=q;break a}}}}while(0);l[k]<<24>>24==0&&qI(d,Xi(p[b+64>>2]+(t[b+5|0]&255)+8|0),5,g,c)}}while(0);l[e]=f;b=p[c>>2];a=c;return b}pI.X=1;function qI(b,c,d,e,f){var g=f>>2,f=a;a+=4;if((p[g]|0)==0){if((c|0)==0){aj(49986),p[g]=11}else{var h=cG(b,c),b=ti(p[b>>2],h,f,0);if((b|0)==0){var c=(c-h)*5|0,i=c-5|0;if((i|0)<0){aj(49997),p[g]=11,d=p[f>>2]}else{b=p[f>>2];h=p[b+4>>2];i=h+i|0;if(!(l[i]<<24>>24==d<<24>>24&&(Xi(h+(c-4)|0)|0)==(e|0))){var j=Yi(b);p[g]=j;(j|0)==0&&(l[i]=d,Zi(h+(c-4)|0,e))}d=b}vi(d)}else{p[g]=b}}}a=f}qI.X=1;function rI(b,c,d,e){var f,g,h=a;a+=28;var i=e<<24>>24==4;a:do{if(i){g=p[b+64>>2],(Xi(g)|0)==(c|0)?(Zi(g,d),g=0):(aj(51961),g=11)}else{var j=b|0,k=l[j];lr(b);var m=Vc[b+16>>1]&65535;g=(b+64|0)>>2;f=(b+18|0)>>1;var o=b+72|0,r=e<<24>>24==3,q=h+24|0;b:do{if(r){var s=0;c:for(;;){if((s|0)>=(m|0)){break b}var u=y[g],w=s<<1,v=y[o>>2],w=((t[v+w|0]&255)<<8|t[v+(w|1)|0]&255)&Vc[f]&65535;bG(b,u+w|0,h);var v=Vc[q>>1],x=v<<16>>16==0;do{if(!x){var A=(v&65535)+w|0;if((A+(u+3)|0)>>>0<=(p[g]+(Vc[f]&65535)|0)>>>0){var E=u+A|0;if((Xi(E)|0)==(c|0)){break c}}}}while(0);s=s+1|0}Zi(E,d)}else{for(s=0;;){if((s|0)>=(m|0)){break b}var J=s<<1,u=y[o>>2],J=p[g]+(((t[u+J|0]&255)<<8|t[u+(J|1)|0]&255)&Vc[f]&65535)|0;if((Xi(J)|0)==(c|0)){break}s=s+1|0}Zi(J,d)}}while(0);f=(s|0)==(m|0);b:do{if(f){f=e<<24>>24==5;do{if(f&&(m=p[g]+(t[b+5|0]&255)+8|0,(Xi(m)|0)==(c|0))){Zi(m,d);break b}}while(0);aj(51995);g=11;break a}}while(0);l[j]=k;g=0}}while(0);a=h;return g}rI.X=1;function tI(b,c,d){var e=a;a+=28;if((p[d>>2]|0)==0){bG(b,c,e);var f=Vc[e+24>>1];f<<16>>16!=0&&qI(p[b+60>>2],Xi(c+(f&65535)|0),3,p[b+80>>2],d)}a=e}function sI(b,c){var d=b+16|0;Gd[p[of+132>>2]](p[p[b+28>>2]+40>>2],p[b>>2],p[d>>2],c);p[d>>2]=c;(n[b+24>>1]&6)<<16>>16==6&&(Ip(b),Kq(b))}function iI(b,c,d){var e=a;a+=4;(d|0)==0?b=7:($m(b,d,-1,e,0)|0)==0?(d=p[e>>2],tl(d),b=uI(b,d,c)):(d=Tm(b),En(c,b,d,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),b=an(b));a=e;return b}function jI(b,c,d){var e=a;a+=4;var d=$m(b,d,-1,e,0),f=(d|0)==0;a:do{if(f){for(var g=p[e>>2];;){if((tl(g)|0)==100){var h=Ml(g,0),h=iI(b,c,h);if((h|0)==0){continue}uI(b,g,c);var i=h;break a}i=uI(b,g,c);break a}}else{i=d}}while(0);a=e;return i}function kI(b,c){var d,e,f=a;a+=56;var g;e=f>>2;g=f+48;var h=p[b>>2];d=(b+4|0)>>2;li(h,p[d]);var h=c|0,i=c+4|0;li(p[h>>2],p[i>>2]);var j=p[p[p[d]>>2]+60>>2];if((p[j>>2]|0)==0){g=3}else{var i=p[i>>2],k=p[i+32>>2],i=(T.multiply(p[i+44>>2],0,k,(k|0)<0?-1:0),T.result[0]),k=T.result[1];p[g>>2]=i;p[g+4>>2]=k;g=Gd[p[p[j>>2]+40>>2]](j,11,g);g=(g|0)==12?0:g;if((g|0)==0){g=3}else{var m=g;g=6}}if(g==3){m=f>>2;for(g=m+12;m<g;m++){p[m]=0}p[e+5]=p[h>>2];p[e+6]=c;h=f+4|0;p[h>>2]=b;p[e+4]=1;pi(f,2147483647);e=Sj(f);(e|0)==0?(n[(p[d]+22|0)>>1]&=-3,m=0):(d=p[p[p[h>>2]+4>>2]>>2],l[d+15|0]<<24>>24==0&&l[d+13|0]<<24>>24==0&&Gp(d),m=e)}a=f;return m}kI.X=1;function uI(b,c,d){c=gk(c);if((c|0)!=0){var e=Tm(b);En(d,b,e,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z))}return c}function hI(b){var c,d=b>>2,e=a;a+=32;var f=e+4,g=e+8,h=e+12,i=e+16;if(l[b+15|0]<<24>>24==0){c=3}else{var j=y[d+10];if((j|0)==0){c=3}else{var k=j;c=40}}a:do{if(c==3){var k=b+180|0,j=y[k>>2],m=(uj(j)|0)==0;b:do{if(m){var o=b+16|0;if(l[o]<<24>>24!=0){var r=0,q=j}else{p[e>>2]=1;if(l[b+7|0]<<24>>24==0&&(c=sr(b,1),(c|0)!=0)){var s=c;c=38;break}var u=(t[b+17|0]&255)<2;do{if(u){c=vI(b,e);if((c|0)!=0){s=c;c=38;break b}c=(p[e>>2]|0)==0?23:10}else{c=10}}while(0);do{if(c==10){c=vr(b,4);if((c|0)!=0){s=c;c=38;break b}c=(b+64|0)>>2;if((p[p[c]>>2]|0)==0){var u=p[d],w=b+148|0,v=Dq(u,p[w>>2],0,f);(v|0)!=0|(p[f>>2]|0)==0?u=v:(p[g>>2]=0,u=Wp(u,p[w>>2],p[c],2050,g),(u|0)==0&&((p[g>>2]&1|0)==0?u=0:(Rh(43106),Yp(p[c]),u=14)))}else{u=0}if((p[p[c]>>2]|0)==0){if(l[b+4|0]<<24>>24!=0){var x=u}else{kq(b,1),x=u}c=21}else{if(c=aq(b),(c|0)!=0){var A=c;c=22}else{x=mq(b,1),l[o]=0,c=21}}if(c==21){if((x|0)==0){break}A=x}Pj(b,A);s=A;c=38;break b}}while(0);c=l[b+13|0]<<24>>24==0;do{if(c&&((p[d+22]|0)!=0||(((p[p[d+44]+40>>2]|0)==0?0:Gd[p[of+120>>2]](p[p[d+44]+40>>2]))|0)>0)){p[h>>2]=0;o=wI(b,h);if((o|0)!=0){s=o;c=38;break b}if((p[h>>2]|0)==0){o=i|0;for(u=o+16;o<u;o++){l[o]=0}}else{if(o=Tp(p[d+15],i|0,16,24,0),(o|0)!=0){s=o;c=38;break b}}(jm(b+100|0,i|0,16)|0)!=0&&Gp(b)}}while(0);q=b;r=a;a+=8;c=r+4;l[q+13|0]<<24>>24==0?(o=wI(q,c),(o|0)!=0?q=o:(o=p[q>>2],u=p[q+184>>2],(p[c>>2]|0)==0?(c=hq(o,u,0),p[r>>2]=0):c=Dq(o,u,0,r),(c|0)!=0?q=c:(p[r>>2]|0)==0?(q=q+5|0,l[q]<<24>>24==5&&(l[q]=0),q=c):q=xI(q,0))):q=0;a=r;r=q;q=p[k>>2]}}else{r=0,q=j}c=33}while(0);do{if(c==33){if((uj(q)|0)==0){s=r}else{s=b;k=a;a+=4;p[k>>2]=0;j=s+180|0;lq(p[j>>2]);j=p[j>>2];m=k;for(o=0;;){var o=o+1|0,E=zr(j,m,0,o);if((E|0)!=-1){break}}j=E;(p[k>>2]|j|0)!=0&&Gp(s);a=k;s=j}k=s;s=b+16|0;k=l[s]<<24>>24==0&(k|0)==0?wI(b,b+24|0):k;if((k|0)!=0){s=k}else{l[s]=1;k=0;break a}}}while(0);cq(b);k=s}}while(0);a=e;return k}hI.X=1;function vI(b,c){var d,e=b>>2,f=a;a+=20;var g=f+4,h=f+8,i=f+12,j=f+16,k=p[e];p[f>>2]=1;d=(b+64|0)>>2;var m=(p[p[d]>>2]|0)!=0;p[c>>2]=0;if(m){var o=0,r=0}else{o=Dq(k,p[e+37],0,f),r=(p[f>>2]|0)==0}r|=(o|0)!=0;a:do{if(r){var q=o}else{if(p[g>>2]=0,q=Gd[p[p[p[e+15]>>2]+36>>2]](p[e+15],g),(p[g>>2]|q|0)==0&&(q=wI(b,h),(q|0)==0)){if((p[h>>2]|0)==0){dj(),(vr(b,2)|0)==0&&(hq(k,p[e+37],0),l[b+4|0]<<24>>24==0&&kq(b,1)),gj()}else{do{if(!m&&(p[i>>2]=2049,q=Wp(k,p[e+37],p[d],2049,i),(q|0)!=0)){if((q|0)!=14){break a}p[c>>2]=1;q=0;break a}}while(0);l[j]=0;q=Tp(p[d],j,1,0,0);q=(q|0)==522?0:q;m||Yp(p[d]);p[c>>2]=l[j]<<24>>24!=0&1}}}}while(0);a=f;return q}vI.X=1;function wI(b,c){var d,e=a;a+=8;var f;d=e>>2;var g=(p[b+180>>2]|0)==0?0:n[p[b+180>>2]+40>>1]<<16>>16>-1?p[p[b+180>>2]+72>>2]:0,h=(g|0)==0;do{if(h){p[d]=0;p[d+1]=0;f=p[b+60>>2];if((p[f>>2]|0)==0){var i=-1,j=-1}else{f=Fi(f,e);if((f|0)!=0){var k=f;f=9;break}f=(T.add(p[d],p[d+1],-1,-1),T.result[0]);i=T.result[1];j=f}var m=p[b+128>>2];f=m;m=(m|0)<0?-1:0;i=(T.add(j,i,f,m),T.result[0]);i=(T.j(i,T.result[1],f,m),T.result[0])}else{i=g}f=6}while(0);f==6&&(d=b+132|0,i>>>0>y[d>>2]>>>0&&(p[d>>2]=i),p[c>>2]=i,k=0);a=e;return k}wI.X=1;function yI(b,c){var d,e=a;a+=16;var f=b,g=c,h=e;a:for(;;){var i=(g|0)==0,j=g|0;d=h;d>>=2;b:for(;;){if(i){var k=f;break a}for(var m=f;;){if((m|0)==0){k=g;break a}var f=m|0,h=p[f>>2],f=p[f+4>>2],o=p[j>>2],r=p[j+4>>2];if((f|0)<(r|0)||(f|0)==(r|0)&&h>>>0<o>>>0){break}if((r|0)<(f|0)||(r|0)==(f|0)&&o>>>0<h>>>0){break b}m=p[m+8>>2]}p[d+2]=m;f=p[m+8>>2];d=m;d>>=2}p[d+2]=g;f=m;h=g;g=p[g+8>>2]}p[d+2]=k;g=p[e+8>>2];a=e;return g}function xI(b,c){var d;if(l[b+13|0]<<24>>24==0){if((p[b+180>>2]|0)!=0){d=6}else{if((uH(l[b+4|0],p[p[b+60>>2]>>2])|0)==0){var e=14}else{Yp(p[b+64>>2]),d=vH(b),(d|0)!=0?e=d:(l[b+5|0]=5,e=l[b+16|0]=0)}d=7}}else{d=6}d==6&&(p[c>>2]=1,e=0);return e}function vH(b){var c;c=b+4|0;if(l[c]<<24>>24==0){f=0,c=4}else{var d=wH(b);if((d|0)!=0){var e=d;c=5}else{var f=t[c]&255;c=4}}c==4&&(e=b+136|0,e=zI(p[b>>2],p[b+60>>2],p[b+184>>2],f,p[e>>2],p[e+4>>2],b+180|0));return e}function wH(b){var c=vr(b,4);(c|0)!=0&&kq(b,1);return c}function zI(b,c,d,e,f,g,h){var i,j=a;a+=4;p[h>>2]=0;var k=qo(p[b+4>>2]+108|0);(k|0)==0?h=7:(p[k>>2]=b,i=(k+8|0)>>2,p[i]=k+108|0,p[(k+4|0)>>2]=c,n[k+40>>1]=-1,c=k+16|0,p[(c|0)>>2]=f,p[(c+4|0)>>2]=g,p[(k+100|0)>>2]=d,f=k+48|0,l[f]=1,g=k+49|0,l[g]=1,l[k+43|0]=(e|0)!=0?2:0,p[j>>2]=524294,b=Wp(b,d,p[i],524294,j),(b|0)==0?((p[j>>2]&1|0)!=0&&(l[k+46|0]=1),i=jq(p[i]),(i&1024|0)!=0&&(l[f]=0),(i&4096|0)!=0&&(l[g]=0),p[h>>2]=k):(gq(k,0),Yp(p[i]),Lg(k)),h=b);a=j;return h}zI.X=1;function sH(b){var c=a;a+=8;var d=c+4;l[b+26|0]<<24>>24==0&&AI(b);var e=b+20|0,f=p[e>>2];(f|0)!=0&&(BI(f,c,d),p[e>>2]=0,b=b+8|0,d=yI(p[b>>2],p[c>>2]),p[b>>2]=d);a=c}function tH(b,c){var d=p[b>>2];if((d|0)==0){d=0}else{if((c|0)==1){var e=d+8|0;p[b>>2]=p[e>>2];p[e>>2]=0;p[(d+12|0)>>2]=0}else{var e=c-1|0,f=tH(b,e),d=p[b>>2];(d|0)==0?d=f:(p[(d+12|0)>>2]=f,f=d+8|0,p[b>>2]=p[f>>2],e=tH(b,e),p[f>>2]=e)}}return d}function AI(b){var c,d=a;a+=160;c=d>>2;for(var e=c+40;c<e;c++){p[c]=0}c=(b+8|0)>>2;var e=p[c],f=(e|0)==0;a:do{if(f){var g=0,h=0}else{for(var i=d|0,j=e,k=0;;){var m=j+8|0;p[c]=p[m>>2];p[m>>2]=0;m=(k|0)==0;b:do{if(m){var o=j,r=i}else{for(var q=0,s=j,u=i,w=k;;){if(s=yI(w,s),p[u>>2]=0,q=q+1|0,u=(q<<2)+d|0,w=p[u>>2],(w|0)==0){o=s;r=u;break b}}}}while(0);p[r>>2]=o;j=p[c];if((j|0)==0){h=g=0;break a}k=p[i>>2]}}}while(0);for(;;){var v=yI(h,p[d+(g<<2)>>2]),g=g+1|0;if((g|0)==40){break}h=v}p[c]=v;p[b+12>>2]=0;l[b+26|0]=1;a=d}AI.X=1;function BI(b,c,d){var e=a;a+=4;var f=p[b+12>>2];(f|0)==0?p[c>>2]=b:(BI(f,c,e),p[(p[e>>2]+8|0)>>2]=b);c=b+8|0;f=p[c>>2];(f|0)==0?p[d>>2]=b:BI(f,c,d);a=e}function dI(b,c,d,e,f){var g=a;a+=4;for(var h=b+16|0,i=b+4|0,j=(c|0)==0,c=(b|0)>>2,k=e,m=d;;){var o=k-1|0;if((k|0)<=0){break}if((p[h>>2]|0)==0){break}if((m|0)<1){gI(b,f,R.pm|0,(z=a,a+=12,p[z>>2]=k,p[z+4>>2]=e,p[z+8>>2]=d,z));break}if((CI(b,m,f)|0)!=0){break}if((ti(p[i>>2],m,g,0)|0)!=0){gI(b,f,R.qm|0,(z=a,a+=4,p[z>>2]=m,z));break}var r=p[g>>2],q=p[r+4>>2];do{if(j){if(l[p[c]+17|0]<<24>>24!=0&(o|0)>0){eI(b,Xi(q),4,m,f),s=o}else{var s=o}}else{var s=Xi(q+4|0),u=p[c];l[u+17|0]<<24>>24!=0&&(eI(b,m,2,0,f),u=p[c]);if((s|0)>(((p[u+36>>2]|0)/4&-1)-2|0)){gI(b,f,R.rm|0,(z=a,a+=4,p[z>>2]=m,z)),s=k-2|0}else{var w=(s|0)>0;a:do{if(w){for(var v=0,x=u;;){var A=Xi((v<<2)+q+8|0);l[x+17|0]<<24>>24!=0&&eI(b,A,2,0,f);CI(b,A,f);v=v+1|0;if((v|0)==(s|0)){break a}x=p[c]}}}while(0);s=o-s|0}}}while(0);m=Xi(q);vi(r);k=s}a=g}dI.X=1;function eI(b,c,d,e,f){var g=a;a+=8;var h=g+4,i=gG(p[b>>2],c,g,h);if((i|0)==0){i=t[g],h=y[h>>2],i<<24>>24==d<<24>>24&(h|0)==(e|0)||gI(b,f,R.om|0,(z=a,a+=20,p[z>>2]=c,p[z+4>>2]=d&255,p[z+8>>2]=e,p[z+12>>2]=i&255,p[z+16>>2]=h,z)),d=6}else{if((i|0)==3082||(i|0)==7){p[b+24>>2]=1}d=3}d==3&&gI(b,f,R.nm|0,(z=a,a+=4,p[z>>2]=c,z));a=g}function OH(b,c,d,e){var f=(b|0)==0;a:do{if(!f){if((e|0)==0){for(var g=b;;){if(l[g+84|0]<<24>>24!=0){var h=g+32|0;p[h>>2]==c&&p[h+4>>2]==d&&(l[g+79|0]=0)}g=p[g+8>>2];if((g|0)==0){break a}}}else{for(g=b;;){if(l[g+84|0]<<24>>24!=0&&(l[g+79|0]=0),g=p[g+8>>2],(g|0)==0){break a}}}}}while(0)}function fI(b,c,d,e,f){var g,h,i,j,k,m=a;a+=148;var o,r=m+4,q=m+104,s=m+112,u=m+120;p[q>>2]=0;p[q+4>>2]=0;p[s>>2]=0;p[s+4>>2]=0;var w=r|0;Ch(100,w,R.Wl|0,(z=a,a+=4,p[z>>2]=c,z));var v=y[b>>2],x=v+36|0,A=y[x>>2],E=(c|0)==0;do{if(E){var J=0}else{if((CI(b,c,d)|0)!=0){J=0}else{var M=Xj(v,c,m,0);if((M|0)==0){var D=y[m>>2];l[D|0]=0;var K=lr(D);if((K|0)==0){var H=b+16|0,N=D+16|0;k=(D+64|0)>>2;for(var Q=D+18|0,P=D+72|0,L=u+12|0,I=D+2|0,X=u|0,Y=u+22|0,da=u+24|0,ga=A-5|0,ha=A-4|0,ba=v+17|0,ea=D+3|0,ja=0,ra=0;;){if((ja|0)>=(Vc[N>>1]&65535|0)){break}if((p[H>>2]|0)==0){break}Ch(100,w,R.Zl|0,(z=a,a+=8,p[z>>2]=c,p[z+4>>2]=ja,z));var Va=y[k],ta=ja<<1,xa=y[P>>2],Fa=((t[xa+ta|0]&255)<<8|t[xa+(ta|1)|0]&255)&Vc[Q>>1]&65535,Na=Va+Fa|0;bG(D,Na,u);var Ea=y[L>>2];if(l[I]<<24>>24==0){var La=X|0;j=La>>2;var za=X+4|0;i=za>>2;var Ba=p[j]+Ea|0}else{var Ja=y[X>>2],ka=y[X+4>>2];if((ja|0)==0){La=s|0;j=La>>2;p[j]=Ja;za=s+4|0;i=za>>2;p[i]=ka;var S=q|0;h=S>>2;p[h]=Ja;var ib=q+4|0;g=ib>>2;p[g]=ka}else{La=s|0;j=La>>2;var Wa=p[j],za=s+4|0;i=za>>2;var Za=p[i];(ka|0)>(Za|0)||(ka|0)==(Za|0)&&Ja>>>0>Wa>>>0||gI(b,w,R.$l|0,(z=a,a+=16,p[z>>2]=Ja,p[z+4>>2]=ka,p[z+8>>2]=Wa,p[z+12>>2]=Za,z));La=s|0;j=La>>2;p[j]=Ja;za=s+4|0;i=za>>2;p[i]=ka}Ba=Ea}var Sa=Vc[Y>>1]&65535;if(Ba>>>0>Sa>>>0){var tb=Va+(Vc[da>>1]&65535)+Fa|0;if(tb>>>0<=(p[k]+p[x>>2]|0)>>>0){var pb=Math.floor(((ga+Ba-Sa|0)>>>0)/(ha>>>0)),fb=Xi(tb);l[ba]<<24>>24!=0&&eI(b,fb,3,c,w);dI(b,0,fb,pb,w)}}if(l[ea]<<24>>24==0){var Xa=Xi(Na);l[ba]<<24>>24!=0&&eI(b,Xa,5,c,w);var Ab=fI(b,Xa,w,q,(ja|0)==0?0:s);if((ja|0)<1|(Ab|0)==(ra|0)){var rb=Ab}else{gI(b,w,R.am|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z)),rb=Ab}}else{rb=ra}ja=ja+1|0;ra=rb}if(l[ea]<<24>>24==0){var cb=Xi(p[k]+(t[D+5|0]&255)+8|0);Ch(100,w,R.cm|0,(z=a,a+=4,p[z>>2]=c,z));l[ba]<<24>>24!=0&&eI(b,cb,5,c,w);fI(b,cb,w,0,n[N>>1]<<16>>16!=0?s:0);o=l[ea]<<24>>24==0?45:32}else{o=32}if(o==32&&l[I]<<24>>24!=0){var Cb=(f|0)!=0;if((e|0)==0){if(Cb){La=q|0;j=La>>2;var Zb=p[j],za=q+4|0;i=za>>2;var dc=p[i],S=f|0;h=S>>2;var kb=p[h],ib=f+4|0;g=ib>>2;var Oa=p[g];(dc|0)>(Oa|0)||(dc|0)==(Oa|0)&&Zb>>>0>kb>>>0||gI(b,w,R.gm|0,(z=a,a+=16,p[z>>2]=Zb,p[z+4>>2]=dc,p[z+8>>2]=kb,p[z+12>>2]=Oa,z))}}else{if(Cb){La=q|0;j=La>>2;var Db=p[j],za=q+4|0;i=za>>2;var Wb=p[i],S=e|0;h=S>>2;var Nb=p[h],ib=e+4|0;g=ib>>2;var $b=p[g];(Wb|0)>($b|0)||(Wb|0)==($b|0)&&Db>>>0>Nb>>>0||gI(b,w,R.em|0,(z=a,a+=16,p[z>>2]=Db,p[z+4>>2]=Wb,p[z+8>>2]=Nb,p[z+12>>2]=$b,z));La=s|0;j=La>>2;var Rb=p[j],za=s+4|0;i=za>>2;var Ra=p[i],S=f|0;h=S>>2;var Ob=p[h],ib=f+4|0;g=ib>>2;var Ua=p[g];if((Ra|0)>(Ua|0)||(Ra|0)==(Ua|0)&&Rb>>>0>Ob>>>0){gI(b,w,R.fm|0,(z=a,a+=16,p[z>>2]=Rb,p[z+4>>2]=Ra,p[z+8>>2]=Ob,p[z+12>>2]=Ua,z));var Jb=s|0,Vb=s+4|0,Pb=p[Vb>>2],sb=p[Jb>>2]}else{Pb=Ra,sb=Rb}Jb=e|0;p[Jb>>2]=sb;Vb=e+4|0;p[Vb>>2]=Pb}else{La=s|0;j=La>>2;var db=p[j],za=s+4|0;i=za>>2;var wb=p[i],S=e|0;h=S>>2;var ob=p[h],ib=e+4|0;g=ib>>2;var Kb=p[g];if((wb|0)>(Kb|0)||(wb|0)==(Kb|0)&&db>>>0>ob>>>0){gI(b,w,R.dm|0,(z=a,a+=16,p[z>>2]=db,p[z+4>>2]=wb,p[z+8>>2]=ob,p[z+12>>2]=Kb,z))}}}}var ub=y[k],Xb=t[D+5|0]&255,Sb=Fp(p[v+32>>2]),Qb=(Sb|0)==0;do{if(Qb){p[b+24>>2]=1}else{var ac=(((t[Xb+(ub+5)|0]&255)<<8|t[Xb+(ub+6)|0]&255)+65535&65535)+1|0;Ed(Sb+ac|0,0,A-ac|0);Ed(Sb,1,ac);var Gb=(t[Xb+(ub+3)|0]&255)<<8|t[Xb+(ub+4)|0]&255,xb=(Gb|0)==0;a:do{if(!xb){for(var Ta=Xb+12-((t[ea]&255)<<2)|0,qb=0;;){var bc=(qb<<1)+Ta|0,$a=(t[ub+bc|0]&255)<<8|t[bc+(ub+1)|0]&255,mb=($a|0)>(ha|0)?65536:RH(D,ub+$a|0)&65535,Bb=$a-1+mb|0,bb=(Bb|0)<(A|0);b:do{if(bb){if((Bb|0)>=($a|0)){for(var jb=Bb;;){var nb=Sb+jb|0;l[nb]=l[nb]+1&255;var zb=jb-1|0;if((zb|0)<($a|0)){break b}jb=zb}}}else{gI(b,0,R.hm|0,(z=a,a+=8,p[z>>2]=qb,p[z+4>>2]=c,z))}}while(0);var Tb=qb+1|0;if((Tb|0)>=(Gb|0)){break a}qb=Tb}}}while(0);var ec=(t[Xb+(ub+1)|0]&255)<<8|t[Xb+(ub+2)|0]&255,Hb=(ec|0)==0;a:do{if(Hb){var Eb=0,Lb=0;o=60}else{for(var gb=ec;;){var Mb=((t[gb+(ub+2)|0]&255)<<8|t[gb+(ub+3)|0]&255)+gb-1|0,vc=(Mb|0)<(gb|0);b:do{if(!vc){for(var hc=Mb;;){var kc=Sb+hc|0;l[kc]=l[kc]+1&255;var pc=hc-1|0;if((pc|0)<(gb|0)){break b}hc=pc}}}while(0);var jc=(t[ub+gb|0]&255)<<8|t[gb+(ub+1)|0]&255;if((jc|0)==0){Lb=Eb=0;break a}gb=jc}}}while(0);a:for(;;){if((Eb|0)>=(A|0)){break}var mc=l[Sb+Eb|0],Fb=mc<<24>>24==0;do{if(!Fb){if(mc<<24>>24<=1){var Ub=Lb;break}gI(b,0,R.im|0,(z=a,a+=8,p[z>>2]=Eb,p[z+4>>2]=c,z));break a}Ub=Lb+1|0}while(0);Eb=Eb+1|0;Lb=Ub}var Ya=t[Xb+(ub+7)|0]&255;(Lb|0)!=(Ya|0)&&gI(b,0,R.jm|0,(z=a,a+=12,p[z>>2]=Lb,p[z+4>>2]=Ya,p[z+8>>2]=c,z))}}while(0);ip(Sb);Yj(D);J=ra+1|0}else{gI(b,w,R.Yl|0,(z=a,a+=4,p[z>>2]=K,z)),Yj(D),J=0}}else{gI(b,w,R.Xl|0,(z=a,a+=4,p[z>>2]=M,z)),J=0}}}}while(0);a=m;return J}fI.X=1;function gI(b,c,d){var e=a;a+=4;var f=b+16|0,g=p[f>>2];(g|0)!=0&&(p[f>>2]=g-1|0,f=b+20|0,p[f>>2]=p[f>>2]+1|0,p[e>>2]=arguments[gI.length],f=b+28|0,(p[b+40>>2]|0)!=0&&uh(f,R.Vl|0,1),(c|0)!=0&&uh(f,c,-1),sh(f,1,d,p[e>>2]),l[b+52|0]<<24>>24!=0&&(p[b+24>>2]=1));a=e}function CI(b,c,d){if((c|0)==0){b=1}else{if(y[b+8>>2]>>>0<c>>>0){gI(b,d,R.km|0,(z=a,a+=4,p[z>>2]=c,z)),b=1}else{var e=(c<<2)+p[b+12>>2]|0,f=y[e>>2];(f|0)==1?(gI(b,d,R.lm|0,(z=a,a+=4,p[z>>2]=c,z)),b=1):(p[e>>2]=f+1|0,b=(f|0)>1&1)}}return b}function RH(b,c){var d,e=a;a+=4;d=e>>2;var f=t[b+6|0]&255,g=c+f|0,h=l[b+2|0]<<24>>24==0;a:do{if(h){var i=t[g];i<<24>>24>-1?(p[d]=i&255,i=1):i=XF(g,e)&255;i=c+i+f|0}else{if(l[b+4|0]<<24>>24==0){p[d]=0;var j=g}else{var k=t[g];k<<24>>24>-1?(p[d]=k&255,k=1):k=XF(g,e)&255;j=c+k+f|0}for(k=j+9|0;;){var m=j+1|0;if(!(l[j]<<24>>24<0&m>>>0<k>>>0)){i=m;break a}j=m}}}while(0);h=y[d];f=Vc[b+8>>1]&65535;h>>>0>f>>>0?(g=Vc[b+10>>1]&65535,h=((h-g|0)>>>0)%((p[p[b+60>>2]+36>>2]-4|0)>>>0)+g|0,f=(h>>>0>f>>>0?g:h)+4|0,d=p[d]=f):d=h;d=d+(i-c)|0;a=e;return d>>>0<4?4:d&65535}RH.X=1;function Uj(b,c,d){var b=b+8|0,e=(c|0)==0;a:do{if(e){for(var f=b;;){f=p[f>>2];if((f|0)==0){var g=0;break a}var h=(f|0)==(d|0);do{if(!h&&l[f+79|0]<<24>>24==1){var i=DI(f);if((i|0)!=0){g=i;break a}}}while(0);f=f+8|0}}else{for(f=b;;){f=p[f>>2];if((f|0)==0){g=0;break a}h=(f|0)==(d|0);do{if(!h&&(p[f+20>>2]|0)==(c|0)&&l[f+79|0]<<24>>24==1&&(i=DI(f),(i|0)!=0)){g=i;break a}}while(0);f=f+8|0}}}while(0);return g}function cI(b,c,d,e){var f,g,h=a;a+=8;var i=h+4;g=i>>2;var j=p[b+44>>2]>>>0<c>>>0;do{if(j){aj(56399),f=11}else{if(f=SF(b,c,h),p[g]=f,(f|0)==0){var k=y[h>>2],m=k+16|0;f=(k+64|0)>>2;var o=k+18|0,r=k+72|0,q=k+3|0,s=0;a:for(;;){var u=Vc[m>>1]&65535;if((s|0)<(u|0)){var u=s<<1,w=y[r>>2],u=p[f]+(((t[w+u|0]&255)<<8|t[w+(u|1)|0]&255)&Vc[o>>1]&65535)|0;if(l[q]<<24>>24==0&&(w=cI(b,Xi(u),1,e),p[g]=w,(w|0)!=0)){var v=w;break}u=SH(k,u);p[g]=u;if((u|0)!=0){v=u;break}s=s+1|0}else{v=l[q]<<24>>24==0;do{if(v){if(m=cI(b,Xi(p[f]+8|0),1,e),p[g]=m,(m|0)!=0){v=m;break a}}else{(e|0)!=0&&(p[e>>2]=p[e>>2]+u|0)}}while(0);if((d|0)==0){v=Yi(p[k+76>>2]);p[g]=v;if((v|0)!=0){break}EI(k,t[p[f]]&255|8);v=0;break}FI(k,i);v=p[g];break}}Yj(k);f=v}}}while(0);a=h;return f}cI.X=1;function SH(b,c){var d,e=a;a+=36;var f,g=e+28,h=e+32;d=h>>2;var i=y[b+60>>2];bG(b,c,e);var j=Vc[e+24>>1],k=j<<16>>16==0;a:do{if(k){var m=0}else{var o=j&65535;if((o+(c+3)|0)>>>0<=(p[b+64>>2]+(Vc[b+18>>1]&65535)|0)>>>0){for(var r=y[i+36>>2],m=i+44|0,q=Math.floor(((r-5+p[e+16>>2]-(Vc[e+22>>1]&65535)|0)>>>0)/((r-4|0)>>>0)),r=Xi(c+o|0);;){o=q-1|0;if((q|0)==0){m=0;break a}p[g>>2]=0;p[d]=0;if(r>>>0<2){break}if(r>>>0>p[m>>2]>>>0){break}q=(o|0)==0;do{if(q){f=11}else{f=fG(i,r,h,g);if((f|0)!=0){m=f;break a}f=p[d];if((f|0)==0){f=11}else{var s=f;f=12}}}while(0);if(f==11){if(q=GI(i,r),p[d]=q,(q|0)==0){var u=0;f=14}else{s=q,f=12}}if(f==12){if((n[p[s+76>>2]+26>>1]<<16>>16|0)==1){u=s,f=14}else{aj(54507);var w=11;f=15}}f==14&&(w=HI(i,u,r));r=p[d];(r|0)!=0&&vi(p[r+76>>2]);if((w|0)!=0){m=w;break a}q=o;r=p[g>>2]}aj(54487)}m=11}}while(0);a=e;return m}SH.X=1;function FI(b,c){if((p[c>>2]|0)==0){var d=HI(p[b+60>>2],b,p[b+80>>2]);p[c>>2]=d}}function EI(b,c){var d,e=y[b+64>>2],f=y[b+60>>2],g=b+5|0,h=t[g],i=h&255,j=e+i|0;d=(f+36|0)>>2;(n[f+22>>1]&4)<<16>>16!=0&&Ed(j,0,p[d]-i|0);l[j]=c&255;var j=(c>>>1&4^12)+i|0,k=j&65535,m=i+(e+1)|0;B=0;l[m]=B&255;B>>=8;l[m+1]=B&255;B>>=8;l[m+2]=B&255;B>>=8;l[m+3]=B&255;l[i+(e+7)|0]=0;l[i+(e+5)|0]=y[d]>>>8&255;l[i+(e+6)|0]=p[d]&255;i=j&65535;n[b+14>>1]=p[d]-j&65535;mr(b,c);l[g]=h;n[b+12>>1]=k;p[b+68>>2]=e+p[d]|0;p[b+72>>2]=e+i|0;l[b+1|0]=0;n[b+18>>1]=p[f+32>>2]+65535&65535;n[b+16>>1]=0;l[b|0]=1}EI.X=1;function HI(b,c,d){var e,f,g,h,i,j,k=a;a+=12;j=k>>2;var m=k+4;i=m>>2;var o=k+8;h=o>>2;p[j]=0;var r=p[b+12>>2];if((c|0)==0){c=GI(b,d),p[i]=c}else{p[i]=c;var q=p[c+76>>2]+26|0;n[q>>1]=n[q>>1]+1&65535}q=Yi(p[r+76>>2]);p[h]=q;var s=(q|0)==0;a:do{if(s){g=(r+64|0)>>2;var u=p[g]+36|0,w=Xi(u);Zi(u,w+1|0);u=b+22|0;if((n[u>>1]&4)<<16>>16==0){f=c}else{if((c|0)==0){f=Xj(b,d,m,0);p[h]=f;if((f|0)!=0){g=f;break}e=p[i]}else{e=c}f=e>>2;var v=Yi(p[f+19]);p[h]=v;if((v|0)!=0){g=v;break}Ed(p[f+16],0,p[p[f+15]+32>>2]);f=e}if(l[b+17|0]<<24>>24!=0&&(qI(b,d,2,0,o),e=y[h],(e|0)!=0)){g=e;break}w=(w|0)==0;do{if(w){e=0}else{v=Xi(p[g]+32|0);e=Xj(b,v,k,0);p[h]=e;if((e|0)!=0){g=e;break a}var x=y[j];e=(x+64|0)>>2;var A=Xi(p[e]+4|0),E=y[b+36>>2]>>>2;if(A>>>0>(E-2|0)>>>0){aj(54392);g=p[h]=11;break a}if(A>>>0<(E-8|0)>>>0){m=Yi(p[x+76>>2]);p[h]=m;if((m|0)!=0){g=m;break a}Zi(p[e]+4|0,A+1|0);Zi((A<<2)+p[e]+8|0,d);(f|0)!=0&&(n[u>>1]&4)<<16>>16==0&&(m=p[f+76>>2],o=m+24|0,r=n[o>>1],(r&2)<<16>>16!=0&&(p[p[m+20>>2]+96>>2]|0)==0&&(n[o>>1]=r|32));var J,m=fa,m=b+60|0,o=p[m>>2];if((o|0)==0){if(b=Ko(p[b+44>>2]),p[m>>2]=b,(b|0)==0){J=7,m=5}else{var M=b,m=3}}else{M=o,m=3}m==3&&(J=p[M>>2]>>>0<d>>>0?0:ej(M,d));g=p[h]=J;break a}else{e=v}}}while(0);if((f|0)==0){u=Xj(b,d,m,0);p[h]=u;if((u|0)!=0){g=u;break}u=p[i]}else{u=f}f=Yi(p[u+76>>2]);p[h]=f;(f|0)!=0?g=f:(u=u+64|0,Zi(p[u>>2],e),Zi(p[u>>2]+4|0,0),Zi(p[g]+32|0,d),g=0)}else{g=q}}while(0);h=p[i];(h|0)!=0&&(l[h|0]=0);Yj(h);Yj(p[j]);a=k;return g}HI.X=1;function GI(b,c){var d=Uq(p[p[b>>2]+176>>2],c);return(d|0)==0?0:TF(d,c,b)}function DI(b){var c,d,e=b+60|0;NG(b,e);l[p[b+128>>2]+2|0]<<24>>24==0?(d=bh(p[(e|0)>>2]),(d|0)==0?(c=7,d=9):(e=Xm(b,0,p[(e|0)>>2],d,0),(e|0)==0?(p[b+68>>2]=d,d=2):(Lg(d),c=e,d=9))):d=2;if(d==2){c=(b+86|0)>>1;d=n[c]<<16>>16<0;a:do{if(!d){for(e=0;;){var f=(e<<2)+b+128|0;Yj(p[f>>2]);p[f>>2]=0;e=e+1|0;if((e|0)>(n[c]<<16>>16|0)){break a}}}}while(0);n[c]=-1;l[b+79|0]=2;c=0}Sm(b);return c}DI.X=1;function nH(b,c,d){var e,f,g,h,i=a;a+=16;h=i>>2;var j=i+4;g=j>>2;var k=i+8,m=i+12;f=m>>2;p[g]=0;e=(b+4|0)>>2;var o=y[e],r=(p[o+8>>2]|0)==0;do{if(r){var q=Xj(o,c,j,0);p[h]=q;if((q|0)==0){if(q=oH(b,c,0),p[h]=q,(q|0)==0){if(p[d>>2]=0,c>>>0>1){if(l[o+17|0]<<24>>24==0){q=p[g],FI(q,i),Yj(q),q=p[h]}else{q=b|0;ri(p[q>>2],p[e],4,k);var s=y[k>>2],u=p[g];if((s|0)==(c|0)){if(FI(u,i),Yj(u),u=y[h],(u|0)!=0){q=u;break}}else{Yj(u);u=Xj(o,s,m,0);p[h]=u;if((u|0)!=0){q=u;break}var u=p[f],w=nI(o,u,1,0,c,0);p[h]=w;Yj(u);if((w|0)!=0){q=w;break}p[f]=0;u=Xj(o,s,m,0);p[h]=u;u=p[f];FI(u,i);Yj(u);u=y[h];if((u|0)!=0){q=u;break}p[d>>2]=s}for(u=Math.floor((y[si>>2]>>>0)/(y[o+32>>2]>>>0))+1|0;;){var v=s-1|0;if((v|0)!=(u|0)&&(cG(o,v)|0)!=(v|0)){break}s=v}p[k>>2]=v;q=Ai(p[q>>2],p[e],4,v);p[h]=q}}else{q=p[g],EI(q,9),Yj(q),q=0}}else{Yj(p[g])}}}else{q=262}}while(0);a=i;return q}nH.X=1;function XH(b,c){var d,e,f,g=a;a+=8;f=g>>2;var h=p[c+68>>2],i=h|0,j=(p[i>>2]|0)==0;do{if(j){e=0}else{if(e=WH(c),(e|0)==0){var k=h+32|0;e=k>>2;var m=p[e];if((m|0)==0){k=ZH(p[b>>2],k);if((k|0)!=0){e=k;break}m=p[e]}var k=h+16|0,o=p[k+4>>2];p[f]=p[k>>2];p[f+1]=o;o=h+36|0;p[o>>2]=p[o>>2]+1|0;var o=p[i>>2],o=$H(m,o,(o|0)<0?-1:0,g),m=h+40|0,r=p[m>>2],q=(o|0)==0,s=(r|0)==0|q^1;a:do{if(s){var u=o,w=r,v=q}else{for(var x=r;;){var A=p[x+8>>2],E=p[e];d=(x+4|0)>>2;var J=p[d],E=$H(E,J,(J|0)<0?-1:0,g);if((E|0)==0){var J=p[f],M=p[f+1],E=Ei(p[e],p[x>>2],p[d],J,M);d=p[d];d=(T.add(J,M,d,(d|0)<0?-1:0),T.result[0]);J=T.result[1];p[f]=d;p[f+1]=J}d=E;vf(b,x);x=(d|0)==0;if((A|0)==0|x^1){u=d;w=A;v=x;break a}x=A}}}while(0);o=p[f];r=p[f+1];p[(k|0)>>2]=o;p[(k+4|0)>>2]=r;e=v?Ei(p[e],II|0,8,o,r):u;p[m>>2]=w}}}while(0);a=g;return e}XH.X=1;function WH(b){var c,d=a;a+=4;c=d>>2;var e=p[b+68>>2],f=qo(256);if((f|0)==0){b=7}else{var e=e+40|0,g=p[e>>2];p[c]=g;var h=(g|0)==0;a:do{if(!h){for(var i=g;;){var j=i+8|0,k=p[j>>2];p[j>>2]=0;var j=p[f>>2],m=(j|0)==0;b:do{if(m){var o=f,r=i}else{for(var q=0,s=f,u=j,w=i;;){if(JI(b,w,u,d),p[s>>2]=0,q=q+1|0,s=(q<<2)+f|0,u=p[s>>2],w=p[c],(u|0)==0){o=s;r=w;break b}}}}while(0);p[o>>2]=r;p[c]=k;if((k|0)==0){break a}i=k}}}while(0);for(r=o=p[c]=0;;){JI(b,r,p[f+(o<<2)>>2],d);var o=o+1|0,v=p[c];if((o|0)==64){break}r=v}p[e>>2]=v;Lg(f);b=0}a=d;return b}WH.X=1;function ZH(b,c){var d=a;a+=4;var e=JJ(b,0,c,4126,d);a=d;return e}function $H(b,c,d,e){e>>=2;var f=a;a+=12;var g=f|0,c=IH(g,c,d),b=Ei(b,g,c,p[e],p[e+1]),c=(T.add(p[e],p[e+1],c,(c|0)<0?-1:0),T.result[0]),d=T.result[1];p[e]=c;p[e+1]=d;a=f;return b}function IH(b,c,d){var e=a;a+=12;var f=d>>>0>16777215||d>>>0==16777215&&c>>>0>4294967295;a:do{if(f){l[b+8|0]=c&255;l[b+7|0]=(c>>>8|d<<24|128)&255;l[b+6|0]=(c>>>15|d<<17|128)&255;l[b+5|0]=(c>>>22|d<<10|128)&255;l[b+4|0]=(c>>>29|d<<3|128)&255;l[b+3|0]=(d>>>4|128)&255;l[b+2|0]=(d>>>11|128)&255;l[b+1|0]=(d>>>18|128)&255;l[b]=(d>>>25|128)&255;var g=9}else{for(var h=0,i=d,j=c;;){var k=h+1|0;l[e+h|0]=(j|128)&255;j=j>>>7|i<<25;i=i>>>7|0;if(j==0&&i==0){break}h=k}l[e|0]&=127;if((h|0)>-1){for(i=0;;){l[b+i|0]=l[e+h|0];if((h|0)<=0){g=k;break a}h=h-1|0;i=i+1|0}}else{g=k}}}while(0);a=e;return g}IH.X=1;function hH(b,c){var d=p[b+12>>2];if((d|0)==0){d=b+40|0,p[c>>2]=p[p[d>>2]+4>>2],d=p[d>>2]|0}else{var d=p[d+4>>2],e=p[b+8>>2];p[c>>2]=p[(e+28>>2)+(d*9|0)];d=e+d*36+32|0}return p[d>>2]}function JJ(b,c,d,e,f){var g=qo(p[b+4>>2]);(g|0)==0?d=7:(b=Wp(b,c,g,e,f),(b|0)==0?(p[d>>2]=g,d=0):(Lg(g),d=b));return d}function JI(b,c,d,e){var f=a;a+=8;var g=f+4;p[f>>2]=0;if((d|0)==0){var h=0,i=0}else{h=p[d>>2],i=d}var d=b+8|0,b=b+68|0,j=c,c=i,k=f;a:for(;;){i=c+4|0;if((c|0)==0){var m=k,o=j;break}for(;;){if((j|0)==0){m=k;o=c;break a}iH(p[d>>2],p[p[b>>2]+52>>2],0,p[j>>2],p[j+4>>2],h,p[i>>2],g);if((p[g>>2]|0)>=1){break}p[k>>2]=j;k=j+8|0;h=0;j=p[k>>2]}p[k>>2]=c;i=c+8|0;c=p[i>>2];if((c|0)==0){m=i;o=j;break}h=p[c>>2];k=i}p[m>>2]=o;p[e>>2]=p[f>>2];a=f}JI.X=1;function iH(b,c,d,e,f,g,h,i){(g|0)!=0&&WF(b,h,g,c);d=(d|0)==0;a:do{if(!d){g=Vc[b+6>>1];n[c+4>>1]=g;g&=65535;for(var h=c+16|0,j=0;;){if((j|0)>=(g|0)){break}if((n[(p[h>>2]+28>>1)+(j*20|0)]&1)<<16>>16!=0){var k=-1,g=10;break a}j=j+1|0}l[c+6|0]|=2}g=9}while(0);g==9&&(k=aG(f,e,c));p[i>>2]=k}function aI(b,c){var d,e,f,g=a;a+=4;f=g>>2;p[f]=0;e=c+8|0;var h=p[e>>2],i=p[e+4>>2];e=(c|0)>>2;var j=p[e],k=p[e+1],h=(T.b(h,i,j,k),T.result[0]),i=T.result[1],h=(i|0)>0||(i|0)==0&&h>>>0>5?5:h,i=(h|0)<1;a:do{if(i){d=c,vf(b,p[d+24>>2]),Ed(d,0,36),d=0}else{var m=c+16|0,o=p[m>>2];d=(c+24|0)>>2;var o=Tp(o,p[d],h,j,k),r=(o|0)==0;do{if(r){var q=y[d],s=t[q];s<<24>>24>-1?(q=s&255,p[f]=q,s=1):(s=XF(q,g)&255,q=p[f]);var u=q+s|0;if((u|0)>(h|0)){var w=c+20|0,v=p[w>>2];if((u|0)>(v|0)){for(;;){var x=v<<1;if((u|0)<=(x|0)){break}v=x}u=Gl(b,p[d],x);p[d]=u;if((u|0)==0){d=7;break a}p[w>>2]=x;v=u}else{v=p[d]}var w=s-h+q|0,u=p[m>>2],v=v+h|0,A=(T.add(p[e],p[e+1],h,(h|0)<0?-1:0),T.result[0]),w=Tp(u,v,w,A,T.result[1])}else{w=o}}else{s=0,w=o,q=0}}while(0);m=q+s|0;m=(T.add(m,(m|0)<0?-1:0,p[e],p[e+1]),T.result[0]);o=T.result[1];p[e]=m;p[e+1]=o;p[c+28>>2]=q;p[c+32>>2]=p[d]+s|0;d=w}}while(0);a=g;return d}aI.X=1;function bI(b,c){var d,e,f=a;a+=4;e=p[b+68>>2]>>2;var g=(p[e+1]|0)/2&-1;if((g|0)>(c|0)){d=c<<1;var h=p[e+3],g=p[h+((d|1)<<2)>>2],h=p[h+(d<<2)>>2]}else{d=c-g<<1,g=d|1,h=d}d=p[e+2]>>2;(p[d+(h*9|0)+4]|0)!=0&&((p[d+(g*9|0)+4]|0)==0?g=h:(iH(p[b+8>>2],p[e+13],0,p[d+(h*9|0)+8],p[d+(h*9|0)+7],p[d+(g*9|0)+8],p[d+(g*9|0)+7],f),g=(p[f>>2]|0)<1?h:g));p[((c<<2)+p[e+3]|0)>>2]=g;a=f}bI.X=1;function NH(b,c){var d=(c|0)==0;a:do{if(!d){for(var e=c;;){var f=p[e+8>>2];vf(b,e);if((f|0)==0){break a}e=f}}}while(0)}function YH(b,c,d){var e=a;a+=8;var f,g=p[c+68>>2];p[(e|0)>>2]=0;p[(e+4|0)>>2]=0;for(var h=g+16|0,i=g+8|0,j=g+24|0,k=0,m=0;;){if((k|0)>=16){var o=m;f=6;break}var m=p[i>>2],r,q=b,s=g,u=p[j>>2],w=p[j+4>>2],v=m+k*36|0,x=e;r=a;a+=8;var A=s+32|0;p[v+16>>2]=p[A>>2];var s=v|0,E=s|0;p[E>>2]=u;E=s+4|0;p[E>>2]=w;p[v+20>>2]=128;w=zh(q,128);p[v+24>>2]=w;if((w|0)==0){q=7}else{u=p[A>>2];E=r;w=s>>2;A=a;a+=12;var J=A|0,u=Tp(u,J,9,p[w],p[w+1]);(u|0)==0&&(E=ZF(J,E)&255,E=(T.add(p[w],p[w+1],E,0),T.result[0]),J=T.result[1],p[w]=E,p[w+1]=J);a=A;w=u;A=p[r>>2];u=p[r+4>>2];E=x|0;J=p[E>>2];E=x+4|0;E=(T.add(J,p[E>>2],A,u),T.result[0]);J=T.result[1];p[x>>2]=E;p[x+4>>2]=J;x=(T.add(A,u,p[s>>2],p[s+4>>2]),T.result[0]);s=T.result[1];A=v+8|0;p[A>>2]=x;p[A+4>>2]=s;q=(w|0)!=0?w:aI(q,v)}a=r;r=q;q=m+k*36+8|0;m=p[q>>2];q=p[q+4>>2];p[(j|0)>>2]=m;p[(j+4|0)>>2]=q;if((r|0)!=0){var M=r;f=8;break}v=p[h+4>>2];if(!((q|0)<(v|0)||(q|0)==(v|0)&&m>>>0<p[h>>2]>>>0)){o=0;f=6;break}k=k+1|0;m=r}a:do{if(f==6){if(b=p[g+4>>2]-1|0,(o|0)==0&(b|0)>0){for(;;){if(bI(c,b),b=b-1|0,(b|0)<=0){M=0;break a}}}else{M=o}}}while(0);c=p[e>>2];f=p[e+4>>2];p[(d|0)>>2]=c;p[(d+4|0)>>2]=f;a=e;return M}YH.X=1;function MH(b){Yp(b);Lg(b)}function TH(b,c,d,e){var f=(p[e>>2]|0)==0;a:do{if(f){var g=y[b+64>>2],h=c<<1,i=b+72|0,j=y[i>>2],k=j+h|0,j=(t[k]&255)<<8|t[j+(h|1)|0]&255,h=t[b+5|0]&255,m=j>>>0<((t[h+(g+5)|0]&255)<<8|t[h+(g+6)|0]&255)>>>0;do{if(!m&&(j+d|0)>>>0<=y[p[b+60>>2]+36>>2]>>>0){c=cK(b,j,d);if((c|0)==0){e=(b+16|0)>>1;c=Vc[e];i=p[i>>2]+(((c&65535)<<1)-2)|0;if(k>>>0<i>>>0){for(;;){c=k+2|0;n[k>>1]=n[c>>1];if(c>>>0>=i>>>0){break}k=c}k=n[e]}else{k=c}k=k-1&65535;n[e]=k;l[h+(g+3)|0]=(k&65535)>>>8&255;l[h+(g+4)|0]=n[e]&255;b=b+14|0;n[b>>1]=n[b>>1]+2&65535;break a}p[e>>2]=c;break a}}while(0);aj(54712);p[e>>2]=11}}while(0)}TH.X=1;function PH(b){var c=b+80|0;(p[c>>2]|0)==0&&(b=Fp(p[b+32>>2]),p[c>>2]=b)}function UH(b,c,d,e,f,g,h){var i,j,k=a;a+=4;j=k>>2;p[j]=0;var m=(g|0)!=0,o=m?4:0,r=(p[h>>2]|0)==0;a:do{if(r){var q=b+1|0,s=l[q]<<24>>24==0;do{if(s){var u=e+2|0;i=(b+14|0)>>1;if((u|0)<=(Vc[i]&65535|0)){f=Yi(p[b+76>>2]);if((f|0)!=0){p[h>>2]=f;break a}r=y[b+64>>2];s=Vc[b+12>>1]&65535;f=(b+16|0)>>1;q=((Vc[f]&65535)<<1)+s|0;c=(c<<1)+s|0;s=PK(b,e,k);if((s|0)==0){n[f]=n[f]+1&65535;n[i]=(Vc[i]&65535)-u&65535;i=y[j];Ah(r+i+o|0,d+o|0,e-o|0);m&&Zi(r+i|0,g);e=r+c|0;if((q|0)>(c|0)){for(g=r+q|0;;){m=g-2|0;n[g>>1]=n[m>>1];if(m>>>0<=e>>>0){break}g=m}j=p[j]}else{j=i}l[e]=j>>>8&255;l[c+(r+1)|0]=j&255;j=b+5|0;l[r+(t[j]&255)+3|0]=(Vc[f]&65535)>>>8&255;l[r+(t[j]&255)+4|0]=n[f]&255;if(l[p[b+60>>2]+17|0]<<24>>24==0){break a}tI(b,d,h);break a}p[h>>2]=s;break a}}}while(0);(f|0)==0?i=d:(Ah(f+o|0,d+o|0,e-o|0),i=f);m&&Zi(i,g);u=t[q];l[q]=u+1&255;u&=255;p[b+(u<<3)+20>>2]=i;n[b+(u<<3)+24>>1]=c&65535}}while(0);a=k}UH.X=1;function VH(b){var c,d,e=a;a+=16;var f=b+4|0,g=Math.floor((p[p[f>>2]+36>>2]<<1>>>0)/3);d=(b+86|0)>>1;var h=b+132|0,i=b+88|0,j=b+90|0,k=e|0,m=0,o=n[d];a:for(;;){for(;;){var r=o<<16>>16,q=y[b+(r<<2)+128>>2];c=q>>1;var s=q+1|0,u=l[s]<<24>>24==0;if(o<<16>>16!=0){break}if(u){var w=m,v=0;break a}o=ML(q,h);if((o|0)!=0){w=m;v=o;break a}n[d]=1;n[i>>1]=0;n[j>>1]=0;o=1}if(u&&(Vc[c+7]&65535)>>>0<=g>>>0){w=m;v=0;break}var x=r-1|0,A=y[b+(x<<2)+128>>2],x=Vc[b+(x<<1)+88>>1],E=x&65535,J=Yi(p[A+76>>2]),M=(J|0)==0;b:do{if(M){var D=l[q+4|0]<<24>>24==0;do{if(!D&&l[s]<<24>>24==1&&n[c+12]<<16>>16==n[c+8]<<16>>16&&(p[A+80>>2]|0)!=1&&n[A+16>>1]<<16>>16==x<<16>>16){var o=SM(A,q,k),D=m,K=o;break b}}while(0);D=Fp(p[p[f>>2]+32>>2]);K=bN(A,E,D,o<<16>>16==1&1);(m|0)!=0&&ip(m)}else{D=m,K=J}}while(0);l[s]=0;Yj(q);o=n[d]-1&65535;n[d]=o;if((K|0)!=0){w=D;v=K;break}m=D}(w|0)!=0&&ip(w);a=e;return v}VH.X=1;function ML(b,c){var d,e,f=a;a+=12;e=f>>2;var g=f+4,h=f+8;d=h>>2;p[g>>2]=0;p[d]=0;var i=p[b+60>>2],j=Yi(p[b+76>>2]);p[e]=j;if((j|0)==0){if(j=b+80|0,h=mI(i,g,h,p[j>>2],0),p[e]=h,g=y[g>>2],kN(b,g,f),l[i+17|0]<<24>>24!=0&&qI(i,p[d],5,p[j>>2],f),e=p[e],(e|0)!=0){var k=g,m=e;d=5}else{var o=b+1|0;Ah(g+20|0,b+20|0,(t[o]&255)<<3);l[g+1|0]=l[o];EI(b,t[p[g+64>>2]]&247);Zi(p[b+64>>2]+(t[b+5|0]&255)+8|0,p[d]);p[c>>2]=g;o=0;d=7}}else{k=0,m=j,d=5}d==5&&(p[c>>2]=0,Yj(k),o=m);a=f;return o}ML.X=1;function SM(b,c,d){var e,f=a;a+=20;var g=f+4,h=f+8,i=f+12;e=i>>2;var j=f+16,k=p[c+60>>2],m=c+16|0,o=n[m>>1]<<16>>16==0;do{if(o){aj(54928);var r=11}else{if(r=mI(k,f,h,0,0),p[g>>2]=r,(r|0)==0){var r=d+4|0,q=p[c+20>>2];p[e]=q;q=RH(c,q);n[j>>1]=q;q=y[f>>2];EI(q,13);oO(q,1,i,j);l[k+17|0]<<24>>24!=0&&(qI(k,p[h>>2],5,p[b+80>>2],g),(Vc[j>>1]&65535)>(Vc[q+10>>1]&65535)&&tI(q,p[e],g));var q=p[c+64>>2],s=(Vc[m>>1]&65535)<<1,u=y[c+72>>2],u=((t[u+(s-2)|0]&255)<<8|t[u+(s-1)|0]&255)&Vc[c+18>>1]&65535,s=q+u|0;p[e]=s;for(q=u+(q+9)|0;;){var w=s+1|0;if(!(l[s]<<24>>24<0&w>>>0<q>>>0)){break}s=w}p[e]=w;q=s+10|0;for(s=w;;){p[e]=s+1|0;var s=l[s],v=r+1|0;l[r]=s;u=y[e];if(!(s<<24>>24<0&u>>>0<q>>>0)){break}r=v;s=u}UH(b,Vc[b+16>>1]&65535,d,v-d|0,0,p[c+80>>2],g);Zi(p[b+64>>2]+(t[b+5|0]&255)+8|0,p[h>>2]);Yj(p[f>>2]);r=p[g>>2]}}}while(0);a=f;return r}SM.X=1;function bN(b,c,d,e){var f,g,h,i,j,k,m,o,r,q,s,u,w,v,x=a;a+=132;var A;v=x>>2;var E=x+4;w=E>>2;u=x+16>>2;var J=x+28;s=J>>2;var M=x+48,D=x+56;q=D>>2;var K=x+76;r=K>>2;var H=x+96;o=H>>2;var N=x+100,Q=x+104;p[v]=0;var P=y[b+60>>2];if((d|0)==0){var L=7}else{var I=b+1|0,X=t[I]&255,Y=b+16|0,da=Vc[Y>>1]&65535,ga=da+X|0;if((ga|0)<2){var ha=ga+1|0,ba=ga,ea=0}else{(c|0)==0?(ha=3,ba=2,ea=0):(ga|0)==(c|0)?(ha=3,ba=2,ea=ga-2|0):(ha=3,ba=2,ea=c-1|0)}var ja=ba+ea-X|0;if((ja|0)==(da|0)){var ra=p[b+64>>2]+(t[b+5|0]&255)+8|0,Va=b+18|0,ta=b+72|0}else{var xa=b+18|0,Fa=ja<<1,Na=b+72|0,Ea=y[Na>>2],ra=p[b+64>>2]+(((t[Ea+Fa|0]&255)<<8|t[Ea+(Fa|1)|0]&255)&Vc[xa>>1]&65535)|0,Va=xa,ta=Na}var La=Xi(ra);p[o]=La;var za=b+24|0,Ba=b+20|0;m=(b+64|0)>>2;for(var Ja=P+22|0,ka=P+36|0,S=1,ib=ba,Wa=La;;){var Za=(ib<<2)+E|0,Sa=SF(P,Wa,Za);p[v]=Sa;if((Sa|0)!=0){Ed(E,0,(ib<<2)+4|0);var tb=0,pb=0;A=117;break}var fb=y[Za>>2],Xa=S+(Vc[fb+16>>1]&65535)+(t[fb+1|0]&255)|0,Ab=ib-1|0;if((ib|0)==0){A=24;break}var rb=Ab+ea|0,cb=t[I];if((rb|0)==(Vc[za>>1]&65535|0)){if(cb<<24>>24==0){var Cb=0;A=18}else{var Zb=p[Ba>>2];p[M+(Ab<<2)>>2]=Zb;var dc=Xi(Zb);p[o]=dc;var kb=RH(b,Zb)&65535;p[(Ab<<2>>2)+r]=kb;l[I]=0;var Oa=dc;A=23}}else{Cb=cb,A=18}if(A==18){var Db=rb-(Cb&255)<<1,Wb=y[ta>>2],Nb=p[m]+(((t[Wb+Db|0]&255)<<8|t[Wb+(Db|1)|0]&255)&Vc[Va>>1]&65535)|0,$b=(Ab<<2)+M|0;p[$b>>2]=Nb;var Rb=Xi(Nb);p[o]=Rb;var Ra=RH(b,Nb)&65535;p[(Ab<<2>>2)+r]=Ra;if((n[Ja>>1]&4)<<16>>16!=0){var Ob=Nb,Ua=Ob-p[m]|0;if((Ua+Ra|0)>(p[ka>>2]|0)){aj(55260);p[v]=11;Ed(E,0,ib<<2);pb=tb=0;A=117;break}Ah(d+Ua|0,Nb,Ra);p[$b>>2]=d+(Ob-p[m])|0}TH(b,rb-(t[I]&255)|0,Ra,x);Oa=Rb}S=Xa+1|0;ib=Ab;Wa=Oa}a:do{if(A==24){var Jb=Xa+3&-4;k=(P+32|0)>>2;var Vb=p[k],Pb=Vb+88|0,sb=Io(Vb+Jb*6+Pb*ha|0),db=sb;j=db>>2;if((sb|0)==0){p[v]=7,tb=0,pb=db}else{var wb=(Jb<<2)+db|0;i=wb>>1;var ob=(Jb<<1)+wb|0;h=ob>>1;for(var Kb=y[w],ub=t[Kb+3|0],Xb=(ub&255)<<2,Sb=t[Kb+4|0],Qb=ha-1|0,ac=Sb<<24>>24==0,Gb=Xb&65535,xb=0,Ta=0,qb=0,bc=Kb;;){var $a=p[k]+Ta*Pb|0;g=$a>>1;var mb=ob+$a|0,Bb=mb;p[(Ta<<2>>2)+u]=Bb;Ah(mb,bc|0,84);var bb=$a+84|0,jb=ob+bb|0,nb=$a+(ob+64)|0;p[nb>>2]=jb;Ah(jb,p[bc+64>>2],p[k]);var zb=Vc[g+(h+8)]&65535,Tb=t[$a+(ob+1)|0],ec=Tb&255,Hb=Tb<<24>>24==0,Eb=(ec+zb|0)>0;b:do{if(Hb){if(Eb){for(var Lb=Vc[g+(h+9)]&65535,gb=Vc[g+(h+6)]&65535,Mb=qb+zb|0,vc=0,hc=qb;;){var kc=(vc<<1)+gb|0,pc=ob+bb+(((t[ob+bb+kc|0]&255)<<8|t[kc+(bb+(ob+1))|0]&255)&Lb)|0;p[((hc<<2)+db|0)>>2]=pc;var jc=RH(Bb,pc);n[(hc<<1>>1)+i]=jc;var mc=hc+1|0;if((mc|0)==(Mb|0)){Fb=Mb;break b}vc=vc+1|0;hc=mc}}else{var Fb=qb}}else{if(Eb){for(var Ub=qb+ec+zb|0,Ya=0,Pa=qb;;){var yb,Ka=t[Bb+1|0]&255,Ac=Ya;c:for(;;){for(var Jc=Ka;;){var uc=Jc-1|0;if((Jc|0)<=0){var Tc=Ac<<1,Yc=y[Bb+72>>2],ua=p[Bb+64>>2]+(((t[Yc+Tc|0]&255)<<8|t[Yc+(Tc|1)|0]&255)&Vc[Bb+18>>1]&65535)|0;break c}var md=Vc[Bb+(uc<<3)+24>>1]&65535;if((md|0)>(Ac|0)){Jc=uc}else{if((md|0)==(Ac|0)){ua=p[Bb+(uc<<3)+20>>2];break c}Ka=uc;Ac=Ac-1|0;continue c}}}yb=ua;p[((Pa<<2)+db|0)>>2]=yb;var nd=RH(Bb,yb);n[(Pa<<1>>1)+i]=nd;var Bc=Pa+1|0;if((Bc|0)==(Ub|0)){Fb=Ub;break b}Ya=Ya+1|0;Pa=Bc}}else{Fb=qb}}}while(0);if((Ta|0)<(Qb|0)&ac){var Qc=p[(Ta<<2>>2)+r];f=((Fb<<1)+wb|0)>>1;n[f]=Qc&65535;var Oc=Qc&65535,ed=Oc+xb|0;Ah(ob+xb|0,p[M+(Ta<<2)>>2],Oc);var Fc=(Fb<<2)+db|0;p[Fc>>2]=ob+xb+Gb|0;var ud=n[f]-Xb&65535;n[f]=ud;if(l[$a+(ob+3)|0]<<24>>24==0){var Rc=p[nb>>2]+8|0,Yb=p[Fc>>2];B=t[Rc]|t[Rc+1]<<8|t[Rc+2]<<16|t[Rc+3]<<24|0;l[Yb]=B&255;B>>=8;l[Yb+1]=B&255;B>>=8;l[Yb+2]=B&255;B>>=8;l[Yb+3]=B&255}else{(ud&65535)<4&&(n[f]=4)}var W=Fb+1|0,bd=ed}else{W=Fb,bd=xb}var hd=Ta+1|0;if((hd|0)>=(ha|0)){break}var eb=p[(hd<<2>>2)+w],xb=bd,Ta=hd,qb=W,bc=eb}for(var Uc=Sb&255,cd=Gb-12+p[ka>>2]|0,vd=(Sb<<24>>24!=0)<<31>>31,id=0,Zc=0,td=0;;){if((id|0)>=(W|0)){break}var zd=td+2|0,Id=zd+(Vc[(id<<1>>1)+i]&65535)|0,xc=(Id|0)>(cd|0);do{if(xc){p[(Zc<<2>>2)+r]=zd;p[(Zc<<2>>2)+q]=id;var qc=Zc+1|0;if((qc|0)<=4){var Gc=id+vd|0,Hc=qc,zc=0;break}aj(55399);p[v]=11;tb=0;pb=db;break a}Gc=id;Hc=Zc;zc=Id}while(0);id=Gc+1|0;Zc=Hc;td=zc}p[(Zc<<2>>2)+r]=td;p[(Zc<<2>>2)+q]=W;var Kc=Zc+1|0,wd=(Zc|0)>0;b:do{if(wd){for(var be=Zc,ge=td;;){for(var Xd=(be<<2)+K|0,rc=be-1|0,Lc=(rc<<2)+K|0,Jd=(rc<<2)+D|0,Qd=p[Jd>>2],Fd=p[Lc>>2],Cd=ge;;){var ce=Qd-1|0,Yd=Vc[(Qd-Uc<<1>>1)+i];if((Cd|0)==0){var Mc=n[(ce<<1>>1)+i],jd=2,gc=Fd-2|0,fd=Yd&65535}else{var Sd=Yd&65535,$c=Cd+2|0,Ad=Vc[(ce<<1>>1)+i],Xe=Fd-2|0;if(($c+Sd|0)>(Xe-(Ad&65535)|0)){break}Mc=Ad;jd=$c;gc=Xe;fd=Sd}Qd=p[Jd>>2]=ce;Fd=gc-(Mc&65535)|0;Cd=jd+fd|0}p[Xd>>2]=Cd;p[Lc>>2]=Fd;if((rc|0)<=0){break b}be=rc;ge=Fd}}}while(0);if(y[Kb+80>>2]>>>0<2){aj(55459),p[v]=11,tb=0,pb=db}else{for(var ef=t[p[Kb+64>>2]]&255,oe=P+17|0,wf=b+80|0,Kd=0,ue=0;;){if((ue|0)>=(Kc|0)){var xf=ue;break}var Ge=(ue|0)<(ha|0);do{if(Ge){var yf=(ue<<2)+E|0,Re=p[yf>>2];p[(ue<<2>>2)+s]=Re;p[N>>2]=Re;p[yf>>2]=0;var Se=Yi(p[Re+76>>2]);p[v]=Se;var tc=Kd+1|0;if((Se|0)!=0){tb=tc;pb=db;break a}var ff=tc}else{var he=mI(P,N,H,p[o],0);p[v]=he;if((he|0)!=0){tb=Kd;pb=db;break a}var je=p[N>>2];p[(ue<<2>>2)+s]=je;var de=Kd+1|0;if(l[oe]<<24>>24!=0&&(qI(P,p[je+80>>2],5,p[wf>>2],x),(p[v]|0)!=0)){tb=de;pb=db;break a}ff=de}}while(0);Kd=ff;ue=ue+1|0}for(;;){if((xf|0)>=(ha|0)){break}var Me=(xf<<2)+E|0,od=p[Me>>2];FI(od,x);if((p[v]|0)!=0){tb=Kd;pb=db;break a}Yj(od);p[Me>>2]=0;xf=xf+1|0}b:do{if(wd){for(var ke=0;;){var Zd=(ke<<2)+J|0,le=ke+1|0,ye=(le|0)<(Kc|0);do{if(ye){for(var zf=y[Zd>>2],Ye=p[zf+80>>2],Ze=ke,Ae=le;;){var Sf=y[p[(Ae<<2>>2)+s]+80>>2],cg=Sf>>>0<Ye>>>0,If=cg?Ae:Ze,Jf=Ae+1|0;if((Jf|0)==(Kc|0)){break}Ye=cg?Sf:Ye;Ze=If;Ae=Jf}if((If|0)>(ke|0)){var Cg=(If<<2)+J|0;p[Zd>>2]=p[Cg>>2];p[Cg>>2]=zf}}}while(0);if((le|0)==(Zc|0)){break b}ke=le}}}while(0);var Kf=y[(Kd-1<<2>>2)+s];Zi(ra,p[Kf+80>>2]);for(var Sg=Q|0,Lf=0,Te=0,gf=ea,sg=0;;){if((Lf|0)>=(Kd|0)){break}var Mf=y[(Lf<<2>>2)+s];EI(Mf,ef);var He=y[(Lf<<2>>2)+q];oO(Mf,He-Te|0,(Te<<2)+db|0,(Te<<1)+wb|0);if((He|0)<(W|0)){var $e=y[(He<<2>>2)+j],Ne=Vc[(He<<1>>1)+i],Ue=(Ne&65535)+Gb|0,hf=d+sg|0;if(l[Mf+3|0]<<24>>24==0){var Dg=$e,me=p[Mf+64>>2]+8|0;B=t[Dg]|t[Dg+1]<<8|t[Dg+2]<<16|t[Dg+3]<<24|0;l[me]=B&255;B>>=8;l[me+1]=B&255;B>>=8;l[me+2]=B&255;B>>=8;l[me+3]=B&255;var jf=He,$d=Ue,Nf=hf,Eg=$e}else{if(ac){var tg=$e-4|0;if(Ne<<16>>16!=4){jf=He,$d=Ue}else{var dg=RH(b,tg),jf=He,$d=dg&65535}Nf=hf;Eg=tg}else{var eg=He-1|0;bG(Mf,p[(eg<<2>>2)+j],Q);var Af=IH(sg+(d+4)|0,p[Sg>>2],p[Sg+4>>2]),jf=eg,$d=Af+4|0,Nf=0,Eg=hf}}UH(b,gf,Eg,$d,Nf,p[Mf+80>>2],x);if((p[v]|0)!=0){tb=Kd;pb=db;break a}var Md=jf+1|0,Tf=gf+1|0,Tg=$d+sg|0}else{Md=He,Tf=gf,Tg=sg}Lf=Lf+1|0;Te=Md;gf=Tf;sg=Tg}if((ef&8|0)==0){var Of=p[p[(Qb<<2>>2)+u]+64>>2]+8|0,Uf=p[Kf+64>>2]+8|0;B=t[Of]|t[Of+1]<<8|t[Of+2]<<16|t[Of+3]<<24|0;l[Uf]=B&255;B>>=8;l[Uf+1]=B&255;B>>=8;l[Uf+2]=B&255;B>>=8;l[Uf+3]=B&255}var kf=(e|0)==0;do{if(!kf&&n[Y>>1]<<16>>16==0){var Vf=y[s];if((t[b+5|0]&255)>>>0<=(Vc[Vf+14>>1]&65535)>>>0){kN(Vf,b,x);FI(Vf,x);tb=Kd;pb=db;break a}}}while(0);if(l[oe]<<24>>24==0){tb=Kd,pb=db}else{var af=y[u],Ug=t[af+1|0],ug=Ug&255,ie=Ug<<24>>24==0?-1:Vc[af+24>>1]&65535;if((W|0)>0){for(var lf=ac&1,mh=ub<<24>>24==0,Fg=p[s],fg=0,gg=0,Ie=0,Pf=af,Vg=ug,hg=(Vc[af+16>>1]&65535)+ug|0,Gg=ie;;){var ig=Ie+lf|0,jg=0,Wf=Gg,vg=hg,kg=Vg,lg=Pf,Bf=gg;b:for(;;){for(var bf=jg,Xf=vg,mf=lg,Eh=Bf;;){if((Ie|0)!=(Xf|0)){break b}var wg=Eh+1|0,Cf=y[(wg<<2>>2)+u],mg=t[Cf+1|0],Qf=mg&255,ci=(Vc[Cf+16>>1]&65535)+ig+Qf|0;if(mg<<24>>24!=0){break}bf=lf;Xf=ci;mf=Cf;Eh=wg}jg=lf;Wf=(Vc[Cf+24>>1]&65535)+ig|0;vg=ci;kg=Qf;lg=Cf;Bf=wg}if((Ie|0)==(Wf|0)){var di=kg-1|0,Fh=1,Gh=((di|0)>0&1)+Wf|0,nh=di}else{Fh=bf,Gh=Wf,nh=kg}if((Ie|0)==(p[(fg<<2>>2)+q]|0)){var nf=fg+1|0,Wg=y[(nf<<2>>2)+s];if(ac){var Hh=nf,Xg=Wg;A=114}else{var xg=nf,Yf=Wg;A=108}}else{xg=fg,Yf=Fg,A=108}do{if(A==108){if((Fh|0)==0){if((p[mf+80>>2]|0)==(p[Yf+80>>2]|0)){Hh=xg;Xg=Yf;break}}else{A=110}mh&&qI(P,Xi(p[(Ie<<2>>2)+j]),5,p[Yf+80>>2],x);(Vc[(Ie<<1>>1)+i]&65535)>(Vc[Yf+10>>1]&65535)&&tI(Yf,p[(Ie<<2>>2)+j],x);Hh=xg;Xg=Yf}}while(0);var Hg=Ie+1|0;if((Hg|0)==(W|0)){break}Fg=Xg;fg=Hh;gg=Eh;Ie=Hg;Pf=mf;Vg=nh;hg=Xf;Gg=Gh}if(!(mh&(Kd|0)>0)){tb=Kd;pb=db;break}var Yg=0}else{if(!(ub<<24>>24==0&(Kd|0)>0)){tb=Kd;pb=db;break}Yg=0}for(;;){var ei=p[(Yg<<2>>2)+s];qI(P,Xi(p[ei+64>>2]+8|0),5,p[ei+80>>2],x);var fi=Yg+1|0;if((fi|0)==(Kd|0)){tb=Kd;pb=db;break a}Yg=fi}}}}}}while(0);Jo(pb);for(var Ui=0;;){Yj(p[(Ui<<2>>2)+w]);var zj=Ui+1|0;if((zj|0)>=(ha|0)){break}Ui=zj}var Aj=(tb|0)>0;a:do{if(Aj){for(var Vi=0;;){Yj(p[(Vi<<2>>2)+s]);var wi=Vi+1|0;if((wi|0)==(tb|0)){break a}Vi=wi}}}while(0);L=p[v]}a=x;return L}bN.X=1;function oO(b,c,d,e){var f=y[b+64>>2],g=t[b+5|0]&255,h=y[p[b+60>>2]+36>>2],i=c<<1,j=(c|0)>0;a:do{if(j){for(var k=p[b+72>>2]+i|0,m=h,o=c;;){var o=o-1|0,r=k-2|0,q=Vc[e+(o<<1)>>1]&65535,m=m-q|0;l[r]=m>>>8&255;l[k-1|0]=m&255;Ah(f+m|0,p[d+(o<<2)>>2],q);if((o|0)<=0){var s=m;break a}k=r}}else{s=h}}while(0);l[g+(f+3)|0]=c>>>8&255;l[g+(f+4)|0]=c&255;l[g+(f+5)|0]=s>>>8&255;l[g+(f+6)|0]=s&255;d=b+14|0;n[d>>1]=s-(h+i)+(Vc[d>>1]&65535)&65535;n[b+16>>1]=c&65535}oO.X=1;function kN(b,c,d){if((p[d>>2]|0)==0){var e=y[b+60>>2],f=y[b+64>>2],g=p[c+64>>2],h=t[b+5|0]&255,i=(p[c+80>>2]|0)==1?100:0,j=(t[h+(f+5)|0]&255)<<8|t[h+(f+6)|0]&255;Ah(g+j|0,f+j|0,p[e+36>>2]-j|0);Ah(g+i|0,f+h|0,((Vc[b+16>>1]&65535)<<1)+(Vc[b+12>>1]&65535)|0);l[c|0]=0;b=lr(c);(b|0)==0?l[e+17|0]<<24>>24!=0&&(c=pI(c),p[d>>2]=c):p[d>>2]=b}}kN.X=1;function PK(b,c,d){var e=t[b+5|0]&255,f=y[b+64>>2],g=y[p[b+60>>2]+36>>2],h=e+(f+7)|0,i=t[h],j=i&255,k=((Vc[b+16>>1]&65535)<<1)+(Vc[b+12>>1]&65535)|0,m=e+(f+5)|0,o=e+(f+6)|0,r=(((t[m]&255)<<8|t[o]&255)+65535&65535)+1|0,q=(k|0)>(r|0);a:do{if(q){aj(50384);var s=11}else{var u=(i&255)>59;b:do{if(u){var w=LO(b);if((w|0)!=0){s=w;break a}w=(((t[m]&255)<<8|t[o]&255)+65535&65535)+1|0}else{if((k+2|0)>(r|0)){w=r}else{var v=g-4|0,x=e+1|0;c:for(;;){var A=f+x|0,s=(t[A]&255)<<8|t[x+(f+1)|0]&255;if((s|0)==0){w=r;break b}var E=(s|0)>(v|0);do{if(!E&&(s|0)>=(x+4|0)){var x=s+(f+2)|0,E=s+(f+3)|0,J=(t[x]&255)<<8|t[E]&255;if((J|0)<(c|0)){x=s;continue c}b=J-c|0;if((b|0)<4){f=f+s|0,g=A,B=(z=t[f]|t[f+1]<<8,z<<16>>16),l[g]=B&255,B>>=8,l[g+1]=B&255,l[h]=b+j&255}else{if((J+s|0)>(g|0)){aj(50416);s=11;break a}l[x]=b>>>8&255;l[E]=b&255}p[d>>2]=b+s|0;s=0;break a}}while(0);aj(50403);s=11;break a}}}}while(0);if((k+(c+2)|0)>(w|0)){s=LO(b);if((s|0)!=0){break}s=(((t[m]&255)<<8|t[o]&255)+65535&65535)+1|0}else{s=w}s=s-c|0;l[m]=s>>>8&255;l[o]=s&255;p[d>>2]=s;s=0}}while(0);return s}PK.X=1;function LO(b){var c=y[b+60>>2],d=p[p[c>>2]+172>>2],e=y[b+64>>2],f=t[b+5|0]&255,g=Vc[b+12>>1]&65535,h=Vc[b+16>>1]&65535,c=y[c+36>>2],i=f+(e+5)|0,j=f+(e+6)|0,k=(t[i]&255)<<8|t[j]&255;Ah(d+k|0,e+k|0,c-k|0);var k=(h<<1)+g|0,m=c-4|0,o=c,r=0;a:for(;;){if((r|0)>=(h|0)){l[i]=o>>>8&255;l[j]=o&255;l[f+(e+1)|0]=0;l[f+(e+2)|0]=0;l[f+(e+7)|0]=0;d=o-k|0;Ed(e+k|0,0,d);if((d|0)==(Vc[b+14>>1]&65535|0)){var q=0;break}aj(50344);q=11;break}var s=(r<<1)+g|0,u=e+s|0,s=s+(e+1)|0,w=(t[u]&255)<<8|t[s]&255;if((w|0)<(k|0)|(w|0)>(m|0)){aj(50315);q=11;break}var v=d+w|0,x=RH(b,v)&65535,o=o-x|0,A=(o|0)<(k|0);do{if(!A&&(x+w|0)<=(c|0)){Ah(e+o|0,v,x);l[u]=o>>>8&255;l[s]=o&255;r=r+1|0;continue a}}while(0);aj(50327);q=11;break}return q}LO.X=1;function cK(b,c,d){var e,f=y[b+64>>2],g=b+60|0,h=p[g>>2];if((n[h+22>>1]&4)<<16>>16==0){var i=h}else{Ed(f+c|0,0,d),i=p[g>>2]}for(var g=t[b+5|0]&255,h=g+1|0,i=p[i+36>>2]-4|0,j=h;;){var k=f+j|0,m=t[k],o=j+(f+1)|0,r=t[o],q=(m&255)<<8|r&255;if(!((q|0)<(c|0)&(q|0)!=0)){e=7;break}if((q|0)<(j+4|0)){aj(50494);var s=11;e=20;break}else{j=q}}a:do{if(e==7){if((q|0)>(i|0)){aj(50499),s=11}else{l[k]=c>>>8&255;l[o]=c&255;l[f+c|0]=m;l[c+(f+1)|0]=r;l[c+(f+2)|0]=d>>>8&255;l[c+(f+3)|0]=d&255;j=b+14|0;n[j>>1]=(Vc[j>>1]&65535)+d&65535;var j=g+(f+7)|0,u=h;b:for(;;){var w=f+u|0,v=u+(f+1)|0;c:for(;;){var x=(t[w]&255)<<8|t[v]&255;if((x|0)==0){d=f+h|0;k=t[d];b=g+(f+5)|0;c=t[b];if(k<<24>>24!=c<<24>>24){s=0;break a}m=t[g+(f+2)|0];g=g+(f+6)|0;e=t[g];if(m<<24>>24!=e<<24>>24){s=0;break a}k=m&255|(k&255)<<8;m=f+k|0;B=(z=t[m]|t[m+1]<<8,z<<16>>16);l[d]=B&255;B>>=8;l[d+1]=B&255;f=((t[k+(f+2)|0]&255)<<8|t[k+(f+3)|0]&255)+((c&255)<<8|e&255)|0;l[b]=f>>>8&255;l[g]=f&255;s=0;break a}var A=f+x|0,E=x+(f+1)|0,J=(t[A]&255)<<8|t[E]&255,M=x+(f+2)|0,D=x+(f+3)|0,K=((t[M]&255)<<8|t[D]&255)+x|0;if(!((K+3|0)>=(J|0)&(J|0)!=0)){u=x;continue b}var K=J-K|0,H=(K|0)<0;do{if(!H){var N=t[j]&255;if((K|0)<=(N|0)){l[j]=N-K&255;K=l[J+(f+1)|0];l[A]=l[f+J|0];l[E]=K;x=J-x+((t[J+(f+2)|0]&255)<<8|t[J+(f+3)|0]&255)|0;l[M]=x>>>8&255;l[D]=x&255;continue c}}}while(0);aj(50518);s=11;break a}}}}}while(0);return s}cK.X=1;function QH(b,c,d,e,f,g,h,i,j){var k,m,o,r=a;a+=40;var q=r+4;o=q>>2;var s=r+8;m=s>>2;var u=r+12;k=u>>1;p[o]=0;var w=y[b+60>>2];p[m]=0;var v=l[b+3|0]<<24>>24==0?4:0;if(l[b+4|0]<<24>>24==0){var x=h=0}else{x=i+h|0,v=IH(c+v|0,x,(x|0)<0?-1:0)+v|0,x=i}i=IH(c+v|0,e,f)+v|0;bG(b,c,u);u=h+x|0;if(l[b+2|0]<<24>>24==0){if(((f|0)>0||(f|0)==0&&e>>>0>2147483647)|(d|0)==0){aj(54585);var A=11,b=27}else{var E=h,J=u+e|0,M=d,D=e,b=7}}else{E=0,J=u,M=g,D=h,b=7}a:do{if(b==7){p[j>>2]=Vc[k+13]&65535;var A=w+17|0,d=w+36|0,e=w+32|0,K=c+i|0,v=c+(Vc[k+12]&65535)|0,x=0,H=Vc[k+11]&65535,h=J,f=M,u=D;b:for(;;){if((h|0)<=0){Yj(x);A=0;break a}if((H|0)==0){K=y[m];if(l[A]<<24>>24==0){var N=K}else{N=Math.floor((y[si>>2]>>>0)/(y[e>>2]>>>0))+1|0;for(H=K;;){var Q=H+1|0;if(!((cG(w,Q)|0)==(Q|0)|(Q|0)==(N|0))){break}H=Q}N=p[m]=Q}N=mI(w,q,s,N,0);p[r>>2]=N;var H=(N|0)==0,P=l[A]<<24>>24!=0&H;do{if(P){N=p[m];qI(w,N,(K|0)!=0?4:3,K,r);K=p[r>>2];if((K|0)==0){var L=N;break}Yj(p[o]);var I=K;break b}if(!H){I=N;break b}L=p[m]}while(0);Zi(v,L);Yj(x);x=p[o];K=x+64|0;v=p[K>>2];Zi(v,0);K=p[K>>2]+4|0;H=p[d>>2]-4|0}N=(h|0)>(H|0)?H:h;(u|0)>0?(N=(N|0)>(u|0)?u:N,Ah(K,f,N)):Ed(K,0,N);h=h-N|0;K=K+N|0;H=H-N|0;(u|0)!=(N|0)?(f=f+N|0,u=u-N|0):(f=g,u=E)}Yj(x);A=I}}while(0);a=r;return A}QH.X=1;function JH(b){return((b|0)==0?0:l[b+8|0]<<24>>24==2)&1}function LH(b,c,d){var e,f,g,h,i=a;a+=28;var j;h=i>>2;var k=i+4;g=k>>2;var m=i+8;f=m>>2;var o=i+12,r=i+16,q=i+20,s=i+24;e=(b+4|0)>>2;var u=y[e],w=l[u+17|0]<<24>>24==0;a:do{if(w){if(j=mI(u,i,k,1,0),p[f]=j,(j|0)!=0){var v=j;j=23}else{var x=p[h],A=p[g];j=22}}else{zH(p[u+8>>2]);j=b|0;ri(p[j>>2],p[e],4,k);for(var E=Math.floor((y[si>>2]>>>0)/(y[u+32>>2]>>>0))+1|0,J=p[g];;){var M=J+1|0;if(!((M|0)==(cG(u,M)|0)|(M|0)==(E|0))){break}J=M}p[g]=M;E=mI(u,r,o,M,1);p[f]=E;if((E|0)!=0){v=E,j=23}else{var E=y[o>>2],D=(E|0)==(M|0);b:do{if(!D){l[q]=0;p[s>>2]=0;Yj(p[r>>2]);J=Xj(u,M,i,0);p[f]=J;if((J|0)!=0){v=J;j=23;break a}J=gG(u,M,q,s);p[f]=J;var D=t[q],K=(D-1&255)<2;do{if(!K){K=y[h];if((J|0)!=0){var H=K,N=J;break}E=nI(u,K,D,p[s>>2],E,0);p[f]=E;Yj(K);if((E|0)!=0){v=E;j=23;break a}E=Xj(u,M,i,0);p[f]=E;if((E|0)!=0){v=E;j=23;break a}E=p[h];J=Yi(p[E+76>>2]);p[f]=J;if((J|0)==0){J=E;break b}Yj(E);v=J;j=23;break a}aj(56311);p[f]=11;H=p[h];N=11}while(0);Yj(H);v=N;j=23;break a}J=p[r>>2];p[h]=J}while(0);qI(u,M,1,0,m);E=p[f];(E|0)==0?(j=Ai(p[j>>2],p[e],4,M),p[f]=j,(j|0)==0?(x=J,A=M,j=22):(Yj(J),v=j,j=23)):(Yj(J),v=E,j=23)}}}while(0);j==22&&(EI(x,(d&1|0)==0?10:13),vi(p[x+76>>2]),p[c>>2]=A,v=0);a=i;return v}LH.X=1;function KH(b,c,d,e,f){var g,h=p[b+4>>2];if((d|0)==0){g=3}else{if((n[h+22>>1]&1)<<16>>16==0){g=3}else{var i=8;g=9}}g==3&&(p[f+20>>2]=(c|0)==1?(p[h+44>>2]|0)!=0?1:0:c,n[f+86>>1]=-1,p[f+16>>2]=e,p[f>>2]=b,p[f+4>>2]=h,l[f+76|0]=d&255,b=h+8|0,c=p[b>>2],p[f+8>>2]=c,(c|0)!=0&&(p[(c+12|0)>>2]=f),p[b>>2]=f,l[f+79|0]=0,f=f+24|0,p[f>>2]=0,i=p[f+4>>2]=0);return i}KH.X=1;function $i(b,c){var d,e=b+96|0,f=p[e>>2],g=(f|0)<(c|0);a:do{if(g){if(l[b+6|0]<<24>>24==0){var h=0}else{var i=b+92|0,j=eh(p[i>>2],c*44|0),k=j;if((j|0)==0){h=7}else{Ed(k+f*44|0,0,(c-f)*44|0);p[i>>2]=k;for(var i=b+24|0,j=b+64|0,m=b+124|0,o=b+52|0,r=b+180|0,q=b+72|0,s=f;;){if((s|0)>=(c|0)){h=0;break a}var u=k+s*44|0;p[(k+s*44+20|0)>>2]=p[i>>2];if((p[p[j>>2]>>2]|0)==0){d=9}else{d=p[q>>2];var w=p[q+4>>2];if((w|0)>0||(w|0)==0&&d>>>0>0){var v=u|0;p[(v|0)>>2]=d;p[(v+4|0)>>2]=w;d=10}else{d=9}}d==9&&(u|=0,p[(u|0)>>2]=p[m>>2],p[(u+4|0)>>2]=0);p[(k+s*44+24|0)>>2]=p[o>>2];u=Ko(p[i>>2]);p[(k+s*44+16|0)>>2]=u;if((u|0)==0){h=7;break a}u=p[r>>2];(uj(u)|0)!=0&&(d=k+s*44+28|0,p[d>>2]=p[u+68>>2],p[d+4>>2]=p[u+76>>2],p[d+8>>2]=p[u+80>>2],p[d+12>>2]=p[u+104>>2]);s=s+1|0;p[e>>2]=s}}}}else{h=0}}while(0);return h}$i.X=1;function Ni(b){var c,d=b+44|0,e=(p[d>>2]|0)==0;do{if(e){var f=y[b+12>>2],g=y[f+64>>2];c=Yi(p[f+76>>2]);if((c|0)!=0){f=c;break}c=R.Bc|0;for(var h=g,i=c+16;c<i;c++,h++){l[h]=l[c]}c=(b+32|0)>>2;l[g+16|0]=y[c]>>>8&255;l[g+17|0]=y[c]>>>16&255;l[g+18|0]=1;l[g+19|0]=1;l[g+20|0]=p[c]-p[b+36>>2]&255;l[g+21|0]=64;l[g+22|0]=32;l[g+23|0]=32;Ed(g+24|0,0,76);EI(f,13);n[(b+22|0)>>1]|=2;Zi(g+52|0,t[b+17|0]&255);Zi(g+64|0,t[b+18|0]&255);p[d>>2]=1;l[g+31|0]=1}f=0}while(0);return f}Ni.X=1;function OG(b,c,d){var e=n[b+86>>1]<<16>>16,f=y[b+(e<<2)+128>>2],g=b+32|0;n[b+58>>1]<<16>>16==0&&dG(f,Vc[b+(e<<1)+88>>1]&65535,g);e=Vc[b+52>>1]&65535;f=l[f+2|0]<<24>>24==0?p[(g|0)>>2]:0;(d|0)==0?d=Vc[b+54>>1]&65535:(d=(Vc[b+54>>1]&65535)-f|0,e=f+e|0);b=p[b+40>>2]+e|0;p[c>>2]=d;return b}OG.X=1;function FH(b){var c;c=b+168|0;var d=p[c>>2];if((d|0)!=0){for(;;){var e=p[d+64>>2];if((e|0)==0){break}d=e}DH(d)}p[c>>2]=0;p[b+176>>2]=0;c=(b+68|0)>>2;d=p[c];e=(d|0)==0;a:do{if(!e){var f=b+50|0,g=n[f>>1];if(g<<16>>16!=0){for(var h=0,i=d;;){i=p[i+(h<<2)>>2];(i|0)!=0&&(aH(b,i),p[((h<<2)+p[c]|0)>>2]=0,g=n[f>>1]);h=h+1|0;if((h|0)>=(g&65535|0)){break a}i=p[c]}}}}while(0);c=p[b+8>>2];(c|0)!=0&&ag(c+40|0,p[b+24>>2]);b=(b+172|0)>>2;c=p[b];d=(c|0)==0;a:do{if(!d){for(e=c;;){p[b]=p[e+64>>2];var f=e+72|0,g=e+44|0,j=p[g>>2],i=f+j*40|0,k=e+48|0,h=e|0;if((p[k>>2]|0)>0){for(j=0;;){if(aH(p[h>>2],p[i+(j<<2)>>2]),j=j+1|0,(j|0)>=(p[k>>2]|0)){break}}g=p[g>>2]}else{g=j}ag(f,g);vf(p[p[h>>2]>>2],e);e=p[b];if((e|0)==0){break a}}}}while(0)}FH.X=1;function GH(b){var c=b+4|0,d=p[c>>2],e=(d|0)>0;a:do{if(e){for(var f=b+8|0,g=0,h=d;;){var i=p[p[f>>2]+(g<<4)+4>>2];(i|0)!=0&&(JH(i)|0)!=0&&(Vj(i,4),h=p[c>>2]);g=g+1|0;if((g|0)>=(h|0)){break a}}}}while(0)}function HH(b,c){var d,e,f=a;a+=12;var g,h=f+4,i=f+8;d=c+56|0;e=(b+308|0)>>2;var j=p[e];p[e]=0;for(var k=b+312|0,m=0,o=0;;){if((m|0)!=0){break}if((o|0)>=(p[k>>2]|0)){break}var r=p[p[j+(o<<2)>>2]+8>>2];if((r|0)==0){m=0}else{if(m=p[p[r>>2]+60>>2],(m|0)==0){m=0}else{m=Gd[m](r);vf(b,p[d>>2]);var r=r+8|0,q=yl(b,p[r>>2]);p[d>>2]=q;Lg(p[r>>2])}}o=o+1|0}p[e]=j;e=(b+4|0)>>2;d=(b+8|0)>>2;for(o=k=j=0;;){if((m|0)!=0){var s=m;g=59;break}if((j|0)>=(p[e]|0)){g=7;break}m=y[p[d]+(j<<4)+4>>2];(JH(m)|0)==0?m=0:(k=((j|0)!=1&1)+k|0,m=o=(uj(p[p[p[m+4>>2]>>2]+180>>2])|0)==0?sr(p[p[m+4>>2]>>2],4):0,o=1);j=j+1|0}a:do{if(g==7){s=(o|0)==0;do{if(!s&&(j=p[b+172>>2],(j|0)!=0&&(Gd[j](p[b+168>>2])|0)!=0)){s=19;break a}}while(0);j=p[p[p[p[p[d]+4>>2]+4>>2]>>2]+144>>2];if((ve(j)|0)==0|(k|0)<2){for(j=s=0;;){if((j|0)!=0){var u=0,w=j;break}if((s|0)>=(p[e]|0)){w=u=0;break}j=p[p[d]+(s<<4)+4>>2];j=(j|0)==0?0:Ji(j,0);s=s+1|0}for(;;){if((w|0)!=0){s=w;break a}if((u|0)>=(p[e]|0)){break}w=p[p[d]+(u<<4)+4>>2];w=(w|0)==0?0:Ii(w,0);u=u+1|0}Un(b,64);s=0}else{if(s=y[b>>2],p[f>>2]=0,r=ve(j),j=zm(b,R.sm|0,(z=a,a+=4,p[z>>2]=j,z)),(j|0)==0){s=7}else{m=i;r=j+r|0;q=0;b:for(;;){var v=(q|0)==0;do{if(!v){if((q|0)>100){cf(13,R.tm|0,(z=a,a+=4,p[z>>2]=j,z));hq(s,j,0);g=31;break b}(q|0)==1&&cf(13,R.um|0,(z=a,a+=4,p[z>>2]=j,z))}}while(0);Dh(4,m);var x=y[i>>2],v=x>>>8;x&=255;Ch(13,r,R.vm|0,(z=a,a+=8,p[z>>2]=v,p[z+4>>2]=x,z));v=Dq(s,j,0,h);if((v|0)!=0){var A=v;g=33;break}if((p[h>>2]|0)==0){g=31;break}q=q+1|0}do{if(g==31&&(A=JJ(s,j,f,16406,0),(A|0)==0)){g=p[f>>2];for(w=h=u=i=0;;){if((h|0)>=(p[e]|0)){break}A=p[p[d]+(h<<4)+4>>2];m=(JH(A)|0)==0;do{if(!m){o=p[A+4>>2];k=p[p[o>>2]+148>>2];if((k|0)==0){k=i;o=u;r=w;break}(w|0)==0?(w=o,li(p[A>>2],w),A=(l[p[w>>2]+8|0]&255|0)!=0?0:1):A=w;w=Ei(g,k,ve(k)+1|0,u,i);k=ve(k)+1|0;i=(T.add(k,(k|0)<0?-1:0,u,i),T.result[0]);u=T.result[1];if((w|0)==0){k=u;o=i;r=A;break}MH(g);hq(s,j,0);vf(b,j);s=w;break a}k=i;o=u;r=w}while(0);i=k;u=o;h=h+1|0;w=r}i=(w|0)==0;do{if(!i){if((jq(g)&1024|0)!=0){u=h=0;break}h=Nj(g,2);if((h|0)==0){u=h=0;break}MH(g);hq(s,j,0);vf(b,j);s=h;break a}u=h=0}while(0);for(;;){if((u|0)!=0){MH(g);vf(b,j);s=u;break a}if((h|0)>=(p[e]|0)){break}i=p[p[d]+(h<<4)+4>>2];i=(i|0)==0?0:Ji(i,j);h=h+1|0;u=i}MH(g);g=hq(s,j,1);vf(b,j);if((g|0)!=0){s=g;break a}dj();h=p[e];i=(h|0)>0;b:do{if(i){u=0;for(A=h;;){if(w=p[p[d]+(u<<4)+4>>2],(w|0)!=0&&(Ii(w,1),A=p[e]),u=u+1|0,(u|0)>=(A|0)){break b}}}}while(0);gj();Un(b,64);s=g;break a}}while(0);vf(b,j);s=A}}}}while(0);a=f;return s}HH.X=1;function Vj(b,c){var d=b+4|0;li(p[b>>2],p[d>>2]);var d=p[p[d>>2]+8>>2],e=(d|0)==0;a:do{if(!e){for(var f=d;;){Cr(f);l[f+79|0]=3;p[f+72>>2]=c;var g=f+86|0,h=n[g>>1]<<16>>16<0;b:do{if(!h){for(var i=0;;){var j=(i<<2)+f+128|0;Yj(p[j>>2]);p[j>>2]=0;i=i+1|0;if((i|0)>(n[g>>1]<<16>>16|0)){break b}}}}while(0);f=p[f+8>>2];if((f|0)==0){break a}}}}while(0)}function DG(b,c){var d=b>>2,e=l[b+1|0]<<24>>24;do{if((e|0)==-17||(e|0)==-6){var f=y[d+4],g=f+6|0,h=Vc[g>>1]&65535;Ch(32,c,R.xm|0,(z=a,a+=4,p[z>>2]=h,z));var i=f+8|0,j=0,h=ve(c);a:for(;;){if((j|0)>=(Vc[g>>1]&65535|0)){var k=c+h|0;break}var m=p[f+(j<<2)+12>>2],o=(m|0)==0;do{if(o){var r=h+4|0;if((r|0)<26){var q=c+h|0;B=1818848812;l[q]=B&255;B>>=8;l[q+1]=B&255;B>>=8;l[q+2]=B&255;B>>=8;l[q+3]=B&255}else{r=h}}else{r=m|0;q=ve(p[r>>2]);if((q+h|0)>26){f=k=c+h|0;B=774778412;l[f]=B&255;B>>=8;l[f+1]=B&255;B>>=8;l[f+2]=B&255;B>>=8;l[f+3]=B&255;break a}var s=h+1|0;l[c+h|0]=44;var u=p[i>>2];(u|0)!=0&&l[u+j|0]<<24>>24!=0&&(l[c+s|0]=45,s=h+2|0);Ah(c+s|0,p[r>>2],q+1|0);r=s+q|0}}while(0);j=j+1|0;h=r}l[k]=41;l[h+(c+1)|0]=0;h=c}else{if((e|0)==-4){h=p[p[d+4]>>2],Ch(32,c,R.ym|0,(z=a,a+=4,p[z>>2]=h,z)),h=c}else{if((e|0)==-5){f=p[d+4],h=p[f+24>>2],f=n[f>>1]<<16>>16,Ch(32,c,R.zm|0,(z=a,a+=8,p[z>>2]=h,p[z+4>>2]=f,z)),h=c}else{if((e|0)==-13){f=p[d+4],h=p[f>>2],f=p[f+4>>2],Ch(32,c,R.U|0,(z=a,a+=8,p[z>>2]=h,p[z+4>>2]=f,z)),h=c}else{if((e|0)==-14){h=p[d+4],Ch(32,c,R.Am|0,(z=a,a+=4,p[z>>2]=h,z)),h=c}else{if((e|0)==-12){h=p[d+4],h=(C[0]=p[h>>2],C[1]=p[h+4>>2],xd[0]),Ch(32,c,R.za|0,(z=a,a+=8,xd[0]=h,p[z>>2]=C[0],p[z+4>>2]=C[1],z)),h=c}else{if((e|0)==-8){if(h=y[d+4],f=Vc[h+28>>1]&65535,(f&2|0)==0){if((f&4|0)==0){if((f&8|0)==0){if((f&1|0)==0){h=R.Bm|0;break}Ch(32,c,R.V|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z))}else{h=h+8|0,h=(C[0]=p[h>>2],C[1]=p[h+4>>2],xd[0]),Ch(32,c,R.za|0,(z=a,a+=8,xd[0]=h,p[z>>2]=C[0],p[z+4>>2]=C[1],z))}}else{f=h+16|0,h=p[f>>2],f=p[f+4>>2],Ch(32,c,R.U|0,(z=a,a+=8,p[z>>2]=h,p[z+4>>2]=f,z))}h=c}else{h=p[h+4>>2]}}else{if((e|0)==-10){h=p[p[d+4]+8>>2],f=p[h>>2],Ch(32,c,R.Cm|0,(z=a,a+=8,p[z>>2]=h,p[z+4>>2]=f,z))}else{if((e|0)==-15){Ch(32,c,R.Dm|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z))}else{if((e|0)==-18){Ch(32,c,R.Em|0,(z=a,a+=1,a=a+3>>2<<2,p[z>>2]=0,z))}else{if((e|0)!=-19&&(h=p[d+4],(h|0)!=0)){break}l[c]=0}}}h=c}}}}}}}}while(0);return h}DG.X=1;function bg(b,c,d){var e=(c|0)==0;a:do{if(!e){var f=c+d*20|0;if((d|0)>0){for(var g=c;;){if(Km(b,l[g+1|0]<<24>>24,p[g+16>>2]),g=g+20|0,g>>>0>=f>>>0){break a}}}}}while(0);vf(b,c|0)}function Qj(b){var c=p[b+4>>2],d=c+60|0;Mo(p[d>>2]);p[d>>2]=0;d=b+8|0;if(l[d]<<24>>24==0){b=6}else{if((p[p[b>>2]+140>>2]|0)>1){var e=p[b+4>>2],f=e+76|0,b=(p[f>>2]|0)==(b|0);a:do{if(b){p[f>>2]=0;n[(e+22|0)>>1]&=-97;var g=p[e+72>>2];if((g|0)!=0){for(;;){if(l[g+8|0]=1,g=p[g+12>>2],(g|0)==0){break a}}}}}while(0);l[d]=1;b=7}else{e=p[b+4>>2];f=e+72|0;a:for(;;){for(;;){for(g=p[f>>2];;){if((g|0)==0){break a}var h=g+12|0;if((p[g>>2]|0)!=(b|0)){f=h;continue a}h=p[h>>2];p[f>>2]=h;if((p[g+4>>2]|0)!=1){break}g=h}Lg(g)}}f=e+76|0;(p[f>>2]|0)==(b|0)?(p[f>>2]=0,n[(e+22|0)>>1]&=-97):(p[e+40>>2]|0)==2&&(n[(e+22|0)>>1]&=-65);b=c+40|0;e=p[b>>2]-1|0;p[b>>2]=e;(e|0)==0&&(l[c+19|0]=0);b=6}}b==6&&(l[d]=0,Oi(c))}function Rj(b){var c,d,e=b|0,f=p[e>>2];zH(p[b+8>>2]);c=l[b+18|0]<<24>>24==0;a:do{if(c){var g=b+44|0,h=p[g>>2],i=cG(b,h),j=(i|0)==(h|0);do{if(!j){var k=Math.floor((y[si>>2]>>>0)/(y[b+32>>2]>>>0))+1|0;if((h|0)!=(k|0)){c=(b+12|0)>>2;j=Xi(p[p[c]+64>>2]+36|0);d=Math.floor((y[b+36>>2]>>>0)/5);i=h-j-Math.floor(((i-h+j+d|0)>>>0)/(d>>>0))|0;for(i=h>>>0>k>>>0?((i>>>0<k>>>0)<<31>>31)+i|0:i;;){if(!((cG(b,i)|0)==(i|0)|(i|0)==(k|0))){break}i=i-1|0}if(i>>>0>h>>>0){aj(52282);g=11;break a}k=h>>>0>i>>>0;do{if(k){for(d=h;;){var m=AH(b,i,d);d=d-1|0;if(!(d>>>0>i>>>0&(m|0)==0)){break}}if((m|0)==101||(m|0)==0){var o=m;d=14}else{var r=m;d=16}}else{o=0,d=14}}while(0);d==14&&((j|0)==0?r=o:(b=Yi(p[p[c]+76>>2]),Zi(p[p[c]+64>>2]+32|0,0),Zi(p[p[c]+64>>2]+36|0,0),Zi(p[p[c]+64>>2]+28|0,i),p[p[e>>2]+24>>2]=i,p[g>>2]=i,r=b));if((r|0)==0){g=0;break a}Wj(f);g=r;break a}}}while(0);aj(52269);g=11}else{g=0}}while(0);return g}Rj.X=1;function xj(b,c){var d,e,f=a;a+=8;var g=(c|0)==0;do{if(g){d=0}else{if(d=l[b+5|0],d<<24>>24==4||d<<24>>24==2){d=0}else{l[b+19|0]=1;d=l[c];var h=d<<24>>24==0;a:do{if(h){var i=0,j=0}else{for(var k=e=0,m=d;;){if(k=(m<<24>>24)+k|0,e=e+1|0,m=l[c+e|0],m<<24>>24==0){i=e;j=k;break a}}}}while(0);if(l[b+9|0]<<24>>24==0){d=b+72|0;var m=p[d+4>>2],o=p[d>>2]}else{h=Iq(b),d=h[0],m=h[1],h=b+72|0,e=h|0,p[e>>2]=d,h=h+4|0,p[h>>2]=m,o=d}h=b+72|0;e=h>>2;d=(b+64|0)>>2;k=qr(p[d],o,m,((p[si>>2]|0)/(p[b+128>>2]|0)&-1)+1|0);if((k|0)!=0){d=k}else{if(k=p[d],m=(T.add(o,m,4,0),T.result[0]),o=T.result[1],k=Ei(k,c,i,m,o),(k|0)!=0){d=k}else{var r=p[d],m=(T.add(m,o,i,(i|0)<0?-1:0),T.result[0]),k=T.result[1],o=qr(r,m,k,i);(o|0)!=0?d=o:(o=p[d],r=(T.add(m,k,4,0),T.result[0]),o=qr(o,r,T.result[1],j),(o|0)!=0?d=o:(o=p[d],m=(T.add(m,k,8,0),T.result[0]),m=Ei(o,R.qa|0,8,m,T.result[1]),(m|0)!=0?d=m:(m=i+20|0,m=(T.add(p[e],p[e+1],m,(m|0)<0?-1:0),T.result[0]),k=T.result[1],p[e]=m,p[e+1]=k,e=Fi(p[d],f),(e|0)!=0?d=e:(m=p[f+4>>2],e=h|0,e=p[e>>2],h=h+4|0,h=p[h>>2],d=(m|0)>(h|0)||(m|0)==(h|0)&&p[f>>2]>>>0>e>>>0?Gi(p[d],e,h):0))))}}}}}while(0);a=f;return d}xj.X=1;function ij(b){(p[p[b+176>>2]+12>>2]|0)==0&&bq(b)}function Li(b){var c,d,e,f,g=a;a+=12;var h,i=g+4;f=i>>2;var j=g+8;p[f]=0;e=(b|0)>>2;var k=hI(p[e]),m=(k|0)==0;a:do{if(m){var o=Xj(b,1,g,0);if((o|0)==0){o=y[g>>2];d=(o+64|0)>>2;h=Xi(p[d]+28|0);p[i>>2]=p[p[e]+24>>2];if((h|0)==0){h=5}else{if(c=p[d],(jm(c+24|0,c+92|0,4)|0)==0){var r=h;h=6}else{h=5}}h==5&&(r=p[f]);c=(r|0)>0;b:do{if(c){d=y[d];c=(jm(d,R.Bc|0,16)|0)==0;c:do{if(c){if((t[d+18|0]&255)>2&&(n[(b+22|0)>>1]|=1),h=t[d+19|0],(h&255)>2){h=26}else{h=h<<24>>24==2;do{if(h&&(n[b+22>>1]&16)<<16>>16==0){p[j>>2]=0;var q=xI(p[e],j);if((q|0)!=0){h=q;break c}if((p[j>>2]|0)==0){Yj(o);o=0;break a}}}while(0);if((jm(d+21|0,R.Sp|0,3)|0)!=0){h=26}else{if(h=(t[d+17|0]&255)<<16|(t[d+16|0]&255)<<8,(h+16777215&h|0)!=0|h>>>0>65536|h>>>0<257){h=26}else{var s=t[d+20|0]&255,q=h-s|0,u=b+32|0;c=u>>2;if((h|0)==(p[c]|0)){s=(p[p[b+4>>2]+12>>2]&8388608|0)==0;do{if(s&&(r|0)>(p[f]|0)){aj(51615);h=11;break c}}while(0);if(q>>>0<480){h=26;break}p[c]=h;p[b+36>>2]=q;l[b+17|0]=(Xi(d+52|0)|0)!=0&1;l[b+18|0]=(Xi(d+64|0)|0)!=0&1;h=q;break b}Yj(o);p[b+36>>2]=q;p[c]=h;bo(b);o=Oo(p[e],u,s);break a}}}}else{h=26}}while(0);Yj(o);p[b+12>>2]=0;o=h;break a}h=p[b+36>>2]}while(0);d=Math.floor((((h<<6)-768|0)>>>0)/255)+65513|0;c=d&65535;n[b+24>>1]=c;q=Math.floor((((h<<5)-384|0)>>>0)/255)+65513&65535;n[b+26>>1]=q;n[b+28>>1]=h+65501&65535;n[b+30>>1]=q;l[b+20|0]=(c&65535)>127?127:d&255;p[b+12>>2]=o;p[b+44>>2]=r;o=0}}else{o=k}}while(0);a=g;return o}Li.X=1;function Mi(b,c,d){var e,f=b>>2,g=p[f+10],h=(g|0)==0;a:do{if(h){l[b+22|0]=d&255;var i=b+16|0;if(l[i]<<24>>24!=1){e=0}else{e=(b+180|0)>>2;var j=p[e],k=(uj(j)|0)==0;do{if(k){var m=vr(b,2),m=(m|0)!=0|(c|0)==0?m:sr(b,4)}else{m=l[b+4|0]<<24>>24==0;do{if(!m&&(rq(j,-1)|0)!=0){var o=vr(b,4);if((o|0)!=0){e=o;break a}rq(p[e],1)}}while(0);m=p[e];l[m+46|0]<<24>>24==0?(o=Xq(m,0,1),(o|0)!=0?m=o:(o=m+44|0,l[o]=1,(jm(m+52|0,p[p[m+32>>2]>>2],48)|0)==0?m=0:(tq(m,0,1),l[o]=0,m=5))):m=8}}while(0);(m|0)!=0?e=m:(l[i]=2,e=p[f+6],p[f+9]=e,p[f+8]=e,p[f+7]=e,e=b+72|0,p[e>>2]=0,e=p[e+4>>2]=0)}}else{e=g}}while(0);return e}Mi.X=1;function wQ(b,c){var d=p[b+24>>2],e=b+16|0,f=(t[e]&255|0)==(c|0);a:do{if(f){var g=0}else{if((c|0)==1){l[e]=1}else{g=(Gd[p[Mh+232>>2]](d)|0)<0;do{if(g&&((p[Qh>>2]|0)!=20||(Gd[p[Mh+196>>2]](d)|0)<0)){d=p[Qh>>2];f=(e=(d|0)==2)?0:2058;if(e){g=f;break a}p[b+20>>2]=d;g=f;break a}}while(0);l[e]=0}g=0}}while(0);return g}function cR(b,c,d,e,f){var g,h,i,j,k=a;a+=72;var m;m=b+36|0;h=p[m>>2];(h|0)==0?(b=kR(b),(b|0)!=0?(i=b,m=23):(j=p[m>>2],m=4)):(j=h,m=4);if(m==4){m=y[j>>2];j=m>>2;i=(m+20|0)>>1;b=(Vc[i]&65535|0)>(c|0);a:do{if(b){h=0}else{var o=c+1|0;g=o*d|0;p[j+4]=d;h=(m+12|0)>>2;var r=p[h],q=(r|0)>-1;do{if(q){if((Gd[p[Mh+64>>2]](r,k)|0)!=0){h=4874;break a}if((p[k+28>>2]|0)<(g|0)){if((e|0)==0){h=0;break a}if((pR(p[h],g)|0)!=0){h=Sh(4874,R.da|0,p[j+2],28970);break a}}}}while(0);g=(m+24|0)>>2;o=dh(p[g],o<<2);if((o|0)==0){h=3082}else{p[g]=o;for(o=n[i];;){r=o&65535;if((r|0)>(c|0)){h=0;break a}q=y[h];if((q|0)>-1){if(o=d,r=r*d|0,q==-1?(r=Dd(o),Ed(r,0,o),o=r):(q=DR[q])?(q=q.object.g,q=Array.prototype.slice.call(q,r,r+o),o=G(q,"i8",Bd)):o=-1,(o|0)==-1){break}}else{o=Kg(d);if((o|0)==0){h=7;break a}Ed(o,0,d)}p[(((Vc[i]&65535)<<2)+p[g]|0)>>2]=o;o=n[i]+1&65535;n[i]=o}h=Sh(5386,R.kq|0,p[j+2],28993)}}}while(0);p[f>>2]=(Vc[i]&65535|0)>(c|0)?p[p[j+6]+(c<<2)>>2]:0;i=l[m+22|0]<<24>>24!=0&(h|0)==0?8:h}a=k;return i}cR.X=1;function SR(b,c,d,e){var f=y[b+36>>2],g=y[f>>2],b=g>>2,h=(1<<d+c)-(1<<c)|0,i=(e&1|0)==0;a:do{if(i){var j=g+32|0;if((e&4|0)==0){for(var k=h&65535;;){j=y[j>>2];if((j|0)==0){break}if((Vc[j+12>>1]&65535&k|0)!=0){k=5;break a}if((Vc[j+10>>1]&65535&k|0)!=0){k=5;break a}j=j+4|0}k=wS(p[b+3],2,c+120|0,d);if((k|0)!=0){break}k=f+12|0}else{for(k=0;;){j=y[j>>2];if((j|0)==0){break}if((h&Vc[j+12>>1]&65535|0)!=0){k=5;break a}k|=Vc[j+10>>1]&65535;j=j+4|0}if((h&65535&k|0)==0&&(k=wS(p[b+3],1,c+120|0,d),(k|0)!=0)){break}k=f+10|0}n[k>>1]=(Vc[k>>1]&65535|h)&65535}else{k=p[b+8];j=(k|0)==0;b:do{if(j){var m=0}else{for(var o=0,r=k;;){if(o=(r|0)==(f|0)?o:n[r+10>>1]|o,r=y[r+4>>2],(r|0)==0){m=o;break b}}}}while(0);if((m&65535&h|0)==0&&(k=wS(p[b+3],3,c+120|0,d),(k|0)!=0)){break}k=(h|-65536)^65535;j=f+12|0;n[j>>1]=Vc[j>>1]&65535&k&65535;j=f+10|0;n[j>>1]=Vc[j>>1]&65535&k&65535}k=0}while(0);return k}SR.X=1;function AS(b){var c=y[p[b+8>>2]+20>>2],d=(c|0)==0;do{if(!d&&(p[c+28>>2]|0)==0){var e=c+20|0,f=n[e>>1]<<16>>16==0;a:do{if(f){var g=c+24|0,h=c+12|0}else{for(var i=c+12|0,j=c+24|0,k=0;;){var m=p[p[j>>2]+(k<<2)>>2];(p[i>>2]|0)>-1?DS(m):Lg(m);k=k+1|0;if((k|0)>=(Vc[e>>1]&65535|0)){g=j;h=i;break a}}}}while(0);Lg(p[g>>2]);e=p[h>>2];(e|0)>-1&&(iU(b,e,28733),p[h>>2]=-1);p[(p[c>>2]+20|0)>>2]=0;Lg(c)}}while(0)}AS.X=1;function iU(b,c,d){(Gd[p[Mh+16>>2]](c)|0)!=0&&Sh(4106,R.lc|0,(b|0)==0?0:p[b+32>>2],d)}function Sh(b,c,d,e){var f=a,g=p[Qh>>2],h;lU||(lU=Dd(256));h=lU;if(g in nU){if(nU[g].length>255){uU(OU)}else{for(var i=nU[g],j=0;j<i.length;j++){l[h+j]=i.charCodeAt(j)}l[h+j]=0}}else{uU(RU)}h=lU;d=(d|0)==0?xh|0:d;cf(b,R.Up|0,(z=a,a+=20,p[z>>2]=e,p[z+4>>2]=g,p[z+8>>2]=c,p[z+12>>2]=d,p[z+16>>2]=h,z));a=f;return b}function Ph(b,c,d){for(;;){var e=Gd[p[Mh+4>>2]](b,c,d);if((e|0)>=0){break}if((p[Qh>>2]|0)!=4){break}}return e}function wS(b,c,d,e){var f,g=a;a+=16;(b|0)>-1?(f=g>>2,p[f]=0,p[f+1]=0,p[f+2]=0,p[f+3]=0,n[g>>1]=c&65535,n[g+2>>1]=0,p[g+4>>2]=d,p[g+8>>2]=e,b=(Gd[p[Mh+88>>2]](b,8,(z=a,a+=4,p[z>>2]=g,z))|0)!=-1?0:5):b=0;a=g;return b}function eW(b){return(b|0)==11||(b|0)==116||(b|0)==16||(b|0)==4||(b|0)==46||(b|0)==13?5:(b|0)==1?3:3850}function jW(b,c,d){var e=y[d>>2];(e|0)<0?p[d>>2]=(l[b+17|0]&c)<<24>>24!=0&1:(e|0)==0?l[b+17|0]&=c^-1:l[b+17|0]|=c}function kR(b){var c,d,e,f=a;a+=72;var g,h=Kg(16),i=(h|0)==0;a:do{if(i){e=7}else{e=h;for(var j=e+16;e<j;e++){l[e]=0}e=(b+8|0)>>2;var j=p[e],k=p[j+20>>2],m=(k|0)==0;b:do{if(m){if((Gd[p[Mh+64>>2]](p[b+12>>2],f)|0)==0){g=5}else{if(l[j+13|0]<<24>>24==0){var o=1802;g=16}else{g=5}}c:do{if(g==5){d=(b+32|0)>>2;c=qe(p[d]);var m=c+42|0,r=Kg(m),k=r;if((r|0)==0){o=7}else{c=c+6|0;Ed(r,0,m);m=r+36|0;p[(r+8|0)>>2]=m;var q=p[d];Ch(c,m,R.lq|0,(z=a,a+=4,p[z>>2]=q,z));c=(r+12|0)>>2;p[c]=-1;p[(p[e]+20|0)>>2]=k;p[r>>2]=p[e];p[(r+4|0)>>2]=8;if(l[j+13|0]<<24>>24!=0){g=k;break b}(Po(p[d],R.mq|0,0)|0)==0?d=514:(l[r+22|0]=1,d=0);d=Ph(m,d,p[f+8>>2]&511);p[c]=d;if((d|0)<0){Rh(28847),o=Sh(14,R.na|0,m,28847)}else{d=(wS(d,2,128,1)|0)==0;do{if(d&&(pR(p[c],0)|0)!=0&&(r=Sh(4618,R.da|0,m,28858),(r|0)!=0)){o=r;break c}}while(0);m=wS(p[c],1,128,1);if((m|0)==0){g=k;break b}o=m}}}}while(0);AS(b);Lg(h);e=o;break a}g=k}while(0);p[h>>2]=g;e=g+28|0;p[e>>2]=p[e>>2]+1|0;p[b+36>>2]=h;e=g+32|0;p[h+4>>2]=p[e>>2];p[e>>2]=h;e=0}}while(0);a=f;return e}kR.X=1;function pR(b,c){for(;;){var d=Gd[p[Mh+76>>2]](b,c);if((d|0)>=0){break}if((p[Qh>>2]|0)!=4){break}}return d}function kW(b,c,d){var e=a;a+=72;var f=b+40|0,g=(p[f>>2]|0)>0;a:do{if(g){var h=b+12|0;if((Gd[p[Mh+64>>2]](p[h>>2],e)|0)!=0){var i=1802}else{var j=p[f>>2],k=j,j=(j|0)<0?-1:0,m=(T.add(c,d,-1,-1),T.result[0]),m=(T.add(m,T.result[1],k,j),T.result[0]),o=T.result[1],k=(T.k(m,o,k,j),T.result[0]),k=(T.b(m,o,k,T.result[1]),T.result[0]),j=T.result[1],o=e+28|0,m=p[o>>2],r=(m|0)<0?-1:0;if((j|0)>(r|0)||(j|0)==(r|0)&&k>>>0>m>>>0){if(m=p[e+56>>2],(pR(p[h>>2],k)|0)==0){h=(m<<1)-1+p[o>>2]|0;r=h+(h%m^-1)|0;h=m;m=(m|0)<0?-1:0;for(o=(r|0)<0?-1:0;;){if(!((o|0)<(j|0)||(o|0)==(j|0)&&r>>>0<k>>>0)){i=0;break a}if((lW(b,r,o,xh|0,1)|0)!=1){i=778;break a}r=(T.add(r,o,h,m),T.result[0]);o=T.result[1]}}else{p[b+20>>2]=p[Qh>>2],i=Sh(1546,R.da|0,p[b+32>>2],28432)}}else{i=0}}}else{i=0}}while(0);a=e;return i}kW.X=1;function lW(b,c,d,e,f){for(var g=b+12|0;;){var h=mW(p[g>>2],c),i=(h|0)<0?-1:0;if(h==c&&i==d){h=Gd[p[Mh+136>>2]](p[g>>2],e,f);if((h|0)>=0){var j=h;break}if((p[Qh>>2]|0)==4){continue}p[b+20>>2]=p[Qh>>2];j=h;break}if((h|0)==-1){p[b+20>>2]=p[Qh>>2];j=-1;break}p[b+20>>2]=0;j=-1;break}return j}function nW(b,c,d,e,f){var g,h=b+12|0,i=0;a:for(;;){for(var j=c;;){var k=mW(p[h>>2],j),m=(k|0)<0?-1:0;if(k==c&&m==d){var o=Gd[p[Mh+100>>2]](p[h>>2],e,f);if((o|0)==(f|0)){var r=i;g=13;break a}if((o|0)<0){if((p[Qh>>2]|0)==4){continue}p[b+20>>2]=p[Qh>>2];r=0;g=13;break a}if((o|0)<=0){r=i;g=13;break a}f=f-o|0;c=(T.add(o,(o|0)<0?-1:0,c,d),T.result[0]);d=T.result[1];i=o+i|0;e=e+o|0;continue a}else{if((k|0)==-1){p[b+20>>2]=p[Qh>>2];var q=-1;g=14;break a}p[b+20>>2]=0;q=-1;g=14;break a}}}g==13&&(q=r+o|0);return q}nW.X=1;function oW(b){var c=b+12|0,d=p[c>>2];(d|0)>-1&&(iU(b,d,26707),p[c>>2]=-1);Lg(p[b+28>>2]);Ed(b,0,44)}function Oh(b){var c;c=a;a+=72;p[pW>>2]=p[pC>>2];if((p[pW+4>>2]|0)==0){var d=qW();p[pW+4>>2]=d}var d=c+8|0,e=0,f=0;a:for(;;){if(e>>>0>=6){break}var g=(f|0)==0;do{if(!g&&(Gd[p[Mh+52>>2]](f,c)|0)==0&&(p[d>>2]&61440|0)==16384&&(Gd[p[Mh+28>>2]](f,7)|0)==0){break a}}while(0);f=p[pW+(e<<2)>>2];e=e+1|0}a=c;c=f;c=(c|0)==0?R.oc|0:c;d=(qe(c)+25|0)>>>0>513;a:do{if(d){var h=1}else{for(;;){if(Ch(496,b,R.uq|0,(z=a,a+=4,p[z>>2]=c,z)),e=qe(b),g=b+e|0,Dh(15,g),f=e+(b+15)|0,l[g]=l[R.q+((t[g]&255)%62&255)|0],g=e+(b+1)|0,l[g]=l[R.q+((t[g]&255)%62&255)|0],g=e+(b+2)|0,l[g]=l[R.q+((t[g]&255)%62&255)|0],g=e+(b+3)|0,l[g]=l[R.q+((t[g]&255)%62&255)|0],g=e+(b+4)|0,l[g]=l[R.q+((t[g]&255)%62&255)|0],g=e+(b+5)|0,l[g]=l[R.q+((t[g]&255)%62&255)|0],g=e+(b+6)|0,l[g]=l[R.q+((t[g]&255)%62&255)|0],g=e+(b+7)|0,l[g]=l[R.q+((t[g]&255)%62&255)|0],g=e+(b+8)|0,l[g]=l[R.q+((t[g]&255)%62&255)|0],g=e+(b+9)|0,l[g]=l[R.q+((t[g]&255)%62&255)|0],g=e+(b+10)|0,l[g]=l[R.q+((t[g]&255)%62&255)|0],g=e+(b+11)|0,l[g]=l[R.q+((t[g]&255)%62&255)|0],g=e+(b+12)|0,l[g]=l[R.q+((t[g]&255)%62&255)|0],g=e+(b+13)|0,l[g]=l[R.q+((t[g]&255)%62&255)|0],g=e+(b+14)|0,l[g]=l[R.q+((t[g]&255)%62&255)|0],l[f]=0,l[e+(b+16)|0]=0,(Gd[p[Mh+28>>2]](b,0)|0)!=0){h=0;break a}}}}while(0);return h}Oh.X=1;function Th(b,c,d,e,f){var g=d>>2;p[g+3]=c;p[g+1]=b;p[g+8]=e;var h=d+17|0;l[h]=f&255;if((Po((f&64|0)!=0?e:0,R.sq|0,1)|0)!=0){l[h]|=16}(jm(p[b+16>>2],R.Yb|0,10)|0)==0&&(l[h]|=1);if((f&128|0)==0){if(b=Gd[p[p[b+20>>2]>>2]](e,d),(b|0)==(rW|0)){if(e=sW(d,d+8|0),(e|0)==0){var i=rW,c=12}else{iU(d,c,29585);p[g+5]=0;var j=e,c=16}}else{if((b|0)!=(tW|0)){i=b,c=12}else{if(f=qe(e)+6|0,h=Kg(f),(h|0)==0){p[g+6]=0,p[g+5]=0,(c|0)>-1&&iU(d,c,29671),j=7,c=16}else{Ch(f,h,R.tq|0,(z=a,a+=4,p[z>>2]=e,z));p[g+6]=h;p[g+5]=0;var k=b,c=15}}}}else{i=uW,c=12}c==12&&(p[g+5]=0,k=i,c=15);c==15&&(p[g]=k,j=0);return j}Th.X=1;function sW(b,c){var d,e,f=a;a+=80;var g=f+8,h=(Gd[p[Mh+64>>2]](p[b+12>>2],g)|0)==0;a:do{if(h){d=f;e=f>>2;p[e]=0;p[e+1]=0;p[f>>2]=p[g>>2];p[f+4>>2]=p[g+4>>2];for(var i=Nh;;){i=p[i>>2];if((i|0)==0){i=Kg(40);d=i>>2;var j=i;if((i|0)==0){e=7;break a}Ed(i,0,40);var k=i,i=p[e+1],m=k|0;B=p[e];l[m]=B&255;B>>=8;l[m+1]=B&255;B>>=8;l[m+2]=B&255;B>>=8;l[m+3]=B&255;e=k+4|0;B=i;l[e]=B&255;B>>=8;l[e+1]=B&255;B>>=8;l[e+2]=B&255;B>>=8;l[e+3]=B&255;p[d+4]=1;p[d+8]=p[Nh>>2];p[d+9]=0;e=p[Nh>>2];(e|0)!=0&&(p[(e+36|0)>>2]=j);p[Nh>>2]=j;break}if((jm(d,i,8)|0)==0){e=i+16|0;p[e>>2]=p[e>>2]+1|0;j=i;break}i=i+32|0}p[c>>2]=j;e=0}else{e=p[Qh>>2],p[b+20>>2]=e,e=(e|0)==139?22:10}}while(0);a=f;return e}sW.X=1;function wh(b,c){var d=p[c>>2];p[c>>2]=d+1|0;if((d|0)>15){d=48}else{var d=(C[0]=p[b>>2],C[1]=p[b+4>>2],xd[0]),e=d&-1;xd[0]=(d-(e|0))*10;p[b>>2]=C[0];p[b+4>>2]=C[1];d=(e+48|0)&255}return d}function vW(b,c){var d=a;a+=16;var e,f=b+16|0,g=t[f],h=(g&255|0)<(c|0);a:do{if(h){var i=y[b+8>>2],j=i+12|0,k=t[j];if(g<<24>>24!=k<<24>>24&&(k&255)>2|(c|0)>1){var m=5}else{var o=(c|0)==1;do{if(o){if((k-1&255)<2){l[f]=1;f=i+8|0;p[f>>2]=p[f>>2]+1|0;f=i+24|0;p[f>>2]=p[f>>2]+1|0;m=0;break a}var r=d+8|0;p[r>>2]=1;n[d+2>>1]=0;e=10}else{if(e=d+8|0,p[e>>2]=1,n[d+2>>1]=0,(c|0)!=4){var q=e;e=24}else{if((g&255)<3){r=e,e=10}else{var s=e;e=13}}}}while(0);do{if(e==10){if(n[d>>1]=o?1:2,p[d+4>>2]=p[si>>2],(wW(b,d)|0)==0){s=r,e=13}else{f=p[Qh>>2];g=eW(f);if((g|0)==5){m=5;break a}p[b+20>>2]=f;m=g;break a}}}while(0);b:do{if(e==13){if(o){e=d+4|0;p[e>>2]=p[si>>2]+2|0;p[s>>2]=510;(wW(b,d)|0)==0?o=k=0:(k=p[Qh>>2],o=eW(k));p[e>>2]=p[si>>2];p[s>>2]=1;n[d>>1]=3;e=(wW(b,d)|0)!=0&(o|0)==0;do{if(!e){if((o|0)!=0){if((o|0)==5){m=5;break a}else{var u=o,w=k;break}}l[f]=1;k=i+24|0;p[k>>2]=p[k>>2]+1|0;p[i+8>>2]=1;e=30;break b}w=Qh;u=2058;w=p[w>>2]}while(0);p[b+20>>2]=w;m=u;break a}if((c|0)!=4){q=s,e=24}else{if((p[i+8>>2]|0)>1){var v=5;e=32}else{n[d>>1]=2;var x=s,A=p[si>>2];e=26}}}}while(0);if(e==24){if(n[d>>1]=2,i=p[si>>2],(c|0)!=2){x=q,A=i,e=26}else{p[d+4>>2]=i+1|0;var E=1,J=q;e=27}}e==26&&(p[d+4>>2]=A+2|0,E=510,J=x,e=27);do{if(e==27){if(p[J>>2]=E,(wW(b,d)|0)==0){e=30}else{i=p[Qh>>2];k=eW(i);if((k|0)==5){v=5}else{p[b+20>>2]=i;if((k|0)==0){e=30;break}v=k}if((c|0)==4){e=32}else{m=v;break a}}}}while(0);e==30?(m=c&255,l[f]=m,l[j]=m,m=0):e==32&&(l[f]=3,l[j]=3,m=v)}}else{m=0}}while(0);a=d;return m}vW.X=1;function xW(b,c){var d=a;a+=16;var e=b+16|0,f=t[e],g=(f&255|0)>(c|0);a:do{if(g){var h=p[b+8>>2];if((f&255)>1){var i=(c|0)==1,j=d|0;do{if(i){n[j>>1]=1;var k=d+2|0;n[k>>1]=0;var m=d+4|0;p[m>>2]=p[si>>2]+2|0;i=d+8|0;p[i>>2]=510;if((wW(b,d)|0)==0){var o=i;break}p[b+20>>2]=p[Qh>>2];h=2314;break a}k=d+2|0;m=d+4|0;o=d+8|0}while(0);n[j>>1]=3;n[k>>1]=0;p[m>>2]=p[si>>2];p[o>>2]=2;if((wW(b,d)|0)!=0){p[b+20>>2]=p[Qh>>2];h=2058;break}l[h+12|0]=1}if((c|0)==0&&(j=h+8|0,k=p[j>>2]-1|0,p[j>>2]=k,(k|0)==0?(n[d>>1]=3,n[d+2>>1]=0,p[d+8>>2]=0,p[d+4>>2]=0,(wW(b,d)|0)==0?j=l[h+12|0]=0:(p[b+20>>2]=p[Qh>>2],l[h+12|0]=0,l[e]=0,j=2058)):j=0,h=h+24|0,k=p[h>>2]-1|0,p[h>>2]=k,(k|0)==0&&yW(b),(j|0)!=0)){h=j;break}l[e]=c&255}h=0}while(0);a=d;return h}xW.X=1;function wW(b,c){var d=a;a+=16;var e,f=p[b+8>>2],g=l[b+17|0];e=(g&1)<<24>>24==0?l[f+13|0]<<24>>24==0?7:3:3;if(e==3){if((g&2)<<24>>24!=0){e=7}else{g=f+13|0;if(l[g]<<24>>24!=0){var h=0}else{n[d+2>>1]=0,p[d+4>>2]=p[si>>2]+2|0,p[d+8>>2]=510,n[d>>1]=2,e=Gd[p[Mh+88>>2]](p[b+12>>2],8,(z=a,a+=4,p[z>>2]=d,z)),(e|0)<0||(l[g]=1,f=f+24|0,p[f>>2]=p[f>>2]+1|0),h=e}e=8}}e==7&&(h=Gd[p[Mh+88>>2]](p[b+12>>2],8,(z=a,a+=4,p[z>>2]=c,z)));a=d;return h}wW.X=1;function yW(b){var c=p[b+8>>2]+28|0,d=p[c>>2],e=(d|0)==0;a:do{if(!e){for(var f=d;;){var g=p[f+8>>2];iU(b,p[f>>2],26034);Lg(f);if((g|0)==0){break a}f=g}}}while(0);p[c>>2]=0}function yh(b,c){var d=(c|0)>28;a:do{if(d){for(var e=c;;){if(uh(b,R.vc|0,29),e=e-29|0,(e|0)<=28){var f=e;break a}}}else{f=c}}while(0);(f|0)>0&&uh(b,R.vc|0,f)}function Dd(b){var c,d=b>>>0<245;do{if(d){var e=b>>>0<11?16:b+11&-8,f=e>>>3;c=y[zW>>2];var g=c>>>(f>>>0);if((g&3|0)!=0){var h=(g&1^1)+f|0,e=h<<1,i=(e<<2)+zW+40|0,d=(e+2<<2)+zW+40|0,e=y[d>>2],b=e+8|0,j=y[b>>2];(i|0)==(j|0)?p[zW>>2]=c&(1<<h^-1):j>>>0<y[zW+16>>2]>>>0?(AW(),ca("Reached an unreachable!")):(p[d>>2]=j,p[j+12>>2]=i);h<<=3;p[e+4>>2]=h|3;p[(e+(h|4)|0)>>2]|=1;j=b;c=38;break}if(e>>>0<=y[zW+8>>2]>>>0){var k=e;c=30;break}if((g|0)!=0){b=2<<f;b=g<<f&(b|-b);d=(b&-b)-1|0;b=d>>>12&16;j=d>>>(b>>>0);d=j>>>5&8;f=j>>>(d>>>0);j=f>>>2&4;g=f>>>(j>>>0);f=g>>>1&2;g>>>=f>>>0;var m=g>>>1&1,j=(d|b|j|f|m)+(g>>>(m>>>0))|0,b=j<<1,f=(b<<2)+zW+40|0,g=(b+2<<2)+zW+40|0,d=y[g>>2],b=d+8|0,m=y[b>>2];(f|0)==(m|0)?p[zW>>2]=c&(1<<j^-1):m>>>0<y[zW+16>>2]>>>0?(AW(),ca("Reached an unreachable!")):(p[g>>2]=m,p[m+12>>2]=f);j<<=3;c=j-e|0;p[d+4>>2]=e|3;f=d;d=f+e|0;p[f+(e|4)>>2]=c|1;p[f+j>>2]=c;m=y[zW+8>>2];(m|0)!=0&&(e=p[zW+20>>2],f=m>>>2&1073741822,j=(f<<2)+zW+40|0,g=y[zW>>2],m=1<<(m>>>3),(g&m|0)==0?(p[zW>>2]=g|m,h=j,i=(f+2<<2)+zW+40|0):(f=(f+2<<2)+zW+40|0,g=y[f>>2],g>>>0<y[zW+16>>2]>>>0?(AW(),ca("Reached an unreachable!")):(h=g,i=f)),p[i>>2]=e,p[h+12>>2]=e,p[(e+8|0)>>2]=h,p[(e+12|0)>>2]=j);p[zW+8>>2]=c;p[zW+20>>2]=d;j=b;c=38;break}if((p[zW+4>>2]|0)==0){k=e;c=30;break}c=BW(e);if((c|0)==0){k=e;c=30;break}j=c}else{if(b>>>0>4294967231){k=-1;c=30;break}c=b+11&-8;if((p[zW+4>>2]|0)==0){k=c;c=30;break}e=CW(c);if((e|0)==0){k=c;c=30;break}j=e}c=38}while(0);c==30&&(h=y[zW+8>>2],k>>>0>h>>>0?(h=y[zW+12>>2],k>>>0<h>>>0?(h=h-k|0,p[zW+12>>2]=h,i=y[zW+24>>2],p[zW+24>>2]=i+k|0,p[k+(i+4)>>2]=h|1,p[i+4>>2]=k|3,j=i+8|0):j=DW(k)):(i=h-k|0,c=y[zW+20>>2],i>>>0>15?(p[zW+20>>2]=c+k|0,p[zW+8>>2]=i,p[k+(c+4)>>2]=i|1,p[c+h>>2]=i,p[c+4>>2]=k|3):(p[zW+8>>2]=0,p[zW+20>>2]=0,p[c+4>>2]=h|3,p[(h+(c+4)|0)>>2]|=1),j=c+8|0));return j}Dd.X=1;function BW(b){var c,d,e=p[zW+4>>2],f=(e&-e)-1|0,e=f>>>12&16,g=f>>>(e>>>0),f=g>>>5&8;d=g>>>(f>>>0);var g=d>>>2&4,h=d>>>(g>>>0);d=h>>>1&2;h>>>=d>>>0;var i=h>>>1&1,e=f=y[zW+((f|e|g|d|i)+(h>>>(i>>>0))<<2)+304>>2];d=e>>2;f=(p[f+4>>2]&-8)-b|0;a:for(;;){for(g=e;;){h=p[g+16>>2];if((h|0)==0){if(g=p[g+20>>2],(g|0)==0){break a}}else{g=h}h=(p[g+4>>2]&-8)-b|0;if(h>>>0<f>>>0){e=g;d=e>>2;f=h;continue a}}}var h=e,j=y[zW+16>>2],i=h>>>0<j>>>0;do{if(!i){var k=h+b|0,g=k;if(h>>>0<k>>>0){var i=y[d+6],k=y[d+3],m=(k|0)==(e|0);do{if(m){var o=e+20|0,r=p[o>>2];if((r|0)==0&&(o=e+16|0,r=p[o>>2],(r|0)==0)){var q=0;c=q>>2;break}for(;;){var s=r+20|0,u=p[s>>2];if((u|0)==0&&(s=r+16|0,u=y[s>>2],(u|0)==0)){break}o=s;r=u}o>>>0<j>>>0?(AW(),ca("Reached an unreachable!")):(p[o>>2]=0,q=r,c=q>>2)}else{o=y[d+2],o>>>0<j>>>0?(AW(),ca("Reached an unreachable!")):(p[o+12>>2]=k,p[k+8>>2]=o,q=k,c=q>>2)}}while(0);j=(i|0)==0;a:do{if(!j){k=e+28|0;m=(p[k>>2]<<2)+zW+304|0;o=(e|0)==(p[m>>2]|0);do{if(o){p[m>>2]=q;if((q|0)!=0){break}p[zW+4>>2]&=1<<p[k>>2]^-1;break a}if(i>>>0<y[zW+16>>2]>>>0){AW(),ca("Reached an unreachable!")}else{if(r=i+16|0,(p[r>>2]|0)==(e|0)?p[r>>2]=q:p[i+20>>2]=q,(q|0)==0){break a}}}while(0);q>>>0<y[zW+16>>2]>>>0?(AW(),ca("Reached an unreachable!")):(p[c+6]=i,k=y[d+4],(k|0)!=0&&(k>>>0<y[zW+16>>2]>>>0?(AW(),ca("Reached an unreachable!")):(p[c+4]=k,p[k+24>>2]=q)),k=y[d+5],(k|0)!=0&&(k>>>0<y[zW+16>>2]>>>0?(AW(),ca("Reached an unreachable!")):(p[c+5]=k,p[k+24>>2]=q)))}}while(0);if(f>>>0<16){var w=f+b|0;p[d+1]=w|3;p[(w+(h+4)|0)>>2]|=1}else{p[d+1]=b|3;p[b+(h+4)>>2]=f|1;p[h+f+b>>2]=f;h=y[zW+8>>2];if((h|0)!=0){b=y[zW+20>>2];q=h>>>2&1073741822;c=(q<<2)+zW+40|0;d=y[zW>>2];h=1<<(h>>>3);if((d&h|0)==0){p[zW>>2]=d|h;var w=c,v=(q+2<<2)+zW+40|0}else{q=(q+2<<2)+zW+40|0,d=y[q>>2],d>>>0<y[zW+16>>2]>>>0?(AW(),ca("Reached an unreachable!")):(w=d,v=q)}p[v>>2]=b;p[w+12>>2]=b;p[b+8>>2]=w;p[b+12>>2]=c}p[zW+8>>2]=f;p[zW+20>>2]=g}return e+8|0}}}while(0);AW();ca("Reached an unreachable!")}BW.X=1;function DW(b){var c,d;(p[EW>>2]|0)==0&&FW();var e=(p[zW+440>>2]&4|0)==0;do{if(e){d=p[zW+24>>2];if((d|0)==0){d=6}else{if(d=GW(d),(d|0)==0){d=6}else{var f=p[EW+8>>2],f=b+47-p[zW+12>>2]+f&-f;if(f>>>0<2147483647){var g=HW(f);if((g|0)==(p[d>>2]+p[d+4>>2]|0)){var h=g,i=f;c=g;d=13}else{var j=g,k=f;d=15}}else{d=14}}}if(d==6){if(d=HW(0),(d|0)==-1){d=14}else{var f=p[EW+8>>2],f=f+(b+47)&-f,g=d,m=p[EW+4>>2],o=m-1|0,f=(o&g|0)==0?f:f-g+(o+g&-m)|0;f>>>0<2147483647?(g=HW(f),(g|0)==(d|0)?(h=d,i=f,c=g,d=13):(j=g,k=f,d=15)):d=14}}if(d==13){if((h|0)!=-1){var r=i,q=h;d=26;break}j=c;k=i}else{if(d==14){p[zW+440>>2]|=4;d=23;break}}d=-k|0;if((j|0)!=-1&k>>>0<2147483647){if(k>>>0<(b+48|0)>>>0){f=p[EW+8>>2],f=b+47-k+f&-f,f>>>0<2147483647?(HW(f)|0)==-1?(HW(d),d=22):(s=f+k|0,d=21):(s=k,d=21)}else{var s=k;d=21}}else{s=k,d=21}d==21&&(j|0)!=-1?(r=s,q=j,d=26):(p[zW+440>>2]|=4,d=23)}else{d=23}}while(0);d==23&&(e=p[EW+8>>2],e=e+(b+47)&-e,e>>>0<2147483647?(e=HW(e),h=HW(0),(h|0)!=-1&(e|0)!=-1&e>>>0<h>>>0?(h=h-e|0,h>>>0<=(b+40|0)>>>0|(e|0)==-1?d=49:(r=h,q=e,d=26)):d=49):d=49);a:do{if(d==26){e=p[zW+432>>2]+r|0;p[zW+432>>2]=e;e>>>0>y[zW+436>>2]>>>0&&(p[zW+436>>2]=e);e=y[zW+24>>2];h=(e|0)==0;b:do{if(h){i=y[zW+16>>2];(i|0)==0|q>>>0<i>>>0&&(p[zW+16>>2]=q);p[zW+444>>2]=q;p[zW+448>>2]=r;p[zW+456>>2]=0;p[zW+36>>2]=p[EW>>2];p[zW+32>>2]=-1;for(i=0;;){if(c=i<<1,j=(c<<2)+zW+40|0,p[zW+(c+3<<2)+40>>2]=j,p[zW+(c+2<<2)+40>>2]=j,i=i+1|0,(i|0)==32){break}}IW(q,r-40|0)}else{j=zW+444|0;for(c=j>>2;;){if((j|0)==0){break}i=y[c];j=j+4|0;k=y[j>>2];s=i+k|0;if((q|0)==(s|0)){if((p[c+3]&8|0)!=0){break}c=e;if(!(c>>>0>=i>>>0&c>>>0<s>>>0)){break}p[j>>2]=k+r|0;IW(p[zW+24>>2],p[zW+12>>2]+r|0);break b}j=p[c+2];c=j>>2}q>>>0<y[zW+16>>2]>>>0&&(p[zW+16>>2]=q);c=q+r|0;for(j=zW+444|0;;){if((j|0)==0){break}k=j|0;i=y[k>>2];if((i|0)==(c|0)){if((p[j+12>>2]&8|0)!=0){break}p[k>>2]=q;var u=j+4|0;p[u>>2]=p[u>>2]+r|0;u=JW(q,i,b);d=50;break a}j=p[j+8>>2]}KW(q,r)}}while(0);e=y[zW+12>>2];e>>>0>b>>>0?(u=e-b|0,p[zW+12>>2]=u,h=e=y[zW+24>>2],p[zW+24>>2]=h+b|0,p[b+(h+4)>>2]=u|1,p[e+4>>2]=b|3,u=e+8|0,d=50):d=49}}while(0);d==49&&(p[Qh>>2]=12,u=0);return u}DW.X=1;function CW(b){var c,d,e,f,g,h=b>>2,i=-b|0,j=b>>>8;if((j|0)==0){var k=0}else{if(b>>>0>16777215){k=31}else{var m=(j+1048320|0)>>>16&8,o=j<<m,r=(o+520192|0)>>>16&4,q=o<<r,s=(q+245760|0)>>>16&2,u=14-(r|m|s)+(q<<s>>>15)|0,k=b>>>((u+7|0)>>>0)&1|u<<1}}var w=y[zW+(k<<2)+304>>2],v=(w|0)==0;a:do{if(v){var x=0,A=i,E=0}else{var J=(k|0)==31?0:25-(k>>>1)|0,M=0,D=i,K=w;g=K>>2;for(var H=b<<J,N=0;;){var Q=p[g+1]&-8,P=Q-b|0;if(P>>>0<D>>>0){if((Q|0)==(b|0)){x=K;A=P;E=K;break a}var L=K,I=P}else{L=M,I=D}var X=y[g+5],Y=y[((H>>>31<<2)+16>>2)+g],da=(X|0)==0|(X|0)==(Y|0)?N:X;if((Y|0)==0){x=L;A=I;E=da;break a}M=L;D=I;K=Y;g=K>>2;H<<=1;N=da}}}while(0);if((E|0)==0&(x|0)==0){var ga=2<<k,ha=p[zW+4>>2]&(ga|-ga);if((ha|0)==0){var ba=E}else{var ea=(ha&-ha)-1|0,ja=ea>>>12&16,ra=ea>>>(ja>>>0),Va=ra>>>5&8,ta=ra>>>(Va>>>0),xa=ta>>>2&4,Fa=ta>>>(xa>>>0),Na=Fa>>>1&2,Ea=Fa>>>(Na>>>0),La=Ea>>>1&1,ba=p[zW+((Va|ja|xa|Na|La)+(Ea>>>(La>>>0))<<2)+304>>2]}}else{ba=E}var za=(ba|0)==0;a:do{if(za){var Ba=A,Ja=x;f=Ja>>2}else{var ka=ba;e=ka>>2;for(var S=A,ib=x;;){var Wa=(p[e+1]&-8)-b|0,Za=Wa>>>0<S>>>0,Sa=Za?Wa:S,tb=Za?ka:ib,pb=y[e+4];if((pb|0)!=0){ka=pb}else{var fb=y[e+5];if((fb|0)==0){Ba=Sa;Ja=tb;f=Ja>>2;break a}ka=fb}e=ka>>2;S=Sa;ib=tb}}}while(0);var Xa=(Ja|0)==0;a:do{if(Xa){var Ab=0}else{if(Ba>>>0<(p[zW+8>>2]-b|0)>>>0){var rb=Ja;d=rb>>2;var cb=y[zW+16>>2],Cb=rb>>>0<cb>>>0;do{if(!Cb){var Zb=rb+b|0,dc=Zb;if(rb>>>0<Zb>>>0){var kb=y[f+6],Oa=y[f+3],Db=(Oa|0)==(Ja|0);do{if(Db){var Wb=Ja+20|0,Nb=p[Wb>>2];if((Nb|0)==0){var $b=Ja+16|0,Rb=p[$b>>2];if((Rb|0)==0){var Ra=0;c=Ra>>2;break}var Ob=$b,Ua=Rb}else{Ob=Wb,Ua=Nb}for(;;){var Jb=Ua+20|0,Vb=p[Jb>>2];if((Vb|0)!=0){Ob=Jb,Ua=Vb}else{var Pb=Ua+16|0,sb=y[Pb>>2];if((sb|0)==0){break}Ob=Pb;Ua=sb}}Ob>>>0<cb>>>0?(AW(),ca("Reached an unreachable!")):(p[Ob>>2]=0,Ra=Ua,c=Ra>>2)}else{var db=y[f+2];db>>>0<cb>>>0?(AW(),ca("Reached an unreachable!")):(p[db+12>>2]=Oa,p[Oa+8>>2]=db,Ra=Oa,c=Ra>>2)}}while(0);var wb=(kb|0)==0;b:do{if(!wb){var ob=Ja+28|0,Kb=(p[ob>>2]<<2)+zW+304|0,ub=(Ja|0)==(p[Kb>>2]|0);do{if(ub){p[Kb>>2]=Ra;if((Ra|0)!=0){break}p[zW+4>>2]&=1<<p[ob>>2]^-1;break b}if(kb>>>0<y[zW+16>>2]>>>0){AW(),ca("Reached an unreachable!")}else{var Xb=kb+16|0;(p[Xb>>2]|0)==(Ja|0)?p[Xb>>2]=Ra:p[kb+20>>2]=Ra;if((Ra|0)==0){break b}}}while(0);if(Ra>>>0<y[zW+16>>2]>>>0){AW(),ca("Reached an unreachable!")}else{p[c+6]=kb;var Sb=y[f+4];(Sb|0)!=0&&(Sb>>>0<y[zW+16>>2]>>>0?(AW(),ca("Reached an unreachable!")):(p[c+4]=Sb,p[Sb+24>>2]=Ra));var Qb=y[f+5];(Qb|0)!=0&&(Qb>>>0<y[zW+16>>2]>>>0?(AW(),ca("Reached an unreachable!")):(p[c+5]=Qb,p[Qb+24>>2]=Ra))}}}while(0);var ac=Ba>>>0<16;b:do{if(ac){var Gb=Ba+b|0;p[f+1]=Gb|3;p[(Gb+(rb+4)|0)>>2]|=1}else{if(p[f+1]=b|3,p[h+(d+1)]=Ba|1,p[(Ba>>2)+d+h]=Ba,Ba>>>0<256){var xb=Ba>>>2&1073741822,Ta=(xb<<2)+zW+40|0,qb=y[zW>>2],bc=1<<(Ba>>>3);if((qb&bc|0)==0){p[zW>>2]=qb|bc;var $a=Ta,mb=(xb+2<<2)+zW+40|0}else{var Bb=(xb+2<<2)+zW+40|0,bb=y[Bb>>2];bb>>>0<y[zW+16>>2]>>>0?(AW(),ca("Reached an unreachable!")):($a=bb,mb=Bb)}p[mb>>2]=dc;p[$a+12>>2]=dc;p[h+(d+2)]=$a;p[h+(d+3)]=Ta}else{var jb=Zb,nb=Ba>>>8;if((nb|0)==0){var zb=0}else{if(Ba>>>0>16777215){zb=31}else{var Tb=(nb+1048320|0)>>>16&8,ec=nb<<Tb,Hb=(ec+520192|0)>>>16&4,Eb=ec<<Hb,Lb=(Eb+245760|0)>>>16&2,gb=14-(Hb|Tb|Lb)+(Eb<<Lb>>>15)|0,zb=Ba>>>((gb+7|0)>>>0)&1|gb<<1}}var Mb=(zb<<2)+zW+304|0;p[h+(d+7)]=zb;var vc=b+(rb+16)|0;p[h+(d+5)]=0;p[vc>>2]=0;var hc=p[zW+4>>2],kc=1<<zb;if((hc&kc|0)==0){p[zW+4>>2]=hc|kc,p[Mb>>2]=jb,p[h+(d+6)]=Mb,p[h+(d+3)]=jb,p[h+(d+2)]=jb}else{for(var pc=Ba<<((zb|0)==31?0:25-(zb>>>1)|0),jc=p[Mb>>2];;){if((p[jc+4>>2]&-8|0)==(Ba|0)){var mc=jc+8|0,Fb=y[mc>>2],Ub=y[zW+16>>2],Ya=jc>>>0<Ub>>>0;do{if(!Ya&&Fb>>>0>=Ub>>>0){p[Fb+12>>2]=jb;p[mc>>2]=jb;p[h+(d+2)]=Fb;p[h+(d+3)]=jc;p[h+(d+6)]=0;break b}}while(0);AW();ca("Reached an unreachable!")}else{var Pa=(pc>>>31<<2)+jc+16|0,yb=y[Pa>>2];if((yb|0)==0){if(Pa>>>0>=y[zW+16>>2]>>>0){p[Pa>>2]=jb;p[h+(d+6)]=jc;p[h+(d+3)]=jb;p[h+(d+2)]=jb;break b}AW();ca("Reached an unreachable!")}else{pc<<=1,jc=yb}}}}}}}while(0);Ab=Ja+8|0;break a}}}while(0);AW();ca("Reached an unreachable!")}else{Ab=0}}}while(0);return Ab}CW.X=1;function LW(){var b;(p[EW>>2]|0)==0&&FW();var c=y[zW+24>>2],d=(c|0)==0;a:do{if(!d){var e=y[zW+12>>2],f=e>>>0>40;do{if(f){var g=y[EW+8>>2],h=(Math.floor(((e-41+g|0)>>>0)/(g>>>0))-1)*g|0,i=GW(c);if((p[i+12>>2]&8|0)==0){var j=HW(0);b=(i+4|0)>>2;if((j|0)==(p[i>>2]+p[b]|0)&&(h=HW(-(h>>>0>2147483646?-2147483648-g|0:h)|0),g=HW(0),(h|0)!=-1&g>>>0<j>>>0&&(h=j-g|0,(j|0)!=(g|0)))){p[b]=p[b]-h|0;p[zW+432>>2]=p[zW+432>>2]-h|0;IW(p[zW+24>>2],p[zW+12>>2]-h|0);break a}}}}while(0);y[zW+12>>2]>>>0>y[zW+28>>2]>>>0&&(p[zW+28>>2]=-1)}}while(0)}LW.X=1;function DS(b){var c,d,e,f,g,h,i=b>>2,j,k=(b|0)==0;a:do{if(!k){var m=b-8|0,o=m,r=y[zW+16>>2],q=m>>>0<r>>>0;b:do{if(!q){var s=y[b-4>>2],u=s&3;if((u|0)!=1){var w=s&-8;h=w>>2;var v=b+(w-8)|0,x=v,A=(s&1|0)==0;c:do{if(A){var E=y[m>>2];if((u|0)==0){break a}var J=-8-E|0;g=J>>2;var M=b+J|0,D=M,K=E+w|0;if(M>>>0<r>>>0){break b}if((D|0)==(p[zW+20>>2]|0)){f=(b+(w-4)|0)>>2;if((p[f]&3|0)!=3){var H=D;e=H>>2;var N=K;break}p[zW+8>>2]=K;p[f]&=-2;p[g+(i+1)]=K|1;p[v>>2]=K;break a}if(E>>>0<256){var Q=y[g+(i+2)],P=y[g+(i+3)];if((Q|0)==(P|0)){p[zW>>2]&=1<<(E>>>3)^-1,H=D,e=H>>2,N=K}else{var L=((E>>>2&1073741822)<<2)+zW+40|0,I=(Q|0)!=(L|0)&Q>>>0<r>>>0;do{if(!I&&(P|0)==(L|0)|P>>>0>=r>>>0){p[Q+12>>2]=P;p[P+8>>2]=Q;H=D;e=H>>2;N=K;break c}}while(0);AW();ca("Reached an unreachable!")}}else{var X=M,Y=y[g+(i+6)],da=y[g+(i+3)],ga=(da|0)==(X|0);do{if(ga){var ha=J+(b+20)|0,ba=p[ha>>2];if((ba|0)==0){var ea=J+(b+16)|0,ja=p[ea>>2];if((ja|0)==0){var ra=0;d=ra>>2;break}var Va=ea,ta=ja}else{Va=ha,ta=ba,j=21}for(;;){var xa=ta+20|0,Fa=p[xa>>2];if((Fa|0)!=0){Va=xa,ta=Fa}else{var Na=ta+16|0,Ea=y[Na>>2];if((Ea|0)==0){break}Va=Na;ta=Ea}}Va>>>0<r>>>0?(AW(),ca("Reached an unreachable!")):(p[Va>>2]=0,ra=ta,d=ra>>2)}else{var La=y[g+(i+2)];La>>>0<r>>>0?(AW(),ca("Reached an unreachable!")):(p[La+12>>2]=da,p[da+8>>2]=La,ra=da,d=ra>>2)}}while(0);if((Y|0)==0){H=D,e=H>>2,N=K}else{var za=J+(b+28)|0,Ba=(p[za>>2]<<2)+zW+304|0,Ja=(X|0)==(p[Ba>>2]|0);do{if(Ja){p[Ba>>2]=ra;if((ra|0)!=0){break}p[zW+4>>2]&=1<<p[za>>2]^-1;H=D;e=H>>2;N=K;break c}if(Y>>>0<y[zW+16>>2]>>>0){AW(),ca("Reached an unreachable!")}else{var ka=Y+16|0;(p[ka>>2]|0)==(X|0)?p[ka>>2]=ra:p[Y+20>>2]=ra;if((ra|0)==0){H=D;e=H>>2;N=K;break c}}}while(0);if(ra>>>0<y[zW+16>>2]>>>0){AW(),ca("Reached an unreachable!")}else{p[d+6]=Y;var S=y[g+(i+4)];(S|0)!=0&&(S>>>0<y[zW+16>>2]>>>0?(AW(),ca("Reached an unreachable!")):(p[d+4]=S,p[S+24>>2]=ra));var ib=y[g+(i+5)];(ib|0)==0?(H=D,e=H>>2,N=K):ib>>>0<y[zW+16>>2]>>>0?(AW(),ca("Reached an unreachable!")):(p[d+5]=ib,p[ib+24>>2]=ra,H=D,e=H>>2,N=K)}}}}else{H=o,e=H>>2,N=w}}while(0);var Wa=H;if(Wa>>>0<v>>>0){var Za=b+(w-4)|0,Sa=y[Za>>2];if((Sa&1|0)!=0){var tb=(Sa&2|0)==0;do{if(tb){if((x|0)==(p[zW+24>>2]|0)){var pb=p[zW+12>>2]+N|0;p[zW+12>>2]=pb;p[zW+24>>2]=H;p[e+1]=pb|1;(H|0)==(p[zW+20>>2]|0)&&(p[zW+20>>2]=0,p[zW+8>>2]=0);if(pb>>>0<=y[zW+28>>2]>>>0){break a}LW();break a}if((x|0)==(p[zW+20>>2]|0)){var fb=p[zW+8>>2]+N|0;p[zW+8>>2]=fb;p[zW+20>>2]=H;p[e+1]=fb|1;p[(Wa+fb|0)>>2]=fb;break a}var Xa=(Sa&-8)+N|0,Ab=Sa>>>3,rb=Sa>>>0<256;c:do{if(rb){var cb=y[i+h],Cb=y[((w|4)>>2)+i];if((cb|0)==(Cb|0)){p[zW>>2]&=1<<Ab^-1}else{var Zb=((Sa>>>2&1073741822)<<2)+zW+40|0;j=(cb|0)==(Zb|0)?63:cb>>>0<y[zW+16>>2]>>>0?66:63;do{if(j==63&&!((Cb|0)!=(Zb|0)&&Cb>>>0<y[zW+16>>2]>>>0)){p[cb+12>>2]=Cb;p[Cb+8>>2]=cb;break c}}while(0);AW();ca("Reached an unreachable!")}}else{var dc=v,kb=y[h+(i+4)],Oa=y[((w|4)>>2)+i],Db=(Oa|0)==(dc|0);do{if(Db){var Wb=w+(b+12)|0,Nb=p[Wb>>2];if((Nb|0)==0){var $b=w+(b+8)|0,Rb=p[$b>>2];if((Rb|0)==0){var Ra=0;c=Ra>>2;break}var Ob=$b,Ua=Rb}else{Ob=Wb,Ua=Nb,j=73}for(;;){var Jb=Ua+20|0,Vb=p[Jb>>2];if((Vb|0)!=0){Ob=Jb,Ua=Vb}else{var Pb=Ua+16|0,sb=y[Pb>>2];if((sb|0)==0){break}Ob=Pb;Ua=sb}}Ob>>>0<y[zW+16>>2]>>>0?(AW(),ca("Reached an unreachable!")):(p[Ob>>2]=0,Ra=Ua,c=Ra>>2)}else{var db=y[i+h];db>>>0<y[zW+16>>2]>>>0?(AW(),ca("Reached an unreachable!")):(p[db+12>>2]=Oa,p[Oa+8>>2]=db,Ra=Oa,c=Ra>>2)}}while(0);if((kb|0)!=0){var wb=w+(b+20)|0,ob=(p[wb>>2]<<2)+zW+304|0,Kb=(dc|0)==(p[ob>>2]|0);do{if(Kb){p[ob>>2]=Ra;if((Ra|0)!=0){break}p[zW+4>>2]&=1<<p[wb>>2]^-1;break c}if(kb>>>0<y[zW+16>>2]>>>0){AW(),ca("Reached an unreachable!")}else{var ub=kb+16|0;(p[ub>>2]|0)==(dc|0)?p[ub>>2]=Ra:p[kb+20>>2]=Ra;if((Ra|0)==0){break c}}}while(0);if(Ra>>>0<y[zW+16>>2]>>>0){AW(),ca("Reached an unreachable!")}else{p[c+6]=kb;var Xb=y[h+(i+2)];(Xb|0)!=0&&(Xb>>>0<y[zW+16>>2]>>>0?(AW(),ca("Reached an unreachable!")):(p[c+4]=Xb,p[Xb+24>>2]=Ra));var Sb=y[h+(i+3)];(Sb|0)!=0&&(Sb>>>0<y[zW+16>>2]>>>0?(AW(),ca("Reached an unreachable!")):(p[c+5]=Sb,p[Sb+24>>2]=Ra))}}}}while(0);p[e+1]=Xa|1;p[Wa+Xa>>2]=Xa;if((H|0)!=(p[zW+20>>2]|0)){var Qb=Xa}else{p[zW+8>>2]=Xa;break a}}else{p[Za>>2]=Sa&-2,p[e+1]=N|1,Qb=p[Wa+N>>2]=N}}while(0);if(Qb>>>0<256){var ac=Qb>>>2&1073741822,Gb=(ac<<2)+zW+40|0,xb=y[zW>>2],Ta=1<<(Qb>>>3);if((xb&Ta|0)==0){p[zW>>2]=xb|Ta;var qb=Gb,bc=(ac+2<<2)+zW+40|0}else{var $a=(ac+2<<2)+zW+40|0,mb=y[$a>>2];mb>>>0<y[zW+16>>2]>>>0?(AW(),ca("Reached an unreachable!")):(qb=mb,bc=$a)}p[bc>>2]=H;p[qb+12>>2]=H;p[e+2]=qb;p[e+3]=Gb;break a}var Bb=H,bb=Qb>>>8;if((bb|0)==0){var jb=0}else{if(Qb>>>0>16777215){jb=31}else{var nb=(bb+1048320|0)>>>16&8,zb=bb<<nb,Tb=(zb+520192|0)>>>16&4,ec=zb<<Tb,Hb=(ec+245760|0)>>>16&2,Eb=14-(Tb|nb|Hb)+(ec<<Hb>>>15)|0,jb=Qb>>>((Eb+7|0)>>>0)&1|Eb<<1}}var Lb=(jb<<2)+zW+304|0;p[e+7]=jb;p[e+5]=0;p[e+4]=0;var gb=p[zW+4>>2],Mb=1<<jb,vc=(gb&Mb|0)==0;c:do{if(vc){p[zW+4>>2]=gb|Mb,p[Lb>>2]=Bb,p[e+6]=Lb,p[e+3]=H,p[e+2]=H}else{for(var hc=Qb<<((jb|0)==31?0:25-(jb>>>1)|0),kc=p[Lb>>2];;){if((p[kc+4>>2]&-8|0)==(Qb|0)){var pc=kc+8|0,jc=y[pc>>2],mc=y[zW+16>>2],Fb=kc>>>0<mc>>>0;do{if(!Fb&&jc>>>0>=mc>>>0){p[jc+12>>2]=Bb;p[pc>>2]=Bb;p[e+2]=jc;p[e+3]=kc;p[e+6]=0;break c}}while(0);AW();ca("Reached an unreachable!")}else{var Ub=(hc>>>31<<2)+kc+16|0,Ya=y[Ub>>2];if((Ya|0)==0){if(Ub>>>0>=y[zW+16>>2]>>>0){p[Ub>>2]=Bb;p[e+6]=kc;p[e+3]=H;p[e+2]=H;break c}AW();ca("Reached an unreachable!")}else{hc<<=1,kc=Ya}}}}}while(0);var Pa=p[zW+32>>2]-1|0;p[zW+32>>2]=Pa;if((Pa|0)!=0){break a}var yb=p[zW+452>>2],Ka=(yb|0)==0;c:do{if(!Ka){for(var Ac=yb;;){var Jc=p[Ac+8>>2];if((Jc|0)==0){break c}Ac=Jc}}}while(0);p[zW+32>>2]=-1;break a}}}}}while(0);AW();ca("Reached an unreachable!")}}while(0)}DS.X=1;function GW(b){var c,d=zW+444|0;for(c=d>>2;;){var e=y[c];if(e>>>0<=b>>>0&&(e+p[c+1]|0)>>>0>b>>>0){var f=d;break}c=y[c+2];if((c|0)==0){f=0;break}d=c;c=d>>2}return f}function IW(b,c){var d=b+8|0,d=(d&7|0)==0?0:-d&7,e=c-d|0;p[zW+24>>2]=b+d|0;p[zW+12>>2]=e;p[d+(b+4)>>2]=e|1;p[c+(b+4)>>2]=40;p[zW+28>>2]=p[EW+16>>2]}function MW(b,c){var d,e,f,g=c>>>0>4294967231;a:do{if(g){p[Qh>>2]=12;var h=0}else{f=d=b-8|0;e=(b-4|0)>>2;var i=y[e],j=i&-8,k=j-8|0,m=b+k|0,o=d>>>0<y[zW+16>>2]>>>0;do{if(!o){var r=i&3;if((r|0)!=1&(k|0)>-8&&(d=(b+(j-4)|0)>>2,(p[d]&1|0)!=0)){g=c>>>0<11?16:c+11&-8;if((r|0)==0){var q=0,s,i=p[f+4>>2]&-8;s=g>>>0<256?0:i>>>0>=(g+4|0)>>>0&&(i-g|0)>>>0<=p[EW+8>>2]<<1>>>0?f:0;f=17}else{j>>>0<g>>>0?(m|0)!=(p[zW+24>>2]|0)?f=21:(d=p[zW+12>>2]+j|0,d>>>0>g>>>0?(q=d-g|0,s=b+(g-8)|0,p[e]=g|i&1|2,p[b+(g-4)>>2]=q|1,p[zW+24>>2]=s,p[zW+12>>2]=q,q=0,s=f,f=17):f=21):(q=j-g|0,q>>>0>15?(p[e]=g|i&1|2,p[b+(g-4)>>2]=q|3,p[d]|=1,q=b+g|0):q=0,s=f,f=17)}do{if(f==17&&(s|0)!=0){(q|0)!=0&&DS(q);h=s+8|0;break a}}while(0);f=Dd(c);if((f|0)==0){h=0;break a}e=j-((p[e]&3|0)==0?8:4)|0;Ah(f,b,e>>>0<c>>>0?e:c);DS(b);h=f;break a}}}while(0);AW();ca("Reached an unreachable!")}}while(0);return h}MW.X=1;function FW(){if((p[EW>>2]|0)==0){var b=NW();(b-1&b|0)==0?(p[EW+8>>2]=b,p[EW+4>>2]=b,p[EW+12>>2]=-1,p[EW+16>>2]=2097152,p[EW+20>>2]=0,p[zW+440>>2]=0,b=OW(0),p[EW>>2]=b&-16^1431655768):(AW(),ca("Reached an unreachable!"))}}function JW(b,c,d){var e,f,g,h=c>>2,i=b>>2,j,k=b+8|0,k=(k&7|0)==0?0:-k&7;f=c+8|0;var m=(f&7|0)==0?0:-f&7;g=m>>2;var o=c+m|0,r=k+d|0;f=r>>2;var q=b+r|0,s=o-(b+k)-d|0;p[(k+4>>2)+i]=d|3;d=(o|0)==(p[zW+24>>2]|0);a:do{if(d){var u=p[zW+12>>2]+s|0;p[zW+12>>2]=u;p[zW+24>>2]=q;p[f+(i+1)]=u|1}else{if((o|0)==(p[zW+20>>2]|0)){u=p[zW+8>>2]+s|0,p[zW+8>>2]=u,p[zW+20>>2]=q,p[f+(i+1)]=u|1,p[(b+u+r|0)>>2]=u}else{var w=y[g+(h+1)];if((w&3|0)==1){var u=w&-8,v=w>>>3,x=w>>>0<256;b:do{if(x){var A=y[((m|8)>>2)+h],E=y[g+(h+3)];if((A|0)==(E|0)){p[zW>>2]&=1<<v^-1}else{var J=((w>>>2&1073741822)<<2)+zW+40|0;j=(A|0)==(J|0)?15:A>>>0<y[zW+16>>2]>>>0?18:15;do{if(j==15&&!((E|0)!=(J|0)&&E>>>0<y[zW+16>>2]>>>0)){p[A+12>>2]=E;p[E+8>>2]=A;break b}}while(0);AW();ca("Reached an unreachable!")}}else{j=o;A=y[((m|24)>>2)+h];E=y[g+(h+3)];J=(E|0)==(j|0);do{if(J){var M=m|16,D=M+(c+4)|0,K=p[D>>2];if((K|0)==0){if(M=c+M|0,K=p[M>>2],(K|0)==0){var H=0;e=H>>2;break}}else{M=D}for(;;){var D=K+20|0,N=p[D>>2];if((N|0)==0&&(D=K+16|0,N=y[D>>2],(N|0)==0)){break}M=D;K=N}M>>>0<y[zW+16>>2]>>>0?(AW(),ca("Reached an unreachable!")):(p[M>>2]=0,H=K,e=H>>2)}else{M=y[((m|8)>>2)+h],M>>>0<y[zW+16>>2]>>>0?(AW(),ca("Reached an unreachable!")):(p[M+12>>2]=E,p[E+8>>2]=M,H=E,e=H>>2)}}while(0);if((A|0)!=0){E=m+(c+28)|0;J=(p[E>>2]<<2)+zW+304|0;M=(j|0)==(p[J>>2]|0);do{if(M){p[J>>2]=H;if((H|0)!=0){break}p[zW+4>>2]&=1<<p[E>>2]^-1;break b}if(A>>>0<y[zW+16>>2]>>>0){AW(),ca("Reached an unreachable!")}else{if(K=A+16|0,(p[K>>2]|0)==(j|0)?p[K>>2]=H:p[A+20>>2]=H,(H|0)==0){break b}}}while(0);H>>>0<y[zW+16>>2]>>>0?(AW(),ca("Reached an unreachable!")):(p[e+6]=A,j=m|16,A=y[(j>>2)+h],(A|0)!=0&&(A>>>0<y[zW+16>>2]>>>0?(AW(),ca("Reached an unreachable!")):(p[e+4]=A,p[A+24>>2]=H)),j=y[(j+4>>2)+h],(j|0)!=0&&(j>>>0<y[zW+16>>2]>>>0?(AW(),ca("Reached an unreachable!")):(p[e+5]=j,p[j+24>>2]=H)))}}}while(0);w=c+(u|m)|0;u=u+s|0}else{w=o,u=s}p[(w+4|0)>>2]&=-2;p[f+(i+1)]=u|1;p[(u>>2)+i+f]=u;if(u>>>0<256){v=u>>>2&1073741822;w=(v<<2)+zW+40|0;x=y[zW>>2];u=1<<(u>>>3);if((x&u|0)==0){p[zW>>2]=x|u;var Q=w,P=(v+2<<2)+zW+40|0}else{u=(v+2<<2)+zW+40|0,v=y[u>>2],v>>>0<y[zW+16>>2]>>>0?(AW(),ca("Reached an unreachable!")):(Q=v,P=u)}p[P>>2]=q;p[Q+12>>2]=q;p[f+(i+2)]=Q;p[f+(i+3)]=w}else{if(w=q,x=u>>>8,(x|0)==0?v=0:u>>>0>16777215?v=31:(v=(x+1048320|0)>>>16&8,j=x<<v,x=(j+520192|0)>>>16&4,j<<=x,A=(j+245760|0)>>>16&2,v=14-(x|v|A)+(j<<A>>>15)|0,v=u>>>((v+7|0)>>>0)&1|v<<1),x=(v<<2)+zW+304|0,p[f+(i+7)]=v,j=r+(b+16)|0,p[f+(i+5)]=0,p[j>>2]=0,j=p[zW+4>>2],A=1<<v,(j&A|0)==0){p[zW+4>>2]=j|A,p[x>>2]=w,p[f+(i+6)]=x,p[f+(i+3)]=w,p[f+(i+2)]=w}else{v=u<<((v|0)==31?0:25-(v>>>1)|0);for(x=p[x>>2];;){if((p[x+4>>2]&-8|0)==(u|0)){j=x+8|0;A=y[j>>2];E=y[zW+16>>2];J=x>>>0<E>>>0;do{if(!J&&A>>>0>=E>>>0){p[A+12>>2]=w;p[j>>2]=w;p[f+(i+2)]=A;p[f+(i+3)]=x;p[f+(i+6)]=0;break a}}while(0);AW();ca("Reached an unreachable!")}else{if(j=(v>>>31<<2)+x+16|0,A=y[j>>2],(A|0)==0){if(j>>>0>=y[zW+16>>2]>>>0){p[j>>2]=w;p[f+(i+6)]=x;p[f+(i+3)]=w;p[f+(i+2)]=w;break a}AW();ca("Reached an unreachable!")}else{v<<=1,x=A}}}}}}}}while(0);return b+(k|8)|0}JW.X=1;function KW(b,c){var d,e,f=y[zW+24>>2];e=f>>2;var g=GW(f),h=p[g>>2];d=p[g+4>>2];var g=h+d|0,i=h+(d-39)|0,h=h+(d-47)+((i&7|0)==0?0:-i&7)|0,h=h>>>0<(f+16|0)>>>0?f:h,i=h+8|0;d=i>>2;IW(b,c-40|0);p[(h+4|0)>>2]=27;p[d]=p[zW+444>>2];p[d+1]=p[zW+448>>2];p[d+2]=p[zW+452>>2];p[d+3]=p[zW+456>>2];p[zW+444>>2]=b;p[zW+448>>2]=c;p[zW+456>>2]=0;p[zW+452>>2]=i;d=h+28|0;p[d>>2]=7;i=(h+32|0)>>>0<g>>>0;a:do{if(i){for(var j=d;;){var k=j+4|0;p[k>>2]=7;if((j+8|0)>>>0>=g>>>0){break a}j=k}}}while(0);g=(h|0)==(f|0);a:do{if(!g){if(d=h-f|0,i=f+d|0,p[(d+(f+4)|0)>>2]&=-2,p[e+1]=d|1,p[i>>2]=d,d>>>0<256){j=d>>>2&1073741822;i=(j<<2)+zW+40|0;k=y[zW>>2];d=1<<(d>>>3);if((k&d|0)==0){p[zW>>2]=k|d;var m=i,o=(j+2<<2)+zW+40|0}else{d=(j+2<<2)+zW+40|0,j=y[d>>2],j>>>0<y[zW+16>>2]>>>0?(AW(),ca("Reached an unreachable!")):(m=j,o=d)}p[o>>2]=f;p[m+12>>2]=f;p[e+2]=m;p[e+3]=i}else{i=f;k=d>>>8;if((k|0)==0){j=0}else{if(d>>>0>16777215){j=31}else{var j=(k+1048320|0)>>>16&8,r=k<<j,k=(r+520192|0)>>>16&4;r<<=k;var q=(r+245760|0)>>>16&2,j=14-(k|j|q)+(r<<q>>>15)|0,j=d>>>((j+7|0)>>>0)&1|j<<1}}k=(j<<2)+zW+304|0;p[e+7]=j;p[e+5]=0;p[e+4]=0;r=p[zW+4>>2];q=1<<j;if((r&q|0)==0){p[zW+4>>2]=r|q,p[k>>2]=i,p[e+6]=k,p[e+3]=f,p[e+2]=f}else{j=d<<((j|0)==31?0:25-(j>>>1)|0);for(k=p[k>>2];;){if((p[k+4>>2]&-8|0)==(d|0)){var r=k+8|0,q=y[r>>2],s=y[zW+16>>2],u=k>>>0<s>>>0;do{if(!u&&q>>>0>=s>>>0){p[q+12>>2]=i;p[r>>2]=i;p[e+2]=q;p[e+3]=k;p[e+6]=0;break a}}while(0);AW();ca("Reached an unreachable!")}else{if(r=(j>>>31<<2)+k+16|0,q=y[r>>2],(q|0)==0){if(r>>>0>=y[zW+16>>2]>>>0){p[r>>2]=i;p[e+6]=k;p[e+3]=f;p[e+2]=f;break a}AW();ca("Reached an unreachable!")}else{j<<=1,k=q}}}}}}}while(0)}KW.X=1;var T=(function(){function b(b,c){this.h=b|0;this.l=c|0}function c(b,c){b!=la&&("number"==typeof b?this.u(b):c==la&&"string"!=typeof b?this.F(b,256):this.F(b,c))}function d(){return new c(la)}function e(b,c){var d=g[b.charCodeAt(c)];return d==la?-1:d}function f(b){var c=d();c.J(b);return c}b.Ta={};b.J=(function(c){if(-128<=c&&c<128){var d=b.Ta[c];if(d){return d}}d=new b(c|0,c<0?-1:0);-128<=c&&c<128&&(b.Ta[c]=d);return d});b.u=(function(c){return isNaN(c)||!isFinite(c)?b.ZERO:c<=-b.Wa?b.MIN_VALUE:c+1>=b.Wa?b.MAX_VALUE:c<0?b.u(-c).m():new b(c%b.H|0,c/b.H|0)});b.D=(function(c,d){return new b(c,d)});b.F=(function(c,d){c.length==0&&ca(Error("number format error: empty string"));var e=d||10;(e<2||36<e)&&ca(Error("radix out of range: "+e));if(c.charAt(0)=="-"){return b.F(c.substring(1),e).m()}else{c.indexOf("-")>=0&&ca(Error('number format error: interior "-" character: '+c))}for(var f=b.u(Math.pow(e,8)),g=b.ZERO,h=0;h<c.length;h+=8){var i=Math.min(8,c.length-h),j=parseInt(c.substring(h,h+i),e);i<8?(i=b.u(Math.pow(e,i)),g=g.multiply(i).add(b.u(j))):(g=g.multiply(f),g=g.add(b.u(j)))}return g});b.wa=65536;b.Ir=16777216;b.H=b.wa*b.wa;b.Jr=b.H/2;b.Kr=b.H*b.wa;b.Tc=b.H*b.H;b.Wa=b.Tc/2;b.ZERO=b.J(0);b.ONE=b.J(1);b.Ua=b.J(-1);b.MAX_VALUE=b.D(-1,2147483647);b.MIN_VALUE=b.D(0,-2147483648);b.Va=b.J(16777216);b.prototype.va=(function(){return this.l*b.H+this.xr()});b.prototype.toString=(function(c){c=c||10;(c<2||36<c)&&ca(Error("radix out of range: "+c));if(this.K()){return"0"}if(this.s()){if(this.t(b.MIN_VALUE)){var d=b.u(c),e=this.C(d),d=e.multiply(d).b(this);return e.toString(c)+d.h.toString(c)}else{return"-"+this.m().toString(c)}}for(var e=b.u(Math.pow(c,6)),d=this,f="";;){var g=d.C(e),h=d.b(g.multiply(e)).h.toString(c),d=g;if(d.K()){return h+f}else{for(;h.length<6;){h="0"+h}f=""+h+f}}});b.prototype.xr=(function(){return this.h>=0?this.h:b.H+this.h});b.prototype.K=(function(){return this.l==0&&this.h==0});b.prototype.s=(function(){return this.l<0});b.prototype.Ic=(function(){return(this.h&1)==1});b.prototype.t=(function(b){return this.l==b.l&&this.h==b.h});b.prototype.Mc=(function(b){return this.Ka(b)<0});b.prototype.yr=(function(b){return this.Ka(b)>0});b.prototype.zr=(function(b){return this.Ka(b)>=0});b.prototype.Ka=(function(b){if(this.t(b)){return 0}var c=this.s(),d=b.s();return c&&!d?-1:!c&&d?1:this.b(b).s()?-1:1});b.prototype.m=(function(){return this.t(b.MIN_VALUE)?b.MIN_VALUE:this.Br().add(b.ONE)});b.prototype.add=(function(c){var d=this.l>>>16,e=this.l&65535,f=this.h>>>16,g=c.l>>>16,h=c.l&65535,i=c.h>>>16,j=0,v=0,x=0,A=0;A+=(this.h&65535)+(c.h&65535);x+=A>>>16;A&=65535;x+=f+i;v+=x>>>16;x&=65535;v+=e+h;j+=v>>>16;v&=65535;j+=d+g;j&=65535;return b.D(x<<16|A,j<<16|v)});b.prototype.b=(function(b){return this.add(b.m())});b.prototype.multiply=(function(c){if(this.K()){return b.ZERO}else{if(c.K()){return b.ZERO}}if(this.t(b.MIN_VALUE)){return c.Ic()?b.MIN_VALUE:b.ZERO}else{if(c.t(b.MIN_VALUE)){return this.Ic()?b.MIN_VALUE:b.ZERO}}if(this.s()){return c.s()?this.m().multiply(c.m()):this.m().multiply(c).m()}else{if(c.s()){return this.multiply(c.m()).m()}}if(this.Mc(b.Va)&&c.Mc(b.Va)){return b.u(this.va()*c.va())}var d=this.l>>>16,e=this.l&65535,f=this.h>>>16,g=this.h&65535,h=c.l>>>16,i=c.l&65535,j=c.h>>>16,c=c.h&65535,v=0,x=0,A=0,E=0;E+=g*c;A+=E>>>16;E&=65535;A+=f*c;x+=A>>>16;A&=65535;A+=g*j;x+=A>>>16;A&=65535;x+=e*c;v+=x>>>16;x&=65535;x+=f*j;v+=x>>>16;x&=65535;x+=g*i;v+=x>>>16;x&=65535;v+=d*c+e*j+f*i+g*h;v&=65535;return b.D(A<<16|E,v<<16|x)});b.prototype.C=(function(c){if(c.K()){ca(Error("division by zero"))}else{if(this.K()){return b.ZERO}}if(this.t(b.MIN_VALUE)){if(c.t(b.ONE)||c.t(b.Ua)){return b.MIN_VALUE}else{if(c.t(b.MIN_VALUE)){return b.ONE}else{var d=this.Dr().C(c).shiftLeft(1);if(d.t(b.ZERO)){return c.s()?b.ONE:b.Ua}else{var e=this.b(c.multiply(d));return d.add(e.C(c))}}}}else{if(c.t(b.MIN_VALUE)){return b.ZERO}}if(this.s()){return c.s()?this.m().C(c.m()):this.m().C(c).m()}else{if(c.s()){return this.C(c.m()).m()}}for(var f=b.ZERO,e=this;e.zr(c);){for(var d=Math.max(1,Math.floor(e.va()/c.va())),g=Math.ceil(Math.log(d)/Math.LN2),g=g<=48?1:Math.pow(2,g-48),h=b.u(d),i=h.multiply(c);i.s()||i.yr(e);){d-=g,h=b.u(d),i=h.multiply(c)}if(h.K()){h=b.ONE}f=f.add(h);e=e.b(i)}return f});b.prototype.k=(function(b){return this.b(this.C(b).multiply(b))});b.prototype.Br=(function(){return b.D(~this.h,~this.l)});b.prototype.shiftLeft=(function(c){c&=63;if(c==0){return this}else{var d=this.h;return c<32?b.D(d<<c,this.l<<c|d>>>32-c):b.D(0,d<<c-32)}});b.prototype.Dr=(function(){var c=1;c&=63;if(c==0){return this}else{var d=this.l;return c<32?b.D(this.h>>>c|d<<32-c,d>>c):b.D(d>>c-32,d>=0?0:-1)}});c.prototype.Ha=(function(b,c,d,e){for(var f=0,g=0;--e>=0;){var h=b*this[f++]+c[d]+g,g=Math.floor(h/67108864);c[d++]=h&67108863}return g});c.prototype.f=26;c.prototype.B=67108863;c.prototype.S=67108864;c.prototype.Sc=Math.pow(2,52);c.prototype.Ra=26;c.prototype.Sa=0;var g=[],h,i;h="0".charCodeAt(0);for(i=0;i<=9;++i){g[h++]=i}h="a".charCodeAt(0);for(i=10;i<36;++i){g[h++]=i}h="A".charCodeAt(0);for(i=10;i<36;++i){g[h++]=i}c.prototype.copyTo=(function(b){for(var c=this.a-1;c>=0;--c){b[c]=this[c]}b.a=this.a;b.c=this.c});c.prototype.J=(function(b){this.a=1;this.c=b<0?-1:0;b>0?this[0]=b:b<-1?this[0]=b+DV:this.a=0});c.prototype.F=(function(b,d){var f;if(d==16){f=4}else{if(d==8){f=3}else{if(d==256){f=8}else{if(d==2){f=1}else{if(d==32){f=5}else{if(d==4){f=2}else{this.wr(b,d);return}}}}}}this.c=this.a=0;for(var g=b.length,h=!1,i=0;--g>=0;){var j=f==8?b[g]&255:e(b,g);j<0?b.charAt(g)=="-"&&(h=!0):(h=!1,i==0?this[this.a++]=j:i+f>this.f?(this[this.a-1]|=(j&(1<<this.f-i)-1)<<i,this[this.a++]=j>>this.f-i):this[this.a-1]|=j<<i,i+=f,i>=this.f&&(i-=this.f))}if(f==8&&(b[0]&128)!=0){this.c=-1,i>0&&(this[this.a-1]|=(1<<this.f-i)-1<<i)}this.I();h&&c.ZERO.A(this,this)});c.prototype.I=(function(){for(var b=this.c&this.B;this.a>0&&this[this.a-1]==b;){--this.a}});c.prototype.La=(function(b,c){var d;for(d=this.a-1;d>=0;--d){c[d+b]=this[d]}for(d=b-1;d>=0;--d){c[d]=0}c.a=this.a+b;c.c=this.c});c.prototype.vr=(function(b,c){for(var d=b;d<this.a;++d){c[d-b]=this[d]}c.a=Math.max(this.a-b,0);c.c=this.c});c.prototype.Lc=(function(b,c){var d=b%this.f,e=this.f-d,f=(1<<e)-1,g=Math.floor(b/this.f),h=this.c<<d&this.B,i;for(i=this.a-1;i>=0;--i){c[i+g+1]=this[i]>>e|h,h=(this[i]&f)<<d}for(i=g-1;i>=0;--i){c[i]=0}c[g]=h;c.a=this.a+g+1;c.c=this.c;c.I()});c.prototype.Cr=(function(b,c){c.c=this.c;var d=Math.floor(b/this.f);if(d>=this.a){c.a=0}else{var e=b%this.f,f=this.f-e,g=(1<<e)-1;c[0]=this[d]>>e;for(var h=d+1;h<this.a;++h){c[h-d-1]|=(this[h]&g)<<f,c[h-d]=this[h]>>e}e>0&&(c[this.a-d-1]|=(this.c&g)<<f);c.a=this.a-d;c.I()}});c.prototype.A=(function(b,c){for(var d=0,e=0,f=Math.min(b.a,this.a);d<f;){e+=this[d]-b[d],c[d++]=e&this.B,e>>=this.f}if(b.a<this.a){for(e-=b.c;d<this.a;){e+=this[d],c[d++]=e&this.B,e>>=this.f}e+=this.c}else{for(e+=this.c;d<b.a;){e-=b[d],c[d++]=e&this.B,e>>=this.f}e-=b.c}c.c=e<0?-1:0;e<-1?c[d++]=this.S+e:e>0&&(c[d++]=e);c.a=d;c.I()});c.prototype.Ar=(function(b,d){var e=this.abs(),f=b.abs(),g=e.a;for(d.a=g+f.a;--g>=0;){d[g]=0}for(g=0;g<f.a;++g){d[g+e.a]=e.Ha(f[g],d,g,e.a)}d.c=0;d.I();this.c!=b.c&&c.ZERO.A(d,d)});c.prototype.O=(function(b,e,f){var g=b.abs();if(!(g.a<=0)){var h=this.abs();if(h.a<g.a){e!=la&&e.J(0),f!=la&&this.copyTo(f)}else{f==la&&(f=d());var i=d(),j=this.c,b=b.c,w=g[g.a-1],v=1,x;if((x=w>>>16)!=0){w=x,v+=16}if((x=w>>8)!=0){w=x,v+=8}if((x=w>>4)!=0){w=x,v+=4}if((x=w>>2)!=0){w=x,v+=2}w>>1!=0&&(v+=1);w=this.f-v;w>0?(g.Lc(w,i),h.Lc(w,f)):(g.copyTo(i),h.copyTo(f));g=i.a;h=i[g-1];if(h!=0){x=h*(1<<this.Ra)+(g>1?i[g-2]>>this.Sa:0);v=this.Sc/x;x=(1<<this.Ra)/x;var A=1<<this.Sa,E=f.a,J=E-g,M=e==la?d():e;i.La(J,M);f.ur(M)>=0&&(f[f.a++]=1,f.A(M,f));c.ONE.La(g,M);for(M.A(i,i);i.a<g;){i[i.a++]=0}for(;--J>=0;){var D=f[--E]==h?this.B:Math.floor(f[E]*v+(f[E-1]+A)*x);if((f[E]+=i.Ha(D,f,J,g))<D){i.La(J,M);for(f.A(M,f);f[E]<--D;){f.A(M,f)}}}e!=la&&(f.vr(g,e),j!=b&&c.ZERO.A(e,e));f.a=g;f.I();w>0&&f.Cr(w,f);j<0&&c.ZERO.A(f,f)}}}});c.prototype.toString=(function(b){if(this.c<0){return"-"+this.m().toString(b)}if(b==16){b=4}else{if(b==8){b=3}else{if(b==2){b=1}else{if(b==32){b=5}else{if(b==4){b=2}else{return this.Hr(b)}}}}}var c=(1<<b)-1,d,e=!1,f="",g=this.a,h=this.f-g*this.f%b;if(g-->0){if(h<this.f&&(d=this[g]>>h)>0){e=!0,f="0123456789abcdefghijklmnopqrstuvwxyz".charAt(d)}for(;g>=0;){h<b?(d=(this[g]&(1<<h)-1)<<b-h,d|=this[--g]>>(h+=this.f-b)):(d=this[g]>>(h-=b)&c,h<=0&&(h+=this.f,--g)),d>0&&(e=!0),e&&(f+="0123456789abcdefghijklmnopqrstuvwxyz".charAt(d))}}return e?f:"0"});c.prototype.m=(function(){var b=d();c.ZERO.A(this,b);return b});c.prototype.abs=(function(){return this.c<0?this.m():this});c.prototype.ur=(function(b){var c=this.c-b.c;if(c!=0){return c}var d=this.a,c=d-b.a;if(c!=0){return c}for(;--d>=0;){if((c=this[d]-b[d])!=0){return c}}return 0});c.ZERO=f(0);c.ONE=f(1);c.prototype.wr=(function(b,d){this.J(0);d==la&&(d=10);for(var f=this.Dc(d),g=Math.pow(d,f),h=!1,i=0,j=0,w=0;w<b.length;++w){var v=e(b,w);v<0?b.charAt(w)=="-"&&this.Pa()==0&&(h=!0):(j=d*j+v,++i>=f&&(this.Gc(g),this.Fc(j),j=i=0))}i>0&&(this.Gc(Math.pow(d,i)),this.Fc(j));h&&c.ZERO.A(this,this)});c.prototype.Dc=(function(b){return Math.floor(Math.LN2*this.f/Math.log(b))});c.prototype.Pa=(function(){return this.c<0?-1:this.a<=0||this.a==1&&this[0]<=0?0:1});c.prototype.Gc=(function(b){this[this.a]=this.Ha(b-1,this,0,this.a);++this.a;this.I()});c.prototype.Fc=(function(b){var c=0;if(b!=0){for(;this.a<=c;){this[this.a++]=0}for(this[c]+=b;this[c]>=this.S;){this[c]-=this.S,++c>=this.a&&(this[this.a++]=0),++this[c]}}});c.prototype.Hr=(function(b){b==la&&(b=10);if(this.Pa()==0||b<2||b>36){return"0"}var c=this.Dc(b),c=Math.pow(b,c),e=f(c),g=d(),h=d(),i="";for(this.O(e,g,h);g.Pa()>0;){i=(c+h.Hc()).toString(b).substr(1)+i,g.O(e,g,h)}return h.Hc().toString(b)+i});c.prototype.Hc=(function(){if(this.c<0){if(this.a==1){return this[0]-this.S}else{if(this.a==0){return-1}}}else{if(this.a==1){return this[0]}else{if(this.a==0){return 0}}}return(this[1]&(1<<32-this.f)-1)<<this.f|this[0]});c.prototype.Cc=(function(b,c){for(var d=0,e=0,f=Math.min(b.a,this.a);d<f;){e+=this[d]+b[d],c[d++]=e&this.B,e>>=this.f}if(b.a<this.a){for(e+=b.c;d<this.a;){e+=this[d],c[d++]=e&this.B,e>>=this.f}e+=this.c}else{for(e+=this.c;d<b.a;){e+=b[d],c[d++]=e&this.B,e>>=this.f}e+=b.c}c.c=e<0?-1:0;e>0?c[d++]=e:e<-1&&(c[d++]=this.S+e);c.a=d;c.I()});var j={result:[0,0],add:(function(c,d,e,f){c=(new b(c,d)).add(new b(e,f));j.result[0]=c.h;j.result[1]=c.l}),b:(function(c,d,e,f){c=(new b(c,d)).b(new b(e,f));j.result[0]=c.h;j.result[1]=c.l}),multiply:(function(c,d,e,f){c=(new b(c,d)).multiply(new b(e,f));j.result[0]=c.h;j.result[1]=c.l}),Nc:(function(){j.R=new c;j.R.F("4294967296",10)}),ta:(function(b,d){var e=new c;e.F(d.toString(),10);var f=new c;e.Ar(j.R,f);e=new c;e.F(b.toString(),10);var g=new c;e.Cc(f,g);return g}),j:(function(d,e,f,g,h){j.R||j.Nc();h?(d=j.ta(d>>>0,e>>>0),g=j.ta(f>>>0,g>>>0),f=new c,d.O(g,f,la),g=new c,d=new c,f.O(j.R,d,g),j.result[0]=parseInt(g.toString())|0,j.result[1]=parseInt(d.toString())|0):(d=new b(d,e),g=new b(f,g),f=d.C(g),j.result[0]=f.h,j.result[1]=f.l)}),k:(function(d,e,f,g,h){j.R||j.Nc();h?(d=j.ta(d>>>0,e>>>0),g=j.ta(f>>>0,g>>>0),f=new c,d.O(g,la,f),g=new c,d=new c,f.O(j.R,d,g),j.result[0]=parseInt(g.toString())|0,j.result[1]=parseInt(d.toString())|0):(d=new b(d,e),g=new b(f,g),f=d.k(g),j.result[0]=f.h,j.result[1]=f.l)}),stringify:(function(d,e,f){d=(new b(d,e)).toString();if(f&&d[0]=="-"){if(!j.Qa){j.Qa=new c,j.Qa.F("18446744073709551616",10)}f=new c;f.F(d,10);d=new c;j.Qa.Cc(f,d);d=d.toString(10)}return d})};return j})();function fu(b,c,d){for(var e=0;e<d;){var f=l[b+e],g=l[c+e];if(f==g&&f==0){break}if(f==0){return-1}if(g==0){return 1}if(f==g){e++}else{return f>g?1:-1}}return 0}function pg(b,c){return fu(b,c,Sc)}function Ed(b,c,d){if(d>=20){for(d=b+d;b%4;){l[b++]=c}c<0&&(c+=256);b>>=2;for(var e=d>>2,f=c|c<<8|c<<16|c<<24;b<e;){p[b++]=f}for(b<<=2;b<d;){l[b++]=c}}else{for(;d--;){l[b++]=c}}}function Ah(b,c,d){if(d>=20&&c%2==b%2){if(c%4==b%4){for(d=c+d;c%4;){l[b++]=l[c++]}c>>=2;b>>=2;for(var e=d>>2;c<e;){p[b++]=p[c++]}c<<=2;for(b<<=2;c<d;){l[b++]=l[c++]}}else{d=c+d;c%2&&(l[b++]=l[c++]);c>>=1;b>>=1;for(e=d>>1;c<e;){n[b++]=n[c++]}c<<=1;b<<=1;c<d&&(l[b++]=l[c++])}}else{for(;d--;){l[b++]=l[c++]}}}function jm(b,c,d){for(var e=0;e<d;e++){var f=l[b+e],g=l[c+e];if(f!=g){return f>g?1:-1}}return 0}var hu=44,lu=0,mu=4,nu=8,ou=12,pu=16,qu=20,ru=24,su=28,uu=32,tu=36,wu=40,gu=0,vu={},iu=la,ku=la,ju=la;function uU(b){Qh||(Qh=G([0],"i32",F));p[Qh>>2]=b}var Qh,PW=13,QW=9,RW=17,RU=22,SW=5,TW=21,UW=2,OU=34,nU={1:"Operation not permitted",2:"No such file or directory",3:"No such process",4:"Interrupted system call",5:"Input/output error",6:"No such device or address",8:"Exec format error",9:"Bad file descriptor",10:"No child processes",11:"Resource temporarily unavailable",12:"Cannot allocate memory",13:"Permission denied",14:"Bad address",16:"Device or resource busy",17:"File exists",18:"Invalid cross-device link",19:"No such device",20:"Not a directory",21:"Is a directory",22:"Invalid argument",23:"Too many open files in system",24:"Too many open files",25:"Inappropriate ioctl for device",26:"Text file busy",27:"File too large",28:"No space left on device",29:"Illegal seek",30:"Read-only file system",31:"Too many links",32:"Broken pipe",33:"Numerical argument out of domain",34:"Numerical result out of range",35:"Resource deadlock avoided",36:"File name too long",37:"No locks available",38:"Function not implemented",39:"Directory not empty",40:"Too many levels of symbolic links",42:"No message of desired type",43:"Identifier removed",60:"Device not a stream",61:"No data available",62:"Timer expired",63:"Out of streams resources",67:"Link has been severed",71:"Protocol error",72:"Multihop attempted",74:"Bad message",75:"Value too large for defined data type",84:"Invalid or incomplete multibyte or wide character",88:"Socket operation on non-socket",89:"Destination address required",90:"Message too long",91:"Protocol wrong type for socket",92:"Protocol not available",93:"Protocol not supported",95:"Operation not supported",97:"Address family not supported by protocol",98:"Address already in use",99:"Cannot assign requested address",100:"Network is down",101:"Network is unreachable",102:"Network dropped connection on reset",103:"Software caused connection abort",104:"Connection reset by peer",105:"No buffer space available",106:"Transport endpoint is already connected",107:"Transport endpoint is not connected",110:"Connection timed out",111:"Connection refused",113:"No route to host",114:"Operation already in progress",115:"Operation now in progress",116:"Stale NFS file handle",122:"Disk quota exceeded",125:"Operation canceled",130:"Owner died",131:"State not recoverable"},lU,VW=0,WW=0,XW=0,YW=2,DR=[la],ZW=!0;function $W(b,c){if(typeof b!=="string"){return la}c===fa&&(c="/");b&&b[0]=="/"&&(c="");for(var d=(c+"/"+b).split("/").reverse(),e=[""];d.length;){var f=d.pop();f==""||f=="."||(f==".."?e.length>1&&e.pop():e.push(f))}return e.length==1?"/":e.join("/")}function aX(b,c,d){var e={Jc:!1,ea:!1,error:0,name:la,path:la,object:la,fa:!1,Oa:la,L:la},b=$W(b);if(b=="/"){e.Jc=!0,e.ea=e.fa=!0,e.name="/",e.path=e.Oa="/",e.object=e.L=bX}else{if(b!==la){for(var d=d||0,b=b.slice(1).split("/"),f=bX,g=[""];b.length;){if(b.length==1&&f.p){e.fa=!0,e.Oa=g.length==1?"/":g.join("/"),e.L=f,e.name=b[0]}var h=b.shift();if(f.p){if(f.ha){if(!f.g.hasOwnProperty(h)){e.error=UW;break}}else{e.error=PW;break}}else{e.error=20;break}f=f.g[h];if(f.link&&!(c&&b.length==0)){if(d>40){e.error=40;break}e=$W(f.link,g.join("/"));e=aX([e].concat(b).join("/"),c,d+1);break}g.push(h);if(b.length==0){e.ea=!0,e.path=g.join("/"),e.object=f}}}}return e}function cX(b,c){dX();var d=aX(b,c);return d.ea?d.object:(uU(d.error),la)}function eX(b,c,d,e,f){b||(b="/");typeof b==="string"&&(b=cX(b));b||(uU(PW),ca(Error("Parent path must exist.")));b.p||(uU(20),ca(Error("Parent must be a folder.")));!b.write&&!ZW&&(uU(PW),ca(Error("Parent folder must be writeable.")));if(!c||c=="."||c==".."){uU(UW),ca(Error("Name must not be empty."))}b.g.hasOwnProperty(c)&&(uU(RW),ca(Error("Can't overwrite object.")));b.g[c]={ha:e===fa?!0:e,write:f===fa?!1:f,timestamp:Date.now(),Na:YW++};for(var g in d){d.hasOwnProperty(g)&&(b.g[c][g]=d[g])}return b.g[c]}function fX(b,c){return eX(b,c,{p:!0,r:!1,g:{}},!0,!0)}function gX(){var b="dev/shm/tmp",c=cX("/");c===la&&ca(Error("Invalid parent."));for(b=b.split("/").reverse();b.length;){var d=b.pop();d&&(c.g.hasOwnProperty(d)||fX(c,d),c=c.g[d])}}function hX(b,c,d,e,f){if(typeof d==="string"){for(var g=Array(d.length),h=0,i=d.length;h<i;++h){g[h]=d.charCodeAt(h)}d=g}return eX(b,c,{r:!1,g:d,p:!1},e,f)}function iX(b,c,d,e){!d&&!e&&ca(Error("A device must have at least one callback defined."));var f={r:!0,input:d,Q:e,p:!1};return eX(b,c,f,Boolean(d),Boolean(e))}function jX(b){if(b.r||b.p||b.link||b.g){return!0}var c=!0;if(typeof XMLHttpRequest!=="undefined"){yc("Cannot do synchronous binary XHRs in modern browsers. Use --embed-file or --preload-file in emcc")}else{if(Module.read){try{b.g=Pd(Module.read(b.url),!0)}catch(d){c=!1}}else{ca(Error("Cannot load without read() or XMLHttpRequest."))}}c||uU(SW);return c}function dX(){bX||(bX={ha:!0,write:!0,p:!0,r:!1,timestamp:Date.now(),Na:1,g:{}})}function kX(){var b,c,d;function e(b){b===la||b==="\n".charCodeAt(0)?(c.ua(c.buffer.join("")),c.buffer=[]):c.buffer.push(String.fromCharCode(b))}yc(!lX,"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)");lX=!0;dX();b=b||Module.stdin;c=c||Module.stdout;d=d||Module.stderr;var f=!0,g=!0,h=!0;b||(f=!1,b=(function(){if(!b.Ia||!b.Ia.length){var c;typeof window!="undefined"&&typeof window.prompt=="function"?c=window.prompt("Input: "):typeof readline=="function"&&(c=readline());c||(c="");b.Ia=Pd(c+"\n",!0)}return b.Ia.shift()}));c||(g=!1,c=e);if(!c.ua){c.ua=Module.print}if(!c.buffer){c.buffer=[]}d||(h=!1,d=e);if(!d.ua){d.ua=Module.print}if(!d.buffer){d.buffer=[]}fX("/","tmp");var i=fX("/","dev"),j=iX(i,"stdin",b),k=iX(i,"stdout",la,c);d=iX(i,"stderr",la,d);iX(i,"tty",b,c);DR[1]={path:"/dev/stdin",object:j,position:0,G:!0,z:!1,P:!1,Kc:!f,error:!1,sa:!1,v:[]};DR[2]={path:"/dev/stdout",object:k,position:0,G:!1,z:!0,P:!1,Kc:!g,error:!1,sa:!1,v:[]};DR[3]={path:"/dev/stderr",object:d,position:0,G:!1,z:!0,P:!1,Kc:!h,error:!1,sa:!1,v:[]};VW=G([1],"void*",F);WW=G([2],"void*",F);XW=G([3],"void*",F);gX();DR[VW]=DR[1];DR[WW]=DR[2];DR[XW]=DR[3];G([G([0,0,0,0,VW,0,0,0,WW,0,0,0,XW,0,0,0],"void*",F)],"void*",F)}var lX,bX,mX=0,nX=4,oX=8,pX=12,qX=16,rX=20,sX=24,tX=28,uX=32,vX=40,wX=48,xX=56,yX=60,zX={};function AX(b,c,d){b=cX(pd(b),d);if(b===la||!jX(b)){return-1}p[c+pX>>2]=1;p[c+qX>>2]=0;p[c+rX>>2]=0;p[c+xX>>2]=4096;p[c+nX>>2]=b.Na;d=Math.floor(b.timestamp/1e3);if(uX===fa){uX=zX.Er.Rc;vX=zX.Gr.Rc;wX=zX.Fr.Rc;var e=b.timestamp%1e3*1e3;p[c+zX.Er.Qc>>2]=e;p[c+zX.Gr.Qc>>2]=e;p[c+zX.Fr.Qc>>2]=e}p[c+uX>>2]=d;p[c+vX>>2]=d;p[c+wX>>2]=d;var f=0,g=d=0,h=e=0;b.r?(e=h=b.Na,d=g=0,f=8192):(e=1,h=0,b.p?(d=4096,g=1,f=16384):(f=b.g||b.link,d=f.length,g=Math.ceil(f.length/4096),f=b.link===fa?32768:40960));p[c+mX>>2]=e;p[c+sX>>2]=h;p[c+tX>>2]=d;p[c+yX>>2]=g;b.ha&&(f|=365);b.write&&(f|=146);p[c+oX>>2]=f;return 0}function BX(b,c){if(c<0){return uU(RU),-1}else{typeof b!=="string"&&(b=pd(b));var d=cX(b);if(d===la){return-1}if(d.p){return uU(TW),-1}else{if(d.r){return uU(RU),-1}else{if(d.write){var e=d.g;if(c<e.length){e.length=c}else{for(;c>e.length;){e.push(0)}}d.timestamp=Date.now();return 0}else{return uU(PW),-1}}}}}function CX(b,c,d,e){var f=DR[b];if(!f||f.object.r){return uU(QW),-1}else{if(f.G){if(f.object.p){return uU(TW),-1}else{if(d<0||e<0){return uU(RU),-1}else{for(b=0;f.v.length&&d>0;){l[c++]=f.v.pop(),d--,b++}for(var f=f.object.g,d=Math.min(f.length-e,d),g=0;g<d;g++){l[c+g]=f[e+g],b++}return b}}}else{return uU(PW),-1}}}var DX=la;function EX(b,c,d){var e=p[d>>2],f=c&3,d=f!=0,f=f!=1,g=Boolean(c&512),h=Boolean(c&2048),i=Boolean(c&1024),j=Boolean(c&8),b=aX(pd(b));if(!b.fa){return uU(b.error),-1}if(c=b.object||la){if(g&&h){return uU(RW),-1}if((d||g||i)&&c.p){return uU(TW),-1}if(f&&!c.ha||d&&!c.write){return uU(PW),-1}if(i&&!c.r){c.g=[]}else{if(!jX(c)){return uU(SW),-1}}b=b.path}else{if(!g){return uU(UW),-1}if(!b.L.write){return uU(PW),-1}c=hX(b.L,b.name,[],e&256,e&128);b=b.Oa+"/"+b.name}e=DR.length;if(c.p){d=0;DX&&(d=Dd(DX.Lr));var f=[],k;for(k in c.g){f.push(k)}DR[e]={path:b,object:c,position:-2,G:!0,z:!1,P:!1,error:!1,sa:!1,v:[],g:f,Ec:d}}else{DR[e]={path:b,object:c,position:0,G:f,z:d,P:j,error:!1,sa:!1,v:[]}}return e}function mW(b,c){if(DR[b]&&!DR[b].r){var d=DR[b];return c<0?(uU(RU),-1):(d.v=[],d.position=c)}else{return uU(QW),-1}}function FX(b){return DR[b]?0:(uU(QW),-1)}function OW(b){var c=Math.floor(Date.now()/1e3);b&&(p[b>>2]=c);return c}var GX=la,HX=la,IX={},JX={};function KX(b,c){c="_"+pd(c);if(IX[b]){var d=IX[b];if(d.Oc.hasOwnProperty(c)){if(d.Ja.hasOwnProperty(c)){return d.Ja[c]}else{var e=d.Oc[c];if(typeof e=="function"){Gd.push(e),Gd.push(0),e=Gd.length-2,d.Ja=e}return e}}else{return HX='Tried to lookup unknown symbol "'+c+'" in dynamic lib: '+d.name,0}}else{return HX="Tried to dlsym() from an unopened handle: "+b,0}}var LX=la,MX={};function P1(b){b=(MX.LD_LIBRARY_PATH||"/")+pd(b);if(JX[b]){var c=JX[b];IX[c].Pc++;return c}c=cX(b);if(!c||c.p||c.r){return HX="Could not find dynamic lib: "+b,0}else{jX(c),c=re(c.g)}try{var d=eval(c)(Gd.length)}catch(e){return HX="Could not evaluate dynamic lib: "+b,0}var c=1,f;for(f in IX){IX.hasOwnProperty(f)&&c++}IX[c]={Pc:1,name:b,Oc:d,Ja:{}};return JX[b]=c}function qW(){var b=R.yq|0;if(b===0){return 0}b=pd(b);if(!MX.hasOwnProperty(b)){return 0}Q1&&DS(Q1);return Q1=G(Pd(MX[b]),"i8",Bd)}var Q1;function AW(){ca("abort() at "+Error().stack)}function NW(){switch(8){case 8:return Hd;case 54:case 56:case 21:case 61:case 63:case 22:case 67:case 23:case 24:case 25:case 26:case 27:case 69:case 28:case 101:case 70:case 71:case 29:case 30:case 199:case 75:case 76:case 32:case 43:case 44:case 80:case 46:case 47:case 45:case 48:case 49:case 42:case 82:case 33:case 7:case 108:case 109:case 107:case 112:case 119:case 121:return 200809;case 13:case 104:case 94:case 95:case 34:case 35:case 77:case 81:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 91:case 94:case 95:case 110:case 111:case 113:case 114:case 115:case 116:case 117:case 118:case 120:case 40:case 16:case 79:case 19:return-1;case 92:case 93:case 5:case 72:case 6:case 74:case 92:case 93:case 96:case 97:case 98:case 99:case 102:case 103:case 105:return 1;case 38:case 66:case 50:case 51:case 4:return 1024;case 15:case 64:case 41:return 32;case 55:case 37:case 17:return 2147483647;case 18:case 1:return 47839;case 59:case 57:return 99;case 68:case 58:return 2048;case 0:return 2097152;case 3:return 65536;case 14:return 32768;case 73:return 32767;case 39:return 16384;case 60:return 1e3;case 106:return 700;case 52:return 256;case 62:return 255;case 2:return 100;case 65:return 64;case 36:return 20;case 100:return 16;case 20:return 6;case 53:return 4}uU(RU);return-1}function HW(b){R1||(Pc=Pc+4095>>12<<12,R1=!0);var c=Pc;b!=0&&Nc(b);return c}var R1;function kr(b){for(var b=b>=0?b:2*Math.abs(-2147483648)+b,c=[],d=0;d<4;d++){c[d]=b&255,b>>=8}for(d=b=0;d<4;d++){b<<=8,b+=c[d]}return b}uU(0);ee.unshift({Ma:(function(){!Module.noFSInit&&!lX&&kX()})});fe.push({Ma:(function(){ZW=!1})});ne.push({Ma:(function(){lX&&(DR[2]&&DR[2].object.Q.buffer.length>0&&DR[2].object.Q("\n".charCodeAt(0)),DR[3]&&DR[3].object.Q.buffer.length>0&&DR[3].object.Q("\n".charCodeAt(0)))})});var S1=MX,T1,U1;LX===la?(MX.USER="root",MX.PATH="/",MX.PWD="/",MX.HOME="/home/emscripten",MX.LANG="en_US.UTF-8",MX._="./this.program",T1=G(1024,"i8",F),U1=G(256,"i8*",F),p[U1>>2]=T1,LX=G([U1],"i8**",F)):(U1=p[LX>>2],T1=p[U1>>2]);var V1=[],W1=0,X1;for(X1 in S1){if(typeof S1[X1]==="string"){var Y1=X1+"="+S1[X1];V1.push(Y1);W1+=Y1.length}}W1>1024&&ca(Error("Environment size exceeded TOTAL_ENV_SIZE!"));for(var Z1=0;Z1<V1.length;Z1++){for(var Y1=V1[Z1],$1=0;$1<Y1.length;$1++){l[T1+$1]=Y1.charCodeAt($1)}l[T1+$1]=0;p[U1+Z1*4>>2]=T1;T1+=Y1.length+1}p[U1+V1.length*4>>2]=0;Module.tr=(function(b){function c(){for(var b=0;b<3;b++){e.push(0)}}var d=b.length+1,e=[G(Pd("/bin/this.program"),"i8",F)];c();for(var f=0;f<d-1;f+=1){e.push(G(Pd(b[f]),"i8",F)),c()}e.push(0);e=G(e,"i32",F);return 0});var Be,Ve,We,of,Je,Qg,Ng,a2,b2,c2,si,Cm,xh,pC,rg,Sn,d2,e2,to,fp,Og,Fo,Go,Kh,Do,jn,$n,sq,oq,tr,Pp,Qp,pk,Pn,On,Ag,tC,sC,Ig,Bg,Ht,jv,Hv,cw,dw,Ju,Uv,Tv,AE,eC,nC,CC,AC,BC,xC,vC,wC,rC,BE,kC,FF,GF,DE,Bx,xG,kw,Ou,Iu,Ku,zG,Kl,II,CG,tW,Mh,uW,rW,Nh,pW,vh,zW,EW;R.zc=G([51,46,55,46,49,48,0],"i8",F);R.Uc=G([83,81,76,73,84,69,95,0],"i8",F);Be=G(16,"*",F);Ve=G(40,"i32",F);We=G(40,"i32",F);of=G([1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,2147483646,0,0,0,128,0,0,0,500,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],["i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i32",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0,"*",0,0,0,"*",0,0,0,"i32",0,0,0],F);Je=G(1,"%struct.sqlite3_vfs*",F);Qg=G(36,["*",0,0,0,"i64",0,0,0,"i32",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i32",0,0,0,"i32",0,0,0],F);R.i=G([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],"i8",F);Ng=G([3,0,0,0,44,0,0,0,512,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,66,0,0,0,68,0,0,0,70,0,0,0,72,0,0,0,74,0,0,0,76,0,0,0,78,0,0,0,80,0,0,0,82,0,0,0,84,0,0,0,86,0,0,0,88,0,0,0,90,0,0,0,92,0,0,0,94,0,0,0,96,0,0,0,3,0,0,0,44,0,0,0,512,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,66,0,0,0,68,0,0,0,70,0,0,0,72,0,0,0,74,0,0,0,76,0,0,0,78,0,0,0,80,0,0,0,82,0,0,0,84,0,0,0,86,0,0,0,88,0,0,0,90,0,0,0,92,0,0,0,94,0,0,0,96,0,0,0,3,0,0,0,44,0,0,0,512,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,66,0,0,0,68,0,0,0,70,0,0,0,72,0,0,0,74,0,0,0,76,0,0,0,78,0,0,0,80,0,0,0,82,0,0,0,84,0,0,0,86,0,0,0,88,0,0,0,90,0,0,0,92,0,0,0,94,0,0,0,96,0,0,0,3,0,0,0,44,0,0,0,512,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,66,0,0,0,68,0,0,0,70,0,0,0,72,0,0,0,74,0,0,0,76,0,0,0,78,0,0,0,80,0,0,0,82,0,0,0,84,0,0,0,86,0,0,0,88,0,0,0,90,0,0,0,92,0,0,0,94,0,0,0,96,0,0,0],["i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0],F);R.Vc=G([117,110,105,120,0],"i8",F);a2=G([98],["%struct.sqlite3_io_methods* (i8*, %struct.unixFile*)*",0,0,0,0],F);R.we=G([117,110,105,120,45,110,111,110,101,0],"i8",F);b2=G([100],["%struct.sqlite3_io_methods* (i8*, %struct.unixFile*)*",0,0,0,0],F);R.fg=G([117,110,105,120,45,100,111,116,102,105,108,101,0],"i8",F);c2=G([102],["%struct.sqlite3_io_methods* (i8*, %struct.unixFile*)*",0,0,0,0],F);R.Yb=G([117,110,105,120,45,101,120,99,108,0],"i8",F);R.Gj=G([115,111,117,114,99,101,32,97,110,100,32,100,101,115,116,105,110,97,116,105,111,110,32,109,117,115,116,32,98,101,32,100,105,115,116,105,110,99,116,0],"i8",F);si=G([1073741824],["i32",0,0,0,0],F);R.Fa=G([115,116,114,105,110,103,32,111,114,32,98,108,111,98,32,116,111,111,32,98,105,103,0],"i8",F);Cm=G([35,0,0,0,38,0,0,0,-125,0,0,0,39,0,0,0,40,0,0,0,12,1,1,1,54,0,10,1,29,0,0,1,16,1,0,0,1,0,5,0,45,0,0,0,6,0,0,0],"i8",F);R.In=G([99,97,110,110,111,116,32,111,112,101,110,32,118,105,114,116,117,97,108,32,116,97,98,108,101,58,32,37,115,0],"i8",F);R.Op=G([99,97,110,110,111,116,32,111,112,101,110,32,118,105,101,119,58,32,37,115,0],"i8",F);R.Nq=G([110,111,32,115,117,99,104,32,99,111,108,117,109,110,58,32,34,37,115,34,0],"i8",F);R.Wc=G([102,111,114,101,105,103,110,32,107,101,121,0],"i8",F);R.fd=G([105,110,100,101,120,101,100,0],"i8",F);R.qd=G([99,97,110,110,111,116,32,111,112,101,110,32,37,115,32,99,111,108,117,109,110,32,102,111,114,32,119,114,105,116,105,110,103,0],"i8",F);R.d=G([37,115,0],"i8",F);xh=G(1,"i8",F);R.e=G([0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,12,12,12,12,12,12,12,12,12,12,0,0,0,0,0,0,0,10,10,10,10,10,10,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,64,0,42,42,42,42,42,42,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,0,0,0,0,0,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64],"i8",F);R.or=G([1,4,3,2,5],"i8",F);R.nr=G([1,0,2,3,4,2,2,2,1,1,2,3,4,2,2,2,1,2,2,2,2,2,2,2,1,3,3,2,4,2,2,2,1,4,2,2,2,4,5,2,6,5,5,5,5,5,5,5,6,6,5,5,5,5,5,7,1,7,5,5,5,5,5,5],"i8",F);R.Md=G([99,114,101,97,116,101,0],"i8",F);R.ia=G([116,114,105,103,103,101,114,0],"i8",F);R.jb=G([116,101,109,112,0],"i8",F);R.ee=G([116,101,109,112,111,114,97,114,121,0],"i8",F);R.me=G([101,110,100,0],"i8",F);R.xe=G([101,120,112,108,97,105,110,0],"i8",F);R.Y=G([50,48,49,50,45,48,49,45,49,54,32,49,51,58,50,56,58,52,48,32,101,98,100,48,49,97,56,100,101,102,102,98,53,48,50,52,97,53,100,55,52,57,52,101,101,102,56,48,48,100,50,51,54,54,100,57,55,50,48,52,0],"i8",F);pC=G(1,"i8*",F);rg=G(92,"*",F);Sn=G([1002,0,0,0,67108864,0,0,0,1003,0,0,0,1073741824,0,0,0],["i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0],F);R.Ne=G([117,110,97,98,108,101,32,116,111,32,99,108,111,115,101,32,100,117,101,32,116,111,32,117,110,102,105,110,97,108,105,115,101,100,32,115,116,97,116,101,109,101,110,116,115,0],"i8",F);R.Xe=G([117,110,97,98,108,101,32,116,111,32,99,108,111,115,101,32,100,117,101,32,116,111,32,117,110,102,105,110,105,115,104,101,100,32,98,97,99,107,117,112,32,111,112,101,114,97,116,105,111,110,0],"i8",F);R.ff=G([117,110,107,110,111,119,110,32,100,97,116,97,98,97,115,101,58,32,37,115,0],"i8",F);d2=G([111,0,117,0,116,0,32,0,111,0,102,0,32,0,109,0,101,0,109,0,111,0,114,0,121,0,0,0],["i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0],F);e2=G([108,0,105,0,98,0,114,0,97,0,114,0,121,0,32,0,114,0,111,0,117,0,116,0,105,0,110,0,101,0,32,0,99,0,97,0,108,0,108,0,101,0,100,0,32,0,111,0,117,0,116,0,32,0,111,0,102,0,32,0,115,0,101,0,113,0,117,0,101,0,110,0,99,0,101,0,0,0],["i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0],F);to=G([1e9,0,0,0,1e9,0,0,0,2e3,0,0,0,1e3,0,0,0,500,0,0,0,25e3,0,0,0,127,0,0,0,10,0,0,0,5e4,0,0,0,999,0,0,0,1e3,0,0,0],["i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0],F);R.nf=G([57,50,50,51,51,55,50,48,51,54,56,53,52,55,55,53,56,48,0],"i8",F);R.br=G([111,110,111,102,102,97,108,115,101,121,101,115,116,114,117,101,102,117,108,108,0],"i8",F);R.$q=G([0,1,2,4,9,12,16],"i8",F);R.Zq=G([2,2,3,5,3,4,4],"i8",F);R.ar=G([1,0,0,0,1,1,2],"i8",F);R.gr=G([82,69,73,78,68,69,88,69,68,69,83,67,65,80,69,65,67,72,69,67,75,69,89,66,69,70,79,82,69,73,71,78,79,82,69,71,69,88,80,76,65,73,78,83,84,69,65,68,68,65,84,65,66,65,83,69,76,69,67,84,65,66,76,69,70,84,72,69,78,68,69,70,69,82,82,65,66,76,69,76,83,69,88,67,69,80,84,82,65,78,83,65,67,84,73,79,78,65,84,85,82,65,76,84,69,82,65,73,83,69,88,67,76,85,83,73,86,69,88,73,83,84,83,65,86,69,80,79,73,78,84,69,82,83,69,67,84,82,73,71,71,69,82,69,70,69,82,69,78,67,69,83,67,79,78,83,84,82,65,73,78,84,79,70,70,83,69,84,69,77,80,79,82,65,82,89,85,78,73,81,85,69,82,89,65,84,84,65,67,72,65,86,73,78,71,82,79,85,80,68,65,84,69,66,69,71,73,78,78,69,82,69,76,69,65,83,69,66,69,84,87,69,69,78,79,84,78,85,76,76,73,75,69,67,65,83,67,65,68,69,76,69,84,69,67,65,83,69,67,79,76,76,65,84,69,67,82,69,65,84,69,67,85,82,82,69,78,84,95,68,65,84,69,68,69,84,65,67,72,73,77,77,69,68,73,65,84,69,74,79,73,78,83,69,82,84,77,65,84,67,72,80,76,65,78,65,76,89,90,69,80,82,65,71,77,65,66,79,82,84,86,65,76,85,69,83,86,73,82,84,85,65,76,73,77,73,84,87,72,69,78,87,72,69,82,69,78,65,77,69,65,70,84,69,82,69,80,76,65,67,69,65,78,68,69,70,65,85,76,84,65,85,84,79,73,78,67,82,69,77,69,78,84,67,65,83,84,67,79,76,85,77,78,67,79,77,77,73,84,67,79,78,70,76,73,67,84,67,82,79,83,83,67,85,82,82,69,78,84,95,84,73,77,69,83,84,65,77,80,82,73,77,65,82,89,68,69,70,69,82,82,69,68,73,83,84,73,78,67,84,68,82,79,80,70,65,73,76,70,82,79,77,70,85,76,76,71,76,79,66,89,73,70,73,83,78,85,76,76,79,82,68,69,82,69,83,84,82,73,67,84,79,85,84,69,82,73,71,72,84,82,79,76,76,66,65,67,75,82,79,87,85,78,73,79,78,85,83,73,78,71,86,65,67,85,85,77,86,73,69,87,73,78,73,84,73,65,76,76,89],"i8",F);R.dr=G([72,101,114,70,0,45,0,0,78,0,73,0,0,42,12,74,15,0,113,81,50,108,0,19,0,0,118,0,116,111,0,22,89,0,9,0,0,66,67,0,65,6,0,48,86,98,0,115,97,0,0,44,0,99,24,0,17,0,119,49,23,0,5,106,25,92,0,0,121,102,56,120,53,28,51,0,87,0,96,26,0,95,0,0,0,91,88,93,84,105,14,39,104,0,77,0,18,85,107,32,0,117,76,109,58,46,80,0,0,90,40,0,112,0,36,0,0,29,0,82,59,60,0,20,57,0,52],"i8",F);R.fr=G([0,0,0,0,4,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,13,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,33,0,21,0,0,0,43,3,47,0,0,0,0,30,0,54,0,38,0,0,0,1,62,0,0,63,0,41,0,0,0,0,0,0,0,61,0,0,0,0,31,55,16,34,10,0,0,0,0,0,0,0,11,68,75,0,8,0,100,94,0,103,0,83,0,71,0,0,110,27,37,69,79,0,35,64,0,0],"i8",F);R.er=G([7,7,5,4,6,4,5,3,6,7,3,6,6,7,7,3,8,2,6,5,4,4,3,10,4,6,11,6,2,7,5,5,9,6,9,9,7,10,10,4,6,2,3,9,4,2,6,5,6,6,5,6,5,5,7,7,7,3,2,4,4,7,3,6,4,7,6,12,6,9,4,6,5,4,7,6,5,6,7,5,4,5,6,5,7,3,7,13,2,2,4,6,6,8,5,17,12,7,8,8,2,4,4,4,4,4,2,2,6,5,8,5,5,8,3,5,5,6,4,9,3],"i8",F);fp=G([0,0,2,0,2,0,8,0,9,0,14,0,16,0,20,0,23,0,25,0,25,0,29,0,33,0,36,0,41,0,46,0,48,0,53,0,54,0,59,0,62,0,65,0,67,0,69,0,78,0,81,0,86,0,91,0,95,0,96,0,101,0,105,0,109,0,117,0,122,0,128,0,136,0,142,0,152,0,159,0,162,0,162,0,165,0,167,0,167,0,171,0,176,0,179,0,184,0,189,0,194,0,197,0,203,0,206,0,210,0,217,0,223,0,223,0,223,0,226,0,229,0,233,0,234,0,238,0,244,0,248,0,255,0,261,0,273,0,279,0,288,0,290,0,296,0,301,0,303,0,310,0,315,0,320,0,326,0,332,0,337,0,341,0,344,0,350,0,354,0,361,0,363,0,370,0,372,0,374,0,383,0,387,0,393,0,399,0,407,0,412,0,412,0,428,0,435,0,442,0,443,0,450,0,454,0,458,0,462,0,466,0,469,0,471,0,473,0,479,0,483,0,491,0,495,0,500,0,508,0,511,0,516,0,521,0,527,0,531,0,536,0],["i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0],F);R.cr=G([64,27,138,41,81,43,101,52,34,110,45,46,49,2,48,140,40,24,116,16,95,136,11,109,137,114,6,29,104,95,139,56,9,20,13,115,60,102,96,127,54,53,108,21,21,68,100,3,33,124,123,107,5,95,14,71,74,19,51,98,49,36,32,106,134,92,17,66,42,8,120,105,50,4,31,55,28,128,63,125,135,126,65,30,57,69,97,103,15,72,37,38,10,39,95,66,66,99,7,117,70,111,44,119,95,49,35,18,73,122,58,95,95,12,59,112,121,61,62,47,113],"i8",F);Og=G(68,["*",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"*",0,0,0,"*",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0],F);Fo=G(1,"void ()*",F);Go=G(1,"void ()*",F);Kh=G(259,"i8",F);Do=G(259,"i8",F);R.xf=G([109,105,115,117,115,101,32,97,116,32,108,105,110,101,32,37,100,32,111,102,32,91,37,46,49,48,115,93,0],"i8",F);R.Ef=G([117,110,97,98,108,101,32,116,111,32,100,101,108,101,116,101,47,109,111,100,105,102,121,32,99,111,108,108,97,116,105,111,110,32,115,101,113,117,101,110,99,101,32,100,117,101,32,116,111,32,97,99,116,105,118,101,32,115,116,97,116,101,109,101,110,116,115,0],"i8",F);R.w=G([66,73,78,65,82,89,0],"i8",F);R.Vf=G([82,84,82,73,77,0],"i8",F);R.Db=G([78,79,67,65,83,69,0],"i8",F);R.qg=G([109,97,105,110,0],"i8",F);jn=G([104,0,0,0,106,0,0,0,108,0,0,0,110,0,0,0,112,0,0,0,114,0,0,0,116,0,0,0,118,0,0,0,120,0,0,0,122,0,0,0,124,0,0,0,126,0,0,0,128,0,0,0,130,0,0,0,132,0,0,0,134,0,0,0,136,0,0,0,138,0,0,0,140,0,0,0,142,0,0,0,144,0,0,0,146,0,0,0,148,0,0,0,0,0,0,0,0,0,0,0,150,0,0,0,152,0,0,0,154,0,0,0,156,0,0,0,158,0,0,0,160,0,0,0,162,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,164,0,0,0,166,0,0,0,168,0,0,0,170,0,0,0,172,0,0,0,174,0,0,0,176,0,0,0,178,0,0,0,180,0,0,0,182,0,0,0,184,0,0,0,186,0,0,0,188,0,0,0,190,0,0,0,192,0,0,0,194,0,0,0,196,0,0,0,198,0,0,0,200,0,0,0,202,0,0,0,204,0,0,0,206,0,0,0,34,0,0,0,208,0,0,0,210,0,0,0,212,0,0,0,214,0,0,0,0,0,0,0,216,0,0,0,218,0,0,0,220,0,0,0,222,0,0,0,224,0,0,0,226,0,0,0,228,0,0,0,230,0,0,0,232,0,0,0,234,0,0,0,236,0,0,0,238,0,0,0,240,0,0,0,242,0,0,0,244,0,0,0,246,0,0,0,248,0,0,0,250,0,0,0,252,0,0,0,254,0,0,0,256,0,0,0,258,0,0,0,260,0,0,0,262,0,0,0,264,0,0,0,266,0,0,0,268,0,0,0,270,0,0,0,272,0,0,0,274,0,0,0,276,0,0,0,0,0,0,0,278,0,0,0,280,0,0,0,282,0,0,0,284,0,0,0,286,0,0,0,288,0,0,0,290,0,0,0,292,0,0,0,294,0,0,0,296,0,0,0,298,0,0,0,300,0,0,0,302,0,0,0,6,0,0,0,8,0,0,0,304,0,0,0,306,0,0,0,308,0,0,0,310,0,0,0,312,0,0,0,314,0,0,0,316,0,0,0,318,0,0,0,320,0,0,0,322,0,0,0,324,0,0,0,326,0,0,0,328,0,0,0,330,0,0,0,332,0,0,0,334,0,0,0,336,0,0,0,338,0,0,0,340,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,342,0,0,0,344,0,0,0,346,0,0,0,348,0,0,0,350,0,0,0,352,0,0,0,354,0,0,0,356,0,0,0,358,0,0,0,360,0,0,0,362,0,0,0,364,0,0,0,366,0,0,0,368,0,0,0,370,0,0,0,372,0,0,0,374,0,0,0,376,0,0,0,378,0,0,0,380,0,0,0,382,0,0,0,384,0,0,0,386,0,0,0,388,0,0,0,390,0,0,0,392,0,0,0,394,0,0,0,396,0,0,0,398,0,0,0,400,0,0,0,402,0,0,0,404,0,0,0,406,0,0,0,408,0,0,0,410,0,0,0,412,0,0,0,414,0,0,0,0,0,0,0,416,0,0,0,418,0,0,0,420,0,0,0,422,0,0,0,424,0,0,0,426,0,0,0],["*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0],F);R.Ag=G([77,65,84,67,72,0],"i8",F);R.Ig=G([58,109,101,109,111,114,121,58,0],"i8",F);$n=G(1,"%struct.BtShared*",F);sq=G(28,"i8",F);oq=G([1,0,0,0,428,0,0,0,430,0,0,0,432,0,0,0,434,0,0,0,436,0,0,0,438,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],["i32",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0],F);R.qa=G([217,213,5,249,32,161,99,215],"i8",F);R.Rg=G([100,97,116,97,98,97,115,101,32,99,111,114,114,117,112,116,105,111,110,32,97,116,32,108,105,110,101,32,37,100,32,111,102,32,91,37,46,49,48,115,93,0],"i8",F);R.Yg=G([99,97,110,110,111,116,32,108,105,109,105,116,32,87,65,76,32,115,105,122,101,58,32,37,115,0],"i8",F);R.ih=G([99,97,110,110,111,116,32,111,112,101,110,32,102,105,108,101,32,97,116,32,108,105,110,101,32,37,100,32,111,102,32,91,37,46,49,48,115,93,0],"i8",F);R.th=G([82,101,99,111,118,101,114,101,100,32,37,100,32,102,114,97,109,101,115,32,102,114,111,109,32,87,65,76,32,102,105,108,101,32,37,115,0],"i8",F);R.Ch=G([45,106,111,117,114,110,97,108,0,0],"i8",F);R.ba=G([45,119,97,108,0,0],"i8",F);tr=G(1,"i8",F);R.Wh=G([102,105,108,101,58,0],"i8",F);R.gi=G([108,111,99,97,108,104,111,115,116,0],"i8",F);R.qi=G([105,110,118,97,108,105,100,32,117,114,105,32,97,117,116,104,111,114,105,116,121,58,32,37,46,42,115,0],"i8",F);R.Ai=G([118,102,115,0],"i8",F);R.$b=G([99,97,99,104,101,0],"i8",F);Pp=G([0,0,0,0,131072,0,0,0,0,0,0,0,262144,0,0,0,0,0,0,0,0,0,0,0],["*",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0],F);R.Si=G([115,104,97,114,101,100,0],"i8",F);R.cj=G([112,114,105,118,97,116,101,0],"i8",F);R.lj=G([109,111,100,101,0],"i8",F);Qp=G([0,0,0,0,1,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0],["*",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0],F);R.wj=G([114,111,0],"i8",F);R.Hj=G([114,119,0],"i8",F);R.Sj=G([114,119,99,0],"i8",F);R.fc=G([97,99,99,101,115,115,0],"i8",F);R.mk=G([110,111,32,115,117,99,104,32,37,115,32,109,111,100,101,58,32,37,115,0],"i8",F);R.xk=G([37,115,32,109,111,100,101,32,110,111,116,32,97,108,108,111,119,101,100,58,32,37,115,0],"i8",F);R.Gk=G([110,111,32,115,117,99,104,32,118,102,115,58,32,37,115,0],"i8",F);R.Rk=G([117,110,97,98,108,101,32,116,111,32,117,115,101,32,102,117,110,99,116,105,111,110,32,37,115,32,105,110,32,116,104,101,32,114,101,113,117,101,115,116,101,100,32,99,111,110,116,101,120,116,0],"i8",F);R.Ga=G([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,0,1,2,3,0,1,0,0],"i8",F);R.bl=G([117,110,97,98,108,101,32,116,111,32,100,101,108,101,116,101,47,109,111,100,105,102,121,32,117,115,101,114,45,102,117,110,99,116,105,111,110,32,100,117,101,32,116,111,32,97,99,116,105,118,101,32,115,116,97,116,101,109,101,110,116,115,0],"i8",F);pk=G(108,"*",F);R.ll=G([110,111,116,32,97,110,32,101,114,114,111,114,0],"i8",F);R.wl=G([83,81,76,32,108,111,103,105,99,32,101,114,114,111,114,32,111,114,32,109,105,115,115,105,110,103,32,100,97,116,97,98,97,115,101,0],"i8",F);R.Gl=G([97,99,99,101,115,115,32,112,101,114,109,105,115,115,105,111,110,32,100,101,110,105,101,100,0],"i8",F);R.Rl=G([99,97,108,108,98,97,99,107,32,114,101,113,117,101,115,116,101,100,32,113,117,101,114,121,32,97,98,111,114,116,0],"i8",F);R.bm=G([100,97,116,97,98,97,115,101,32,105,115,32,108,111,99,107,101,100,0],"i8",F);R.mm=G([100,97,116,97,98,97,115,101,32,116,97,98,108,101,32,105,115,32,108,111,99,107,101,100,0],"i8",F);R.ca=G([111,117,116,32,111,102,32,109,101,109,111,114,121,0],"i8",F);R.Fm=G([97,116,116,101,109,112,116,32,116,111,32,119,114,105,116,101,32,97,32,114,101,97,100,111,110,108,121,32,100,97,116,97,98,97,115,101,0],"i8",F);R.Qm=G([105,110,116,101,114,114,117,112,116,101,100,0],"i8",F);R.an=G([100,105,115,107,32,73,47,79,32,101,114,114,111,114,0],"i8",F);R.mn=G([100,97,116,97,98,97,115,101,32,100,105,115,107,32,105,109,97,103,101,32,105,115,32,109,97,108,102,111,114,109,101,100,0],"i8",F);R.xn=G([117,110,107,110,111,119,110,32,111,112,101,114,97,116,105,111,110,0],"i8",F);R.Jn=G([100,97,116,97,98,97,115,101,32,111,114,32,100,105,115,107,32,105,115,32,102,117,108,108,0],"i8",F);R.Un=G([117,110,97,98,108,101,32,116,111,32,111,112,101,110,32,100,97,116,97,98,97,115,101,32,102,105,108,101,0],"i8",F);R.fo=G([108,111,99,107,105,110,103,32,112,114,111,116,111,99,111,108,0],"i8",F);R.ro=G([116,97,98,108,101,32,99,111,110,116,97,105,110,115,32,110,111,32,100,97,116,97,0],"i8",F);R.kc=G([100,97,116,97,98,97,115,101,32,115,99,104,101,109,97,32,104,97,115,32,99,104,97,110,103,101,100,0],"i8",F);R.Mo=G([99,111,110,115,116,114,97,105,110,116,32,102,97,105,108,101,100,0],"i8",F);R.Xo=G([100,97,116,97,116,121,112,101,32,109,105,115,109,97,116,99,104,0],"i8",F);R.hp=G([108,105,98,114,97,114,121,32,114,111,117,116,105,110,101,32,99,97,108,108,101,100,32,111,117,116,32,111,102,32,115,101,113,117,101,110,99,101,0],"i8",F);R.sp=G([108,97,114,103,101,32,102,105,108,101,32,115,117,112,112,111,114,116,32,105,115,32,100,105,115,97,98,108,101,100,0],"i8",F);R.Dp=G([97,117,116,104,111,114,105,122,97,116,105,111,110,32,100,101,110,105,101,100,0],"i8",F);R.Pp=G([97,117,120,105,108,105,97,114,121,32,100,97,116,97,98,97,115,101,32,102,111,114,109,97,116,32,101,114,114,111,114,0],"i8",F);R.Xp=G([98,105,110,100,32,111,114,32,99,111,108,117,109,110,32,105,110,100,101,120,32,111,117,116,32,111,102,32,114,97,110,103,101,0],"i8",F);R.gq=G([102,105,108,101,32,105,115,32,101,110,99,114,121,112,116,101,100,32,111,114,32,105,115,32,110,111,116,32,97,32,100,97,116,97,98,97,115,101,0],"i8",F);R.qq=G([117,110,107,110,111,119,110,32,101,114,114,111,114,0],"i8",F);R.Aq=G([105,110,118,97,108,105,100,0],"i8",F);R.Kq=G([65,80,73,32,99,97,108,108,32,119,105,116,104,32,37,115,32,100,97,116,97,98,97,115,101,32,99,111,110,110,101,99,116,105,111,110,32,112,111,105,110,116,101,114,0],"i8",F);Pn=G([1,0,0,0,0,0,0,0,440,0,0,0,442,0,0,0,444,0,0,0,446,0,0,0,448,0,0,0,450,0,0,0,452,0,0,0,454,0,0,0,456,0,0,0,458,0,0,0,460,0,0,0],["i32",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0],F);On=G([462,0,0,0,464,0,0,0,466,0,0,0,468,0,0,0,470,0,0,0,472,0,0,0,474,0,0,0,0,0,0,0],["*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0],F);R.Lq=G([102,97,105,108,101,100,32,109,101,109,111,114,121,32,114,101,115,105,122,101,32,37,117,32,116,111,32,37,117,32,98,121,116,101,115,0],"i8",F);R.Mq=G([102,97,105,108,101,100,32,116,111,32,97,108,108,111,99,97,116,101,32,37,117,32,98,121,116,101,115,32,111,102,32,109,101,109,111,114,121,0],"i8",F);Ag=G([1,0,1,0,0,0,0,0,0,0,0,0,476,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,0,0,0,0,0,0,0,0,0,476,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,476,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,0,0,0,0,0,0,0,0,0,476,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,476,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,0,0,0,0,0,0,0,0,0,476,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,1,8,0,0,0,0,0,0,0,0,478,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,8,0,0,0,0,0,0,0,0,0,0,0,0,480,0,0,0,482,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,1,8,0,0,0,0,0,0,0,0,478,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,8,0,0,0,0,0,0,0,0,0,0,0,0,480,0,0,0,482,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,484,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,486,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,0,0,0,0,0,0,0,0,0,488,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,1,0,0,0,0,0,0,0,0,0,488,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,490,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,492,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,0,0,0,0,0,0,0,0,0,492,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,494,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,496,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,1,64,0,0,0,0,0,0,0,0,498,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,500,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,64,0,0,0,0,0,0,0,0,498,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,502,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,504,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,8,0,0,0,0,0,0,0,0,506,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,498,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,508,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,0,0,0,0,0,0,0,0,0,510,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,512,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,514,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,516,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,518,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,520,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,522,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,1,0,0,0,0,0,0,0,0,0,524,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,526,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,528,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,0,0,0,0,0,0,0,0,0,528,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,530,0,0,0,532,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,530,0,0,0,534,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,530,0,0,0,536,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,32,0,0,0,0,0,0,0,0,0,0,0,0,538,0,0,0,540,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,538,0,0,0,540,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,542,0,0,0,544,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,542,0,0,0,544,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,3,0,0,0,0,0,0,0,0,54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,1,0,0,0,0,0,0,0,0,54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,1,1,0,0,0,0,0,0,0,0,54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],["i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0],F);R.pc=G([108,116,114,105,109,0],"i8",F);R.qc=G([114,116,114,105,109,0],"i8",F);R.rc=G([116,114,105,109,0],"i8",F);R.oa=G([109,105,110,0],"i8",F);R.pa=G([109,97,120,0],"i8",F);R.Oq=G([116,121,112,101,111,102,0],"i8",F);R.Pq=G([108,101,110,103,116,104,0],"i8",F);R.sc=G([115,117,98,115,116,114,0],"i8",F);R.Qq=G([97,98,115,0],"i8",F);R.tc=G([114,111,117,110,100,0],"i8",F);R.Rq=G([117,112,112,101,114,0],"i8",F);R.Sq=G([108,111,119,101,114,0],"i8",F);R.xa=G([99,111,97,108,101,115,99,101,0],"i8",F);R.Xc=G([104,101,120,0],"i8",F);R.Yc=G([105,102,110,117,108,108,0],"i8",F);R.Zc=G([114,97,110,100,111,109,0],"i8",F);R.$c=G([114,97,110,100,111,109,98,108,111,98,0],"i8",F);R.ad=G([110,117,108,108,105,102,0],"i8",F);R.bd=G([115,113,108,105,116,101,95,118,101,114,115,105,111,110,0],"i8",F);R.cd=G([115,113,108,105,116,101,95,115,111,117,114,99,101,95,105,100,0],"i8",F);R.dd=G([115,113,108,105,116,101,95,108,111,103,0],"i8",F);R.ed=G([115,113,108,105,116,101,95,99,111,109,112,105,108,101,111,112,116,105,111,110,95,117,115,101,100,0],"i8",F);R.gd=G([115,113,108,105,116,101,95,99,111,109,112,105,108,101,111,112,116,105,111,110,95,103,101,116,0],"i8",F);R.hd=G([113,117,111,116,101,0],"i8",F);R.jd=G([108,97,115,116,95,105,110,115,101,114,116,95,114,111,119,105,100,0],"i8",F);R.kd=G([99,104,97,110,103,101,115,0],"i8",F);R.ld=G([116,111,116,97,108,95,99,104,97,110,103,101,115,0],"i8",F);R.md=G([114,101,112,108,97,99,101,0],"i8",F);R.nd=G([122,101,114,111,98,108,111,98,0],"i8",F);R.Xa=G([108,111,97,100,95,101,120,116,101,110,115,105,111,110,0],"i8",F);R.od=G([115,117,109,0],"i8",F);R.pd=G([116,111,116,97,108,0],"i8",F);R.rd=G([97,118,103,0],"i8",F);R.Ya=G([99,111,117,110,116,0],"i8",F);R.Za=G([103,114,111,117,112,95,99,111,110,99,97,116,0],"i8",F);tC=G([42,63,91,0],"i8",F);R.ya=G([103,108,111,98,0],"i8",F);sC=G([37,95,0,1],"i8",F);R.T=G([108,105,107,101,0],"i8",F);Ig=G([2,0,1,0,0,0,0,0,0,0,0,0,546,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,0,0,0,0,0,0,0,0,0,548,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,1,0,0,0,0,0,0,0,0,0,550,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],["i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0],F);R.sd=G([115,113,108,105,116,101,95,114,101,110,97,109,101,95,116,97,98,108,101,0],"i8",F);R.td=G([115,113,108,105,116,101,95,114,101,110,97,109,101,95,116,114,105,103,103,101,114,0],"i8",F);R.ud=G([115,113,108,105,116,101,95,114,101,110,97,109,101,95,112,97,114,101,110,116,0],"i8",F);R.vd=G([37,115,37,46,42,115,34,37,119,34,0],"i8",F);R.$a=G([37,115,37,115,0],"i8",F);R.ab=G([37,46,42,115,34,37,119,34,37,115,0],"i8",F);Bg=G([-1,0,1,0,0,0,0,0,0,0,0,0,552,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,1,0,0,0,0,0,0,0,0,0,554,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,1,0,0,0,0,0,0,0,0,0,556,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,1,0,0,0,0,0,0,0,0,0,558,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,1,0,0,0,0,0,0,0,0,0,560,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,562,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,564,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,566,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],["i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0],F);R.wd=G([106,117,108,105,97,110,100,97,121,0],"i8",F);R.xd=G([100,97,116,101,0],"i8",F);R.yd=G([116,105,109,101,0],"i8",F);R.zd=G([100,97,116,101,116,105,109,101,0],"i8",F);R.Ad=G([115,116,114,102,116,105,109,101,0],"i8",F);R.Bd=G([99,117,114,114,101,110,116,95,116,105,109,101,0],"i8",F);R.Cd=G([99,117,114,114,101,110,116,95,116,105,109,101,115,116,97,109,112,0],"i8",F);R.Dd=G([99,117,114,114,101,110,116,95,100,97,116,101,0],"i8",F);R.M=G([37,48,50,100,0],"i8",F);R.Ed=G([37,48,54,46,51,102,0],"i8",F);R.Fd=G([37,48,51,100,0],"i8",F);R.za=G([37,46,49,54,103,0],"i8",F);R.U=G([37,108,108,100,0],"i8",F);R.Gd=G([37,48,52,100,0],"i8",F);R.Hd=G([108,111,99,97,108,116,105,109,101,0],"i8",F);R.Id=G([117,110,105,120,101,112,111,99,104,0],"i8",F);R.Jd=G([117,116,99,0],"i8",F);R.Kd=G([119,101,101,107,100,97,121,32,0],"i8",F);R.Ld=G([115,116,97,114,116,32,111,102,32,0],"i8",F);R.bb=G([109,111,110,116,104,0],"i8",F);R.cb=G([121,101,97,114,0],"i8",F);R.eb=G([100,97,121,0],"i8",F);R.Nd=G([104,111,117,114,0],"i8",F);R.Od=G([109,105,110,117,116,101,0],"i8",F);R.Pd=G([115,101,99,111,110,100,0],"i8",F);R.Qd=G([108,111,99,97,108,32,116,105,109,101,32,117,110,97,118,97,105,108,97,98,108,101,0],"i8",F);R.Rd=G([110,111,119,0],"i8",F);R.Sd=G([37,48,52,100,45,37,48,50,100,45,37,48,50,100,32,37,48,50,100,58,37,48,50,100,58,37,48,50,100,0],"i8",F);R.Td=G([37,48,50,100,58,37,48,50,100,58,37,48,50,100,0],"i8",F);R.Ud=G([37,48,52,100,45,37,48,50,100,45,37,48,50,100,0],"i8",F);R.Vd=G([76,73,75,69,32,111,114,32,71,76,79,66,32,112,97,116,116,101,114,110,32,116,111,111,32,99,111,109,112,108,101,120,0],"i8",F);R.Wd=G([69,83,67,65,80,69,32,101,120,112,114,101,115,115,105,111,110,32,109,117,115,116,32,98,101,32,97,32,115,105,110,103,108,101,32,99,104,97,114,97,99,116,101,114,0],"i8",F);R.fb=G([44,0],"i8",F);R.gb=G([105,110,116,101,103,101,114,32,111,118,101,114,102,108,111,119,0],"i8",F);R.ra=G([48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70],"i8",F);R.V=G([78,85,76,76,0],"i8",F);R.Xd=G([37,46,42,102,0],"i8",F);R.hb=G([105,110,116,101,103,101,114,0],"i8",F);R.Yd=G([116,101,120,116,0],"i8",F);R.ib=G([114,101,97,108,0],"i8",F);R.Zd=G([98,108,111,98,0],"i8",F);R.kb=G([110,117,108,108,0],"i8",F);R.qr=G([1],"i8",F);Ht=G(4,"*",F);R.W=G([32,0],"i8",F);R.$d=G([105,110,116,101,114,114,117,112,116,0],"i8",F);R.ae=G([117,110,114,101,99,111,103,110,105,122,101,100,32,116,111,107,101,110,58,32,34,37,84,34,0],"i8",F);R.lb=G([110,101,97,114,32,34,37,84,34,58,32,115,121,110,116,97,120,32,101,114,114,111,114,0],"i8",F);jv=G([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],["i8","i8",0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0],F);R.be=G([115,101,116,32,108,105,115,116,0],"i8",F);R.ce=G([116,111,111,32,109,97,110,121,32,97,114,103,117,109,101,110,116,115,32,111,110,32,102,117,110,99,116,105,111,110,32,37,84,0],"i8",F);Hv=G([0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0],["*",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0],F);R.Aa=G([105,110,100,101,120,0],"i8",F);R.de=G([113,117,97,108,105,102,105,101,100,32,116,97,98,108,101,32,110,97,109,101,115,32,97,114,101,32,110,111,116,32,97,108,108,111,119,101,100,32,111,110,32,73,78,83,69,82,84,44,32,85,80,68,65,84,69,44,32,97,110,100,32,68,69,76,69,84,69,32,115,116,97,116,101,109,101,110,116,115,32,119,105,116,104,105,110,32,116,114,105,103,103,101,114,115,0],"i8",F);R.fe=G([116,104,101,32,73,78,68,69,88,69,68,32,66,89,32,99,108,97,117,115,101,32,105,115,32,110,111,116,32,97,108,108,111,119,101,100,32,111,110,32,85,80,68,65,84,69,32,111,114,32,68,69,76,69,84,69,32,115,116,97,116,101,109,101,110,116,115,32,119,105,116,104,105,110,32,116,114,105,103,103,101,114,115,0],"i8",F);R.ge=G([116,104,101,32,78,79,84,32,73,78,68,69,88,69,68,32,99,108,97,117,115,101,32,105,115,32,110,111,116,32,97,108,108,111,119,101,100,32,111,110,32,85,80,68,65,84,69,32,111,114,32,68,69,76,69,84,69,32,115,116,97,116,101,109,101,110,116,115,32,119,105,116,104,105,110,32,116,114,105,103,103,101,114,115,0],"i8",F);cw=G([-114,1,-113,2,-113,1,-112,1,-112,3,-111,0,-111,1,-111,3,-110,1,-109,3,-107,0,-107,1,-107,2,-108,0,-108,1,-108,1,-108,1,-109,2,-109,2,-109,2,-105,1,-105,0,-109,2,-109,3,-109,5,-109,2,-104,6,-102,1,-100,0,-100,3,-101,1,-101,0,-103,4,-103,2,-98,3,-98,1,-95,3,-94,1,-91,1,-91,1,-90,1,-106,1,-106,1,-106,1,-93,0,-93,1,-89,1,-89,4,-89,6,-88,1,-88,2,-87,1,-87,1,-92,2,-92,0,-84,3,-84,1,-83,2,-83,4,-83,3,-83,3,-83,2,-83,2,-83,3,-83,5,-83,2,-83,4,-83,4,-83,1,-83,2,-78,0,-78,1,-76,0,-76,2,-74,2,-74,3,-74,3,-74,3,-73,2,-73,2,-73,1,-73,1,-73,2,-75,3,-75,2,-72,0,-72,2,-72,2,-97,0,-97,2,-71,3,-71,2,-71,1,-70,2,-70,7,-70,5,-70,5,-70,10,-68,0,-68,1,-80,0,-80,3,-67,0,-67,2,-66,1,-66,1,-66,1,-109,4,-64,2,-64,0,-109,8,-109,4,-109,1,-96,1,-96,3,-61,1,-61,2,-61,1,-62,9,-60,1,-60,1,-60,0,-52,2,-52,0,-59,3,-59,2,-59,4,-51,2,-51,1,-51,0,-58,0,-58,2,-49,2,-49,0,-50,7,-50,7,-50,7,-99,0,-99,2,-63,2,-48,1,-48,2,-48,3,-48,4,-46,2,-46,0,-47,0,-47,3,-47,2,-45,4,-45,0,-54,0,-54,3,-42,4,-42,2,-41,1,-79,1,-79,1,-79,0,-56,0,-56,3,-55,0,-55,2,-53,0,-53,2,-53,4,-53,4,-109,5,-57,0,-57,2,-109,7,-39,5,-39,3,-109,8,-109,5,-109,6,-38,2,-38,1,-36,3,-36,1,-37,0,-37,3,-43,3,-43,1,-81,1,-81,3,-82,1,-81,1,-81,1,-81,3,-81,5,-82,1,-82,1,-81,1,-81,1,-81,3,-81,6,-81,5,-81,4,-82,1,-81,3,-81,3,-81,3,-81,3,-81,3,-81,3,-81,3,-81,3,-34,1,-34,2,-34,1,-34,2,-81,3,-81,5,-81,2,-81,3,-81,3,-81,4,-81,2,-81,2,-81,2,-81,2,-33,1,-33,2,-81,5,-32,1,-32,2,-81,5,-81,3,-81,5,-81,4,-81,4,-81,5,-30,5,-30,4,-29,2,-29,0,-31,1,-31,0,-35,1,-35,0,-40,3,-40,1,-109,11,-28,1,-28,0,-77,0,-77,3,-69,5,-69,3,-27,0,-27,2,-109,4,-109,1,-109,2,-109,3,-109,5,-109,6,-109,5,-109,6,-26,1,-26,1,-26,1,-26,1,-26,1,-86,2,-85,2,-24,1,-25,1,-25,0,-109,5,-23,11,-21,1,-21,1,-21,2,-21,0,-20,1,-20,1,-20,3,-19,0,-19,3,-18,0,-18,2,-22,3,-22,2,-16,1,-16,3,-15,0,-15,3,-15,2,-17,7,-17,8,-17,5,-17,5,-17,1,-81,4,-81,6,-65,1,-65,1,-65,1,-109,4,-109,6,-109,3,-13,0,-13,2,-14,1,-14,0,-109,1,-109,3,-109,1,-109,3,-109,6,-109,6,-12,1,-11,0,-11,1,-109,1,-109,4,-10,7,-9,1,-9,3,-8,0,-8,2,-7,1,-7,3,-6,1,-5,0,-5,4,-5,2],"i8",F);dw=G([-141,0,994,0,1118,0,223,0,157,0,-53,0,93,0,89,0,83,0,375,0,386,0,381,0,379,0,308,0,295,0,325,0,-47,0,27,0,1240,0,1234,0,1228,0,1221,0,1208,0,1187,0,1151,0,1111,0,1109,0,1077,0,1054,0,1022,0,1016,0,1e3,0,911,0,908,0,906,0,890,0,888,0,874,0,834,0,816,0,800,0,760,0,758,0,755,0,742,0,739,0,726,0,685,0,672,0,668,0,665,0,652,0,611,0,609,0,607,0,604,0,591,0,578,0,526,0,519,0,453,0,474,0,454,0,461,0,443,0,245,0,442,0,473,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,484,0,130,0,484,0,484,0,1145,0,909,0,1110,0,1088,0,1084,0,1033,0,1002,0,965,0,820,0,837,0,746,0,686,0,612,0,817,0,610,0,919,0,221,0,563,0,814,0,813,0,744,0,669,0,470,0,543,0,484,0,484,0,484,0,484,0,484,0,291,0,569,0,671,0,658,0,970,0,1290,0,1287,0,1286,0,1282,0,518,0,518,0,1280,0,1279,0,1277,0,1270,0,1268,0,1263,0,1261,0,1260,0,1256,0,1251,0,1247,0,1227,0,1185,0,1168,0,1167,0,1159,0,1148,0,1139,0,1117,0,1066,0,1049,0,1006,0,998,0,996,0,995,0,973,0,970,0,966,0,964,0,892,0,762,0,-52,0,881,0,932,0,802,0,731,0,619,0,812,0,664,0,660,0,627,0,392,0,331,0,124,0,1358,0,1357,0,1356,0,1354,0,1352,0,1351,0,1349,0,1319,0,1334,0,1346,0,1334,0,1334,0,1334,0,1334,0,1334,0,1334,0,1334,0,1320,0,1304,0,1334,0,1334,0,1319,0,1360,0,1325,0,1369,0,1326,0,1315,0,1311,0,1301,0,1324,0,1300,0,1335,0,1350,0,1345,0,1348,0,1342,0,1333,0,1341,0,1303,0,1332,0,1331,0,1284,0,1278,0,1274,0,1339,0,1309,0,1308,0,1347,0,1258,0,1344,0,1340,0,1257,0,1253,0,1337,0,1273,0,1302,0,1299,0,1298,0,1297,0,1296,0,1295,0,1328,0,1294,0,1264,0,1292,0,1291,0,1322,0,1321,0,1238,0,1232,0,1318,0,1317,0,1316,0,1314,0,1312,0,1310,0,1307,0,1283,0,1289,0,1288,0,1285,0,1276,0,1229,0,1224,0,1267,0,1281,0,1265,0,1262,0,1235,0,1255,0,1205,0,1183,0,1179,0,1177,0,1162,0,1140,0,1153,0,1184,0,1182,0,1102,0,1124,0,1103,0,1095,0,1090,0,1089,0,1093,0,1112,0,1115,0,1086,0,1105,0,1092,0,1087,0,1068,0,962,0,955,0,957,0,1031,0,1023,0,1030,0],["i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0],F);Ju=G([313,0,960,0,186,0,419,0,2,0,172,0,627,0,597,0,55,0,55,0,55,0,55,0,48,0,53,0,53,0,53,0,53,0,52,0,52,0,51,0,51,0,51,0,50,0,238,0,302,0,283,0,623,0,622,0,516,0,515,0,590,0,584,0,55,0,55,0,55,0,55,0,282,0,53,0,53,0,53,0,53,0,52,0,52,0,51,0,51,0,51,0,50,0,238,0,6,0,56,0,57,0,47,0,582,0,581,0,583,0,583,0,54,0,54,0,55,0,55,0,55,0,55,0,608,0,53,0,53,0,53,0,53,0,52,0,52,0,51,0,51,0,51,0,50,0,238,0,313,0,597,0,409,0,330,0,579,0,579,0,32,0,53,0,53,0,53,0,53,0,52,0,52,0,51,0,51,0,51,0,50,0,238,0,330,0,217,0,620,0,619,0,166,0,411,0,624,0,382,0,379,0,378,0,7,0,491,0,590,0,584,0,200,0,199,0,198,0,58,0,377,0,300,0,414,0,621,0,481,0,66,0,623,0,622,0,621,0,580,0,254,0,601,0,94,0,56,0,57,0,47,0,582,0,581,0,583,0,583,0,54,0,54,0,55,0,55,0,55,0,55,0,671,0,53,0,53,0,53,0,53,0,52,0,52,0,51,0,51,0,51,0,50,0,238,0,313,0,532,0,226,0,506,0,507,0,133,0,177,0,139,0,284,0,385,0,279,0,384,0,169,0,197,0,342,0,398,0,251,0,226,0,253,0,275,0,388,0,167,0,139,0,284,0,385,0,279,0,384,0,169,0,570,0,236,0,590,0,584,0,672,0,240,0,275,0,157,0,620,0,619,0,554,0,437,0,51,0,51,0,51,0,50,0,238,0,343,0,439,0,553,0,438,0,56,0,57,0,47,0,582,0,581,0,583,0,583,0,54,0,54,0,55,0,55,0,55,0,55,0,465,0,53,0,53,0,53,0,53,0,52,0,52,0,51,0,51,0,51,0,50,0,238,0,313,0,390,0,52,0,52,0,51,0,51,0,51,0,50,0,238,0,391,0,166,0,491,0,566,0,382,0,379,0,378,0,409,0,440,0,579,0,579,0,252,0,440,0,607,0,66,0,377,0,513,0,621,0,49,0,46,0,147,0,590,0,584,0,621,0,16,0,466,0,189,0,621,0,441,0,442,0,673,0,526,0,441,0,340,0,577,0,595,0,64,0,194,0,482,0,434,0,56,0,57,0,47,0,582,0,581,0,583,0,583,0,54,0,54,0,55,0,55,0,55,0,55,0,30,0,53,0,53,0,53,0,53,0,52,0,52,0,51,0,51,0,51,0,50,0,238,0,313,0,593,0,593,0,593,0,387,0,578,0,606,0,493,0,259,0,351,0,258,0,411,0,1,0,623,0,622,0,496,0,623,0,622,0,65,0,240,0,623,0,622,0,597,0,443,0,237,0,239,0,414,0,341,0,237,0,602,0,590,0,584,0,18,0,603,0,166,0,601,0,87,0,382,0,379,0,378,0,67,0,623,0,622,0,38,0,623,0,622,0,176,0,270,0,377,0,56,0,57,0,47,0,582,0,581,0,583,0,583,0,54,0,54,0,55,0,55,0,55,0,55,0,175,0,53,0,53,0,53,0,53,0,52,0,52,0,51,0,51,0,51,0,50,0,238,0,313,0,396,0,233,0,411,0,531,0,565,0,317,0,620,0,619,0,44,0,620,0,619,0,240,0,206,0,620,0,619,0,597,0,266,0,414,0,268,0,409,0,597,0,579,0,579,0,352,0,184,0,505,0,601,0,73,0,533,0,590,0,584,0,466,0,548,0,190,0,620,0,619,0,576,0,620,0,619,0,547,0,383,0,551,0,35,0,332,0,575,0,574,0,600,0,504,0,56,0,57,0,47,0,582,0,581,0,583,0,583,0,54,0,54,0,55,0,55,0,55,0,55,0,567,0,53,0,53,0,53,0,53,0,52,0,52,0,51,0,51,0,51,0,50,0,238,0,313,0,411,0,561,0,561,0,528,0,364,0,259,0,351,0,258,0,183,0,361,0,549,0,524,0,374,0,411,0,597,0,414,0,240,0,560,0,560,0,409,0,604,0,579,0,579,0,328,0,601,0,93,0,623,0,622,0,414,0,590,0,584,0,237,0,564,0,559,0,559,0,520,0,402,0,601,0,87,0,409,0,210,0,579,0,579,0,168,0,421,0,950,0,519,0,950,0,56,0,57,0,47,0,582,0,581,0,583,0,583,0,54,0,54,0,55,0,55,0,55,0,55,0,192,0,53,0,53,0,53,0,53,0,52,0,52,0,51,0,51,0,51,0,50,0,238,0,313,0,600,0,293,0,563,0,511,0,234,0,357,0,146,0,475,0,475,0,367,0,411,0,562,0,411,0,358,0,542,0,425,0,171,0,411,0,215,0,144,0,620,0,619,0,544,0,318,0,353,0,414,0,203,0,414,0,275,0,590,0,584,0,549,0,414,0,174,0,601,0,94,0,601,0,79,0,558,0,471,0,61,0,601,0,79,0,421,0,949,0,350,0,949,0,34,0,56,0,57,0,47,0,582,0,581,0,583,0,583,0,54,0,54,0,55,0,55,0,55,0,55,0,535,0,53,0,53,0,53,0,53,0,52,0,52,0,51,0,51,0,51,0,50,0,238,0,313,0,307,0,424,0,394,0,272,0,49,0,46,0,147,0,349,0,322,0,4,0,411,0,491,0,312,0,321,0,425,0,568,0,492,0,216,0,264,0,407,0,575,0,574,0,429,0,66,0,549,0,414,0,621,0,540,0,602,0,590,0,584,0,13,0,603,0,621,0,601,0,72,0,12,0,618,0,617,0,616,0,202,0,210,0,621,0,546,0,469,0,422,0,319,0,148,0,56,0,57,0,47,0,582,0,581,0,583,0,583,0,54,0,54,0,55,0,55,0,55,0,55,0,338,0,53,0,53,0,53,0,53,0,52,0,52,0,51,0,51,0,51,0,50,0,238,0,313,0,600,0,600,0,411,0,39,0,21,0,37,0,170,0,237,0,875,0,411,0,572,0,572,0,201,0,144,0,473,0,538,0,331,0,414,0,474,0,143,0,146,0,630,0,628,0,334,0,414,0,353,0,601,0,68,0,168,0,590,0,584,0,132,0,365,0,601,0,96,0,307,0,423,0,530,0,336,0,49,0,46,0,147,0,568,0,406,0,216,0,549,0,360,0,529,0,56,0,57,0,47,0,582,0,581,0,583,0,583,0,54,0,54,0,55,0,55,0,55,0,55,0,411,0,53,0,53,0,53,0,53,0,52,0,52,0,51,0,51,0,51,0,50,0,238,0,313,0,411,0,605,0,414,0,484,0,510,0,172,0,422,0,597,0,318,0,496,0,485,0,601,0,99,0,411,0,142,0,414,0,411,0,231,0,411,0,540,0,411,0,359,0,629,0,2,0,601,0,97,0,426,0,308,0,414,0,590,0,584,0,414,0,20,0,414,0,621,0,414,0,621,0,601,0,106,0,503,0,601,0,105,0,601,0,108,0,601,0,109,0,204,0,28,0,56,0,57,0,47,0,582,0,581,0,583,0,583,0,54,0,54,0,55,0,55,0,55,0,55,0,411,0,53,0,53,0,53,0,53,0,52,0,52,0,51,0,51,0,51,0,50,0,238,0,313,0,411,0,597,0,414,0,411,0,276,0,214,0,600,0,411,0,366,0,213,0,381,0,601,0,134,0,274,0,500,0,414,0,167,0,130,0,414,0,621,0,411,0,354,0,414,0,376,0,601,0,135,0,129,0,601,0,100,0,590,0,584,0,601,0,104,0,522,0,521,0,414,0,621,0,224,0,273,0,600,0,167,0,327,0,282,0,600,0,601,0,103,0,468,0,521,0,56,0,57,0,47,0,582,0,581,0,583,0,583,0,54,0,54,0,55,0,55,0,55,0,55,0,411,0,53,0,53,0,53,0,53,0,52,0,52,0,51,0,51,0,51,0,50,0,238,0,313,0,411,0,27,0,414,0,411,0,375,0,276,0,167,0,359,0,544,0,50,0,238,0,601,0,95,0,128,0,223,0,414,0,411,0,165,0,414,0,411,0,621,0,411,0,621,0,612,0,601,0,102,0,372,0,601,0,76,0,590,0,584,0,414,0,570,0,236,0,414,0,470,0,414,0,167,0,621,0,188,0,601,0,98,0,225,0,601,0,138,0,601,0,137,0,232,0,56,0,45,0,47,0,582,0,581,0,583,0,583,0,54,0,54,0,55,0,55,0,55,0,55,0,411,0,53,0,53,0,53,0,53,0,52,0,52,0,51,0,51,0,51,0,50,0,238,0,313,0,276,0,276,0,414,0,411,0,276,0,544,0,459,0,359,0,171,0,209,0,479,0,601,0,136,0,628,0,334,0,621,0,621,0,125,0,414,0,621,0,368,0,411,0,621,0,257,0,540,0,589,0,588,0,601,0,75,0,590,0,584,0,458,0,446,0,23,0,23,0,124,0,414,0,326,0,325,0,621,0,427,0,324,0,309,0,600,0,288,0,601,0,92,0,586,0,585,0,57,0,47,0,582,0,581,0,583,0,583,0,54,0,54,0,55,0,55,0,55,0,55,0,411,0,53,0,53,0,53,0,53,0,52,0,52,0,51,0,51,0,51,0,50,0,238,0,313,0,587,0,411,0,414,0,411,0,207,0,611,0,476,0,171,0,472,0,160,0,123,0,601,0,91,0,323,0,261,0,15,0,414,0,464,0,414,0,411,0,621,0,411,0,354,0,222,0,411,0,601,0,74,0,601,0,90,0,590,0,584,0,159,0,264,0,158,0,414,0,461,0,414,0,621,0,600,0,414,0,121,0,120,0,25,0,601,0,89,0,601,0,101,0,621,0,601,0,88,0,47,0,582,0,581,0,583,0,583,0,54,0,54,0,55,0,55,0,55,0,55,0,544,0,53,0,53,0,53,0,53,0,52,0,52,0,51,0,51,0,51,0,50,0,238,0,43,0,405,0,263,0,3,0,610,0,264,0,140,0,415,0,622,0,24,0,410,0,11,0,456,0,594,0,118,0,155,0,219,0,452,0,408,0,621,0,621,0,621,0,156,0,43,0,405,0,621,0,3,0,286,0,621,0,113,0,415,0,622,0,111,0,445,0,411,0,400,0,557,0,403,0,545,0,10,0,411,0,408,0,264,0,110,0,205,0,436,0,541,0,566,0,453,0,414,0,621,0,621,0,63,0,621,0,435,0,414,0,411,0,621,0,601,0,94,0,403,0,621,0,411,0,337,0,601,0,86,0,150,0,40,0,41,0,534,0,566,0,414,0,242,0,264,0,42,0,413,0,412,0,414,0,600,0,595,0,601,0,85,0,191,0,333,0,107,0,451,0,601,0,84,0,621,0,539,0,40,0,41,0,420,0,230,0,411,0,149,0,316,0,42,0,413,0,412,0,398,0,127,0,595,0,315,0,621,0,399,0,278,0,625,0,181,0,414,0,593,0,593,0,593,0,592,0,591,0,14,0,450,0,411,0,601,0,71,0,240,0,621,0,43,0,405,0,264,0,3,0,615,0,180,0,264,0,415,0,622,0,614,0,414,0,593,0,593,0,593,0,592,0,591,0,14,0,621,0,408,0,601,0,70,0,621,0,417,0,33,0,405,0,613,0,3,0,411,0,264,0,411,0,415,0,622,0,418,0,626,0,178,0,509,0,8,0,403,0,241,0,416,0,126,0,408,0,414,0,621,0,414,0,449,0,208,0,566,0,240,0,221,0,621,0,601,0,83,0,601,0,82,0,599,0,297,0,277,0,296,0,30,0,403,0,31,0,395,0,264,0,295,0,397,0,489,0,40,0,41,0,411,0,566,0,220,0,621,0,294,0,42,0,413,0,412,0,271,0,621,0,595,0,600,0,621,0,59,0,60,0,414,0,269,0,267,0,623,0,622,0,36,0,40,0,41,0,621,0,601,0,81,0,598,0,235,0,42,0,413,0,412,0,621,0,621,0,595,0,265,0,344,0,411,0,248,0,556,0,173,0,185,0,593,0,593,0,593,0,592,0,591,0,14,0,218,0,29,0,621,0,543,0,414,0,305,0,304,0,303,0,179,0,301,0,411,0,566,0,454,0,601,0,80,0,289,0,335,0,593,0,593,0,593,0,592,0,591,0,14,0,411,0,287,0,414,0,151,0,392,0,246,0,260,0,411,0,196,0,195,0,523,0,601,0,69,0,411,0,245,0,414,0,526,0,537,0,285,0,389,0,595,0,621,0,414,0,536,0,601,0,17,0,362,0,153,0,414,0,466,0,463,0,601,0,78,0,154,0,414,0,462,0,152,0,601,0,77,0,355,0,255,0,621,0,455,0,601,0,9,0,621,0,386,0,444,0,517,0,247,0,621,0,593,0,593,0,593,0,621,0,621,0,244,0,621,0,243,0,430,0,518,0,292,0,621,0,329,0,621,0,145,0,393,0,280,0,513,0,291,0,131,0,621,0,514,0,621,0,621,0,311,0,621,0,259,0,346,0,249,0,621,0,621,0,229,0,314,0,621,0,228,0,512,0,227,0,240,0,494,0,488,0,310,0,164,0,487,0,486,0,373,0,480,0,163,0,262,0,369,0,371,0,162,0,26,0,212,0,478,0,477,0,161,0,141,0,363,0,467,0,122,0,339,0,187,0,119,0,348,0,347,0,117,0,116,0,115,0,114,0,112,0,182,0,457,0,320,0,22,0,433,0,432,0,448,0,19,0,609,0,431,0,428,0,62,0,193,0,596,0,573,0,298,0,555,0,552,0,571,0,404,0,290,0,380,0,498,0,510,0,495,0,306,0,281,0,499,0,250,0,5,0,497,0,460,0,345,0,447,0,569,0,550,0,238,0,299,0,527,0,525,0,508,0,961,0,502,0,501,0,961,0,401,0,961,0,211,0,490,0,356,0,256,0,961,0,483,0,961,0,961,0,961,0,961,0,961,0,961,0,961,0,961,0,961,0,961,0,961,0,370,0],["i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0],F);R.mb=G([110,111,116,32,97,117,116,104,111,114,105,122,101,100,0],"i8",F);R.he=G([97,117,116,104,111,114,105,122,101,114,32,109,97,108,102,117,110,99,116,105,111,110,0],"i8",F);R.ie=G([67,82,69,65,84,69,32,86,73,82,84,85,65,76,32,84,65,66,76,69,32,37,84,0],"i8",F);R.je=G([85,80,68,65,84,69,32,37,81,46,37,115,32,83,69,84,32,116,121,112,101,61,39,116,97,98,108,101,39,44,32,110,97,109,101,61,37,81,44,32,116,98,108,95,110,97,109,101,61,37,81,44,32,114,111,111,116,112,97,103,101,61,48,44,32,115,113,108,61,37,81,32,87,72,69,82,69,32,114,111,119,105,100,61,35,37,100,0],"i8",F);R.n=G([115,113,108,105,116,101,95,116,101,109,112,95,109,97,115,116,101,114,0],"i8",F);R.o=G([115,113,108,105,116,101,95,109,97,115,116,101,114,0],"i8",F);R.ke=G([110,97,109,101,61,39,37,113,39,32,65,78,68,32,116,121,112,101,61,39,116,97,98,108,101,39,0],"i8",F);R.le=G([118,105,114,116,117,97,108,32,116,97,98,108,101,115,32,109,97,121,32,110,111,116,32,98,101,32,97,108,116,101,114,101,100,0],"i8",F);R.ne=G([67,97,110,110,111,116,32,97,100,100,32,97,32,99,111,108,117,109,110,32,116,111,32,97,32,118,105,101,119,0],"i8",F);R.oe=G([115,113,108,105,116,101,95,97,108,116,101,114,116,97,98,95,37,115,0],"i8",F);R.pe=G([117,110,97,98,108,101,32,116,111,32,111,112,101,110,32,97,32,116,101,109,112,111,114,97,114,121,32,100,97,116,97,98,97,115,101,32,102,105,108,101,32,102,111,114,32,115,116,111,114,105,110,103,32,116,101,109,112,111,114,97,114,121,32,116,97,98,108,101,115,0],"i8",F);R.N=G([115,113,108,105,116,101,95,0],"i8",F);R.qe=G([116,97,98,108,101,32,37,115,32,109,97,121,32,110,111,116,32,98,101,32,97,108,116,101,114,101,100,0],"i8",F);R.re=G([67,97,110,110,111,116,32,97,100,100,32,97,32,80,82,73,77,65,82,89,32,75,69,89,32,99,111,108,117,109,110,0],"i8",F);R.se=G([67,97,110,110,111,116,32,97,100,100,32,97,32,85,78,73,81,85,69,32,99,111,108,117,109,110,0],"i8",F);R.te=G([67,97,110,110,111,116,32,97,100,100,32,97,32,82,69,70,69,82,69,78,67,69,83,32,99,111,108,117,109,110,32,119,105,116,104,32,110,111,110,45,78,85,76,76,32,100,101,102,97,117,108,116,32,118,97,108,117,101,0],"i8",F);R.ue=G([67,97,110,110,111,116,32,97,100,100,32,97,32,78,79,84,32,78,85,76,76,32,99,111,108,117,109,110,32,119,105,116,104,32,100,101,102,97,117,108,116,32,118,97,108,117,101,32,78,85,76,76,0],"i8",F);R.ve=G([67,97,110,110,111,116,32,97,100,100,32,97,32,99,111,108,117,109,110,32,119,105,116,104,32,110,111,110,45,99,111,110,115,116,97,110,116,32,100,101,102,97,117,108,116,0],"i8",F);R.ye=G([85,80,68,65,84,69,32,34,37,119,34,46,37,115,32,83,69,84,32,115,113,108,32,61,32,115,117,98,115,116,114,40,115,113,108,44,49,44,37,100,41,32,124,124,32,39,44,32,39,32,124,124,32,37,81,32,124,124,32,115,117,98,115,116,114,40,115,113,108,44,37,100,41,32,87,72,69,82,69,32,116,121,112,101,32,61,32,39,116,97,98,108,101,39,32,65,78,68,32,110,97,109,101,32,61,32,37,81,0],"i8",F);R.ze=G([116,98,108,95,110,97,109,101,61,37,81,0],"i8",F);R.Ae=G([116,121,112,101,61,39,116,114,105,103,103,101,114,39,32,65,78,68,32,40,37,115,41,0],"i8",F);R.Be=G([110,97,109,101,61,37,81,0],"i8",F);R.Ce=G([37,115,32,79,82,32,110,97,109,101,61,37,81,0],"i8",F);R.De=G([45,0],"i8",F);R.nb=G([37,33,46,49,53,103,0],"i8",F);R.Ee=G([116,104,101,114,101,32,105,115,32,97,108,114,101,97,100,121,32,97,110,111,116,104,101,114,32,116,97,98,108,101,32,111,114,32,105,110,100,101,120,32,119,105,116,104,32,116,104,105,115,32,110,97,109,101,58,32,37,115,0],"i8",F);R.Fe=G([118,105,101,119,32,37,115,32,109,97,121,32,110,111,116,32,98,101,32,97,108,116,101,114,101,100,0],"i8",F);R.Ge=G([85,80,68,65,84,69,32,34,37,119,34,46,37,115,32,83,69,84,32,115,113,108,32,61,32,115,113,108,105,116,101,95,114,101,110,97,109,101,95,112,97,114,101,110,116,40,115,113,108,44,32,37,81,44,32,37,81,41,32,87,72,69,82,69,32,37,115,59,0],"i8",F);R.He=G([85,80,68,65,84,69,32,37,81,46,37,115,32,83,69,84,32,115,113,108,32,61,32,67,65,83,69,32,87,72,69,78,32,116,121,112,101,32,61,32,39,116,114,105,103,103,101,114,39,32,84,72,69,78,32,115,113,108,105,116,101,95,114,101,110,97,109,101,95,116,114,105,103,103,101,114,40,115,113,108,44,32,37,81,41,69,76,83,69,32,115,113,108,105,116,101,95,114,101,110,97,109,101,95,116,97,98,108,101,40,115,113,108,44,32,37,81,41,32,69,78,68,44,32,116,98,108,95,110,97,109,101,32,61,32,37,81,44,32,110,97,109,101,32,61,32,67,65,83,69,32,87,72,69,78,32,116,121,112,101,61,39,116,97,98,108,101,39,32,84,72,69,78,32,37,81,32,87,72,69,78,32,110,97,109,101,32,76,73,75,69,32,39,115,113,108,105,116,101,95,97,117,116,111,105,110,100,101,120,37,37,39,32,65,78,68,32,116,121,112,101,61,39,105,110,100,101,120,39,32,84,72,69,78,32,39,115,113,108,105,116,101,95,97,117,116,111,105,110,100,101,120,95,39,32,124,124,32,37,81,32,124,124,32,115,117,98,115,116,114,40,110,97,109,101,44,37,100,43,49,56,41,32,69,76,83,69,32,110,97,109,101,32,69,78,68,32,87,72,69,82,69,32,116,98,108,95,110,97,109,101,61,37,81,32,65,78,68,32,40,116,121,112,101,61,39,116,97,98,108,101,39,32,79,82,32,116,121,112,101,61,39,105,110,100,101,120,39,32,79,82,32,116,121,112,101,61,39,116,114,105,103,103,101,114,39,41,59,0],"i8",F);R.ob=G([115,113,108,105,116,101,95,115,101,113,117,101,110,99,101,0],"i8",F);R.Ie=G([85,80,68,65,84,69,32,34,37,119,34,46,115,113,108,105,116,101,95,115,101,113,117,101,110,99,101,32,115,101,116,32,110,97,109,101,32,61,32,37,81,32,87,72,69,82,69,32,110,97,109,101,32,61,32,37,81,0],"i8",F);R.Je=G([85,80,68,65,84,69,32,115,113,108,105,116,101,95,116,101,109,112,95,109,97,115,116,101,114,32,83,69,84,32,115,113,108,32,61,32,115,113,108,105,116,101,95,114,101,110,97,109,101,95,116,114,105,103,103,101,114,40,115,113,108,44,32,37,81,41,44,32,116,98,108,95,110,97,109,101,32,61,32,37,81,32,87,72,69,82,69,32,37,115,59,0],"i8",F);R.Ke=G([118,105,101,119,32,37,115,32,105,115,32,99,105,114,99,117,108,97,114,108,121,32,100,101,102,105,110,101,100,0],"i8",F);R.pb=G([110,111,32,115,117,99,104,32,99,111,108,108,97,116,105,111,110,32,115,101,113,117,101,110,99,101,58,32,37,115,0],"i8",F);R.pr=G([3,2,1],"i8",F);R.qb=G([73,78,84,69,71,69,82,0],"i8",F);R.Z=G([114,111,119,105,100,0],"i8",F);R.Le=G([37,115,58,37,100,0],"i8",F);R.Me=G([97,32,71,82,79,85,80,32,66,89,32,99,108,97,117,115,101,32,105,115,32,114,101,113,117,105,114,101,100,32,98,101,102,111,114,101,32,72,65,86,73,78,71,0],"i8",F);R.ja=G([79,82,68,69,82,0],"i8",F);R.Oe=G([71,82,79,85,80,0],"i8",F);R.Pe=G([97,103,103,114,101,103,97,116,101,32,102,117,110,99,116,105,111,110,115,32,97,114,101,32,110,111,116,32,97,108,108,111,119,101,100,32,105,110,32,116,104,101,32,71,82,79,85,80,32,66,89,32,99,108,97,117,115,101,0],"i8",F);R.Qe=G([116,111,111,32,109,97,110,121,32,116,101,114,109,115,32,105,110,32,79,82,68,69,82,32,66,89,32,99,108,97,117,115,101,0],"i8",F);R.Re=G([37,114,32,79,82,68,69,82,32,66,89,32,116,101,114,109,32,100,111,101,115,32,110,111,116,32,109,97,116,99,104,32,97,110,121,32,99,111,108,117,109,110,32,105,110,32,116,104,101,32,114,101,115,117,108,116,32,115,101,116,0],"i8",F);R.Se=G([37,114,32,37,115,32,66,89,32,116,101,114,109,32,111,117,116,32,111,102,32,114,97,110,103,101,32,45,32,115,104,111,117,108,100,32,98,101,32,98,101,116,119,101,101,110,32,49,32,97,110,100,32,37,100,0],"i8",F);R.Te=G([116,111,111,32,109,97,110,121,32,116,101,114,109,115,32,105,110,32,37,115,32,66,89,32,99,108,97,117,115,101,0],"i8",F);R.Ue=G([69,120,112,114,101,115,115,105,111,110,32,116,114,101,101,32,105,115,32,116,111,111,32,108,97,114,103,101,32,40,109,97,120,105,109,117,109,32,100,101,112,116,104,32,37,100,41,0],"i8",F);R.Ve=G([110,111,116,32,97,117,116,104,111,114,105,122,101,100,32,116,111,32,117,115,101,32,102,117,110,99,116,105,111,110,58,32,37,115,0],"i8",F);R.We=G([109,105,115,117,115,101,32,111,102,32,97,103,103,114,101,103,97,116,101,32,102,117,110,99,116,105,111,110,32,37,46,42,115,40,41,0],"i8",F);R.Ye=G([110,111,32,115,117,99,104,32,102,117,110,99,116,105,111,110,58,32,37,46,42,115,0],"i8",F);R.Ze=G([119,114,111,110,103,32,110,117,109,98,101,114,32,111,102,32,97,114,103,117,109,101,110,116,115,32,116,111,32,102,117,110,99,116,105,111,110,32,37,46,42,115,40,41,0],"i8",F);R.$e=G([115,117,98,113,117,101,114,105,101,115,32,112,114,111,104,105,98,105,116,101,100,32,105,110,32,67,72,69,67,75,32,99,111,110,115,116,114,97,105,110,116,115,0],"i8",F);R.af=G([112,97,114,97,109,101,116,101,114,115,32,112,114,111,104,105,98,105,116,101,100,32,105,110,32,67,72,69,67,75,32,99,111,110,115,116,114,97,105,110,116,115,0],"i8",F);R.rb=G([110,101,119,0],"i8",F);R.sb=G([111,108,100,0],"i8",F);R.bf=G([109,105,115,117,115,101,32,111,102,32,97,108,105,97,115,101,100,32,97,103,103,114,101,103,97,116,101,32,37,115,0],"i8",F);R.cf=G([110,111,32,115,117,99,104,32,99,111,108,117,109,110,0],"i8",F);R.df=G([97,109,98,105,103,117,111,117,115,32,99,111,108,117,109,110,32,110,97,109,101,0],"i8",F);R.ef=G([37,115,58,32,37,115,46,37,115,46,37,115,0],"i8",F);R.tb=G([37,115,58,32,37,115,46,37,115,0],"i8",F);R.ub=G([37,115,58,32,37,115,0],"i8",F);R.vb=G([82,79,87,73,68,0],"i8",F);R.gf=G([97,99,99,101,115,115,32,116,111,32,37,115,46,37,115,46,37,115,32,105,115,32,112,114,111,104,105,98,105,116,101,100,0],"i8",F);R.hf=G([97,99,99,101,115,115,32,116,111,32,37,115,46,37,115,32,105,115,32,112,114,111,104,105,98,105,116,101,100,0],"i8",F);R.jf=G([95,82,79,87,73,68,95,0],"i8",F);R.kf=G([79,73,68,0],"i8",F);R.lf=G([115,113,108,105,116,101,95,115,117,98,113,117,101,114,121,95,37,112,95,0],"i8",F);R.wb=G([37,115,46,37,115,0],"i8",F);R.mf=G([110,111,32,115,117,99,104,32,116,97,98,108,101,58,32,37,115,0],"i8",F);R.of=G([110,111,32,116,97,98,108,101,115,32,115,112,101,99,105,102,105,101,100,0],"i8",F);R.pf=G([116,111,111,32,109,97,110,121,32,99,111,108,117,109,110,115,32,105,110,32,114,101,115,117,108,116,32,115,101,116,0],"i8",F);R.qf=G([97,32,78,65,84,85,82,65,76,32,106,111,105,110,32,109,97,121,32,110,111,116,32,104,97,118,101,32,97,110,32,79,78,32,111,114,32,85,83,73,78,71,32,99,108,97,117,115,101,0],"i8",F);R.rf=G([99,97,110,110,111,116,32,104,97,118,101,32,98,111,116,104,32,79,78,32,97,110,100,32,85,83,73,78,71,32,99,108,97,117,115,101,115,32,105,110,32,116,104,101,32,115,97,109,101,32,106,111,105,110,0],"i8",F);R.sf=G([99,97,110,110,111,116,32,106,111,105,110,32,117,115,105,110,103,32,99,111,108,117,109,110,32,37,115,32,45,32,99,111,108,117,109,110,32,110,111,116,32,112,114,101,115,101,110,116,32,105,110,32,98,111,116,104,32,116,97,98,108,101,115,0],"i8",F);R.tf=G([110,111,32,115,117,99,104,32,105,110,100,101,120,58,32,37,115,0],"i8",F);R.xb=G([110,111,32,115,117,99,104,32,109,111,100,117,108,101,58,32,37,115,0],"i8",F);R.uf=G([118,116,97,98,108,101,32,99,111,110,115,116,114,117,99,116,111,114,32,102,97,105,108,101,100,58,32,37,115,0],"i8",F);R.vf=G([118,116,97,98,108,101,32,99,111,110,115,116,114,117,99,116,111,114,32,100,105,100,32,110,111,116,32,100,101,99,108,97,114,101,32,115,99,104,101,109,97,58,32,37,115,0],"i8",F);R.wf=G([104,105,100,100,101,110,0],"i8",F);R.yf=G([32,104,105,100,100,101,110,0],"i8",F);R.zf=G([111,98,106,101,99,116,32,110,97,109,101,32,114,101,115,101,114,118,101,100,32,102,111,114,32,105,110,116,101,114,110,97,108,32,117,115,101,58,32,37,115,0],"i8",F);R.Af=G([99,111,114,114,117,112,116,32,100,97,116,97,98,97,115,101,0],"i8",F);R.Bf=G([117,110,107,110,111,119,110,32,100,97,116,97,98,97,115,101,32,37,84,0],"i8",F);R.yb=G([105,100,120,0],"i8",F);R.zb=G([116,98,108,0],"i8",F);R.Ab=G([97,97,97,0],"i8",F);R.$=G([115,113,108,105,116,101,95,115,116,97,116,49,0],"i8",F);R.Cf=G([116,98,108,44,105,100,120,44,115,116,97,116,0],"i8",F);R.Df=G([67,82,69,65,84,69,32,84,65,66,76,69,32,37,81,46,37,115,40,37,115,41,0],"i8",F);R.ka=G([68,69,76,69,84,69,32,70,82,79,77,32,37,81,46,37,115,32,87,72,69,82,69,32,37,115,61,37,81,0],"i8",F);R.hr=G([67,82,69,65,84,69,32,84,65,66,76,69,32,115,113,108,105,116,101,95,109,97,115,116,101,114,40,10,32,32,116,121,112,101,32,116,101,120,116,44,10,32,32,110,97,109,101,32,116,101,120,116,44,10,32,32,116,98,108,95,110,97,109,101,32,116,101,120,116,44,10,32,32,114,111,111,116,112,97,103,101,32,105,110,116,101,103,101,114,44,10,32,32,115,113,108,32,116,101,120,116,10,41,0],"i8",F);R.ir=G([67,82,69,65,84,69,32,84,69,77,80,32,84,65,66,76,69,32,115,113,108,105,116,101,95,116,101,109,112,95,109,97,115,116,101,114,40,10,32,32,116,121,112,101,32,116,101,120,116,44,10,32,32,110,97,109,101,32,116,101,120,116,44,10,32,32,116,98,108,95,110,97,109,101,32,116,101,120,116,44,10,32,32,114,111,111,116,112,97,103,101,32,105,110,116,101,103,101,114,44,10,32,32,115,113,108,32,116,101,120,116,10,41,0],"i8",F);R.Bb=G([49,0],"i8",F);R.Cb=G([97,116,116,97,99,104,101,100,32,100,97,116,97,98,97,115,101,115,32,109,117,115,116,32,117,115,101,32,116,104,101,32,115,97,109,101,32,116,101,120,116,32,101,110,99,111,100,105,110,103,32,97,115,32,109,97,105,110,32,100,97,116,97,98,97,115,101,0],"i8",F);R.Ff=G([117,110,115,117,112,112,111,114,116,101,100,32,102,105,108,101,32,102,111,114,109,97,116,0],"i8",F);R.Gf=G([83,69,76,69,67,84,32,110,97,109,101,44,32,114,111,111,116,112,97,103,101,44,32,115,113,108,32,70,82,79,77,32,39,37,113,39,46,37,115,32,79,82,68,69,82,32,66,89,32,114,111,119,105,100,0],"i8",F);R.Hf=G([83,69,76,69,67,84,32,116,98,108,44,105,100,120,44,115,116,97,116,32,70,82,79,77,32,37,81,46,115,113,108,105,116,101,95,115,116,97,116,49,0],"i8",F);R.If=G([117,110,111,114,100,101,114,101,100,0],"i8",F);R.Jf=G([105,110,118,97,108,105,100,32,114,111,111,116,112,97,103,101,0],"i8",F);R.Ba=G([63,0],"i8",F);R.Kf=G([109,97,108,102,111,114,109,101,100,32,100,97,116,97,98,97,115,101,32,115,99,104,101,109,97,32,40,37,115,41,0],"i8",F);R.Lf=G([37,115,32,45,32,37,115,0],"i8",F);R.Mf=G([117,110,97,98,108,101,32,116,111,32,105,100,101,110,116,105,102,121,32,116,104,101,32,111,98,106,101,99,116,32,116,111,32,98,101,32,114,101,105,110,100,101,120,101,100,0],"i8",F);R.Nf=G([105,110,100,101,120,101,100,32,99,111,108,117,109,110,115,32,97,114,101,32,110,111,116,32,117,110,105,113,117,101,0],"i8",F);Uv=G([1,0,1,0,0,0,0,0,0,0,0,0,568,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],["i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0],F);R.Of=G([115,113,108,105,116,101,95,100,101,116,97,99,104,0],"i8",F);R.Pf=G([109,105,115,117,115,101,32,111,102,32,97,103,103,114,101,103,97,116,101,58,32,37,115,40,41,0],"i8",F);R.Qf=G([117,110,107,110,111,119,110,32,102,117,110,99,116,105,111,110,58,32,37,46,42,115,40,41,0],"i8",F);R.Rf=G([82,65,73,83,69,40,41,32,109,97,121,32,111,110,108,121,32,98,101,32,117,115,101,100,32,119,105,116,104,105,110,32,97,32,116,114,105,103,103,101,114,45,112,114,111,103,114,97,109,0],"i8",F);R.Sf=G([69,88,69,67,85,84,69,32,37,115,37,115,32,83,85,66,81,85,69,82,89,32,37,100,0],"i8",F);R.Tf=G([67,79,82,82,69,76,65,84,69,68,32,0],"i8",F);R.Uf=G([76,73,83,84,0],"i8",F);R.Wf=G([83,67,65,76,65,82,0],"i8",F);R.Xf=G([105,110,118,97,108,105,100,32,110,97,109,101,58,32,34,37,115,34,0],"i8",F);R.Yf=G([110,111,32,115,117,99,104,32,100,97,116,97,98,97,115,101,58,32,37,115,0],"i8",F);R.Zf=G([99,97,110,110,111,116,32,100,101,116,97,99,104,32,100,97,116,97,98,97,115,101,32,37,115,0],"i8",F);R.$f=G([99,97,110,110,111,116,32,68,69,84,65,67,72,32,100,97,116,97,98,97,115,101,32,119,105,116,104,105,110,32,116,114,97,110,115,97,99,116,105,111,110,0],"i8",F);R.ag=G([100,97,116,97,98,97,115,101,32,37,115,32,105,115,32,108,111,99,107,101,100,0],"i8",F);Tv=G([3,0,1,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],["i16",0,"i8","i8","*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0],F);R.bg=G([115,113,108,105,116,101,95,97,116,116,97,99,104,0],"i8",F);R.cg=G([116,111,111,32,109,97,110,121,32,97,116,116,97,99,104,101,100,32,100,97,116,97,98,97,115,101,115,32,45,32,109,97,120,32,37,100,0],"i8",F);R.dg=G([99,97,110,110,111,116,32,65,84,84,65,67,72,32,100,97,116,97,98,97,115,101,32,119,105,116,104,105,110,32,116,114,97,110,115,97,99,116,105,111,110,0],"i8",F);R.eg=G([100,97,116,97,98,97,115,101,32,37,115,32,105,115,32,97,108,114,101,97,100,121,32,105,110,32,117,115,101,0],"i8",F);R.gg=G([100,97,116,97,98,97,115,101,32,105,115,32,97,108,114,101,97,100,121,32,97,116,116,97,99,104,101,100,0],"i8",F);R.hg=G([117,110,97,98,108,101,32,116,111,32,111,112,101,110,32,100,97,116,97,98,97,115,101,58,32,37,115,0],"i8",F);R.ig=G([110,111,32,115,117,99,104,32,116,114,105,103,103,101,114,58,32,37,83,0],"i8",F);AE=G([72,0,-10,0,94,0,1,0,29,0,1,2,75,2,-9,1,94,0,1,0,29,0,0,2,75,2,-9,1,59,0,0,0,95,0,-2,0],"i8",F);R.jg=G([116,101,109,112,111,114,97,114,121,32,116,114,105,103,103,101,114,32,109,97,121,32,110,111,116,32,104,97,118,101,32,113,117,97,108,105,102,105,101,100,32,110,97,109,101,0],"i8",F);R.kg=G([99,97,110,110,111,116,32,99,114,101,97,116,101,32,116,114,105,103,103,101,114,115,32,111,110,32,118,105,114,116,117,97,108,32,116,97,98,108,101,115,0],"i8",F);R.lg=G([116,114,105,103,103,101,114,32,37,84,32,97,108,114,101,97,100,121,32,101,120,105,115,116,115,0],"i8",F);R.mg=G([99,97,110,110,111,116,32,99,114,101,97,116,101,32,116,114,105,103,103,101,114,32,111,110,32,115,121,115,116,101,109,32,116,97,98,108,101,0],"i8",F);R.ng=G([99,97,110,110,111,116,32,99,114,101,97,116,101,32,37,115,32,116,114,105,103,103,101,114,32,111,110,32,118,105,101,119,58,32,37,83,0],"i8",F);R.og=G([66,69,70,79,82,69,0],"i8",F);R.pg=G([65,70,84,69,82,0],"i8",F);R.rg=G([99,97,110,110,111,116,32,99,114,101,97,116,101,32,73,78,83,84,69,65,68,32,79,70,32,116,114,105,103,103,101,114,32,111,110,32,116,97,98,108,101,58,32,37,83,0],"i8",F);R.sg=G([37,115,32,37,84,32,99,97,110,110,111,116,32,114,101,102,101,114,101,110,99,101,32,111,98,106,101,99,116,115,32,105,110,32,100,97,116,97,98,97,115,101,32,37,115,0],"i8",F);R.tg=G([73,78,83,69,82,84,32,73,78,84,79,32,37,81,46,37,115,32,86,65,76,85,69,83,40,39,116,114,105,103,103,101,114,39,44,37,81,44,37,81,44,48,44,39,67,82,69,65,84,69,32,84,82,73,71,71,69,82,32,37,113,39,41,0],"i8",F);R.ug=G([116,121,112,101,61,39,116,114,105,103,103,101,114,39,32,65,78,68,32,110,97,109,101,61,39,37,113,39,0],"i8",F);R.vg=G([45,37,84,0],"i8",F);R.wg=G([100,101,102,97,117,108,116,95,99,97,99,104,101,95,115,105,122,101,0],"i8",F);eC=G([35,0,0,0,36,0,1,3,120,1,7,0,7,0,2,0,87,1,2,1,120,1,7,0,7,0,1,0,16,1,1,0],"i8",F);R.Ca=G([99,97,99,104,101,95,115,105,122,101,0],"i8",F);R.Eb=G([112,97,103,101,95,115,105,122,101,0],"i8",F);R.Fb=G([115,101,99,117,114,101,95,100,101,108,101,116,101,0],"i8",F);R.xg=G([112,97,103,101,95,99,111,117,110,116,0],"i8",F);R.yg=G([109,97,120,95,112,97,103,101,95,99,111,117,110,116,0],"i8",F);R.Gb=G([108,111,99,107,105,110,103,95,109,111,100,101,0],"i8",F);R.Hb=G([110,111,114,109,97,108,0],"i8",F);R.Ib=G([101,120,99,108,117,115,105,118,101,0],"i8",F);R.Jb=G([106,111,117,114,110,97,108,95,109,111,100,101,0],"i8",F);R.Kb=G([106,111,117,114,110,97,108,95,115,105,122,101,95,108,105,109,105,116,0],"i8",F);R.Lb=G([97,117,116,111,95,118,97,99,117,117,109,0],"i8",F);nC=G([35,0,1,0,36,0,1,4,27,1,0,0,6,0,2,0,7,0,1,0,37,0,7,1],"i8",F);R.zg=G([105,110,99,114,101,109,101,110,116,97,108,95,118,97,99,117,117,109,0],"i8",F);R.Mb=G([116,101,109,112,95,115,116,111,114,101,0],"i8",F);R.Nb=G([116,101,109,112,95,115,116,111,114,101,95,100,105,114,101,99,116,111,114,121,0],"i8",F);R.Bg=G([110,111,116,32,97,32,119,114,105,116,97,98,108,101,32,100,105,114,101,99,116,111,114,121,0],"i8",F);R.Ob=G([115,121,110,99,104,114,111,110,111,117,115,0],"i8",F);R.Cg=G([83,97,102,101,116,121,32,108,101,118,101,108,32,109,97,121,32,110,111,116,32,98,101,32,99,104,97,110,103,101,100,32,105,110,115,105,100,101,32,97,32,116,114,97,110,115,97,99,116,105,111,110,0],"i8",F);R.Dg=G([116,97,98,108,101,95,105,110,102,111,0],"i8",F);R.Pb=G([99,105,100,0],"i8",F);R.aa=G([110,97,109,101,0],"i8",F);R.Eg=G([116,121,112,101,0],"i8",F);R.Fg=G([110,111,116,110,117,108,108,0],"i8",F);R.Gg=G([100,102,108,116,95,118,97,108,117,101,0],"i8",F);R.Hg=G([112,107,0],"i8",F);R.Jg=G([105,110,100,101,120,95,105,110,102,111,0],"i8",F);R.Kg=G([115,101,113,110,111,0],"i8",F);R.Lg=G([105,110,100,101,120,95,108,105,115,116,0],"i8",F);R.la=G([115,101,113,0],"i8",F);R.Mg=G([117,110,105,113,117,101,0],"i8",F);R.Ng=G([100,97,116,97,98,97,115,101,95,108,105,115,116,0],"i8",F);R.Qb=G([102,105,108,101,0],"i8",F);R.Og=G([99,111,108,108,97,116,105,111,110,95,108,105,115,116,0],"i8",F);R.Pg=G([102,111,114,101,105,103,110,95,107,101,121,95,108,105,115,116,0],"i8",F);R.Qg=G([105,100,0],"i8",F);R.Rb=G([116,97,98,108,101,0],"i8",F);R.Sb=G([102,114,111,109,0],"i8",F);R.Sg=G([116,111,0],"i8",F);R.Tg=G([111,110,95,117,112,100,97,116,101,0],"i8",F);R.Ug=G([111,110,95,100,101,108,101,116,101,0],"i8",F);R.Tb=G([109,97,116,99,104,0],"i8",F);R.Vg=G([78,79,78,69,0],"i8",F);R.Wg=G([99,97,115,101,95,115,101,110,115,105,116,105,118,101,95,108,105,107,101,0],"i8",F);R.Ub=G([105,110,116,101,103,114,105,116,121,95,99,104,101,99,107,0],"i8",F);R.Xg=G([113,117,105,99,107,95,99,104,101,99,107,0],"i8",F);CC=G([20,1,0,0,121,1,0,0,94,0,3,0,16,3,1,0],"i8",F);R.Zg=G([42,42,42,32,105,110,32,100,97,116,97,98,97,115,101,32,37,115,32,42,42,42,10,0],"i8",F);AC=G([20,1,-1,0,94,0,3,0,65,1,4,0,94,0,5,0,94,0,6,0,91,4,3,3,91,5,3,3,91,6,3,3,16,3,1,0,120,1,0,0,6,0,0,0],"i8",F);R.$g=G([114,111,119,105,100,32,0],"i8",F);R.ah=G([32,109,105,115,115,105,110,103,32,102,114,111,109,32,105,110,100,101,120,32,0],"i8",F);BC=G([7,0,3,0,72,0,0,0,20,3,1,0,95,0,0,0,76,2,0,3,20,1,-1,0,94,0,2,0,94,0,3,0,91,3,2,2,16,2,1,0],"i8",F);R.bh=G([119,114,111,110,103,32,35,32,111,102,32,101,110,116,114,105,101,115,32,105,110,32,105,110,100,101,120,32,0],"i8",F);R.dh=G([111,107,0],"i8",F);R.Vb=G([101,110,99,111,100,105,110,103,0],"i8",F);xC=G([0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],["*",0,0,0,"i8","i8","i8","i8","*",0,0,0,"i8","i8","i8","i8","*",0,0,0,"i8","i8","i8","i8","*",0,0,0,"i8","i8","i8","i8","*",0,0,0,"i8","i8","i8","i8","*",0,0,0,"i8","i8","i8","i8","*",0,0,0,"i8","i8","i8","i8","*",0,0,0,"i8","i8","i8","i8","*",0,0,0,"i8","i8","i8","i8"],F);R.eh=G([85,84,70,56,0],"i8",F);R.fh=G([85,84,70,45,56,0],"i8",F);R.gh=G([85,84,70,45,49,54,108,101,0],"i8",F);R.hh=G([85,84,70,45,49,54,98,101,0],"i8",F);R.jh=G([85,84,70,49,54,108,101,0],"i8",F);R.kh=G([85,84,70,49,54,98,101,0],"i8",F);R.lh=G([85,84,70,45,49,54,0],"i8",F);R.mh=G([85,84,70,49,54,0],"i8",F);R.nh=G([117,110,115,117,112,112,111,114,116,101,100,32,101,110,99,111,100,105,110,103,58,32,37,115,0],"i8",F);R.oh=G([115,99,104,101,109,97,95,118,101,114,115,105,111,110,0],"i8",F);R.ph=G([117,115,101,114,95,118,101,114,115,105,111,110,0],"i8",F);R.qh=G([102,114,101,101,108,105,115,116,95,99,111,117,110,116,0],"i8",F);vC=G([35,0,1,0,7,0,1,0,37,0,0,1],"i8",F);wC=G([35,0,0,0,36,0,1,0,16,1,1,0],"i8",F);R.rh=G([99,111,109,112,105,108,101,95,111,112,116,105,111,110,115,0],"i8",F);R.sh=G([99,111,109,112,105,108,101,95,111,112,116,105,111,110,0],"i8",F);R.uh=G([119,97,108,95,99,104,101,99,107,112,111,105,110,116,0],"i8",F);R.Wb=G([102,117,108,108,0],"i8",F);R.vh=G([114,101,115,116,97,114,116,0],"i8",F);R.wh=G([98,117,115,121,0],"i8",F);R.xh=G([108,111,103,0],"i8",F);R.yh=G([99,104,101,99,107,112,111,105,110,116,101,100,0],"i8",F);R.Xb=G([119,97,108,95,97,117,116,111,99,104,101,99,107,112,111,105,110,116,0],"i8",F);R.zh=G([115,104,114,105,110,107,95,109,101,109,111,114,121,0],"i8",F);rC=G([37,95,0,0],"i8",F);R.Ah=G([83,69,84,32,78,85,76,76,0],"i8",F);R.Bh=G([83,69,84,32,68,69,70,65,85,76,84,0],"i8",F);R.Dh=G([67,65,83,67,65,68,69,0],"i8",F);R.Eh=G([82,69,83,84,82,73,67,84,0],"i8",F);R.Fh=G([78,79,32,65,67,84,73,79,78,0],"i8",F);BE=G([0,0,0,0,1024,0,0,0,0,0,0,0,2048,0,0,0,0,0,0,0,4096,0,0,0,0,0,0,0,8192,0,0,0,0,0,0,0,1048576,0,0,0,0,0,0,0,2097152,0,0,0,0,0,0,0,4194304,0,0,0,0,0,0,0,16777216,0,0,0,0,0,0,0,134217728,0,0,0,0,0,0,0,262144,0,0,0,0,0,0,0,8454144,0,0,0,0,0,0,0,131072,0,0,0,0,0,0,0,524288,0,0,0,0,0,0,0,33554432,0,0,0,0,0,0,0,67108864,0,0,0],["*",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0],F);R.Gh=G([102,117,108,108,95,99,111,108,117,109,110,95,110,97,109,101,115,0],"i8",F);R.Hh=G([115,104,111,114,116,95,99,111,108,117,109,110,95,110,97,109,101,115,0],"i8",F);R.Ih=G([99,111,117,110,116,95,99,104,97,110,103,101,115,0],"i8",F);R.Jh=G([101,109,112,116,121,95,114,101,115,117,108,116,95,99,97,108,108,98,97,99,107,115,0],"i8",F);R.Kh=G([108,101,103,97,99,121,95,102,105,108,101,95,102,111,114,109,97,116,0],"i8",F);R.Lh=G([102,117,108,108,102,115,121,110,99,0],"i8",F);R.Mh=G([99,104,101,99,107,112,111,105,110,116,95,102,117,108,108,102,115,121,110,99,0],"i8",F);R.Nh=G([114,101,118,101,114,115,101,95,117,110,111,114,100,101,114,101,100,95,115,101,108,101,99,116,115,0],"i8",F);R.Oh=G([97,117,116,111,109,97,116,105,99,95,105,110,100,101,120,0],"i8",F);R.Ph=G([105,103,110,111,114,101,95,99,104,101,99,107,95,99,111,110,115,116,114,97,105,110,116,115,0],"i8",F);R.Qh=G([119,114,105,116,97,98,108,101,95,115,99,104,101,109,97,0],"i8",F);R.Rh=G([111,109,105,116,95,114,101,97,100,108,111,99,107,0],"i8",F);R.Sh=G([114,101,97,100,95,117,110,99,111,109,109,105,116,116,101,100,0],"i8",F);R.Th=G([114,101,99,117,114,115,105,118,101,95,116,114,105,103,103,101,114,115,0],"i8",F);R.Uh=G([102,111,114,101,105,103,110,95,107,101,121,115,0],"i8",F);R.Vh=G([116,101,109,112,111,114,97,114,121,32,115,116,111,114,97,103,101,32,99,97,110,110,111,116,32,98,101,32,99,104,97,110,103,101,100,32,102,114,111,109,32,119,105,116,104,105,110,32,97,32,116,114,97,110,115,97,99,116,105,111,110,0],"i8",F);R.Zb=G([109,101,109,111,114,121,0],"i8",F);R.Xh=G([110,111,110,101,0],"i8",F);R.Yh=G([105,110,99,114,101,109,101,110,116,97,108,0],"i8",F);kC=G(24,"*",F);R.Zh=G([100,101,108,101,116,101,0],"i8",F);R.$h=G([112,101,114,115,105,115,116,0],"i8",F);R.ai=G([111,102,102,0],"i8",F);R.bi=G([116,114,117,110,99,97,116,101,0],"i8",F);R.ci=G([119,97,108,0],"i8",F);R.di=G([110,111,32,115,117,99,104,32,105,110,100,101,120,58,32,37,83,0],"i8",F);R.ei=G([105,110,100,101,120,32,97,115,115,111,99,105,97,116,101,100,32,119,105,116,104,32,85,78,73,81,85,69,32,111,114,32,80,82,73,77,65,82,89,32,75,69,89,32,99,111,110,115,116,114,97,105,110,116,32,99,97,110,110,111,116,32,98,101,32,100,114,111,112,112,101,100,0],"i8",F);R.fi=G([68,69,76,69,84,69,32,70,82,79,77,32,37,81,46,37,115,32,87,72,69,82,69,32,110,97,109,101,61,37,81,32,65,78,68,32,116,121,112,101,61,39,105,110,100,101,120,39,0],"i8",F);R.hi=G([85,80,68,65,84,69,32,37,81,46,37,115,32,83,69,84,32,114,111,111,116,112,97,103,101,61,37,100,32,87,72,69,82,69,32,35,37,100,32,65,78,68,32,114,111,111,116,112,97,103,101,61,35,37,100,0],"i8",F);R.Da=G([115,113,108,105,116,101,95,115,116,97,116,37,100,0],"i8",F);R.ii=G([48,0],"i8",F);R.ji=G([118,97,114,105,97,98,108,101,32,110,117,109,98,101,114,32,109,117,115,116,32,98,101,32,98,101,116,119,101,101,110,32,63,49,32,97,110,100,32,63,37,100,0],"i8",F);R.ki=G([116,111,111,32,109,97,110,121,32,83,81,76,32,118,97,114,105,97,98,108,101,115,0],"i8",F);R.li=G([116,97,98,108,101,32,37,83,32,104,97,115,32,37,100,32,99,111,108,117,109,110,115,32,98,117,116,32,37,100,32,118,97,108,117,101,115,32,119,101,114,101,32,115,117,112,112,108,105,101,100,0],"i8",F);R.mi=G([37,100,32,118,97,108,117,101,115,32,102,111,114,32,37,100,32,99,111,108,117,109,110,115,0],"i8",F);R.ni=G([116,97,98,108,101,32,37,83,32,104,97,115,32,110,111,32,99,111,108,117,109,110,32,110,97,109,101,100,32,37,115,0],"i8",F);R.oi=G([114,111,119,115,32,105,110,115,101,114,116,101,100,0],"i8",F);R.pi=G([97,116,32,109,111,115,116,32,37,100,32,116,97,98,108,101,115,32,105,110,32,97,32,106,111,105,110,0],"i8",F);R.ri=G([99,97,110,110,111,116,32,117,115,101,32,105,110,100,101,120,58,32,37,115,0],"i8",F);R.Vq=G([49,47,46,48],"i8",F);R.Xq=G([0,0,72,67,49,46,48,47],"i8",F);R.Uq=G([149,101,100],"i8",F);R.Yq=G([95,92],"i8",F);R.Wq=G([72,67],"i8",F);R.Ea=G([83,69,65,82,67,72,0],"i8",F);R.si=G([83,67,65,78,0],"i8",F);R.ti=G([37,115,32,83,85,66,81,85,69,82,89,32,37,100,0],"i8",F);R.ui=G([37,115,32,84,65,66,76,69,32,37,115,0],"i8",F);R.vi=G([37,115,32,65,83,32,37,115,0],"i8",F);R.wi=G([37,115,32,85,83,73,78,71,32,37,115,37,115,73,78,68,69,88,37,115,37,115,37,115,0],"i8",F);R.xi=G([65,85,84,79,77,65,84,73,67,32,0],"i8",F);R.yi=G([67,79,86,69,82,73,78,71,32,0],"i8",F);R.zi=G([37,115,32,85,83,73,78,71,32,73,78,84,69,71,69,82,32,80,82,73,77,65,82,89,32,75,69,89,0],"i8",F);R.Bi=G([37,115,32,40,114,111,119,105,100,61,63,41,0],"i8",F);R.Ci=G([37,115,32,40,114,111,119,105,100,62,63,32,65,78,68,32,114,111,119,105,100,60,63,41,0],"i8",F);R.Di=G([37,115,32,40,114,111,119,105,100,62,63,41,0],"i8",F);R.Ei=G([37,115,32,40,114,111,119,105,100,60,63,41,0],"i8",F);R.Fi=G([37,115,32,86,73,82,84,85,65,76,32,84,65,66,76,69,32,73,78,68,69,88,32,37,100,58,37,115,0],"i8",F);R.Gi=G([37,115,32,40,126,37,108,108,100,32,114,111,119,115,41,0],"i8",F);R.Hi=G([32,40,0],"i8",F);R.Ii=G([61,0],"i8",F);R.Ji=G([62,0],"i8",F);R.Ki=G([60,0],"i8",F);R.ac=G([41,0],"i8",F);R.Li=G([32,65,78,68,32,0],"i8",F);R.Mi=G([97,117,116,111,45,105,110,100,101,120,0],"i8",F);R.Ni=G([116,97,98,108,101,32,37,115,58,32,120,66,101,115,116,73,110,100,101,120,32,114,101,116,117,114,110,101,100,32,97,110,32,105,110,118,97,108,105,100,32,112,108,97,110,0],"i8",F);R.ma=G([102,111,114,101,105,103,110,32,107,101,121,32,99,111,110,115,116,114,97,105,110,116,32,102,97,105,108,101,100,0],"i8",F);R.Oi=G([102,111,114,101,105,103,110,32,107,101,121,32,109,105,115,109,97,116,99,104,0],"i8",F);R.Pi=G([37,115,46,37,115,32,109,97,121,32,110,111,116,32,98,101,32,78,85,76,76,0],"i8",F);R.bc=G([80,82,73,77,65,82,89,32,75,69,89,32,109,117,115,116,32,98,101,32,117,110,105,113,117,101,0],"i8",F);R.Qi=G([99,111,108,117,109,110,115,32,0],"i8",F);R.Ri=G([99,111,108,117,109,110,32,0],"i8",F);R.Ti=G([44,32,0],"i8",F);R.Ui=G([32,97,114,101,32,110,111,116,32,117,110,105,113,117,101,0],"i8",F);R.Vi=G([32,105,115,32,110,111,116,32,117,110,105,113,117,101,0],"i8",F);R.Wi=G([45,45,32,84,82,73,71,71,69,82,32,37,115,0],"i8",F);R.wc=G([0,1,1,4,4,16,0,2,2,2,2,2,2,0,36,36,0,0,0,36,4,5,4,0,0,1,1,5,5,0,0,0,2,0,0,0,2,16,0,0,0,0,0,0,0,0,17,17,17,17,8,17,17,17,17,2,2,0,0,0,0,0,0,0,0,2,0,1,76,76,1,1,1,5,5,21,21,21,21,21,21,1,76,76,76,76,76,76,76,76,76,76,1,36,2,1,8,8,0,2,1,1,2,0,2,2,0,0,0,0,0,0,12,69,21,1,2,0,1,8,5,5,5,0,0,0,2,0,1,0,2,0,0,0,0,0,1,0,1,0,0,4,4,4,4,4,2,2,0,0,0],"i8",F);R.mr=G([0,1,2,3,4,6,8,8,0,0,0,0],"i8",F);FF=G([0,0,0,0,3,0,0,0],["*",0,0,0,"i32",0,0,0],F);GF=G([0,0,0,0,3,0,0,0],["*",0,0,0,"i32",0,0,0],F);R.Xi=G([111,105,100,0],"i8",F);DE=G(20,["i8","i8","i8","i8","i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0],F);R.Yi=G([116,97,98,108,101,32,37,115,32,109,97,121,32,110,111,116,32,98,101,32,109,111,100,105,102,105,101,100,0],"i8",F);R.Zi=G([99,97,110,110,111,116,32,109,111,100,105,102,121,32,37,115,32,98,101,99,97,117,115,101,32,105,116,32,105,115,32,97,32,118,105,101,119,0],"i8",F);R.$i=G([110,111,32,115,117,99,104,32,99,111,108,117,109,110,58,32,37,115,0],"i8",F);R.aj=G([114,111,119,115,32,117,112,100,97,116,101,100,0],"i8",F);R.bj=G([95,114,111,119,105,100,95,0],"i8",F);R.dj=G([116,111,111,32,109,97,110,121,32,99,111,108,117,109,110,115,32,105,110,32,37,115,0],"i8",F);R.ej=G([114,111,119,115,32,100,101,108,101,116,101,100,0],"i8",F);R.jr=G([110,97,116,117,114,97,108,101,102,116,111,117,116,101,114,105,103,104,116,102,117,108,108,105,110,110,101,114,99,114,111,115,115,0],"i8",F);Bx=G([0,7,4,6,4,40,10,5,32,14,5,48,19,4,56,23,5,1,28,5,3],"i8",F);R.fj=G([117,110,107,110,111,119,110,32,111,114,32,117,110,115,117,112,112,111,114,116,101,100,32,106,111,105,110,32,116,121,112,101,58,32,37,84,32,37,84,37,115,37,84,0],"i8",F);R.gj=G([82,73,71,72,84,32,97,110,100,32,70,85,76,76,32,79,85,84,69,82,32,74,79,73,78,115,32,97,114,101,32,110,111,116,32,99,117,114,114,101,110,116,108,121,32,115,117,112,112,111,114,116,101,100,0],"i8",F);R.hj=G([97,32,74,79,73,78,32,99,108,97,117,115,101,32,105,115,32,114,101,113,117,105,114,101,100,32,98,101,102,111,114,101,32,37,115,0],"i8",F);R.ij=G([79,78,0],"i8",F);R.jj=G([85,83,73,78,71,0],"i8",F);R.kj=G([116,111,111,32,109,97,110,121,32,116,101,114,109,115,32,105,110,32,99,111,109,112,111,117,110,100,32,83,69,76,69,67,84,0],"i8",F);R.cc=G([68,73,83,84,73,78,67,84,0],"i8",F);R.dc=G([71,82,79,85,80,32,66,89,0],"i8",F);R.mj=G([79,82,68,69,82,32,66,89,0],"i8",F);R.nj=G([83,67,65,78,32,84,65,66,76,69,32,37,115,32,37,115,37,115,40,126,37,100,32,114,111,119,115,41,0],"i8",F);R.oj=G([85,83,73,78,71,32,67,79,86,69,82,73,78,71,32,73,78,68,69,88,32,0],"i8",F);R.pj=G([68,73,83,84,73,78,67,84,32,97,103,103,114,101,103,97,116,101,115,32,109,117,115,116,32,104,97,118,101,32,101,120,97,99,116,108,121,32,111,110,101,32,97,114,103,117,109,101,110,116,0],"i8",F);R.qj=G([85,83,69,32,84,69,77,80,32,66,45,84,82,69,69,32,70,79,82,32,37,115,0],"i8",F);R.rj=G([79,82,68,69,82,32,66,89,32,99,108,97,117,115,101,32,115,104,111,117,108,100,32,99,111,109,101,32,97,102,116,101,114,32,37,115,32,110,111,116,32,98,101,102,111,114,101,0],"i8",F);R.sj=G([76,73,77,73,84,32,99,108,97,117,115,101,32,115,104,111,117,108,100,32,99,111,109,101,32,97,102,116,101,114,32,37,115,32,110,111,116,32,98,101,102,111,114,101,0],"i8",F);R.tj=G([83,69,76,69,67,84,115,32,116,111,32,116,104,101,32,108,101,102,116,32,97,110,100,32,114,105,103,104,116,32,111,102,32,37,115,32,100,111,32,110,111,116,32,104,97,118,101,32,116,104,101,32,115,97,109,101,32,110,117,109,98,101,114,32,111,102,32,114,101,115,117,108,116,32,99,111,108,117,109,110,115,0],"i8",F);R.uj=G([67,79,77,80,79,85,78,68,32,83,85,66,81,85,69,82,73,69,83,32,37,100,32,65,78,68,32,37,100,32,37,115,40,37,115,41,0],"i8",F);R.vj=G([85,83,73,78,71,32,84,69,77,80,32,66,45,84,82,69,69,32,0],"i8",F);R.xj=G([85,78,73,79,78,32,65,76,76,0],"i8",F);R.yj=G([73,78,84,69,82,83,69,67,84,0],"i8",F);R.zj=G([69,88,67,69,80,84,0],"i8",F);R.Aj=G([85,78,73,79,78,0],"i8",F);R.Bj=G([111,110,108,121,32,97,32,115,105,110,103,108,101,32,114,101,115,117,108,116,32,97,108,108,111,119,101,100,32,102,111,114,32,97,32,83,69,76,69,67,84,32,116,104,97,116,32,105,115,32,112,97,114,116,32,111,102,32,97,110,32,101,120,112,114,101,115,115,105,111,110,0],"i8",F);R.Cj=G([112,97,114,97,109,101,116,101,114,115,32,97,114,101,32,110,111,116,32,97,108,108,111,119,101,100,32,105,110,32,118,105,101,119,115,0],"i8",F);R.ec=G([118,105,101,119,0],"i8",F);R.Dj=G([115,113,108,105,116,101,95,115,116,97,116,0],"i8",F);R.Ej=G([116,97,98,108,101,32,37,115,32,109,97,121,32,110,111,116,32,98,101,32,100,114,111,112,112,101,100,0],"i8",F);R.Fj=G([117,115,101,32,68,82,79,80,32,84,65,66,76,69,32,116,111,32,100,101,108,101,116,101,32,116,97,98,108,101,32,37,115,0],"i8",F);R.Ij=G([117,115,101,32,68,82,79,80,32,86,73,69,87,32,116,111,32,100,101,108,101,116,101,32,118,105,101,119,32,37,115,0],"i8",F);R.Jj=G([68,69,76,69,84,69,32,70,82,79,77,32,37,81,46,115,113,108,105,116,101,95,115,101,113,117,101,110,99,101,32,87,72,69,82,69,32,110,97,109,101,61,37,81,0],"i8",F);R.Kj=G([68,69,76,69,84,69,32,70,82,79,77,32,37,81,46,37,115,32,87,72,69,82,69,32,116,98,108,95,110,97,109,101,61,37,81,32,97,110,100,32,116,121,112,101,33,61,39,116,114,105,103,103,101,114,39,0],"i8",F);R.Lj=G([102,111,114,101,105,103,110,32,107,101,121,32,111,110,32,37,115,32,115,104,111,117,108,100,32,114,101,102,101,114,101,110,99,101,32,111,110,108,121,32,111,110,101,32,99,111,108,117,109,110,32,111,102,32,116,97,98,108,101,32,37,84,0],"i8",F);R.Mj=G([110,117,109,98,101,114,32,111,102,32,99,111,108,117,109,110,115,32,105,110,32,102,111,114,101,105,103,110,32,107,101,121,32,100,111,101,115,32,110,111,116,32,109,97,116,99,104,32,116,104,101,32,110,117,109,98,101,114,32,111,102,32,99,111,108,117,109,110,115,32,105,110,32,116,104,101,32,114,101,102,101,114,101,110,99,101,100,32,116,97,98,108,101,0],"i8",F);R.Nj=G([117,110,107,110,111,119,110,32,99,111,108,117,109,110,32,34,37,115,34,32,105,110,32,102,111,114,101,105,103,110,32,107,101,121,32,100,101,102,105,110,105,116,105,111,110,0],"i8",F);R.Oj=G([97,108,116,101,114,116,97,98,95,0],"i8",F);R.Pj=G([116,97,98,108,101,32,37,115,32,109,97,121,32,110,111,116,32,98,101,32,105,110,100,101,120,101,100,0],"i8",F);R.Qj=G([118,105,101,119,115,32,109,97,121,32,110,111,116,32,98,101,32,105,110,100,101,120,101,100,0],"i8",F);R.Rj=G([118,105,114,116,117,97,108,32,116,97,98,108,101,115,32,109,97,121,32,110,111,116,32,98,101,32,105,110,100,101,120,101,100,0],"i8",F);R.Tj=G([116,104,101,114,101,32,105,115,32,97,108,114,101,97,100,121,32,97,32,116,97,98,108,101,32,110,97,109,101,100,32,37,115,0],"i8",F);R.Uj=G([105,110,100,101,120,32,37,115,32,97,108,114,101,97,100,121,32,101,120,105,115,116,115,0],"i8",F);R.Vj=G([115,113,108,105,116,101,95,97,117,116,111,105,110,100,101,120,95,37,115,95,37,100,0],"i8",F);R.Wj=G([116,97,98,108,101,32,37,115,32,104,97,115,32,110,111,32,99,111,108,117,109,110,32,110,97,109,101,100,32,37,115,0],"i8",F);R.Xj=G([99,111,110,102,108,105,99,116,105,110,103,32,79,78,32,67,79,78,70,76,73,67,84,32,99,108,97,117,115,101,115,32,115,112,101,99,105,102,105,101,100,0],"i8",F);R.Yj=G([67,82,69,65,84,69,37,115,32,73,78,68,69,88,32,37,46,42,115,0],"i8",F);R.Zj=G([32,85,78,73,81,85,69,0],"i8",F);R.$j=G([73,78,83,69,82,84,32,73,78,84,79,32,37,81,46,37,115,32,86,65,76,85,69,83,40,39,105,110,100,101,120,39,44,37,81,44,37,81,44,35,37,100,44,37,81,41,59,0],"i8",F);R.ak=G([110,97,109,101,61,39,37,113,39,32,65,78,68,32,116,121,112,101,61,39,105,110,100,101,120,39,0],"i8",F);R.bk=G([116,97,98,108,101,32,34,37,115,34,32,104,97,115,32,109,111,114,101,32,116,104,97,110,32,111,110,101,32,112,114,105,109,97,114,121,32,107,101,121,0],"i8",F);R.ck=G([65,85,84,79,73,78,67,82,69,77,69,78,84,32,105,115,32,111,110,108,121,32,97,108,108,111,119,101,100,32,111,110,32,97,110,32,73,78,84,69,71,69,82,32,80,82,73,77,65,82,89,32,75,69,89,0],"i8",F);R.dk=G([100,101,102,97,117,108,116,32,118,97,108,117,101,32,111,102,32,99,111,108,117,109,110,32,91,37,115,93,32,105,115,32,110,111,116,32,99,111,110,115,116,97,110,116,0],"i8",F);R.ek=G([116,111,111,32,109,97,110,121,32,99,111,108,117,109,110,115,32,111,110,32,37,115,0],"i8",F);R.fk=G([100,117,112,108,105,99,97,116,101,32,99,111,108,117,109,110,32,110,97,109,101,58,32,37,115,0],"i8",F);R.gk=G([84,65,66,76,69,0],"i8",F);R.hk=G([86,73,69,87,0],"i8",F);R.ik=G([67,82,69,65,84,69,32,37,115,32,37,46,42,115,0],"i8",F);R.jk=G([85,80,68,65,84,69,32,37,81,46,37,115,32,83,69,84,32,116,121,112,101,61,39,37,115,39,44,32,110,97,109,101,61,37,81,44,32,116,98,108,95,110,97,109,101,61,37,81,44,32,114,111,111,116,112,97,103,101,61,35,37,100,44,32,115,113,108,61,37,81,32,87,72,69,82,69,32,114,111,119,105,100,61,35,37,100,0],"i8",F);R.kk=G([67,82,69,65,84,69,32,84,65,66,76,69,32,37,81,46,115,113,108,105,116,101,95,115,101,113,117,101,110,99,101,40,110,97,109,101,44,115,101,113,41,0],"i8",F);R.lk=G([116,98,108,95,110,97,109,101,61,39,37,113,39,0],"i8",F);R.nk=G([10,32,32,0],"i8",F);R.ok=G([44,10,32,32,0],"i8",F);R.pk=G([10,41,0],"i8",F);R.qk=G([67,82,69,65,84,69,32,84,65,66,76,69,32,0],"i8",F);xG=G(20,"*",F);R.rk=G([32,84,69,88,84,0],"i8",F);R.sk=G([32,78,85,77,0],"i8",F);R.tk=G([32,73,78,84,0],"i8",F);R.uk=G([32,82,69,65,76,0],"i8",F);R.vk=G([116,101,109,112,111,114,97,114,121,32,116,97,98,108,101,32,110,97,109,101,32,109,117,115,116,32,98,101,32,117,110,113,117,97,108,105,102,105,101,100,0],"i8",F);R.wk=G([116,97,98,108,101,32,37,84,32,97,108,114,101,97,100,121,32,101,120,105,115,116,115,0],"i8",F);R.yk=G([116,104,101,114,101,32,105,115,32,97,108,114,101,97,100,121,32,97,110,32,105,110,100,101,120,32,110,97,109,101,100,32,37,115,0],"i8",F);kw=G(12,"*",F);R.gc=G([66,69,71,73,78,0],"i8",F);R.zk=G([82,69,76,69,65,83,69,0],"i8",F);R.hc=G([82,79,76,76,66,65,67,75,0],"i8",F);R.Ak=G([67,79,77,77,73,84,0],"i8",F);Ou=G([0,0,0,0,0,0,0,0,0,0,0,0],["i32",0,0,0,"i8","i8","i8","i8","i8","i8","i8","i8"],F);R.Bk=G([112,97,114,115,101,114,32,115,116,97,99,107,32,111,118,101,114,102,108,111,119,0],"i8",F);Iu=G([975,0,1114,0,1343,0,1114,0,1213,0,1213,0,90,0,90,0,0,0,-19,0,1213,0,1213,0,1213,0,1213,0,1213,0,345,0,445,0,721,0,1091,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1236,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,1213,0,199,0,445,0,445,0,835,0,835,0,365,0,1164,0,55,0,647,0,573,0,499,0,425,0,351,0,277,0,203,0,129,0,795,0,795,0,795,0,795,0,795,0,795,0,795,0,795,0,795,0,795,0,795,0,795,0,795,0,795,0,795,0,795,0,795,0,795,0,869,0,795,0,943,0,1017,0,1017,0,-69,0,-45,0,-45,0,-45,0,-45,0,-45,0,-1,0,58,0,138,0,100,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,537,0,438,0,445,0,445,0,445,0,445,0,445,0,365,0,807,0,1436,0,-74,0,-74,0,-74,0,1293,0,73,0,434,0,434,0,311,0,314,0,290,0,283,0,286,0,540,0,467,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,445,0,65,0,722,0,722,0,722,0,688,0,266,0,1164,0,1164,0,1164,0,-74,0,-74,0,-74,0,136,0,168,0,168,0,234,0,360,0,360,0,360,0,430,0,372,0,435,0,352,0,278,0,126,0,-36,0,-36,0,-36,0,-36,0,421,0,651,0,-36,0,-36,0,592,0,292,0,212,0,623,0,158,0,204,0,204,0,505,0,158,0,505,0,144,0,365,0,154,0,365,0,154,0,645,0,154,0,204,0,154,0,154,0,535,0,548,0,548,0,365,0,387,0,508,0,233,0,1464,0,1222,0,1222,0,1456,0,1456,0,1222,0,1462,0,1410,0,1165,0,1468,0,1468,0,1468,0,1468,0,1222,0,1165,0,1462,0,1410,0,1410,0,1222,0,1448,0,1338,0,1425,0,1222,0,1222,0,1448,0,1222,0,1448,0,1222,0,1448,0,1419,0,1313,0,1313,0,1313,0,1387,0,1364,0,1364,0,1419,0,1313,0,1336,0,1313,0,1387,0,1313,0,1313,0,1254,0,1245,0,1254,0,1245,0,1254,0,1245,0,1222,0,1222,0,1186,0,1189,0,1175,0,1169,0,1171,0,1165,0,1164,0,1243,0,1244,0,1244,0,1212,0,1212,0,1212,0,1212,0,-74,0,-74,0,-74,0,-74,0,-74,0,-74,0,939,0,104,0,680,0,571,0,327,0,1,0,980,0,26,0,972,0,971,0,946,0,901,0,870,0,830,0,806,0,54,0,21,0,-73,0,510,0,242,0,1198,0,1190,0,1170,0,1042,0,1161,0,1108,0,1146,0,1141,0,1132,0,1015,0,1127,0,1026,0,1034,0,1020,0,1107,0,1004,0,1116,0,1121,0,1005,0,1099,0,951,0,1043,0,1003,0,969,0,1045,0,1035,0,950,0,1053,0,1047,0,1025,0,942,0,913,0,992,0,1019,0,945,0,984,0,940,0,876,0,904,0,953,0,896,0,748,0,804,0,880,0,786,0,868,0,819,0,805,0,810,0,773,0,751,0,766,0,706,0,716,0,691,0,681,0,568,0,655,0,638,0,676,0,516,0,541,0,594,0,599,0,567,0,541,0,534,0,507,0,527,0,498,0,523,0,466,0,382,0,409,0,384,0,357,0,6,0,240,0,224,0,143,0,62,0,18,0,71,0,39,0,9,0,5,0],["i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0],F);Ku=G([635,0,870,0,959,0,959,0,959,0,870,0,899,0,899,0,959,0,759,0,959,0,959,0,959,0,959,0,868,0,959,0,959,0,933,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,899,0,899,0,674,0,763,0,794,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,932,0,934,0,809,0,808,0,802,0,801,0,912,0,774,0,799,0,792,0,785,0,796,0,871,0,864,0,865,0,863,0,867,0,872,0,959,0,795,0,831,0,848,0,830,0,842,0,847,0,854,0,846,0,843,0,833,0,832,0,666,0,834,0,835,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,661,0,728,0,959,0,959,0,959,0,959,0,959,0,959,0,836,0,837,0,851,0,850,0,849,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,939,0,937,0,959,0,883,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,641,0,959,0,759,0,759,0,759,0,635,0,959,0,959,0,959,0,959,0,951,0,763,0,753,0,719,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,804,0,742,0,922,0,924,0,959,0,905,0,740,0,663,0,761,0,676,0,751,0,643,0,798,0,776,0,776,0,917,0,798,0,917,0,700,0,959,0,788,0,959,0,788,0,697,0,788,0,776,0,788,0,788,0,866,0,959,0,959,0,959,0,760,0,751,0,959,0,944,0,767,0,767,0,936,0,936,0,767,0,810,0,732,0,798,0,739,0,739,0,739,0,739,0,767,0,798,0,810,0,732,0,732,0,767,0,658,0,911,0,909,0,767,0,767,0,658,0,767,0,658,0,767,0,658,0,876,0,730,0,730,0,730,0,715,0,880,0,880,0,876,0,730,0,700,0,730,0,715,0,730,0,730,0,780,0,775,0,780,0,775,0,780,0,775,0,767,0,767,0,959,0,793,0,781,0,791,0,789,0,798,0,959,0,718,0,651,0,651,0,640,0,640,0,640,0,640,0,956,0,956,0,951,0,702,0,702,0,684,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,885,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,636,0,946,0,959,0,959,0,943,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,915,0,959,0,959,0,959,0,959,0,959,0,959,0,908,0,907,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,790,0,959,0,782,0,959,0,869,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,959,0,745,0,819,0,959,0,818,0,822,0,817,0,668,0,959,0,649,0,959,0,632,0,637,0,955,0,958,0,957,0,954,0,953,0,952,0,947,0,945,0,942,0,941,0,940,0,938,0,935,0,931,0,889,0,887,0,894,0,893,0,892,0,891,0,890,0,888,0,886,0,884,0,805,0,803,0,800,0,797,0,930,0,882,0,741,0,738,0,737,0,657,0,948,0,914,0,923,0,921,0,811,0,920,0,919,0,918,0,916,0,913,0,900,0,807,0,806,0,733,0,874,0,873,0,660,0,904,0,903,0,902,0,906,0,910,0,901,0,769,0,659,0,656,0,665,0,722,0,721,0,729,0,727,0,726,0,725,0,724,0,723,0,720,0,667,0,675,0,686,0,714,0,699,0,698,0,879,0,881,0,878,0,877,0,707,0,706,0,712,0,711,0,710,0,709,0,708,0,705,0,704,0,703,0,696,0,695,0,701,0,694,0,717,0,716,0,713,0,693,0,736,0,735,0,734,0,731,0,692,0,691,0,690,0,822,0,689,0,688,0,828,0,827,0,815,0,858,0,756,0,755,0,754,0,766,0,765,0,778,0,777,0,813,0,812,0,779,0,764,0,758,0,757,0,773,0,772,0,771,0,770,0,762,0,752,0,784,0,787,0,786,0,783,0,860,0,768,0,857,0,929,0,928,0,927,0,926,0,925,0,862,0,861,0,829,0,826,0,679,0,680,0,898,0,896,0,897,0,895,0,682,0,681,0,678,0,677,0,859,0,747,0,746,0,855,0,852,0,844,0,840,0,856,0,853,0,845,0,841,0,839,0,838,0,824,0,823,0,821,0,820,0,816,0,825,0,670,0,748,0,744,0,743,0,814,0,750,0,749,0,687,0,685,0,683,0,664,0,662,0,655,0,653,0,652,0,654,0,650,0,648,0,647,0,646,0,645,0,644,0,673,0,672,0,671,0,669,0,668,0,642,0,639,0,638,0,634,0,633,0,631,0],["i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0,"i16",0],F);R.Ac=G([19,142,143,144,145,24,1,26,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,15,98,26,27,7,8,49,50,77,78,79,80,109,82,83,84,85,86,87,88,89,90,91,92,22,68,69,70,71,72,73,74,75,76,77,78,79,80,23,82,83,84,85,86,87,88,89,90,91,92,19,94,112,19,114,115,25,82,83,84,85,86,87,88,89,90,91,92,19,22,94,95,96,150,150,99,100,101,76,150,49,50,105,106,107,54,110,158,165,165,161,162,26,27,165,113,16,174,175,68,69,70,71,72,73,74,75,76,77,78,79,80,118,82,83,84,85,86,87,88,89,90,91,92,19,23,92,97,98,24,96,97,98,99,100,101,102,25,97,216,60,92,62,109,221,25,97,98,99,100,101,102,86,87,49,50,118,116,109,25,94,95,32,97,88,89,90,91,92,128,104,41,106,68,69,70,71,72,73,74,75,76,77,78,79,80,11,82,83,84,85,86,87,88,89,90,91,92,19,19,86,87,88,89,90,91,92,27,96,150,66,99,100,101,112,150,114,115,138,150,161,162,110,103,165,222,223,224,49,50,165,22,57,24,165,170,171,118,94,170,171,23,98,25,185,186,243,68,69,70,71,72,73,74,75,76,77,78,79,80,126,82,83,84,85,86,87,88,89,90,91,92,19,129,130,131,88,23,172,173,105,106,107,150,22,26,27,181,26,27,22,116,26,27,26,230,231,197,165,230,231,113,49,50,204,117,96,174,175,99,100,101,22,26,27,136,26,27,118,16,110,68,69,70,71,72,73,74,75,76,77,78,79,80,118,82,83,84,85,86,87,88,89,90,91,92,19,214,215,150,23,23,155,94,95,22,94,95,116,160,94,95,94,60,165,62,112,26,114,115,128,23,36,174,175,88,49,50,57,120,22,94,95,23,94,95,120,51,25,136,169,170,171,194,58,68,69,70,71,72,73,74,75,76,77,78,79,80,23,82,83,84,85,86,87,88,89,90,91,92,19,150,12,12,23,228,105,106,107,23,233,25,165,19,150,94,165,116,28,28,112,174,114,115,108,174,175,26,27,165,49,50,231,11,44,44,46,46,174,175,112,160,114,115,50,22,23,57,25,68,69,70,71,72,73,74,75,76,77,78,79,80,119,82,83,84,85,86,87,88,89,90,91,92,19,194,225,23,23,215,19,95,105,106,107,150,23,150,27,23,67,25,150,206,207,94,95,166,104,218,165,22,165,109,49,50,120,165,25,174,175,174,175,23,21,234,174,175,22,23,239,25,25,68,69,70,71,72,73,74,75,76,77,78,79,80,205,82,83,84,85,86,87,88,89,90,91,92,19,22,23,216,23,222,223,224,63,220,35,150,150,163,220,67,166,167,168,150,169,170,171,161,162,25,165,165,150,113,49,50,25,117,165,174,175,35,7,8,9,160,160,165,120,100,67,247,248,68,69,70,71,72,73,74,75,76,77,78,79,80,193,82,83,84,85,86,87,88,89,90,91,92,19,194,194,150,135,24,137,35,231,138,150,129,130,206,207,30,27,213,165,34,118,95,0,1,2,165,218,174,175,50,49,50,22,48,174,175,22,23,23,244,222,223,224,166,167,168,120,239,23,68,69,70,71,72,73,74,75,76,77,78,79,80,150,82,83,84,85,86,87,88,89,90,91,92,19,150,173,165,181,182,24,67,26,104,181,188,174,175,150,39,165,150,52,150,150,150,150,144,145,174,175,249,250,165,49,50,165,52,165,165,165,165,174,175,29,174,175,174,175,174,175,160,22,68,69,70,71,72,73,74,75,76,77,78,79,80,150,82,83,84,85,86,87,88,89,90,91,92,19,150,94,165,150,150,160,194,150,213,160,52,174,175,23,23,165,25,22,165,165,150,150,165,52,174,175,22,174,175,49,50,174,175,190,191,165,165,240,23,194,25,187,109,194,174,175,190,191,68,69,70,71,72,73,74,75,76,77,78,79,80,150,82,83,84,85,86,87,88,89,90,91,92,19,150,22,165,150,23,150,25,150,166,91,92,174,175,22,217,165,150,102,165,150,165,150,165,150,174,175,19,174,175,49,50,165,86,87,165,23,165,25,165,24,174,175,187,174,175,174,175,205,68,69,70,71,72,73,74,75,76,77,78,79,80,150,82,83,84,85,86,87,88,89,90,91,92,19,150,150,165,150,150,166,23,150,25,160,20,174,175,1,2,165,165,104,165,165,43,150,165,240,150,49,50,174,175,49,50,23,23,25,25,53,165,187,187,165,23,187,25,194,205,174,175,71,72,69,70,71,72,73,74,75,76,77,78,79,80,150,82,83,84,85,86,87,88,89,90,91,92,19,98,150,165,150,160,150,59,25,53,104,22,174,175,213,138,5,165,1,165,150,165,150,150,240,150,174,175,174,175,49,50,118,150,35,165,27,165,165,194,165,108,127,76,174,175,174,175,165,174,175,70,71,72,73,74,75,76,77,78,79,80,166,82,83,84,85,86,87,88,89,90,91,92,19,20,193,22,150,150,150,26,27,76,150,22,1,150,119,121,217,20,37,165,165,165,16,19,20,165,22,205,165,119,26,27,108,128,150,150,150,56,150,22,150,37,150,127,160,23,150,66,193,165,165,165,16,165,23,165,150,165,174,175,56,165,150,65,174,175,15,86,87,88,66,165,140,150,93,94,95,165,194,98,174,175,22,3,164,193,174,175,165,150,86,87,4,180,150,248,251,93,94,95,216,180,98,251,165,221,150,149,6,165,129,130,131,132,133,134,193,150,174,175,116,165,19,20,150,22,149,151,150,26,27,149,165,129,130,131,132,133,134,165,37,174,175,165,149,19,20,13,22,150,150,150,26,27,146,147,151,150,25,56,152,159,154,37,165,165,165,193,160,66,116,193,165,174,175,174,175,194,199,150,200,126,56,124,123,150,201,122,150,86,87,150,66,193,165,202,93,94,95,150,165,98,194,165,125,22,165,150,150,26,27,135,86,87,165,174,175,203,226,93,94,95,165,165,98,150,218,150,193,157,118,157,129,130,131,132,133,134,5,104,165,211,165,10,11,12,13,14,150,66,17,174,175,210,246,129,130,131,132,133,134,150,210,165,31,121,33,150,150,86,87,176,174,175,150,42,165,94,211,210,150,98,165,165,211,174,175,150,55,165,57,150,174,175,61,165,150,64,174,175,150,150,165,150,174,175,165,104,150,184,150,165,129,130,131,165,165,150,165,150,150,176,150,165,47,165,150,150,176,103,150,22,165,178,165,165,179,165,105,106,107,165,165,229,111,165,92,176,229,116,184,176,179,156,176,176,18,157,156,237,45,157,156,135,157,157,238,156,68,157,189,189,139,219,22,157,18,192,192,192,192,189,219,199,157,242,40,157,199,242,153,157,38,245,196,166,232,198,177,177,232,227,209,178,166,182,166,148,177,177,209,196,177,199,209,199,166,208,92,195,174,174,183,252,183,183,252,191,252,235,186,241,241,252,186,252,252,252,252,252,252,252,252,252,252,252,236],"i8",F);R.rr=G([0,0,26,26,26,26,0,26,26,26,0,26,26,26,26,0,0,0,26,0,0,26,0,0,0,0,0,0,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26],"i8",F);R.Ck=G([115,113,108,105,116,101,51,95,103,101,116,95,116,97,98,108,101,40,41,32,99,97,108,108,101,100,32,119,105,116,104,32,116,119,111,32,111,114,32,109,111,114,101,32,105,110,99,111,109,112,97,116,105,98,108,101,32,113,117,101,114,105,101,115,0],"i8",F);R.Dk=G([100,97,116,97,98,97,115,101,32,115,99,104,101,109,97,32,105,115,32,108,111,99,107,101,100,58,32,37,115,0],"i8",F);R.Ek=G([115,116,97,116,101,109,101,110,116,32,116,111,111,32,108,111,110,103,0],"i8",F);zG=G(48,"*",F);R.Fk=G([97,100,100,114,0],"i8",F);R.Hk=G([111,112,99,111,100,101,0],"i8",F);R.Ik=G([112,49,0],"i8",F);R.Jk=G([112,50,0],"i8",F);R.Kk=G([112,51,0],"i8",F);R.Lk=G([112,52,0],"i8",F);R.Mk=G([112,53,0],"i8",F);R.Nk=G([99,111,109,109,101,110,116,0],"i8",F);R.Ok=G([115,101,108,101,99,116,105,100,0],"i8",F);R.Pk=G([111,114,100,101,114,0],"i8",F);R.Qk=G([100,101,116,97,105,108,0],"i8",F);R.Sk=G([115,113,108,105,116,101,51,95,101,120,116,101,110,115,105,111,110,95,105,110,105,116,0],"i8",F);R.Tk=G([117,110,97,98,108,101,32,116,111,32,111,112,101,110,32,115,104,97,114,101,100,32,108,105,98,114,97,114,121,32,91,37,115,93,0],"i8",F);R.Uk=G([110,111,32,101,110,116,114,121,32,112,111,105,110,116,32,91,37,115,93,32,105,110,32,115,104,97,114,101,100,32,108,105,98,114,97,114,121,32,91,37,115,93,0],"i8",F);R.Vk=G([101,114,114,111,114,32,100,117,114,105,110,103,32,105,110,105,116,105,97,108,105,122,97,116,105,111,110,58,32,37,115,0],"i8",F);R.Wk=G([117,110,111,112,101,110,101,100,0],"i8",F);R.Xk=G([110,111,32,115,117,99,104,32,118,105,101,119,0],"i8",F);R.Yk=G([110,111,32,115,117,99,104,32,116,97,98,108,101,0],"i8",F);R.Zk=G([99,97,110,110,111,116,32,111,112,101,110,32,118,97,108,117,101,32,111,102,32,116,121,112,101,32,37,115,0],"i8",F);R.$k=G([110,111,32,115,117,99,104,32,114,111,119,105,100,58,32,37,108,108,100,0],"i8",F);R.al=G([98,105,110,100,32,111,110,32,97,32,98,117,115,121,32,112,114,101,112,97,114,101,100,32,115,116,97,116,101,109,101,110,116,58,32,91,37,115,93,0],"i8",F);Kl=G([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,5,0,0,0,0,0,0,0,0,0],["*",0,0,0,"*",0,0,0,"double",0,0,0,0,0,0,0,"i64",0,0,0,"i32",0,0,0,"i32",0,0,0,"i16",0,"i8","i8","*",0,0,0,"*",0,0,0],F);R.cl=G([97,98,111,114,116,32,97,116,32,37,100,32,105,110,32,91,37,115,93,58,32,37,115,0],"i8",F);R.dl=G([99,111,110,115,116,114,97,105,110,116,32,102,97,105,108,101,100,32,97,116,32,37,100,32,105,110,32,91,37,115,93,0],"i8",F);R.kr=G([0,0,0,0,1,2,0,2,2],"i8",F);R.lr=G([0,1,2,1,1,1,2,1,2],"i8",F);R.el=G([99,97,110,110,111,116,32,111,112,101,110,32,115,97,118,101,112,111,105,110,116,32,45,32,83,81,76,32,115,116,97,116,101,109,101,110,116,115,32,105,110,32,112,114,111,103,114,101,115,115,0],"i8",F);R.fl=G([110,111,32,115,117,99,104,32,115,97,118,101,112,111,105,110,116,58,32,37,115,0],"i8",F);R.gl=G([99,97,110,110,111,116,32,37,115,32,115,97,118,101,112,111,105,110,116,32,45,32,83,81,76,32,115,116,97,116,101,109,101,110,116,115,32,105,110,32,112,114,111,103,114,101,115,115,0],"i8",F);R.ic=G([114,111,108,108,98,97,99,107,0],"i8",F);R.hl=G([114,101,108,101,97,115,101,0],"i8",F);R.il=G([99,97,110,110,111,116,32,114,111,108,108,98,97,99,107,32,116,114,97,110,115,97,99,116,105,111,110,32,45,32,83,81,76,32,115,116,97,116,101,109,101,110,116,115,32,105,110,32,112,114,111,103,114,101,115,115,0],"i8",F);R.jl=G([99,97,110,110,111,116,32,99,111,109,109,105,116,32,116,114,97,110,115,97,99,116,105,111,110,32,45,32,83,81,76,32,115,116,97,116,101,109,101,110,116,115,32,105,110,32,112,114,111,103,114,101,115,115,0],"i8",F);R.kl=G([99,97,110,110,111,116,32,115,116,97,114,116,32,97,32,116,114,97,110,115,97,99,116,105,111,110,32,119,105,116,104,105,110,32,97,32,116,114,97,110,115,97,99,116,105,111,110,0],"i8",F);R.ml=G([99,97,110,110,111,116,32,114,111,108,108,98,97,99,107,32,45,32,110,111,32,116,114,97,110,115,97,99,116,105,111,110,32,105,115,32,97,99,116,105,118,101,0],"i8",F);R.nl=G([99,97,110,110,111,116,32,99,111,109,109,105,116,32,45,32,110,111,32,116,114,97,110,115,97,99,116,105,111,110,32,105,115,32,97,99,116,105,118,101,0],"i8",F);R.ol=G([83,69,76,69,67,84,32,110,97,109,101,44,32,114,111,111,116,112,97,103,101,44,32,115,113,108,32,70,82,79,77,32,39,37,113,39,46,37,115,32,87,72,69,82,69,32,37,115,32,79,82,68,69,82,32,66,89,32,114,111,119,105,100,0],"i8",F);R.pl=G([116,111,111,32,109,97,110,121,32,108,101,118,101,108,115,32,111,102,32,116,114,105,103,103,101,114,32,114,101,99,117,114,115,105,111,110,0],"i8",F);R.ql=G([99,97,110,110,111,116,32,99,104,97,110,103,101,32,37,115,32,119,97,108,32,109,111,100,101,32,102,114,111,109,32,119,105,116,104,105,110,32,97,32,116,114,97,110,115,97,99,116,105,111,110,0],"i8",F);R.rl=G([105,110,116,111,0],"i8",F);R.sl=G([111,117,116,32,111,102,0],"i8",F);R.tl=G([100,97,116,97,98,97,115,101,32,116,97,98,108,101,32,105,115,32,108,111,99,107,101,100,58,32,37,115,0],"i8",F);R.ul=G([115,116,97,116,101,109,101,110,116,32,97,98,111,114,116,115,32,97,116,32,37,100,58,32,91,37,115,93,32,37,115,0],"i8",F);R.vl=G([45,45,32,0],"i8",F);R.jc=G([39,37,46,42,113,39,0],"i8",F);R.xl=G([122,101,114,111,98,108,111,98,40,37,100,41,0],"i8",F);R.yl=G([120,39,0],"i8",F);R.zl=G([37,48,50,120,0],"i8",F);R.Al=G([39,0],"i8",F);R.Bl=G([99,97,110,110,111,116,32,86,65,67,85,85,77,32,102,114,111,109,32,119,105,116,104,105,110,32,97,32,116,114,97,110,115,97,99,116,105,111,110,0],"i8",F);R.Cl=G([99,97,110,110,111,116,32,86,65,67,85,85,77,32,45,32,83,81,76,32,115,116,97,116,101,109,101,110,116,115,32,105,110,32,112,114,111,103,114,101,115,115,0],"i8",F);R.Dl=G([65,84,84,65,67,72,32,39,58,109,101,109,111,114,121,58,39,32,65,83,32,118,97,99,117,117,109,95,100,98,59,0],"i8",F);R.El=G([65,84,84,65,67,72,32,39,39,32,65,83,32,118,97,99,117,117,109,95,100,98,59,0],"i8",F);R.Fl=G([80,82,65,71,77,65,32,118,97,99,117,117,109,95,100,98,46,115,121,110,99,104,114,111,110,111,117,115,61,79,70,70,0],"i8",F);R.Hl=G([66,69,71,73,78,32,69,88,67,76,85,83,73,86,69,59,0],"i8",F);R.Il=G([83,69,76,69,67,84,32,39,67,82,69,65,84,69,32,84,65,66,76,69,32,118,97,99,117,117,109,95,100,98,46,39,32,124,124,32,115,117,98,115,116,114,40,115,113,108,44,49,52,41,32,32,32,70,82,79,77,32,115,113,108,105,116,101,95,109,97,115,116,101,114,32,87,72,69,82,69,32,116,121,112,101,61,39,116,97,98,108,101,39,32,65,78,68,32,110,97,109,101,33,61,39,115,113,108,105,116,101,95,115,101,113,117,101,110,99,101,39,32,32,32,65,78,68,32,114,111,111,116,112,97,103,101,62,48,0],"i8",F);R.Jl=G([83,69,76,69,67,84,32,39,67,82,69,65,84,69,32,73,78,68,69,88,32,118,97,99,117,117,109,95,100,98,46,39,32,124,124,32,115,117,98,115,116,114,40,115,113,108,44,49,52,41,32,32,70,82,79,77,32,115,113,108,105,116,101,95,109,97,115,116,101,114,32,87,72,69,82,69,32,115,113,108,32,76,73,75,69,32,39,67,82,69,65,84,69,32,73,78,68,69,88,32,37,39,32,0],"i8",F);R.Kl=G([83,69,76,69,67,84,32,39,67,82,69,65,84,69,32,85,78,73,81,85,69,32,73,78,68,69,88,32,118,97,99,117,117,109,95,100,98,46,39,32,124,124,32,115,117,98,115,116,114,40,115,113,108,44,50,49,41,32,32,32,70,82,79,77,32,115,113,108,105,116,101,95,109,97,115,116,101,114,32,87,72,69,82,69,32,115,113,108,32,76,73,75,69,32,39,67,82,69,65,84,69,32,85,78,73,81,85,69,32,73,78,68,69,88,32,37,39,0],"i8",F);R.Ll=G([83,69,76,69,67,84,32,39,73,78,83,69,82,84,32,73,78,84,79,32,118,97,99,117,117,109,95,100,98,46,39,32,124,124,32,113,117,111,116,101,40,110,97,109,101,41,32,124,124,32,39,32,83,69,76,69,67,84,32,42,32,70,82,79,77,32,109,97,105,110,46,39,32,124,124,32,113,117,111,116,101,40,110,97,109,101,41,32,124,124,32,39,59,39,70,82,79,77,32,109,97,105,110,46,115,113,108,105,116,101,95,109,97,115,116,101,114,32,87,72,69,82,69,32,116,121,112,101,32,61,32,39,116,97,98,108,101,39,32,65,78,68,32,110,97,109,101,33,61,39,115,113,108,105,116,101,95,115,101,113,117,101,110,99,101,39,32,32,32,65,78,68,32,114,111,111,116,112,97,103,101,62,48,0],"i8",F);R.Ml=G([83,69,76,69,67,84,32,39,68,69,76,69,84,69,32,70,82,79,77,32,118,97,99,117,117,109,95,100,98,46,39,32,124,124,32,113,117,111,116,101,40,110,97,109,101,41,32,124,124,32,39,59,39,32,70,82,79,77,32,118,97,99,117,117,109,95,100,98,46,115,113,108,105,116,101,95,109,97,115,116,101,114,32,87,72,69,82,69,32,110,97,109,101,61,39,115,113,108,105,116,101,95,115,101,113,117,101,110,99,101,39,32,0],"i8",F);R.Nl=G([83,69,76,69,67,84,32,39,73,78,83,69,82,84,32,73,78,84,79,32,118,97,99,117,117,109,95,100,98,46,39,32,124,124,32,113,117,111,116,101,40,110,97,109,101,41,32,124,124,32,39,32,83,69,76,69,67,84,32,42,32,70,82,79,77,32,109,97,105,110,46,39,32,124,124,32,113,117,111,116,101,40,110,97,109,101,41,32,124,124,32,39,59,39,32,70,82,79,77,32,118,97,99,117,117,109,95,100,98,46,115,113,108,105,116,101,95,109,97,115,116,101,114,32,87,72,69,82,69,32,110,97,109,101,61,61,39,115,113,108,105,116,101,95,115,101,113,117,101,110,99,101,39,59,0],"i8",F);R.Ol=G([73,78,83,69,82,84,32,73,78,84,79,32,118,97,99,117,117,109,95,100,98,46,115,113,108,105,116,101,95,109,97,115,116,101,114,32,32,32,83,69,76,69,67,84,32,116,121,112,101,44,32,110,97,109,101,44,32,116,98,108,95,110,97,109,101,44,32,114,111,111,116,112,97,103,101,44,32,115,113,108,32,32,32,32,70,82,79,77,32,109,97,105,110,46,115,113,108,105,116,101,95,109,97,115,116,101,114,32,32,32,87,72,69,82,69,32,116,121,112,101,61,39,118,105,101,119,39,32,79,82,32,116,121,112,101,61,39,116,114,105,103,103,101,114,39,32,32,32,32,32,32,79,82,32,40,116,121,112,101,61,39,116,97,98,108,101,39,32,65,78,68,32,114,111,111,116,112,97,103,101,61,48,41,0],"i8",F);R.xc=G([1,1,3,0,5,0,6,0],"i8",F);R.Pl=G([77,97,105,110,32,102,114,101,101,108,105,115,116,58,32,0],"i8",F);R.Ql=G([76,105,115,116,32,111,102,32,116,114,101,101,32,114,111,111,116,115,58,32,0],"i8",F);R.Sl=G([80,97,103,101,32,37,100,32,105,115,32,110,101,118,101,114,32,117,115,101,100,0],"i8",F);R.Tl=G([80,111,105,110,116,101,114,32,109,97,112,32,112,97,103,101,32,37,100,32,105,115,32,114,101,102,101,114,101,110,99,101,100,0],"i8",F);R.Ul=G([79,117,116,115,116,97,110,100,105,110,103,32,112,97,103,101,32,99,111,117,110,116,32,103,111,101,115,32,102,114,111,109,32,37,100,32,116,111,32,37,100,32,100,117,114,105,110,103,32,116,104,105,115,32,97,110,97,108,121,115,105,115,0],"i8",F);R.Vl=G([10,0],"i8",F);R.Wl=G([80,97,103,101,32,37,100,58,32,0],"i8",F);R.Xl=G([117,110,97,98,108,101,32,116,111,32,103,101,116,32,116,104,101,32,112,97,103,101,46,32,101,114,114,111,114,32,99,111,100,101,61,37,100,0],"i8",F);R.Yl=G([98,116,114,101,101,73,110,105,116,80,97,103,101,40,41,32,114,101,116,117,114,110,115,32,101,114,114,111,114,32,99,111,100,101,32,37,100,0],"i8",F);R.Zl=G([79,110,32,116,114,101,101,32,112,97,103,101,32,37,100,32,99,101,108,108,32,37,100,58,32,0],"i8",F);R.$l=G([82,111,119,105,100,32,37,108,108,100,32,111,117,116,32,111,102,32,111,114,100,101,114,32,40,112,114,101,118,105,111,117,115,32,119,97,115,32,37,108,108,100,41,0],"i8",F);R.am=G([67,104,105,108,100,32,112,97,103,101,32,100,101,112,116,104,32,100,105,102,102,101,114,115,0],"i8",F);R.cm=G([79,110,32,112,97,103,101,32,37,100,32,97,116,32,114,105,103,104,116,32,99,104,105,108,100,58,32,0],"i8",F);R.dm=G([82,111,119,105,100,32,37,108,108,100,32,111,117,116,32,111,102,32,111,114,100,101,114,32,40,109,97,120,32,108,97,114,103,101,114,32,116,104,97,110,32,112,97,114,101,110,116,32,109,105,110,32,111,102,32,37,108,108,100,41,0],"i8",F);R.em=G([82,111,119,105,100,32,37,108,108,100,32,111,117,116,32,111,102,32,111,114,100,101,114,32,40,109,105,110,32,108,101,115,115,32,116,104,97,110,32,112,97,114,101,110,116,32,109,105,110,32,111,102,32,37,108,108,100,41,0],"i8",F);R.fm=G([82,111,119,105,100,32,37,108,108,100,32,111,117,116,32,111,102,32,111,114,100,101,114,32,40,109,97,120,32,108,97,114,103,101,114,32,116,104,97,110,32,112,97,114,101,110,116,32,109,97,120,32,111,102,32,37,108,108,100,41,0],"i8",F);R.gm=G([82,111,119,105,100,32,37,108,108,100,32,111,117,116,32,111,102,32,111,114,100,101,114,32,40,109,105,110,32,108,101,115,115,32,116,104,97,110,32,112,97,114,101,110,116,32,109,97,120,32,111,102,32,37,108,108,100,41,0],"i8",F);R.hm=G([67,111,114,114,117,112,116,105,111,110,32,100,101,116,101,99,116,101,100,32,105,110,32,99,101,108,108,32,37,100,32,111,110,32,112,97,103,101,32,37,100,0],"i8",F);R.im=G([77,117,108,116,105,112,108,101,32,117,115,101,115,32,102,111,114,32,98,121,116,101,32,37,100,32,111,102,32,112,97,103,101,32,37,100,0],"i8",F);R.jm=G([70,114,97,103,109,101,110,116,97,116,105,111,110,32,111,102,32,37,100,32,98,121,116,101,115,32,114,101,112,111,114,116,101,100,32,97,115,32,37,100,32,111,110,32,112,97,103,101,32,37,100,0],"i8",F);R.km=G([105,110,118,97,108,105,100,32,112,97,103,101,32,110,117,109,98,101,114,32,37,100,0],"i8",F);R.lm=G([50,110,100,32,114,101,102,101,114,101,110,99,101,32,116,111,32,112,97,103,101,32,37,100,0],"i8",F);R.nm=G([70,97,105,108,101,100,32,116,111,32,114,101,97,100,32,112,116,114,109,97,112,32,107,101,121,61,37,100,0],"i8",F);R.om=G([66,97,100,32,112,116,114,32,109,97,112,32,101,110,116,114,121,32,107,101,121,61,37,100,32,101,120,112,101,99,116,101,100,61,40,37,100,44,37,100,41,32,103,111,116,61,40,37,100,44,37,100,41,0],"i8",F);R.pm=G([37,100,32,111,102,32,37,100,32,112,97,103,101,115,32,109,105,115,115,105,110,103,32,102,114,111,109,32,111,118,101,114,102,108,111,119,32,108,105,115,116,32,115,116,97,114,116,105,110,103,32,97,116,32,37,100,0],"i8",F);R.qm=G([102,97,105,108,101,100,32,116,111,32,103,101,116,32,112,97,103,101,32,37,100,0],"i8",F);R.rm=G([102,114,101,101,108,105,115,116,32,108,101,97,102,32,99,111,117,110,116,32,116,111,111,32,98,105,103,32,111,110,32,112,97,103,101,32,37,100,0],"i8",F);II=G(8,"i8",F);R.Bc=G([83,81,76,105,116,101,32,102,111,114,109,97,116,32,51,0],"i8",F);R.sm=G([37,115,45,109,106,88,88,88,88,88,88,57,88,88,122,0],"i8",F);R.tm=G([77,74,32,100,101,108,101,116,101,58,32,37,115,0],"i8",F);R.um=G([77,74,32,99,111,108,108,105,100,101,58,32,37,115,0],"i8",F);R.vm=G([45,109,106,37,48,54,88,57,37,48,50,88,0],"i8",F);R.wm=G([37,46,50,120,0],"i8",F);R.xm=G([107,101,121,105,110,102,111,40,37,100,0],"i8",F);R.ym=G([99,111,108,108,115,101,113,40,37,46,50,48,115,41,0],"i8",F);R.zm=G([37,115,40,37,100,41,0],"i8",F);R.Am=G([37,100,0],"i8",F);R.Bm=G([40,98,108,111,98,41,0],"i8",F);R.Cm=G([118,116,97,98,58,37,112,58,37,112,0],"i8",F);R.Dm=G([105,110,116,97,114,114,97,121,0],"i8",F);R.Em=G([112,114,111,103,114,97,109,0],"i8",F);CG=G(604,"*",F);R.Gm=G([71,111,116,111,0],"i8",F);R.Hm=G([71,111,115,117,98,0],"i8",F);R.Im=G([82,101,116,117,114,110,0],"i8",F);R.Jm=G([89,105,101,108,100,0],"i8",F);R.Km=G([72,97,108,116,73,102,78,117,108,108,0],"i8",F);R.Lm=G([72,97,108,116,0],"i8",F);R.Mm=G([73,110,116,101,103,101,114,0],"i8",F);R.Nm=G([73,110,116,54,52,0],"i8",F);R.Om=G([83,116,114,105,110,103,0],"i8",F);R.Pm=G([78,117,108,108,0],"i8",F);R.Rm=G([66,108,111,98,0],"i8",F);R.Sm=G([86,97,114,105,97,98,108,101,0],"i8",F);R.Tm=G([77,111,118,101,0],"i8",F);R.Um=G([67,111,112,121,0],"i8",F);R.Vm=G([83,67,111,112,121,0],"i8",F);R.Wm=G([82,101,115,117,108,116,82,111,119,0],"i8",F);R.Xm=G([67,111,108,108,83,101,113,0],"i8",F);R.Ym=G([70,117,110,99,116,105,111,110,0],"i8",F);R.Zm=G([78,111,116,0],"i8",F);R.$m=G([65,100,100,73,109,109,0],"i8",F);R.bn=G([77,117,115,116,66,101,73,110,116,0],"i8",F);R.cn=G([82,101,97,108,65,102,102,105,110,105,116,121,0],"i8",F);R.dn=G([80,101,114,109,117,116,97,116,105,111,110,0],"i8",F);R.en=G([67,111,109,112,97,114,101,0],"i8",F);R.fn=G([74,117,109,112,0],"i8",F);R.gn=G([79,110,99,101,0],"i8",F);R.hn=G([73,102,0],"i8",F);R.jn=G([73,102,78,111,116,0],"i8",F);R.kn=G([67,111,108,117,109,110,0],"i8",F);R.ln=G([65,102,102,105,110,105,116,121,0],"i8",F);R.nn=G([77,97,107,101,82,101,99,111,114,100,0],"i8",F);R.on=G([67,111,117,110,116,0],"i8",F);R.pn=G([83,97,118,101,112,111,105,110,116,0],"i8",F);R.qn=G([65,117,116,111,67,111,109,109,105,116,0],"i8",F);R.rn=G([84,114,97,110,115,97,99,116,105,111,110,0],"i8",F);R.sn=G([82,101,97,100,67,111,111,107,105,101,0],"i8",F);R.tn=G([83,101,116,67,111,111,107,105,101,0],"i8",F);R.un=G([86,101,114,105,102,121,67,111,111,107,105,101,0],"i8",F);R.vn=G([79,112,101,110,82,101,97,100,0],"i8",F);R.wn=G([79,112,101,110,87,114,105,116,101,0],"i8",F);R.yn=G([79,112,101,110,65,117,116,111,105,110,100,101,120,0],"i8",F);R.zn=G([79,112,101,110,69,112,104,101,109,101,114,97,108,0],"i8",F);R.An=G([83,111,114,116,101,114,79,112,101,110,0],"i8",F);R.Bn=G([79,112,101,110,80,115,101,117,100,111,0],"i8",F);R.Cn=G([67,108,111,115,101,0],"i8",F);R.Dn=G([83,101,101,107,76,116,0],"i8",F);R.En=G([83,101,101,107,76,101,0],"i8",F);R.Fn=G([83,101,101,107,71,101,0],"i8",F);R.Gn=G([83,101,101,107,71,116,0],"i8",F);R.Hn=G([83,101,101,107,0],"i8",F);R.Kn=G([78,111,116,70,111,117,110,100,0],"i8",F);R.Ln=G([70,111,117,110,100,0],"i8",F);R.Mn=G([73,115,85,110,105,113,117,101,0],"i8",F);R.Nn=G([78,111,116,69,120,105,115,116,115,0],"i8",F);R.On=G([83,101,113,117,101,110,99,101,0],"i8",F);R.Pn=G([78,101,119,82,111,119,105,100,0],"i8",F);R.Qn=G([73,110,115,101,114,116,0],"i8",F);R.Rn=G([73,110,115,101,114,116,73,110,116,0],"i8",F);R.Sn=G([68,101,108,101,116,101,0],"i8",F);R.Tn=G([82,101,115,101,116,67,111,117,110,116,0],"i8",F);R.Vn=G([83,111,114,116,101,114,67,111,109,112,97,114,101,0],"i8",F);R.Wn=G([83,111,114,116,101,114,68,97,116,97,0],"i8",F);R.Xn=G([82,111,119,75,101,121,0],"i8",F);R.Yn=G([82,111,119,68,97,116,97,0],"i8",F);R.Zn=G([82,111,119,105,100,0],"i8",F);R.$n=G([78,117,108,108,82,111,119,0],"i8",F);R.ao=G([76,97,115,116,0],"i8",F);R.bo=G([79,114,0],"i8",F);R.co=G([65,110,100,0],"i8",F);R.eo=G([83,111,114,116,101,114,83,111,114,116,0],"i8",F);R.ho=G([83,111,114,116,0],"i8",F);R.io=G([82,101,119,105,110,100,0],"i8",F);R.jo=G([73,115,78,117,108,108,0],"i8",F);R.ko=G([78,111,116,78,117,108,108,0],"i8",F);R.lo=G([78,101,0],"i8",F);R.mo=G([69,113,0],"i8",F);R.no=G([71,116,0],"i8",F);R.oo=G([76,101,0],"i8",F);R.po=G([76,116,0],"i8",F);R.qo=G([71,101,0],"i8",F);R.so=G([83,111,114,116,101,114,78,101,120,116,0],"i8",F);R.to=G([66,105,116,65,110,100,0],"i8",F);R.uo=G([66,105,116,79,114,0],"i8",F);R.vo=G([83,104,105,102,116,76,101,102,116,0],"i8",F);R.wo=G([83,104,105,102,116,82,105,103,104,116,0],"i8",F);R.xo=G([65,100,100,0],"i8",F);R.yo=G([83,117,98,116,114,97,99,116,0],"i8",F);R.zo=G([77,117,108,116,105,112,108,121,0],"i8",F);R.Ao=G([68,105,118,105,100,101,0],"i8",F);R.Bo=G([82,101,109,97,105,110,100,101,114,0],"i8",F);R.Co=G([67,111,110,99,97,116,0],"i8",F);R.Do=G([80,114,101,118,0],"i8",F);R.Eo=G([66,105,116,78,111,116,0],"i8",F);R.Fo=G([83,116,114,105,110,103,56,0],"i8",F);R.Go=G([78,101,120,116,0],"i8",F);R.Ho=G([83,111,114,116,101,114,73,110,115,101,114,116,0],"i8",F);R.Io=G([73,100,120,73,110,115,101,114,116,0],"i8",F);R.Jo=G([73,100,120,68,101,108,101,116,101,0],"i8",F);R.Ko=G([73,100,120,82,111,119,105,100,0],"i8",F);R.Lo=G([73,100,120,76,84,0],"i8",F);R.No=G([73,100,120,71,69,0],"i8",F);R.Oo=G([68,101,115,116,114,111,121,0],"i8",F);R.Po=G([67,108,101,97,114,0],"i8",F);R.Qo=G([67,114,101,97,116,101,73,110,100,101,120,0],"i8",F);R.Ro=G([67,114,101,97,116,101,84,97,98,108,101,0],"i8",F);R.So=G([80,97,114,115,101,83,99,104,101,109,97,0],"i8",F);R.To=G([76,111,97,100,65,110,97,108,121,115,105,115,0],"i8",F);R.Uo=G([68,114,111,112,84,97,98,108,101,0],"i8",F);R.Vo=G([68,114,111,112,73,110,100,101,120,0],"i8",F);R.Wo=G([68,114,111,112,84,114,105,103,103,101,114,0],"i8",F);R.Yo=G([73,110,116,101,103,114,105,116,121,67,107,0],"i8",F);R.Zo=G([82,111,119,83,101,116,65,100,100,0],"i8",F);R.$o=G([82,111,119,83,101,116,82,101,97,100,0],"i8",F);R.ap=G([82,111,119,83,101,116,84,101,115,116,0],"i8",F);R.bp=G([80,114,111,103,114,97,109,0],"i8",F);R.cp=G([80,97,114,97,109,0],"i8",F);R.dp=G([70,107,67,111,117,110,116,101,114,0],"i8",F);R.ep=G([70,107,73,102,90,101,114,111,0],"i8",F);R.fp=G([77,101,109,77,97,120,0],"i8",F);R.gp=G([73,102,80,111,115,0],"i8",F);R.ip=G([73,102,78,101,103,0],"i8",F);R.jp=G([73,102,90,101,114,111,0],"i8",F);R.kp=G([65,103,103,83,116,101,112,0],"i8",F);R.lp=G([65,103,103,70,105,110,97,108,0],"i8",F);R.mp=G([67,104,101,99,107,112,111,105,110,116,0],"i8",F);R.np=G([74,111,117,114,110,97,108,77,111,100,101,0],"i8",F);R.op=G([86,97,99,117,117,109,0],"i8",F);R.pp=G([73,110,99,114,86,97,99,117,117,109,0],"i8",F);R.qp=G([69,120,112,105,114,101,0],"i8",F);R.rp=G([82,101,97,108,0],"i8",F);R.tp=G([84,97,98,108,101,76,111,99,107,0],"i8",F);R.up=G([86,66,101,103,105,110,0],"i8",F);R.vp=G([86,67,114,101,97,116,101,0],"i8",F);R.wp=G([86,68,101,115,116,114,111,121,0],"i8",F);R.xp=G([86,79,112,101,110,0],"i8",F);R.yp=G([86,70,105,108,116,101,114,0],"i8",F);R.zp=G([86,67,111,108,117,109,110,0],"i8",F);R.Ap=G([86,78,101,120,116,0],"i8",F);R.Bp=G([86,82,101,110,97,109,101,0],"i8",F);R.Cp=G([86,85,112,100,97,116,101,0],"i8",F);R.Ep=G([84,111,84,101,120,116,0],"i8",F);R.Fp=G([84,111,66,108,111,98,0],"i8",F);R.Gp=G([84,111,78,117,109,101,114,105,99,0],"i8",F);R.Hp=G([84,111,73,110,116,0],"i8",F);R.Ip=G([84,111,82,101,97,108,0],"i8",F);R.Jp=G([80,97,103,101,99,111,117,110,116,0],"i8",F);R.Kp=G([77,97,120,80,103,99,110,116,0],"i8",F);R.Lp=G([84,114,97,99,101,0],"i8",F);R.Mp=G([78,111,111,112,0],"i8",F);R.Np=G([69,120,112,108,97,105,110,0],"i8",F);R.Qp=G([65,80,73,32,99,97,108,108,101,100,32,119,105,116,104,32,78,85,76,76,32,112,114,101,112,97,114,101,100,32,115,116,97,116,101,109,101,110,116,0],"i8",F);R.Rp=G([65,80,73,32,99,97,108,108,101,100,32,119,105,116,104,32,102,105,110,97,108,105,122,101,100,32,112,114,101,112,97,114,101,100,32,115,116,97,116,101,109,101,110,116,0],"i8",F);R.Sp=G([64,32,32,0],"i8",F);R.Tp=G([117,110,107,110,111,119,110,32,100,97,116,97,98,97,115,101,32,37,115,0],"i8",F);tW=G([1,0,0,0,572,0,0,0,574,0,0,0,576,0,0,0,578,0,0,0,580,0,0,0,582,0,0,0,584,0,0,0,586,0,0,0,588,0,0,0,590,0,0,0,592,0,0,0,594,0,0,0,596,0,0,0,598,0,0,0,600,0,0,0,602,0,0,0],["i32",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0],F);Mh=G([0,0,0,0,604,0,0,0,0,0,0,0,0,0,0,0,606,0,0,0,0,0,0,0,0,0,0,0,608,0,0,0,0,0,0,0,0,0,0,0,610,0,0,0,0,0,0,0,0,0,0,0,612,0,0,0,0,0,0,0,0,0,0,0,614,0,0,0,0,0,0,0,0,0,0,0,616,0,0,0,0,0,0,0,0,0,0,0,618,0,0,0,0,0,0,0,0,0,0,0,620,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,622,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,624,0,0,0,0,0,0,0,0,0,0,0,626,0,0,0,0,0,0,0,0,0,0,0,628,0,0,0,0,0,0,0,0,0,0,0,630,0,0,0,0,0,0,0],["*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0],F);R.lc=G([99,108,111,115,101,0],"i8",F);R.Up=G([111,115,95,117,110,105,120,46,99,58,37,100,58,32,40,37,100,41,32,37,115,40,37,115,41,32,45,32,37,115,0],"i8",F);R.na=G([111,112,101,110,0],"i8",F);R.mc=G([103,101,116,99,119,100,0],"i8",F);R.Vp=G([115,116,97,116,0],"i8",F);R.Wp=G([102,115,116,97,116,0],"i8",F);R.da=G([102,116,114,117,110,99,97,116,101,0],"i8",F);R.Yp=G([102,99,110,116,108,0],"i8",F);R.Zp=G([114,101,97,100,0],"i8",F);R.$p=G([112,114,101,97,100,0],"i8",F);R.aq=G([112,114,101,97,100,54,52,0],"i8",F);R.bq=G([119,114,105,116,101,0],"i8",F);R.cq=G([112,119,114,105,116,101,0],"i8",F);R.dq=G([112,119,114,105,116,101,54,52,0],"i8",F);R.eq=G([102,99,104,109,111,100,0],"i8",F);R.fq=G([102,97,108,108,111,99,97,116,101,0],"i8",F);R.nc=G([117,110,108,105,110,107,0],"i8",F);R.hq=G([111,112,101,110,68,105,114,101,99,116,111,114,121,0],"i8",F);R.iq=G([109,107,100,105,114,0],"i8",F);R.jq=G([114,109,100,105,114,0],"i8",F);R.kq=G([109,109,97,112,0],"i8",F);R.lq=G([37,115,45,115,104,109,0],"i8",F);R.mq=G([114,101,97,100,111,110,108,121,95,115,104,109,0],"i8",F);R.nq=G([102,117,108,108,95,102,115,121,110,99,0],"i8",F);uW=G([1,0,0,0,632,0,0,0,574,0,0,0,576,0,0,0,578,0,0,0,580,0,0,0,582,0,0,0,634,0,0,0,636,0,0,0,638,0,0,0,590,0,0,0,592,0,0,0,594,0,0,0,596,0,0,0,598,0,0,0,600,0,0,0,602,0,0,0],["i32",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0],F);R.oq=G([47,100,101,118,47,117,114,97,110,100,111,109,0],"i8",F);R.pq=G([47,37,115,0],"i8",F);R.rq=G([102,115,121,110,99,0],"i8",F);R.sq=G([112,115,111,119,0],"i8",F);rW=G([2,0,0,0,640,0,0,0,574,0,0,0,576,0,0,0,578,0,0,0,580,0,0,0,582,0,0,0,642,0,0,0,644,0,0,0,646,0,0,0,590,0,0,0,592,0,0,0,594,0,0,0,596,0,0,0,598,0,0,0,600,0,0,0,602,0,0,0],["i32",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0],F);R.tq=G([37,115,46,108,111,99,107,0],"i8",F);Nh=G(1,"%struct.unixInodeInfo*",F);R.q=G([97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,48,49,50,51,52,53,54,55,56,57,0],"i8",F);R.oc=G([46,0],"i8",F);R.uq=G([37,115,47,101,116,105,108,113,115,95,0],"i8",F);pW=G(24,"*",F);R.vq=G([47,118,97,114,47,116,109,112,0],"i8",F);R.wq=G([47,117,115,114,47,116,109,112,0],"i8",F);R.xq=G([47,116,109,112,0],"i8",F);R.yq=G([84,77,80,68,73,82,0],"i8",F);R.zq=G([37,0],"i8",F);vh=G([100,10,1,1,0,0,115,0,4,6,0,0,103,0,1,4,30,0,122,0,4,7,0,0,113,0,4,10,0,0,81,0,4,11,0,0,119,0,4,15,0,0,99,0,0,9,0,0,111,8,0,1,0,2,117,10,0,1,0,0,120,16,0,1,16,1,88,16,0,1,0,4,102,0,1,2,0,0,101,0,1,3,30,0,69,0,1,3,14,0,71,0,1,4,14,0,105,10,1,1,0,0,110,0,0,5,0,0,37,0,0,8,0,0,112,16,0,14,0,1,84,0,2,12,0,0,83,0,2,13,0,0,114,10,3,16,0,0],"i8",F);R.yc=G([116,104,115,116,110,100,114,100,0],"i8",F);R.uc=G([48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,48,49,50,51,52,53,54,55,56,57,97,98,99,100,101,102,0],"i8",F);R.Tq=G([45,120,48,0,88,48,0],"i8",F);R.Bq=G([78,97,78,0],"i8",F);R.Cq=G([45,73,110,102,0],"i8",F);R.Dq=G([43,73,110,102,0],"i8",F);R.Eq=G([73,110,102,0],"i8",F);R.Fq=G([40,78,85,76,76,41,0],"i8",F);R.vc=G([32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0],"i8",F);R.Gq=G([68,73,83,65,66,76,69,95,76,70,83,0],"i8",F);R.Hq=G([73,78,84,54,52,95,84,89,80,69,0],"i8",F);R.Iq=G([84,69,77,80,95,83,84,79,82,69,61,49,0],"i8",F);R.Jq=G([84,72,82,69,65,68,83,65,70,69,61,48,0],"i8",F);G([202,0,0,0,136,0,0,0,228,0,0,0],["*",0,0,0,"*",0,0,0,"*",0,0,0],F);zW=G(468,["i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"*",0,0,0,"i32",0,0,0,"i32",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0,"*",0,0,0,"i32",0,0,0],F);EW=G(24,"i32",F);p[Be>>2]=R.Gq|0;p[Be+4>>2]=R.Hq|0;p[Be+8>>2]=R.Iq|0;p[Be+12>>2]=R.Jq|0;p[Ng+16>>2]=R.Vc|0;p[Ng+20>>2]=a2;p[Ng+104>>2]=R.we|0;p[Ng+108>>2]=b2;p[Ng+192>>2]=R.fg|0;p[Ng+196>>2]=c2;p[Ng+280>>2]=R.Yb|0;p[Ng+284>>2]=a2;p[Pp>>2]=R.Si|0;p[Pp+8>>2]=R.cj|0;p[Qp>>2]=R.wj|0;p[Qp+8>>2]=R.Hj|0;p[Qp+16>>2]=R.Sj|0;p[pk>>2]=R.ll|0;p[pk+4>>2]=R.wl|0;p[pk+12>>2]=R.Gl|0;p[pk+16>>2]=R.Rl|0;p[pk+20>>2]=R.bm|0;p[pk+24>>2]=R.mm|0;p[pk+28>>2]=R.ca|0;p[pk+32>>2]=R.Fm|0;p[pk+36>>2]=R.Qm|0;p[pk+40>>2]=R.an|0;p[pk+44>>2]=R.mn|0;p[pk+48>>2]=R.xn|0;p[pk+52>>2]=R.Jn|0;p[pk+56>>2]=R.Un|0;p[pk+60>>2]=R.fo|0;p[pk+64>>2]=R.ro|0;p[pk+68>>2]=R.kc|0;p[pk+72>>2]=R.Fa|0;p[pk+76>>2]=R.Mo|0;p[pk+80>>2]=R.Xo|0;p[pk+84>>2]=R.hp|0;p[pk+88>>2]=R.sp|0;p[pk+92>>2]=R.Dp|0;p[pk+96>>2]=R.Pp|0;p[pk+100>>2]=R.Xp|0;p[pk+104>>2]=R.gq|0;p[Ag+4>>2]=1;p[Ag+24>>2]=R.pc|0;p[Ag+40>>2]=1;p[Ag+60>>2]=R.pc|0;p[Ag+76>>2]=2;p[Ag+96>>2]=R.qc|0;p[Ag+112>>2]=2;p[Ag+132>>2]=R.qc|0;p[Ag+148>>2]=3;p[Ag+168>>2]=R.rc|0;p[Ag+184>>2]=3;p[Ag+204>>2]=R.rc|0;p[Ag+240>>2]=R.oa|0;p[Ag+276>>2]=R.oa|0;p[Ag+312>>2]=R.oa|0;p[Ag+328>>2]=1;p[Ag+348>>2]=R.pa|0;p[Ag+364>>2]=1;p[Ag+384>>2]=R.pa|0;p[Ag+400>>2]=1;p[Ag+420>>2]=R.pa|0;p[Ag+456>>2]=R.Oq|0;p[Ag+492>>2]=R.Pq|0;p[Ag+528>>2]=R.sc|0;p[Ag+564>>2]=R.sc|0;p[Ag+600>>2]=R.Qq|0;p[Ag+636>>2]=R.tc|0;p[Ag+672>>2]=R.tc|0;p[Ag+708>>2]=R.Rq|0;p[Ag+744>>2]=R.Sq|0;p[Ag+780>>2]=R.xa|0;p[Ag+816>>2]=R.xa|0;p[Ag+852>>2]=R.xa|0;p[Ag+888>>2]=R.Xc|0;p[Ag+924>>2]=R.Yc|0;p[Ag+960>>2]=R.Zc|0;p[Ag+996>>2]=R.$c|0;p[Ag+1032>>2]=R.ad|0;p[Ag+1068>>2]=R.bd|0;p[Ag+1104>>2]=R.cd|0;p[Ag+1140>>2]=R.dd|0;p[Ag+1176>>2]=R.ed|0;p[Ag+1212>>2]=R.gd|0;p[Ag+1248>>2]=R.hd|0;p[Ag+1284>>2]=R.jd|0;p[Ag+1320>>2]=R.kd|0;p[Ag+1356>>2]=R.ld|0;p[Ag+1392>>2]=R.md|0;p[Ag+1428>>2]=R.nd|0;p[Ag+1464>>2]=R.Xa|0;p[Ag+1500>>2]=R.Xa|0;p[Ag+1536>>2]=R.od|0;p[Ag+1572>>2]=R.pd|0;p[Ag+1608>>2]=R.rd|0;p[Ag+1644>>2]=R.Ya|0;p[Ag+1680>>2]=R.Ya|0;p[Ag+1716>>2]=R.Za|0;p[Ag+1752>>2]=R.Za|0;p[Ag+1768>>2]=tC|0;p[Ag+1788>>2]=R.ya|0;p[Ag+1804>>2]=sC|0;p[Ag+1824>>2]=R.T|0;p[Ag+1840>>2]=sC|0;p[Ag+1860>>2]=R.T|0;p[Ig+24>>2]=R.sd|0;p[Ig+60>>2]=R.td|0;p[Ig+96>>2]=R.ud|0;p[Bg+24>>2]=R.wd|0;p[Bg+60>>2]=R.xd|0;p[Bg+96>>2]=R.yd|0;p[Bg+132>>2]=R.zd|0;p[Bg+168>>2]=R.Ad|0;p[Bg+204>>2]=R.Bd|0;p[Bg+240>>2]=R.Cd|0;p[Bg+276>>2]=R.Dd|0;p[Ht>>2]=R.W|0;p[Hv>>2]=R.ii|0;p[Hv+8>>2]=R.Bb|0;p[Uv+24>>2]=R.Of|0;p[Tv+24>>2]=R.bg|0;p[xC>>2]=R.eh|0;p[xC+8>>2]=R.fh|0;p[xC+16>>2]=R.gh|0;p[xC+24>>2]=R.hh|0;p[xC+32>>2]=R.jh|0;p[xC+40>>2]=R.kh|0;p[xC+48>>2]=R.lh|0;p[xC+56>>2]=R.mh|0;p[BE>>2]=R.Gh|0;p[BE+8>>2]=R.Hh|0;p[BE+16>>2]=R.Ih|0;p[BE+24>>2]=R.Jh|0;p[BE+32>>2]=R.Kh|0;p[BE+40>>2]=R.Lh|0;p[BE+48>>2]=R.Mh|0;p[BE+56>>2]=R.Nh|0;p[BE+64>>2]=R.Oh|0;p[BE+72>>2]=R.Ph|0;p[BE+80>>2]=R.Qh|0;p[BE+88>>2]=R.Rh|0;p[BE+96>>2]=R.Sh|0;p[BE+104>>2]=R.Th|0;p[BE+112>>2]=R.Uh|0;p[kC>>2]=R.Zh|0;p[kC+4>>2]=R.$h|0;p[kC+8>>2]=R.ai|0;p[kC+12>>2]=R.bi|0;p[kC+16>>2]=R.Zb|0;p[kC+20>>2]=R.ci|0;p[FF>>2]=R.sb|0;p[GF>>2]=R.rb|0;p[xG>>2]=R.rk|0;p[xG+4>>2]=xh|0;p[xG+8>>2]=R.sk|0;p[xG+12>>2]=R.tk|0;p[xG+16>>2]=R.uk|0;p[kw>>2]=R.gc|0;p[kw+4>>2]=R.zk|0;p[kw+8>>2]=R.hc|0;p[zG>>2]=R.Fk|0;p[zG+4>>2]=R.Hk|0;p[zG+8>>2]=R.Ik|0;p[zG+12>>2]=R.Jk|0;p[zG+16>>2]=R.Kk|0;p[zG+20>>2]=R.Lk|0;p[zG+24>>2]=R.Mk|0;p[zG+28>>2]=R.Nk|0;p[zG+32>>2]=R.Ok|0;p[zG+36>>2]=R.Pk|0;p[zG+40>>2]=R.Sb|0;p[zG+44>>2]=R.Qk|0;p[Kl+4>>2]=xh|0;p[CG>>2]=R.Ba|0;p[CG+4>>2]=R.Gm|0;p[CG+8>>2]=R.Hm|0;p[CG+12>>2]=R.Im|0;p[CG+16>>2]=R.Jm|0;p[CG+20>>2]=R.Km|0;p[CG+24>>2]=R.Lm|0;p[CG+28>>2]=R.Mm|0;p[CG+32>>2]=R.Nm|0;p[CG+36>>2]=R.Om|0;p[CG+40>>2]=R.Pm|0;p[CG+44>>2]=R.Rm|0;p[CG+48>>2]=R.Sm|0;p[CG+52>>2]=R.Tm|0;p[CG+56>>2]=R.Um|0;p[CG+60>>2]=R.Vm|0;p[CG+64>>2]=R.Wm|0;p[CG+68>>2]=R.Xm|0;p[CG+72>>2]=R.Ym|0;p[CG+76>>2]=R.Zm|0;p[CG+80>>2]=R.$m|0;p[CG+84>>2]=R.bn|0;p[CG+88>>2]=R.cn|0;p[CG+92>>2]=R.dn|0;p[CG+96>>2]=R.en|0;p[CG+100>>2]=R.fn|0;p[CG+104>>2]=R.gn|0;p[CG+108>>2]=R.hn|0;p[CG+112>>2]=R.jn|0;p[CG+116>>2]=R.kn|0;p[CG+120>>2]=R.ln|0;p[CG+124>>2]=R.nn|0;p[CG+128>>2]=R.on|0;p[CG+132>>2]=R.pn|0;p[CG+136>>2]=R.qn|0;p[CG+140>>2]=R.rn|0;p[CG+144>>2]=R.sn|0;p[CG+148>>2]=R.tn|0;p[CG+152>>2]=R.un|0;p[CG+156>>2]=R.vn|0;p[CG+160>>2]=R.wn|0;p[CG+164>>2]=R.yn|0;p[CG+168>>2]=R.zn|0;p[CG+172>>2]=R.An|0;p[CG+176>>2]=R.Bn|0;p[CG+180>>2]=R.Cn|0;p[CG+184>>2]=R.Dn|0;p[CG+188>>2]=R.En|0;p[CG+192>>2]=R.Fn|0;p[CG+196>>2]=R.Gn|0;p[CG+200>>2]=R.Hn|0;p[CG+204>>2]=R.Kn|0;p[CG+208>>2]=R.Ln|0;p[CG+212>>2]=R.Mn|0;p[CG+216>>2]=R.Nn|0;p[CG+220>>2]=R.On|0;p[CG+224>>2]=R.Pn|0;p[CG+228>>2]=R.Qn|0;p[CG+232>>2]=R.Rn|0;p[CG+236>>2]=R.Sn|0;p[CG+240>>2]=R.Tn|0;p[CG+244>>2]=R.Vn|0;p[CG+248>>2]=R.Wn|0;p[CG+252>>2]=R.Xn|0;p[CG+256>>2]=R.Yn|0;p[CG+260>>2]=R.Zn|0;p[CG+264>>2]=R.$n|0;p[CG+268>>2]=R.ao|0;p[CG+272>>2]=R.bo|0;p[CG+276>>2]=R.co|0;p[CG+280>>2]=R.eo|0;p[CG+284>>2]=R.ho|0;p[CG+288>>2]=R.io|0;p[CG+292>>2]=R.jo|0;p[CG+296>>2]=R.ko|0;p[CG+300>>2]=R.lo|0;p[CG+304>>2]=R.mo|0;p[CG+308>>2]=R.no|0;p[CG+312>>2]=R.oo|0;p[CG+316>>2]=R.po|0;p[CG+320>>2]=R.qo|0;p[CG+324>>2]=R.so|0;p[CG+328>>2]=R.to|0;p[CG+332>>2]=R.uo|0;p[CG+336>>2]=R.vo|0;p[CG+340>>2]=R.wo|0;p[CG+344>>2]=R.xo|0;p[CG+348>>2]=R.yo|0;p[CG+352>>2]=R.zo|0;p[CG+356>>2]=R.Ao|0;p[CG+360>>2]=R.Bo|0;p[CG+364>>2]=R.Co|0;p[CG+368>>2]=R.Do|0;p[CG+372>>2]=R.Eo|0;p[CG+376>>2]=R.Fo|0;p[CG+380>>2]=R.Go|0;p[CG+384>>2]=R.Ho|0;p[CG+388>>2]=R.Io|0;p[CG+392>>2]=R.Jo|0;p[CG+396>>2]=R.Ko|0;p[CG+400>>2]=R.Lo|0;p[CG+404>>2]=R.No|0;p[CG+408>>2]=R.Oo|0;p[CG+412>>2]=R.Po|0;p[CG+416>>2]=R.Qo|0;p[CG+420>>2]=R.Ro|0;p[CG+424>>2]=R.So|0;p[CG+428>>2]=R.To|0;p[CG+432>>2]=R.Uo|0;p[CG+436>>2]=R.Vo|0;p[CG+440>>2]=R.Wo|0;p[CG+444>>2]=R.Yo|0;p[CG+448>>2]=R.Zo|0;p[CG+452>>2]=R.$o|0;p[CG+456>>2]=R.ap|0;p[CG+460>>2]=R.bp|0;p[CG+464>>2]=R.cp|0;p[CG+468>>2]=R.dp|0;p[CG+472>>2]=R.ep|0;p[CG+476>>2]=R.fp|0;p[CG+480>>2]=R.gp|0;p[CG+484>>2]=R.ip|0;p[CG+488>>2]=R.jp|0;p[CG+492>>2]=R.kp|0;p[CG+496>>2]=R.lp|0;p[CG+500>>2]=R.mp|0;p[CG+504>>2]=R.np|0;p[CG+508>>2]=R.op|0;p[CG+512>>2]=R.pp|0;p[CG+516>>2]=R.qp|0;p[CG+520>>2]=R.rp|0;p[CG+524>>2]=R.tp|0;p[CG+528>>2]=R.up|0;p[CG+532>>2]=R.vp|0;p[CG+536>>2]=R.wp|0;p[CG+540>>2]=R.xp|0;p[CG+544>>2]=R.yp|0;p[CG+548>>2]=R.zp|0;p[CG+552>>2]=R.Ap|0;p[CG+556>>2]=R.Bp|0;p[CG+560>>2]=R.Cp|0;p[CG+564>>2]=R.Ep|0;p[CG+568>>2]=R.Fp|0;p[CG+572>>2]=R.Gp|0;p[CG+576>>2]=R.Hp|0;p[CG+580>>2]=R.Ip|0;p[CG+584>>2]=R.Jp|0;p[CG+588>>2]=R.Kp|0;p[CG+592>>2]=R.Lp|0;p[CG+596>>2]=R.Mp|0;p[CG+600>>2]=R.Np|0;p[Mh>>2]=R.na|0;p[Mh+12>>2]=R.lc|0;p[Mh+24>>2]=R.fc|0;p[Mh+36>>2]=R.mc|0;p[Mh+48>>2]=R.Vp|0;p[Mh+60>>2]=R.Wp|0;p[Mh+72>>2]=R.da|0;p[Mh+84>>2]=R.Yp|0;p[Mh+96>>2]=R.Zp|0;p[Mh+108>>2]=R.$p|0;p[Mh+120>>2]=R.aq|0;p[Mh+132>>2]=R.bq|0;p[Mh+144>>2]=R.cq|0;p[Mh+156>>2]=R.dq|0;p[Mh+168>>2]=R.eq|0;p[Mh+180>>2]=R.fq|0;p[Mh+192>>2]=R.nc|0;p[Mh+204>>2]=R.hq|0;p[Mh+216>>2]=R.iq|0;p[Mh+228>>2]=R.jq|0;p[pW+8>>2]=R.vq|0;p[pW+12>>2]=R.wq|0;p[pW+16>>2]=R.xq|0;Gd=[0,0,sa(),0,vf,0,wk,0,Ok,0,Vm,0,(function(b,c,d,e){var f;f=b+79|0;var g=t[f];if((g&255)>1){if(g=Wm(b),(g|0)!=0){var h=g;f=7}else{var i=l[f];f=4}}else{i=g,f=4}f==4&&(h=i<<24>>24!=1?4:l[b+76|0]<<24>>24==0?8:Xm(b,c,d,e,1));return h}),0,xn,0,(function(b,c){if((c*1e3+1e3|0)>(p[b+440>>2]|0)){var d=0}else{Gd[p[p[b>>2]+60>>2]](p[b>>2],1e6),d=1}return d}),0,(function(b){var c=a,d=p[p[b>>2]+24>>2],d=Bh(R.Rk|0,(z=a,a+=4,p[z>>2]=d,z));Yk(b,d,-1);Lg(d);a=c}),0,(function(b,c,d,e){(b|0)>(e|0)||(dj(),lo(c,d),gj());return 0}),0,(function(b,c,d,e,f){var g=(c|0)<(e|0)?c:e,h=jm(d,f,g),i=(h|0)==0;a:do{if(i){var j=(b|0)==0;do{if(!j&&(wr(d+g|0,c-g|0)|0)!=0&&(wr(f+g|0,e-g|0)|0)!=0){j=h;break a}}while(0);j=c-e|0}else{j=h}}while(0);return j}),0,(function(b,c,d,e,f){b=te(d,f,(c|0)<(e|0)?c:e);return(b|0)==0?c-e|0:b}),0,(function(b){var c=p[b+8>>2];l[c]<<24>>24!=0&&(l[c]=0,(n[b+26>>1]<<16>>16|0)>1&&lr(c))}),0,nr,0,lj,0,Ti,0,Lg,0,ED,0,ya(0),0,nD,0,pD,0,kD,0,UD,0,YD,0,(function(b,c){var d,e;d=(b+12|0)>>2;var f=y[d];if((f|0)==3){if((n[c+2>>1]&1)<<16>>16==0){e=4}else{p[d]=0;var g=2;e=7}}else{e=4}do{if(e==4){g=t[c|0]&255;if((g|0)==151){if((f|0)==2){g=0;break}}else{if(!((g|0)==26||(g|0)==152||(g|0)==153||(g|0)==154)){g=0;break}}p[d]=0;g=2}}while(0);return g}),0,(function(b){p[b+12>>2]=0;return 2}),0,(function(b,c,d){var e=a;a+=4;var f=rl(b),g=wk(p[d>>2]),h=wk(p[d+4>>2]),f=(Ak(p[d>>2])|0)>(p[f+104>>2]|0);do{if(f){Yk(b,R.Vd|0,-1)}else{if((c|0)==3){var i=wk(p[d+8>>2]);p[e>>2]=i;if((i|0)==0){break}if((un(i,-1)|0)!=1){Yk(b,R.Wd|0,-1);break}i=xu(i,e)}else{i=0}(h|0)==0|(g|0)==0||(i=Au(g,h,ql(b),i),Zk(b,i))}}while(0);a=e}),0,CF,0,LF,0,PF,0,sG,0,(function(b,c){var d;d=(p[b+12>>2]+24|0)>>2;(p[d]|0)==0?(p[d]=1,fD(b,c),p[d]=p[d]-1|0,d=1):d=0;return d}),0,Lh,0,(function(b,c,d){b=a;a+=4;var e;if((Gd[p[Mh+196>>2]](c)|0)==-1){if((p[Qh>>2]|0)==2){e=4}else{var f=Sh(2570,R.nc|0,c,30165);e=10}}else{e=4}e==4&&((d&1|0)==0?f=0:(d=Gd[p[Mh+208>>2]](c,b),(d|0)==0?(c=(FX(p[b>>2])|0)==0?0:Sh(1290,R.rq|0,c,30178),iU(0,p[b>>2],30180),f=c):f=(d|0)==14?0:d));a=b;return f}),0,(function(b,c,d,e){b=a;a+=72;var f=(Gd[p[Mh+28>>2]](c,(d|0)==2?4:(d|0)==1?6:0)|0)==0;p[e>>2]=f&1;!((d|0)!=0|f^1)&&(Gd[p[Mh+52>>2]](c,b)|0)==0&&(p[b+28>>2]|0)==0&&(p[e>>2]=0);a=b;return 0}),0,(function(b,c,d,e){b=d-1|0;l[e+b|0]=0;l[c]<<24>>24==47?(Ch(d,e,R.d|0,(z=a,a+=4,p[z>>2]=c,z)),c=0):(Gd[p[Mh+40>>2]](e,b)|0)==0?(Rh(30265),c=Sh(14,R.mc|0,c,30265)):(b=qe(e),Ch(d-b|0,e+b|0,R.pq|0,(z=a,a+=4,p[z>>2]=c,z)),c=0);return c}),0,(function(b,c){return P1(c)}),0,(function(b,c,d){HX===la?b=0:(GX&&DS(GX),b=Pd(HX),GX=G(b,"i8",Bd),HX=la,b=GX);(b|0)!=0&&Ch(c,d,R.d|0,(z=a,a+=4,p[z>>2]=b,z))}),0,(function(b,c,d){return KX(c,d)}),0,(function(b,c){if(IX[c]){var d=IX[c];d.Pc--==0&&(delete JX[d.name],delete IX[c])}else{HX="Tried to dlclose() unopened handle: "+c}}),0,(function(b,c,d){b=a;a+=4;Ed(d,0,c);var e=Ph(R.oq|0,0,0);if((e|0)<0){OW(b),B=p[b>>2],l[d]=B&255,B>>=8,l[d+1]=B&255,B>>=8,l[d+2]=B&255,B>>=8,l[d+3]=B&255,d=d+4|0,B=0,l[d]=B&255,B>>=8,l[d+1]=B&255,B>>=8,l[d+2]=B&255,B>>=8,l[d+3]=B&255,d=8}else{for(;;){var f=Gd[p[Mh+100>>2]](e,d,c);if((f|0)>=0){break}if((p[Qh>>2]|0)!=4){break}c=f}iU(0,e,30370);d=f}a=b;return d}),0,(function(b,c){return((c+999999|0)/1e6&-1)*1e6|0}),0,(function(b,c){var d,e=a;a+=8;d=e>>2;p[d]=0;p[d+1]=0;var f=Yh(0,e);xd[0]=(p[d]+p[d+1]*4294967296)/864e5;p[c>>2]=C[0];p[c+4>>2]=C[1];a=e;return f}),0,ya(0),0,Yh,0,(function(b,c,d){b=(c|0)==0;a:do{if(b){for(var e=0;;){var f=p[(Mh+8>>2)+(e*3|0)];(f|0)!=0&&(p[(Mh+4>>2)+(e*3|0)]=f);e=e+1|0;if((e|0)==20){var g=0;break a}}}else{for(e=0;;){if(e>>>0>=20){g=12;break a}if((pg(c,p[(Mh>>2)+(e*3|0)])|0)==0){break}e=e+1|0}g=Mh+e*12+8|0;f=p[g>>2];e=Mh+e*12+4|0;(f|0)==0&&(f=p[e>>2],p[g>>2]=f);g=f;p[e>>2]=(d|0)==0?g:d;g=0}}while(0);return g}),0,(function(b,c){for(var d=0;;){if(d>>>0>=20){var e=0;break}if((pg(c,p[(Mh>>2)+(d*3|0)])|0)==0){e=p[(Mh+4>>2)+(d*3|0)];break}d=d+1|0}return e}),0,(function(b,c){var d=(c|0)==0;a:do{if(d){var e=-1}else{for(var f=0;;){if((f|0)>=19){e=f;break a}if((pg(c,p[(Mh>>2)+(f*3|0)])|0)==0){e=f;break a}f=f+1|0}}}while(0);for(;;){d=e+1|0;if((d|0)>=20){var g=0;break}if((p[(Mh+4>>2)+(d*3|0)]|0)==0){e=d}else{g=p[(Mh>>2)+(d*3|0)];break}}return g}),0,(function(){return rW}),0,(function(){return uW}),0,(function(){return tW}),0,El,0,(function(b){return p[p[b+48>>2]+24>>2]}),0,Rl,0,am,0,(function(b,c,d){return gm(b,c,d,(d|0)<0?-1:0)}),0,gm,0,(function(b,c){return $l(b,c)}),0,(function(b){return(b|0)==0?0:n[b+80>>1]<<16>>16}),0,(function(b,c){return im(b,c,ve(c))}),0,(function(b,c){return(b|0)==0|(c|0)<1?0:(n[b+82>>1]<<16>>16|0)<(c|0)?0:p[p[b+76>>2]+(c-1<<2)>>2]}),0,(function(b,c,d,e,f){return Yl(b,c,d,e,f,1)}),0,(function(b,c,d,e,f){return Yl(b,c,d,e,f,2)}),0,(function(b,c,d){var e=t[d+30|0]&255;(e|0)==1?(d=d+16|0,b=gm(b,c,p[d>>2],p[d+4>>2])):(e|0)==2?(d=d+8|0,d=(C[0]=p[d>>2],C[1]=p[d+4>>2],xd[0]),b=am(b,c,d)):b=(e|0)==4?(n[d+28>>1]&16384)<<16>>16==0?Rl(b,c,p[d+4>>2],p[d+24>>2],-1):hm(b,c,p[d+16>>2]):(e|0)==3?Yl(b,c,p[d+4>>2],p[d+24>>2],-1,l[d+31|0]):$l(b,c);return b}),0,Mn,0,(function(b,c){(c|0)>0?(p[b+440>>2]=c,Mn(b,16,b)):Mn(b,0,0);return 0}),0,Kn,0,Tn,0,(function(b,c,d){p[b+200>>2]=d;p[b+204>>2]=0;p[b+208>>2]=c;return 0}),0,(function(b,c,d){p[b+200>>2]=0;p[b+204>>2]=d;p[b+208>>2]=c;return 0}),0,(function(b,c){var d=Jl(b,c),d=vk(d);Ll(b);return d}),0,(function(b,c){var d=Jl(b,c),d=Ak(d);Ll(b);return d}),0,(function(b,c){var d=Jl(b,c),d=Ck(d);Ll(b);return d}),0,sl,0,(function(b,c){return Pl(b,c,6,1)}),0,(function(b,c){return Pl(b,c,8,1)}),0,(function(b,c){var d=Jl(b,c),d=Dk(d);Ll(b);return d}),0,(function(b,c){var d=Jl(b,c),d=Fk(d);Ll(b);return d}),0,(function(b,c){var d=Jl(b,c),e=Jk(d),d=e[0],e=e[1];Ll(b);return[d,e]}),0,Ol,0,(function(b,c){return Pl(b,c,8,0)}),0,Ml,0,(function(b,c){var d=Jl(b,c),d=Ok(d);Ll(b);return d}),0,Nl,0,(function(b,c){var d=Jl(b,c),e=d+28|0,f=n[e>>1];(f&2048)<<16>>16!=0&&(n[e>>1]=f&-6145|4096);Ll(b);return d}),0,(function(b,c,d){var e=b+168|0,f=p[e>>2];p[b+172>>2]=c;p[e>>2]=d;return f}),0,Gn,0,(function(b){var c=og();(c|0)==0&&(c=hi(0),ii(c,-1,b,2,0),b=zk(c,1),b=(b|0)==0?7:Gn(b),Hn(c),c=hk(0,b));return c}),0,(function(b,c,d,e,f){c=vo(b,c,d&255,e,f,0);return hk(b,c)}),0,(function(b,c,d,e,f){c=tn(b,c,-1);(c|0)==0?d=0:(d=vo(b,c,d&255,e,f,0),vf(b,c));return hk(b,d)}),0,(function(b,c,d,e,f,g,h,i){return eo(b,c,d,e,f,g,h,i,0)}),0,(function(b,c,d,e,f,g,h,i){c=tn(b,c,-1);d=fo(b,c,d,e,f,g,h,i,0);vf(b,c);return hk(b,d)}),0,(function(b,c,d,e){return yn(b,c,d,e,0)}),0,(function(b){return(b|0)==0?0:(p[b+20>>2]|0)==0?0:Vc[b+48>>1]&65535}),0,(function(b){return(b|0)==0?0:p[b>>2]}),0,zn,0,(function(b){p[of+192>>2]=b;return 0}),0,an,0,Tm,0,(function(b){var c;if((b|0)==0){var d=d2}else{if((cn(p[b+56>>2])|0)==0){d=e2}else{if(d=b+30|0,l[d]<<24>>24!=0){d=d2}else{c=(b+212|0)>>2;var e=Ok(p[c]);(e|0)==0?(ii(p[c],-1,ok(p[b+20>>2]),1,0),b=Ok(p[c])):b=e;l[d]=0;d=b}}}return d}),0,Ym,0,(function(b){return((b|0)==0?1:l[b+99|0]<<24>>24!=0)&1}),0,Zj,0,wn,0,(function(b){return t[b+28|0]&255}),0,(function(b,c){var d=p[b+4>>2];return(d|0)==0?0:(p[d+4>>2]|0)<=(c|0)|(c|0)<0?0:p[d+(c<<3)+8>>2]}),0,vn,0,(function(b){p[b+224>>2]=1}),0,Jn,0,(function(){return R.zc|0}),0,ya(3007010),0,Kg,0,Bh,0,oo,0,(function(b,c){p[c>>2]=0;var d=og();if((d|0)==0){d=hi(0);ii(d,-1,b,2,0);var e=zk(d,1);(e|0)==0?e=7:(e=po(e,c,6,0),(e|0)==0&&(e=p[p[p[c>>2]+8>>2]+12>>2],(n[e+78>>1]&1)<<16>>16==0&&(l[e+77|0]=2),e=0));Hn(d);d=hk(0,e)}return d}),0,$m,0,(function(b,c,d,e,f){return sn(b,c,d,0,e,f)}),0,(function(b,c,d){var e=b+164|0,f=p[e>>2];p[b+160>>2]=c;p[e>>2]=d;return f}),0,(function(b,c,d,e){var f=b+276|0;(c|0)>0?(p[f>>2]=d,p[b+284>>2]=c,p[b+280>>2]=e):(p[f>>2]=0,p[b+284>>2]=0,p[b+280>>2]=0)}),0,dh,0,qk,0,Qk,0,Vk,0,Yk,0,(function(b,c,d){p[b+52>>2]=1;Tk(b+8|0,c,d,2,-1)}),0,Zk,0,al,0,bl,0,dl,0,(function(b,c,d,e){Sk(b,c,d,2,e)}),0,(function(b,c,d,e){Sk(b,c,d,3,e)}),0,(function(b,c,d,e){Sk(b,c,d,2,e)}),0,el,0,(function(b,c,d){var e=b+176|0,f=p[e>>2];p[b+180>>2]=c;p[e>>2]=d;return f}),0,(function(b,c,d){p[b+268>>2]=c;p[b+272>>2]=d;Nm(p[b+136>>2]);return 0}),0,Hl,0,Ch,0,tl,0,sa(),0,Ln,0,(function(b,c,d){var e=b+156|0,f=p[e>>2];p[b+152>>2]=c;p[e>>2]=d;return f}),0,(function(b,c){if(n[b+80>>1]<<16>>16==n[c+80>>1]<<16>>16){l[c+105|0]<<24>>24!=0&&(p[c+180>>2]|0)!=0&&(l[c+99|0]=1);l[b+105|0]<<24>>24!=0&&(p[b+180>>2]|0)!=0&&(l[b+99|0]=1);xl(b,c);var d=0}else{d=1}return d}),0,(function(b,c,d){var e=b+184|0,f=p[e>>2];p[b+188>>2]=c;p[e>>2]=d;return f}),0,ql,0,vk,0,Ak,0,Ck,0,(function(b){return Dk(b)}),0,Fk,0,Jk,0,lm,0,(function(b){return zk(b,3)}),0,(function(b){return zk(b,2)}),0,lk,0,lh,0,ho,0,(function(b,c,d,e,f){return wl(b,c,d,1,0,e,f)}),0,(function(b,c,d,e,f){return sn(b,c,d,1,e,f)}),0,(function(b){var c=b+80|0,d=n[c>>1]<<16>>16>0;a:do{if(d){for(var e=b+72|0,f=0;;){if(tk(p[e>>2]+f*40|0),n[(p[e>>2]+28>>1)+(f*20|0)]=1,f=f+1|0,(f|0)>=(n[c>>1]<<16>>16|0)){break a}}}}while(0);l[b+105|0]<<24>>24!=0&&(p[b+180>>2]|0)!=0&&(l[b+99|0]=1);return 0}),0,(function(b,c,d,e,f){return yn(b,c,d,e,f)}),0,hm,0,(function(b){return(b|0)==0?0:(p[b+20>>2]|0)==0?0:p[b+4>>2]}),0,(function(b){if((b|0)==0){b=0}else{var c=p[b+24>>2],d=Zj(p[b+20>>2]);vf(c,b);b=d}return b}),0,wm,0,(function(b,c,d,e){return Um(b,c,d,e,10)}),0,(function(b,c,d,e){return Um(b,c,d,e,12)}),0,(function(b,c,d,e,f,g){c=vo(b,c,d&255,e,f,g);return hk(b,c)}),0,Bo,0,(function(b){var c=a;a+=8;var d=c+4;Le(0,c,d,b);b=p[d>>2];a=c;return[b,(b|0)<0?-1:0]}),0,ah,0,(function(b,c,d,e){return po(b,c,d,e)}),0,ya(0),0,pl,0,Uk,0,(function(b){var c=ng(0);return(c|0)==0?0:(Gd[p[c+60>>2]](c,b*1e3|0)|0)/1e3&-1}),0,(function(b){var c=(b|0)<0;$g(c?0:b,c?0:(b|0)<0?-1:0)}),0,ng,0,Mg,0,(function(b){De(b);return 0}),0,ya(0),0,ml,0,ol,0,Co,0,Dh,0,rl,0,(function(b,c){p[b+24>>2]=(c|0)!=0?-1:255;return 0}),0,(function(b,c,d){if(c>>>0>10){d=-1}else{var b=(c<<2)+b+72|0,e=p[b>>2];(d|0)>-1&&(c=p[to+(c<<2)>>2],p[b>>2]=(c|0)<(d|0)?c:d);d=e}return d}),0,(function(b,c){return p[((c|0)==0?b+136|0:c+64|0)>>2]}),0,jj,0,Le,0,Sj,0,Zh,0,(function(b){return p[b+36>>2]}),0,(function(b){return p[b+32>>2]}),0,pi,0,ze,0,Ke,0,eo,0,Qn,0,(function(b){return p[b+68>>2]}),0,df,0,(function(b){(b|0)==0?b=7:(cn(p[b+56>>2])|0)==0?(Qe(113841),b=21):b=l[b+30|0]<<24>>24!=0?7:p[b+20>>2];return b}),0,cf,0,$g,0,(function(){return R.Y|0}),0,(function(b,c,d){b=(c-1<<2)+b+124|0;c=p[b>>2];(d|0)!=0&&(p[b>>2]=0);return c}),0,te,0,ko,0,(function(b,c){return lo(b,c)}),0,co,0,(function(b,c,d){var e=a;a+=4;if((b|0)==0){Qe(71484);var f=21}else{f=p[b+24>>2],(p[b+20>>2]|0)==0?b=4:(b=Gm(b,c,d,e),(b|0)==0?b=0:(c=p[e>>2],$h(f,b,(c|0)!=0?R.d|0:0,(z=a,a+=4,p[z>>2]=c,z)),vf(f,c))),f=hk(f,b)}a=e;return f}),0,Fn,0,(function(b){return t[R.or+((t[b+34|0]&255)-1)|0]&255}),0,(function(b){zq(b);return 0}),0,xq,0,yq,0,zq,0,ya(0),0,(function(b,c){var d=b+8|0,e=p[d+4>>2];p[c>>2]=p[d>>2];p[c+4>>2]=e;return 0}),0,(function(){for(var b=Og>>2,c=b+17;b<c;b++){p[b]=0}(p[of+4>>2]|0)!=0&&(p[Og>>2]=8,p[Og+52>>2]=8);p[Og+12>>2]=10;p[Og+28>>2]=1;return 0}),0,(function(){for(var b=Og>>2,c=b+17;b<c;b++){p[b]=0}}),0,(function(b,c,d){var e,f=Kg(48);e=f>>2;(f|0)!=0&&(Ed(f,0,48),p[e]=Og|0,p[e+1]=b,p[e+2]=c,b=(d|0)!=0,p[e+3]=b&1,b&&(p[e+4]=10,e=p[Og+8>>2],p[Og+8>>2]=e+10|0,p[Og+12>>2]=-10-e+p[Og+4>>2]+10|0));return f}),0,(function(b,c){if((p[b+12>>2]|0)!=0){var d=y[b>>2],e=b+20|0,f=d+4|0,g=p[f>>2]+(c-p[e>>2])|0;p[f>>2]=g;p[d+12>>2]=10-p[d+8>>2]+g|0;p[e>>2]=c;p[b+24>>2]=Math.floor(((c*9|0)>>>0)/10);Et(d)}}),0,(function(b){return p[b+32>>2]}),0,Is,0,(function(b,c,d){var e,f=y[b>>2];e=f>>2;(d|0)==0?y[e+4]>>>0>y[e+1]>>>0?b=3:(d=(f+20|0)>>2,f=p[d],(f|0)==0?p[e+6]=c:(p[(f+24|0)>>2]=c,p[c+20>>2]=p[d]),p[d]=c,b=b+28|0,p[b>>2]=p[b>>2]+1|0,b=8):b=3;b==3&&(ms(c),Ct(c))}),0,(function(b,c,d,e){var f,g=b+36|0;f=(b+40|0)>>2;var d=((d>>>0)%(y[g>>2]>>>0)<<2)+p[f]|0,h=p[d>>2],i=(h|0)==(c|0);a:do{if(i){var j=d}else{for(var k=h;;){var k=k+12|0,m=p[k>>2];if((m|0)==(c|0)){j=k;break a}k=m}}}while(0);d=c+12|0;p[j>>2]=p[d>>2];g=(e>>>0)%(y[g>>2]>>>0);p[c+8>>2]=e;p[d>>2]=p[p[f]+(g<<2)>>2];p[((g<<2)+p[f]|0)>>2]=c;b=b+44|0;y[b>>2]>>>0<e>>>0&&(p[b>>2]=e)}),0,(function(b,c){var d=b+44|0;y[d>>2]>>>0<c>>>0||(Ft(b,c),p[d>>2]=c-1|0)}),0,(function(b){var c;c=b>>2;var d=p[b>>2];Ft(b,0);var e=d+4|0,f=p[e>>2]-p[c+5]|0;p[e>>2]=f;var e=d+8|0,g=p[e>>2]-p[c+4]|0;p[e>>2]=g;p[(d+12|0)>>2]=10-g+f|0;Et(d);Lg(p[c+10]);Lg(b)}),0,(function(b){if((p[b+12>>2]|0)!=0){var c=p[b>>2],b=(c+4|0)>>2,d=p[b];p[b]=0;Et(c);p[b]=d}}),0,(function(b){var b=b+7&-8,c=Dd(b+8|0);(c|0)==0?(cf(7,R.Mq|0,(z=a,a+=4,p[z>>2]=b,z)),b=c):(p[c>>2]=b,p[c+4>>2]=(b|0)<0?-1:0,b=c+8|0);return b}),0,(function(b){DS(b-8|0)}),0,(function(b,c){var d=(b-8|0)==0?Dd(c+8|0):MW(b-8|0,c+8|0);if((d|0)==0){var e=ts(b);cf(7,R.Lq|0,(z=a,a+=8,p[z>>2]=e,p[z+4>>2]=c,z))}else{p[d>>2]=c,p[d+4>>2]=(c|0)<0?-1:0,d=d+8|0}return d}),0,ts,0,(function(b){return b+7&-8}),0,ya(0),0,sa(),0,Gt,0,(function(b,c,d){var e=((ql(b)|0)!=0)<<31>>31,f=p[b+56>>2],g=(lk(p[d>>2])|0)==5;a:do{if(!g){for(var h=0,i=1;;){if((i|0)>=(c|0)){break}var j=p[d+(i<<2)>>2];if((lk(j)|0)==5){break a}h=(Cu(p[d+(h<<2)>>2],j,f)^e|0)>-1?i:h;i=i+1|0}el(b,p[d+(h<<2)>>2])}}while(0)}),0,(function(b,c,d){c=p[d>>2];d=(lk(c)|0)==5;do{if(!d){var e=El(b,40),f=e;if((e|0)!=0){if(n[e+28>>1]<<16>>16!=0){var e=(ql(b)|0)!=0,g=Cu(f,c,p[b+56>>2]);if(!(e&(g|0)<0)&&!((g|0)>0&(e^1))){break}}ll(f,c)}}}while(0)}),0,(function(b){var c=El(b,0);(c|0)!=0&&(n[c+28>>1]<<16>>16!=0&&el(b,c),tk(c))}),0,(function(b,c,d){c=lk(p[d>>2]);dl(b,(c|0)==1?R.hb|0:(c|0)==3?R.Yd|0:(c|0)==2?R.ib|0:(c|0)==4?R.Zd|0:R.kb|0,-1,0)}),0,(function(b,c,d){c=p[d>>2];d=lk(c);do{if((d|0)==4||(d|0)==1||(d|0)==2){var e=Ak(c);Zk(b,e)}else{if((d|0)==3){if(e=wk(c),(e|0)!=0){var f=l[e],g=f<<24>>24==0;a:do{if(g){var h=0}else{for(var i=0,j=e,k=f;;){var i=i+1|0,j=j+1|0,m=l[j],k=(k&255)>191&(m&-64)<<24>>24==-128;b:do{if(k){for(var o=j;;){var o=o+1|0,r=l[o];if((r&-64)<<24>>24!=-128){var q=o,s=r;break b}}}else{q=j,s=m}}while(0);if(s<<24>>24==0){h=i;break a}j=q;k=s}}}while(0);Zk(b,h)}}else{bl(b)}}}while(0)}),0,Jt,0,(function(b,c,d){c=p[d>>2];d=lk(c);do{if((d|0)==1){var e=Jk(c),f=e[0],e=e[1];if((e|0)<0||(e|0)==0&&f>>>0<0){if((f&-1)==0&&(e&2147483647)==0){Yk(b,R.gb|0,-1);break}f=(T.b(0,0,f,e),T.result[0]);e=T.result[1]}al(b,f,e)}else{(d|0)==5?bl(b):(f=Dk(c),Vk(b,f<0?-f:f))}}while(0)}),0,Kt,0,(function(b,c,d){var c=wk(p[d>>2]),d=Ak(p[d>>2]),e=(c|0)==0;do{if(!e){var f=(T.add(d,(d|0)<0?-1:0,1,0),T.result[0]),f=It(b,f,T.result[1]);if((f|0)!=0){var g=(d|0)>0;a:do{if(g){for(var h=0;;){var i=t[c+h|0];l[f+h|0]=((l[R.e+(i&255)|0]|-33)^32)&i;h=h+1|0;if((h|0)==(d|0)){break a}}}}while(0);dl(b,f,d,34)}}}while(0)}),0,(function(b,c,d){var c=wk(p[d>>2]),d=Ak(p[d>>2]),e=(c|0)==0;do{if(!e){var f=(T.add(d,(d|0)<0?-1:0,1,0),T.result[0]),f=It(b,f,T.result[1]);if((f|0)!=0){var g=(d|0)>0;a:do{if(g){for(var h=0;;){if(l[f+h|0]=l[R.i+(t[c+h|0]&255)|0],h=h+1|0,(h|0)==(d|0)){break a}}}}while(0);dl(b,f,d,34)}}}while(0)}),0,(function(b){dl(b,R.zc|0,-1,0)}),0,(function(b,c,d){var e=vk(p[d>>2]),f=Ak(p[d>>2]),d=It(b,f<<1|1,((f|0)<0?-1:0)<<1|f>>>31|0);if((d|0)!=0){c=f<<1;if((f|0)>0){for(var f=e+f|0,g=e,e=d;;){var h=t[g]&255;l[e]=l[R.ra+(h>>>4)|0];l[e+1|0]=l[R.ra+(h&15)|0];g=g+1|0;if((g|0)==(f|0)){break}e=e+2|0}f=d+c|0}else{f=d}l[f]=0;dl(b,d,c,34)}}),0,(function(b){var c,d=a;a+=8;c=d>>2;Dh(8,d);var e=p[c],f=p[c+1];if((f|0)<0||(f|0)==0&&e>>>0<0){e=(T.b(0,0,e^0,f^-2147483648),T.result[0]),f=T.result[1],p[c]=e,p[c+1]=f}c=f;al(b,e,c);a=d}),0,(function(b,c,d){c=Fk(p[d>>2]);c=(c|0)<1?1:c;d=It(b,c,(c|0)<0?-1:0);(d|0)!=0&&(Dh(c,d),Qk(b,d,c,34))}),0,(function(b,c,d){(Cu(p[d>>2],p[d+4>>2],p[b+56>>2])|0)!=0&&el(b,p[d>>2])}),0,(function(b){dl(b,R.Y|0,-1,0)}),0,(function(b,c,d){b=a;c=Fk(p[d>>2]);d=wk(p[d+4>>2]);cf(c,R.d|0,(z=a,a+=4,p[z>>2]=d,z));a=b}),0,(function(b,c,d){c=wk(p[d>>2]);(c|0)!=0&&Zk(b,Ke(c))}),0,(function(b,c,d){c=Fk(p[d>>2]);dl(b,ze(c),-1,0)}),0,Lt,0,(function(b){var c=Jn(rl(b));al(b,c[0],c[1])}),0,(function(b){Zk(b,Kn(rl(b)))}),0,(function(b){Zk(b,Ln(rl(b)))}),0,Mt,0,(function(b,c,d){var c=rl(b),e=Jk(p[d>>2]),d=e[0],e=e[1],c=p[c+72>>2],f=(c|0)<0?-1:0;(e|0)>(f|0)||(e|0)==(f|0)&&d>>>0>c>>>0?Uk(b):ml(b,d)}),0,(function(b,c,d){var e,f=a;a+=4;e=f>>2;var g=wk(p[d>>2]),h=rl(b);p[e]=0;c=(c|0)==2?wk(p[d+4>>2]):0;if(d=(g|0)!=0){g=dn(h,g,c,f),d=(hk(h,g)|0)!=0}d&&(Yk(b,p[e],-1),Lg(p[e]));a=f}),0,Nt,0,(function(b){var c=El(b,0);if((c|0)!=0){var d=c+16|0,e=p[(d+4|0)>>2];if((e|0)>0||(e|0)==0&&p[(d|0)>>2]>>>0>0){l[c+24|0]<<24>>24==0?l[c+25|0]<<24>>24==0?(c=c+8|0,d=p[(c|0)>>2],al(b,d,p[(c+4|0)>>2])):(c=(C[0]=p[c>>2],C[1]=p[c+4>>2],xd[0]),Vk(b,c)):Yk(b,R.gb|0,-1)}}}),0,(function(b){var c=El(b,0),c=(c|0)==0?0:(C[0]=p[c>>2],C[1]=p[c+4>>2],xd[0]);Vk(b,c)}),0,(function(b){var c=El(b,0);if((c|0)!=0){var d=c+16|0,e=p[d>>2],d=p[d+4>>2];if((d|0)>0||(d|0)==0&&e>>>0>0){c=(C[0]=p[c>>2],C[1]=p[c+4>>2],xd[0])/(e+d*4294967296),Vk(b,c)}}}),0,(function(b,c,d){var b=El(b,8),e=(c|0)==0;do{if(e){if((b|0)==0){c=5;break}}else{if((lk(p[d>>2])|0)==5|(b|0)==0){c=5;break}}c=4}while(0);c==4&&(d=b>>2,b=(T.add(p[d],p[d+1],1,0),T.result[0]),c=T.result[1],p[d]=b,p[d+1]=c)}),0,(function(b){var c=El(b,0);if((c|0)==0){var d=0,c=0}else{d=p[c+4>>2],c=p[c>>2]}al(b,c,d)}),0,(function(b,c,d){if((lk(p[d>>2])|0)!=5){var e=El(b,28);if((e|0)!=0){var b=rl(b),f=e+25|0,g=l[f]<<24>>24==0;l[f]=2;p[e+20>>2]=p[b+72>>2];g||((c|0)==2?(b=d+4|0,c=wk(p[b>>2]),b=Ak(p[b>>2])):(b=1,c=R.fb|0),uh(e,c,b));c=wk(p[d>>2]);d=Ak(p[d>>2]);uh(e,c,d)}}}),0,(function(b){var c=El(b,0);(c|0)!=0&&(l[c+26|0]<<24>>24==0?l[c+24|0]<<24>>24==0?(c=th(c),dl(b,c,-1,34)):pl(b):Uk(b))}),0,(function(b,c,d){c=a;a+=4;var e=wk(p[d>>2]),d=wk(p[d+4>>2]),f=rl(b),g=(e|0)==0;a:do{if(!g){var h=0,i=e;b:for(;;){if(l[i]<<24>>24==0){break a}for(var j=h,k=i;;){var k=k+j|0,j=Bn(k,c),m=p[c>>2];if((m|0)!=149){if((m|0)==121||(m|0)==22){break b}else{h=j;i=k;continue b}}}}k=i-e|0;h=zm(f,R.ab|0,(z=a,a+=16,p[z>>2]=k,p[z+4>>2]=e,p[z+8>>2]=d,p[z+12>>2]=i+h|0,z));dl(b,h,-1,4)}}while(0);a=c}),0,(function(b,c,d){c=a;a+=4;var e=wk(p[d>>2]),d=wk(p[d+4>>2]),f=rl(b),g=(e|0)==0;a:do{if(!g){for(var h=0,i=e,j=3;;){if(l[i]<<24>>24==0){break a}for(var k=h,m=i;;){var o=m+k|0,r=Bn(o,c),q=p[c>>2];if((q|0)!=149){break}k=r;m=o}j=j+1|0;if((q|0)==118||(q|0)==104){h=r,i=o,j=0}else{if((j|0)!=2){h=r,i=o}else{if((q|0)==135||(q|0)==45||(q|0)==5){break}h=r;i=o;j=2}}}j=i-e|0;h=zm(f,R.ab|0,(z=a,a+=16,p[z>>2]=j,p[z+4>>2]=e,p[z+8>>2]=d,p[z+12>>2]=i+h|0,z));dl(b,h,-1,4)}}while(0);a=c}),0,Pt,0,(function(b,c,d){var e=a;a+=44;(St(b,c,d,e)|0)==0&&(Yt(e),c=e|0,Vk(b,(p[c>>2]+p[c+4>>2]*4294967296)/864e5));a=e}),0,Rt,0,Ut,0,Wt,0,Zt,0,(function(b){Ut(b,0,0)}),0,(function(b){Wt(b,0,0)}),0,(function(b){Rt(b,0,0)}),0,dE,0,zE,0,(function(b){(b|0)!=0&&(wQ(b,0),Lg(p[b+24>>2]));oW(b);return 0}),0,(function(b,c,d,e,f){e=nW(b,e,f,c,d);(e|0)==(d|0)?b=0:(e|0)<0?b=266:(p[b+20>>2]=0,Ed(c+e|0,0,d-e|0),b=522);return b}),0,(function(b,c,d,e,f){for(var g=e;;){if((d|0)<=0){var h=0;break}e=lW(b,g,f,c,d);if((e|0)<=0){if((e|0)<0&&(p[b+20>>2]|0)!=28){h=778;break}p[b+20>>2]=0;h=13;break}d=d-e|0;g=(T.add(e,(e|0)<0?-1:0,g,f),T.result[0]);f=T.result[1];c=c+e|0}return h}),0,(function(b,c,d){var e=p[b+40>>2];if((e|0)==0){e=c}else{var f=(e|0)<0?-1:0,c=(T.add(c,d,-1,-1),T.result[0]),c=(T.add(c,T.result[1],e,f),T.result[0]),d=T.result[1],e=(T.k(c,d,e,f),T.result[0]),e=(T.b(c,d,e,T.result[1]),T.result[0])}(pR(p[b+12>>2],e)|0)==0?b=0:(p[b+20>>2]=p[Qh>>2],b=Sh(1546,R.da|0,p[b+32>>2],28341));return b}),0,(function(b){var c=a;a+=4;if((FX(p[b+12>>2])|0)==0){var d=b+17|0;if((l[d]&8)<<24>>24==0){d=0}else{var e=Gd[p[Mh+208>>2]](p[b+32>>2],c);(e|0)==0?(e=p[c>>2],(e|0)>-1&&(FX(e),iU(b,p[c>>2],28311)),b=0):b=(e|0)==14?0:e;l[d]&=-9;d=b}}else{p[b+20>>2]=p[Qh>>2],d=Sh(1034,R.nq|0,p[b+32>>2],28297)}a=c;return d}),0,(function(b,c){var d=a;a+=72;if((Gd[p[Mh+64>>2]](p[b+12>>2],d)|0)==0){var e=p[d+28>>2],f=(e|0)==1;p[c>>2]=f?0:e;p[c+4>>2]=f?0:(e|0)<0?-1:0;e=0}else{p[b+20>>2]=p[Qh>>2],e=1802}a=d;return e}),0,(function(b,c){var d=p[b+24>>2],e=b+16|0;l[e]<<24>>24==0?(d=Gd[p[Mh+220>>2]](d,511),(d|0)<0?(e=p[Qh>>2],(e|0)==17?e=5:(d=eW(e),(d|0)==5||(d|0)==0||(p[b+20>>2]=e),e=d)):(l[e]=c&255,e=d)):(l[e]=c&255,fa(d,0),e=0);return e}),0,wQ,0,(function(b,c){var d=(t[b+16|0]&255)>1?1:(Gd[p[Mh+28>>2]](p[b+24>>2],0)|0)==0&1;p[c>>2]=d;return 0}),0,(function(b,c,d){(c|0)==1?(p[d>>2]=t[b+16|0]&255,d=0):(c|0)==4?(p[d>>2]=p[b+20>>2],d=0):(c|0)==6?(p[b+40>>2]=p[d>>2],d=0):(c|0)==5?d=kW(b,p[d>>2],p[d+4>>2]):(c|0)==10?(jW(b,4,d),d=0):(c|0)==13?(jW(b,16,d),d=0):(c|0)==12?(b=p[p[b+4>>2]+16>>2],b=Bh(R.d|0,(z=a,a+=4,p[z>>2]=b,z)),p[d>>2]=b,d=0):d=12;return d}),0,ya(4096),0,(function(b){return(l[b+17|0]&16)<<24>>24==0?0:4096}),0,cR,0,SR,0,sa(),0,(function(b,c){var d=b+36|0,e=p[d>>2],f=(e|0)==0;do{if(!f){var g=p[e>>2],h=g+32|0,i=p[h>>2],j=(i|0)==(e|0);a:do{if(j){var k=h}else{for(var m=i;;){var m=m+4|0,o=p[m>>2];if((o|0)==(e|0)){k=m;break a}m=o}}}while(0);p[k>>2]=p[e+4>>2];Lg(e);p[d>>2]=0;h=g+28|0;i=p[h>>2]-1|0;p[h>>2]=i;if((i|0)==0){if((c|0)!=0&&(p[g+12>>2]|0)>-1){Gd[p[Mh+196>>2]](p[g+8>>2])}AS(b)}}}while(0);return 0}),0,(function(b,c,d){var e=a,b=EX(b,c,(z=a,a+=4,p[z>>2]=d,z));a=e;return b}),0,(function(b){return DR[b]?(DR[b].Ec&&DS(DR[b].Ec),delete DR[b],0):(uU(QW),-1)}),0,(function(b,c){var b=pd(b),d=cX(b);return d===la?-1:c&2&&!d.write||(c&1||c&4)&&!d.ha?(uU(PW),-1):0}),0,(function(b,c){if(c==0){return uU(RU),0}else{if(c<2){return uU(OU),0}else{for(var d=0;d<1;d++){l[b+d]="/".charCodeAt(d)}l[b+d]=0;return b}}}),0,AX,0,(function(b,c){if(DR[b]){var d=Pd(DR[b].path);return AX(G(d,"i8",1),c)}else{return uU(QW),-1}}),0,(function(b,c){return DR[b]&&DR[b].z?BX(DR[b].path,c):(DR[b]?uU(RU):uU(QW),-1)}),0,(function(b,c,d){if(!(b in DR)){return uU(QW),-1}b=DR[b];switch(c){case 0:c=p[d>>2];if(c<0){uU(RU);break}var d={},e;for(e in b){d[e]=b[e]}if(c in DR){c=DR.length}DR[c]=d;return c;case 1:case 2:return 0;case 3:return e=0,b.G&&b.z?e=2:!b.G&&b.z?e=1:b.G&&!b.z&&(e=0),b.P&&(e|=8),e;case 4:return c=p[d>>2],b.P=Boolean(c|8),0;case 7:case 20:return c=p[d>>2],n[c+0>>1]=3,0;case 8:case 9:case 21:case 22:return 0;case 6:case 5:uU(RU);break;default:uU(RU)}return-1}),0,(function(b,c,d){var e=DR[b];if(e){if(e.G){if(d<0){return uU(RU),-1}else{if(e.object.r){if(e.object.input){for(b=0;e.v.length&&d>0;){l[c++]=e.v.pop(),d--,b++}for(var f=0;f<d;f++){try{var g=e.object.input()}catch(h){return uU(SW),-1}if(g===la||g===fa){break}b++;l[c+f]=g}return b}else{return uU(6),-1}}else{return g=e.v.length,b=CX(b,c,d,e.position),b!=-1&&(e.position+=e.v.length-g+b),b}}}else{return uU(PW),-1}}else{return uU(QW),-1}}),0,(function(b,c,d){var e=DR[b];if(e){if(e.z){if(d<0){return uU(RU),-1}else{if(e.object.r){if(e.object.Q){for(var f=0;f<d;f++){try{e.object.Q(l[c+f])}catch(g){return uU(SW),-1}}e.object.timestamp=Date.now();return f}else{return uU(6),-1}}else{f=e.position;b=DR[b];if(!b||b.object.r){uU(QW),c=-1}else{if(b.z){if(b.object.p){uU(TW),c=-1}else{if(d<0||f<0){uU(RU),c=-1}else{for(var h=b.object.g;h.length<f;){h.push(0)}for(var i=0;i<d;i++){h[f+i]=t[c+i]}b.object.timestamp=Date.now();c=i}}}else{uU(PW),c=-1}}c!=-1&&(e.position+=c);return c}}}else{return uU(PW),-1}}else{return uU(QW),-1}}),0,(function(b){b=aX(pd(b));return!b.fa||!b.ea?(uU(b.error),-1):b.object.p?(uU(TW),-1):b.object.write?(delete b.L.g[b.name],0):(uU(PW),-1)}),0,(function(b,c){var d=a;a+=516;var e,f=d|0;Ch(512,f,R.d|0,(z=a,a+=4,p[z>>2]=b,z));for(e=qe(f);;){if((e|0)<=1){break}if(l[d+e|0]<<24>>24==47){break}e=e-1|0}if((e|0)>0){if(l[d+e|0]=0,e=Ph(f,0,0),(e|0)>-1){var g=p[Mh+88>>2],h=Gd[g](e,1,(z=a,a+=4,p[z>>2]=0,z))|1;Gd[g](e,2,(z=a,a+=4,p[z>>2]=h,z));p[c>>2]=e;g=0;e=9}else{var i=e;e=8}}else{i=-1,e=8}e==8&&(p[c>>2]=i,Rh(28256),g=Sh(14,R.na|0,f,28256));a=d;return g}),0,(function(b,c){var d;var e=b,f=16384|c&384;if(f&49152){var g={g:[],p:Boolean(f&16384)},e=aX(pd(e));try{eX(e.L,e.name,g,f&256,f&128),d=0}catch(h){d=-1}}else{uU(RU),d=-1}return d}),0,(function(b){b=aX(pd(b));if(!b.fa||!b.ea){return uU(b.error),-1}else{if(!b.object.write||b.Jc){return uU(PW),-1}else{if(b.object.p){for(var c in b.object.g){return uU(39),-1}return b.path=="/"?(uU(16),-1):(delete b.L.g[b.name],0)}else{return uU(20),-1}}}}),0,(function(b){oW(b);return 0}),0,ya(0),0,ya(0),0,(function(b,c){return p[c>>2]=0}),0,(function(b){xW(b,0);var c=p[b+8>>2];if((c|0)!=0&&(p[c+24>>2]|0)!=0){var c=b+28|0,d=p[c>>2],e=p[b+8>>2]+28|0;p[(d+8|0)>>2]=p[e>>2];p[e>>2]=d;p[b+12>>2]=-1;p[c>>2]=0}c=p[b+8>>2];if((c|0)!=0&&(d=c+16|0,e=p[d>>2]-1|0,p[d>>2]=e,(e|0)==0)){yW(b);var d=c+36|0,e=p[d>>2],f=c+32|0,g=p[f>>2];(e|0)==0?p[Nh>>2]=g:p[(e+32|0)>>2]=g;e=p[f>>2];(e|0)!=0&&(p[(e+36|0)>>2]=p[d>>2]);Lg(c)}oW(b);return 0}),0,vW,0,(function(b,c){return xW(b,c)}),0,(function(b,c){var d=a;a+=16;var e=y[b+8>>2],f=(t[e+12|0]&255)>1,g=f&1;f?e=0:l[e+13|0]<<24>>24!=0?e=g=0:(n[d+2>>1]=0,p[d+4>>2]=p[si>>2]+1|0,p[d+8>>2]=1,e=d|0,n[e>>1]=2,(Gd[p[Mh+88>>2]](p[b+12>>2],7,(z=a,a+=4,p[z>>2]=d,z))|0)==0?(g=n[e>>1]<<16>>16==3?0:1,e=0):(p[b+20>>2]=p[Qh>>2],e=3594));p[c>>2]=g;a=d;return e}),0];Module.FUNCTION_TABLE=Gd;function f2(b){b=b||Module.arguments;Module.setStatus&&Module.setStatus("");Module.preRun&&Module.preRun();var c=la;Module._main&&(ae(fe),c=Module.tr(b),Module.noExitRuntime||ae(ne));Module.postRun&&Module.postRun();return c}Module.run=f2;ae(ee);Module.noInitialRun&&(se++,Module.monitorRunDependencies&&Module.monitorRunDependencies(se));se==0&&f2();var g2=Ic(4),h2,i2=Gd.length;Gd[i2]=(function(b,c,d,e){for(var b=[],f=0;f<c;f++){b.push({column:pd(yd(e+f*wc,"i32")),value:pd(yd(d+f*wc,"i32"))})}h2.push(b)});Gd.push(0,0);var j2=0;Module.open=(function(b){var c="file_"+j2++;b&&hX("/",c,b,!0,!0);(b=Module.ccall("sqlite3_open","number",["string","number"],[c,g2]))&&ca("SQLite exception: "+b);return{ga:yd(g2,"i32"),filename:c,close:(function(){var b=Module.ccall("sqlite3_close","number",["number"],[this.ga]);this.ga=la;b&&ca("SQLite exception: "+b)}),exec:(function(b){this.ga||ca("Database closed!");rd(g2,0,"i32");h2=[];var c=Module.ccall("sqlite3_exec","number",["number","string","number","number","number"],[this.ga,b,i2,0,g2]),b=yd(g2,"i32");if(c||b){c="SQLite exception: "+c+(b?", "+pd(b):""),b&&Lg(b),ca(c)}return h2}),exportData:(function(){this.ga||ca("Database closed!");return new Uint8Array(bX.g[this.filename].g)})}});this.SQL=Module diff --git a/src/main/webapp/lib/.gitignore b/src/main/webapp/lib/.gitignore new file mode 100644 index 0000000..d3f5a12 --- /dev/null +++ b/src/main/webapp/lib/.gitignore @@ -0,0 +1 @@ +
diff --git a/src/main/webapp/lib/OpenIDConsumer/ClientScopeOpenIDSession.cfc b/src/main/webapp/lib/OpenIDConsumer/ClientScopeOpenIDSession.cfc new file mode 100755 index 0000000..626e74e --- /dev/null +++ b/src/main/webapp/lib/OpenIDConsumer/ClientScopeOpenIDSession.cfc @@ -0,0 +1,22 @@ +<cfcomponent> + +<cffunction name="init"> + <cfreturn this/> +</cffunction> + +<cffunction name="exists"> + <cfreturn StructKeyExists(Client, "__OpenID")/> +</cffunction> + +<cffunction name="load"> + <cfset var json = createobject("component","json") /> + <cfreturn json.decode(Client.__OpenID)/> +</cffunction> + +<cffunction name="store"> + <cfargument name="data"/> + <cfset var json = createobject("component","json") /> + <cfset Client.__OpenID = json.encode(arguments.data)/> +</cffunction> + +</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/lib/OpenIDConsumer/OpenIDConsumer.cfc b/src/main/webapp/lib/OpenIDConsumer/OpenIDConsumer.cfc new file mode 100755 index 0000000..ed53303 --- /dev/null +++ b/src/main/webapp/lib/OpenIDConsumer/OpenIDConsumer.cfc @@ -0,0 +1,390 @@ +<!--- Document Information -----------------------------------------------------
+
+Title: OpenIDConsumer.cfc
+
+Author: Dmitry Yakhnov
+Email: dmitry@yakhnov.info
+
+Website: http://www.yakhnov.info/
+ http://www.coldfusiondeveloper.com.au/
+
+Purpose: Consumer library for OpenID auth framework
+
+Thanks to: Tim McCarthy (tim@timmcc.com) for HMAC:SHA1 functions
+
+Modification Log:
+
+Name Date Version Description
+================================================================================
+Dmitry Yakhnov 14/12/2006 0.0.1 Created
+Dmitry Yakhnov 11/01/2007 0.1 Public release
+Dmitry Yakhnov 11/04/2007 0.1.1 Thread-safe version
+Dmitry Yakhnov 08/05/2007 0.2 Smart mode support
+
+------------------------------------------------------------------------------->
+<cfcomponent name="OpenIDConsumer" hint="Consumer library for OpenID auth framework">
+
+<cffunction name="getServers" returntype="struct" access="public" output="false" hint="Parse html page for openid.server and openid.delegate declarations">
+ <cfargument name="Content" type="string" required="true" />
+
+ <cfset var Servers = StructNew() />
+ <cfset var match = "" />
+
+ <cfset Servers['server'] = "" />
+ <cfset Servers['delegate'] = "" />
+
+ <cfset match = REFindNoCase("<link[^>]*rel=""openid.server""[^>]*href=""([^""]+)""[^>]*\/?>",arguments.Content,1,true) />
+ <cfif match.pos[1] neq 0>
+ <cfset Servers['server'] = Mid(arguments.Content,match.pos[2],match.len[2]) />
+ <cfelse>
+ <cfset match = REFindNoCase("<link[^>]*href=""([^""]+)""[^>]*rel=""openid.server""[^>]*\/?>",arguments.Content,1,true) />
+ <cfif match.pos[1] neq 0>
+ <cfset Servers['server'] = Mid(arguments.Content,match.pos[2],match.len[2]) />
+ </cfif>
+ </cfif>
+
+ <cfset match = REFindNoCase("<link[^>]*rel=""openid.delegate""[^>]*href=""([^""]+)""[^>]*\/?>",arguments.Content,1,true) />
+ <cfif match.pos[1] neq 0>
+ <cfset Servers['delegate'] = Mid(arguments.Content,match.pos[2],match.len[2]) />
+ <cfelse>
+ <cfset match = REFindNoCase("<link[^>]*href=""([^""]+)""[^>]*rel=""openid.delegate""[^>]*\/?>",arguments.Content,1,true) />
+ <cfif match.pos[1] neq 0>
+ <cfset Servers['delegate'] = Mid(arguments.Content,match.pos[2],match.len[2]) />
+ </cfif>
+ </cfif>
+
+ <cfreturn Servers />
+
+</cffunction>
+
+<cffunction name="discoverOpenIDServer" returntype="struct" access="public" output="false" hint="Consumer fetches the IdP server URL">
+ <cfargument name="Request" type="struct" required="true" />
+
+ <cfset var Response = StructNew() />
+ <cfset var cfhttp = "" />
+ <cfset var Servers = "" />
+
+ <cfhttp method="get" url="#arguments.Request['openid.identity']#" />
+
+ <cfset Response['status'] = false />
+
+ <cfif Find("200",cfhttp.StatusCode)>
+ <cfset Servers = getServers(cfhttp.FileContent) />
+ <cfif Servers['server'] neq "">
+ <cfif Servers['delegate'] neq "">
+ <cfset Response['identity'] = Servers['delegate'] />
+ </cfif>
+ <cfset Response['server'] = Servers['server'] />
+ <cfset Response['status'] = true />
+ </cfif>
+ </cfif>
+
+ <cfreturn Response />
+
+</cffunction>
+
+<cffunction name="getAssociate" returntype="struct" access="public" output="false" hint="Establish a shared secret between Consumer and IdP">
+ <cfargument name="Request" type="struct" required="true" />
+
+ <cfset var Response = StructNew() />
+ <cfset var cfhttp = "" />
+ <cfset var pos = 0 />
+ <cfset var match = "" />
+
+ <cfhttp method="post" url="#arguments.Request['openid_server']#">
+ <cfhttpparam type="formfield" name="openid.mode" value="associate" />
+ <cfhttpparam type="formfield" name="openid.assoc_type" value="HMAC-SHA1" />
+ <cfhttpparam type="formfield" name="openid.session_type" value="" />
+ </cfhttp>
+
+ <cfset Response['status'] = false />
+
+ <cfif Find("200",cfhttp.StatusCode)>
+ <cfset pos = 1 />
+ <cfset match = REFindNoCase("([^:]*):([^\r\n]*)",cfhttp.FileContent,pos,true) />
+ <cfloop condition="match.pos[1] gt 0">
+ <cfset Response[Mid(cfhttp.FileContent,match.pos[2],match.len[2])] = Mid(cfhttp.FileContent,match.pos[3],match.len[3]) />
+ <cfset pos = match.pos[1] + match.len[1] + 1 />
+ <cfset match = REFindNoCase("([^:]*):([^\r\n]*)",cfhttp.FileContent,pos,true) />
+ </cfloop>
+ <cfset Response['status'] = true />
+ </cfif>
+
+ <cfreturn Response />
+
+</cffunction>
+
+<cffunction name="doRedirect" returntype="void" access="public" output="false" hint="Redirect user browser to IdP">
+ <cfargument name="Request" type="struct" required="true" />
+
+ <cfset var Header = StructNew() />
+ <cfset var redirectURL = "" />
+ <cfset var sKey = "" />
+
+ <cfset Header['openid.mode'] = "checkid_setup" />
+ <cfset Header['openid.assoc_handle'] = arguments.Request['assoc_handle'] />
+
+ <cfloop item="sKey" collection="#arguments.Request#">
+ <cfif Find("openid.",sKey)>
+ <cfset Header[Lcase(sKey)] = arguments.Request[sKey] />
+ </cfif>
+ </cfloop>
+
+ <cfset redirectURL = arguments.Request['openid_server'] & "?" & struct2string(Header) />
+
+ <cflocation addtoken="false" url="#redirectURL#" />
+
+</cffunction>
+
+<cffunction name="isValidSignature" returntype="boolean" access="public" output="false" hint="Validation of IdP signature">
+ <cfargument name="Request" type="struct" required="true" />
+
+ <cfset var tokenContents = "" />
+ <cfset var sKey = "" />
+ <cfset var Secret = "" />
+ <cfset var Signature = "" />
+
+ <cfif not StructKeyExists(arguments.Request,"mac_key")>
+ <cfreturn false />
+ </cfif>
+
+ <cfloop index="sKey" list="#url['openid.signed']#">
+ <cfset tokenContents = tokenContents & "#LCase(sKey)#:#URLDecode(url['openid.'&sKey])##chr(10)#" />
+ </cfloop>
+
+ <cfset Secret = ToString(ToBinary(arguments.Request['mac_key']),"iso-8859-1") />
+ <cfset Signature = ToBase64(hex2bin(HMAC_SHA1(tokenContents,Secret,160),"hex"),"iso-8859-1") />
+
+ <cfif Signature eq url['openid.sig']>
+ <cfreturn true />
+ <cfelse>
+ <cfreturn false />
+ </cfif>
+
+</cffunction>
+
+<cffunction name="isValidHandle" returntype="boolean" access="public" output="false" hint="Ask IdP if a message is valid">
+ <cfargument name="Request" type="struct" required="true" />
+
+ <cfset var cfhttp = "" />
+ <cfset var sKey = "" />
+
+ <cfhttp method="post" url="#arguments.Request['openid_server']#">
+ <cfhttpparam type="formfield" name="openid.mode" value="check_authentication" />
+ <cfhttpparam type="formfield" name="openid.assoc_handle" value="#arguments.Request['assoc_handle']#" />
+ <cfhttpparam type="formfield" name="openid.sig" value="#url['openid.sig']#" />
+ <cfhttpparam type="formfield" name="openid.signed" value="#url['openid.signed']#" />
+ <cfloop index="sKey" list="#url['openid.signed']#">
+ <cfif sKey neq "mode">
+ <cfhttpparam type="formfield" name="openid.#LCase(sKey)#" value="#url['openid.'&sKey]#" />
+ </cfif>
+ </cfloop>
+ </cfhttp>
+
+ <cfif Find("200", cfhttp.StatusCode) and FindNoCase("is_valid:true", cfhttp.FileContent)>
+ <cfreturn true />
+ <cfelse>
+ <cfreturn false />
+ </cfif>
+
+</cffunction>
+
+<!--- Misc functions --->
+
+<cffunction name="normalizeURL" returntype="string" access="public" output="false" hint="URL normalization">
+ <cfargument name="inURL" type="string" required="true" />
+
+ <cfset var outURL = "" />
+
+ <!--- Add protocol to the URL --->
+ <cfif Left(arguments.inURL,7) neq "http://">
+ <cfset outURL = "http://" & arguments.inURL />
+ <cfelse>
+ <cfset outURL = arguments.inURL />
+ </cfif>
+
+ <cfreturn outURL />
+
+</cffunction>
+
+<cffunction name="struct2string" returntype="string" access="public" output="false" hint="Convert struct pairs of key and value to a string">
+ <cfargument name="inStr" type="struct" required="true" />
+
+ <cfset var outStr = "" />
+ <cfset var sKey = "" />
+
+ <!--- Loop through struct to form URL string of pairs (key1=value1&key2=value2...) --->
+ <cfloop item="sKey" collection="#arguments.inStr#">
+ <cfset outStr = outStr & iif(outStr eq "",de(""),de("&")) & LCase(sKey) & "=" & URLEncodedFormat(arguments.inStr[sKey]) />
+ </cfloop>
+
+ <cfreturn outStr />
+
+</cffunction>
+
+<cffunction name="hex2bin" returntype="any" access="public" output="false" hint="Convert hex string to a bytes array">
+ <cfargument name="inStr" type="string" required="true" />
+
+ <cfset var outStream = createobject("java","java.io.ByteArrayOutputStream").init() />
+ <cfset var inLen = Len(arguments.inStr) />
+ <cfset var outStr = "" />
+ <cfset var i = 0 />
+ <cfset var ch = "" />
+
+ <cfif inLen mod 2 neq 0>
+ <cfset arguments.inStr = "0" & arguments.inStr />
+ </cfif>
+
+ <cfloop index="i" from="1" to="#inLen#" step="2">
+ <cfset ch = Mid(arguments.inStr, i, 2) />
+ <cfset outStream.write(JavaCast("int", InputBaseN(ch, 16))) />
+ </cfloop>
+
+ <cfset outStream.flush() />
+ <cfset outStream.close() />
+
+ <cfreturn outStream.toByteArray() />
+
+</cffunction>
+
+<!--- HMAC:SHA1 encryption, do not modify below --->
+
+<cffunction name="HMAC_SHA1" returntype="string" access="public">
+ <cfargument name="Data" type="string" required="true" />
+ <cfargument name="Key" type="string" required="true" />
+ <cfargument name="Bits" type="numeric" required="true" />
+
+ <cfset var i = 0 />
+ <cfset var HexData = "" />
+ <cfset var HexKey = "" />
+ <cfset var KeyLen = 0 />
+ <cfset var KeyI = "" />
+ <cfset var KeyO = "" />
+
+ <cfloop index="i" from="1" to="#Len(arguments.Data)#">
+ <cfset HexData = HexData & Right("0"&FormatBaseN(Asc(Mid(arguments.Data,i,1)),16),2) />
+ </cfloop>
+
+ <cfloop index="i" from="1" to="#Len(arguments.Key)#">
+ <cfset HexKey = HexKey & Right("0"&FormatBaseN(Asc(Mid(arguments.Key,i,1)),16),2) />
+ </cfloop>
+
+ <cfset KeyLen = Len(HexKey)/2 />
+
+ <cfif KeyLen gt 64>
+ <cfset HexKey = SHA1(HexKey) />
+ <cfset KeyLen = Len(HexKey)/2 />
+ </cfif>
+
+ <cfloop index="i" from="1" to="#KeyLen#">
+ <cfset KeyI = KeyI & Right("0"&FormatBaseN(BitXor(InputBaseN(Mid(HexKey,2*i-1,2),16),InputBaseN("36",16)),16),2) />
+ <cfset KeyO = KeyO & Right("0"&FormatBaseN(BitXor(InputBaseN(Mid(HexKey,2*i-1,2),16),InputBaseN("5c",16)),16),2) />
+ </cfloop>
+ <cfset KeyI = KeyI & RepeatString("36",64-KeyLen) />
+ <cfset KeyO = KeyO & RepeatString("5c",64-KeyLen) />
+
+ <cfset HexKey = SHA1(KeyI&HexData) />
+ <cfset HexKey = SHA1(KeyO&HexKey) />
+
+ <cfreturn Left(HexKey,arguments.Bits/4) />
+
+</cffunction>
+
+<cffunction name="SHA1" returntype="string" access="public">
+ <cfargument name="Msg" type="string" required="true" />
+
+ <cfset var HexMsg = arguments.Msg />
+ <cfset var HexMsgLen = FormatBaseN(4*Len(HexMsg),16) />
+ <cfset var PadHexMsg = HexMsg & "80" & RepeatString("0",128-((Len(HexMsg)+2+16) Mod 128)) & RepeatString("0",16-Len(HexMsgLen)) & HexMsgLen />
+ <cfset var h = ArrayNew(1) />
+ <cfset var w = ArrayNew(1) />
+ <cfset var n = 0 />
+ <cfset var t = 0 />
+ <cfset var i = 0 />
+ <cfset var MsgBlock = "" />
+ <cfset var a = "" />
+ <cfset var b = "" />
+ <cfset var c = "" />
+ <cfset var d = "" />
+ <cfset var e = "" />
+ <cfset var f = "" />
+ <cfset var k = "" />
+ <cfset var temp = "" />
+ <cfset var num = "" />
+
+ <cfset h[1] = InputBaseN("0x67452301",16) />
+ <cfset h[2] = InputBaseN("0xefcdab89",16) />
+ <cfset h[3] = InputBaseN("0x98badcfe",16) />
+ <cfset h[4] = InputBaseN("0x10325476",16) />
+ <cfset h[5] = InputBaseN("0xc3d2e1f0",16) />
+
+ <cfloop index="n" from="1" to="#Evaluate(Len(PadHexMsg)/128)#">
+ <cfset MsgBlock = Mid(PadHexMsg,128*(n-1)+1,128) />
+
+ <cfset a = h[1] />
+ <cfset b = h[2] />
+ <cfset c = h[3] />
+ <cfset d = h[4] />
+ <cfset e = h[5] />
+
+ <cfloop index="t" from="0" to="79">
+
+ <cfif t le 19>
+ <cfset f = BitOr(BitAnd(b,c),BitAnd(BitNot(b),d)) />
+ <cfset k = InputBaseN("0x5a827999",16) />
+ <cfelseif t le 39>
+ <cfset f = BitXor(BitXor(b,c),d) />
+ <cfset k = InputBaseN("0x6ed9eba1",16) />
+ <cfelseif t le 59>
+ <cfset f = BitOr(BitOr(BitAnd(b,c),BitAnd(b,d)),BitAnd(c,d)) />
+ <cfset k = InputBaseN("0x8f1bbcdc",16) />
+ <cfelse>
+ <cfset f = BitXor(BitXor(b,c),d) />
+ <cfset k = InputBaseN("0xca62c1d6",16) />
+ </cfif>
+
+ <cfif t le 15>
+ <cfset w[t+1] = InputBaseN(Mid(MsgBlock,8*t+1,8),16) />
+ <cfelse>
+ <cfset num = BitXor(BitXor(BitXor(w[t-3+1],w[t-8+1]),w[t-14+1]),w[t-16+1]) />
+ <cfset w[t+1] = BitOr(BitSHLN(num,1),BitSHRN(num,32-1)) />
+ </cfif>
+
+ <cfset temp = BitOr(BitSHLN(a,5),BitSHRN(a,32-5)) + f + e + w[t+1] + k />
+ <cfset e = d />
+ <cfset d = c />
+ <cfset c = BitOr(BitSHLN(b,30),BitSHRN(b,32-30)) />
+ <cfset b = a />
+ <cfset a = temp />
+
+ <cfset num = a />
+ <cfloop condition="(num lt -2^31) or (num ge 2^31)">
+ <cfset num = num - Sgn(num)*2^32 />
+ </cfloop>
+ <cfset a = num />
+
+ </cfloop>
+
+ <cfset h[1] = h[1] + a />
+ <cfset h[2] = h[2] + b />
+ <cfset h[3] = h[3] + c />
+ <cfset h[4] = h[4] + d />
+ <cfset h[5] = h[5] + e />
+
+ <cfloop index="i" from="1" to="5">
+ <cfloop condition="(h[i] lt -2^31) or (h[i] ge 2^31)">
+ <cfset h[i] = h[i] - Sgn(h[i])*2^32 />
+ </cfloop>
+ </cfloop>
+
+ </cfloop>
+
+ <cfloop index="i" from="1" to="5">
+ <cfset h[i] = RepeatString("0",8-Len(FormatBaseN(h[i],16))) & UCase(FormatBaseN(h[i],16)) />
+ </cfloop>
+
+ <cfreturn h[1] & h[2] & h[3] & h[4] & h[5] />
+
+</cffunction>
+
+</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/lib/OpenIDConsumer/OpenIDConsumer2.cfc b/src/main/webapp/lib/OpenIDConsumer/OpenIDConsumer2.cfc new file mode 100755 index 0000000..7a1b616 --- /dev/null +++ b/src/main/webapp/lib/OpenIDConsumer/OpenIDConsumer2.cfc @@ -0,0 +1,1033 @@ +<!--- OpenID Consumer Library Component
+
+Author:
+ Richard Davies
+ http://www.richarddavies.us
+ richard@richarddavies.us
+
+Usage:
+ Authenticating an OpenID identifier is easy and only requires usage of two public methods: authenticate() and
+ verifyAuthentication().
+
+ ==============
+ authenticate()
+ ==============
+
+ Arguments:
+ This method accepts a single structure containing the following elements:
+
+ Required elements:
+ identifier string The OpenID identifier (i.e. URL, i-name, etc) that you want to authenticate.
+ returnURL string The URL that the OpenID identity provider will return to after authenticating.
+
+ Optional elements
+ realm string URL realm that specifies the scope of the authentication request. Defaults to domain
+ of requesting page.
+ sregRequired string List of required simple registration fields.
+ sregOptional string List of optional simple registration fields.
+ (Valid values are fullname, nickname, email, dob, gender, postcode, country, language, and timezone.)
+ axRequired string List of required attribute exchange aliases.
+ axOptional string List of optional attribute exchange aliases.
+ ax.[alias] string Type identifier (URI) of attribute.
+ (Simple registration values are automatically converted to attribute exchange values.)
+
+ Returns:
+ boolean If successful, this function doesn't return anything because it redirects to the OpenID provider.
+ It returns false if an error occurs.
+
+ ======================
+ verifyAuthentication()
+ ======================
+
+ Arguments:
+ No required or optional arguments.
+
+ Returns:
+ struct Structure with the following elements:
+ result Result code (success, invalid, cancelled, unauthorized, error, replay, returnToError, or expired).
+ resultMsg Description of result code.
+ user_identity User-supplied OpenID indentifier. (This is the identity you should use in your application.)
+ identity Local indentifier provided by OpenID provider.
+ openid_server OpenID provider's endpoint URL
+ sreg Optional structure containing simple registration values (if returned)
+ ax Optional structure containing attribute exchange values (if returned)
+
+Thanks to:
+ Dmitry Yakhnov (dmitry@yakhnov.info) for the initial ColdFusion OpenID implementation that this is based on.
+ Patrick McElhaney (http://twitter.com/patrick_mc) for Client/Session storage functions.
+ ColdBox Framework for JSON functions.
+ Tim McCarthy (tim@timmcc.com) for the HMAC:SHA1 function.
+
+Specification:
+ http://openid.net/specs/openid-authentication-2_0.html (version 2.0)
+ http://openid.net/specs/openid-authentication-1_1.html (version 1.1)
+ http://openid.net/specs/openid-simple-registration-extension-1_0.html
+ http://openid.net/specs/openid-attribute-exchange-1_0.html
+
+ --->
+
+<cfcomponent name="OpenIDConsumer2" extends="OpenIDConsumer" output="false" hint="Consumer library for OpenID auth framework. Supports OpenID v1 and v2.">
+
+ <cfset SetEncoding("url", "utf-8") />
+
+ <!--- Proxy settings for <cfhttp> --->
+ <cfset Variables.proxyServer = "" />
+ <cfset Variables.proxyPort = 80 />
+ <cfset Variables.proxyUser = "" />
+ <cfset Variables.proxyPassword = "" />
+
+ <!--- Diffie-Hellman values are stored in Java BigInteger objects
+ http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigInteger.html
+ --->
+ <cfset Variables.BigInteger = CreateObject("java", "java.math.BigInteger") />
+
+ <cfset Variables.httpClient = CreateObject("component", "httpClient").init(Variables.proxyServer, Variables.proxyPort, Variables.proxyUser, Variables.proxyPassword) />
+
+ <cfset Variables.yadis = CreateObject("component", "yadis").init(Variables.proxyServer, Variables.proxyPort, Variables.proxyUser, Variables.proxyPassword) />
+
+ <!--- Namespaces --->
+ <cfset Variables.ns[1] = "http://openid.net/signon/1.1" />
+ <cfset Variables.ns[2] = "http://specs.openid.net/auth/2.0" />
+ <cfset Variables.ns_sreg[1] = "http://openid.net/extensions/sreg/1.1" />
+ <cfset Variables.ns_ax[1] = "http://openid.net/srv/ax/1.0" />
+
+
+ <cffunction name="init" access="public" returntype="OpenIDConsumer2" output="false" hint="Component constructor.">
+ <cfargument name="OpenIDSession" default="#createObject('component', 'SessionScopeOpenIDSession').init()#"/>
+ <cfargument name="proxyServer" type="string" required="false" default="-1" hint="Proxy server" />
+ <cfargument name="proxyPort" type="numeric" required="false" default="-1" hint="Proxy port" />
+ <cfargument name="proxyUser" type="string" required="false" default="-1" hint="Proxy user" />
+ <cfargument name="proxyPassword" type="string" required="false" default="-1" hint="Proxy password" />
+
+ <cfset variables.OpenIDSession = arguments.OpenIDSession/>
+
+ <!--- Allow optional per-instance overriding of default proxy settings --->
+ <cfset Variables.proxyServer = IIf(Arguments.proxyServer neq -1, "Arguments.proxyServer", "Variables.proxyServer") />
+ <cfset Variables.proxyPort = IIf(Arguments.proxyPort neq -1, "Arguments.proxyPort", "Variables.proxyPort") />
+ <cfset Variables.proxyUser = IIf(Arguments.proxyUser neq -1, "Arguments.proxyUser", "Variables.proxyUser") />
+ <cfset Variables.proxyPassword = IIf(Arguments.proxyPassword neq -1, "Arguments.proxyPassword", "Variables.proxyPassword") />
+
+ <cfset Variables.httpClient = CreateObject("component", "httpClient").init(Variables.proxyServer, Variables.proxyPort, Variables.proxyUser, Variables.proxyPassword) />
+ <cfset Variables.yadis = CreateObject("component", "yadis").init(Variables.proxyServer, Variables.proxyPort, Variables.proxyUser, Variables.proxyPassword) />
+
+ <cfreturn this/>
+
+ </cffunction>
+
+
+ <!--- Public API methods --->
+ <cffunction name="authenticate" returntype="boolean" access="public" output="false" hint="Redirects to OpenID provider for authentication.">
+ <cfargument name="args" type="struct" required="true" hint="Argument structure containing at least identifier and returnURL elements" />
+
+ <cfset var Local = StructNew() />
+
+ <!--- Verify arguments --->
+ <cfparam name="Arguments.args.identifier" type="string" /> <!--- OpenID identifier (i.e. URL, i-name, etc) --->
+ <cfparam name="Arguments.args.returnURL" type="string" /> <!--- URL to return to after authenticating --->
+ <cfparam name="Arguments.args.realm" type="string" default="#urlScheme()#://#CGI.HTTP_HOST#/" /> <!--- URL realm that specifies the scope of the authentication request --->
+ <cfparam name="Arguments.args.sregRequired" type="string" default="" /> <!--- List of required simple registration fields --->
+ <cfparam name="Arguments.args.sregOptional" type="string" default="" /> <!--- List of optional simple registration fields --->
+ <cfparam name="Arguments.args.axRequired" type="string" default="" /> <!--- List of required attribute exchange fields --->
+ <cfparam name="Arguments.args.axOptional" type="string" default="" /> <!--- List of optional attribute exchange fields --->
+ <cfloop list="#ListAppend(Arguments.args.axRequired, Arguments.args.axOptional)#" index="Local.field">
+ <cfparam name="Arguments.args.ax.#Local.field#" type="string" default="" /> <!--- Each attribute must be defined --->
+ </cfloop>
+ <cfif not Len(Arguments.args.identifier)>
+ <cfreturn false />
+ </cfif>
+
+ <!--- OpenID variables --->
+ <cfset Local.OpenID = StructNew() />
+
+ <!--- Requesting Authentication
+ http://openid.net/specs/openid-authentication-2_0.html#requesting_authentication
+ --->
+
+ <!--- Nonce for replay attack detection --->
+ <cfset Local.OpenID['nonce'] = CreateUUID() />
+
+ <!--- Mandatory OpenID request parameters --->
+ <cfset Local.OpenID['user_identity'] = normalizeIdentifier(Arguments.args.identifier) />
+ <cfset Local.OpenID['openid.identity'] = Local.OpenID['user_identity'] />
+ <cfset Local.OpenID['openid.return_to'] = appendUrlParam(Arguments.args.returnURL, "nonce=" & Local.OpenID['nonce']) />
+
+ <!--- Optional OpenID request parameters --->
+
+ <!--- Simple Registration --->
+ <cfset Local.OpenID['openid.ns.sreg'] = Variables.ns_sreg[1] />
+ <cfset Local.OpenID['openid.sreg.required'] = Arguments.args.sregRequired />
+ <cfset Local.OpenID['openid.sreg.optional'] = Arguments.args.sregOptional />
+
+ <!--- Attribute Exchange --->
+ <cfset Local.axRequired = "" />
+ <cfset Local.axOptional = "" />
+ <cfset Local.OpenID['openid.ns.ax'] = Variables.ns_ax[1] />
+ <cfset Local.OpenID['openid.ax.mode'] = "fetch_request" />
+ <cfset Local.axRequired = ListAppend(Local.axRequired, Arguments.args.axRequired) />
+ <cfset Local.axOptional = ListAppend(Local.axOptional, Arguments.args.axOptional) />
+ <cfloop list="#ListAppend(Arguments.args.axRequired, Arguments.args.axOptional)#" index="Local.alias">
+ <cfset Local.OpenID["openid.ax.type." & Local.alias] = Arguments.args.ax[Local.alias] />
+ </cfloop>
+
+ <!--- Convert simple registration values to equivalent attribute exchange values --->
+ <cfset Local.axRequired = ListAppend(Local.axRequired, Arguments.args.sregRequired) />
+ <cfset Local.axOptional = ListAppend(Local.axOptional, Arguments.args.sregOptional) />
+ <cfset StructAppend(Local.OpenID, sreg2ax(ListAppend(Arguments.args.sregRequired, Arguments.args.sregOptional))) />
+
+ <cfif ListLen(Local.axRequired)>
+ <cfset Local.OpenID['openid.ax.required'] = Local.axRequired />
+ </cfif>
+ <cfif ListLen(Local.axOptional)>
+ <cfset Local.OpenID['openid.ax.if_available'] = Local.axOptional />
+ </cfif>
+
+ <!--- Discover OpenID server --->
+ <cfset Local.results = discoverOpenIDServer(Local.OpenID['openid.identity']) />
+
+ <cfif Local.results['status']>
+
+ <!--- OpenID Provider (OP) server --->
+ <cfset Local.OpenID['openid_server'] = Local.results['server'] />
+
+ <!--- Local (delegate) Identifier --->
+ <cfset Local.OpenID['openid.identity'] = Local.results['identity'] />
+
+ <!--- In case delegation is set --->
+ <cfif StructKeyExists(Local.results, "delegate")>
+ <cfset Local.OpenID['openid.identity'] = Local.results['delegate'] />
+ </cfif>
+
+ <!--- OpenID v2 specific items --->
+ <cfif Local.results.version gt 1>
+ <!--- Namespace/protocol version --->
+ <cfset Local.OpenID['openid.ns'] = Variables.ns[Local.results.version] />
+
+ <!--- Claimed identifier --->
+ <cfif Local.results['identity'] is "http://specs.openid.net/auth/2.0/identifier_select">
+ <cfset Local.OpenID['openid.claimed_id'] = Local.results['identity'] />
+ <cfelse>
+ <cfset Local.OpenID['openid.claimed_id'] = Local.OpenID['user_identity'] />
+ </cfif>
+
+ <!--- Authentication realm --->
+ <cfset Local.OpenID['openid.realm'] = Arguments.args.realm />
+
+ <!--- OpenID v1 specific items --->
+ <cfelse>
+ <!--- Authentication realm --->
+ <cfset Local.OpenID['openid.trust_root'] = Arguments.args.realm />
+ </cfif>
+
+
+ <!--- Establish a shared secret between Consumer and Identity Provider --->
+ <cfset Local.results = getAssociate(Local.OpenID) />
+
+ <cfif Local.results['status']>
+ <cfset Local.OpenID['mode'] = "smart" />
+
+ <!--- Save all returned keys for further use --->
+ <cfloop item="Local.sKey" collection="#Local.results#">
+ <cfif Local.sKey neq "status">
+ <cfset Local.OpenID[Local.sKey] = Local.results[Local.sKey] />
+ </cfif>
+ </cfloop>
+ <cfelse>
+ <cfset Local.OpenID['mode'] = "dumb" />
+ <cfset Local.OpenID['assoc_handle'] = "" />
+ </cfif>
+
+ <!--- Uncomment next two lines if you want to test 'dumb' mode only --->
+ <!--- <cfset Local.OpenID['mode'] = "dumb" /> --->
+ <!--- <cfset Local.OpenID['assoc_handle'] = "" /> --->
+
+ <!--- Save working variables, could be only 'assoc_handle' and 'mac_key' --->
+ <cfset Variables.OpenIDSession.store(Local.OpenID) />
+
+ <!--- Redirect user-agent to OP server for request processing --->
+ <cfset doRedirect(Local.OpenID) />
+
+ <cfelse>
+ <cfreturn false /> <!--- Can't find OpenID server --->
+ </cfif>
+ </cffunction>
+
+
+ <cffunction name="verifyAuthentication" returntype="struct" access="public" output="false" hint="Processes authentication results returned from OpenID provider.">
+ <!--- Verifying Assertions
+ http://openid.net/specs/openid-authentication-2_0.html#verification
+ --->
+
+ <!--- Check if response sent via HTTP GET or POST --->
+ <cfset var messageScope = IIf(CGI.REQUEST_METHOD is "get", "URL", "Form") />
+
+ <cfset var Local = StructNew() />
+ <cfset Local.result = StructNew() />
+
+ <!--- If session still alive --->
+ <cfif Variables.OpenIDSession.exists()>
+
+ <!--- Restore working variables --->
+ <cfset Local.OpenID = Variables.OpenIDSession.load() />
+
+ <cfif not StructKeyExists(messageScope,"openid.mode")>
+
+ <cfset Local.result.result = "error" />
+ <cfset Local.result.resultMsg = "OpenID provider error: required paramter not passed in" />
+ <cfreturn Local.result />
+
+ <cfelseif not verifyReturnURL(Local.OpenID['openid.return_to'])>
+
+ <cfset Local.result.result = "returnToError" />
+ <cfset Local.result.resultMsg = "Current request URL does not match openid.return_to URL" />
+
+ <!--- Positive answer from OP --->
+ <cfelseif StructFind(messageScope, 'openid.mode') eq "id_res">
+
+ <!--- Check nonce to avoid copy+paste fraud aka replay attack --->
+ <cfif StructKeyExists(Local.OpenID, "nonce") and StructKeyExists(Url, "nonce") and Local.OpenID['nonce'] eq URLDecode(Url['nonce'])>
+
+ <!--- Verify discovered information if necessary
+ http://openid.net/specs/openid-authentication-2_0.html#verify_disco
+ --->
+ <cfif StructKeyExists(messageScope, "openid.claimed_id") and StructFind(messageScope, 'openid.claimed_id') is not Local.OpenID['openid.identity']>
+ <!--- Verify OP endpoint is authorized to make assertions for the claimed identifier --->
+ <cfset Local.discoResponse = discoverOpenIDServer(StructFind(messageScope, 'openid.claimed_id')) />
+
+ <cfif not StructKeyExists(Local.discoResponse, "status") or not StructKeyExists(Local.discoResponse, "server") or Local.discoResponse['server'] is not StructFind(messageScope, 'openid.op_endpoint')>
+ <cfset Local.result.result = "unauthorized" />
+ <cfset Local.result.resultMsg = "Unauthorized assertion made by OpenID provider" />
+ </cfif>
+ </cfif>
+
+ <!--- Set assoc_handle for 'dumb' mode --->
+ <cfif Local.OpenID['mode'] eq "dumb" or Local.OpenID['assoc_handle'] eq "">
+ <cfset Local.OpenID['assoc_handle'] = StructFind(messageScope, 'openid.assoc_handle') />
+ </cfif>
+
+ <!--- Verify return variables signature (smart) or transaction using handle (dumb) --->
+ <cfif (Local.OpenID['mode'] eq "smart" and isValidSignature(Local.OpenID, messageScope)) or isValidHandle(Local.OpenID, messageScope)>
+ <cfset Local.axResult = StructFindValue(messageScope, Variables.ns_ax[1]) />
+ <cfif ArrayLen(Local.axResult)>
+ <cfset Local.axNSalias = ListLast(Local.axResult[1].key, ".") />
+ </cfif>
+
+ <!--- Copy simple registration field values into result structure --->
+ <cfloop index="Local.sKey" list="#ListAppend(Local.OpenID['openid.sreg.required'], Local.OpenID['openid.sreg.optional'])#">
+ <cfif StructKeyExists(messageScope, "openID.sreg." & Local.sKey)>
+ <cfset Local.result.sreg[Local.skey] = StructFind(messageScope, "openid.sreg." & Local.skey) />
+ </cfif>
+
+ <!--- Also include attribute exchange values that have simple registration equivalents --->
+ <cfif ArrayLen(Local.axResult) and StructKeyExists(messageScope, "openID.#Local.axNSalias#.value." & Local.sKey)>
+ <cfset Local.result.sreg[Local.skey] = StructFind(messageScope, "openID.#Local.axNSalias#.value." & Local.skey) />
+ </cfif>
+ </cfloop>
+
+ <!--- Copy attribute exchange values into result structure --->
+ <cfparam name="Local.OpenID['openID.ax.required']" default="" />
+ <cfparam name="Local.OpenID['openID.ax.if_available']" default="" />
+ <cfif ArrayLen(Local.axResult)>
+ <cfloop index="Local.sKey" list="#ListAppend(Local.OpenID['openID.ax.required'], Local.OpenID['openID.ax.if_available'])#">
+ <cfif StructKeyExists(messageScope, "openID.#Local.axNSalias#.value." & Local.sKey)>
+ <cfset Local.result.ax[Local.skey] = StructFind(messageScope, "openID.#Local.axNSalias#.value." & Local.skey) />
+ </cfif>
+ </cfloop>
+ </cfif>
+
+ <cfset Local.result.result = "success" />
+ <cfset Local.result.resultMsg = "Identity has been successfully authenticated" />
+ <cfelse>
+ <cfset Local.result.result = "invalid" />
+ <cfset Local.result.resultMsg = "Invalid authentication" />
+ </cfif>
+
+ <cfelse>
+
+ <cfset Local.result.result = "replay" />
+ <cfset Local.result.resultMsg = "Replay attack has been detected" />
+
+ </cfif>
+
+ <!--- Negative answers from OP --->
+ <cfelseif StructFind(messageScope, 'openid.mode') eq "cancel">
+ <cfset Local.result.result = "cancelled" />
+ <cfset Local.result.resultMsg = "Request was cancelled by the user or OpenID provider" />
+ <cfelseif StructFind(messageScope, 'openid.mode') eq "error">
+ <cfset Local.result.result = "error" />
+ <cfset Local.result.resultMsg = "OpenID provider error: #StructFind(messageScope, 'openid.error')#" />
+ </cfif>
+
+ <cfelse>
+ <cfset Local.result.result = "expired" />
+ <cfset Local.result.resultMsg = "The session has expired" />
+ <cfreturn Local.result />
+ </cfif>
+
+ <!--- Populate result structure with some useful OpenID values --->
+ <cfset Local.result.identity = Local.OpenID["openID.identity"] />
+ <cfset Local.result.user_identity = Local.OpenID["user_identity"] />
+ <cfset Local.result.openid_server = Local.OpenID["openID_server"] />
+
+ <!--- OP may assist end user in selecting the claimed and local identifiers, so use those when present --->
+ <cfif StructKeyExists(messageScope, "openid.claimed_id")>
+ <cfset Local.result.user_identity = StructFind(messageScope, "openID.claimed_id") />
+ <cfset Local.result.identity = StructFind(messageScope, "openID.identity") />
+ </cfif>
+
+ <cfreturn Local.result />
+ </cffunction>
+
+
+ <cffunction name="normalizeIdentifier" returntype="string" access="public" output="false" hint="Identifier normalization.">
+ <cfargument name="identifier" type="string" required="true" />
+
+ <!--- Normalize OpenID identifier
+ http://openid.net/specs/openid-authentication-2_0.html#normalization
+ --->
+
+ <cfset var Local = StructNew() />
+ <cfset Local.identifier = Arguments.identifier />
+
+ <!--- XRIs --->
+ <cfif Left(Local.identifier, 6) eq "xri://">
+ <!--- Remove "xri://" prefix --->
+ <cfset Local.identifier = RemoveChars(Local.identifier, 1, 6) />
+ </cfif>
+
+ <!--- Normal URLs --->
+ <cfif not ListFind("=,@,+,$,!,(", Left(Local.identifier, 1))>
+ <!--- Add protocol to the URL --->
+ <cfif Left(Local.identifier, 4) neq "http">
+ <cfset Local.identifier = "http://" & Local.identifier />
+ </cfif>
+
+ <!--- Remove fragment identifier --->
+ <cfset Local.identifier = ListFirst(Local.identifier, "##") />
+
+ <!--- Lower case domain name (necessary for Blogger OpenIDs) --->
+ <cfif ListLen(Local.identifier, "/") gte 2>
+ <cfset Local.identifier = ReReplace(Local.identifier, "//.*?(/|$)", "//" & LCase(ListGetAt(Local.identifier, 2, "/")) & "/") />
+ </cfif>
+ </cfif>
+
+ <cfreturn Local.identifier />
+ </cffunction>
+
+
+ <!--- Private helper methods --->
+ <cffunction name="doRedirect" returntype="void" access="private" output="false" hint="Redirect user browser to OP.">
+ <cfargument name="Request" type="struct" required="true" />
+
+ <!--- Method changelist
+
+ Use appendUrlParam to append correct parameter delimiter to URL. -RD
+ --->
+
+ <cfset var Header = StructNew() />
+ <cfset var redirectURL = "" />
+ <cfset var sKey = "" />
+
+ <cfset Header['openid.mode'] = "checkid_setup" />
+ <cfif Len(arguments.Request['assoc_handle']) gt 0>
+ <cfset Header['openid.assoc_handle'] = arguments.Request['assoc_handle'] />
+ </cfif>
+
+ <cfloop item="sKey" collection="#arguments.Request#">
+ <cfif Find("openid.",sKey)>
+ <cfset Header[Lcase(sKey)] = arguments.Request[sKey] />
+ </cfif>
+ </cfloop>
+
+ <cfset redirectURL = appendUrlParam(arguments.Request['openid_server'], struct2string(Header)) />
+
+ <cflocation url="#redirectURL#" addtoken="false" />
+ </cffunction>
+
+
+ <cffunction name="appendUrlParam" returntype="string" access="private" output="false" hint="Appends a parameter to a URL using the appropriate delimiter.">
+ <cfargument name="baseURL" type="string" required="true" hint="Base URL to append parameter to." />
+ <cfargument name="param" type="string" required="true" hint="URL parameter to append to URL." />
+
+ <cfset var Local = StructNew() />
+
+ <!--- Determine if URL already contains a query string and therefore if we need to use a & or ? delimiter --->
+ <cfset Local.hasQueryString = Find("?", Arguments.baseURL) />
+
+ <cfif Local.hasQueryString>
+ <cfset Local.delimiter = "&" />
+ <cfelse>
+ <cfset Local.delimiter = "?" />
+ </cfif>
+
+ <cfset Local.url = Arguments.baseURL & Local.delimiter & Arguments.param />
+
+ <cfreturn Local.url />
+ </cffunction>
+
+
+ <cffunction name="getAssociate" returntype="struct" access="private" output="false" hint="Establish a 'DH-SHA1' association and shared secret between Consumer and OP.">
+ <cfargument name="Request" type="struct" required="true" />
+
+ <cfset var Local = StructNew() />
+
+ <!--- Establish a Diffie-Hellman shared secret between consumer and provider
+ http://openid.net/specs/openid-authentication-2_0.html#associations
+ --->
+
+ <!--- Default OpenID prime number (i.e. mod) --->
+ <cfset Local.primeHex = "DCF93A0B883972EC0E19989AC5A2CE310E1D37717E8D9571BB7623731866E61EF75A2E27898B057F9891C2E27A639C3F29B60814581CD3B2CA3986D2683705577D45C2E7E52DC81C7A171876E5CEA74B1448BFDFAF18828EFD2519F14E45E3826634AF1949E5B535CC829A483B8A76223E5D490A257F05BDFF16F2FB22C583AB" />
+ <cfset Local.p = Variables.BigInteger.init(Local.primeHex, 16) />
+
+ <!--- Default OpenID generator (i.e. g) --->
+ <cfset Local.g = Variables.BigInteger.valueOf(2) />
+
+ <!--- Random number generator --->
+ <cfset Local.prnd = CreateObject("java", "java.security.SecureRandom") />
+ <cfset Local.prnd.getProvider() /> <!--- This seems to initialize (i.e. seed?) prnd --->
+
+ <!--- Random private secret number in range [1 .. p-1] --->
+ <cfset Local.xa = Variables.BigInteger.init(JavaCast("int", Local.p.bitLength()-1), Local.prnd) />
+
+ <!--- Public Diffie-Hellman key to pass to OP server --->
+ <cfset Local.key = Local.g.modPow(Local.xa, Local.p) /> <!--- key = g ^ xa mod p --->
+ <cfset Local.cpub = BinaryEncode(Local.key.toByteArray(), "base64") />
+
+ <!--- Request association from OP server --->
+ <!--- Use encoded="false" attribute to prevent '.' in the parameter names from being
+ URL encoded because some OP's (eg. 1id.com) don't like that.
+ --->
+
+ <cfset Local.data = ArrayNew(1) />
+
+ <cfif StructKeyExists(Arguments.Request, "openid.ns")>
+ <cfset Local.httpParameter = StructNew() />
+ <cfset Local.httpParameter["Type"] = "formfield" />
+ <cfset Local.httpParameter["Name"] = "openid.ns" />
+ <cfset Local.httpParameter["Value"] = UrlEncodedFormat(Arguments.Request['openid.ns']) />
+ <cfset Local.httpParameter["Encoded"] = false />
+ <cfset ArrayAppend(Local.data,Local.httpParameter) />
+ </cfif>
+
+ <cfset Local.httpParameter = StructNew() />
+ <cfset Local.httpParameter["Type"] = "formfield" />
+ <cfset Local.httpParameter["Name"] = "openid.mode" />
+ <cfset Local.httpParameter["Value"] = "associate" />
+ <cfset Local.httpParameter["Encoded"] = false />
+ <cfset ArrayAppend(Local.data,Local.httpParameter) />
+
+ <cfset Local.httpParameter = StructNew() />
+ <cfset Local.httpParameter["Type"] = "formfield" />
+ <cfset Local.httpParameter["Name"] = "openid.assoc_type" />
+ <cfset Local.httpParameter["Value"] = "HMAC-SHA1" />
+ <cfset Local.httpParameter["Encoded"] = false />
+ <cfset ArrayAppend(Local.data,Local.httpParameter) />
+
+ <cfset Local.httpParameter = StructNew() />
+ <cfset Local.httpParameter["Type"] = "formfield" />
+ <cfset Local.httpParameter["Name"] = "openid.session_type" />
+ <cfset Local.httpParameter["Value"] = "DH-SHA1" />
+ <cfset Local.httpParameter["Encoded"] = false />
+ <cfset ArrayAppend(Local.data,Local.httpParameter) />
+
+ <cfset Local.httpParameter = StructNew() />
+ <cfset Local.httpParameter["Type"] = "formfield" />
+ <cfset Local.httpParameter["Name"] = "openid.dh_consumer_public" />
+ <cfset Local.httpParameter["Value"] = UrlEncodedFormat(Local.cpub) />
+ <cfset Local.httpParameter["Encoded"] = false />
+ <cfset ArrayAppend(Local.data,Local.httpParameter) />
+
+ <cfset Local.cfhttp = Variables.httpClient.call("post",Arguments.Request['openid_server'],Local.data) />
+
+ <!--- Create a response structure to store association and response values --->
+ <cfset Local.Response = StructNew() />
+ <cfset Local.Response['status'] = false />
+
+ <!--- Store our Diffie-Hellman values --->
+ <cfset Local.Response['p'] = Local.p />
+ <cfset Local.Response['g'] = Local.g />
+ <cfset Local.Response['xa'] = Local.xa />
+
+ <!--- Check if successfully established an association --->
+ <cfif Val(Local.cfhttp.StatusCode) eq 200 and Local.cfhttp.FileContent contains "assoc_type:" and Local.cfhttp.FileContent does not contain "error_code:">
+ <!--- Copy key:value parameters from server response into response structure --->
+ <cfloop index="Local.param" list="#Local.cfhttp.FileContent#" delimiters="#Chr(10)#">
+ <cfset Local.Response[ListFirst(Local.param, ":")] = ListRest(Local.param, ":") />
+ </cfloop>
+ <cfset Local.Response['status'] = true />
+ </cfif>
+
+ <cfreturn Local.Response />
+ </cffunction>
+
+
+ <cffunction name="verifyReturnURL" returntype="boolean" access="private" output="false" hint="Verifies the value of 'openid.return_to' matches the URL of the current request.">
+ <cfargument name="returnURL" type="string" required="true" hint="The openid.return_to URL" />
+
+ <!--- Verify the Return URL
+ http://openid.net/specs/openid-authentication-2_0.html#verify_return_to
+ --->
+
+ <cfset var Local = StructNew() />
+
+ <cfif CGI.PATH_INFO eq CGI.SCRIPT_NAME>
+ <cfset Local.path_info = "" />
+ <cfelse>
+ <cfset Local.path_info = CGI.PATH_INFO />
+ </cfif>
+
+ <!--- Base URL = URL excluding any query parameters --->
+ <cfif ListFind("80,443", CGI.SERVER_PORT)>
+ <cfset Local.serverPort = "" />
+ <cfelse>
+ <cfset Local.serverPort = ":#CGI.SERVER_PORT#" />
+ </cfif>
+ <cfset Local.baseURL = "#urlScheme()#://#CGI.SERVER_NAME##Local.serverPort##CGI.SCRIPT_NAME##Local.path_info#"/>
+
+ <!--- Verify the current request base URL equals the return to base URL --->
+ <cfif Local.baseURL neq ListFirst(Arguments.returnURL, "?")>
+ <cfreturn false />
+ </cfif>
+
+ <!--- Verify that any query parameters in the return to URL are also in the current URL (with identical values) --->
+ <cfif ListLen(Arguments.returnURL, "?") gt 1>
+ <cfset Local.returnQS = ListLast(Arguments.returnURL, "?") />
+ <cfloop index="Local.param" list="#Local.returnQS#" delimiters="&">
+ <cfset Local.paramName = ListFirst(Local.param, "=") />
+ <cfif ListLen(Local.param, "=") gt 1>
+ <cfset Local.paramVal = ListRest(Local.param, "=") />
+ <cfelse>
+ <cfset Local.paramVal = "" />
+ </cfif>
+
+ <cfif StructKeyExists(Url, Local.paramName)>
+ <cfif Url[Local.paramName] neq Local.paramVal>
+ <cfreturn false />
+ </cfif>
+ <cfelse>
+ <cfreturn false />
+ </cfif>
+ </cfloop>
+ </cfif>
+
+ <cfreturn true />
+ </cffunction>
+
+
+ <cffunction name="isValidSignature" returntype="boolean" access="private" output="false" hint="Validation of OP signature.">
+ <cfargument name="Request" type="struct" required="true" />
+ <cfargument name="messageScope" type="struct" required="true" />
+
+ <!--- Verifying Signatures
+ http://openid.net/specs/openid-authentication-2_0.html#verifying_signatures
+ --->
+
+ <cfset var Local = StructNew() />
+
+ <!--- Get shared association secret --->
+ <cfif StructKeyExists(Arguments.Request, "enc_mac_key")>
+ <!--- Encrypted (Diffie-Hellman) association
+ http://openid.net/specs/openid-authentication-2_0.html#rfc.section.8.4.2
+ --->
+ <cfset Local.enc_mac_key = BinaryDecode(Arguments.Request.enc_mac_key, "base64") />
+ <cfset Local.dh_server_public = BinaryDecode(Arguments.Request.dh_server_public, "base64") />
+ <cfset Local.spub = Variables.BigInteger.init(Local.dh_server_public) />
+ <cfset Local.mac_key = extractSecret(Local.enc_mac_key, Local.spub, Arguments.Request.xa, Arguments.Request.p) />
+ <cfelseif StructKeyExists(Arguments.Request,"mac_key")>
+ <!--- Unencrypted association --->
+ <cfset Local.mac_key = BinaryDecode(Arguments.Request.mac_key, "base64") />
+ <cfelse>
+ <cfreturn false />
+ </cfif>
+
+ <!--- Convert binary secret into a string --->
+ <cfset Local.Secret = CharsetEncode(Local.mac_key, "iso-8859-1") />
+
+ <!--- Convert list of signed parameters into key-value encoded list
+ http://openid.net/specs/openid-authentication-2_0.html#kvform
+ --->
+ <cfset Local.tokenContents = "" />
+ <cfloop index="Local.sKey" list="#StructFind(messageScope, 'openid.signed')#">
+ <cfset Local.tokenContents = Local.tokenContents & "#LCase(Local.sKey)#:#StructFind(messageScope, 'openid.' & Local.sKey)##chr(10)#" />
+ </cfloop>
+
+ <!--- Calculate message signature
+ http://openid.net/specs/openid-authentication-2_0.html#generating_signatures
+ --->
+ <cfset Local.Signature = BinaryDecode(HMAC_SHA1(Local.tokenContents, Local.Secret, 160), "hex") />
+ <cfset Local.Signature_base64 = BinaryEncode(Local.Signature, "base64") />
+
+ <!--- Verify calculated signature with signature returned by OP --->
+ <cfif Local.Signature_base64 eq StructFind(messageScope, 'openid.sig')>
+ <cfreturn true />
+ <cfelse>
+ <cfreturn false />
+ </cfif>
+ </cffunction>
+
+
+ <cffunction name="isValidHandle" returntype="boolean" access="private" output="false" hint="Ask OP if a message is valid">
+ <cfargument name="Request" type="struct" required="true" />
+ <cfargument name="messageScope" type="struct" required="true" />
+
+ <!--- Verifying Directly with the OpenID Provider
+ http://openid.net/specs/openid-authentication-2_0.html#rfc.section.11.4.2
+ --->
+
+ <cfset var Local = StructNew() />
+
+ <!--- Use encoded="false" attribute to prevent '.' in the parameter names from being
+ URL encoded because some OP's (eg. 1id.com) don't like that.
+ --->
+
+ <cfset Local.data = ArrayNew(1) />
+
+ <cfif StructKeyExists(Arguments.Request, "openid.ns")>
+ <cfset Local.httpParameter = StructNew() />
+ <cfset Local.httpParameter["Type"] = "formfield" />
+ <cfset Local.httpParameter["Name"] = "openid.ns" />
+ <cfset Local.httpParameter["Value"] = UrlEncodedFormat(Arguments.Request['openid.ns']) />
+ <cfset Local.httpParameter["Encoded"] = false />
+ <cfset ArrayAppend(Local.data,Local.httpParameter) />
+ </cfif>
+
+ <cfset Local.httpParameter = StructNew() />
+ <cfset Local.httpParameter["Type"] = "formfield" />
+ <cfset Local.httpParameter["Name"] = "openid.mode" />
+ <cfset Local.httpParameter["Value"] = "check_authentication" />
+ <cfset Local.httpParameter["Encoded"] = false />
+ <cfset ArrayAppend(Local.data,Local.httpParameter) />
+
+ <cfset Local.httpParameter = StructNew() />
+ <cfset Local.httpParameter["Type"] = "formfield" />
+ <cfset Local.httpParameter["Name"] = "openid.assoc_handle" />
+ <cfset Local.httpParameter["Value"] = UrlEncodedFormat(Arguments.Request['assoc_handle']) />
+ <cfset Local.httpParameter["Encoded"] = false />
+ <cfset ArrayAppend(Local.data,Local.httpParameter) />
+
+ <cfset Local.httpParameter = StructNew() />
+ <cfset Local.httpParameter["Type"] = "formfield" />
+ <cfset Local.httpParameter["Name"] = "openid.sig" />
+ <cfset Local.httpParameter["Value"] = UrlEncodedFormat(StructFind(messageScope, 'openid.sig')) />
+ <cfset Local.httpParameter["Encoded"] = false />
+ <cfset ArrayAppend(Local.data,Local.httpParameter) />
+
+ <cfset Local.httpParameter = StructNew() />
+ <cfset Local.httpParameter["Type"] = "formfield" />
+ <cfset Local.httpParameter["Name"] = "openid.signed" />
+ <cfset Local.httpParameter["Value"] = UrlEncodedFormat(StructFind(messageScope, 'openid.signed')) />
+ <cfset Local.httpParameter["Encoded"] = false />
+ <cfset ArrayAppend(Local.data,Local.httpParameter) />
+
+ <cfloop index="Local.sKey" list="#StructFind(messageScope, 'openid.signed')#">
+ <cfif not ListFindNoCase("mode,assoc_handle,sig,signed", Local.sKey)>
+ <cfset Local.httpParameter = StructNew() />
+ <cfset Local.httpParameter["Type"] = "formfield" />
+ <cfset Local.httpParameter["Name"] = "openid.#LCase(Local.sKey)#" />
+ <cfset Local.httpParameter["Value"] = UrlEncodedFormat(StructFind(messageScope, 'openid.' & Local.sKey)) />
+ <cfset Local.httpParameter["Encoded"] = false />
+ <cfset ArrayAppend(Local.data,Local.httpParameter) />
+ </cfif>
+ </cfloop>
+
+ <cfset Local.cfhttp = Variables.httpClient.call("post",Arguments.Request['openid_server'],Local.data) />
+
+ <cfif Find("200", Local.cfhttp.StatusCode) and FindNoCase("is_valid:true", Local.cfhttp.FileContent)>
+ <cfreturn true />
+ <cfelse>
+ <cfreturn false />
+ </cfif>
+ </cffunction>
+
+
+ <cffunction name="extractSecret" returntype="binary" access="private" output="false" hint="Extracts MAC key which was encrypted with secret Diffie-Hellman key.">
+ <cfargument name="enc_mac_key" type="binary" required="true" />
+ <cfargument name="spub" type="string" required="true" hint="Java object of class java.math.BigInteger" />
+ <cfargument name="xa" type="string" required="true" hint="Java object of class java.math.BigInteger" />
+ <cfargument name="p" type="string" required="true" hint="Java object of class java.math.BigInteger" />
+
+ <cfset var Local = StructNew() />
+
+ <!--- To decrypt the MAC key, we need to XOR the hashed DH secret with the encrypted MAC key
+ http://openid.net/specs/openid-authentication-2_0.html#rfc.section.8.2.3
+ --->
+
+ <!--- Get shared Diffie-Hellmen secret --->
+ <cfset Local.dh_shared = getSharedSecret(Arguments.spub, Arguments.xa, Arguments.p) />
+ <!--- Convert secret to binary -- toByteArray() = btwoc() --->
+ <cfset Local.dh_shared_bin = Local.dh_shared.toByteArray() />
+ <!--- Hash secret and convert back to binary value --->
+ <cfset Local.dh_shared_hash = Hash(CharsetEncode(Local.dh_shared_bin, "iso-8859-1"), "sha", "iso-8859-1") />
+ <cfset Local.dh_shared_hash_bin = BinaryDecode(Local.dh_shared_hash, "hex") />
+
+ <!--- Convert hashed secret and encrypted MAC key to BigIntegers because it's easy to XOR BigIntegers --->
+ <cfset Local.dh_shared_bigint = Variables.BigInteger.init(Local.dh_shared_hash_bin) />
+ <cfset Local.enc_mac_key_bigint = Variables.BigInteger.init(Arguments.enc_mac_key) />
+
+ <!--- XOR values and convert back into binary --->
+ <cfset Local.xsecret = Local.dh_shared_bigint.xor(Local.enc_mac_key_bigint) />
+ <cfset Local.xsecret = Local.xsecret.toByteArray() />
+
+ <cfreturn Local.xsecret />
+ </cffunction>
+
+
+ <cffunction name="getSharedSecret" returntype="string" access="private" output="false" hint="Calculates Diffie-Hellman shared secret from OP's response. Returns a BigInteger.">
+ <cfargument name="spub" type="string" required="true" hint="Java object of class java.math.BigInteger" />
+ <cfargument name="xa" type="string" required="true" hint="Java object of class java.math.BigInteger" />
+ <cfargument name="p" type="string" required="true" hint="Java object of class java.math.BigInteger" />
+
+ <cfset var Local = StructNew() />
+
+ <!--- http://openid.net/specs/openid-authentication-2_0.html#rfc.section.8.4.2 --->
+ <cfset Local.secret = Arguments.spub.modPow(Arguments.xa, Arguments.p) />
+
+ <cfreturn Local.secret />
+ </cffunction>
+
+
+ <cffunction name="HMAC_SHA1" returntype="string" access="private" output="false" hint="Calculates hash message authentication code using SHA1 algorithm.">
+ <cfargument name="Data" type="string" required="true" />
+ <cfargument name="Key" type="string" required="true" />
+ <cfargument name="Bits" type="numeric" required="true" />
+
+ <!--- Method changelist
+
+ I modified this method to use ColdFusion's built-in SHA algorithm instead of Tim
+ McCarthy's 'SHA1 method. Although I don't think I've encounted any issues with
+ Tim's method, I figured it best to use the built-in function. -RD
+ --->
+
+ <cfset var i = 0 />
+ <cfset var HexData = "" />
+ <cfset var HexKey = "" />
+ <cfset var KeyLen = 0 />
+ <cfset var KeyI = "" />
+ <cfset var KeyO = "" />
+
+ <cfset HexData = BinaryEncode(CharsetDecode(Arguments.data, "iso-8859-1"), "hex") />
+ <cfset HexKey = BinaryEncode(CharsetDecode(Arguments.key, "iso-8859-1"), "hex") />
+
+ <cfset KeyLen = Len(HexKey)/2 />
+
+ <cfif KeyLen gt 64>
+ <cfset HexKey = Hash(CharsetEncode(BinaryDecode(HexKey, "hex"), "iso-8859-1"), "sha", "iso-8859-1") />
+ <cfset KeyLen = Len(HexKey)/2 />
+ </cfif>
+
+ <cfloop index="i" from="1" to="#KeyLen#">
+ <cfset KeyI = KeyI & Right("0"&FormatBaseN(BitXor(InputBaseN(Mid(HexKey,2*i-1,2),16),InputBaseN("36",16)),16),2) />
+ <cfset KeyO = KeyO & Right("0"&FormatBaseN(BitXor(InputBaseN(Mid(HexKey,2*i-1,2),16),InputBaseN("5c",16)),16),2) />
+ </cfloop>
+ <cfset KeyI = KeyI & RepeatString("36",64-KeyLen) />
+ <cfset KeyO = KeyO & RepeatString("5c",64-KeyLen) />
+
+ <cfset HexKey = Hash(CharsetEncode(BinaryDecode(KeyI&HexData, "hex"), "iso-8859-1"), "sha", "iso-8859-1") />
+ <cfset HexKey = Hash(CharsetEncode(BinaryDecode(KeyO&HexKey, "hex"), "iso-8859-1"), "sha", "iso-8859-1") />
+
+ <cfreturn Left(HexKey,arguments.Bits/4) />
+ </cffunction>
+
+
+ <cffunction name="urlScheme" returntype="string" access="private" output="false" hint="Returns 'http' or 'https' depending on current request">
+ <cfset var Local = StructNew() />
+
+ <cfif CGI.HTTPS is "on">
+ <cfset Local.scheme = "https" />
+ <cfelse>
+ <cfset Local.scheme = "http" />
+ </cfif>
+
+ <cfreturn Local.scheme />
+
+ </cffunction>
+
+
+ <cffunction name="sreg2ax" returntype="struct" access="private" output="false" hint="Converts simple registration values to their equivalent attribute exchange values.">
+ <cfargument name="sreg" type="string" required="true" hint="Simple registration value (or list of values)." />
+
+ <cfset var Local = StructNew() />
+ <cfset Local.sreg2ax["nickname"] = "http://axschema.org/namePerson/friendly" />
+ <cfset Local.sreg2ax["email"] = "http://axschema.org/contact/email" />
+ <cfset Local.sreg2ax["fullname"] = "http://axschema.org/namePerson" />
+ <cfset Local.sreg2ax["dob"] = "http://axschema.org/birthDate" />
+ <cfset Local.sreg2ax["gender"] = "http://axschema.org/person/gender" />
+ <cfset Local.sreg2ax["postcode"] = "http://axschema.org/contact/postalCode/home" />
+ <cfset Local.sreg2ax["country"] = "http://axschema.org/contact/country/home" />
+ <cfset Local.sreg2ax["language"] = "http://axschema.org/pref/language" />
+ <cfset Local.sreg2ax["timezone"] = "http://axschema.org/pref/timezone" />
+
+ <cfset Local.ax = StructNew() />
+ <cfloop list="#Arguments.sreg#" index="Local.sregValue">
+ <cfset Local.ax["openid.ax.type." & Local.sregValue] = Local.sreg2ax[Local.sregValue] />
+ </cfloop>
+
+ <cfreturn Local.ax />
+ </cffunction>
+
+
+ <!--- Yadis/HTML discovery methods --->
+ <cffunction name="discoverOpenIDServer" returntype="struct" access="private" output="false" hint="Perform discovery of OP server URL.">
+ <cfargument name="identifier" type="string" required="true" hint="OpenID identifier to perform discovery on" />
+
+ <!--- Discovery
+ http://openid.net/specs/openid-authentication-2_0.html#discovery
+ --->
+
+ <cfset var Local = StructNew() />
+
+ <!--- XRI idendifiers --->
+ <cfif not Left(Arguments.identifier, 4) is "http">
+ <!--- Use XRI.net proxy resolver URL as identity --->
+ <cfset Arguments.identifier = "http://xri.net/#Arguments.identifier#?_xrd_r=application/xrds+xml" />
+ </cfif>
+
+ <!--- First attempt Yadis discovery --->
+ <cfset Local.response = yadisDiscovery(Arguments.identifier) />
+
+ <!--- Fallback to HTML-based discovery if Yadis discovery failed --->
+ <cfif not Local.response.status>
+ <cfset Local.response = htmlServerDiscovery(Arguments.identifier) />
+ </cfif>
+
+ <cfreturn Local.response />
+ </cffunction>
+
+
+ <cffunction name="yadisDiscovery" returntype="struct" access="private" output="false" hint="Use Yadis protocol for discovery of OpenID servers.">
+ <cfargument name="identifier" type="string" required="true" hint="OpenID identifier to perform discovery on" />
+
+ <!--- Yadis discovery
+ http://openid.net/specs/openid-authentication-2_0.html#rfc.section.7.3.1
+ --->
+
+ <cfset var Local = StructNew() />
+ <cfset Local.response = StructNew() />
+ <cfset Local.response['status'] = false />
+ <cfset Local.servers['server'] = "" />
+ <cfset Local.servers['delegate'] = "" />
+
+ <cfset Local.xrds = Variables.yadis.discover(Arguments.identifier) />
+
+ <!--- Extract service info from XRDS document --->
+ <cfif Local.xrds is not "">
+ <!--- Search xrds for OP identifier element (OpenID v2) --->
+ <cfset Local.service = Variables.yadis.services(Local.xrds, "opIdentifierFilter") />
+ <cfif not ArrayIsEmpty(Local.service)>
+ <cfset Local.response['server'] = Local.service[1].URI.XmlText />
+ <cfset Local.response['identity'] = "http://specs.openid.net/auth/2.0/identifier_select" />
+ <cfset Local.response['delegate'] = "http://specs.openid.net/auth/2.0/identifier_select" />
+ <cfset Local.response['version'] = 2 />
+ <cfset Local.response['status'] = true />
+ </cfif>
+
+ <cfif not Local.response.status>
+ <!--- Search xrds for claimed identifier element (OpenID v2) --->
+ <cfset Local.service = Variables.yadis.services(Local.xrds, "claimedIdentifierFilter") />
+
+ <cfif not ArrayIsEmpty(Local.service)>
+ <cfset Local.response['server'] = Local.service[1].URI.XmlText />
+ <cfset Local.response['identity'] = Arguments.identifier />
+ <cfif StructKeyExists(Local.service[1], "LocalID")>
+ <cfset Local.response['delegate'] = Local.service[1].LocalID.XmlText />
+ </cfif>
+ <cfset Local.response['version'] = 2 />
+ <cfset Local.response['status'] = true />
+ </cfif>
+ </cfif>
+
+ <cfif not Local.response.status>
+ <!--- Search xrds for OpenID v1.x info --->
+ <cfset Local.service = Variables.yadis.services(Local.xrds, "openID1Filter") />
+
+ <cfif not ArrayIsEmpty(Local.service)>
+ <cfset Local.response['server'] = Local.service[1].URI.XmlText />
+ <cfset Local.response['identity'] = Arguments.identifier />
+ <cfif StructKeyExists(Local.service[1], "openid:Delegate")>
+ <cfset Local.response['delegate'] = Local.service[1]['openid:Delegate'].XmlText />
+ </cfif>
+ <cfset Local.response['version'] = 1 />
+ <cfset Local.response['status'] = true />
+ </cfif>
+ </cfif>
+
+ <cfif Left(Arguments.identifier, 15) is "http://xri.net/">
+ <cfset Local.response['identity'] = Local.xrds.xrds.xrd.CanonicalID.XmlText />
+ </cfif>
+ </cfif>
+
+ <cfreturn Local.response />
+ </cffunction>
+
+
+ <cffunction name="htmlServerDiscovery" returntype="struct" access="private" output="false" hint="HTML-based discovery of OpenID servers.">
+ <cfargument name="identifier" type="string" required="true" hint="OpenID identifier to perform discovery on" />
+
+ <!--- HTML-based discovery
+ http://openid.net/specs/openid-authentication-2_0.html#rfc.section.7.3.3
+ --->
+
+ <cfset var Local = StructNew() />
+ <cfset Local.response = StructNew() />
+ <cfset Local.response['status'] = false />
+ <cfset Local.servers['server'] = "" />
+ <cfset Local.servers['delegate'] = "" />
+
+ <cfset Local.cfhttp = Variables.httpClient.call("get",Arguments.identifier) />
+
+ <cfif Find("200", Local.cfhttp.StatusCode)>
+ <!--- First check for v2 link elements --->
+ <cfset Local.servers['server'] = findLinkIdentifier(Local.cfhttp.FileContent, "openid2.provider") />
+ <cfset Local.servers['delegate'] = findLinkIdentifier(Local.cfhttp.FileContent, "openid2.local_id") />
+ <cfset Local.response['version'] = 2 />
+
+ <!--- Fallback to v1 link elements if necessary --->
+ <cfif Local.servers['server'] is "">
+ <cfset Local.servers['server'] = findLinkIdentifier(Local.cfhttp.FileContent, "openid.server") />
+ <cfset Local.servers['delegate'] = findLinkIdentifier(Local.cfhttp.FileContent, "openid.delegate") />
+ <cfset Local.response['version'] = 1 />
+ </cfif>
+ </cfif>
+
+ <cfif Local.servers['server'] neq "">
+ <cfif Local.servers['delegate'] neq "">
+ <cfset Local.response['delegate'] = Local.servers['delegate'] />
+ </cfif>
+ <cfset Local.response['server'] = Local.servers['server'] />
+ <cfset Local.response['identity'] = Arguments.identifier />
+ <cfset Local.response['status'] = true />
+ </cfif>
+
+ <cfreturn Local.response />
+ </cffunction>
+
+
+ <cffunction name="findLinkIdentifier" returntype="string" access="private" output="false" hint="Parse html page for OP provider URLs.">
+ <cfargument name="Content" type="string" required="true" hint="HTML document content" />
+ <cfargument name="rel" type="string" required="true" hint="Value of link's rel attribute for which to return" />
+
+ <cfset var Local = StructNew() />
+ <cfset Local.serverURL = "" />
+
+ <!--- Look for <link rel="" href="" /> element --->
+ <cfset Local.match = REFindNoCase("<link[^>]*rel=[""']#Arguments.rel#[""'][^>]*href=[""']([^""']+)[""'][^>]*\/?>", Arguments.Content, 1, true) />
+ <cfif Local.match.pos[1] neq 0>
+ <cfset Local.serverURL = Mid(Arguments.Content, Local.match.pos[2], Local.match.len[2]) />
+
+ <!--- Look for <link href="" rel="" /> element --->
+ <cfelse>
+ <cfset Local.match = REFindNoCase("<link[^>]*href=[""']([^""']+)[""'][^>]*rel=[""']#Arguments.rel#[""'][^>]*\/?>", Arguments.Content, 1, true) />
+ <cfif Local.match.pos[1] neq 0>
+ <cfset Local.serverURL = Mid(Arguments.Content, Local.match.pos[2], Local.match.len[2]) />
+ </cfif>
+ </cfif>
+
+ <!--- Replace HTML entities with their respective characters --->
+ <cfset Local.serverURL = ReplaceNoCase(Local.serverURL, "&", "&", "all") />
+ <cfset Local.serverURL = ReplaceNoCase(Local.serverURL, "<", "<", "all") />
+ <cfset Local.serverURL = ReplaceNoCase(Local.serverURL, ">", ">", "all") />
+ <cfset Local.serverURL = ReplaceNoCase(Local.serverURL, """, """", "all") />
+
+ <cfreturn Local.serverURL />
+ </cffunction>
+
+</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/lib/OpenIDConsumer/SessionScopeOpenIDSession.cfc b/src/main/webapp/lib/OpenIDConsumer/SessionScopeOpenIDSession.cfc new file mode 100755 index 0000000..6dff495 --- /dev/null +++ b/src/main/webapp/lib/OpenIDConsumer/SessionScopeOpenIDSession.cfc @@ -0,0 +1,20 @@ +<cfcomponent> + +<cffunction name="init"> + <cfreturn this/> +</cffunction> + +<cffunction name="exists"> + <cfreturn StructKeyExists(Session, "__OpenID")/> +</cffunction> + +<cffunction name="load"> + <cfreturn Duplicate(Session.__OpenID)/> +</cffunction> + +<cffunction name="store"> + <cfargument name="data"/> + <cfset Session.__OpenID = Duplicate(arguments.data)/> +</cffunction> + +</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/lib/OpenIDConsumer/httpClient.cfc b/src/main/webapp/lib/OpenIDConsumer/httpClient.cfc new file mode 100644 index 0000000..5ad9d3b --- /dev/null +++ b/src/main/webapp/lib/OpenIDConsumer/httpClient.cfc @@ -0,0 +1,90 @@ +<cfcomponent name="httpClient" output="false">
+
+<cfset variables.instance = StructNew() />
+
+<cffunction name="init" returntype="any" output="false" access="public">
+ <cfargument name="proxyServer" type="string" required="false" default="" />
+ <cfargument name="proxyPort" type="numeric" required="false" default="0" />
+ <cfargument name="proxyUser" type="string" required="false" default="" />
+ <cfargument name="proxyPassword" type="string" required="false" default="" />
+ <cfargument name="timeout" type="numeric" required="false" default="15" />
+ <cfargument name="redirect" type="boolean" required="false" default="true" />
+ <cfargument name="resolveurl" type="boolean" required="false" default="false" />
+ <cfargument name="charset" type="string" required="false" default="utf-8" />
+ <cfargument name="throwonerror" type="boolean" required="false" default="true" />
+
+ <cfset variables.instance.timeout = arguments.timeout />
+ <cfset variables.instance.redirect = arguments.redirect />
+ <cfset variables.instance.resolveurl = arguments.resolveurl />
+ <cfset variables.instance.charset = arguments.charset />
+ <cfset variables.instance.throwonerror = arguments.throwonerror />
+
+ <cfset variables.instance.proxyServer = arguments.proxyServer />
+ <cfset variables.instance.proxyPort = arguments.proxyPort />
+ <cfset variables.instance.proxyUser = arguments.proxyUser />
+ <cfset variables.instance.proxyPassword = arguments.proxyPassword />
+
+ <cfreturn this />
+
+</cffunction>
+
+<cffunction name="call" output="true" returntype="any" access="public">
+ <cfargument name="method" type="string" required="true" />
+ <cfargument name="url" type="string" required="true" />
+ <cfargument name="data" type="array" required="false" default="#ArrayNew(1)#" />
+
+ <cfif Len(variables.instance.proxyServer) eq 0 and variables.instance.proxyPort eq 0>
+ <cfreturn callHttp(
+ method=arguments.method,
+ url=arguments.url,
+ data=arguments.data) />
+ <cfelse>
+ <cfreturn callHttpViaProxy(
+ method=arguments.method,
+ url=arguments.url,
+ data=arguments.data) />
+ </cfif>
+
+</cffunction>
+
+<cffunction name="callHttp" output="false" returntype="any" access="private">
+ <cfargument name="method" type="string" required="true" />
+ <cfargument name="url" type="string" required="true" />
+ <cfargument name="data" type="array" required="false" default="#ArrayNew(1)#" />
+
+ <cfhttp url="#arguments.url#" method="#arguments.method#" result="local.response" timeout="#variables.instance.timeout#" redirect="#variables.instance.redirect#" resolveurl="#variables.instance.resolveurl#" charset="#variables.instance.charset#" throwonerror="#variables.instance.throwonerror#" useragent="#cgi.http_user_agent#">
+ <cfloop index="local.i" from="1" to="#ArrayLen(arguments.data)#">
+ <cfset local.p = arguments.data[local.i] />
+ <cfif StructKeyExists(local.p,"Encoded")> + <cfhttpparam type="#local.p.type#" name="#local.p.name#" value="#URLDecode(local.p.value)#" />
+ <cfelse>
+ <cfhttpparam type="#local.p.type#" name="#local.p.name#" value="#local.p.value#" />
+ </cfif>
+ </cfloop>
+ </cfhttp>
+
+ <cfreturn local.response />
+
+</cffunction>
+
+<cffunction name="callHttpViaProxy" output="false" returntype="any" access="private">
+ <cfargument name="method" type="string" required="true" />
+ <cfargument name="url" type="string" required="true" />
+ <cfargument name="data" type="array" required="false" default="#ArrayNew(1)#" />
+
+ <cfhttp url="#arguments.url#" method="#arguments.method#" result="local.response" timeout="#variables.instance.timeout#" redirect="#variables.instance.redirect#" resolveurl="#variables.instance.resolveurl#" charset="#variables.instance.charset#" throwonerror="#variables.instance.throwonerror#" useragent="#cgi.http_user_agent#" proxyserver="#variables.instance.proxyServer#" proxyport="#variables.instance.proxyPort#" proxyuser="#variables.instance.proxyUser#" proxypassword="#variables.instance.proxyPassword#">
+ <cfloop index="local.i" from="1" to="#ArrayLen(arguments.data)#">
+ <cfset local.p = arguments.data[local.i] />
+ <cfif StructKeyExists(local.p,"Encoded")>
+ <cfhttpparam type="#local.p.type#" name="#local.p.name#" value="#URLDecode(local.p.value)#" />
+ <cfelse>
+ <cfhttpparam type="#local.p.type#" name="#local.p.name#" value="#local.p.value#" />
+ </cfif>
+ </cfloop>
+ </cfhttp>
+
+ <cfreturn local.response />
+
+</cffunction>
+
+</cfcomponent>
diff --git a/src/main/webapp/lib/OpenIDConsumer/json.cfc b/src/main/webapp/lib/OpenIDConsumer/json.cfc new file mode 100755 index 0000000..87621a4 --- /dev/null +++ b/src/main/webapp/lib/OpenIDConsumer/json.cfc @@ -0,0 +1,587 @@ +<!-----------------------------------------------------------------------
+********************************************************************************
+Copyright 2005-2008 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
+www.coldboxframework.com | www.luismajano.com | www.ortussolutions.com
+********************************************************************************
+Serialize and deserialize JSON data into native ColdFusion objects
+http://www.epiphantastic.com/cfjson/
+
+Authors: Jehiah Czebotar (jehiah@gmail.com)
+ Thomas Messier (thomas@epiphantastic.com)
+Version: 1.9 February 20, 2008
+
+Modifications:
+ - Contributed by Ernst van der Linden (evdlinden@gmail.com) ]
+ - Sana Ullah (adjusted the compatibility with coldbox plugins).
+ - Luis Majano (adaptations & best practices)
+----------------------------------------------------------------------->
+<cfcomponent name="json"
+ hint="JSON Plugin is used to serialize and deserialize JSON data to/from native ColdFusion objects."
+ output="false"
+ cache="true">
+
+<!------------------------------------------- CONSTRUCTOR ------------------------------------------->
+
+ <cffunction name="init" access="public" returntype="json" output="false">
+ <cfargument name="controller" type="any" required="true" hint="coldbox.system.controller">
+ <cfscript>
+ super.Init(arguments.controller);
+
+ /* Plugin Properties */
+ setpluginName("JSON");
+ setpluginVersion("1.9");
+ setpluginDescription("JSON Plugin is used to serialize and deserialize JSON data to/from native ColdFusion objects");
+
+ /* Return Instance */
+ return this;
+ </cfscript>
+ </cffunction>
+
+<!------------------------------------------- PUBLIC ------------------------------------------->
+
+ <!--- Decode from JSON to CF --->
+ <cffunction name="decode" access="public" returntype="any" output="no" hint="Converts data from JSON to CF format">
+ <!--- ************************************************************* --->
+ <cfargument name="data" type="string" required="Yes" hint="JSON Packet" />
+ <!--- ************************************************************* --->
+ <!--- DECLARE VARIABLES --->
+ <cfset var ar = ArrayNew(1) />
+ <cfset var st = StructNew() />
+ <cfset var dataType = "" />
+ <cfset var inQuotes = false />
+ <cfset var startPos = 1 />
+ <cfset var nestingLevel = 0 />
+ <cfset var dataSize = 0 />
+ <cfset var i = 1 />
+ <cfset var skipIncrement = false />
+ <cfset var j = 0 />
+ <cfset var char = "" />
+ <cfset var dataStr = "" />
+ <cfset var structVal = "" />
+ <cfset var structKey = "" />
+ <cfset var colonPos = "" />
+ <cfset var qRows = 0 />
+ <cfset var qCol = "" />
+ <cfset var qData = "" />
+ <cfset var curCharIndex = "" />
+ <cfset var curChar = "" />
+ <cfset var result = "" />
+ <cfset var unescapeVals = "\\,\"",\/,\b,\t,\n,\f,\r" />
+ <cfset var unescapeToVals = "\,"",/,#Chr(8)#,#Chr(9)#,#Chr(10)#,#Chr(12)#,#Chr(13)#" />
+ <cfset var unescapeVals2 = '\,",/,b,t,n,f,r' />
+ <cfset var unescapetoVals2 = '\,",/,#Chr(8)#,#Chr(9)#,#Chr(10)#,#Chr(12)#,#Chr(13)#' />
+ <cfset var dJSONString = "" />
+ <cfset var _data = Trim(arguments.data) />
+ <cfset var pos = 0>
+
+ <!--- NUMBER --->
+ <cfif IsNumeric(_data)>
+ <cfreturn _data />
+
+ <!--- NULL --->
+ <cfelseif _data EQ "null">
+ <cfreturn "" />
+
+ <!--- BOOLEAN --->
+ <cfelseif ListFindNoCase("true,false", _data)>
+ <cfreturn _data />
+
+ <!--- EMPTY STRING --->
+ <cfelseif _data EQ "''" OR _data EQ '""'>
+ <cfreturn "" />
+
+ <!--- STRING --->
+ <cfelseif ReFind('^"[^\\"]*(?:\\.[^\\"]*)*"$', _data) EQ 1 OR ReFind("^'[^\\']*(?:\\.[^\\']*)*'$", _data) EQ 1>
+ <cfset _data = mid(_data, 2, Len(_data)-2) />
+ <!--- If there are any \b, \t, \n, \f, and \r, do extra processing
+ (required because ReplaceList() won't work with those) --->
+ <cfif Find("\b", _data) OR Find("\t", _data) OR Find("\n", _data) OR Find("\f", _data) OR Find("\r", _data)>
+ <cfset curCharIndex = 0 />
+ <cfset curChar = ""/>
+ <cfset dJSONString = createObject("java", "java.lang.StringBuffer").init("") />
+ <cfloop condition="true">
+ <cfset curCharIndex = curCharIndex + 1 />
+ <cfif curCharIndex GT len(_data)>
+ <cfbreak />
+ <cfelse>
+ <cfset curChar = mid(_data, curCharIndex, 1) />
+ <cfif curChar EQ "\">
+ <cfset curCharIndex = curCharIndex + 1 />
+ <cfset curChar = mid(_data, curCharIndex,1) />
+ <cfset pos = listFind(unescapeVals2, curChar) />
+ <cfif pos>
+ <cfset dJSONString.append(ListGetAt(unescapetoVals2, pos)) />
+ <cfelse>
+ <cfset dJSONString.append("\" & curChar) />
+ </cfif>
+ <cfelse>
+ <cfset dJSONString.append(curChar) />
+ </cfif>
+ </cfif>
+ </cfloop>
+
+ <cfreturn dJSONString.toString() />
+ <cfelse>
+ <cfreturn ReplaceList(_data, unescapeVals, unescapeToVals) />
+ </cfif>
+
+ <!--- ARRAY, STRUCT, OR QUERY --->
+ <cfelseif ( Left(_data, 1) EQ "[" AND Right(_data, 1) EQ "]" )
+ OR ( Left(_data, 1) EQ "{" AND Right(_data, 1) EQ "}" )>
+
+ <!--- Store the data type we're dealing with --->
+ <cfif Left(_data, 1) EQ "[" AND Right(_data, 1) EQ "]">
+ <cfset dataType = "array" />
+ <cfelseif ReFindNoCase('^\{"recordcount":[0-9]+,"columnlist":"[^"]+","data":\{("[^"]+":\[[^]]*\],?)+\}\}$', _data, 0) EQ 1>
+ <cfset dataType = "query" />
+ <cfelse>
+ <cfset dataType = "struct" />
+ </cfif>
+
+ <!--- Remove the brackets --->
+ <cfset _data = Trim( Mid(_data, 2, Len(_data)-2) ) />
+
+ <!--- Deal with empty array/struct --->
+ <cfif Len(_data) EQ 0>
+ <cfif dataType EQ "array">
+ <cfreturn ar />
+ <cfelse>
+ <cfreturn st />
+ </cfif>
+ </cfif>
+
+ <!--- Loop through the string characters --->
+ <cfset dataSize = Len(_data) + 1 />
+ <cfloop condition="#i# LTE #dataSize#">
+ <cfset skipIncrement = false />
+ <!--- Save current character --->
+ <cfset char = Mid(_data, i, 1) />
+
+ <!--- If char is a quote, switch the quote status --->
+ <cfif char EQ '"'>
+ <cfset inQuotes = NOT inQuotes />
+ <!--- If char is escape character, skip the next character --->
+ <cfelseif char EQ "\" AND inQuotes>
+ <cfset i = i + 2 />
+ <cfset skipIncrement = true />
+ <!--- If char is a comma and is not in quotes, or if end of string, deal with data --->
+ <cfelseif (char EQ "," AND NOT inQuotes AND nestingLevel EQ 0) OR i EQ Len(_data)+1>
+ <cfset dataStr = Mid(_data, startPos, i-startPos) />
+
+ <!--- If data type is array, append data to the array --->
+ <cfif dataType EQ "array">
+ <cfset arrayappend( ar, decode(dataStr) ) />
+ <!--- If data type is struct or query... --->
+ <cfelseif dataType EQ "struct" OR dataType EQ "query">
+ <cfset dataStr = Mid(_data, startPos, i-startPos) />
+ <cfset colonPos = Find('":', dataStr) />
+ <cfif colonPos>
+ <cfset colonPos = colonPos + 1 />
+ <cfelse>
+ <cfset colonPos = Find(":", dataStr) />
+ </cfif>
+ <cfset structKey = Trim( Mid(dataStr, 1, colonPos-1) ) />
+
+ <!--- If needed, remove quotes from keys --->
+ <cfif Left(structKey, 1) EQ "'" OR Left(structKey, 1) EQ '"'>
+ <cfset structKey = Mid( structKey, 2, Len(structKey)-2 ) />
+ </cfif>
+
+ <cfset structVal = Mid( dataStr, colonPos+1, Len(dataStr)-colonPos ) />
+
+ <!--- If struct, add to the structure --->
+ <cfif dataType EQ "struct">
+ <cfset StructInsert( st, structKey, decode(structVal) ) />
+
+ <!--- If query, build the query --->
+ <cfelse>
+ <cfif structKey EQ "recordcount">
+ <cfset qRows = decode(structVal) />
+ <cfelseif structKey EQ "columnlist">
+ <cfset st = QueryNew( decode(structVal) ) />
+ <cfif qRows>
+ <cfset QueryAddRow(st, qRows) />
+ </cfif>
+ <cfelseif structKey EQ "data">
+ <cfset qData = decode(structVal) />
+ <cfset ar = StructKeyArray(qData) />
+ <cfloop from="1" to="#ArrayLen(ar)#" index="j">
+ <cfloop from="1" to="#st.recordcount#" index="qRows">
+ <cfset qCol = ar[j] />
+ <cfset QuerySetCell(st, qCol, qData[qCol][qRows], qRows) />
+ </cfloop>
+ </cfloop>
+ </cfif>
+ </cfif>
+ </cfif>
+
+ <cfset startPos = i + 1 />
+ <!--- If starting a new array or struct, add to nesting level --->
+ <cfelseif "{[" CONTAINS char AND NOT inQuotes>
+ <cfset nestingLevel = nestingLevel + 1 />
+ <!--- If ending an array or struct, subtract from nesting level --->
+ <cfelseif "]}" CONTAINS char AND NOT inQuotes>
+ <cfset nestingLevel = nestingLevel - 1 />
+ </cfif>
+
+ <cfif NOT skipIncrement>
+ <cfset i = i + 1 />
+ </cfif>
+ </cfloop>
+
+ <!--- Return appropriate value based on data type --->
+ <cfif dataType EQ "array">
+ <cfreturn ar />
+ <cfelse>
+ <cfreturn st />
+ </cfif>
+
+ <!--- INVALID JSON --->
+ <cfelse>
+ <cfthrow message="Invalid JSON" detail="The document you are trying to decode is not in valid JSON format" />
+ </cfif>
+ </cffunction>
+
+ <!--- CONVERTS DATA FROM CF TO JSON FORMAT --->
+ <cffunction name="encode" access="public" returntype="string" output="No" hint="Converts data from CF to JSON format">
+ <!--- ************************************************************* --->
+ <cfargument name="data" type="any" required="Yes" hint="The CF structure" />
+ <cfargument name="queryFormat" type="string" required="No" default="query" hint="query or array" />
+ <cfargument name="queryKeyCase" type="string" required="No" default="lower" hint="lower or upper"/>
+ <cfargument name="stringNumbers" type="boolean" required="No" default="false" >
+ <cfargument name="formatDates" type="boolean" required="No" default="false" >
+ <cfargument name="columnListFormat" type="string" required="No" default="string" hint="string or array" >
+ <cfargument name="keyCase" type="string" required="No" default="lower" hint="lower or upper"/>
+ <!--- ************************************************************* --->
+
+ <!--- VARIABLE DECLARATION --->
+ <cfset var jsonString = "" />
+ <cfset var tempVal = "" />
+ <cfset var arKeys = "" />
+ <cfset var arKey = "" />
+ <cfset var colPos = 1 />
+ <cfset var i = 1 />
+ <cfset var column = ""/>
+ <cfset var datakey = ""/>
+ <cfset var recordcountkey = ""/>
+ <cfset var columnlist = ""/>
+ <cfset var columnlistkey = ""/>
+ <cfset var dJSONString = "" />
+ <cfset var escapeToVals = "\\,\"",\/,\b,\t,\n,\f,\r" />
+ <cfset var escapeVals = "\,"",/,#Chr(8)#,#Chr(9)#,#Chr(10)#,#Chr(12)#,#Chr(13)#" />
+
+ <cfset var _data = arguments.data />
+
+ <!--- BOOLEAN --->
+ <cfif IsBoolean(_data) AND NOT IsNumeric(_data) AND NOT ListFindNoCase("Yes,No", _data)>
+ <cfreturn LCase(ToString(_data)) />
+
+ <!--- NUMBER --->
+ <cfelseif NOT stringNumbers AND IsNumeric(_data) AND NOT REFind("^0+[^\.]",_data)>
+ <cfreturn ToString(_data) />
+
+ <!--- DATE --->
+ <cfelseif IsDate(_data) AND arguments.formatDates>
+ <cfreturn '"#DateFormat(_data, "medium")# #TimeFormat(_data, "medium")#"' />
+
+ <!--- STRING --->
+ <cfelseif IsSimpleValue(_data)>
+ <cfreturn '"' & ReplaceList(_data, escapeVals, escapeToVals) & '"' />
+
+ <!--- ARRAY --->
+ <cfelseif IsArray(_data)>
+ <cfset dJSONString = createObject('java','java.lang.StringBuffer').init("") />
+ <cfloop from="1" to="#ArrayLen(_data)#" index="i">
+ <cfset tempVal = encode( _data[i], arguments.queryFormat, arguments.queryKeyCase, arguments.stringNumbers, arguments.formatDates, arguments.columnListFormat ) />
+ <cfif dJSONString.toString() EQ "">
+ <cfset dJSONString.append(tempVal) />
+ <cfelse>
+ <cfset dJSONString.append("," & tempVal) />
+ </cfif>
+ </cfloop>
+
+ <cfreturn "[" & dJSONString.toString() & "]" />
+
+ <!--- STRUCT --->
+ <cfelseif IsStruct(_data)>
+ <cfset dJSONString = createObject('java','java.lang.StringBuffer').init("") />
+ <cfset arKeys = StructKeyArray(_data) />
+ <cfloop from="1" to="#ArrayLen(arKeys)#" index="i">
+ <cfset tempVal = encode( _data[ arKeys[i] ], arguments.queryFormat, arguments.queryKeyCase, arguments.stringNumbers, arguments.formatDates, arguments.columnListFormat ) />
+
+ <!--- Key to lower Case? --->
+ <cfif arguments.keyCase EQ "lower">
+ <cfset arKey = LCASE(arKeys[i]) />
+ <cfelse>
+ <cfset arKey = UCASE(arKeys[i]) />
+ </cfif>
+
+ <cfif dJSONString.toString() EQ "">
+ <cfset dJSONString.append('"' & arKey & '":' & tempVal) />
+ <cfelse>
+ <cfset dJSONString.append("," & '"' & arKey & '":' & tempVal) />
+ </cfif>
+ </cfloop>
+
+ <cfreturn "{" & dJSONString.toString() & "}" />
+
+ <!--- QUERY --->
+ <cfelseif IsQuery(_data)>
+ <cfset dJSONString = createObject('java','java.lang.StringBuffer').init("") />
+
+ <!--- Add query meta data --->
+ <cfif arguments.queryKeyCase EQ "lower">
+ <cfset recordcountKey = "recordcount" />
+ <cfset columnlistKey = "columnlist" />
+ <cfset columnlist = LCase(_data.columnlist) />
+ <cfset dataKey = "data" />
+ <cfelse>
+ <cfset recordcountKey = "RECORDCOUNT" />
+ <cfset columnlistKey = "COLUMNLIST" />
+ <cfset columnlist = _data.columnlist />
+ <cfset dataKey = "data" />
+ </cfif>
+
+ <cfset dJSONString.append('"#recordcountKey#":' & _data.recordcount) />
+
+ <cfif arguments.columnListFormat EQ "array">
+ <cfset columnlist = "[" & ListQualify(columnlist, '"') & "]" />
+ <cfset dJSONString.append(',"#columnlistKey#":' & columnlist) />
+ <cfelse>
+ <cfset dJSONString.append(',"#columnlistKey#":"' & columnlist & '"') />
+ </cfif>
+
+ <cfset dJSONString.append(',"#dataKey#":') />
+
+ <!--- Make query a structure of arrays --->
+ <cfif arguments.queryFormat EQ "query">
+ <cfset dJSONString.append("{") />
+ <cfset colPos = 1 />
+
+ <cfloop list="#_data.columnlist#" delimiters="," index="column">
+ <cfif colPos GT 1>
+ <cfset dJSONString.append(",") />
+ </cfif>
+ <cfif arguments.queryKeyCase EQ "lower">
+ <cfset column = LCase(column) />
+ </cfif>
+ <cfset dJSONString.append('"' & column & '":[') />
+
+ <cfloop from="1" to="#_data.recordcount#" index="i">
+ <!--- Get cell value; recurse to get proper format depending on string/number/boolean data type --->
+ <cfset tempVal = encode( _data[column][i], arguments.queryFormat, arguments.queryKeyCase, arguments.stringNumbers, arguments.formatDates, arguments.columnListFormat ) />
+
+ <cfif i GT 1>
+ <cfset dJSONString.append(",") />
+ </cfif>
+ <cfset dJSONString.append(tempVal) />
+ </cfloop>
+
+ <cfset dJSONString.append("]") />
+
+ <cfset colPos = colPos + 1 />
+ </cfloop>
+ <cfset dJSONString.append("}") />
+ <!--- Make query an array of structures --->
+ <cfelse>
+ <cfset dJSONString.append("[") />
+ <cfloop query="_data">
+ <cfif CurrentRow GT 1>
+ <cfset dJSONString.append(",") />
+ </cfif>
+ <cfset dJSONString.append("{") />
+ <cfset colPos = 1 />
+ <cfloop list="#columnlist#" delimiters="," index="column">
+ <cfset tempVal = encode( _data[column][CurrentRow], arguments.queryFormat, arguments.queryKeyCase, arguments.stringNumbers, arguments.formatDates, arguments.columnListFormat ) />
+
+ <cfif colPos GT 1>
+ <cfset dJSONString.append(",") />
+ </cfif>
+
+ <cfif arguments.queryKeyCase EQ "lower">
+ <cfset column = LCase(column) />
+ </cfif>
+ <cfset dJSONString.append('"' & column & '":' & tempVal) />
+
+ <cfset colPos = colPos + 1 />
+ </cfloop>
+ <cfset dJSONString.append("}") />
+ </cfloop>
+ <cfset dJSONString.append("]") />
+ </cfif>
+
+ <!--- Wrap all query data into an object --->
+ <cfreturn "{" & dJSONString.toString() & "}" />
+
+ <!--- UNKNOWN OBJECT TYPE --->
+ <cfelse>
+ <cfreturn '"' & "unknown-obj" & '"' />
+ </cfif>
+ </cffunction>
+
+ <!--- Validate a JSON document --->
+ <cffunction name="validate" access="remote" output="yes" returntype="boolean" hint="I validate a JSON document against a JSON schema">
+ <!--- ************************************************************* --->
+ <cfargument name="doc" type="string" required="No" />
+ <cfargument name="schema" type="string" required="No" />
+ <cfargument name="errorVar" type="string" required="No" default="jsonSchemaErrors" />
+ <cfargument name="stopOnError" type="boolean" required="No" default=true />
+ <!--- These arguments are for internal use only --->
+ <cfargument name="_doc" type="any" required="No" />
+ <cfargument name="_schema" type="any" required="No" />
+ <cfargument name="_item" type="string" required="No" default="root" />
+ <!--- ************************************************************* --->
+
+ <cfset var schemaRules = "" />
+ <cfset var jsonDoc = "" />
+ <cfset var i = 0 />
+ <cfset var key = "" />
+ <cfset var isValid = true />
+ <cfset var msg = "" />
+
+ <cfif StructKeyExists(arguments, "doc")>
+ <cfif FileExists(arguments.doc)>
+ <cffile action="READ" file="#arguments.doc#" variable="arguments.doc" />
+ </cfif>
+
+ <cfif FileExists(arguments.schema)>
+ <cffile action="READ" file="#arguments.schema#" variable="arguments.schema" />
+ </cfif>
+
+ <cfset jsonDoc = decode(arguments.doc) />
+ <cfset schemaRules = decode(arguments.schema) />
+
+ <cfset request[arguments.errorVar] = ArrayNew(1) />
+ <cfelseif StructKeyExists(arguments, "_doc")>
+ <cfset jsonDoc = arguments._doc />
+ <cfset schemaRules = arguments._schema />
+ </cfif>
+
+ <!--- See if the document matches the rules from the schema --->
+ <cfif schemaRules.type EQ "struct">
+ <cfif NOT IsStruct(jsonDoc)>
+ <cfset ArrayPrepend(request[arguments.errorVar], "#arguments._item# should be a struct") />
+ <cfif arguments.stopOnError>
+ <cfreturn false />
+ </cfif>
+ <cfelse>
+ <!--- If specific keys are set to be required, check if they exist --->
+ <cfif StructKeyExists(schemaRules, "keys")>
+ <cfloop from="1" to="#ArrayLen(schemaRules.keys)#" index="i">
+ <cfif NOT StructKeyExists(jsonDoc, schemaRules.keys[i])>
+ <cfset ArrayPrepend(request[arguments.errorVar], "#arguments._item# should have a key named #schemaRules.keys[i]#") />
+ <cfif arguments.stopOnError>
+ <cfreturn false />
+ </cfif>
+ </cfif>
+ </cfloop>
+ </cfif>
+
+ <!--- Loop over all the keys for the structure and see if they are valid (if items key is specified) by recursing the validate function --->
+ <cfif StructKeyExists(schemaRules, "items")>
+ <cfloop collection="#jsonDoc#" item="key">
+ <cfif StructKeyExists(schemaRules.items, key)>
+ <cfset isValid = validate(_doc=jsonDoc[key], _schema=schemaRules.items[key], _item="#arguments._item#['#key#']", errorVar=arguments.errorVar, stopOnError=arguments.stopOnError) />
+ <cfif arguments.stopOnError AND NOT isValid>
+ <cfreturn false />
+ </cfif>
+ </cfif>
+ </cfloop>
+ </cfif>
+ </cfif>
+ <cfelseif schemaRules.type EQ "array">
+ <cfif NOT IsArray(jsonDoc)>
+ <cfset ArrayPrepend(request[arguments.errorVar], "#arguments._item# should be an array") />
+ <cfif arguments.stopOnError>
+ <cfreturn false />
+ </cfif>
+ <cfelse>
+ <cfparam name="schemaRules.minlength" default="0" />
+ <cfparam name="schemaRules.maxlength" default="9999999999" />
+
+ <!--- If there are length requirements for the array make sure they are valid --->
+ <cfif ArrayLen(jsonDoc) LT schemaRules.minlength>
+ <cfset ArrayPrepend(request[arguments.errorVar], "#arguments._item# is an array that should have at least #schemaRules.minlength# elements") />
+ <cfif arguments.stopOnError>
+ <cfreturn false />
+ </cfif>
+ <cfelseif ArrayLen(jsonDoc) GT schemaRules.maxlength>
+ <cfset ArrayPrepend(request[arguments.errorVar], "#arguments._item# is an array that should have at the most #schemaRules.maxlength# elements") />
+ <cfif arguments.stopOnError>
+ <cfreturn false />
+ </cfif>
+ </cfif>
+
+ <!--- Loop over the array elements and if there are rules for the array items recurse to enforce them --->
+ <cfif StructKeyExists(schemaRules, "items")>
+ <cfloop from="1" to="#ArrayLen(jsonDoc)#" index="i">
+ <cfset isValid = validate(_doc=jsonDoc[i], _schema=schemaRules.items, _item="#arguments._item#[#i#]", errorVar=arguments.errorVar, stopOnError=arguments.stopOnError) />
+ <cfif arguments.stopOnError AND NOT isValid>
+ <cfreturn false />
+ </cfif>
+ </cfloop>
+ </cfif>
+ </cfif>
+ <cfelseif schemaRules.type EQ "number">
+ <cfif NOT IsNumeric(jsonDoc)>
+ <cfset ArrayPrepend(request[arguments.errorVar], "#arguments._item# should be numeric") />
+ <cfif arguments.stopOnError>
+ <cfreturn false />
+ </cfif>
+ <cfelseif StructKeyExists(schemaRules, "min") AND jsonDoc LT schemaRules.min>
+ <cfset ArrayPrepend(request[arguments.errorVar], "#arguments._item# cannot be a number less than #schemaRules.min#") />
+ <cfif arguments.stopOnError>
+ <cfreturn false />
+ </cfif>
+ <cfelseif StructKeyExists(schemaRules, "max") AND jsonDoc GT schemaRules.max>
+ <cfset ArrayPrepend(request[arguments.errorVar], "#arguments._item# cannot be a number greater than #schemaRules.max#") />
+ <cfif arguments.stopOnError>
+ <cfreturn false />
+ </cfif>
+ </cfif>
+ <cfelseif schemaRules.type EQ "boolean" AND ( NOT IsBoolean(jsonDoc) OR ListFindNoCase("Yes,No", jsonDoc) OR IsNumeric(jsonDoc) )>
+ <cfset ArrayPrepend(request[arguments.errorVar], "#arguments._item# should be a boolean") />
+ <cfif arguments.stopOnError>
+ <cfreturn false />
+ </cfif>
+ <cfelseif schemaRules.type EQ "date">
+ <cfif NOT IsSimpleValue(jsonDoc) OR NOT IsDate(jsonDoc)
+ OR ( StructKeyExists(schemaRules, "mask") AND CompareNoCase( jsonDoc, DateFormat(jsonDoc, schemaRules.mask) ) NEQ 0 )>
+ <cfif StructKeyExists(schemaRules, "mask")>
+ <cfset msg = " in #schemaRules.mask# format" />
+ </cfif>
+ <cfset ArrayPrepend(request[arguments.errorVar], "#arguments._item# should be a date#msg#") />
+ <cfif arguments.stopOnError>
+ <cfreturn false />
+ </cfif>
+ </cfif>
+ <cfelseif schemaRules.type EQ "string">
+ <cfif NOT IsSimpleValue(jsonDoc)>
+ <cfset ArrayPrepend(request[arguments.errorVar], "#arguments._item# should be a string") />
+ <cfif arguments.stopOnError>
+ <cfreturn false />
+ </cfif>
+ <cfelseif StructKeyExists(schemaRules, "minlength") AND Len(jsonDoc) LT schemaRules.minlength>
+ <cfset ArrayPrepend(request[arguments.errorVar], "#arguments._item# should have a minimum length of #schemaRules.minlength#") />
+ <cfif arguments.stopOnError>
+ <cfreturn false />
+ </cfif>
+ <cfelseif StructKeyExists(schemaRules, "maxlength") AND Len(jsonDoc) GT schemaRules.maxlength>
+ <cfset ArrayPrepend(request[arguments.errorVar], "#arguments._item# should have a maximum length of #schemaRules.maxlength#") />
+ <cfif arguments.stopOnError>
+ <cfreturn false />
+ </cfif>
+ </cfif>
+ </cfif>
+
+ <cfif ArrayLen(request[arguments.errorVar])>
+ <cfreturn false />
+ <cfelse>
+ <cfreturn true />
+ </cfif>
+ </cffunction>
+
+<!------------------------------------------- PRIVATE ------------------------------------------->
+
+
+</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/lib/OpenIDConsumer/yadis.cfc b/src/main/webapp/lib/OpenIDConsumer/yadis.cfc new file mode 100755 index 0000000..3c4dad3 --- /dev/null +++ b/src/main/webapp/lib/OpenIDConsumer/yadis.cfc @@ -0,0 +1,338 @@ +<!--- Yadis Component + +Description: + The Yadis specification provides a mechanism for determining the services that are available with a + given identifier. It uses URLs as identifiers, so given a URL, it provides a mechanism of retrieving + a list of available services associated with that URL. The service list is an XRDS XML document. + +Author: + Richard Davies + http://www.richarddavies.us + richard@richarddavies.us + +Usage: + There are two public methods: discover() and services(). + + ========== + discover() + ========== + Discover the XRDS document associated with a specified URL. + + Required arguments: + url string The Yadis URL that you want to perform service discovery on. + + Returns: + string If successful, returns the XRDS XML service document. Otherwise, returns an empty string. + + ========== + services() + ========== + Parses a specified XRDS document and returns an array of services. It can also filter the returned services + using one or more developer-specified filter functions. + + Required arguments: + xrds xml The XRDS XML document from which to extract the <service> elements. + + Optional arguments: + filters string List containing the names of the filter functions. + matchAll boolean If true, only returns services that match ALL of the filters. If false, returns + services that match ANY of the filters. + + Returns: + array An array of XML service elements. + + Filter functions: + When using filters, services() will pass each <service> element to the the function(s), which should + return a boolean value to specify if the element passes or fails the filter. The filters must be defined + in the Request scope. + + The following example filter returns <service> elements that have a <Type> element whose value is + http://specs.openid.net/auth/2.0/signon. + + <cffunction name="claimedIdentifierFilter" returntype="boolean" output="false" hint="Yadis filter to select claimed identifier services."> + <cfargument name="service" type="xml" required="true" hint="Service element to apply filter to"> + + <cfset var Local = StructNew() /> + <cfset Local.match = XmlSearch(Arguments.service, "self::node()[:Type='http://specs.openid.net/auth/2.0/signon']")> + + <cfreturn not ArrayIsEmpty(Local.match)> + </cffunction> + <cfset Request.claimedIdentifierFilter = Variables.claimedIdentifierFilter /> + + +Specification: + http://yadis.org/papers/yadis-v1.0.pdf (version 1.0 - PDF) + http://yadis.org/wiki/Yadis_1.0_(HTML) (version 1.0 - HTML) + + ---> + + +<cfcomponent name="Yadis" output="false" hint="The Yadis protocol provides a mechanism for discovering the services that are available with a given identifier (URL)."> + + <!--- Proxy settings for <cfhttp> ---> + <cfset Variables.proxyServer = "" /> + <cfset Variables.proxyPort = 80 /> + <cfset Variables.proxyUser = "" /> + <cfset Variables.proxyPassword = "" /> + + <cfset Variables.httpClient = CreateObject("component", "httpClient").init(Variables.proxyServer, Variables.proxyPort, Variables.proxyUser, Variables.proxyPassword) /> + + <cffunction name="init" access="public" returntype="yadis" output="false" hint="Component constructor."> + <cfargument name="proxyServer" type="string" required="false" default="-1" hint="Proxy server" /> + <cfargument name="proxyPort" type="numeric" required="false" default="-1" hint="Proxy port" /> + <cfargument name="proxyUser" type="string" required="false" default="-1" hint="Proxy user" /> + <cfargument name="proxyPassword" type="string" required="false" default="-1" hint="Proxy password" /> + + <!--- Allow optional per-instance overriding of default proxy settings ---> + <cfset Variables.proxyServer = IIf(Arguments.proxyServer neq -1, "Arguments.proxyServer", "Variables.proxyServer") /> + <cfset Variables.proxyPort = IIf(Arguments.proxyPort neq -1, "Arguments.proxyPort", "Variables.proxyPort") /> + <cfset Variables.proxyUser = IIf(Arguments.proxyUser neq -1, "Arguments.proxyUser", "Variables.proxyUser") /> + <cfset Variables.proxyPassword = IIf(Arguments.proxyPassword neq -1, "Arguments.proxyPassword", "Variables.proxyPassword") /> + + <cfset Variables.httpClient = CreateObject("component", "httpClient").init(Variables.proxyServer, Variables.proxyPort, Variables.proxyUser, Variables.proxyPassword) /> + + <cfreturn this /> + </cffunction> + + <cffunction name="discover" access="public" returntype="string" output="false" hint="Gets the XRDS service document for a URL."> + <cfargument name="url" type="string" required="true" hint="Yadis URL" /> + + <!--- Yadis XRDS discovery + http://yadis.org/wiki/Yadis_1.0_(HTML)#6.2.4_Initiation + ---> + + <cfset var Local = StructNew() /> + + <cfset Local.data = ArrayNew(1) /> + + <cfset Local.httpParameter = StructNew() /> + <cfset Local.httpParameter["Type"] = "header" /> + <cfset Local.httpParameter["Name"] = "Accept" /> + <cfset Local.httpParameter["Value"] = "application/xrds+xml" /> + <cfset ArrayAppend(Local.data,Local.httpParameter) /> + + <cfset Local.cfhttp = Variables.httpClient.call("get",Arguments.url,Local.data) /> + + <!--- Retrieve document from URL returned in HTTP header ---> + <cfif StructKeyExists(Local.cfhttp.ResponseHeader, "X-XRDS-Location")> + <cfset Local.xrdsURL = Local.cfhttp.ResponseHeader["x-xrds-location"] /> + <cfset Local.recursiveDiscover = Local.xrdsURL neq Arguments.url /> + + <!--- Don't keep recusing if X-XRDS-Location header is the same URL as the current URL ---> + <cfif Local.recursiveDiscover> + <cfset Local.xrdsDocument = discover(Local.xrdsURL) /> + <cfreturn Local.xrdsDocument /> + </cfif> + + <!--- Retrieve document from URL returned in <meta> HTML element ---> + <cfelse> + <cfset Local.xrdsURL = findMetaDescriptorURL(Local.cfhttp.FileContent)> + + <cfif Local.xrdsURL is not ""> + <cfset Local.xrdsDocument = discover(Local.xrdsURL) /> + <cfreturn Local.xrdsDocument /> + </cfif> + </cfif> + + <!--- Retrieve document from HTTP response content ---> + <cfset Local.xrdsDocument = Local.cfhttp.FileContent /> + <cfif IsXML(Local.xrdsDocument)> + <cfset Local.xrdsDocument = XmlParse(Local.xrdsDocument) /> + <cfreturn Local.xrdsDocument /> + <cfelse> + <cfreturn "" /> + </cfif> + </cffunction> + + + <cffunction name="findMetaDescriptorURL" returntype="string" access="private" output="false" hint="Parse html page for IdP provider URLs."> + <cfargument name="Content" type="string" required="true" hint="HTML document content" /> + + <cfset var Local = StructNew() /> + <cfset Local.url = "" /> + + <!--- Look for <meta http-equiv="x-xrds-locationi" content="" /> element ---> + <cfset Local.match = REFindNoCase("<meta[^>]*http-equiv=[""']x-xrds-location[""'][^>]*content=[""']([^""']+)[""'][^>]*\/?>", Arguments.Content, 1, true) /> + <cfif Local.match.pos[1] neq 0> + <cfset Local.url = Mid(Arguments.Content, Local.match.pos[2], Local.match.len[2]) /> + + <!--- Look for <meta content="" http-equiv="x-xrds-location" /> element ---> + <cfelse> + <cfset Local.match = REFindNoCase("<meta[^>]*content=[""']([^""']+)[""'][^>]*http-equiv=[""']x-xrds-location[""'][^>]*\/?>", Arguments.Content, 1, true) /> + <cfif Local.match.pos[1] neq 0> + <cfset Local.url = Mid(Arguments.Content, Local.match.pos[2], Local.match.len[2]) /> + </cfif> + </cfif> + + <!--- Replace HTML entities with their respective characters ---> + <cfset Local.url = ReplaceNoCase(Local.url, "&", "&", "all") /> + <cfset Local.url = ReplaceNoCase(Local.url, "<", "<", "all") /> + <cfset Local.url = ReplaceNoCase(Local.url, ">", ">", "all") /> + <cfset Local.url = ReplaceNoCase(Local.url, """, """", "all") /> + + <cfreturn Local.url /> + </cffunction> + + + <cffunction name="services" access="public" returntype="array" output="false" hint="Gets an array of services from an XRDS document."> + <cfargument name="xrds" type="xml" required="true" hint="XRDS service document" /> + <cfargument name="filters" type="string" required="false" default="" hint="List containing names of filter functions (functions must exist in Request scope)" /> + <cfargument name="matchAll" type="boolean" required="false" default="false" hint="Require services to match all filter functions" /> + + <!--- XRDS <service> description and example + http://openid.net/specs/openid-authentication-2_0.html#rfc.section.7.3.2 + ---> + + <cfset var Local = StructNew() /> + + <!--- Sort by priority attribute of <Service> element ---> + <cfset Local.sortedServices = prioritySort(Arguments.xrds, "Service") /> + + <!--- Filter services using developer-defined functions (if any) ---> + <cfset Local.matchedFilter = "" /> + <cfif ListLen(Arguments.filters)> + <cfloop index="Local.service" from="1" to="#ArrayLen(Local.sortedServices)#"> + <cfset Local.allFiltersMatched = "true" /> + <cfloop index="Local.filter" list="#Arguments.filters#"> + <!--- Apply filter to service and check results ---> + <cfset Local.match = Evaluate(Trim(Local.filter) & "(Local.sortedServices[Local.service])") /> + <cfif Arguments.matchAll> + <cfif not Local.match> + <!--- For matchAll mode: The service didn't match a filter, so flag result and no + need to apply any other filters to this service + ---> + <cfset Local.allFiltersMatched = "false" /> + <cfbreak /> + </cfif> + <cfelse> + <cfif Local.match> + <!--- For matchAny mode: We've found the first match, so add the service to the + "keepers" list and stop applying additional filters to this service + ---> + <cfset Local.matchedFilter = ListAppend(Local.matchedFilter, Local.service) /> + <cfbreak /> + </cfif> + </cfif> + </cfloop> + + <!--- For matchAll mode: we've now applied all of the filters to the service, so + if they all matched then add the service to the "keepers" list + ---> + <cfif Arguments.matchAll and Local.allFiltersMatched> + <cfset Local.matchedFilter = ListAppend(Local.matchedFilter, Local.service) /> + </cfif> + </cfloop> + + <!--- Use "keepers" list to create a filtered array of services ---> + <cfset Local.filteredServices = ArrayNew(1) /> + <cfloop list="#Local.matchedFilter#" index="Local.service"> + <cfset ArrayAppend(Local.filteredServices, Local.sortedServices[Local.service]) /> + </cfloop> + <cfelse> + <!--- No filter functions specified ---> + <cfset Local.filteredServices = ArrayNew(1) /> + <cfset Local.filteredServices = Local.sortedServices /> + </cfif> + + <!--- Sort the filtered <Service> elements' <URI> elements by their priority attributes ---> + <cfloop index="Local.i" from="1" to="#ArrayLen(Local.filteredServices)#"> + <cfset Local.sortedUris = prioritySort(Local.filteredServices[Local.i], "URI") /> + + <!--- Rearrange <URI> elements according to their priority (highest priority first) ---> + <cfloop index="Local.j" from="1" to="#ArrayLen(Local.sortedUris)#"> + <cfset Local.filteredServices[Local.i].URI[Local.j] = Duplicate(Local.sortedUris[Local.j]) /> + </cfloop> + </cfloop> + + <cfreturn Local.filteredServices /> + </cffunction> + + + <cffunction name="prioritySort" access="private" returntype="array" output="false" hint="Sorts specified XML elements according to their priority attribute."> + <cfargument name="xml" type="xml" required="true" hint="XML element containing descendent elements to sort." /> + <cfargument name="element" type="string" required="true" hint="Name of XML elements to sort." /> + + <cfset var Local = StructNew() /> + <cfset Local.MIN_PRIORITY = 999999999999 /> + + <!--- Get all specified descendent elements from given XML element ---> + <cfset Local.elements = XmlSearch(Arguments.xml, ".//*[local-name()='#Arguments.element#']") /> + + + <!--- Sort by element's priority attribute (the lower the number, the higher the priority) ---> + + <!--- Create an array containing all of the priority values ---> + <cfset Local.sortArray = ArrayNew(1) /> + <cfloop index="Local.i" from="1" to="#ArrayLen(Local.elements)#"> + <cfif StructKeyExists(Local.elements[Local.i].XmlAttributes, "priority")> + <cfset Local.sortArray[Local.i] = Local.elements[Local.i].XmlAttributes.priority /> + <cfelse> + <!--- If element doesn't have a priority, assign it a very low priority ---> + <cfset Local.sortArray[Local.i] = Local.MIN_PRIORITY /> + </cfif> + </cfloop> + + <!--- Sort the priority values array ---> + <cfset ArraySort(Local.sortArray, "numeric") /> + + <!--- Loop through (sorted) priority values array and use those values to put their + respective elements into another array (which will then be sorted). + ---> + <cfset Local.sortedElements = ArrayNew(1) /> + <cfloop index="Local.i" from="1" to="#ArrayLen(Local.sortArray)#"> + <cfset Local.priority = Local.sortArray[Local.i] /> + <cfif Local.priority is not Local.MIN_PRIORITY> + <cfset Local.element = XmlSearch(Arguments.xml, ".//*[local-name()='#Arguments.element#' and @priority='#Local.priority#']") /> + <!--- It's possible that there are more than one element with the same priority ---> + <cfloop index="Local.j" from="1" to="#ArrayLen(Local.element)#"> + <cfset Local.sortedElements[Local.i + Local.j - 1] = Local.element[Local.j] /> + <!--- Clear upcoming element in sortArray because we've just added its respective element ---> + <cfset Local.sortArray[Local.i + Local.j - 1] = -1 /> + </cfloop> + <cfelse> + <!--- We've reached the end of the elements with explicitly set priorities ---> + <cfbreak /> + </cfif> + </cfloop> + + <!--- Append those elements without any priority to the end of the sorted array ---> + <cfset Local.minPriorityArray = XmlSearch(Arguments.xml, ".//*[local-name()='#Arguments.element#' and not(@priority)]") /> + <cfloop index="Local.i" from="1" to="#ArrayLen(Local.minPriorityArray)#"> + <cfset ArrayAppend(Local.sortedElements, Local.minPriorityArray[Local.i]) /> + </cfloop> + + <cfreturn Local.sortedElements /> + </cffunction> + + <cffunction name="opIdentifierFilter" returntype="boolean" access="private" output="false" hint="Yadis filter to select OP identifier services."> + <cfargument name="service" type="xml" required="true" hint="Service element to apply filter to"> + + <cfset var Local = StructNew() /> + <cfset Local.match = XmlSearch(Arguments.service, "self::node()[:Type='http://specs.openid.net/auth/2.0/server']")> + + <cfreturn not ArrayIsEmpty(Local.match)> + </cffunction> + + <cffunction name="claimedIdentifierFilter" returntype="boolean" access="private" output="false" hint="Yadis filter to select claimed identifier services."> + <cfargument name="service" type="xml" required="true" hint="Service element to apply filter to"> + + <cfset var Local = StructNew() /> + <cfset Local.match = XmlSearch(Arguments.service, "self::node()[:Type='http://specs.openid.net/auth/2.0/signon']")> + + <cfreturn not ArrayIsEmpty(Local.match)> + </cffunction> + + <cffunction name="openID1Filter" returntype="boolean" access="private" output="false" hint="Yadis filter to select OpenID v1 services."> + <cfargument name="service" type="xml" required="true" hint="Service element to apply filter to"> + + <cfset var Local = StructNew() /> + <cfset Local.match = XmlSearch(Arguments.service, "self::node()[:Type='http://openid.net/signon/1.1']")> + + <cfif ArrayIsEmpty(Local.match)> + <cfset Local.match = XmlSearch(Arguments.service, "self::node()[:Type='http://openid.net/signon/1.0']")> + </cfif> + + <cfreturn not ArrayIsEmpty(Local.match)> + </cffunction> + +</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/miscellaneous/Application.cfc b/src/main/webapp/miscellaneous/Application.cfc new file mode 100644 index 0000000..536f461 --- /dev/null +++ b/src/main/webapp/miscellaneous/Application.cfc @@ -0,0 +1,6 @@ +<!---
+ You can place ".cfm" files in this folder and run them independently from Wheels.
+ This empty "Application.cfc" file makes sure that Wheels does not interfer with the request.
+--->
+<cfcomponent>
+</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/models/DB_Type.cfc b/src/main/webapp/models/DB_Type.cfc new file mode 100644 index 0000000..bb42c02 --- /dev/null +++ b/src/main/webapp/models/DB_Type.cfc @@ -0,0 +1,35 @@ +<cfcomponent extends="Model"> + <cfscript> + + function init() { + hasMany(name="Hosts", foreignKey="db_type_id"); + hasMany(name="Schema_Defs", foreignKey="db_type_id"); + } + + </cfscript> + + <cffunction name="findAvailableHost" returnType="query"> + <cfset var ret = QueryNew("")> + + <cfquery datasource="#get('datasourceName')#" name="ret" maxrows="1"> + SELECT + h.* + FROM + Hosts h + WHERE + db_type_id = <cfqueryparam value="#this.id#" cfsqltype="cf_sql_integer"> AND + not exists ( + SELECT + 1 + FROM + Hosts h2 + WHERE + h2.id != h.id AND + h2.db_type_id = h.db_type_id AND + coalesce((SELECT count(s.id) FROM schema_defs s WHERE s.current_host_id = h2.id), 0) < coalesce((SELECT count(s.id) FROM schema_defs s WHERE s.current_host_id = h.id), 0) + ) + </cfquery> + + <cfreturn ret> + </cffunction> +</cfcomponent> diff --git a/src/main/webapp/models/Host.cfc b/src/main/webapp/models/Host.cfc new file mode 100644 index 0000000..a69f039 --- /dev/null +++ b/src/main/webapp/models/Host.cfc @@ -0,0 +1,143 @@ +<cfcomponent extends="Model"> + <cfscript> + function init() { + belongsTo(name="DB_Type", foreignKey="db_type_id"); + hasMany(name="Schema_Defs", foreignKey="host_id"); + } + </cfscript> + + <cffunction name="initializeDatabase"> + <cfargument name="databaseName" type="string"> + <cfargument name="firstAttempt" type="boolean" default="true"> + + <cfset var sql = Replace(this.db_type.setup_script_template, '##databaseName##', this.db_type_id & '_' & databaseName, 'ALL')> + <cfset var statement = ""> + + <cfif Len(this.db_type.batch_separator)> + <cfset sql = REReplace(sql, "#chr(10)##this.db_type.batch_separator#(#chr(13)#?)#chr(10)#", '#chr(7)#', 'all')> + </cfif> + + <cftry> + <cfloop list="#sql#" index="statement" delimiters="#chr(7)#"> + <cfquery datasource="#this.cf_dsn#">#PreserveSingleQuotes(statement)#</cfquery> + </cfloop> + <cfcatch type="any"> + <cfset this.dropDatabase(arguments.databaseName)> + <cfif arguments.firstAttempt> + <cfset this.initializeDatabase(arguments.databaseName, false)> + </cfif> + </cfcatch> + </cftry> + + </cffunction> + + <cffunction name="initializeDSN"> + <cfargument name="databaseName" type="string"> + + <cfscript> + setDatasource( + adminPassword=get('CFAdminPassword'), + name="#this.db_type_id#_#arguments.databaseName#", + class=this.db_type.jdbc_class_name, + jdbcurl="#Replace(this.jdbc_url_template, '##databaseName##', "db_" & this.db_type_id & '_' & arguments.databaseName, 'ALL')#", + username="user_#this.db_type_id#_#arguments.databaseName#", + password=this.db_type_id & '_' & arguments.databaseName, + customJDBCArguments=this.db_type.custom_jdbc_attributes, + timeout=0, + allowed_grant=false, + allowed_revoke=false, + pooling=false, + description = "Created on #DateFormat(Now(), 'mm/dd/yyyy')# #TimeFormat(Now(), 'hh:mm:ss tt')#" + ); + </cfscript> + + </cffunction> + + <cffunction name="initializeSchema" output=true> + <cfargument name="datasourceName" type="string"> + <cfargument name="ddl" type="string"> + <cfargument name="statement_separator" type="string" default=";"> + + <cfset var statement = ""> + <cfset var ddl_list = ""> + + <cfif StructKeyExists(server, "railo")><!--- Annoying incompatiblity found in how ACF and Railo escape backreferences ---> + <cfset var escaped_separator = ReReplace(arguments.statement_separator, "([^A-Za-z0-9])", "\\1", "ALL")> + <cfelse> + <cfset var escaped_separator = ReReplace(arguments.statement_separator, "([^A-Za-z0-9])", "\\\1", "ALL")> + </cfif> + <cfif Len(this.db_type.batch_separator)> + <cfset ddl_list = REReplace(arguments.ddl, "#chr(10)##this.db_type.batch_separator#(#chr(13)#?)#chr(10)#", '#chr(7)#', 'all')> + <cfelse> + <cfset ddl_list = arguments.ddl> + </cfif> + <cfset ddl_list = REReplace(ddl_list, "#escaped_separator#\s*(\r?\n|$)", "#chr(7)#", "all")> + + <cfloop list="#ddl_list#" index="statement" delimiters="#chr(7)#"> + <cfif Len(trim(statement))> + <cfquery datasource="#this.db_type_id#_#arguments.datasourceName#">#PreserveSingleQuotes(statement)#</cfquery> + </cfif> + </cfloop> + + <cfscript> + local.isMySQL = this.db_type.simple_name IS 'MySQL'; + + setDatasource( + adminPassword=get('CFAdminPassword'), + name="#this.db_type_id#_#arguments.datasourceName#", + class=this.db_type.jdbc_class_name, + jdbcurl="#Replace(this.jdbc_url_template, '##databaseName##', "db_" & this.db_type_id & '_' & arguments.datasourceName, 'ALL')#", + username="user_#this.db_type_id#_#arguments.datasourceName#", + password=this.db_type_id & '_' & arguments.datasourceName, + customJDBCArguments=this.db_type.custom_jdbc_attributes, + timeout=0, + allowed_select=true, + allowed_insert=!local.isMySQL, + allowed_update=!local.isMySQL, + allowed_delete=!local.isMySQL, + allowed_alter=!local.isMySQL, + allowed_drop=!local.isMySQL, + allowed_revoke=false, + allowed_create=!local.isMySQL, + allowed_grant=false, + pooling=false, + description = "Created on #DateFormat(Now(), 'mm/dd/yyyy')# #TimeFormat(Now(), 'hh:mm:ss tt')#" + ); + </cfscript> + + </cffunction> + + + <cffunction name="dropDSN"> + <cfargument name="databaseName" type="string"> + <cfscript> + deleteDatasource( + adminPassword=get('CFAdminPassword'), + name="#this.db_type_id#_#arguments.databaseName#" + ); + </cfscript> + </cffunction> + + + + <cffunction name="dropDatabase"> + <cfargument name="databaseName" type="string"> + <cfset var statement = ""> + + <cfif not IsDefined("this.db_type")> + <cfset this.db_type = model("DB_Type").findByKey(this.db_type_id)> + </cfif> + <cfset var sql = Replace(this.db_type.drop_script_template, '##databaseName##', this.db_type_id & '_' & ucase(databaseName), 'ALL')> + + <cfif Len(this.db_type.batch_separator)> + <cfset sql = REReplace(sql, "#chr(10)##this.db_type.batch_separator#(#chr(13)#?)#chr(10)#", '#chr(7)#', 'all')> + </cfif> + + <cfloop list="#sql#" index="statement" delimiters="#chr(7)#"> + <cfquery datasource="#this.cf_dsn#">#PreserveSingleQuotes(statement)#</cfquery> + </cfloop> + + + </cffunction> + +</cfcomponent> diff --git a/src/main/webapp/models/Model.cfc b/src/main/webapp/models/Model.cfc new file mode 100644 index 0000000..cf76970 --- /dev/null +++ b/src/main/webapp/models/Model.cfc @@ -0,0 +1,8 @@ +<!---
+ This is the parent model file that all your models should extend.
+ You can add functions to this file to make them globally available in all your models.
+ Do not delete this file.
+--->
+<cfcomponent extends="Wheels">
+
+</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/models/Query.cfc b/src/main/webapp/models/Query.cfc new file mode 100644 index 0000000..b6dfb7b --- /dev/null +++ b/src/main/webapp/models/Query.cfc @@ -0,0 +1,262 @@ +<cfcomponent extends="Model"> + <cfscript> + + function init() { + belongsTo(name="Schema_Def", foreignKey="schema_def_id"); + } + + </cfscript> + + <cffunction name="executeSQL" returnType="struct"> + <cfset var returnVal = {}> + <cfset var resultInfo = {}> + <cfset var ret = QueryNew("")> + <cfset var executionPlan = QueryNew("")> + <cfset var statement = ""> + <cfset var statementArray = []> + <cfset var sqlBatchList = ""> + + <cfif StructKeyExists(server, "railo")><!--- Annoying incompatiblity found in how ACF and Railo escape backreferences ---> + <cfset var escaped_separator = ReReplace(this.statement_separator, "([^A-Za-z0-9])", "\\1", "ALL")> + <cfelse> + <cfset var escaped_separator = ReReplace(this.statement_separator, "([^A-Za-z0-9])", "\\\1", "ALL")> + </cfif> + + <cfif not IsDefined("this.schema_def") OR not IsDefined("this.schema_def.db_type")> + <cfset this.schema_def = model("Schema_Def").findByKey(key=this.schema_def_id, include="DB_Type")> + </cfif> + + <cfif this.schema_def.db_type.context IS "host"> + + <cfset local.hasQuerySets = model("Query_Set").count(where="query_id=#this.id# AND schema_def_id = #this.schema_def_id#")> + + <cfset returnVal["sets"] = []> + + <cftransaction> + + <cfif Len(this.schema_def.db_type.batch_separator)> + <cfset sqlBatchList = REReplace(this.sql, "#chr(10)##this.schema_def.db_type.batch_separator#(#chr(13)#?)#chr(10)#", '#chr(7)#', 'all')> + <cfelse> + <cfset sqlBatchList = this.sql> + </cfif> + + <cfset sqlBatchList = REReplace(sqlBatchList, "#escaped_separator#\s*(\r?\n|$)", "#chr(7)#", "all")> + + <cfif this.schema_def.db_type.simple_name IS "Oracle"> + <cfset local.defered_table = "DEFERRED_#Left(Hash(createuuid(), "MD5"), 8)#"> + <cfquery datasource="#this.schema_def.db_type_id#_#this.schema_def.short_code#"> + CREATE TABLE #local.defered_table# (val NUMBER(1) CONSTRAINT #local.defered_table#_ck CHECK(val =1) DEFERRABLE INITIALLY DEFERRED) + </cfquery> + <cfquery datasource="#this.schema_def.db_type_id#_#this.schema_def.short_code#"> + INSERT INTO #local.defered_table# VALUES (2) + </cfquery> + </cfif> + + <cftry> + + <cfloop list="#sqlBatchList#" index="statement" delimiters="#chr(7)#"> + <cfset local.ret = QueryNew("")> + <cfset local.executionPlan = QueryNew("")> + <cfset local.executionPlanRaw = QueryNew("")> + + <cfif Len(trim(statement))><!--- don't run empty queries ---> + + <!--- if there is an execution plan mechanism available for this db type ---> + <cfif ( + Len(this.schema_def.db_type.execution_plan_prefix) OR + Len(this.schema_def.db_type.execution_plan_suffix) + ) + > + + <cfset local.executionPlanSQL = this.schema_def.db_type.execution_plan_prefix & statement & this.schema_def.db_type.execution_plan_suffix> + <cfset local.executionPlanSQL = Replace(local.executionPlanSQL, "##schema_short_code##", this.schema_def.short_code, "ALL")> + <cfset local.executionPlanSQL = Replace(local.executionPlanSQL, "##query_id##", this.id, "ALL")> + + <cfif Len(this.schema_def.db_type.batch_separator)> + <cfset local.executionPlanBatchList = REReplace(local.executionPlanSQL, "#chr(10)##this.schema_def.db_type.batch_separator#(#chr(13)#?)#chr(10)#", '#chr(7)#', 'all')> + <cfelse> + <cfset local.executionPlanBatchList = local.executionPlanSQL> + </cfif> + + <cfloop list="#local.executionPlanBatchList#" index="executionPlanStatement" delimiters="#chr(7)#"> + <cftry> + <cfquery datasource="#this.schema_def.db_type_id#_#this.schema_def.short_code#" name="executionPlan">#PreserveSingleQuotes(executionPlanStatement)#</cfquery> + <cfcatch> + + <!--- execution plan failed! Oh well, carry on.... ---> + <cfset local.executionPlan = QueryNew("")> + + </cfcatch> + </cftry> + </cfloop> + + <cfset local.executionPlanRaw = Duplicate(local.executionPlan)> + + <!--- Some db types offer XML for the execution plan, which can allow for customized output ---> + <cfif + IsDefined("local.executionPlan") AND + IsQuery(local.executionPlan) AND + local.executionPlan.recordCount AND + IsXML(local.executionPlan[ListFirst(local.executionPlan.columnList)][1])> + + <!--- This is pretty much only for SQL Server, since only SQL Server reports when explicit commits occur. ---> + <cfif len(this.schema_def.db_type.execution_plan_check)> + <cfset local.checkResult = XMLSearch(local.executionPlan[ListFirst(local.executionPlan.columnList)][1], this.schema_def.db_type.execution_plan_check)> + <cfif ArrayLen(local.checkResult)> + <cfthrow message="Explicit commits are not allowed."> + </cfif> + </cfif> + + <!--- if we have xslt available for this db type, use it to transform the execution plan response ---> + <cfif Len(this.schema_def.db_type.execution_plan_xslt)> + <cfset local.executionPlan[ListFirst(local.executionPlan.columnList)][1] = + XMLTransform( + local.executionPlan[ListFirst(local.executionPlan.columnList)][1], + this.schema_def.db_type.execution_plan_xslt + )> + <cfelse> + <!--- no XSLT, so just format it nicely ---> + + <cfset local.executionPlan[ListFirst(local.executionPlan.columnList)][1] = + "<pre>#XMLFormat(local.executionPlan[ListFirst(local.executionPlan.columnList)][1])#</pre>"> + + </cfif><!--- end if xslt is/is not available for type ---> + + </cfif><!--- end if xml-based execution plan ---> + + </cfif> <!--- end if execution plan ---> + + + <cfif this.schema_def.db_type.simple_name IS "SQL Server"> + <cfquery datasource="#this.schema_def.db_type_id#_#this.schema_def.short_code#"> + begin tran; + </cfquery> + </cfif> + + + <!--- run the actual query ---> + <cfquery datasource="#this.schema_def.db_type_id#_#this.schema_def.short_code#" name="ret" result="resultInfo">#PreserveSingleQuotes(statement)#</cfquery> + <cfset ArrayAppend(statementArray, statement)> + + <cfif this.schema_def.db_type.simple_name IS "Oracle"> + <!--- Just in case some sneaky person finds a way to delete the intentionally-invalid record, we put one back in after each statement that executes. ---> + <cfquery datasource="#this.schema_def.db_type_id#_#this.schema_def.short_code#"> + INSERT INTO #local.defered_table# VALUES (2) + </cfquery> + </cfif> + + <cfif IsDefined("local.ret")> + <!--- use getMetaData to get column names instead of local.ret.columnNames csv list, since there can be valid columns in the resultset which contain commas in their names ---> + <cfset local.columnArray = getMetaData(local.ret)> + <!--- change null values to the string "(null)" for better display ---> + <cfloop query="local.ret"> + <cfloop array="#local.columnArray#" index="local.colObj"> + <cfset local.NullTest = local.ret.getString(local.colObj.name)> + + <cfif not StructKeyExists(local, "NullTest")> + <cfset local.ret[local.colObj.name][local.ret.currentRow] = "(null)"> + <cfelse> + <cfset structDelete(local, "NullTest")> + </cfif> + </cfloop> + + </cfloop> + + <cfset ArrayAppend(returnVal["sets"], { + succeeded = true, + results = Duplicate(ret), + ExecutionTime = (IsDefined("resultInfo.ExecutionTime") ? resultInfo.ExecutionTime : 0), + ExecutionPlan = ((IsDefined("local.executionPlan") AND IsQuery(local.executionPlan) AND local.executionPlan.recordCount) ? Duplicate(local.executionPlan) : []), + ExecutionPlanRaw = ((IsDefined("local.executionPlanRaw") AND IsQuery(local.executionPlanRaw) AND local.executionPlanRaw.recordCount) ? Duplicate(local.executionPlanRaw) : []) + })> + + <cfelse> + <cfset ArrayAppend(returnVal["sets"], { + succeeded = true, + results = {"DATA" = []}, + ExecutionTime = (IsDefined("resultInfo.ExecutionTime") ? resultInfo.ExecutionTime : 0), + ExecutionPlan = ((IsDefined("local.executionPlan") AND IsQuery(local.executionPlan) AND local.executionPlan.recordCount) ? Duplicate(local.executionPlan) : []), + ExecutionPlanRaw = ((IsDefined("local.executionPlanRaw") AND IsQuery(local.executionPlanRaw) AND local.executionPlanRaw.recordCount) ? Duplicate(local.executionPlanRaw) : []) + })> + </cfif> + + </cfif> + + <cfset StructDelete(local, "executionPlan")> + <cfset StructDelete(local, "ret")> + </cfloop> + + <cfcatch> + + <cfset ArrayAppend(statementArray, statement)> + + <cfif this.schema_def.db_type.simple_name IS "Oracle" AND + FindNoCase("ORA-02290: check constraint (USER_#UCase(this.schema_def.short_code)#.#local.defered_table#_CK) violated", cfcatch.message)> + + <cfset ArrayAppend(returnVal["sets"], { + succeeded = false, + errorMessage = "Explicit commits and DDL (ex: CREATE, DROP, RENAME, or ALTER) are not allowed within the query panel for Oracle. Put DDL in the schema panel instead." + })> + + <cfelseif this.schema_def.db_type.simple_name IS "MySQL" AND + REFindNoCase("^access denied to execute", cfcatch.message)> + + <cfset ArrayAppend(returnVal["sets"], { + succeeded = false, + errorMessage = "DDL and DML statements are not allowed in the query panel for MySQL; only SELECT statements are allowed. Put DDL and DML in the schema panel." + })> + + <cfelse> + + <cfset ArrayAppend(returnVal["sets"], { + succeeded = false, + errorMessage = (IsDefined("cfcatch.queryError") ? (cfcatch.message & ": " & cfcatch.queryError) : cfcatch.message) + })> + + </cfif> + + </cfcatch> + <cffinally> + + <cftransaction action="rollback" /> + + <cfif this.schema_def.db_type.simple_name IS "Oracle"> + + <cfquery datasource="#this.schema_def.db_type_id#_#this.schema_def.short_code#"> + DROP TABLE #local.defered_table# + </cfquery> + + </cfif> + + </cffinally> + + </cftry> + + + </cftransaction> + + + <cfif not local.hasQuerySets> + <cfloop from="1" to="#ArrayLen(returnVal['sets'])#" index="i" > + <cfset tmp= model("Query_Set").create({ + id = i, + query_id = this.id, + schema_def_id = this.schema_def_id, + row_count = (StructKeyExists(returnVal["sets"][i], "results") AND IsQuery(returnVal["sets"][i].results)) ? returnVal["sets"][i].results.recordCount : 0, + execution_time = StructKeyExists(returnVal["sets"][i], "ExecutionTime") ? returnVal["sets"][i].ExecutionTime : 0, + execution_plan = StructKeyExists(returnVal["sets"][i], "ExecutionPlanRaw") ? SerializeJSON(returnVal["sets"][i].ExecutionPlanRaw) : "", + succeeded = returnVal["sets"][i].succeeded ? 1 : 0, + error_message = StructKeyExists(returnVal["sets"][i], "errorMessage") ? returnVal["sets"][i].errorMessage : "", + sql = statementArray[i], + columns_list = (StructKeyExists(returnVal["sets"][i], "results") AND IsQuery(returnVal["sets"][i].results)) ? Left(returnVal["sets"][i].results.columnList, 500) : "" + })> + </cfloop> + </cfif> + + + + </cfif> + + <cfreturn returnVal> + </cffunction> +</cfcomponent> diff --git a/src/main/webapp/models/Query_Set.cfc b/src/main/webapp/models/Query_Set.cfc new file mode 100644 index 0000000..d46d60d --- /dev/null +++ b/src/main/webapp/models/Query_Set.cfc @@ -0,0 +1,9 @@ +<cfcomponent extends="Model"> + <cfscript> + + function init() { + belongsTo(name="Schema_Def", foreignKey="schema_def_id"); + } + + </cfscript> +</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/models/Schema_Def.cfc b/src/main/webapp/models/Schema_Def.cfc new file mode 100644 index 0000000..89c5bf2 --- /dev/null +++ b/src/main/webapp/models/Schema_Def.cfc @@ -0,0 +1,151 @@ +<cfcomponent extends="Model"> + <cfscript> + + function init() { + belongsTo(name="DB_Type", foreignKey="db_type_id"); + belongsTo(name="Host", foreignKey="current_host_id", joinType="outer"); + property(name="dbSimpleName", sql="(select simple_name from db_types where id = db_type_id)"); + } + + + function initialize() + { + + var db_type = model("DB_Type").findByKey(key=this.db_type_id, cache="true"); + + this.last_used = now(); + + if (db_type.context IS "host") // if the context for this schema is anything other than "host", we don't do much on this end + { + var available_host_id = db_type.findAvailableHost().id; + var host = model("Host").findByKey(key=available_host_id, include="DB_Type", cache="true"); + + this.current_host_id = host.id; + + host.initializeDatabase(this.short_code); + host.initializeDSN(this.short_code); + host.initializeSchema(this.short_code, this.ddl, this.statement_separator); + } + this.save(); + + } + + function purgeDatabase(boolean saveAfterPurge = true) + { + if (IsNumeric(this.current_host_id)) + { + var host = model("Host").findByKey(key=this.current_host_id, include="DB_Type"); + + try { + host.dropDSN(this.short_code); + host.dropDatabase(this.short_code); + } + catch (Database dbError) { + // database no longer exists for some reason? + } + + if (arguments.saveAfterPurge) + { + this.current_host_id = ""; + this.save(); + } + } + } + + string function getShortCode(string md5, numeric db_type_id) { + + var tmp_short_code = ""; + var checkShortCodeUniquie = {}; + + if (IsDefined("this.md5") AND not IsDefined(arguments.md5)) + arguments.md5 = this.md5; + + tmp_short_code = Left(arguments.md5, 5); + checkShortCodeUniquie = model("Schema_Def").findOne(where="short_code='#tmp_short_code#' AND db_type_id=#arguments.db_type_id#"); + + while (IsObject(checkShortCodeUniquie)) + { + tmp_short_code = Left(arguments.md5, len(tmp_short_code)+1); + checkShortCodeUniquie = model("Schema_Def").findOne(where="short_code='#tmp_short_code#' AND db_type_id=#arguments.db_type_id#"); + } + return tmp_short_code; + } + </cfscript> + + <cffunction name="getSchemaStructure" returnType="array"> + <cfset var schemaStruct = []> + <cfset var db_type = model("DB_Type").findByKey(key=this.db_type_id, cache="true")> + + <cfif (db_type.context IS "host")><!--- if the context for this schema is anything other than "host", we don't do much on this end---> + + <cfif StructKeyExists(this, "structure_json") AND isJSON(this.structure_json)> + + <cfset schemaStruct = deserializeJSON(this.structure_json)> + + <cfelse> + + + <cfif db_type.simple_name IS "Oracle"> + + <!--- using dbinfo is far too slow for Oracle, since it returns thousands of unneeded system tables ---> + + <cfquery datasource="#this.db_type_id#_#this.short_code#" name="local.tablesList"> + SELECT table_name as table_Name, 'TABLE' as table_Type from all_tables where owner = Upper(<cfqueryparam value="user_#this.short_code#" cfsqltype="cf_sql_varchar">) + UNION + SELECT view_name as table_Name, 'VIEW' as table_Type from all_views where owner = Upper(<cfqueryparam value="user_#this.short_code#" cfsqltype="cf_sql_varchar">) + </cfquery> + + <cfelse> + + <cfdbinfo datasource="#this.db_type_id#_#this.short_code#" type="tables" name="local.tablesList"> + + </cfif> + + + <cfloop query="local.tablesList"> + + <cfif ListFindNoCase("TABLE,VIEW",table_type) AND (db_type.simple_name IS NOT "SQL Server" OR table_schem IS "dbo")> + <cfset local.tableStruct = { + "table_name"= table_Name, + "table_type"= table_Type, + "columns"= [] + }> + + <cfif db_type.simple_name IS "Oracle"> + + <cfquery datasource="#this.db_type_id#_#this.short_code#" name="local.columnsList"> + SELECT column_name, data_type as type_name, DATA_LENGTH as column_size from all_tab_columns where owner = Upper(<cfqueryparam value="user_#this.short_code#" cfsqltype="cf_sql_varchar">) + AND table_name = <cfqueryparam value="#table_name#" cfsqltype="cf_sql_varchar"> + </cfquery> + + <cfelse> + + <cfdbinfo datasource="#this.db_type_id#_#this.short_code#" type="columns" table="#table_name#" name="local.columnsList"> + + </cfif> + + <cfloop query="local.columnsList"> + + <cfset ArrayAppend(local.tableStruct["columns"], { + "name" = column_name, + "type" = "#type_name# (#column_size#)" + })> + + </cfloop> + + <cfset ArrayAppend(schemaStruct, local.tableStruct)> + </cfif> + </cfloop> + + <cfset this.structure_json = serializeJSON(schemaStruct)> + <cfset this.save()> + + </cfif> + + </cfif> + + + <cfreturn schemaStruct> + </cffunction> + +</cfcomponent> diff --git a/src/main/webapp/models/User.cfc b/src/main/webapp/models/User.cfc new file mode 100644 index 0000000..60cad00 --- /dev/null +++ b/src/main/webapp/models/User.cfc @@ -0,0 +1,7 @@ +<cfcomponent extends="Model"> + <cfscript> + function init() { + + } + </cfscript> +</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/models/User_Fiddle.cfc b/src/main/webapp/models/User_Fiddle.cfc new file mode 100644 index 0000000..f5cb9ed --- /dev/null +++ b/src/main/webapp/models/User_Fiddle.cfc @@ -0,0 +1,209 @@ +<cfcomponent extends="Model"> + <cfscript> + function init() { + belongsTo(name="Schema_Def", foreignKey="schema_def_id"); + belongsTo(name="Query", foreignKey="query_id", joinType="outer"); + } + + function logAccess(numeric schema_def_id, query_id = "", last_accessed = now()) { + var succeeded = false; + + if (StructKeyExists(session, "user")) + { + if (IsNumeric(arguments.query_id)) + { + lock timeout="60" name="log_#session.user.id#_#arguments.schema_def_id#_#arguments.query_id#" type="exclusive" + { + local.alreadyExists = model("User_Fiddles").findOne(where="user_id=#session.user.id# AND schema_def_id=#arguments.schema_def_id# AND query_id=#arguments.query_id#"); + if (IsObject(local.alreadyExists)) + { + local.alreadyExists.last_accessed = arguments.last_accessed > local.alreadyExists.last_accessed ? arguments.last_accessed : local.alreadyExists.last_accessed; + local.alreadyExists.num_accesses++; + local.alreadyExists.show_in_history = 1; + succeeded = local.alreadyExists.save(); + } + else + { + succeeded = ! model("User_Fiddles").create({ + "user_id" = session.user.id, + "schema_def_id" = arguments.schema_def_id, + "query_id" = arguments.query_id, + "last_accessed" = arguments.last_accessed, + "show_in_history" = 1 + }).hasErrors(); + } + } + } + else + { + lock timeout="60" name="log_#session.user.id#_#arguments.schema_def_id#" type="exclusive" + { + local.alreadyExists = model("User_Fiddles").findOne(where="user_id=#session.user.id# AND schema_def_id=#arguments.schema_def_id# AND query_id IS NULL"); + if (IsObject(local.alreadyExists)) + { + local.alreadyExists.last_accessed = arguments.last_accessed > local.alreadyExists.last_accessed ? arguments.last_accessed : local.alreadyExists.last_accessed; + local.alreadyExists.num_accesses++; + local.alreadyExists.show_in_history = 1; + succeeded = local.alreadyExists.save(); + } + else + { + succeeded = ! model("User_Fiddles").create({ + "user_id" = session.user.id, + "schema_def_id" = arguments.schema_def_id, + "last_accessed" = arguments.last_accessed, + "show_in_history" = 1 + }).hasErrors(); + } + } + } + } + + return succeeded; + + } + + </cfscript> + + <cffunction name="findFiddles"> + <cfargument name="user_id" type="numeric" required="true"> + + <cfquery name="local.fiddles" datasource="#get('dataSourceName')#"> + SELECT + mySchemas.most_recent_schema_access, + mySchemas.my_query_count, + mySchemas.full_name, + mySchemas.context, + mySchemas.ddl, + cast(mySchemas.db_type_id as varchar) || '/' || mySchemas.short_code as schema_fragment, + mySchemas.db_type_id, + mySchemas.short_code, + mySchemas.schema_def_id, + mySchemas.owner_id, + mySchemas.user_id, + mySchemas.structure_json, + + uf.last_accessed as most_recent_query_access, + uf.favorite, + uf.query_id, + + q.sql as full_sql, + + qs.id as set_id, + qs.row_count, + qs.succeeded, + qs.sql, + qs.error_message, + qs.columns_list + FROM + ( + SELECT + max(uf.last_accessed) as most_recent_schema_access, + count(uf.query_id) as my_query_count, + d.full_name, + d.context, + sd.db_type_id, + sd.short_code, + sd.ddl, + sd.id as schema_def_id, + sd.structure_json, + sd.owner_id, + uf.user_id + FROM + User_Fiddles uf + INNER JOIN Schema_Defs sd ON + uf.schema_def_id = sd.id + INNER JOIN DB_Types d ON + sd.db_type_id = d.id + WHERE + uf.user_id = <cfqueryparam value="#arguments.user_id#" cfsqltype="cf_sql_bigint"> AND + uf.show_in_history = 1 + GROUP BY + d.full_name, + d.context, + sd.db_type_id, + sd.short_code, + sd.ddl, + sd.id, + sd.owner_id, + uf.user_id + HAVING + max(uf.show_in_history) = 1 + ORDER BY + most_recent_schema_access DESC + LIMIT 20 + ) mySchemas + LEFT OUTER JOIN User_Fiddles uf ON + mySchemas.schema_def_id = uf.schema_def_id AND + mySchemas.user_id = uf.user_id AND + uf.query_id IS NOT NULL AND + uf.show_in_history = 1 + + LEFT OUTER JOIN Queries q ON + uf.schema_def_id = q.schema_def_id AND + uf.query_id = q.id + LEFT OUTER JOIN Query_Sets qs ON + uf.schema_def_id = qs.schema_def_id AND + uf.query_id = qs.query_id + + ORDER BY + most_recent_schema_access DESC, + schema_fragment, + most_recent_query_access DESC, + query_id, + qs.id + </cfquery> + + <cfreturn local.fiddles> + </cffunction> + + <cffunction name="findFavorites"> + <cfargument name="user_id" type="numeric" required="true"> + + <cfquery name="local.fiddles" datasource="#get('dataSourceName')#"> + SELECT + uf.schema_def_id, + uf.query_id, + uf.last_accessed, + uf.num_accesses, + + db.full_name, + db.context, + db.id as db_type_id, + + cast(sd.db_type_id as varchar) || '/' || sd.short_code as schema_fragment, + sd.short_code, + sd.owner_id, + sd.structure_json, + sd.ddl, + + q.sql as full_sql, + + qs.id as set_id, + qs.row_count, + qs.succeeded, + qs.sql, + qs.error_message, + qs.columns_list + FROM + User_Fiddles uf + INNER JOIN Queries q ON + uf.query_id = q.id AND + uf.schema_def_id = q.schema_def_id + LEFT OUTER JOIN Query_Sets qs ON + q.schema_def_id = qs.schema_def_id AND + q.id = qs.query_id + INNER JOIN Schema_Defs sd ON + uf.schema_def_id = sd.id + INNER JOIN DB_Types db ON + sd.db_type_id = db.id + WHERE + uf.user_id = <cfqueryparam value="#arguments.user_id#" cfsqltype="cf_sql_bigint"> AND + uf.favorite = 1 + ORDER BY + uf.last_accessed DESC + </cfquery> + + <cfreturn local.fiddles> + </cffunction> +</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/models/Wheels.cfc b/src/main/webapp/models/Wheels.cfc new file mode 100644 index 0000000..ad01ab8 --- /dev/null +++ b/src/main/webapp/models/Wheels.cfc @@ -0,0 +1,7 @@ +<!---
+ This is a model file that Wheels uses internally.
+ Do not delete this file.
+--->
+<cfcomponent output="false" displayName="Model">
+ <cfinclude template="../wheels/model.cfm">
+</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/plugins/CFAdminDSN-0.1.zip b/src/main/webapp/plugins/CFAdminDSN-0.1.zip Binary files differnew file mode 100644 index 0000000..7bc2b4a --- /dev/null +++ b/src/main/webapp/plugins/CFAdminDSN-0.1.zip diff --git a/src/main/webapp/plugins/CFAdminDSN/CFAdminDSN.cfc b/src/main/webapp/plugins/CFAdminDSN/CFAdminDSN.cfc new file mode 100644 index 0000000..bc2548d --- /dev/null +++ b/src/main/webapp/plugins/CFAdminDSN/CFAdminDSN.cfc @@ -0,0 +1,15 @@ +<cfcomponent output="false" mixin="global" hint="Normalizes Admin API usage for creating and deleting datasources between Adobe CF and Railo"> + + + <cffunction name="init"> + <cfset this.version = "1.1,1.1.5,1.1.7,1.1.8"> + <cfreturn this> + </cffunction> + + <cfif StructKeyExists(server, "railo")> + <cfinclude template="railo.cfm"> + <cfelse> + <cfinclude template="adobe.cfm"> + </cfif> + +</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/plugins/CFAdminDSN/adobe.cfm b/src/main/webapp/plugins/CFAdminDSN/adobe.cfm new file mode 100644 index 0000000..61eabeb --- /dev/null +++ b/src/main/webapp/plugins/CFAdminDSN/adobe.cfm @@ -0,0 +1,85 @@ +<cffunction name="setDatasource"> + <cfargument name="adminPassword" type="string" required="true"> + <cfargument name="name" type="string" required="true"> + <cfargument name="class" type="string" required="true"> + <cfargument name="jdbcurl" type="string" required="true"> + <cfargument name="username" type="string" required="true"> + <cfargument name="password" type="string" required="true"> + + <cfargument name="customJDBCArguments" type="string" required="true"> + <cfargument name="timeout" type="numeric" required="true"> + <cfargument name="allowed_select" type="boolean" default="true"> + <cfargument name="allowed_insert" type="boolean" default="true"> + <cfargument name="allowed_update" type="boolean" default="true"> + <cfargument name="allowed_delete" type="boolean" default="true"> + <cfargument name="allowed_alter" type="boolean" default="true"> + <cfargument name="allowed_drop" type="boolean" default="true"> + <cfargument name="allowed_grant" type="boolean" default="true"> + <cfargument name="allowed_create" type="boolean" default="true"> + <cfargument name="allowed_revoke" type="boolean" default="true"> + + <cfargument name="allowed_storedproc" type="boolean" default="true"> + <cfargument name="selectMethod" type="string" default="direct"> + <cfargument name="pooling" type="boolean" default="true"> + <cfargument name="description" type="string" default=""> + + <cfscript> + var stDSN = {}; + + // Required arguments for a data source. + stDSN.name=arguments.name; + stDSN.url = arguments.jdbcurl; + stDSN.class = arguments.class; + stDSN.username = arguments.username; + stDSN.password = arguments.password; + + stDSN.driver = "Other"; + + stDSN.select = arguments.allowed_select; + stDSN.create = arguments.allowed_create; + stDSN.grant = arguments.allowed_grant; + stDSN.insert = arguments.allowed_insert; + stDSN.drop = arguments.allowed_drop; + stDSN.revoke = arguments.allowed_revoke; + stDSN.update = arguments.allowed_update; + stDSN.alter = arguments.allowed_alter; + stDSN.delete = arguments.allowed_delete; + + stDSN.selectMethod = arguments.selectMethod; + stDSN.storedproc = arguments.allowed_storedproc; + stDSN.pooling = arguments.pooling; + stDSN.description = arguments.description; + + getAdminAPIREf(arguments.adminPassword).setOther(argumentCollection=stDSN); + </cfscript> + +</cffunction> + +<cffunction name="deleteDatasource"> + + <cfargument name="adminPassword" type="string" required="true"> + <cfargument name="name" type="string" required="true"> + + <cfscript> + var apiRef = getAdminAPIREf(arguments.adminPassword); + var dsn_list = StructKeyList(apiRef.getDatasources()); + + if (ListFind(dsn_list, arguments.name)) + apiRef.deleteDatasource(arguments.name); + </cfscript> + +</cffunction> + + +<cffunction name="getAdminAPIREf" returnType="CFIDE.adminapi.datasource"> + <cfargument name="adminPassword" type="string" required="true"> + <cfscript> + var myObj = {}; + + createObject("component","CFIDE.adminapi.administrator").login(arguments.adminPassword); + // Instantiate the data source object. + myObj = createObject("component","CFIDE.adminapi.datasource"); + return myObj; + </cfscript> +</cffunction> + diff --git a/src/main/webapp/plugins/CFAdminDSN/index.cfm b/src/main/webapp/plugins/CFAdminDSN/index.cfm new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/main/webapp/plugins/CFAdminDSN/index.cfm diff --git a/src/main/webapp/plugins/CFAdminDSN/railo.cfm b/src/main/webapp/plugins/CFAdminDSN/railo.cfm new file mode 100644 index 0000000..222eb66 --- /dev/null +++ b/src/main/webapp/plugins/CFAdminDSN/railo.cfm @@ -0,0 +1,69 @@ +<cffunction name="setDatasource"> + <cfargument name="adminPassword" type="string" required="true"> + <cfargument name="name" type="string" required="true"> + <cfargument name="class" type="string" required="true"> + <cfargument name="jdbcurl" type="string" required="true"> + <cfargument name="username" type="string" required="true"> + <cfargument name="password" type="string" required="true"> + + <cfargument name="customJDBCArguments" type="string" required="true"> + <cfargument name="timeout" type="numeric" required="true"> + <cfargument name="allowed_select" type="boolean" default="true"> + <cfargument name="allowed_insert" type="boolean" default="true"> + <cfargument name="allowed_update" type="boolean" default="true"> + <cfargument name="allowed_delete" type="boolean" default="true"> + <cfargument name="allowed_alter" type="boolean" default="true"> + <cfargument name="allowed_drop" type="boolean" default="true"> + <cfargument name="allowed_grant" type="boolean" default="true"> + <cfargument name="allowed_create" type="boolean" default="true"> + <cfargument name="allowed_revoke" type="boolean" default="true"> + + <cfargument name="allowed_storedproc" type="boolean" default="true"><!--- not used in Railo ---> + <cfargument name="selectMethod" type="string" default="direct"> <!--- not used in Railo ---> + <cfargument name="pooling" type="boolean" default="true"><!--- not used in Railo ---> + <cfargument name="description" type="string" default=""><!--- not used in Railo ---> + + <cflock name="cfadmin" timeout="30"> + + <cfadmin + action="updateDatasource" + type="web" + password="#arguments.adminPassword#" + classname="#arguments.class#" + newName="#arguments.name#" + name="#arguments.name#" + dsn="#arguments.jdbcurl#" + dbusername="#arguments.username#" + dbpassword="#arguments.password#" + connectionTimeout="#arguments.timeout#" + custom="#arguments.customJDBCArguments#" + allowed_select="#arguments.allowed_select#" + allowed_insert="#arguments.allowed_insert#" + allowed_update="#arguments.allowed_update#" + allowed_delete="#arguments.allowed_delete#" + allowed_alter="#arguments.allowed_alter#" + allowed_drop="#arguments.allowed_drop#" + allowed_revoke="#arguments.allowed_revoke#" + allowed_create="#arguments.allowed_create#" + allowed_grant="#arguments.allowed_grant#"> + </cflock> + + +</cffunction> + +<cffunction name="deleteDatasource"> + + <cfargument name="adminPassword" type="string" required="true"> + <cfargument name="name" type="string" required="true"> + + <cflock name="cfadmin" timeout="30"> + + <cfadmin + action="removeDatasource" + name="#arguments.name#" + type="web" + password="#arguments.adminPassword#"> + + </cflock> + +</cffunction> diff --git a/src/main/webapp/plugins/RequireJS-0.2.1.zip b/src/main/webapp/plugins/RequireJS-0.2.1.zip Binary files differnew file mode 100644 index 0000000..987e74b --- /dev/null +++ b/src/main/webapp/plugins/RequireJS-0.2.1.zip diff --git a/src/main/webapp/plugins/RequireJS/.gitignore b/src/main/webapp/plugins/RequireJS/.gitignore new file mode 100644 index 0000000..001f38b --- /dev/null +++ b/src/main/webapp/plugins/RequireJS/.gitignore @@ -0,0 +1,4 @@ +/optimize_css_output.txt +/optimize_output.txt +/optimize_css_lock.txt +/optimize_js_lock.txt diff --git a/src/main/webapp/plugins/RequireJS/RequireJS.cfc b/src/main/webapp/plugins/RequireJS/RequireJS.cfc new file mode 100644 index 0000000..97b12c4 --- /dev/null +++ b/src/main/webapp/plugins/RequireJS/RequireJS.cfc @@ -0,0 +1,276 @@ +<cfcomponent output="false" mixin="global" hint="Simplify your RequireJS usage and optimization process"> + + <cffunction name="init"> + <cfset this.version = "1.1.7,1.1.8"> + <cfreturn this> + </cffunction> + + <cffunction name="requireStyleTags" output="true"> + <cfargument name="href" type="Array" required="true"> + <cfargument name="outputTarget" type="string" required="false" default="#ListFirst(Replace(CGI.script_name, '/', '_', "ALL"), '.')#.css"> + + <cfset var loc = { output = ""}> + + <cfset arguments.outputTarget = REReplaceNoCase(arguments.outputTarget, ".css$", "")> + + <!--- If we are in test or production and there is no optimize command given, just use the minified css file that exists ---> + <cfif ListFindNoCase("test,production", get("environment")) AND + FileExists("#GetDirectoryFromPath(GetBaseTemplatePath())#stylesheets_min/#arguments.outputTarget#.css") AND + NOT FileExists("#GetDirectoryFromPath(GetBaseTemplatePath())#plugins/RequireJS/optimize_css_lock.txt") AND + NOT ( + ( + StructKeyExists(URL, "reload") && + ( + !StructKeyExists(application, "wheels") || + !StructKeyExists(application.wheels, "reloadPassword") || + !Len(application.wheels.reloadPassword) || + ( + StructKeyExists(URL, "password") && + URL.password IS application.wheels.reloadPassword + ) + ) + ) + AND StructKeyExists(URL, "optimizeRequireJS") + )> + + <cfsavecontent variable="loc.output"><cfoutput><link href="stylesheets_min/#arguments.outputTarget#.css?#DateFormat(Now(), 'yyyymmdd')#" media="all" rel="stylesheet" type="text/css" /></cfoutput></cfsavecontent> + + <cfelse> + + <cfset loc.javaHome = createobject("java", "java.lang.System").getProperty("java.home")> + + <cfif FileExists("#loc.javaHome#/bin/java.exe")> + <cfset loc.javaBin = "#loc.javaHome#/bin/java.exe"> + <cfelse> + <cfset loc.javaBin = "#loc.javaHome#/bin/java"> + </cfif> + + <cfloop from=1 to="#ArrayLen(arguments.href)#" index="loc.i"> + <cfset loc.stylesheetSrc = arguments.href[loc.i]> + + <cfif Lcase(ListLast(loc.stylesheetSrc, '.')) IS "less"> + <!--- less files need to be converted to css first ---> + + <cfdirectory action="list" recurse="true" directory="#GetDirectoryFromPath(GetBaseTemplatePath())#stylesheets" name="loc.ssMetaData" type="file"> + + <cfset loc.ssTimes = { + "css" = CreateDate(2100,1,1), + "less" = CreateDate(1900,1,1) + }> + + <cfset loc.ssFiles = [loc.stylesheetSrc]> + + <cffile action="read" file="#GetDirectoryFromPath(GetBaseTemplatePath())#stylesheets/#loc.stylesheetSrc#" variable="loc.ssContent"> + + <cfset loc.import = ReFindNoCase("@import\s+(.*?);", loc.ssContent, 0, true)> + + <cfloop condition="#ArrayLen(loc.import.pos)# IS 2"> + <cfset loc.importFile = ReReplace(mid(loc.ssContent, loc.import.pos[2], loc.import.len[2]), "(^""|')|(""|'$)", "", "ALL")> + + <cfif Find("/", loc.stylesheetSrc)> + <cfset loc.importFile = GetDirectoryFromPath(loc.stylesheetSrc) & loc.importFile> + </cfif> + + <cfset ArrayAppend(loc.ssFiles, loc.importFile)> + + <cfset loc.import = ReFindNoCase("@import\s+(.*?);", loc.ssContent, loc.import.pos[2], true)> + </cfloop> + + <cfloop query="loc.ssMetaData"> + + <cfloop array="#loc.ssFiles#" index="loc.thisSS"> + + <cfif Replace(directory & "/" & REReplaceNoCase(name, ".(le|c)ss$", ""), "#GetDirectoryFromPath(GetBaseTemplatePath())#stylesheets/","") IS REReplaceNoCase(loc.thisSS, ".less$", "")> + + <!--- If any of the less files we are dealing with have a date greater than the oldest css, then we need to regenerate. + So, we need to find the most recent date associated with each set of our files. ---> + <cfif (LCase(ListLast(name, '.')) IS "less" AND DateCompare(loc.ssTimes[LCase(ListLast(name, '.'))], dateLastModified) LT 0) OR + (LCase(ListLast(name, '.')) IS "css" AND DateCompare(loc.ssTimes[LCase(ListLast(name, '.'))], dateLastModified) GT 0) + > + + <cfset loc.ssTimes[LCase(ListLast(name, '.'))] = dateLastModified> + + </cfif> + + </cfif> + </cfloop> + </cfloop> + + <!--- if the css is older than the less files, it must be out of date and in need of regeneration ---> + <cfif DateCompare(loc.ssTimes["css"], loc.ssTimes["less"]) LT 0> + + <cftry> + <!--- this usually doesn't take too long to do, so we'll do it synchronously instead of in a separate thread ---> + <cfexecute + name="#loc.javaBin#" + arguments="-jar #GetDirectoryFromPath(GetBaseTemplatePath())#plugins/RequireJS/js.jar #GetDirectoryFromPath(GetBaseTemplatePath())#plugins/RequireJS/less-rhino-1.3.0.js #GetDirectoryFromPath(GetBaseTemplatePath())#stylesheets/#loc.stylesheetSrc# #GetDirectoryFromPath(GetBaseTemplatePath())#stylesheets/#REReplace(loc.stylesheetSrc, ".less$", ".css")#" + variable="loc.lessOutput" + timeout="600"></cfexecute> + + <cfset loc.ssTimes['css'] = Now()> + + <cfcatch type="Any"> + + </cfcatch> + + </cftry> + + </cfif><!--- end if the css was outdated ---> + + <cfset arguments.href[loc.i] = REReplaceNoCase(loc.stylesheetSrc, "\.less$", ".css")> + + </cfif> <!--- end if the file is a .less file ---> + + </cfloop><!--- end loop through stylesheets ---> + + + <!--- + If we are in test or production, we would only be in this section of code if we + have been passed a proper reload/optimizeRequireJS combo, or if the minimized css output + file doesn't exist. + + We won't run this code, however, if there is a lock file indicating the optimization thread is still running. + ---> + <cfif + ListFindNoCase("test,production", get("environment")) AND + ( + ( + ( + StructKeyExists(URL, "reload") && + ( + !StructKeyExists(application, "wheels") || + !StructKeyExists(application.wheels, "reloadPassword") || + !Len(application.wheels.reloadPassword) || + ( + StructKeyExists(URL, "password") && + URL.password IS application.wheels.reloadPassword + ) + ) + ) + AND StructKeyExists(URL, "optimizeRequireJS") + ) + OR + ( + NOT FileExists("#GetDirectoryFromPath(GetBaseTemplatePath())#stylesheets_min/#arguments.outputTarget#.css") + ) + ) AND + NOT FileExists("#GetDirectoryFromPath(GetBaseTemplatePath())#plugins/RequireJS/optimize_css_lock.txt") + > + + <cfthread name="cssOptimizer" action="run" loc="#loc#" href="#arguments.href#" outputTarget="#arguments.outputTarget#"> + + <cffile action="write" file="#GetDirectoryFromPath(GetBaseTemplatePath())#plugins/RequireJS/optimize_css_lock.txt" output="#now()#"> + <cffile action="delete" file="#GetDirectoryFromPath(GetBaseTemplatePath())#stylesheets_min/#outputTarget#.css"> + + <cftry> + + <cfloop from=1 to="#ArrayLen(href)#" index="loc.i"> + + <cfexecute + name="#loc.javaBin#" + arguments="-classpath #GetDirectoryFromPath(GetBaseTemplatePath())#plugins/RequireJS/js.jar org.mozilla.javascript.tools.shell.Main #GetDirectoryFromPath(GetBaseTemplatePath())#plugins/RequireJS/r.js -o cssIn='#GetDirectoryFromPath(GetBaseTemplatePath())#stylesheets/#href[loc.i]#' out='#GetDirectoryFromPath(GetBaseTemplatePath())#stylesheets_min/#href[loc.i]#' optimizeCss=default" + outputfile="#GetDirectoryFromPath(GetBaseTemplatePath())#plugins/RequireJS/optimize_css_output.txt" + timeout="600"></cfexecute> + + <cffile action="read" file="#GetDirectoryFromPath(GetBaseTemplatePath())#stylesheets_min/#href[loc.i]#" variable="loc.cssContent"> + <cffile action="append" file="#GetDirectoryFromPath(GetBaseTemplatePath())#stylesheets_min/#outputTarget#.css" output="#loc.cssContent#" addNewLine=true> + + </cfloop> + + <cfcatch type="any"> + <cffile action="write" file="#GetDirectoryFromPath(GetBaseTemplatePath())#plugins/RequireJS/optimize_css_output.txt" output="#cfcatch.message#"> + </cfcatch> + + </cftry> + + <cffile action="delete" file="#GetDirectoryFromPath(GetBaseTemplatePath())#plugins/RequireJS/optimize_css_lock.txt"> + + </cfthread> + + </cfif> + + <!--- + We must either be in design/development mode, + or in the process of rebuilding the optimized CSS file. + ---> + + <cfloop from=1 to="#ArrayLen(arguments.href)#" index="loc.i"> + <cfsavecontent variable="loc.linkTag"><cfoutput><link href="stylesheets/#arguments.href[loc.i]#" media="all" rel="stylesheet" type="text/css" /></cfoutput></cfsavecontent> + <cfset loc.output = loc.output & loc.linkTag> + </cfloop> + + </cfif> + + <cfreturn loc.output> + + </cffunction> + + <cffunction name="requirejsTag"> + <cfargument name="src" type="string" default="plugins/RequireJS/require.js"> + <cfargument name="main" type="string" default="main"> + <cfargument name="build" type="string" default="plugins/RequireJS/build.js"> + + <cfset var loc = {}> + <cfif ListFindNoCase("test,production", get("environment"))> + + <cfdirectory action="list" directory="#GetDirectoryFromPath(GetBaseTemplatePath())#plugins/RequireJS" name="local.hasLock" filter="optimize_js_lock.txt"> + + <cfif not local.hasLock.recordCount> + <cfset loc.basePath = "javascripts_min/"> + <cfelse> + <!--- use the non-optimized javascript while the optimized version is being built ---> + <cfset loc.basePath = "javascripts/"> + </cfif> + + <!--- if we're in test or production, and the app has just been reloaded, then we are going to rebuild this particular main config file ---> + <cfif (StructKeyExists(URL, "reload") && (!StructKeyExists(application, "wheels") || !StructKeyExists(application.wheels, "reloadPassword") || !Len(application.wheels.reloadPassword) || (StructKeyExists(URL, "password") && URL.password IS application.wheels.reloadPassword))) + AND StructKeyExists(URL, "optimizeRequireJS")> + + <!--- only attempt to rebuild the JS code when there is no js lock file ---> + <cfif not local.hasLock.recordCount> + + <cfset loc.basePath = "javascripts/"> + <cfset loc.build = arguments.build> + + <cfthread name="jsOptimizer" action="run" loc="#loc#"> + + <cffile action="write" file="#GetDirectoryFromPath(GetBaseTemplatePath())#plugins/RequireJS/optimize_js_lock.txt" output="#now()#"> + + <cfset loc.javaHome = createobject("java", "java.lang.System").getProperty("java.home")> + <cftry> + <cfif FileExists("#loc.javaHome#/bin/java.exe")> + <cfset loc.javaBin = "#loc.javaHome#/bin/java.exe"> + <cfelse> + <cfset loc.javaBin = "#loc.javaHome#/bin/java"> + </cfif> + <cfexecute + name="#loc.javaBin#" + arguments="-classpath #GetDirectoryFromPath(GetBaseTemplatePath())#plugins/RequireJS/js.jar org.mozilla.javascript.tools.shell.Main #GetDirectoryFromPath(GetBaseTemplatePath())#plugins/RequireJS/r.js -o #GetDirectoryFromPath(GetBaseTemplatePath())##loc.build#" + outputfile="#GetDirectoryFromPath(GetBaseTemplatePath())#plugins/RequireJS/optimize_output.txt" + timeout="600"></cfexecute> + + <cfcatch type="any"> + <cffile action="write" file="#GetDirectoryFromPath(GetBaseTemplatePath())#plugins/RequireJS/optimize_output.txt" output="#cfcatch.message#"> + </cfcatch> + + </cftry> + + <cffile action="delete" file="#GetDirectoryFromPath(GetBaseTemplatePath())#plugins/RequireJS/optimize_js_lock.txt"> + + </cfthread> + + </cfif> + </cfif> + + <cfelse> + <cfset loc.basePath = "javascripts/"> + </cfif> + <cfsavecontent variable="loc.scriptTag" > + <cfoutput> + <script type="text/javascript" src="#arguments.src#" data-main="#loc.basePath##arguments.main#"></script> + </cfoutput> + </cfsavecontent> + <cfreturn loc.scriptTag> + </cffunction> + +</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/plugins/RequireJS/build.js b/src/main/webapp/plugins/RequireJS/build.js new file mode 100644 index 0000000..364ce18 --- /dev/null +++ b/src/main/webapp/plugins/RequireJS/build.js @@ -0,0 +1,11 @@ +({ + appDir: "../../javascripts", + baseUrl: ".", + dir: "../../javascripts_min", + mainConfigFile: "../../javascripts/main.js", + modules: [ + { + name: "main" + } + ] +})
\ No newline at end of file diff --git a/src/main/webapp/plugins/RequireJS/index.cfm b/src/main/webapp/plugins/RequireJS/index.cfm new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/main/webapp/plugins/RequireJS/index.cfm diff --git a/src/main/webapp/plugins/RequireJS/js.jar b/src/main/webapp/plugins/RequireJS/js.jar Binary files differnew file mode 100644 index 0000000..878b0d9 --- /dev/null +++ b/src/main/webapp/plugins/RequireJS/js.jar diff --git a/src/main/webapp/plugins/RequireJS/less-rhino-1.3.0.js b/src/main/webapp/plugins/RequireJS/less-rhino-1.3.0.js new file mode 100644 index 0000000..934936d --- /dev/null +++ b/src/main/webapp/plugins/RequireJS/less-rhino-1.3.0.js @@ -0,0 +1,3657 @@ +// +// Stub out `require` in rhino +// +function require(arg) { + return less[arg.split('/')[1]]; +}; + + +// ecma-5.js +// +// -- kriskowal Kris Kowal Copyright (C) 2009-2010 MIT License +// -- tlrobinson Tom Robinson +// dantman Daniel Friesen + +// +// Array +// +if (!Array.isArray) { + Array.isArray = function(obj) { + return Object.prototype.toString.call(obj) === "[object Array]" || + (obj instanceof Array); + }; +} +if (!Array.prototype.forEach) { + Array.prototype.forEach = function(block, thisObject) { + var len = this.length >>> 0; + for (var i = 0; i < len; i++) { + if (i in this) { + block.call(thisObject, this[i], i, this); + } + } + }; +} +if (!Array.prototype.map) { + Array.prototype.map = function(fun /*, thisp*/) { + var len = this.length >>> 0; + var res = new Array(len); + var thisp = arguments[1]; + + for (var i = 0; i < len; i++) { + if (i in this) { + res[i] = fun.call(thisp, this[i], i, this); + } + } + return res; + }; +} +if (!Array.prototype.filter) { + Array.prototype.filter = function (block /*, thisp */) { + var values = []; + var thisp = arguments[1]; + for (var i = 0; i < this.length; i++) { + if (block.call(thisp, this[i])) { + values.push(this[i]); + } + } + return values; + }; +} +if (!Array.prototype.reduce) { + Array.prototype.reduce = function(fun /*, initial*/) { + var len = this.length >>> 0; + var i = 0; + + // no value to return if no initial value and an empty array + if (len === 0 && arguments.length === 1) throw new TypeError(); + + if (arguments.length >= 2) { + var rv = arguments[1]; + } else { + do { + if (i in this) { + rv = this[i++]; + break; + } + // if array contains no values, no initial value to return + if (++i >= len) throw new TypeError(); + } while (true); + } + for (; i < len; i++) { + if (i in this) { + rv = fun.call(null, rv, this[i], i, this); + } + } + return rv; + }; +} +if (!Array.prototype.indexOf) { + Array.prototype.indexOf = function (value /*, fromIndex */ ) { + var length = this.length; + var i = arguments[1] || 0; + + if (!length) return -1; + if (i >= length) return -1; + if (i < 0) i += length; + + for (; i < length; i++) { + if (!Object.prototype.hasOwnProperty.call(this, i)) { continue } + if (value === this[i]) return i; + } + return -1; + }; +} + +// +// Object +// +if (!Object.keys) { + Object.keys = function (object) { + var keys = []; + for (var name in object) { + if (Object.prototype.hasOwnProperty.call(object, name)) { + keys.push(name); + } + } + return keys; + }; +} + +// +// String +// +if (!String.prototype.trim) { + String.prototype.trim = function () { + return String(this).replace(/^\s\s*/, '').replace(/\s\s*$/, ''); + }; +} +var less, tree; + +if (typeof environment === "object" && ({}).toString.call(environment) === "[object Environment]") { + // Rhino + // Details on how to detect Rhino: https://github.com/ringo/ringojs/issues/88 + if (typeof(window) === 'undefined') { less = {} } + else { less = window.less = {} } + tree = less.tree = {}; + less.mode = 'rhino'; +} else if (typeof(window) === 'undefined') { + // Node.js + less = exports, + tree = require('./tree'); + less.mode = 'node'; +} else { + // Browser + if (typeof(window.less) === 'undefined') { window.less = {} } + less = window.less, + tree = window.less.tree = {}; + less.mode = 'browser'; +} +// +// less.js - parser +// +// A relatively straight-forward predictive parser. +// There is no tokenization/lexing stage, the input is parsed +// in one sweep. +// +// To make the parser fast enough to run in the browser, several +// optimization had to be made: +// +// - Matching and slicing on a huge input is often cause of slowdowns. +// The solution is to chunkify the input into smaller strings. +// The chunks are stored in the `chunks` var, +// `j` holds the current chunk index, and `current` holds +// the index of the current chunk in relation to `input`. +// This gives us an almost 4x speed-up. +// +// - In many cases, we don't need to match individual tokens; +// for example, if a value doesn't hold any variables, operations +// or dynamic references, the parser can effectively 'skip' it, +// treating it as a literal. +// An example would be '1px solid #000' - which evaluates to itself, +// we don't need to know what the individual components are. +// The drawback, of course is that you don't get the benefits of +// syntax-checking on the CSS. This gives us a 50% speed-up in the parser, +// and a smaller speed-up in the code-gen. +// +// +// Token matching is done with the `$` function, which either takes +// a terminal string or regexp, or a non-terminal function to call. +// It also takes care of moving all the indices forwards. +// +// +less.Parser = function Parser(env) { + var input, // LeSS input string + i, // current index in `input` + j, // current chunk + temp, // temporarily holds a chunk's state, for backtracking + memo, // temporarily holds `i`, when backtracking + furthest, // furthest index the parser has gone to + chunks, // chunkified input + current, // index of current chunk, in `input` + parser; + + var that = this; + + // Top parser on an import tree must be sure there is one "env" + // which will then be passed arround by reference. + var env = env || { }; + if (!env.contents) { env.contents={}; } // env.contents must be passed arround with top env + + // This function is called after all files + // have been imported through `@import`. + var finish = function () {}; + + var imports = this.imports = { + paths: env && env.paths || [], // Search paths, when importing + queue: [], // Files which haven't been imported yet + files: {}, // Holds the imported parse trees + contents: env.contents, // Holds the imported file contents + mime: env && env.mime, // MIME type of .less files + error: null, // Error in parsing/evaluating an import + push: function (path, callback) { + var that = this; + this.queue.push(path); + + // + // Import a file asynchronously + // + less.Parser.importer(path, this.paths, function (e, root) { + that.queue.splice(that.queue.indexOf(path), 1); // Remove the path from the queue + + var imported = path in that.files; + + that.files[path] = root; // Store the root + + if (e && !that.error) { that.error = e } + + callback(e, root, imported); + + if (that.queue.length === 0) { finish(e) } // Call `finish` if we're done importing + }, env); + } + }; + + function save() { temp = chunks[j], memo = i, current = i } + function restore() { chunks[j] = temp, i = memo, current = i } + + function sync() { + if (i > current) { + chunks[j] = chunks[j].slice(i - current); + current = i; + } + } + function isWhitespace(c) { + // Could change to \s? + var code = c.charCodeAt(0); + return code === 32 || code === 10 || code === 9; + } + // + // Parse from a token, regexp or string, and move forward if match + // + function $(tok) { + var match, args, length, index, k; + + // + // Non-terminal + // + if (tok instanceof Function) { + return tok.call(parser.parsers); + // + // Terminal + // + // Either match a single character in the input, + // or match a regexp in the current chunk (chunk[j]). + // + } else if (typeof(tok) === 'string') { + match = input.charAt(i) === tok ? tok : null; + length = 1; + sync (); + } else { + sync (); + + if (match = tok.exec(chunks[j])) { + length = match[0].length; + } else { + return null; + } + } + + // The match is confirmed, add the match length to `i`, + // and consume any extra white-space characters (' ' || '\n') + // which come after that. The reason for this is that LeSS's + // grammar is mostly white-space insensitive. + // + if (match) { + skipWhitespace(length); + + if(typeof(match) === 'string') { + return match; + } else { + return match.length === 1 ? match[0] : match; + } + } + } + + function skipWhitespace(length) { + var oldi = i, oldj = j, + endIndex = i + chunks[j].length, + mem = i += length; + + while (i < endIndex) { + if (! isWhitespace(input.charAt(i))) { break } + i++; + } + chunks[j] = chunks[j].slice(length + (i - mem)); + current = i; + + if (chunks[j].length === 0 && j < chunks.length - 1) { j++ } + + return oldi !== i || oldj !== j; + } + + function expect(arg, msg) { + var result = $(arg); + if (! result) { + error(msg || (typeof(arg) === 'string' ? "expected '" + arg + "' got '" + input.charAt(i) + "'" + : "unexpected token")); + } else { + return result; + } + } + + function error(msg, type) { + throw { index: i, type: type || 'Syntax', message: msg }; + } + + // Same as $(), but don't change the state of the parser, + // just return the match. + function peek(tok) { + if (typeof(tok) === 'string') { + return input.charAt(i) === tok; + } else { + if (tok.test(chunks[j])) { + return true; + } else { + return false; + } + } + } + + function getInput(e, env) { + if (e.filename && env.filename && (e.filename !== env.filename)) { + return parser.imports.contents[e.filename]; + } else { + return input; + } + } + + function getLocation(index, input) { + for (var n = index, column = -1; + n >= 0 && input.charAt(n) !== '\n'; + n--) { column++ } + + return { line: typeof(index) === 'number' ? (input.slice(0, index).match(/\n/g) || "").length : null, + column: column }; + } + + function LessError(e, env) { + var input = getInput(e, env), + loc = getLocation(e.index, input), + line = loc.line, + col = loc.column, + lines = input.split('\n'); + + this.type = e.type || 'Syntax'; + this.message = e.message; + this.filename = e.filename || env.filename; + this.index = e.index; + this.line = typeof(line) === 'number' ? line + 1 : null; + this.callLine = e.call && (getLocation(e.call, input).line + 1); + this.callExtract = lines[getLocation(e.call, input).line]; + this.stack = e.stack; + this.column = col; + this.extract = [ + lines[line - 1], + lines[line], + lines[line + 1] + ]; + } + + this.env = env = env || {}; + + // The optimization level dictates the thoroughness of the parser, + // the lower the number, the less nodes it will create in the tree. + // This could matter for debugging, or if you want to access + // the individual nodes in the tree. + this.optimization = ('optimization' in this.env) ? this.env.optimization : 1; + + this.env.filename = this.env.filename || null; + + // + // The Parser + // + return parser = { + + imports: imports, + // + // Parse an input string into an abstract syntax tree, + // call `callback` when done. + // + parse: function (str, callback) { + var root, start, end, zone, line, lines, buff = [], c, error = null; + + i = j = current = furthest = 0; + input = str.replace(/\r\n/g, '\n'); + + // Remove potential UTF Byte Order Mark + input = input.replace(/^\uFEFF/, ''); + + // Split the input into chunks. + chunks = (function (chunks) { + var j = 0, + skip = /(?:@\{[\w-]+\}|[^"'`\{\}\/\(\)\\])+/g, + comment = /\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g, + string = /"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`]|\\.)*)`/g, + level = 0, + match, + chunk = chunks[0], + inParam; + + for (var i = 0, c, cc; i < input.length; i++) { + skip.lastIndex = i; + if (match = skip.exec(input)) { + if (match.index === i) { + i += match[0].length; + chunk.push(match[0]); + } + } + c = input.charAt(i); + comment.lastIndex = string.lastIndex = i; + + if (match = string.exec(input)) { + if (match.index === i) { + i += match[0].length; + chunk.push(match[0]); + c = input.charAt(i); + } + } + + if (!inParam && c === '/') { + cc = input.charAt(i + 1); + if (cc === '/' || cc === '*') { + if (match = comment.exec(input)) { + if (match.index === i) { + i += match[0].length; + chunk.push(match[0]); + c = input.charAt(i); + } + } + } + } + + switch (c) { + case '{': if (! inParam) { level ++; chunk.push(c); break } + case '}': if (! inParam) { level --; chunk.push(c); chunks[++j] = chunk = []; break } + case '(': if (! inParam) { inParam = true; chunk.push(c); break } + case ')': if ( inParam) { inParam = false; chunk.push(c); break } + default: chunk.push(c); + } + } + if (level > 0) { + error = new(LessError)({ + index: i, + type: 'Parse', + message: "missing closing `}`", + filename: env.filename + }, env); + } + + return chunks.map(function (c) { return c.join('') });; + })([[]]); + + if (error) { + return callback(error); + } + + // Start with the primary rule. + // The whole syntax tree is held under a Ruleset node, + // with the `root` property set to true, so no `{}` are + // output. The callback is called when the input is parsed. + try { + root = new(tree.Ruleset)([], $(this.parsers.primary)); + root.root = true; + } catch (e) { + return callback(new(LessError)(e, env)); + } + + root.toCSS = (function (evaluate) { + var line, lines, column; + + return function (options, variables) { + var frames = [], importError; + + options = options || {}; + // + // Allows setting variables with a hash, so: + // + // `{ color: new(tree.Color)('#f01') }` will become: + // + // new(tree.Rule)('@color', + // new(tree.Value)([ + // new(tree.Expression)([ + // new(tree.Color)('#f01') + // ]) + // ]) + // ) + // + if (typeof(variables) === 'object' && !Array.isArray(variables)) { + variables = Object.keys(variables).map(function (k) { + var value = variables[k]; + + if (! (value instanceof tree.Value)) { + if (! (value instanceof tree.Expression)) { + value = new(tree.Expression)([value]); + } + value = new(tree.Value)([value]); + } + return new(tree.Rule)('@' + k, value, false, 0); + }); + frames = [new(tree.Ruleset)(null, variables)]; + } + + try { + var css = evaluate.call(this, { frames: frames }) + .toCSS([], { compress: options.compress || false }); + } catch (e) { + throw new(LessError)(e, env); + } + + if ((importError = parser.imports.error)) { // Check if there was an error during importing + if (importError instanceof LessError) throw importError; + else throw new(LessError)(importError, env); + } + + if (options.yuicompress && less.mode === 'node') { + return require('./cssmin').compressor.cssmin(css); + } else if (options.compress) { + return css.replace(/(\s)+/g, "$1"); + } else { + return css; + } + }; + })(root.eval); + + // If `i` is smaller than the `input.length - 1`, + // it means the parser wasn't able to parse the whole + // string, so we've got a parsing error. + // + // We try to extract a \n delimited string, + // showing the line where the parse error occured. + // We split it up into two parts (the part which parsed, + // and the part which didn't), so we can color them differently. + if (i < input.length - 1) { + i = furthest; + lines = input.split('\n'); + line = (input.slice(0, i).match(/\n/g) || "").length + 1; + + for (var n = i, column = -1; n >= 0 && input.charAt(n) !== '\n'; n--) { column++ } + + error = { + type: "Parse", + message: "Syntax Error on line " + line, + index: i, + filename: env.filename, + line: line, + column: column, + extract: [ + lines[line - 2], + lines[line - 1], + lines[line] + ] + }; + } + + if (this.imports.queue.length > 0) { + finish = function (e) { + if (e) callback(e); + else callback(null, root); + }; + } else { + callback(error, root); + } + }, + + // + // Here in, the parsing rules/functions + // + // The basic structure of the syntax tree generated is as follows: + // + // Ruleset -> Rule -> Value -> Expression -> Entity + // + // Here's some LESS code: + // + // .class { + // color: #fff; + // border: 1px solid #000; + // width: @w + 4px; + // > .child {...} + // } + // + // And here's what the parse tree might look like: + // + // Ruleset (Selector '.class', [ + // Rule ("color", Value ([Expression [Color #fff]])) + // Rule ("border", Value ([Expression [Dimension 1px][Keyword "solid"][Color #000]])) + // Rule ("width", Value ([Expression [Operation "+" [Variable "@w"][Dimension 4px]]])) + // Ruleset (Selector [Element '>', '.child'], [...]) + // ]) + // + // In general, most rules will try to parse a token with the `$()` function, and if the return + // value is truly, will return a new node, of the relevant type. Sometimes, we need to check + // first, before parsing, that's when we use `peek()`. + // + parsers: { + // + // The `primary` rule is the *entry* and *exit* point of the parser. + // The rules here can appear at any level of the parse tree. + // + // The recursive nature of the grammar is an interplay between the `block` + // rule, which represents `{ ... }`, the `ruleset` rule, and this `primary` rule, + // as represented by this simplified grammar: + // + // primary → (ruleset | rule)+ + // ruleset → selector+ block + // block → '{' primary '}' + // + // Only at one point is the primary rule not called from the + // block rule: at the root level. + // + primary: function () { + var node, root = []; + + while ((node = $(this.mixin.definition) || $(this.rule) || $(this.ruleset) || + $(this.mixin.call) || $(this.comment) || $(this.directive)) + || $(/^[\s\n]+/)) { + node && root.push(node); + } + return root; + }, + + // We create a Comment node for CSS comments `/* */`, + // but keep the LeSS comments `//` silent, by just skipping + // over them. + comment: function () { + var comment; + + if (input.charAt(i) !== '/') return; + + if (input.charAt(i + 1) === '/') { + return new(tree.Comment)($(/^\/\/.*/), true); + } else if (comment = $(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/)) { + return new(tree.Comment)(comment); + } + }, + + // + // Entities are tokens which can be found inside an Expression + // + entities: { + // + // A string, which supports escaping " and ' + // + // "milky way" 'he\'s the one!' + // + quoted: function () { + var str, j = i, e; + + if (input.charAt(j) === '~') { j++, e = true } // Escaped strings + if (input.charAt(j) !== '"' && input.charAt(j) !== "'") return; + + e && $('~'); + + if (str = $(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/)) { + return new(tree.Quoted)(str[0], str[1] || str[2], e); + } + }, + + // + // A catch-all word, such as: + // + // black border-collapse + // + keyword: function () { + var k; + + if (k = $(/^[_A-Za-z-][_A-Za-z0-9-]*/)) { + if (tree.colors.hasOwnProperty(k)) { + // detect named color + return new(tree.Color)(tree.colors[k].slice(1)); + } else { + return new(tree.Keyword)(k); + } + } + }, + + // + // A function call + // + // rgb(255, 0, 255) + // + // We also try to catch IE's `alpha()`, but let the `alpha` parser + // deal with the details. + // + // The arguments are parsed with the `entities.arguments` parser. + // + call: function () { + var name, nameLC, args, alpha_ret, index = i; + + if (! (name = /^([\w-]+|%|progid:[\w\.]+)\(/.exec(chunks[j]))) return; + + name = name[1]; + nameLC = name.toLowerCase(); + + if (nameLC === 'url') { return null } + else { i += name.length } + + if (nameLC === 'alpha') { + alpha_ret = $(this.alpha); + if(typeof alpha_ret !== 'undefined') { + return alpha_ret; + } + } + + $('('); // Parse the '(' and consume whitespace. + + args = $(this.entities.arguments); + + if (! $(')')) return; + + if (name) { return new(tree.Call)(name, args, index, env.filename) } + }, + arguments: function () { + var args = [], arg; + + while (arg = $(this.entities.assignment) || $(this.expression)) { + args.push(arg); + if (! $(',')) { break } + } + return args; + }, + literal: function () { + return $(this.entities.ratio) || + $(this.entities.dimension) || + $(this.entities.color) || + $(this.entities.quoted); + }, + + // Assignments are argument entities for calls. + // They are present in ie filter properties as shown below. + // + // filter: progid:DXImageTransform.Microsoft.Alpha( *opacity=50* ) + // + + assignment: function () { + var key, value; + if ((key = $(/^\w+(?=\s?=)/i)) && $('=') && (value = $(this.entity))) { + return new(tree.Assignment)(key, value); + } + }, + + // + // Parse url() tokens + // + // We use a specific rule for urls, because they don't really behave like + // standard function calls. The difference is that the argument doesn't have + // to be enclosed within a string, so it can't be parsed as an Expression. + // + url: function () { + var value; + + if (input.charAt(i) !== 'u' || !$(/^url\(/)) return; + value = $(this.entities.quoted) || $(this.entities.variable) || + $(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/) || ""; + + expect(')'); + + return new(tree.URL)((value.value != null || value instanceof tree.Variable) + ? value : new(tree.Anonymous)(value), imports.paths); + }, + + // + // A Variable entity, such as `@fink`, in + // + // width: @fink + 2px + // + // We use a different parser for variable definitions, + // see `parsers.variable`. + // + variable: function () { + var name, index = i; + + if (input.charAt(i) === '@' && (name = $(/^@@?[\w-]+/))) { + return new(tree.Variable)(name, index, env.filename); + } + }, + + // A variable entity useing the protective {} e.g. @{var} + variableCurly: function () { + var name, curly, index = i; + + if (input.charAt(i) === '@' && (curly = $(/^@\{([\w-]+)\}/))) { + return new(tree.Variable)("@" + curly[1], index, env.filename); + } + }, + + // + // A Hexadecimal color + // + // #4F3C2F + // + // `rgb` and `hsl` colors are parsed through the `entities.call` parser. + // + color: function () { + var rgb; + + if (input.charAt(i) === '#' && (rgb = $(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/))) { + return new(tree.Color)(rgb[1]); + } + }, + + // + // A Dimension, that is, a number and a unit + // + // 0.5em 95% + // + dimension: function () { + var value, c = input.charCodeAt(i); + if ((c > 57 || c < 45) || c === 47) return; + + if (value = $(/^(-?\d*\.?\d+)(px|%|em|pc|ex|in|deg|s|ms|pt|cm|mm|rad|grad|turn|dpi|dpcm|dppx|rem|vw|vh|vmin|vm|ch)?/)) { + return new(tree.Dimension)(value[1], value[2]); + } + }, + + // + // A Ratio + // + // 16/9 + // + ratio: function () { + var value, c = input.charCodeAt(i); + if (c > 57 || c < 48) return; + + if (value = $(/^(\d+\/\d+)/)) { + return new(tree.Ratio)(value[1]); + } + }, + + // + // JavaScript code to be evaluated + // + // `window.location.href` + // + javascript: function () { + var str, j = i, e; + + if (input.charAt(j) === '~') { j++, e = true } // Escaped strings + if (input.charAt(j) !== '`') { return } + + e && $('~'); + + if (str = $(/^`([^`]*)`/)) { + return new(tree.JavaScript)(str[1], i, e); + } + } + }, + + // + // The variable part of a variable definition. Used in the `rule` parser + // + // @fink: + // + variable: function () { + var name; + + if (input.charAt(i) === '@' && (name = $(/^(@[\w-]+)\s*:/))) { return name[1] } + }, + + // + // A font size/line-height shorthand + // + // small/12px + // + // We need to peek first, or we'll match on keywords and dimensions + // + shorthand: function () { + var a, b; + + if (! peek(/^[@\w.%-]+\/[@\w.-]+/)) return; + + save(); + + if ((a = $(this.entity)) && $('/') && (b = $(this.entity))) { + return new(tree.Shorthand)(a, b); + } + + restore(); + }, + + // + // Mixins + // + mixin: { + // + // A Mixin call, with an optional argument list + // + // #mixins > .square(#fff); + // .rounded(4px, black); + // .button; + // + // The `while` loop is there because mixins can be + // namespaced, but we only support the child and descendant + // selector for now. + // + call: function () { + var elements = [], e, c, args = [], arg, index = i, s = input.charAt(i), name, value, important = false; + + if (s !== '.' && s !== '#') { return } + + save(); // stop us absorbing part of an invalid selector + + while (e = $(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)) { + elements.push(new(tree.Element)(c, e, i)); + c = $('>'); + } + if ($('(')) { + while (arg = $(this.expression)) { + value = arg; + name = null; + + // Variable + if (arg.value.length == 1) { + var val = arg.value[0]; + if (val instanceof tree.Variable) { + if ($(':')) { + if (value = $(this.expression)) { + name = val.name; + } else { + throw new(Error)("Expected value"); + } + } + } + } + + args.push({ name: name, value: value }); + + if (! $(',')) { break } + } + if (! $(')')) throw new(Error)("Expected )"); + } + + if ($(this.important)) { + important = true; + } + + if (elements.length > 0 && ($(';') || peek('}'))) { + return new(tree.mixin.Call)(elements, args, index, env.filename, important); + } + + restore(); + }, + + // + // A Mixin definition, with a list of parameters + // + // .rounded (@radius: 2px, @color) { + // ... + // } + // + // Until we have a finer grained state-machine, we have to + // do a look-ahead, to make sure we don't have a mixin call. + // See the `rule` function for more information. + // + // We start by matching `.rounded (`, and then proceed on to + // the argument list, which has optional default values. + // We store the parameters in `params`, with a `value` key, + // if there is a value, such as in the case of `@radius`. + // + // Once we've got our params list, and a closing `)`, we parse + // the `{...}` block. + // + definition: function () { + var name, params = [], match, ruleset, param, value, cond, variadic = false; + if ((input.charAt(i) !== '.' && input.charAt(i) !== '#') || + peek(/^[^{]*(;|})/)) return; + + save(); + + if (match = $(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)) { + name = match[1]; + + do { + if (input.charAt(i) === '.' && $(/^\.{3}/)) { + variadic = true; + break; + } else if (param = $(this.entities.variable) || $(this.entities.literal) + || $(this.entities.keyword)) { + // Variable + if (param instanceof tree.Variable) { + if ($(':')) { + value = expect(this.expression, 'expected expression'); + params.push({ name: param.name, value: value }); + } else if ($(/^\.{3}/)) { + params.push({ name: param.name, variadic: true }); + variadic = true; + break; + } else { + params.push({ name: param.name }); + } + } else { + params.push({ value: param }); + } + } else { + break; + } + } while ($(',')) + + // .mixincall("@{a}"); + // looks a bit like a mixin definition.. so we have to be nice and restore + if (!$(')')) { + furthest = i; + restore(); + } + + if ($(/^when/)) { // Guard + cond = expect(this.conditions, 'expected condition'); + } + + ruleset = $(this.block); + + if (ruleset) { + return new(tree.mixin.Definition)(name, params, ruleset, cond, variadic); + } else { + restore(); + } + } + } + }, + + // + // Entities are the smallest recognized token, + // and can be found inside a rule's value. + // + entity: function () { + return $(this.entities.literal) || $(this.entities.variable) || $(this.entities.url) || + $(this.entities.call) || $(this.entities.keyword) || $(this.entities.javascript) || + $(this.comment); + }, + + // + // A Rule terminator. Note that we use `peek()` to check for '}', + // because the `block` rule will be expecting it, but we still need to make sure + // it's there, if ';' was ommitted. + // + end: function () { + return $(';') || peek('}'); + }, + + // + // IE's alpha function + // + // alpha(opacity=88) + // + alpha: function () { + var value; + + if (! $(/^\(opacity=/i)) return; + if (value = $(/^\d+/) || $(this.entities.variable)) { + expect(')'); + return new(tree.Alpha)(value); + } + }, + + // + // A Selector Element + // + // div + // + h1 + // #socks + // input[type="text"] + // + // Elements are the building blocks for Selectors, + // they are made out of a `Combinator` (see combinator rule), + // and an element name, such as a tag a class, or `*`. + // + element: function () { + var e, t, c, v; + + c = $(this.combinator); + + e = $(/^(?:\d+\.\d+|\d+)%/) || $(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/) || + $('*') || $('&') || $(this.attribute) || $(/^\([^)@]+\)/) || $(/^[\.#](?=@)/) || $(this.entities.variableCurly); + + if (! e) { + if ($('(') && (v = ($(this.entities.variableCurly) || $(this.entities.variable))) && $(')')) { + e = new(tree.Paren)(v); + } + } + + if (e) { return new(tree.Element)(c, e, i) } + }, + + // + // Combinators combine elements together, in a Selector. + // + // Because our parser isn't white-space sensitive, special care + // has to be taken, when parsing the descendant combinator, ` `, + // as it's an empty space. We have to check the previous character + // in the input, to see if it's a ` ` character. More info on how + // we deal with this in *combinator.js*. + // + combinator: function () { + var match, c = input.charAt(i); + + if (c === '>' || c === '+' || c === '~') { + i++; + while (input.charAt(i).match(/\s/)) { i++ } + return new(tree.Combinator)(c); + } else if (input.charAt(i - 1).match(/\s/)) { + return new(tree.Combinator)(" "); + } else { + return new(tree.Combinator)(null); + } + }, + + // + // A CSS Selector + // + // .class > div + h1 + // li a:hover + // + // Selectors are made out of one or more Elements, see above. + // + selector: function () { + var sel, e, elements = [], c, match; + + // depreciated, will be removed soon + if ($('(')) { + sel = $(this.entity); + expect(')'); + return new(tree.Selector)([new(tree.Element)('', sel, i)]); + } + + while (e = $(this.element)) { + c = input.charAt(i); + elements.push(e) + if (c === '{' || c === '}' || c === ';' || c === ',') { break } + } + + if (elements.length > 0) { return new(tree.Selector)(elements) } + }, + tag: function () { + return $(/^[A-Za-z][A-Za-z-]*[0-9]?/) || $('*'); + }, + attribute: function () { + var attr = '', key, val, op; + + if (! $('[')) return; + + if (key = $(/^[_A-Za-z0-9-]+/) || $(this.entities.quoted)) { + if ((op = $(/^[|~*$^]?=/)) && + (val = $(this.entities.quoted) || $(/^[\w-]+/))) { + attr = [key, op, val.toCSS ? val.toCSS() : val].join(''); + } else { attr = key } + } + + if (! $(']')) return; + + if (attr) { return "[" + attr + "]" } + }, + + // + // The `block` rule is used by `ruleset` and `mixin.definition`. + // It's a wrapper around the `primary` rule, with added `{}`. + // + block: function () { + var content; + if ($('{') && (content = $(this.primary)) && $('}')) { + return content; + } + }, + + // + // div, .class, body > p {...} + // + ruleset: function () { + var selectors = [], s, rules, match; + save(); + + while (s = $(this.selector)) { + selectors.push(s); + $(this.comment); + if (! $(',')) { break } + $(this.comment); + } + + if (selectors.length > 0 && (rules = $(this.block))) { + return new(tree.Ruleset)(selectors, rules, env.strictImports); + } else { + // Backtrack + furthest = i; + restore(); + } + }, + rule: function () { + var name, value, c = input.charAt(i), important, match; + save(); + + if (c === '.' || c === '#' || c === '&') { return } + + if (name = $(this.variable) || $(this.property)) { + if ((name.charAt(0) != '@') && (match = /^([^@+\/'"*`(;{}-]*);/.exec(chunks[j]))) { + i += match[0].length - 1; + value = new(tree.Anonymous)(match[1]); + } else if (name === "font") { + value = $(this.font); + } else { + value = $(this.value); + } + important = $(this.important); + + if (value && $(this.end)) { + return new(tree.Rule)(name, value, important, memo); + } else { + furthest = i; + restore(); + } + } + }, + + // + // An @import directive + // + // @import "lib"; + // + // Depending on our environemnt, importing is done differently: + // In the browser, it's an XHR request, in Node, it would be a + // file-system operation. The function used for importing is + // stored in `import`, which we pass to the Import constructor. + // + "import": function () { + var path, features, index = i; + + save(); + + var dir = $(/^@import(?:-(once))?\s+/); + + if (dir && (path = $(this.entities.quoted) || $(this.entities.url))) { + features = $(this.mediaFeatures); + if ($(';')) { + return new(tree.Import)(path, imports, features, (dir[1] === 'once'), index); + } + } + + restore(); + }, + + mediaFeature: function () { + var e, p, nodes = []; + + do { + if (e = $(this.entities.keyword)) { + nodes.push(e); + } else if ($('(')) { + p = $(this.property); + e = $(this.entity); + if ($(')')) { + if (p && e) { + nodes.push(new(tree.Paren)(new(tree.Rule)(p, e, null, i, true))); + } else if (e) { + nodes.push(new(tree.Paren)(e)); + } else { + return null; + } + } else { return null } + } + } while (e); + + if (nodes.length > 0) { + return new(tree.Expression)(nodes); + } + }, + + mediaFeatures: function () { + var e, features = []; + + do { + if (e = $(this.mediaFeature)) { + features.push(e); + if (! $(',')) { break } + } else if (e = $(this.entities.variable)) { + features.push(e); + if (! $(',')) { break } + } + } while (e); + + return features.length > 0 ? features : null; + }, + + media: function () { + var features, rules; + + if ($(/^@media/)) { + features = $(this.mediaFeatures); + + if (rules = $(this.block)) { + return new(tree.Media)(rules, features); + } + } + }, + + // + // A CSS Directive + // + // @charset "utf-8"; + // + directive: function () { + var name, value, rules, identifier, e, nodes, nonVendorSpecificName, + hasBlock, hasIdentifier; + + if (input.charAt(i) !== '@') return; + + if (value = $(this['import']) || $(this.media)) { + return value; + } + + save(); + + name = $(/^@[a-z-]+/); + + nonVendorSpecificName = name; + if (name.charAt(1) == '-' && name.indexOf('-', 2) > 0) { + nonVendorSpecificName = "@" + name.slice(name.indexOf('-', 2) + 1); + } + + switch(nonVendorSpecificName) { + case "@font-face": + hasBlock = true; + break; + case "@viewport": + case "@top-left": + case "@top-left-corner": + case "@top-center": + case "@top-right": + case "@top-right-corner": + case "@bottom-left": + case "@bottom-left-corner": + case "@bottom-center": + case "@bottom-right": + case "@bottom-right-corner": + case "@left-top": + case "@left-middle": + case "@left-bottom": + case "@right-top": + case "@right-middle": + case "@right-bottom": + hasBlock = true; + break; + case "@page": + case "@document": + case "@supports": + case "@keyframes": + hasBlock = true; + hasIdentifier = true; + break; + } + + if (hasIdentifier) { + name += " " + ($(/^[^{]+/) || '').trim(); + } + + if (hasBlock) + { + if (rules = $(this.block)) { + return new(tree.Directive)(name, rules); + } + } else { + if ((value = $(this.entity)) && $(';')) { + return new(tree.Directive)(name, value); + } + } + + restore(); + }, + font: function () { + var value = [], expression = [], weight, shorthand, font, e; + + while (e = $(this.shorthand) || $(this.entity)) { + expression.push(e); + } + value.push(new(tree.Expression)(expression)); + + if ($(',')) { + while (e = $(this.expression)) { + value.push(e); + if (! $(',')) { break } + } + } + return new(tree.Value)(value); + }, + + // + // A Value is a comma-delimited list of Expressions + // + // font-family: Baskerville, Georgia, serif; + // + // In a Rule, a Value represents everything after the `:`, + // and before the `;`. + // + value: function () { + var e, expressions = [], important; + + while (e = $(this.expression)) { + expressions.push(e); + if (! $(',')) { break } + } + + if (expressions.length > 0) { + return new(tree.Value)(expressions); + } + }, + important: function () { + if (input.charAt(i) === '!') { + return $(/^! *important/); + } + }, + sub: function () { + var e; + + if ($('(') && (e = $(this.expression)) && $(')')) { + return e; + } + }, + multiplication: function () { + var m, a, op, operation; + if (m = $(this.operand)) { + while (!peek(/^\/\*/) && (op = ($('/') || $('*'))) && (a = $(this.operand))) { + operation = new(tree.Operation)(op, [operation || m, a]); + } + return operation || m; + } + }, + addition: function () { + var m, a, op, operation; + if (m = $(this.multiplication)) { + while ((op = $(/^[-+]\s+/) || (!isWhitespace(input.charAt(i - 1)) && ($('+') || $('-')))) && + (a = $(this.multiplication))) { + operation = new(tree.Operation)(op, [operation || m, a]); + } + return operation || m; + } + }, + conditions: function () { + var a, b, index = i, condition; + + if (a = $(this.condition)) { + while ($(',') && (b = $(this.condition))) { + condition = new(tree.Condition)('or', condition || a, b, index); + } + return condition || a; + } + }, + condition: function () { + var a, b, c, op, index = i, negate = false; + + if ($(/^not/)) { negate = true } + expect('('); + if (a = $(this.addition) || $(this.entities.keyword) || $(this.entities.quoted)) { + if (op = $(/^(?:>=|=<|[<=>])/)) { + if (b = $(this.addition) || $(this.entities.keyword) || $(this.entities.quoted)) { + c = new(tree.Condition)(op, a, b, index, negate); + } else { + error('expected expression'); + } + } else { + c = new(tree.Condition)('=', a, new(tree.Keyword)('true'), index, negate); + } + expect(')'); + return $(/^and/) ? new(tree.Condition)('and', c, $(this.condition)) : c; + } + }, + + // + // An operand is anything that can be part of an operation, + // such as a Color, or a Variable + // + operand: function () { + var negate, p = input.charAt(i + 1); + + if (input.charAt(i) === '-' && (p === '@' || p === '(')) { negate = $('-') } + var o = $(this.sub) || $(this.entities.dimension) || + $(this.entities.color) || $(this.entities.variable) || + $(this.entities.call); + return negate ? new(tree.Operation)('*', [new(tree.Dimension)(-1), o]) + : o; + }, + + // + // Expressions either represent mathematical operations, + // or white-space delimited Entities. + // + // 1px solid black + // @var * 2 + // + expression: function () { + var e, delim, entities = [], d; + + while (e = $(this.addition) || $(this.entity)) { + entities.push(e); + } + if (entities.length > 0) { + return new(tree.Expression)(entities); + } + }, + property: function () { + var name; + + if (name = $(/^(\*?-?[_a-z0-9-]+)\s*:/)) { + return name[1]; + } + } + } + }; +}; + +if (less.mode === 'browser' || less.mode === 'rhino') { + // + // Used by `@import` directives + // + less.Parser.importer = function (path, paths, callback, env) { + if (!/^([a-z-]+:)?\//.test(path) && paths.length > 0) { + path = paths[0] + path; + } + // We pass `true` as 3rd argument, to force the reload of the import. + // This is so we can get the syntax tree as opposed to just the CSS output, + // as we need this to evaluate the current stylesheet. + // __ Now using the hack of passing a ref to top parser's content cache in the 1st arg. __ + loadStyleSheet({ href: path, title: path, type: env.mime, contents: env.contents }, function (e) { + if (e && typeof(env.errback) === "function") { + env.errback.call(null, path, paths, callback, env); + } else { + callback.apply(null, arguments); + } + }, true); + }; +} + +(function (tree) { + +tree.functions = { + rgb: function (r, g, b) { + return this.rgba(r, g, b, 1.0); + }, + rgba: function (r, g, b, a) { + var rgb = [r, g, b].map(function (c) { return number(c) }), + a = number(a); + return new(tree.Color)(rgb, a); + }, + hsl: function (h, s, l) { + return this.hsla(h, s, l, 1.0); + }, + hsla: function (h, s, l, a) { + h = (number(h) % 360) / 360; + s = number(s); l = number(l); a = number(a); + + var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s; + var m1 = l * 2 - m2; + + return this.rgba(hue(h + 1/3) * 255, + hue(h) * 255, + hue(h - 1/3) * 255, + a); + + function hue(h) { + h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h); + if (h * 6 < 1) return m1 + (m2 - m1) * h * 6; + else if (h * 2 < 1) return m2; + else if (h * 3 < 2) return m1 + (m2 - m1) * (2/3 - h) * 6; + else return m1; + } + }, + hue: function (color) { + return new(tree.Dimension)(Math.round(color.toHSL().h)); + }, + saturation: function (color) { + return new(tree.Dimension)(Math.round(color.toHSL().s * 100), '%'); + }, + lightness: function (color) { + return new(tree.Dimension)(Math.round(color.toHSL().l * 100), '%'); + }, + red: function (color) { + return new(tree.Dimension)(color.rgb[0]); + }, + green: function (color) { + return new(tree.Dimension)(color.rgb[1]); + }, + blue: function (color) { + return new(tree.Dimension)(color.rgb[2]); + }, + alpha: function (color) { + return new(tree.Dimension)(color.toHSL().a); + }, + luma: function (color) { + return new(tree.Dimension)(Math.round((0.2126 * (color.rgb[0]/255) + + 0.7152 * (color.rgb[1]/255) + + 0.0722 * (color.rgb[2]/255)) + * color.alpha * 100), '%'); + }, + saturate: function (color, amount) { + var hsl = color.toHSL(); + + hsl.s += amount.value / 100; + hsl.s = clamp(hsl.s); + return hsla(hsl); + }, + desaturate: function (color, amount) { + var hsl = color.toHSL(); + + hsl.s -= amount.value / 100; + hsl.s = clamp(hsl.s); + return hsla(hsl); + }, + lighten: function (color, amount) { + var hsl = color.toHSL(); + + hsl.l += amount.value / 100; + hsl.l = clamp(hsl.l); + return hsla(hsl); + }, + darken: function (color, amount) { + var hsl = color.toHSL(); + + hsl.l -= amount.value / 100; + hsl.l = clamp(hsl.l); + return hsla(hsl); + }, + fadein: function (color, amount) { + var hsl = color.toHSL(); + + hsl.a += amount.value / 100; + hsl.a = clamp(hsl.a); + return hsla(hsl); + }, + fadeout: function (color, amount) { + var hsl = color.toHSL(); + + hsl.a -= amount.value / 100; + hsl.a = clamp(hsl.a); + return hsla(hsl); + }, + fade: function (color, amount) { + var hsl = color.toHSL(); + + hsl.a = amount.value / 100; + hsl.a = clamp(hsl.a); + return hsla(hsl); + }, + spin: function (color, amount) { + var hsl = color.toHSL(); + var hue = (hsl.h + amount.value) % 360; + + hsl.h = hue < 0 ? 360 + hue : hue; + + return hsla(hsl); + }, + // + // Copyright (c) 2006-2009 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein + // http://sass-lang.com + // + mix: function (color1, color2, weight) { + if (!weight) { + weight = new(tree.Dimension)(50); + } + var p = weight.value / 100.0; + var w = p * 2 - 1; + var a = color1.toHSL().a - color2.toHSL().a; + + var w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0; + var w2 = 1 - w1; + + var rgb = [color1.rgb[0] * w1 + color2.rgb[0] * w2, + color1.rgb[1] * w1 + color2.rgb[1] * w2, + color1.rgb[2] * w1 + color2.rgb[2] * w2]; + + var alpha = color1.alpha * p + color2.alpha * (1 - p); + + return new(tree.Color)(rgb, alpha); + }, + greyscale: function (color) { + return this.desaturate(color, new(tree.Dimension)(100)); + }, + contrast: function (color, dark, light, threshold) { + if (typeof light === 'undefined') { + light = this.rgba(255, 255, 255, 1.0); + } + if (typeof dark === 'undefined') { + dark = this.rgba(0, 0, 0, 1.0); + } + if (typeof threshold === 'undefined') { + threshold = 0.43; + } else { + threshold = threshold.value; + } + if (((0.2126 * (color.rgb[0]/255) + 0.7152 * (color.rgb[1]/255) + 0.0722 * (color.rgb[2]/255)) * color.alpha) < threshold) { + return light; + } else { + return dark; + } + }, + e: function (str) { + return new(tree.Anonymous)(str instanceof tree.JavaScript ? str.evaluated : str); + }, + escape: function (str) { + return new(tree.Anonymous)(encodeURI(str.value).replace(/=/g, "%3D").replace(/:/g, "%3A").replace(/#/g, "%23").replace(/;/g, "%3B").replace(/\(/g, "%28").replace(/\)/g, "%29")); + }, + '%': function (quoted /* arg, arg, ...*/) { + var args = Array.prototype.slice.call(arguments, 1), + str = quoted.value; + + for (var i = 0; i < args.length; i++) { + str = str.replace(/%[sda]/i, function(token) { + var value = token.match(/s/i) ? args[i].value : args[i].toCSS(); + return token.match(/[A-Z]$/) ? encodeURIComponent(value) : value; + }); + } + str = str.replace(/%%/g, '%'); + return new(tree.Quoted)('"' + str + '"', str); + }, + round: function (n, f) { + var fraction = typeof(f) === "undefined" ? 0 : f.value; + if (n instanceof tree.Dimension) { + return new(tree.Dimension)(number(n).toFixed(fraction), n.unit); + } else if (typeof(n) === 'number') { + return n.toFixed(fraction); + } else { + throw { type: "Argument", message: "argument must be a number" }; + } + }, + ceil: function (n) { + return this._math('ceil', n); + }, + floor: function (n) { + return this._math('floor', n); + }, + _math: function (fn, n) { + if (n instanceof tree.Dimension) { + return new(tree.Dimension)(Math[fn](number(n)), n.unit); + } else if (typeof(n) === 'number') { + return Math[fn](n); + } else { + throw { type: "Argument", message: "argument must be a number" }; + } + }, + argb: function (color) { + return new(tree.Anonymous)(color.toARGB()); + + }, + percentage: function (n) { + return new(tree.Dimension)(n.value * 100, '%'); + }, + color: function (n) { + if (n instanceof tree.Quoted) { + return new(tree.Color)(n.value.slice(1)); + } else { + throw { type: "Argument", message: "argument must be a string" }; + } + }, + iscolor: function (n) { + return this._isa(n, tree.Color); + }, + isnumber: function (n) { + return this._isa(n, tree.Dimension); + }, + isstring: function (n) { + return this._isa(n, tree.Quoted); + }, + iskeyword: function (n) { + return this._isa(n, tree.Keyword); + }, + isurl: function (n) { + return this._isa(n, tree.URL); + }, + ispixel: function (n) { + return (n instanceof tree.Dimension) && n.unit === 'px' ? tree.True : tree.False; + }, + ispercentage: function (n) { + return (n instanceof tree.Dimension) && n.unit === '%' ? tree.True : tree.False; + }, + isem: function (n) { + return (n instanceof tree.Dimension) && n.unit === 'em' ? tree.True : tree.False; + }, + _isa: function (n, Type) { + return (n instanceof Type) ? tree.True : tree.False; + }, + + /* Blending modes */ + + multiply: function(color1, color2) { + var r = color1.rgb[0] * color2.rgb[0] / 255; + var g = color1.rgb[1] * color2.rgb[1] / 255; + var b = color1.rgb[2] * color2.rgb[2] / 255; + return this.rgb(r, g, b); + }, + screen: function(color1, color2) { + var r = 255 - (255 - color1.rgb[0]) * (255 - color2.rgb[0]) / 255; + var g = 255 - (255 - color1.rgb[1]) * (255 - color2.rgb[1]) / 255; + var b = 255 - (255 - color1.rgb[2]) * (255 - color2.rgb[2]) / 255; + return this.rgb(r, g, b); + }, + overlay: function(color1, color2) { + var r = color1.rgb[0] < 128 ? 2 * color1.rgb[0] * color2.rgb[0] / 255 : 255 - 2 * (255 - color1.rgb[0]) * (255 - color2.rgb[0]) / 255; + var g = color1.rgb[1] < 128 ? 2 * color1.rgb[1] * color2.rgb[1] / 255 : 255 - 2 * (255 - color1.rgb[1]) * (255 - color2.rgb[1]) / 255; + var b = color1.rgb[2] < 128 ? 2 * color1.rgb[2] * color2.rgb[2] / 255 : 255 - 2 * (255 - color1.rgb[2]) * (255 - color2.rgb[2]) / 255; + return this.rgb(r, g, b); + }, + softlight: function(color1, color2) { + var t = color2.rgb[0] * color1.rgb[0] / 255; + var r = t + color1.rgb[0] * (255 - (255 - color1.rgb[0]) * (255 - color2.rgb[0]) / 255 - t) / 255; + t = color2.rgb[1] * color1.rgb[1] / 255; + var g = t + color1.rgb[1] * (255 - (255 - color1.rgb[1]) * (255 - color2.rgb[1]) / 255 - t) / 255; + t = color2.rgb[2] * color1.rgb[2] / 255; + var b = t + color1.rgb[2] * (255 - (255 - color1.rgb[2]) * (255 - color2.rgb[2]) / 255 - t) / 255; + return this.rgb(r, g, b); + }, + hardlight: function(color1, color2) { + var r = color2.rgb[0] < 128 ? 2 * color2.rgb[0] * color1.rgb[0] / 255 : 255 - 2 * (255 - color2.rgb[0]) * (255 - color1.rgb[0]) / 255; + var g = color2.rgb[1] < 128 ? 2 * color2.rgb[1] * color1.rgb[1] / 255 : 255 - 2 * (255 - color2.rgb[1]) * (255 - color1.rgb[1]) / 255; + var b = color2.rgb[2] < 128 ? 2 * color2.rgb[2] * color1.rgb[2] / 255 : 255 - 2 * (255 - color2.rgb[2]) * (255 - color1.rgb[2]) / 255; + return this.rgb(r, g, b); + }, + difference: function(color1, color2) { + var r = Math.abs(color1.rgb[0] - color2.rgb[0]); + var g = Math.abs(color1.rgb[1] - color2.rgb[1]); + var b = Math.abs(color1.rgb[2] - color2.rgb[2]); + return this.rgb(r, g, b); + }, + exclusion: function(color1, color2) { + var r = color1.rgb[0] + color2.rgb[0] * (255 - color1.rgb[0] - color1.rgb[0]) / 255; + var g = color1.rgb[1] + color2.rgb[1] * (255 - color1.rgb[1] - color1.rgb[1]) / 255; + var b = color1.rgb[2] + color2.rgb[2] * (255 - color1.rgb[2] - color1.rgb[2]) / 255; + return this.rgb(r, g, b); + }, + average: function(color1, color2) { + var r = (color1.rgb[0] + color2.rgb[0]) / 2; + var g = (color1.rgb[1] + color2.rgb[1]) / 2; + var b = (color1.rgb[2] + color2.rgb[2]) / 2; + return this.rgb(r, g, b); + }, + negation: function(color1, color2) { + var r = 255 - Math.abs(255 - color2.rgb[0] - color1.rgb[0]); + var g = 255 - Math.abs(255 - color2.rgb[1] - color1.rgb[1]); + var b = 255 - Math.abs(255 - color2.rgb[2] - color1.rgb[2]); + return this.rgb(r, g, b); + } +}; + +function hsla(hsla) { + return tree.functions.hsla(hsla.h, hsla.s, hsla.l, hsla.a); +} + +function number(n) { + if (n instanceof tree.Dimension) { + return parseFloat(n.unit == '%' ? n.value / 100 : n.value); + } else if (typeof(n) === 'number') { + return n; + } else { + throw { + error: "RuntimeError", + message: "color functions take numbers as parameters" + }; + } +} + +function clamp(val) { + return Math.min(1, Math.max(0, val)); +} + +})(require('./tree')); +(function (tree) { + tree.colors = { + 'aliceblue':'#f0f8ff', + 'antiquewhite':'#faebd7', + 'aqua':'#00ffff', + 'aquamarine':'#7fffd4', + 'azure':'#f0ffff', + 'beige':'#f5f5dc', + 'bisque':'#ffe4c4', + 'black':'#000000', + 'blanchedalmond':'#ffebcd', + 'blue':'#0000ff', + 'blueviolet':'#8a2be2', + 'brown':'#a52a2a', + 'burlywood':'#deb887', + 'cadetblue':'#5f9ea0', + 'chartreuse':'#7fff00', + 'chocolate':'#d2691e', + 'coral':'#ff7f50', + 'cornflowerblue':'#6495ed', + 'cornsilk':'#fff8dc', + 'crimson':'#dc143c', + 'cyan':'#00ffff', + 'darkblue':'#00008b', + 'darkcyan':'#008b8b', + 'darkgoldenrod':'#b8860b', + 'darkgray':'#a9a9a9', + 'darkgrey':'#a9a9a9', + 'darkgreen':'#006400', + 'darkkhaki':'#bdb76b', + 'darkmagenta':'#8b008b', + 'darkolivegreen':'#556b2f', + 'darkorange':'#ff8c00', + 'darkorchid':'#9932cc', + 'darkred':'#8b0000', + 'darksalmon':'#e9967a', + 'darkseagreen':'#8fbc8f', + 'darkslateblue':'#483d8b', + 'darkslategray':'#2f4f4f', + 'darkslategrey':'#2f4f4f', + 'darkturquoise':'#00ced1', + 'darkviolet':'#9400d3', + 'deeppink':'#ff1493', + 'deepskyblue':'#00bfff', + 'dimgray':'#696969', + 'dimgrey':'#696969', + 'dodgerblue':'#1e90ff', + 'firebrick':'#b22222', + 'floralwhite':'#fffaf0', + 'forestgreen':'#228b22', + 'fuchsia':'#ff00ff', + 'gainsboro':'#dcdcdc', + 'ghostwhite':'#f8f8ff', + 'gold':'#ffd700', + 'goldenrod':'#daa520', + 'gray':'#808080', + 'grey':'#808080', + 'green':'#008000', + 'greenyellow':'#adff2f', + 'honeydew':'#f0fff0', + 'hotpink':'#ff69b4', + 'indianred':'#cd5c5c', + 'indigo':'#4b0082', + 'ivory':'#fffff0', + 'khaki':'#f0e68c', + 'lavender':'#e6e6fa', + 'lavenderblush':'#fff0f5', + 'lawngreen':'#7cfc00', + 'lemonchiffon':'#fffacd', + 'lightblue':'#add8e6', + 'lightcoral':'#f08080', + 'lightcyan':'#e0ffff', + 'lightgoldenrodyellow':'#fafad2', + 'lightgray':'#d3d3d3', + 'lightgrey':'#d3d3d3', + 'lightgreen':'#90ee90', + 'lightpink':'#ffb6c1', + 'lightsalmon':'#ffa07a', + 'lightseagreen':'#20b2aa', + 'lightskyblue':'#87cefa', + 'lightslategray':'#778899', + 'lightslategrey':'#778899', + 'lightsteelblue':'#b0c4de', + 'lightyellow':'#ffffe0', + 'lime':'#00ff00', + 'limegreen':'#32cd32', + 'linen':'#faf0e6', + 'magenta':'#ff00ff', + 'maroon':'#800000', + 'mediumaquamarine':'#66cdaa', + 'mediumblue':'#0000cd', + 'mediumorchid':'#ba55d3', + 'mediumpurple':'#9370d8', + 'mediumseagreen':'#3cb371', + 'mediumslateblue':'#7b68ee', + 'mediumspringgreen':'#00fa9a', + 'mediumturquoise':'#48d1cc', + 'mediumvioletred':'#c71585', + 'midnightblue':'#191970', + 'mintcream':'#f5fffa', + 'mistyrose':'#ffe4e1', + 'moccasin':'#ffe4b5', + 'navajowhite':'#ffdead', + 'navy':'#000080', + 'oldlace':'#fdf5e6', + 'olive':'#808000', + 'olivedrab':'#6b8e23', + 'orange':'#ffa500', + 'orangered':'#ff4500', + 'orchid':'#da70d6', + 'palegoldenrod':'#eee8aa', + 'palegreen':'#98fb98', + 'paleturquoise':'#afeeee', + 'palevioletred':'#d87093', + 'papayawhip':'#ffefd5', + 'peachpuff':'#ffdab9', + 'peru':'#cd853f', + 'pink':'#ffc0cb', + 'plum':'#dda0dd', + 'powderblue':'#b0e0e6', + 'purple':'#800080', + 'red':'#ff0000', + 'rosybrown':'#bc8f8f', + 'royalblue':'#4169e1', + 'saddlebrown':'#8b4513', + 'salmon':'#fa8072', + 'sandybrown':'#f4a460', + 'seagreen':'#2e8b57', + 'seashell':'#fff5ee', + 'sienna':'#a0522d', + 'silver':'#c0c0c0', + 'skyblue':'#87ceeb', + 'slateblue':'#6a5acd', + 'slategray':'#708090', + 'slategrey':'#708090', + 'snow':'#fffafa', + 'springgreen':'#00ff7f', + 'steelblue':'#4682b4', + 'tan':'#d2b48c', + 'teal':'#008080', + 'thistle':'#d8bfd8', + 'tomato':'#ff6347', + // 'transparent':'rgba(0,0,0,0)', + 'turquoise':'#40e0d0', + 'violet':'#ee82ee', + 'wheat':'#f5deb3', + 'white':'#ffffff', + 'whitesmoke':'#f5f5f5', + 'yellow':'#ffff00', + 'yellowgreen':'#9acd32' + }; +})(require('./tree')); +(function (tree) { + +tree.Alpha = function (val) { + this.value = val; +}; +tree.Alpha.prototype = { + toCSS: function () { + return "alpha(opacity=" + + (this.value.toCSS ? this.value.toCSS() : this.value) + ")"; + }, + eval: function (env) { + if (this.value.eval) { this.value = this.value.eval(env) } + return this; + } +}; + +})(require('../tree')); +(function (tree) { + +tree.Anonymous = function (string) { + this.value = string.value || string; +}; +tree.Anonymous.prototype = { + toCSS: function () { + return this.value; + }, + eval: function () { return this }, + compare: function (x) { + if (!x.toCSS) { + return -1; + } + + var left = this.toCSS(), + right = x.toCSS(); + + if (left === right) { + return 0; + } + + return left < right ? -1 : 1; + } +}; + +})(require('../tree')); +(function (tree) { + +tree.Assignment = function (key, val) { + this.key = key; + this.value = val; +}; +tree.Assignment.prototype = { + toCSS: function () { + return this.key + '=' + (this.value.toCSS ? this.value.toCSS() : this.value); + }, + eval: function (env) { + if (this.value.eval) { + return new(tree.Assignment)(this.key, this.value.eval(env)); + } + return this; + } +}; + +})(require('../tree'));(function (tree) { + +// +// A function call node. +// +tree.Call = function (name, args, index, filename) { + this.name = name; + this.args = args; + this.index = index; + this.filename = filename; +}; +tree.Call.prototype = { + // + // When evaluating a function call, + // we either find the function in `tree.functions` [1], + // in which case we call it, passing the evaluated arguments, + // or we simply print it out as it appeared originally [2]. + // + // The *functions.js* file contains the built-in functions. + // + // The reason why we evaluate the arguments, is in the case where + // we try to pass a variable to a function, like: `saturate(@color)`. + // The function should receive the value, not the variable. + // + eval: function (env) { + var args = this.args.map(function (a) { return a.eval(env) }); + + if (this.name in tree.functions) { // 1. + try { + return tree.functions[this.name].apply(tree.functions, args); + } catch (e) { + throw { type: e.type || "Runtime", + message: "error evaluating function `" + this.name + "`" + + (e.message ? ': ' + e.message : ''), + index: this.index, filename: this.filename }; + } + } else { // 2. + return new(tree.Anonymous)(this.name + + "(" + args.map(function (a) { return a.toCSS() }).join(', ') + ")"); + } + }, + + toCSS: function (env) { + return this.eval(env).toCSS(); + } +}; + +})(require('../tree')); +(function (tree) { +// +// RGB Colors - #ff0014, #eee +// +tree.Color = function (rgb, a) { + // + // The end goal here, is to parse the arguments + // into an integer triplet, such as `128, 255, 0` + // + // This facilitates operations and conversions. + // + if (Array.isArray(rgb)) { + this.rgb = rgb; + } else if (rgb.length == 6) { + this.rgb = rgb.match(/.{2}/g).map(function (c) { + return parseInt(c, 16); + }); + } else { + this.rgb = rgb.split('').map(function (c) { + return parseInt(c + c, 16); + }); + } + this.alpha = typeof(a) === 'number' ? a : 1; +}; +tree.Color.prototype = { + eval: function () { return this }, + + // + // If we have some transparency, the only way to represent it + // is via `rgba`. Otherwise, we use the hex representation, + // which has better compatibility with older browsers. + // Values are capped between `0` and `255`, rounded and zero-padded. + // + toCSS: function () { + if (this.alpha < 1.0) { + return "rgba(" + this.rgb.map(function (c) { + return Math.round(c); + }).concat(this.alpha).join(', ') + ")"; + } else { + return '#' + this.rgb.map(function (i) { + i = Math.round(i); + i = (i > 255 ? 255 : (i < 0 ? 0 : i)).toString(16); + return i.length === 1 ? '0' + i : i; + }).join(''); + } + }, + + // + // Operations have to be done per-channel, if not, + // channels will spill onto each other. Once we have + // our result, in the form of an integer triplet, + // we create a new Color node to hold the result. + // + operate: function (op, other) { + var result = []; + + if (! (other instanceof tree.Color)) { + other = other.toColor(); + } + + for (var c = 0; c < 3; c++) { + result[c] = tree.operate(op, this.rgb[c], other.rgb[c]); + } + return new(tree.Color)(result, this.alpha + other.alpha); + }, + + toHSL: function () { + var r = this.rgb[0] / 255, + g = this.rgb[1] / 255, + b = this.rgb[2] / 255, + a = this.alpha; + + var max = Math.max(r, g, b), min = Math.min(r, g, b); + var h, s, l = (max + min) / 2, d = max - min; + + if (max === min) { + h = s = 0; + } else { + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + + switch (max) { + case r: h = (g - b) / d + (g < b ? 6 : 0); break; + case g: h = (b - r) / d + 2; break; + case b: h = (r - g) / d + 4; break; + } + h /= 6; + } + return { h: h * 360, s: s, l: l, a: a }; + }, + toARGB: function () { + var argb = [Math.round(this.alpha * 255)].concat(this.rgb); + return '#' + argb.map(function (i) { + i = Math.round(i); + i = (i > 255 ? 255 : (i < 0 ? 0 : i)).toString(16); + return i.length === 1 ? '0' + i : i; + }).join(''); + }, + compare: function (x) { + if (!x.rgb) { + return -1; + } + + return (x.rgb[0] === this.rgb[0] && + x.rgb[1] === this.rgb[1] && + x.rgb[2] === this.rgb[2] && + x.alpha === this.alpha) ? 0 : -1; + } +}; + + +})(require('../tree')); +(function (tree) { + +tree.Comment = function (value, silent) { + this.value = value; + this.silent = !!silent; +}; +tree.Comment.prototype = { + toCSS: function (env) { + return env.compress ? '' : this.value; + }, + eval: function () { return this } +}; + +})(require('../tree')); +(function (tree) { + +tree.Condition = function (op, l, r, i, negate) { + this.op = op.trim(); + this.lvalue = l; + this.rvalue = r; + this.index = i; + this.negate = negate; +}; +tree.Condition.prototype.eval = function (env) { + var a = this.lvalue.eval(env), + b = this.rvalue.eval(env); + + var i = this.index, result; + + var result = (function (op) { + switch (op) { + case 'and': + return a && b; + case 'or': + return a || b; + default: + if (a.compare) { + result = a.compare(b); + } else if (b.compare) { + result = b.compare(a); + } else { + throw { type: "Type", + message: "Unable to perform comparison", + index: i }; + } + switch (result) { + case -1: return op === '<' || op === '=<'; + case 0: return op === '=' || op === '>=' || op === '=<'; + case 1: return op === '>' || op === '>='; + } + } + })(this.op); + return this.negate ? !result : result; +}; + +})(require('../tree')); +(function (tree) { + +// +// A number with a unit +// +tree.Dimension = function (value, unit) { + this.value = parseFloat(value); + this.unit = unit || null; +}; + +tree.Dimension.prototype = { + eval: function () { return this }, + toColor: function () { + return new(tree.Color)([this.value, this.value, this.value]); + }, + toCSS: function () { + var css = this.value + this.unit; + return css; + }, + + // In an operation between two Dimensions, + // we default to the first Dimension's unit, + // so `1px + 2em` will yield `3px`. + // In the future, we could implement some unit + // conversions such that `100cm + 10mm` would yield + // `101cm`. + operate: function (op, other) { + return new(tree.Dimension) + (tree.operate(op, this.value, other.value), + this.unit || other.unit); + }, + + // TODO: Perform unit conversion before comparing + compare: function (other) { + if (other instanceof tree.Dimension) { + if (other.value > this.value) { + return -1; + } else if (other.value < this.value) { + return 1; + } else { + return 0; + } + } else { + return -1; + } + } +}; + +})(require('../tree')); +(function (tree) { + +tree.Directive = function (name, value) { + this.name = name; + + if (Array.isArray(value)) { + this.ruleset = new(tree.Ruleset)([], value); + this.ruleset.allowImports = true; + } else { + this.value = value; + } +}; +tree.Directive.prototype = { + toCSS: function (ctx, env) { + if (this.ruleset) { + this.ruleset.root = true; + return this.name + (env.compress ? '{' : ' {\n ') + + this.ruleset.toCSS(ctx, env).trim().replace(/\n/g, '\n ') + + (env.compress ? '}': '\n}\n'); + } else { + return this.name + ' ' + this.value.toCSS() + ';\n'; + } + }, + eval: function (env) { + var evaldDirective = this; + if (this.ruleset) { + env.frames.unshift(this); + evaldDirective = new(tree.Directive)(this.name); + evaldDirective.ruleset = this.ruleset.eval(env); + env.frames.shift(); + } + return evaldDirective; + }, + variable: function (name) { return tree.Ruleset.prototype.variable.call(this.ruleset, name) }, + find: function () { return tree.Ruleset.prototype.find.apply(this.ruleset, arguments) }, + rulesets: function () { return tree.Ruleset.prototype.rulesets.apply(this.ruleset) } +}; + +})(require('../tree')); +(function (tree) { + +tree.Element = function (combinator, value, index) { + this.combinator = combinator instanceof tree.Combinator ? + combinator : new(tree.Combinator)(combinator); + + if (typeof(value) === 'string') { + this.value = value.trim(); + } else if (value) { + this.value = value; + } else { + this.value = ""; + } + this.index = index; +}; +tree.Element.prototype.eval = function (env) { + return new(tree.Element)(this.combinator, + this.value.eval ? this.value.eval(env) : this.value, + this.index); +}; +tree.Element.prototype.toCSS = function (env) { + var value = (this.value.toCSS ? this.value.toCSS(env) : this.value); + if (value == '' && this.combinator.value.charAt(0) == '&') { + return ''; + } else { + return this.combinator.toCSS(env || {}) + value; + } +}; + +tree.Combinator = function (value) { + if (value === ' ') { + this.value = ' '; + } else { + this.value = value ? value.trim() : ""; + } +}; +tree.Combinator.prototype.toCSS = function (env) { + return { + '' : '', + ' ' : ' ', + ':' : ' :', + '+' : env.compress ? '+' : ' + ', + '~' : env.compress ? '~' : ' ~ ', + '>' : env.compress ? '>' : ' > ' + }[this.value]; +}; + +})(require('../tree')); +(function (tree) { + +tree.Expression = function (value) { this.value = value }; +tree.Expression.prototype = { + eval: function (env) { + if (this.value.length > 1) { + return new(tree.Expression)(this.value.map(function (e) { + return e.eval(env); + })); + } else if (this.value.length === 1) { + return this.value[0].eval(env); + } else { + return this; + } + }, + toCSS: function (env) { + return this.value.map(function (e) { + return e.toCSS ? e.toCSS(env) : ''; + }).join(' '); + } +}; + +})(require('../tree')); +(function (tree) { +// +// CSS @import node +// +// The general strategy here is that we don't want to wait +// for the parsing to be completed, before we start importing +// the file. That's because in the context of a browser, +// most of the time will be spent waiting for the server to respond. +// +// On creation, we push the import path to our import queue, though +// `import,push`, we also pass it a callback, which it'll call once +// the file has been fetched, and parsed. +// +tree.Import = function (path, imports, features, once, index) { + var that = this; + + this.once = once; + this.index = index; + this._path = path; + this.features = features && new(tree.Value)(features); + + // The '.less' extension is optional + if (path instanceof tree.Quoted) { + this.path = /\.(le?|c)ss(\?.*)?$/.test(path.value) ? path.value : path.value + '.less'; + } else { + this.path = path.value.value || path.value; + } + + this.css = /css(\?.*)?$/.test(this.path); + + // Only pre-compile .less files + if (! this.css) { + imports.push(this.path, function (e, root, imported) { + if (e) { e.index = index } + if (imported && that.once) that.skip = imported; + that.root = root || new(tree.Ruleset)([], []); + }); + } +}; + +// +// The actual import node doesn't return anything, when converted to CSS. +// The reason is that it's used at the evaluation stage, so that the rules +// it imports can be treated like any other rules. +// +// In `eval`, we make sure all Import nodes get evaluated, recursively, so +// we end up with a flat structure, which can easily be imported in the parent +// ruleset. +// +tree.Import.prototype = { + toCSS: function (env) { + var features = this.features ? ' ' + this.features.toCSS(env) : ''; + + if (this.css) { + return "@import " + this._path.toCSS() + features + ';\n'; + } else { + return ""; + } + }, + eval: function (env) { + var ruleset, features = this.features && this.features.eval(env); + + if (this.skip) return []; + + if (this.css) { + return this; + } else { + ruleset = new(tree.Ruleset)([], this.root.rules.slice(0)); + + for (var i = 0; i < ruleset.rules.length; i++) { + if (ruleset.rules[i] instanceof tree.Import) { + Array.prototype + .splice + .apply(ruleset.rules, + [i, 1].concat(ruleset.rules[i].eval(env))); + } + } + return this.features ? new(tree.Media)(ruleset.rules, this.features.value) : ruleset.rules; + } + } +}; + +})(require('../tree')); +(function (tree) { + +tree.JavaScript = function (string, index, escaped) { + this.escaped = escaped; + this.expression = string; + this.index = index; +}; +tree.JavaScript.prototype = { + eval: function (env) { + var result, + that = this, + context = {}; + + var expression = this.expression.replace(/@\{([\w-]+)\}/g, function (_, name) { + return tree.jsify(new(tree.Variable)('@' + name, that.index).eval(env)); + }); + + try { + expression = new(Function)('return (' + expression + ')'); + } catch (e) { + throw { message: "JavaScript evaluation error: `" + expression + "`" , + index: this.index }; + } + + for (var k in env.frames[0].variables()) { + context[k.slice(1)] = { + value: env.frames[0].variables()[k].value, + toJS: function () { + return this.value.eval(env).toCSS(); + } + }; + } + + try { + result = expression.call(context); + } catch (e) { + throw { message: "JavaScript evaluation error: '" + e.name + ': ' + e.message + "'" , + index: this.index }; + } + if (typeof(result) === 'string') { + return new(tree.Quoted)('"' + result + '"', result, this.escaped, this.index); + } else if (Array.isArray(result)) { + return new(tree.Anonymous)(result.join(', ')); + } else { + return new(tree.Anonymous)(result); + } + } +}; + +})(require('../tree')); + +(function (tree) { + +tree.Keyword = function (value) { this.value = value }; +tree.Keyword.prototype = { + eval: function () { return this }, + toCSS: function () { return this.value }, + compare: function (other) { + if (other instanceof tree.Keyword) { + return other.value === this.value ? 0 : 1; + } else { + return -1; + } + } +}; + +tree.True = new(tree.Keyword)('true'); +tree.False = new(tree.Keyword)('false'); + +})(require('../tree')); +(function (tree) { + +tree.Media = function (value, features) { + var selectors = this.emptySelectors(); + + this.features = new(tree.Value)(features); + this.ruleset = new(tree.Ruleset)(selectors, value); + this.ruleset.allowImports = true; +}; +tree.Media.prototype = { + toCSS: function (ctx, env) { + var features = this.features.toCSS(env); + + this.ruleset.root = (ctx.length === 0 || ctx[0].multiMedia); + return '@media ' + features + (env.compress ? '{' : ' {\n ') + + this.ruleset.toCSS(ctx, env).trim().replace(/\n/g, '\n ') + + (env.compress ? '}': '\n}\n'); + }, + eval: function (env) { + if (!env.mediaBlocks) { + env.mediaBlocks = []; + env.mediaPath = []; + } + + var blockIndex = env.mediaBlocks.length; + env.mediaPath.push(this); + env.mediaBlocks.push(this); + + var media = new(tree.Media)([], []); + media.features = this.features.eval(env); + + env.frames.unshift(this.ruleset); + media.ruleset = this.ruleset.eval(env); + env.frames.shift(); + + env.mediaBlocks[blockIndex] = media; + env.mediaPath.pop(); + + return env.mediaPath.length === 0 ? media.evalTop(env) : + media.evalNested(env) + }, + variable: function (name) { return tree.Ruleset.prototype.variable.call(this.ruleset, name) }, + find: function () { return tree.Ruleset.prototype.find.apply(this.ruleset, arguments) }, + rulesets: function () { return tree.Ruleset.prototype.rulesets.apply(this.ruleset) }, + emptySelectors: function() { + var el = new(tree.Element)('', '&', 0); + return [new(tree.Selector)([el])]; + }, + + evalTop: function (env) { + var result = this; + + // Render all dependent Media blocks. + if (env.mediaBlocks.length > 1) { + var selectors = this.emptySelectors(); + result = new(tree.Ruleset)(selectors, env.mediaBlocks); + result.multiMedia = true; + } + + delete env.mediaBlocks; + delete env.mediaPath; + + return result; + }, + evalNested: function (env) { + var i, value, + path = env.mediaPath.concat([this]); + + // Extract the media-query conditions separated with `,` (OR). + for (i = 0; i < path.length; i++) { + value = path[i].features instanceof tree.Value ? + path[i].features.value : path[i].features; + path[i] = Array.isArray(value) ? value : [value]; + } + + // Trace all permutations to generate the resulting media-query. + // + // (a, b and c) with nested (d, e) -> + // a and d + // a and e + // b and c and d + // b and c and e + this.features = new(tree.Value)(this.permute(path).map(function (path) { + path = path.map(function (fragment) { + return fragment.toCSS ? fragment : new(tree.Anonymous)(fragment); + }); + + for(i = path.length - 1; i > 0; i--) { + path.splice(i, 0, new(tree.Anonymous)("and")); + } + + return new(tree.Expression)(path); + })); + + // Fake a tree-node that doesn't output anything. + return new(tree.Ruleset)([], []); + }, + permute: function (arr) { + if (arr.length === 0) { + return []; + } else if (arr.length === 1) { + return arr[0]; + } else { + var result = []; + var rest = this.permute(arr.slice(1)); + for (var i = 0; i < rest.length; i++) { + for (var j = 0; j < arr[0].length; j++) { + result.push([arr[0][j]].concat(rest[i])); + } + } + return result; + } + }, + bubbleSelectors: function (selectors) { + this.ruleset = new(tree.Ruleset)(selectors.slice(0), [this.ruleset]); + } +}; + +})(require('../tree')); +(function (tree) { + +tree.mixin = {}; +tree.mixin.Call = function (elements, args, index, filename, important) { + this.selector = new(tree.Selector)(elements); + this.arguments = args; + this.index = index; + this.filename = filename; + this.important = important; +}; +tree.mixin.Call.prototype = { + eval: function (env) { + var mixins, args, rules = [], match = false; + + for (var i = 0; i < env.frames.length; i++) { + if ((mixins = env.frames[i].find(this.selector)).length > 0) { + args = this.arguments && this.arguments.map(function (a) { + return { name: a.name, value: a.value.eval(env) }; + }); + for (var m = 0; m < mixins.length; m++) { + if (mixins[m].match(args, env)) { + try { + Array.prototype.push.apply( + rules, mixins[m].eval(env, this.arguments, this.important).rules); + match = true; + } catch (e) { + throw { message: e.message, index: this.index, filename: this.filename, stack: e.stack }; + } + } + } + if (match) { + return rules; + } else { + throw { type: 'Runtime', + message: 'No matching definition was found for `' + + this.selector.toCSS().trim() + '(' + + this.arguments.map(function (a) { + return a.toCSS(); + }).join(', ') + ")`", + index: this.index, filename: this.filename }; + } + } + } + throw { type: 'Name', + message: this.selector.toCSS().trim() + " is undefined", + index: this.index, filename: this.filename }; + } +}; + +tree.mixin.Definition = function (name, params, rules, condition, variadic) { + this.name = name; + this.selectors = [new(tree.Selector)([new(tree.Element)(null, name)])]; + this.params = params; + this.condition = condition; + this.variadic = variadic; + this.arity = params.length; + this.rules = rules; + this._lookups = {}; + this.required = params.reduce(function (count, p) { + if (!p.name || (p.name && !p.value)) { return count + 1 } + else { return count } + }, 0); + this.parent = tree.Ruleset.prototype; + this.frames = []; +}; +tree.mixin.Definition.prototype = { + toCSS: function () { return "" }, + variable: function (name) { return this.parent.variable.call(this, name) }, + variables: function () { return this.parent.variables.call(this) }, + find: function () { return this.parent.find.apply(this, arguments) }, + rulesets: function () { return this.parent.rulesets.apply(this) }, + + evalParams: function (env, args) { + var frame = new(tree.Ruleset)(null, []), varargs, arg; + + for (var i = 0, val, name; i < this.params.length; i++) { + arg = args && args[i] + + if (arg && arg.name) { + frame.rules.unshift(new(tree.Rule)(arg.name, arg.value.eval(env))); + args.splice(i, 1); + i--; + continue; + } + + if (name = this.params[i].name) { + if (this.params[i].variadic && args) { + varargs = []; + for (var j = i; j < args.length; j++) { + varargs.push(args[j].value.eval(env)); + } + frame.rules.unshift(new(tree.Rule)(name, new(tree.Expression)(varargs).eval(env))); + } else if (val = (arg && arg.value) || this.params[i].value) { + frame.rules.unshift(new(tree.Rule)(name, val.eval(env))); + } else { + throw { type: 'Runtime', message: "wrong number of arguments for " + this.name + + ' (' + args.length + ' for ' + this.arity + ')' }; + } + } + } + return frame; + }, + eval: function (env, args, important) { + var frame = this.evalParams(env, args), context, _arguments = [], rules, start; + + for (var i = 0; i < Math.max(this.params.length, args && args.length); i++) { + _arguments.push((args[i] && args[i].value) || this.params[i].value); + } + frame.rules.unshift(new(tree.Rule)('@arguments', new(tree.Expression)(_arguments).eval(env))); + + rules = important ? + this.rules.map(function (r) { + return new(tree.Rule)(r.name, r.value, '!important', r.index); + }) : this.rules.slice(0); + + return new(tree.Ruleset)(null, rules).eval({ + frames: [this, frame].concat(this.frames, env.frames) + }); + }, + match: function (args, env) { + var argsLength = (args && args.length) || 0, len, frame; + + if (! this.variadic) { + if (argsLength < this.required) { return false } + if (argsLength > this.params.length) { return false } + if ((this.required > 0) && (argsLength > this.params.length)) { return false } + } + + if (this.condition && !this.condition.eval({ + frames: [this.evalParams(env, args)].concat(env.frames) + })) { return false } + + len = Math.min(argsLength, this.arity); + + for (var i = 0; i < len; i++) { + if (!this.params[i].name) { + if (args[i].value.eval(env).toCSS() != this.params[i].value.eval(env).toCSS()) { + return false; + } + } + } + return true; + } +}; + +})(require('../tree')); +(function (tree) { + +tree.Operation = function (op, operands) { + this.op = op.trim(); + this.operands = operands; +}; +tree.Operation.prototype.eval = function (env) { + var a = this.operands[0].eval(env), + b = this.operands[1].eval(env), + temp; + + if (a instanceof tree.Dimension && b instanceof tree.Color) { + if (this.op === '*' || this.op === '+') { + temp = b, b = a, a = temp; + } else { + throw { name: "OperationError", + message: "Can't substract or divide a color from a number" }; + } + } + return a.operate(this.op, b); +}; + +tree.operate = function (op, a, b) { + switch (op) { + case '+': return a + b; + case '-': return a - b; + case '*': return a * b; + case '/': return a / b; + } +}; + +})(require('../tree')); + +(function (tree) { + +tree.Paren = function (node) { + this.value = node; +}; +tree.Paren.prototype = { + toCSS: function (env) { + return '(' + this.value.toCSS(env) + ')'; + }, + eval: function (env) { + return new(tree.Paren)(this.value.eval(env)); + } +}; + +})(require('../tree')); +(function (tree) { + +tree.Quoted = function (str, content, escaped, i) { + this.escaped = escaped; + this.value = content || ''; + this.quote = str.charAt(0); + this.index = i; +}; +tree.Quoted.prototype = { + toCSS: function () { + if (this.escaped) { + return this.value; + } else { + return this.quote + this.value + this.quote; + } + }, + eval: function (env) { + var that = this; + var value = this.value.replace(/`([^`]+)`/g, function (_, exp) { + return new(tree.JavaScript)(exp, that.index, true).eval(env).value; + }).replace(/@\{([\w-]+)\}/g, function (_, name) { + var v = new(tree.Variable)('@' + name, that.index).eval(env); + return ('value' in v) ? v.value : v.toCSS(); + }); + return new(tree.Quoted)(this.quote + value + this.quote, value, this.escaped, this.index); + }, + compare: function (x) { + if (!x.toCSS) { + return -1; + } + + var left = this.toCSS(), + right = x.toCSS(); + + if (left === right) { + return 0; + } + + return left < right ? -1 : 1; + } +}; + +})(require('../tree')); +(function (tree) { + +tree.Ratio = function (value) { + this.value = value; +}; +tree.Ratio.prototype = { + toCSS: function (env) { + return this.value; + }, + eval: function () { return this } +}; + +})(require('../tree')); +(function (tree) { + +tree.Rule = function (name, value, important, index, inline) { + this.name = name; + this.value = (value instanceof tree.Value) ? value : new(tree.Value)([value]); + this.important = important ? ' ' + important.trim() : ''; + this.index = index; + this.inline = inline || false; + + if (name.charAt(0) === '@') { + this.variable = true; + } else { this.variable = false } +}; +tree.Rule.prototype.toCSS = function (env) { + if (this.variable) { return "" } + else { + return this.name + (env.compress ? ':' : ': ') + + this.value.toCSS(env) + + this.important + (this.inline ? "" : ";"); + } +}; + +tree.Rule.prototype.eval = function (context) { + return new(tree.Rule)(this.name, + this.value.eval(context), + this.important, + this.index, this.inline); +}; + +tree.Shorthand = function (a, b) { + this.a = a; + this.b = b; +}; + +tree.Shorthand.prototype = { + toCSS: function (env) { + return this.a.toCSS(env) + "/" + this.b.toCSS(env); + }, + eval: function () { return this } +}; + +})(require('../tree')); +(function (tree) { + +tree.Ruleset = function (selectors, rules, strictImports) { + this.selectors = selectors; + this.rules = rules; + this._lookups = {}; + this.strictImports = strictImports; +}; +tree.Ruleset.prototype = { + eval: function (env) { + var selectors = this.selectors && this.selectors.map(function (s) { return s.eval(env) }); + var ruleset = new(tree.Ruleset)(selectors, this.rules.slice(0), this.strictImports); + var rules = []; + + ruleset.root = this.root; + ruleset.allowImports = this.allowImports; + + // push the current ruleset to the frames stack + env.frames.unshift(ruleset); + + // Evaluate imports + if (ruleset.root || ruleset.allowImports || !ruleset.strictImports) { + for (var i = 0; i < ruleset.rules.length; i++) { + if (ruleset.rules[i] instanceof tree.Import) { + rules = rules.concat(ruleset.rules[i].eval(env)); + } else { + rules.push(ruleset.rules[i]); + } + } + ruleset.rules = rules; + rules = []; + } + + // Store the frames around mixin definitions, + // so they can be evaluated like closures when the time comes. + for (var i = 0; i < ruleset.rules.length; i++) { + if (ruleset.rules[i] instanceof tree.mixin.Definition) { + ruleset.rules[i].frames = env.frames.slice(0); + } + } + + var mediaBlockCount = (env.mediaBlocks && env.mediaBlocks.length) || 0; + + // Evaluate mixin calls. + for (var i = 0; i < ruleset.rules.length; i++) { + if (ruleset.rules[i] instanceof tree.mixin.Call) { + rules = rules.concat(ruleset.rules[i].eval(env)); + } else { + rules.push(ruleset.rules[i]); + } + } + ruleset.rules = rules; + + // Evaluate everything else + for (var i = 0, rule; i < ruleset.rules.length; i++) { + rule = ruleset.rules[i]; + + if (! (rule instanceof tree.mixin.Definition)) { + ruleset.rules[i] = rule.eval ? rule.eval(env) : rule; + } + } + + // Pop the stack + env.frames.shift(); + + if (env.mediaBlocks) { + for(var i = mediaBlockCount; i < env.mediaBlocks.length; i++) { + env.mediaBlocks[i].bubbleSelectors(selectors); + } + } + + return ruleset; + }, + match: function (args) { + return !args || args.length === 0; + }, + variables: function () { + if (this._variables) { return this._variables } + else { + return this._variables = this.rules.reduce(function (hash, r) { + if (r instanceof tree.Rule && r.variable === true) { + hash[r.name] = r; + } + return hash; + }, {}); + } + }, + variable: function (name) { + return this.variables()[name]; + }, + rulesets: function () { + if (this._rulesets) { return this._rulesets } + else { + return this._rulesets = this.rules.filter(function (r) { + return (r instanceof tree.Ruleset) || (r instanceof tree.mixin.Definition); + }); + } + }, + find: function (selector, self) { + self = self || this; + var rules = [], rule, match, + key = selector.toCSS(); + + if (key in this._lookups) { return this._lookups[key] } + + this.rulesets().forEach(function (rule) { + if (rule !== self) { + for (var j = 0; j < rule.selectors.length; j++) { + if (match = selector.match(rule.selectors[j])) { + if (selector.elements.length > rule.selectors[j].elements.length) { + Array.prototype.push.apply(rules, rule.find( + new(tree.Selector)(selector.elements.slice(1)), self)); + } else { + rules.push(rule); + } + break; + } + } + } + }); + return this._lookups[key] = rules; + }, + // + // Entry point for code generation + // + // `context` holds an array of arrays. + // + toCSS: function (context, env) { + var css = [], // The CSS output + rules = [], // node.Rule instances + _rules = [], // + rulesets = [], // node.Ruleset instances + paths = [], // Current selectors + selector, // The fully rendered selector + rule; + + if (! this.root) { + this.joinSelectors(paths, context, this.selectors); + } + + // Compile rules and rulesets + for (var i = 0; i < this.rules.length; i++) { + rule = this.rules[i]; + + if (rule.rules || (rule instanceof tree.Directive) || (rule instanceof tree.Media)) { + rulesets.push(rule.toCSS(paths, env)); + } else if (rule instanceof tree.Comment) { + if (!rule.silent) { + if (this.root) { + rulesets.push(rule.toCSS(env)); + } else { + rules.push(rule.toCSS(env)); + } + } + } else { + if (rule.toCSS && !rule.variable) { + rules.push(rule.toCSS(env)); + } else if (rule.value && !rule.variable) { + rules.push(rule.value.toString()); + } + } + } + + rulesets = rulesets.join(''); + + // If this is the root node, we don't render + // a selector, or {}. + // Otherwise, only output if this ruleset has rules. + if (this.root) { + css.push(rules.join(env.compress ? '' : '\n')); + } else { + if (rules.length > 0) { + selector = paths.map(function (p) { + return p.map(function (s) { + return s.toCSS(env); + }).join('').trim(); + }).join(env.compress ? ',' : ',\n'); + + // Remove duplicates + for (var i = rules.length - 1; i >= 0; i--) { + if (_rules.indexOf(rules[i]) === -1) { + _rules.unshift(rules[i]); + } + } + rules = _rules; + + css.push(selector, + (env.compress ? '{' : ' {\n ') + + rules.join(env.compress ? '' : '\n ') + + (env.compress ? '}' : '\n}\n')); + } + } + css.push(rulesets); + + return css.join('') + (env.compress ? '\n' : ''); + }, + + joinSelectors: function (paths, context, selectors) { + for (var s = 0; s < selectors.length; s++) { + this.joinSelector(paths, context, selectors[s]); + } + }, + + joinSelector: function (paths, context, selector) { + + var i, j, k, + hasParentSelector, newSelectors, el, sel, parentSel, + newSelectorPath, afterParentJoin, newJoinedSelector, + newJoinedSelectorEmpty, lastSelector, currentElements, + selectorsMultiplied; + + for (i = 0; i < selector.elements.length; i++) { + el = selector.elements[i]; + if (el.value === '&') { + hasParentSelector = true; + } + } + + if (!hasParentSelector) { + if (context.length > 0) { + for(i = 0; i < context.length; i++) { + paths.push(context[i].concat(selector)); + } + } + else { + paths.push([selector]); + } + return; + } + + // The paths are [[Selector]] + // The first list is a list of comma seperated selectors + // The inner list is a list of inheritance seperated selectors + // e.g. + // .a, .b { + // .c { + // } + // } + // == [[.a] [.c]] [[.b] [.c]] + // + + // the elements from the current selector so far + currentElements = []; + // the current list of new selectors to add to the path. + // We will build it up. We initiate it with one empty selector as we "multiply" the new selectors + // by the parents + newSelectors = [[]]; + + for (i = 0; i < selector.elements.length; i++) { + el = selector.elements[i]; + // non parent reference elements just get added + if (el.value !== "&") { + currentElements.push(el); + } else { + // the new list of selectors to add + selectorsMultiplied = []; + + // merge the current list of non parent selector elements + // on to the current list of selectors to add + if (currentElements.length > 0) { + this.mergeElementsOnToSelectors(currentElements, newSelectors); + } + + // loop through our current selectors + for(j = 0; j < newSelectors.length; j++) { + sel = newSelectors[j]; + // if we don't have any parent paths, the & might be in a mixin so that it can be used + // whether there are parents or not + if (context.length == 0) { + // the combinator used on el should now be applied to the next element instead so that + // it is not lost + if (sel.length > 0) { + sel[0].elements = sel[0].elements.slice(0); + sel[0].elements.push(new(tree.Element)(el.combinator, '', 0)); //new Element(el.Combinator, "")); + } + selectorsMultiplied.push(sel); + } + else { + // and the parent selectors + for(k = 0; k < context.length; k++) { + parentSel = context[k]; + // We need to put the current selectors + // then join the last selector's elements on to the parents selectors + + // our new selector path + newSelectorPath = []; + // selectors from the parent after the join + afterParentJoin = []; + newJoinedSelectorEmpty = true; + + //construct the joined selector - if & is the first thing this will be empty, + // if not newJoinedSelector will be the last set of elements in the selector + if (sel.length > 0) { + newSelectorPath = sel.slice(0); + lastSelector = newSelectorPath.pop(); + newJoinedSelector = new(tree.Selector)(lastSelector.elements.slice(0)); + newJoinedSelectorEmpty = false; + } + else { + newJoinedSelector = new(tree.Selector)([]); + } + + //put together the parent selectors after the join + if (parentSel.length > 1) { + afterParentJoin = afterParentJoin.concat(parentSel.slice(1)); + } + + if (parentSel.length > 0) { + newJoinedSelectorEmpty = false; + + // join the elements so far with the first part of the parent + newJoinedSelector.elements.push(new(tree.Element)(el.combinator, parentSel[0].elements[0].value, 0)); + newJoinedSelector.elements = newJoinedSelector.elements.concat(parentSel[0].elements.slice(1)); + } + + if (!newJoinedSelectorEmpty) { + // now add the joined selector + newSelectorPath.push(newJoinedSelector); + } + + // and the rest of the parent + newSelectorPath = newSelectorPath.concat(afterParentJoin); + + // add that to our new set of selectors + selectorsMultiplied.push(newSelectorPath); + } + } + } + + // our new selectors has been multiplied, so reset the state + newSelectors = selectorsMultiplied; + currentElements = []; + } + } + + // if we have any elements left over (e.g. .a& .b == .b) + // add them on to all the current selectors + if (currentElements.length > 0) { + this.mergeElementsOnToSelectors(currentElements, newSelectors); + } + + for(i = 0; i < newSelectors.length; i++) { + paths.push(newSelectors[i]); + } + }, + + mergeElementsOnToSelectors: function(elements, selectors) { + var i, sel; + + if (selectors.length == 0) { + selectors.push([ new(tree.Selector)(elements) ]); + return; + } + + for(i = 0; i < selectors.length; i++) { + sel = selectors[i]; + + // if the previous thing in sel is a parent this needs to join on to it + if (sel.length > 0) { + sel[sel.length - 1] = new(tree.Selector)(sel[sel.length - 1].elements.concat(elements)); + } + else { + sel.push(new(tree.Selector)(elements)); + } + } + } +}; +})(require('../tree')); +(function (tree) { + +tree.Selector = function (elements) { + this.elements = elements; +}; +tree.Selector.prototype.match = function (other) { + var len = this.elements.length, + olen = other.elements.length, + max = Math.min(len, olen); + + if (len < olen) { + return false; + } else { + for (var i = 0; i < max; i++) { + if (this.elements[i].value !== other.elements[i].value) { + return false; + } + } + } + return true; +}; +tree.Selector.prototype.eval = function (env) { + return new(tree.Selector)(this.elements.map(function (e) { + return e.eval(env); + })); +}; +tree.Selector.prototype.toCSS = function (env) { + if (this._css) { return this._css } + + if (this.elements[0].combinator.value === "") { + this._css = ' '; + } else { + this._css = ''; + } + + this._css += this.elements.map(function (e) { + if (typeof(e) === 'string') { + return ' ' + e.trim(); + } else { + return e.toCSS(env); + } + }).join(''); + + return this._css; +}; + +})(require('../tree')); +(function (tree) { + +tree.URL = function (val, paths) { + this.value = val; + this.paths = paths; +}; +tree.URL.prototype = { + toCSS: function () { + return "url(" + this.value.toCSS() + ")"; + }, + eval: function (ctx) { + var val = this.value.eval(ctx); + + // Add the base path if the URL is relative and we are in the browser + if (typeof window !== 'undefined' && typeof val.value === "string" && !/^(?:[a-z-]+:|\/)/.test(val.value) && this.paths.length > 0) { + val.value = this.paths[0] + (val.value.charAt(0) === '/' ? val.value.slice(1) : val.value); + } + + return new(tree.URL)(val, this.paths); + } +}; + +})(require('../tree')); +(function (tree) { + +tree.Value = function (value) { + this.value = value; + this.is = 'value'; +}; +tree.Value.prototype = { + eval: function (env) { + if (this.value.length === 1) { + return this.value[0].eval(env); + } else { + return new(tree.Value)(this.value.map(function (v) { + return v.eval(env); + })); + } + }, + toCSS: function (env) { + return this.value.map(function (e) { + return e.toCSS(env); + }).join(env.compress ? ',' : ', '); + } +}; + +})(require('../tree')); +(function (tree) { + +tree.Variable = function (name, index, file) { this.name = name, this.index = index, this.file = file }; +tree.Variable.prototype = { + eval: function (env) { + var variable, v, name = this.name; + + if (name.indexOf('@@') == 0) { + name = '@' + new(tree.Variable)(name.slice(1)).eval(env).value; + } + + if (variable = tree.find(env.frames, function (frame) { + if (v = frame.variable(name)) { + return v.value.eval(env); + } + })) { return variable } + else { + throw { type: 'Name', + message: "variable " + name + " is undefined", + filename: this.file, + index: this.index }; + } + } +}; + +})(require('../tree')); +(function (tree) { + +tree.find = function (obj, fun) { + for (var i = 0, r; i < obj.length; i++) { + if (r = fun.call(obj, obj[i])) { return r } + } + return null; +}; +tree.jsify = function (obj) { + if (Array.isArray(obj.value) && (obj.value.length > 1)) { + return '[' + obj.value.map(function (v) { return v.toCSS(false) }).join(', ') + ']'; + } else { + return obj.toCSS(false); + } +}; + +})(require('./tree')); +var name; + +function loadStyleSheet(sheet, callback, reload, remaining) { + var endOfPath = Math.max(name.lastIndexOf('/'), name.lastIndexOf('\\')), + sheetName = name.slice(0, endOfPath + 1) + sheet.href, + contents = sheet.contents || {}, + input = readFile(sheetName); + + contents[sheetName] = input; + + var parser = new less.Parser({ + paths: [sheet.href.replace(/[\w\.-]+$/, '')], + contents: contents + }); + parser.parse(input, function (e, root) { + if (e) { + return error(e, sheetName); + } + try { + callback(e, root, sheet, { local: false, lastModified: 0, remaining: remaining }); + } catch(e) { + error(e, sheetName); + } + }); +} + +function writeFile(filename, content) { + var fstream = new java.io.FileWriter(filename); + var out = new java.io.BufferedWriter(fstream); + out.write(content); + out.close(); +} + +// Command line integration via Rhino +(function (args) { + var output, + compress = false, + i; + + for(i = 0; i < args.length; i++) { + switch(args[i]) { + case "-x": + compress = true; + break; + default: + if (!name) { + name = args[i]; + } else if (!output) { + output = args[i]; + } else { + print("unrecognised parameters"); + print("input_file [output_file] [-x]"); + } + } + } + + if (!name) { + print('No files present in the fileset; Check your pattern match in build.xml'); + quit(1); + } + path = name.split("/");path.pop();path=path.join("/") + + var input = readFile(name); + + if (!input) { + print('lesscss: couldn\'t open file ' + name); + quit(1); + } + + var result; + try { + var parser = new less.Parser(); + parser.parse(input, function (e, root) { + if (e) { + error(e, name); + quit(1); + } else { + result = root.toCSS({compress: compress || false}); + if (output) { + writeFile(output, result); + print("Written to " + output); + } else { + print(result); + } + quit(0); + } + }); + } + catch(e) { + error(e, name); + quit(1); + } + print("done"); +}(arguments)); + +function error(e, filename) { + + var content = "Error : " + filename + "\n"; + + filename = e.filename || filename; + + if (e.message) { + content += e.message + "\n"; + } + + var errorline = function (e, i, classname) { + if (e.extract[i]) { + content += + String(parseInt(e.line) + (i - 1)) + + ":" + e.extract[i] + "\n"; + } + }; + + if (e.stack) { + content += e.stack; + } else if (e.extract) { + content += 'on line ' + e.line + ', column ' + (e.column + 1) + ':\n'; + errorline(e, 0); + errorline(e, 1); + errorline(e, 2); + } + print(content); +}
\ No newline at end of file diff --git a/src/main/webapp/plugins/RequireJS/r.js b/src/main/webapp/plugins/RequireJS/r.js new file mode 100644 index 0000000..aaafadf --- /dev/null +++ b/src/main/webapp/plugins/RequireJS/r.js @@ -0,0 +1,15568 @@ +/** + * @license r.js 2.0.2+ Sun, 08 Jul 2012 06:41:19 GMT Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ + +/* + * This is a bootstrap script to allow running RequireJS in the command line + * in either a Java/Rhino or Node environment. It is modified by the top-level + * dist.js file to inject other files to completely enable this file. It is + * the shell of the r.js file. + */ + +/*jslint evil: true, nomen: true, sloppy: true */ +/*global readFile: true, process: false, Packages: false, print: false, +console: false, java: false, module: false, requirejsVars */ + +var requirejs, require, define; +(function (console, args, readFileFunc) { + + var fileName, env, fs, vm, path, exec, rhinoContext, dir, nodeRequire, + nodeDefine, exists, reqMain, loadedOptimizedLib, existsForNode, + version = '2.0.2+ Sun, 08 Jul 2012 06:41:19 GMT', + jsSuffixRegExp = /\.js$/, + commandOption = '', + useLibLoaded = {}, + //Used by jslib/rhino/args.js + rhinoArgs = args, + readFile = typeof readFileFunc !== 'undefined' ? readFileFunc : null; + + function showHelp() { + console.log('See https://github.com/jrburke/r.js for usage.'); + } + + if (typeof Packages !== 'undefined') { + env = 'rhino'; + + fileName = args[0]; + + if (fileName && fileName.indexOf('-') === 0) { + commandOption = fileName.substring(1); + fileName = args[1]; + } + + //Set up execution context. + rhinoContext = Packages.org.mozilla.javascript.ContextFactory.getGlobal().enterContext(); + + exec = function (string, name) { + return rhinoContext.evaluateString(this, string, name, 0, null); + }; + + exists = function (fileName) { + return (new java.io.File(fileName)).exists(); + }; + + //Define a console.log for easier logging. Don't + //get fancy though. + if (typeof console === 'undefined') { + console = { + log: function () { + print.apply(undefined, arguments); + } + }; + } + } else if (typeof process !== 'undefined') { + env = 'node'; + + //Get the fs module via Node's require before it + //gets replaced. Used in require/node.js + fs = require('fs'); + vm = require('vm'); + path = require('path'); + //In Node 0.7+ existsSync is on fs. + existsForNode = fs.existsSync || path.existsSync; + + nodeRequire = require; + nodeDefine = define; + reqMain = require.main; + + //Temporarily hide require and define to allow require.js to define + //them. + require = undefined; + define = undefined; + + readFile = function (path) { + return fs.readFileSync(path, 'utf8'); + }; + + exec = function (string, name) { + return vm.runInThisContext(this.requirejsVars.require.makeNodeWrapper(string), + name ? fs.realpathSync(name) : ''); + }; + + exists = function (fileName) { + return existsForNode(fileName); + }; + + + fileName = process.argv[2]; + + if (fileName && fileName.indexOf('-') === 0) { + commandOption = fileName.substring(1); + fileName = process.argv[3]; + } + } + + /** vim: et:ts=4:sw=4:sts=4 + * @license RequireJS 2.0.2+ Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ +/*jslint regexp: true, nomen: true */ +/*global window, navigator, document, importScripts, jQuery, setTimeout, opera */ + + +(function (global) { + 'use strict'; + + var version = '2.0.2+', + commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg, + cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g, + jsSuffixRegExp = /\.js$/, + currDirRegExp = /^\.\//, + ostring = Object.prototype.toString, + ap = Array.prototype, + aps = ap.slice, + apsp = ap.splice, + isBrowser = !!(typeof window !== 'undefined' && navigator && document), + isWebWorker = !isBrowser && typeof importScripts !== 'undefined', + //PS3 indicates loaded and complete, but need to wait for complete + //specifically. Sequence is 'loading', 'loaded', execution, + // then 'complete'. The UA check is unfortunate, but not sure how + //to feature test w/o causing perf issues. + readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ? + /^complete$/ : /^(complete|loaded)$/, + defContextName = '_', + //Oh the tragedy, detecting opera. See the usage of isOpera for reason. + isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]', + contexts = {}, + cfg = {}, + globalDefQueue = [], + useInteractive = false, + req, s, head, baseElement, dataMain, src, + interactiveScript, currentlyAddingScript, mainScript, subPath; + + function isFunction(it) { + return ostring.call(it) === '[object Function]'; + } + + function isArray(it) { + return ostring.call(it) === '[object Array]'; + } + + /** + * Helper function for iterating over an array. If the func returns + * a true value, it will break out of the loop. + */ + function each(ary, func) { + if (ary) { + var i; + for (i = 0; i < ary.length; i += 1) { + if (ary[i] && func(ary[i], i, ary)) { + break; + } + } + } + } + + /** + * Helper function for iterating over an array backwards. If the func + * returns a true value, it will break out of the loop. + */ + function eachReverse(ary, func) { + if (ary) { + var i; + for (i = ary.length - 1; i > -1; i -= 1) { + if (ary[i] && func(ary[i], i, ary)) { + break; + } + } + } + } + + function hasProp(obj, prop) { + return obj.hasOwnProperty(prop); + } + + /** + * Cycles over properties in an object and calls a function for each + * property value. If the function returns a truthy value, then the + * iteration is stopped. + */ + function eachProp(obj, func) { + var prop; + for (prop in obj) { + if (obj.hasOwnProperty(prop)) { + if (func(obj[prop], prop)) { + break; + } + } + } + } + + /** + * Simple function to mix in properties from source into target, + * but only if target does not already have a property of the same name. + * This is not robust in IE for transferring methods that match + * Object.prototype names, but the uses of mixin here seem unlikely to + * trigger a problem related to that. + */ + function mixin(target, source, force, deepStringMixin) { + if (source) { + eachProp(source, function (value, prop) { + if (force || !hasProp(target, prop)) { + if (deepStringMixin && typeof value !== 'string') { + if (!target[prop]) { + target[prop] = {}; + } + mixin(target[prop], value, force, deepStringMixin); + } else { + target[prop] = value; + } + } + }); + } + return target; + } + + //Similar to Function.prototype.bind, but the 'this' object is specified + //first, since it is easier to read/figure out what 'this' will be. + function bind(obj, fn) { + return function () { + return fn.apply(obj, arguments); + }; + } + + function scripts() { + return document.getElementsByTagName('script'); + } + + //Allow getting a global that expressed in + //dot notation, like 'a.b.c'. + function getGlobal(value) { + if (!value) { + return value; + } + var g = global; + each(value.split('.'), function (part) { + g = g[part]; + }); + return g; + } + + function makeContextModuleFunc(func, relMap, enableBuildCallback) { + return function () { + //A version of a require function that passes a moduleName + //value for items that may need to + //look up paths relative to the moduleName + var args = aps.call(arguments, 0), lastArg; + if (enableBuildCallback && + isFunction((lastArg = args[args.length - 1]))) { + lastArg.__requireJsBuild = true; + } + args.push(relMap); + return func.apply(null, args); + }; + } + + function addRequireMethods(req, context, relMap) { + each([ + ['toUrl'], + ['undef'], + ['defined', 'requireDefined'], + ['specified', 'requireSpecified'] + ], function (item) { + var prop = item[1] || item[0]; + req[item[0]] = context ? makeContextModuleFunc(context[prop], relMap) : + //If no context, then use default context. Reference from + //contexts instead of early binding to default context, so + //that during builds, the latest instance of the default + //context with its config gets used. + function () { + var ctx = contexts[defContextName]; + return ctx[prop].apply(ctx, arguments); + }; + }); + } + + /** + * Constructs an error with a pointer to an URL with more information. + * @param {String} id the error ID that maps to an ID on a web page. + * @param {String} message human readable error. + * @param {Error} [err] the original error, if there is one. + * + * @returns {Error} + */ + function makeError(id, msg, err, requireModules) { + var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id); + e.requireType = id; + e.requireModules = requireModules; + if (err) { + e.originalError = err; + } + return e; + } + + if (typeof define !== 'undefined') { + //If a define is already in play via another AMD loader, + //do not overwrite. + return; + } + + if (typeof requirejs !== 'undefined') { + if (isFunction(requirejs)) { + //Do not overwrite and existing requirejs instance. + return; + } + cfg = requirejs; + requirejs = undefined; + } + + //Allow for a require config object + if (typeof require !== 'undefined' && !isFunction(require)) { + //assume it is a config object. + cfg = require; + require = undefined; + } + + function newContext(contextName) { + var config = { + waitSeconds: 7, + baseUrl: './', + paths: {}, + pkgs: {}, + shim: {} + }, + registry = {}, + undefEvents = {}, + defQueue = [], + defined = {}, + urlFetched = {}, + requireCounter = 1, + unnormalizedCounter = 1, + //Used to track the order in which modules + //should be executed, by the order they + //load. Important for consistent cycle resolution + //behavior. + waitAry = [], + inCheckLoaded, Module, context, handlers, + checkLoadedTimeoutId; + + /** + * Trims the . and .. from an array of path segments. + * It will keep a leading path segment if a .. will become + * the first path segment, to help with module name lookups, + * which act like paths, but can be remapped. But the end result, + * all paths that use this function should look normalized. + * NOTE: this method MODIFIES the input array. + * @param {Array} ary the array of path segments. + */ + function trimDots(ary) { + var i, part; + for (i = 0; ary[i]; i+= 1) { + part = ary[i]; + if (part === '.') { + ary.splice(i, 1); + i -= 1; + } else if (part === '..') { + if (i === 1 && (ary[2] === '..' || ary[0] === '..')) { + //End of the line. Keep at least one non-dot + //path segment at the front so it can be mapped + //correctly to disk. Otherwise, there is likely + //no path mapping for a path starting with '..'. + //This can still fail, but catches the most reasonable + //uses of .. + break; + } else if (i > 0) { + ary.splice(i - 1, 2); + i -= 2; + } + } + } + } + + /** + * Given a relative module name, like ./something, normalize it to + * a real name that can be mapped to a path. + * @param {String} name the relative name + * @param {String} baseName a real name that the name arg is relative + * to. + * @param {Boolean} applyMap apply the map config to the value. Should + * only be done if this normalization is for a dependency ID. + * @returns {String} normalized name + */ + function normalize(name, baseName, applyMap) { + var baseParts = baseName && baseName.split('/'), + normalizedBaseParts = baseParts, + map = config.map, + starMap = map && map['*'], + pkgName, pkgConfig, mapValue, nameParts, i, j, nameSegment, + foundMap; + + //Adjust any relative paths. + if (name && name.charAt(0) === '.') { + //If have a base name, try to normalize against it, + //otherwise, assume it is a top-level require that will + //be relative to baseUrl in the end. + if (baseName) { + if (config.pkgs[baseName]) { + //If the baseName is a package name, then just treat it as one + //name to concat the name with. + baseParts = [baseName]; + } else { + //Convert baseName to array, and lop off the last part, + //so that . matches that 'directory' and not name of the baseName's + //module. For instance, baseName of 'one/two/three', maps to + //'one/two/three.js', but we want the directory, 'one/two' for + //this normalization. + normalizedBaseParts = baseParts.slice(0, baseParts.length - 1); + } + + name = normalizedBaseParts.concat(name.split('/')); + trimDots(name); + + //Some use of packages may use a . path to reference the + //'main' module name, so normalize for that. + pkgConfig = config.pkgs[(pkgName = name[0])]; + name = name.join('/'); + if (pkgConfig && name === pkgName + '/' + pkgConfig.main) { + name = pkgName; + } + } else if (name.indexOf('./') === 0) { + // No baseName, so this is ID is resolved relative + // to baseUrl, pull off the leading dot. + name = name.substring(2); + } + } + + //Apply map config if available. + if (applyMap && (baseParts || starMap) && map) { + nameParts = name.split('/'); + + for (i = nameParts.length; i > 0; i -= 1) { + nameSegment = nameParts.slice(0, i).join('/'); + + if (baseParts) { + //Find the longest baseName segment match in the config. + //So, do joins on the biggest to smallest lengths of baseParts. + for (j = baseParts.length; j > 0; j -= 1) { + mapValue = map[baseParts.slice(0, j).join('/')]; + + //baseName segment has config, find if it has one for + //this name. + if (mapValue) { + mapValue = mapValue[nameSegment]; + if (mapValue) { + //Match, update name to the new value. + foundMap = mapValue; + break; + } + } + } + } + + if (!foundMap && starMap && starMap[nameSegment]) { + foundMap = starMap[nameSegment]; + } + + if (foundMap) { + nameParts.splice(0, i, foundMap); + name = nameParts.join('/'); + break; + } + } + } + + return name; + } + + function removeScript(name) { + if (isBrowser) { + each(scripts(), function (scriptNode) { + if (scriptNode.getAttribute('data-requiremodule') === name && + scriptNode.getAttribute('data-requirecontext') === context.contextName) { + scriptNode.parentNode.removeChild(scriptNode); + return true; + } + }); + } + } + + function hasPathFallback(id) { + var pathConfig = config.paths[id]; + if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) { + removeScript(id); + //Pop off the first array value, since it failed, and + //retry + pathConfig.shift(); + context.undef(id); + context.require([id]); + return true; + } + } + + /** + * Creates a module mapping that includes plugin prefix, module + * name, and path. If parentModuleMap is provided it will + * also normalize the name via require.normalize() + * + * @param {String} name the module name + * @param {String} [parentModuleMap] parent module map + * for the module name, used to resolve relative names. + * @param {Boolean} isNormalized: is the ID already normalized. + * This is true if this call is done for a define() module ID. + * @param {Boolean} applyMap: apply the map config to the ID. + * Should only be true if this map is for a dependency. + * + * @returns {Object} + */ + function makeModuleMap(name, parentModuleMap, isNormalized, applyMap) { + var index = name ? name.indexOf('!') : -1, + prefix = null, + parentName = parentModuleMap ? parentModuleMap.name : null, + originalName = name, + isDefine = true, + normalizedName = '', + url, pluginModule, suffix; + + //If no name, then it means it is a require call, generate an + //internal name. + if (!name) { + isDefine = false; + name = '_@r' + (requireCounter += 1); + } + + if (index !== -1) { + prefix = name.substring(0, index); + name = name.substring(index + 1, name.length); + } + + if (prefix) { + prefix = normalize(prefix, parentName, applyMap); + pluginModule = defined[prefix]; + } + + //Account for relative paths if there is a base name. + if (name) { + if (prefix) { + if (pluginModule && pluginModule.normalize) { + //Plugin is loaded, use its normalize method. + normalizedName = pluginModule.normalize(name, function (name) { + return normalize(name, parentName, applyMap); + }); + } else { + normalizedName = normalize(name, parentName, applyMap); + } + } else { + //A regular module. + normalizedName = normalize(name, parentName, applyMap); + url = context.nameToUrl(normalizedName); + } + } + + //If the id is a plugin id that cannot be determined if it needs + //normalization, stamp it with a unique ID so two matching relative + //ids that may conflict can be separate. + suffix = prefix && !pluginModule && !isNormalized ? + '_unnormalized' + (unnormalizedCounter += 1) : + ''; + + return { + prefix: prefix, + name: normalizedName, + parentMap: parentModuleMap, + unnormalized: !!suffix, + url: url, + originalName: originalName, + isDefine: isDefine, + id: (prefix ? + prefix + '!' + normalizedName : + normalizedName) + suffix + }; + } + + function getModule(depMap) { + var id = depMap.id, + mod = registry[id]; + + if (!mod) { + mod = registry[id] = new context.Module(depMap); + } + + return mod; + } + + function on(depMap, name, fn) { + var id = depMap.id, + mod = registry[id]; + + if (hasProp(defined, id) && + (!mod || mod.defineEmitComplete)) { + if (name === 'defined') { + fn(defined[id]); + } + } else { + getModule(depMap).on(name, fn); + } + } + + function onError(err, errback) { + var ids = err.requireModules, + notified = false; + + if (errback) { + errback(err); + } else { + each(ids, function (id) { + var mod = registry[id]; + if (mod) { + //Set error on module, so it skips timeout checks. + mod.error = err; + if (mod.events.error) { + notified = true; + mod.emit('error', err); + } + } + }); + + if (!notified) { + req.onError(err); + } + } + } + + /** + * Internal method to transfer globalQueue items to this context's + * defQueue. + */ + function takeGlobalQueue() { + //Push all the globalDefQueue items into the context's defQueue + if (globalDefQueue.length) { + //Array splice in the values since the context code has a + //local var ref to defQueue, so cannot just reassign the one + //on context. + apsp.apply(defQueue, + [defQueue.length - 1, 0].concat(globalDefQueue)); + globalDefQueue = []; + } + } + + /** + * Helper function that creates a require function object to give to + * modules that ask for it as a dependency. It needs to be specific + * per module because of the implication of path mappings that may + * need to be relative to the module name. + */ + function makeRequire(mod, enableBuildCallback, altRequire) { + var relMap = mod && mod.map, + modRequire = makeContextModuleFunc(altRequire || context.require, + relMap, + enableBuildCallback); + + addRequireMethods(modRequire, context, relMap); + modRequire.isBrowser = isBrowser; + + return modRequire; + } + + handlers = { + 'require': function (mod) { + return makeRequire(mod); + }, + 'exports': function (mod) { + mod.usingExports = true; + if (mod.map.isDefine) { + return (mod.exports = defined[mod.map.id] = {}); + } + }, + 'module': function (mod) { + return (mod.module = { + id: mod.map.id, + uri: mod.map.url, + config: function () { + return (config.config && config.config[mod.map.id]) || {}; + }, + exports: defined[mod.map.id] + }); + } + }; + + function removeWaiting(id) { + //Clean up machinery used for waiting modules. + delete registry[id]; + + each(waitAry, function (mod, i) { + if (mod.map.id === id) { + waitAry.splice(i, 1); + if (!mod.defined) { + context.waitCount -= 1; + } + return true; + } + }); + } + + function findCycle(mod, traced) { + var id = mod.map.id, + depArray = mod.depMaps, + foundModule; + + //Do not bother with unitialized modules or not yet enabled + //modules. + if (!mod.inited) { + return; + } + + //Found the cycle. + if (traced[id]) { + return mod; + } + + traced[id] = true; + + //Trace through the dependencies. + each(depArray, function (depMap) { + var depId = depMap.id, + depMod = registry[depId]; + + if (!depMod) { + return; + } + + if (!depMod.inited || !depMod.enabled) { + //Dependency is not inited, so this cannot + //be used to determine a cycle. + foundModule = null; + delete traced[id]; + return true; + } + + //mixin traced to a new object for each dependency, so that + //sibling dependencies in this object to not generate a + //false positive match on a cycle. Ideally an Object.create + //type of prototype delegation would be used here, but + //optimizing for file size vs. execution speed since hopefully + //the trees are small for circular dependency scans relative + //to the full app perf. + return (foundModule = findCycle(depMod, mixin({}, traced))); + }); + + return foundModule; + } + + function forceExec(mod, traced, uninited) { + var id = mod.map.id, + depArray = mod.depMaps; + + if (!mod.inited || !mod.map.isDefine) { + return; + } + + if (traced[id]) { + return defined[id]; + } + + traced[id] = mod; + + each(depArray, function(depMap) { + var depId = depMap.id, + depMod = registry[depId], + value; + + if (handlers[depId]) { + return; + } + + if (depMod) { + if (!depMod.inited || !depMod.enabled) { + //Dependency is not inited, + //so this module cannot be + //given a forced value yet. + uninited[id] = true; + return; + } + + //Get the value for the current dependency + value = forceExec(depMod, traced, uninited); + + //Even with forcing it may not be done, + //in particular if the module is waiting + //on a plugin resource. + if (!uninited[depId]) { + mod.defineDepById(depId, value); + } + } + }); + + mod.check(true); + + return defined[id]; + } + + function modCheck(mod) { + mod.check(); + } + + function checkLoaded() { + var waitInterval = config.waitSeconds * 1000, + //It is possible to disable the wait interval by using waitSeconds of 0. + expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(), + noLoads = [], + stillLoading = false, + needCycleCheck = true, + map, modId, err, usingPathFallback; + + //Do not bother if this call was a result of a cycle break. + if (inCheckLoaded) { + return; + } + + inCheckLoaded = true; + + //Figure out the state of all the modules. + eachProp(registry, function (mod) { + map = mod.map; + modId = map.id; + + //Skip things that are not enabled or in error state. + if (!mod.enabled) { + return; + } + + if (!mod.error) { + //If the module should be executed, and it has not + //been inited and time is up, remember it. + if (!mod.inited && expired) { + if (hasPathFallback(modId)) { + usingPathFallback = true; + stillLoading = true; + } else { + noLoads.push(modId); + removeScript(modId); + } + } else if (!mod.inited && mod.fetched && map.isDefine) { + stillLoading = true; + if (!map.prefix) { + //No reason to keep looking for unfinished + //loading. If the only stillLoading is a + //plugin resource though, keep going, + //because it may be that a plugin resource + //is waiting on a non-plugin cycle. + return (needCycleCheck = false); + } + } + } + }); + + if (expired && noLoads.length) { + //If wait time expired, throw error of unloaded modules. + err = makeError('timeout', 'Load timeout for modules: ' + noLoads, null, noLoads); + err.contextName = context.contextName; + return onError(err); + } + + //Not expired, check for a cycle. + if (needCycleCheck) { + + each(waitAry, function (mod) { + if (mod.defined) { + return; + } + + var cycleMod = findCycle(mod, {}), + traced = {}; + + if (cycleMod) { + forceExec(cycleMod, traced, {}); + + //traced modules may have been + //removed from the registry, but + //their listeners still need to + //be called. + eachProp(traced, modCheck); + } + }); + + //Now that dependencies have + //been satisfied, trigger the + //completion check that then + //notifies listeners. + eachProp(registry, modCheck); + } + + //If still waiting on loads, and the waiting load is something + //other than a plugin resource, or there are still outstanding + //scripts, then just try back later. + if ((!expired || usingPathFallback) && stillLoading) { + //Something is still waiting to load. Wait for it, but only + //if a timeout is not already in effect. + if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) { + checkLoadedTimeoutId = setTimeout(function () { + checkLoadedTimeoutId = 0; + checkLoaded(); + }, 50); + } + } + + inCheckLoaded = false; + } + + Module = function (map) { + this.events = undefEvents[map.id] || {}; + this.map = map; + this.shim = config.shim[map.id]; + this.depExports = []; + this.depMaps = []; + this.depMatched = []; + this.pluginMaps = {}; + this.depCount = 0; + + /* this.exports this.factory + this.depMaps = [], + this.enabled, this.fetched + */ + }; + + Module.prototype = { + init: function(depMaps, factory, errback, options) { + options = options || {}; + + //Do not do more inits if already done. Can happen if there + //are multiple define calls for the same module. That is not + //a normal, common case, but it is also not unexpected. + if (this.inited) { + return; + } + + this.factory = factory; + + if (errback) { + //Register for errors on this module. + this.on('error', errback); + } else if (this.events.error) { + //If no errback already, but there are error listeners + //on this module, set up an errback to pass to the deps. + errback = bind(this, function (err) { + this.emit('error', err); + }); + } + + //Do a copy of the dependency array, so that + //source inputs are not modified. For example + //"shim" deps are passed in here directly, and + //doing a direct modification of the depMaps array + //would affect that config. + this.depMaps = depMaps && depMaps.slice(0); + this.depMaps.rjsSkipMap = depMaps.rjsSkipMap; + + this.errback = errback; + + //Indicate this module has be initialized + this.inited = true; + + this.ignore = options.ignore; + + //Could have option to init this module in enabled mode, + //or could have been previously marked as enabled. However, + //the dependencies are not known until init is called. So + //if enabled previously, now trigger dependencies as enabled. + if (options.enabled || this.enabled) { + //Enable this module and dependencies. + //Will call this.check() + this.enable(); + } else { + this.check(); + } + }, + + defineDepById: function (id, depExports) { + var i; + + //Find the index for this dependency. + each(this.depMaps, function (map, index) { + if (map.id === id) { + i = index; + return true; + } + }); + + return this.defineDep(i, depExports); + }, + + defineDep: function (i, depExports) { + //Because of cycles, defined callback for a given + //export can be called more than once. + if (!this.depMatched[i]) { + this.depMatched[i] = true; + this.depCount -= 1; + this.depExports[i] = depExports; + } + }, + + fetch: function () { + if (this.fetched) { + return; + } + this.fetched = true; + + context.startTime = (new Date()).getTime(); + + var map = this.map; + + //If the manager is for a plugin managed resource, + //ask the plugin to load it now. + if (this.shim) { + makeRequire(this, true)(this.shim.deps || [], bind(this, function () { + return map.prefix ? this.callPlugin() : this.load(); + })); + } else { + //Regular dependency. + return map.prefix ? this.callPlugin() : this.load(); + } + }, + + load: function() { + var url = this.map.url; + + //Regular dependency. + if (!urlFetched[url]) { + urlFetched[url] = true; + context.load(this.map.id, url); + } + }, + + /** + * Checks is the module is ready to define itself, and if so, + * define it. If the silent argument is true, then it will just + * define, but not notify listeners, and not ask for a context-wide + * check of all loaded modules. That is useful for cycle breaking. + */ + check: function (silent) { + if (!this.enabled || this.enabling) { + return; + } + + var id = this.map.id, + depExports = this.depExports, + exports = this.exports, + factory = this.factory, + err, cjsModule; + + if (!this.inited) { + this.fetch(); + } else if (this.error) { + this.emit('error', this.error); + } else if (!this.defining) { + //The factory could trigger another require call + //that would result in checking this module to + //define itself again. If already in the process + //of doing that, skip this work. + this.defining = true; + + if (this.depCount < 1 && !this.defined) { + if (isFunction(factory)) { + //If there is an error listener, favor passing + //to that instead of throwing an error. + if (this.events.error) { + try { + exports = context.execCb(id, factory, depExports, exports); + } catch (e) { + err = e; + } + } else { + exports = context.execCb(id, factory, depExports, exports); + } + + if (this.map.isDefine) { + //If setting exports via 'module' is in play, + //favor that over return value and exports. After that, + //favor a non-undefined return value over exports use. + cjsModule = this.module; + if (cjsModule && + cjsModule.exports !== undefined && + //Make sure it is not already the exports value + cjsModule.exports !== this.exports) { + exports = cjsModule.exports; + } else if (exports === undefined && this.usingExports) { + //exports already set the defined value. + exports = this.exports; + } + } + + if (err) { + err.requireMap = this.map; + err.requireModules = [this.map.id]; + err.requireType = 'define'; + return onError((this.error = err)); + } + + } else { + //Just a literal value + exports = factory; + } + + this.exports = exports; + + if (this.map.isDefine && !this.ignore) { + defined[id] = exports; + + if (req.onResourceLoad) { + req.onResourceLoad(context, this.map, this.depMaps); + } + } + + //Clean up + delete registry[id]; + + this.defined = true; + context.waitCount -= 1; + if (context.waitCount === 0) { + //Clear the wait array used for cycles. + waitAry = []; + } + } + + //Finished the define stage. Allow calling check again + //to allow define notifications below in the case of a + //cycle. + this.defining = false; + + if (!silent) { + if (this.defined && !this.defineEmitted) { + this.defineEmitted = true; + this.emit('defined', this.exports); + this.defineEmitComplete = true; + } + } + } + }, + + callPlugin: function() { + var map = this.map, + id = map.id, + pluginMap = makeModuleMap(map.prefix, null, false, true); + + on(pluginMap, 'defined', bind(this, function (plugin) { + var name = this.map.name, + parentName = this.map.parentMap ? this.map.parentMap.name : null, + load, normalizedMap, normalizedMod; + + //If current map is not normalized, wait for that + //normalized name to load instead of continuing. + if (this.map.unnormalized) { + //Normalize the ID if the plugin allows it. + if (plugin.normalize) { + name = plugin.normalize(name, function (name) { + return normalize(name, parentName, true); + }) || ''; + } + + normalizedMap = makeModuleMap(map.prefix + '!' + name, + this.map.parentMap, + false, + true); + on(normalizedMap, + 'defined', bind(this, function (value) { + this.init([], function () { return value; }, null, { + enabled: true, + ignore: true + }); + })); + normalizedMod = registry[normalizedMap.id]; + if (normalizedMod) { + if (this.events.error) { + normalizedMod.on('error', bind(this, function (err) { + this.emit('error', err); + })); + } + normalizedMod.enable(); + } + + return; + } + + load = bind(this, function (value) { + this.init([], function () { return value; }, null, { + enabled: true + }); + }); + + load.error = bind(this, function (err) { + this.inited = true; + this.error = err; + err.requireModules = [id]; + + //Remove temp unnormalized modules for this module, + //since they will never be resolved otherwise now. + eachProp(registry, function (mod) { + if (mod.map.id.indexOf(id + '_unnormalized') === 0) { + removeWaiting(mod.map.id); + } + }); + + onError(err); + }); + + //Allow plugins to load other code without having to know the + //context or how to 'complete' the load. + load.fromText = function (moduleName, text) { + /*jslint evil: true */ + var hasInteractive = useInteractive; + + //Turn off interactive script matching for IE for any define + //calls in the text, then turn it back on at the end. + if (hasInteractive) { + useInteractive = false; + } + + //Prime the system by creating a module instance for + //it. + getModule(makeModuleMap(moduleName)); + + req.exec(text); + + if (hasInteractive) { + useInteractive = true; + } + + //Support anonymous modules. + context.completeLoad(moduleName); + }; + + //Use parentName here since the plugin's name is not reliable, + //could be some weird string with no path that actually wants to + //reference the parentName's path. + plugin.load(map.name, makeRequire(map.parentMap, true, function (deps, cb) { + deps.rjsSkipMap = true; + return context.require(deps, cb); + }), load, config); + })); + + context.enable(pluginMap, this); + this.pluginMaps[pluginMap.id] = pluginMap; + }, + + enable: function () { + this.enabled = true; + + if (!this.waitPushed) { + waitAry.push(this); + context.waitCount += 1; + this.waitPushed = true; + } + + //Set flag mentioning that the module is enabling, + //so that immediate calls to the defined callbacks + //for dependencies do not trigger inadvertent load + //with the depCount still being zero. + this.enabling = true; + + //Enable each dependency + each(this.depMaps, bind(this, function (depMap, i) { + var id, mod, handler; + + if (typeof depMap === 'string') { + //Dependency needs to be converted to a depMap + //and wired up to this module. + depMap = makeModuleMap(depMap, + (this.map.isDefine ? this.map : this.map.parentMap), + false, + !this.depMaps.rjsSkipMap); + this.depMaps[i] = depMap; + + handler = handlers[depMap.id]; + + if (handler) { + this.depExports[i] = handler(this); + return; + } + + this.depCount += 1; + + on(depMap, 'defined', bind(this, function (depExports) { + this.defineDep(i, depExports); + this.check(); + })); + + if (this.errback) { + on(depMap, 'error', this.errback); + } + } + + id = depMap.id; + mod = registry[id]; + + //Skip special modules like 'require', 'exports', 'module' + //Also, don't call enable if it is already enabled, + //important in circular dependency cases. + if (!handlers[id] && mod && !mod.enabled) { + context.enable(depMap, this); + } + })); + + //Enable each plugin that is used in + //a dependency + eachProp(this.pluginMaps, bind(this, function (pluginMap) { + var mod = registry[pluginMap.id]; + if (mod && !mod.enabled) { + context.enable(pluginMap, this); + } + })); + + this.enabling = false; + + this.check(); + }, + + on: function(name, cb) { + var cbs = this.events[name]; + if (!cbs) { + cbs = this.events[name] = []; + } + cbs.push(cb); + }, + + emit: function (name, evt) { + each(this.events[name], function (cb) { + cb(evt); + }); + if (name === 'error') { + //Now that the error handler was triggered, remove + //the listeners, since this broken Module instance + //can stay around for a while in the registry/waitAry. + delete this.events[name]; + } + } + }; + + function callGetModule(args) { + getModule(makeModuleMap(args[0], null, true)).init(args[1], args[2]); + } + + function removeListener(node, func, name, ieName) { + //Favor detachEvent because of IE9 + //issue, see attachEvent/addEventListener comment elsewhere + //in this file. + if (node.detachEvent && !isOpera) { + //Probably IE. If not it will throw an error, which will be + //useful to know. + if (ieName) { + node.detachEvent(ieName, func); + } + } else { + node.removeEventListener(name, func, false); + } + } + + /** + * Given an event from a script node, get the requirejs info from it, + * and then removes the event listeners on the node. + * @param {Event} evt + * @returns {Object} + */ + function getScriptData(evt) { + //Using currentTarget instead of target for Firefox 2.0's sake. Not + //all old browsers will be supported, but this one was easy enough + //to support and still makes sense. + var node = evt.currentTarget || evt.srcElement; + + //Remove the listeners once here. + removeListener(node, context.onScriptLoad, 'load', 'onreadystatechange'); + removeListener(node, context.onScriptError, 'error'); + + return { + node: node, + id: node && node.getAttribute('data-requiremodule') + }; + } + + return (context = { + config: config, + contextName: contextName, + registry: registry, + defined: defined, + urlFetched: urlFetched, + waitCount: 0, + defQueue: defQueue, + Module: Module, + makeModuleMap: makeModuleMap, + + /** + * Set a configuration for the context. + * @param {Object} cfg config object to integrate. + */ + configure: function (cfg) { + //Make sure the baseUrl ends in a slash. + if (cfg.baseUrl) { + if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== '/') { + cfg.baseUrl += '/'; + } + } + + //Save off the paths and packages since they require special processing, + //they are additive. + var pkgs = config.pkgs, + shim = config.shim, + paths = config.paths, + map = config.map; + + //Mix in the config values, favoring the new values over + //existing ones in context.config. + mixin(config, cfg, true); + + //Merge paths. + config.paths = mixin(paths, cfg.paths, true); + + //Merge map + if (cfg.map) { + config.map = mixin(map || {}, cfg.map, true, true); + } + + //Merge shim + if (cfg.shim) { + eachProp(cfg.shim, function (value, id) { + //Normalize the structure + if (isArray(value)) { + value = { + deps: value + }; + } + if (value.exports && !value.exports.__buildReady) { + value.exports = context.makeShimExports(value.exports); + } + shim[id] = value; + }); + config.shim = shim; + } + + //Adjust packages if necessary. + if (cfg.packages) { + each(cfg.packages, function (pkgObj) { + var location; + + pkgObj = typeof pkgObj === 'string' ? { name: pkgObj } : pkgObj; + location = pkgObj.location; + + //Create a brand new object on pkgs, since currentPackages can + //be passed in again, and config.pkgs is the internal transformed + //state for all package configs. + pkgs[pkgObj.name] = { + name: pkgObj.name, + location: location || pkgObj.name, + //Remove leading dot in main, so main paths are normalized, + //and remove any trailing .js, since different package + //envs have different conventions: some use a module name, + //some use a file name. + main: (pkgObj.main || 'main') + .replace(currDirRegExp, '') + .replace(jsSuffixRegExp, '') + }; + }); + + //Done with modifications, assing packages back to context config + config.pkgs = pkgs; + } + + //If there are any "waiting to execute" modules in the registry, + //update the maps for them, since their info, like URLs to load, + //may have changed. + eachProp(registry, function (mod, id) { + mod.map = makeModuleMap(id); + }); + + //If a deps array or a config callback is specified, then call + //require with those args. This is useful when require is defined as a + //config object before require.js is loaded. + if (cfg.deps || cfg.callback) { + context.require(cfg.deps || [], cfg.callback); + } + }, + + makeShimExports: function (exports) { + var func; + if (typeof exports === 'string') { + func = function () { + return getGlobal(exports); + }; + //Save the exports for use in nodefine checking. + func.exports = exports; + return func; + } else { + return function () { + return exports.apply(global, arguments); + }; + } + }, + + requireDefined: function (id, relMap) { + return hasProp(defined, makeModuleMap(id, relMap, false, true).id); + }, + + requireSpecified: function (id, relMap) { + id = makeModuleMap(id, relMap, false, true).id; + return hasProp(defined, id) || hasProp(registry, id); + }, + + require: function (deps, callback, errback, relMap) { + var moduleName, id, map, requireMod, args; + if (typeof deps === 'string') { + if (isFunction(callback)) { + //Invalid call + return onError(makeError('requireargs', 'Invalid require call'), errback); + } + + //Synchronous access to one module. If require.get is + //available (as in the Node adapter), prefer that. + //In this case deps is the moduleName and callback is + //the relMap + if (req.get) { + return req.get(context, deps, callback); + } + + //Just return the module wanted. In this scenario, the + //second arg (if passed) is just the relMap. + moduleName = deps; + relMap = callback; + + //Normalize module name, if it contains . or .. + map = makeModuleMap(moduleName, relMap, false, true); + id = map.id; + + if (!hasProp(defined, id)) { + return onError(makeError('notloaded', 'Module name "' + + id + + '" has not been loaded yet for context: ' + + contextName)); + } + return defined[id]; + } + + //Callback require. Normalize args. if callback or errback is + //not a function, it means it is a relMap. Test errback first. + if (errback && !isFunction(errback)) { + relMap = errback; + errback = undefined; + } + if (callback && !isFunction(callback)) { + relMap = callback; + callback = undefined; + } + + //Any defined modules in the global queue, intake them now. + takeGlobalQueue(); + + //Make sure any remaining defQueue items get properly processed. + while (defQueue.length) { + args = defQueue.shift(); + if (args[0] === null) { + return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1])); + } else { + //args are id, deps, factory. Should be normalized by the + //define() function. + callGetModule(args); + } + } + + //Mark all the dependencies as needing to be loaded. + requireMod = getModule(makeModuleMap(null, relMap)); + + requireMod.init(deps, callback, errback, { + enabled: true + }); + + checkLoaded(); + + return context.require; + }, + + undef: function (id) { + var map = makeModuleMap(id, null, true), + mod = registry[id]; + + delete defined[id]; + delete urlFetched[map.url]; + delete undefEvents[id]; + + if (mod) { + //Hold on to listeners in case the + //module will be attempted to be reloaded + //using a different config. + if (mod.events.defined) { + undefEvents[id] = mod.events; + } + + removeWaiting(id); + } + }, + + /** + * Called to enable a module if it is still in the registry + * awaiting enablement. parent module is passed in for context, + * used by the optimizer. + */ + enable: function (depMap, parent) { + var mod = registry[depMap.id]; + if (mod) { + getModule(depMap).enable(); + } + }, + + /** + * Internal method used by environment adapters to complete a load event. + * A load event could be a script load or just a load pass from a synchronous + * load call. + * @param {String} moduleName the name of the module to potentially complete. + */ + completeLoad: function (moduleName) { + var shim = config.shim[moduleName] || {}, + shExports = shim.exports && shim.exports.exports, + found, args, mod; + + takeGlobalQueue(); + + while (defQueue.length) { + args = defQueue.shift(); + if (args[0] === null) { + args[0] = moduleName; + //If already found an anonymous module and bound it + //to this name, then this is some other anon module + //waiting for its completeLoad to fire. + if (found) { + break; + } + found = true; + } else if (args[0] === moduleName) { + //Found matching define call for this script! + found = true; + } + + callGetModule(args); + } + + //Do this after the cycle of callGetModule in case the result + //of those calls/init calls changes the registry. + mod = registry[moduleName]; + + if (!found && + !defined[moduleName] && + mod && !mod.inited) { + if (config.enforceDefine && (!shExports || !getGlobal(shExports))) { + if (hasPathFallback(moduleName)) { + return; + } else { + return onError(makeError('nodefine', + 'No define call for ' + moduleName, + null, + [moduleName])); + } + } else { + //A script that does not call define(), so just simulate + //the call for it. + callGetModule([moduleName, (shim.deps || []), shim.exports]); + } + } + + checkLoaded(); + }, + + /** + * Converts a module name + .extension into an URL path. + * *Requires* the use of a module name. It does not support using + * plain URLs like nameToUrl. + */ + toUrl: function (moduleNamePlusExt, relModuleMap) { + var index = moduleNamePlusExt.lastIndexOf('.'), + ext = null; + + if (index !== -1) { + ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length); + moduleNamePlusExt = moduleNamePlusExt.substring(0, index); + } + + return context.nameToUrl(normalize(moduleNamePlusExt, relModuleMap && relModuleMap.id, true), + ext); + }, + + /** + * Converts a module name to a file path. Supports cases where + * moduleName may actually be just an URL. + * Note that it **does not** call normalize on the moduleName, + * it is assumed to have already been normalized. This is an + * internal API, not a public one. Use toUrl for the public API. + */ + nameToUrl: function (moduleName, ext) { + var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url, + parentPath; + + //If a colon is in the URL, it indicates a protocol is used and it is just + //an URL to a file, or if it starts with a slash, contains a query arg (i.e. ?) + //or ends with .js, then assume the user meant to use an url and not a module id. + //The slash is important for protocol-less URLs as well as full paths. + if (req.jsExtRegExp.test(moduleName)) { + //Just a plain path, not module name lookup, so just return it. + //Add extension if it is included. This is a bit wonky, only non-.js things pass + //an extension, this method probably needs to be reworked. + url = moduleName + (ext || ''); + } else { + //A module that needs to be converted to a path. + paths = config.paths; + pkgs = config.pkgs; + + syms = moduleName.split('/'); + //For each module name segment, see if there is a path + //registered for it. Start with most specific name + //and work up from it. + for (i = syms.length; i > 0; i -= 1) { + parentModule = syms.slice(0, i).join('/'); + pkg = pkgs[parentModule]; + parentPath = paths[parentModule]; + if (parentPath) { + //If an array, it means there are a few choices, + //Choose the one that is desired + if (isArray(parentPath)) { + parentPath = parentPath[0]; + } + syms.splice(0, i, parentPath); + break; + } else if (pkg) { + //If module name is just the package name, then looking + //for the main module. + if (moduleName === pkg.name) { + pkgPath = pkg.location + '/' + pkg.main; + } else { + pkgPath = pkg.location; + } + syms.splice(0, i, pkgPath); + break; + } + } + + //Join the path parts together, then figure out if baseUrl is needed. + url = syms.join('/') + (ext || '.js'); + url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url; + } + + return config.urlArgs ? url + + ((url.indexOf('?') === -1 ? '?' : '&') + + config.urlArgs) : url; + }, + + //Delegates to req.load. Broken out as a separate function to + //allow overriding in the optimizer. + load: function (id, url) { + req.load(context, id, url); + }, + + /** + * Executes a module callack function. Broken out as a separate function + * solely to allow the build system to sequence the files in the built + * layer in the right sequence. + * + * @private + */ + execCb: function (name, callback, args, exports) { + return callback.apply(exports, args); + }, + + /** + * callback for script loads, used to check status of loading. + * + * @param {Event} evt the event from the browser for the script + * that was loaded. + */ + onScriptLoad: function (evt) { + //Using currentTarget instead of target for Firefox 2.0's sake. Not + //all old browsers will be supported, but this one was easy enough + //to support and still makes sense. + if (evt.type === 'load' || + (readyRegExp.test((evt.currentTarget || evt.srcElement).readyState))) { + //Reset interactive script so a script node is not held onto for + //to long. + interactiveScript = null; + + //Pull out the name of the module and the context. + var data = getScriptData(evt); + context.completeLoad(data.id); + } + }, + + /** + * Callback for script errors. + */ + onScriptError: function (evt) { + var data = getScriptData(evt); + if (!hasPathFallback(data.id)) { + return onError(makeError('scripterror', 'Script error', evt, [data.id])); + } + } + }); + } + + /** + * Main entry point. + * + * If the only argument to require is a string, then the module that + * is represented by that string is fetched for the appropriate context. + * + * If the first argument is an array, then it will be treated as an array + * of dependency string names to fetch. An optional function callback can + * be specified to execute when all of those dependencies are available. + * + * Make a local req variable to help Caja compliance (it assumes things + * on a require that are not standardized), and to give a short + * name for minification/local scope use. + */ + req = requirejs = function (deps, callback, errback, optional) { + + //Find the right context, use default + var contextName = defContextName, + context, config; + + // Determine if have config object in the call. + if (!isArray(deps) && typeof deps !== 'string') { + // deps is a config object + config = deps; + if (isArray(callback)) { + // Adjust args if there are dependencies + deps = callback; + callback = errback; + errback = optional; + } else { + deps = []; + } + } + + if (config && config.context) { + contextName = config.context; + } + + context = contexts[contextName]; + if (!context) { + context = contexts[contextName] = req.s.newContext(contextName); + } + + if (config) { + context.configure(config); + } + + return context.require(deps, callback, errback); + }; + + /** + * Support require.config() to make it easier to cooperate with other + * AMD loaders on globally agreed names. + */ + req.config = function (config) { + return req(config); + }; + + /** + * Export require as a global, but only if it does not already exist. + */ + if (!require) { + require = req; + } + + req.version = version; + + //Used to filter out dependencies that are already paths. + req.jsExtRegExp = /^\/|:|\?|\.js$/; + req.isBrowser = isBrowser; + s = req.s = { + contexts: contexts, + newContext: newContext + }; + + //Create default context. + req({}); + + //Exports some context-sensitive methods on global require, using + //default context if no context specified. + addRequireMethods(req); + + if (isBrowser) { + head = s.head = document.getElementsByTagName('head')[0]; + //If BASE tag is in play, using appendChild is a problem for IE6. + //When that browser dies, this can be removed. Details in this jQuery bug: + //http://dev.jquery.com/ticket/2709 + baseElement = document.getElementsByTagName('base')[0]; + if (baseElement) { + head = s.head = baseElement.parentNode; + } + } + + /** + * Any errors that require explicitly generates will be passed to this + * function. Intercept/override it if you want custom error handling. + * @param {Error} err the error object. + */ + req.onError = function (err) { + throw err; + }; + + /** + * Does the request to load a module for the browser case. + * Make this a separate function to allow other environments + * to override it. + * + * @param {Object} context the require context to find state. + * @param {String} moduleName the name of the module. + * @param {Object} url the URL to the module. + */ + req.load = function (context, moduleName, url) { + var config = (context && context.config) || {}, + node; + if (isBrowser) { + //In the browser so use a script tag + node = config.xhtml ? + document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') : + document.createElement('script'); + node.type = config.scriptType || 'text/javascript'; + node.charset = 'utf-8'; + + node.setAttribute('data-requirecontext', context.contextName); + node.setAttribute('data-requiremodule', moduleName); + + //Set up load listener. Test attachEvent first because IE9 has + //a subtle issue in its addEventListener and script onload firings + //that do not match the behavior of all other browsers with + //addEventListener support, which fire the onload event for a + //script right after the script execution. See: + //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution + //UNFORTUNATELY Opera implements attachEvent but does not follow the script + //script execution mode. + if (node.attachEvent && + //Check if node.attachEvent is artificially added by custom script or + //natively supported by browser + //read https://github.com/jrburke/requirejs/issues/187 + //if we can NOT find [native code] then it must NOT natively supported. + //in IE8, node.attachEvent does not have toString() + //Note the test for "[native code" with no closing brace, see: + //https://github.com/jrburke/requirejs/issues/273 + !(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) && + !isOpera) { + //Probably IE. IE (at least 6-8) do not fire + //script onload right after executing the script, so + //we cannot tie the anonymous define call to a name. + //However, IE reports the script as being in 'interactive' + //readyState at the time of the define call. + useInteractive = true; + + node.attachEvent('onreadystatechange', context.onScriptLoad); + //It would be great to add an error handler here to catch + //404s in IE9+. However, onreadystatechange will fire before + //the error handler, so that does not help. If addEvenListener + //is used, then IE will fire error before load, but we cannot + //use that pathway given the connect.microsoft.com issue + //mentioned above about not doing the 'script execute, + //then fire the script load event listener before execute + //next script' that other browsers do. + //Best hope: IE10 fixes the issues, + //and then destroys all installs of IE 6-9. + //node.attachEvent('onerror', context.onScriptError); + } else { + node.addEventListener('load', context.onScriptLoad, false); + node.addEventListener('error', context.onScriptError, false); + } + node.src = url; + + //For some cache cases in IE 6-8, the script executes before the end + //of the appendChild execution, so to tie an anonymous define + //call to the module name (which is stored on the node), hold on + //to a reference to this node, but clear after the DOM insertion. + currentlyAddingScript = node; + if (baseElement) { + head.insertBefore(node, baseElement); + } else { + head.appendChild(node); + } + currentlyAddingScript = null; + + return node; + } else if (isWebWorker) { + //In a web worker, use importScripts. This is not a very + //efficient use of importScripts, importScripts will block until + //its script is downloaded and evaluated. However, if web workers + //are in play, the expectation that a build has been done so that + //only one script needs to be loaded anyway. This may need to be + //reevaluated if other use cases become common. + importScripts(url); + + //Account for anonymous modules + context.completeLoad(moduleName); + } + }; + + function getInteractiveScript() { + if (interactiveScript && interactiveScript.readyState === 'interactive') { + return interactiveScript; + } + + eachReverse(scripts(), function (script) { + if (script.readyState === 'interactive') { + return (interactiveScript = script); + } + }); + return interactiveScript; + } + + //Look for a data-main script attribute, which could also adjust the baseUrl. + if (isBrowser) { + //Figure out baseUrl. Get it from the script tag with require.js in it. + eachReverse(scripts(), function (script) { + //Set the 'head' where we can append children by + //using the script's parent. + if (!head) { + head = script.parentNode; + } + + //Look for a data-main attribute to set main script for the page + //to load. If it is there, the path to data main becomes the + //baseUrl, if it is not already set. + dataMain = script.getAttribute('data-main'); + if (dataMain) { + //Set final baseUrl if there is not already an explicit one. + if (!cfg.baseUrl) { + //Pull off the directory of data-main for use as the + //baseUrl. + src = dataMain.split('/'); + mainScript = src.pop(); + subPath = src.length ? src.join('/') + '/' : './'; + + cfg.baseUrl = subPath; + dataMain = mainScript; + } + + //Strip off any trailing .js since dataMain is now + //like a module name. + dataMain = dataMain.replace(jsSuffixRegExp, ''); + + //Put the data-main script in the files to load. + cfg.deps = cfg.deps ? cfg.deps.concat(dataMain) : [dataMain]; + + return true; + } + }); + } + + /** + * The function that handles definitions of modules. Differs from + * require() in that a string for the module should be the first argument, + * and the function to execute after dependencies are loaded should + * return a value to define the module corresponding to the first argument's + * name. + */ + define = function (name, deps, callback) { + var node, context; + + //Allow for anonymous functions + if (typeof name !== 'string') { + //Adjust args appropriately + callback = deps; + deps = name; + name = null; + } + + //This module may not have dependencies + if (!isArray(deps)) { + callback = deps; + deps = []; + } + + //If no name, and callback is a function, then figure out if it a + //CommonJS thing with dependencies. + if (!deps.length && isFunction(callback)) { + //Remove comments from the callback string, + //look for require calls, and pull them into the dependencies, + //but only if there are function args. + if (callback.length) { + callback + .toString() + .replace(commentRegExp, '') + .replace(cjsRequireRegExp, function (match, dep) { + deps.push(dep); + }); + + //May be a CommonJS thing even without require calls, but still + //could use exports, and module. Avoid doing exports and module + //work though if it just needs require. + //REQUIRES the function to expect the CommonJS variables in the + //order listed below. + deps = (callback.length === 1 ? ['require'] : ['require', 'exports', 'module']).concat(deps); + } + } + + //If in IE 6-8 and hit an anonymous define() call, do the interactive + //work. + if (useInteractive) { + node = currentlyAddingScript || getInteractiveScript(); + if (node) { + if (!name) { + name = node.getAttribute('data-requiremodule'); + } + context = contexts[node.getAttribute('data-requirecontext')]; + } + } + + //Always save off evaluating the def call until the script onload handler. + //This allows multiple modules to be in a file without prematurely + //tracing dependencies, and allows for anonymous module support, + //where the module name is not known until the script onload event + //occurs. If no context, use the global queue, and get it processed + //in the onscript load callback. + (context ? context.defQueue : globalDefQueue).push([name, deps, callback]); + }; + + define.amd = { + jQuery: true + }; + + + /** + * Executes the text. Normally just uses eval, but can be modified + * to use a better, environment-specific call. Only used for transpiling + * loader plugins, not for plain JS modules. + * @param {String} text the text to execute/evaluate. + */ + req.exec = function (text) { + /*jslint evil: true */ + return eval(text); + }; + + //Set up with config info. + req(cfg); +}(this)); + + + if (env === 'rhino') { + /** + * @license RequireJS rhino Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ + +/*jslint */ +/*global require: false, java: false, load: false */ + +(function () { + 'use strict'; + require.load = function (context, moduleName, url) { + + load(url); + + //Support anonymous modules. + context.completeLoad(moduleName); + }; + +}()); + } else if (env === 'node') { + this.requirejsVars = { + require: require, + requirejs: require, + define: define, + nodeRequire: nodeRequire + }; + require.nodeRequire = nodeRequire; + + /** + * @license RequireJS node Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ + +/*jslint regexp: false */ +/*global require: false, define: false, requirejsVars: false, process: false */ + +/** + * This adapter assumes that x.js has loaded it and set up + * some variables. This adapter just allows limited RequireJS + * usage from within the requirejs directory. The general + * node adapater is r.js. + */ + +(function () { + 'use strict'; + + var nodeReq = requirejsVars.nodeRequire, + req = requirejsVars.require, + def = requirejsVars.define, + fs = nodeReq('fs'), + path = nodeReq('path'), + vm = nodeReq('vm'), + //In Node 0.7+ existsSync is on fs. + exists = fs.existsSync || path.existsSync; + + //Supply an implementation that allows synchronous get of a module. + req.get = function (context, moduleName, relModuleMap) { + if (moduleName === "require" || moduleName === "exports" || moduleName === "module") { + req.onError(new Error("Explicit require of " + moduleName + " is not allowed.")); + } + + var ret, + moduleMap = context.makeModuleMap(moduleName, relModuleMap); + + //Normalize module name, if it contains . or .. + moduleName = moduleMap.id; + + if (context.defined.hasOwnProperty(moduleName)) { + ret = context.defined[moduleName]; + } else { + if (ret === undefined) { + //Try to dynamically fetch it. + req.load(context, moduleName, moduleMap.url); + //The above call is sync, so can do the next thing safely. + ret = context.defined[moduleName]; + } + } + + return ret; + }; + + //Add wrapper around the code so that it gets the requirejs + //API instead of the Node API, and it is done lexically so + //that it survives later execution. + req.makeNodeWrapper = function (contents) { + return '(function (require, requirejs, define) { ' + + contents + + '\n}(requirejsVars.require, requirejsVars.requirejs, requirejsVars.define));'; + }; + + req.load = function (context, moduleName, url) { + var contents, err; + + if (exists(url)) { + contents = fs.readFileSync(url, 'utf8'); + + contents = req.makeNodeWrapper(contents); + try { + vm.runInThisContext(contents, fs.realpathSync(url)); + } catch (e) { + err = new Error('Evaluating ' + url + ' as module "' + + moduleName + '" failed with error: ' + e); + err.originalError = e; + err.moduleName = moduleName; + err.fileName = url; + return req.onError(err); + } + } else { + def(moduleName, function () { + try { + return (context.config.nodeRequire || req.nodeRequire)(moduleName); + } catch (e) { + err = new Error('Calling node\'s require("' + + moduleName + '") failed with error: ' + e); + err.originalError = e; + err.moduleName = moduleName; + return req.onError(err); + } + }); + } + + //Support anonymous modules. + context.completeLoad(moduleName); + }; + + //Override to provide the function wrapper for define/require. + req.exec = function (text) { + /*jslint evil: true */ + text = req.makeNodeWrapper(text); + return eval(text); + }; +}()); + + } + + //Support a default file name to execute. Useful for hosted envs + //like Joyent where it defaults to a server.js as the only executed + //script. But only do it if this is not an optimization run. + if (commandOption !== 'o' && (!fileName || !jsSuffixRegExp.test(fileName))) { + fileName = 'main.js'; + } + + /** + * Loads the library files that can be used for the optimizer, or for other + * tasks. + */ + function loadLib() { + /** + * @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ + +/*jslint strict: false */ +/*global Packages: false, process: false, window: false, navigator: false, + document: false, define: false */ + +/** + * A plugin that modifies any /env/ path to be the right path based on + * the host environment. Right now only works for Node, Rhino and browser. + */ +(function () { + var pathRegExp = /(\/|^)env\/|\{env\}/, + env = 'unknown'; + + if (typeof Packages !== 'undefined') { + env = 'rhino'; + } else if (typeof process !== 'undefined') { + env = 'node'; + } else if (typeof window !== "undefined" && navigator && document) { + env = 'browser'; + } + + define('env', { + load: function (name, req, load, config) { + //Allow override in the config. + if (config.env) { + env = config.env; + } + + name = name.replace(pathRegExp, function (match, prefix) { + if (match.indexOf('{') === -1) { + return prefix + env + '/'; + } else { + return env; + } + }); + + req([name], function (mod) { + load(mod); + }); + } + }); +}()); +if(env === 'node') { +/** + * @license RequireJS Copyright (c) 2012, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ + +/*jslint strict: false */ +/*global define: false, load: false */ + +//Needed so that rhino/assert can return a stub for uglify's consolidator.js +define('node/assert', ['assert'], function (assert) { + return assert; +}); + +} + +if(env === 'rhino') { +/** + * @license RequireJS Copyright (c) 2012, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ + +/*jslint strict: false */ +/*global define: false, load: false */ + +//Just a stub for use with uglify's consolidator.js +define('rhino/assert', function () { + return {}; +}); + +} + +if(env === 'node') { +/** + * @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ + +/*jslint strict: false */ +/*global define: false, process: false */ + +define('node/args', function () { + //Do not return the "node" or "r.js" arguments + var args = process.argv.slice(2); + + //Ignore any command option used for rq.js + if (args[0] && args[0].indexOf('-' === 0)) { + args = args.slice(1); + } + + return args; +}); + +} + +if(env === 'rhino') { +/** + * @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ + +/*jslint strict: false */ +/*global define: false, process: false */ + +var jsLibRhinoArgs = (typeof rhinoArgs !== 'undefined' && rhinoArgs) || [].concat(Array.prototype.slice.call(arguments, 0)); + +define('rhino/args', function () { + var args = jsLibRhinoArgs; + + //Ignore any command option used for rq.js + if (args[0] && args[0].indexOf('-' === 0)) { + args = args.slice(1); + } + + return args; +}); + +} + +if(env === 'node') { +/** + * @license RequireJS Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ + +/*jslint strict: false */ +/*global define: false, console: false */ + +define('node/load', ['fs'], function (fs) { + function load(fileName) { + var contents = fs.readFileSync(fileName, 'utf8'); + process.compile(contents, fileName); + } + + return load; +}); + +} + +if(env === 'rhino') { +/** + * @license RequireJS Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ + +/*jslint strict: false */ +/*global define: false, load: false */ + +define('rhino/load', function () { + return load; +}); + +} + +if(env === 'node') { +/** + * @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ + +/*jslint plusplus: false, octal:false, strict: false */ +/*global define: false, process: false */ + +define('node/file', ['fs', 'path'], function (fs, path) { + + var isWindows = process.platform === 'win32', + windowsDriveRegExp = /^[a-zA-Z]\:\/$/, + file; + + function frontSlash(path) { + return path.replace(/\\/g, '/'); + } + + function exists(path) { + if (isWindows && path.charAt(path.length - 1) === '/' && + path.charAt(path.length - 2) !== ':') { + path = path.substring(0, path.length - 1); + } + + try { + fs.statSync(path); + return true; + } catch (e) { + return false; + } + } + + function mkDir(dir) { + if (!exists(dir) && (!isWindows || !windowsDriveRegExp.test(dir))) { + fs.mkdirSync(dir, 511); + } + } + + function mkFullDir(dir) { + var parts = dir.split('/'), + currDir = '', + first = true; + + parts.forEach(function (part) { + //First part may be empty string if path starts with a slash. + currDir += part + '/'; + first = false; + + if (part) { + mkDir(currDir); + } + }); + } + + file = { + backSlashRegExp: /\\/g, + exclusionRegExp: /^\./, + getLineSeparator: function () { + return '/'; + }, + + exists: function (fileName) { + return exists(fileName); + }, + + parent: function (fileName) { + var parts = fileName.split('/'); + parts.pop(); + return parts.join('/'); + }, + + /** + * Gets the absolute file path as a string, normalized + * to using front slashes for path separators. + * @param {String} fileName + */ + absPath: function (fileName) { + return frontSlash(path.normalize(frontSlash(fs.realpathSync(fileName)))); + }, + + normalize: function (fileName) { + return frontSlash(path.normalize(fileName)); + }, + + isFile: function (path) { + return fs.statSync(path).isFile(); + }, + + isDirectory: function (path) { + return fs.statSync(path).isDirectory(); + }, + + getFilteredFileList: function (/*String*/startDir, /*RegExp*/regExpFilters, /*boolean?*/makeUnixPaths) { + //summary: Recurses startDir and finds matches to the files that match regExpFilters.include + //and do not match regExpFilters.exclude. Or just one regexp can be passed in for regExpFilters, + //and it will be treated as the "include" case. + //Ignores files/directories that start with a period (.) unless exclusionRegExp + //is set to another value. + var files = [], topDir, regExpInclude, regExpExclude, dirFileArray, + i, stat, filePath, ok, dirFiles, fileName; + + topDir = startDir; + + regExpInclude = regExpFilters.include || regExpFilters; + regExpExclude = regExpFilters.exclude || null; + + if (file.exists(topDir)) { + dirFileArray = fs.readdirSync(topDir); + for (i = 0; i < dirFileArray.length; i++) { + fileName = dirFileArray[i]; + filePath = path.join(topDir, fileName); + stat = fs.statSync(filePath); + if (stat.isFile()) { + if (makeUnixPaths) { + //Make sure we have a JS string. + if (filePath.indexOf("/") === -1) { + filePath = frontSlash(filePath); + } + } + + ok = true; + if (regExpInclude) { + ok = filePath.match(regExpInclude); + } + if (ok && regExpExclude) { + ok = !filePath.match(regExpExclude); + } + + if (ok && (!file.exclusionRegExp || + !file.exclusionRegExp.test(fileName))) { + files.push(filePath); + } + } else if (stat.isDirectory() && + (!file.exclusionRegExp || !file.exclusionRegExp.test(fileName))) { + dirFiles = this.getFilteredFileList(filePath, regExpFilters, makeUnixPaths); + files.push.apply(files, dirFiles); + } + } + } + + return files; //Array + }, + + copyDir: function (/*String*/srcDir, /*String*/destDir, /*RegExp?*/regExpFilter, /*boolean?*/onlyCopyNew) { + //summary: copies files from srcDir to destDir using the regExpFilter to determine if the + //file should be copied. Returns a list file name strings of the destinations that were copied. + regExpFilter = regExpFilter || /\w/; + + //Normalize th directory names, but keep front slashes. + //path module on windows now returns backslashed paths. + srcDir = frontSlash(path.normalize(srcDir)); + destDir = frontSlash(path.normalize(destDir)); + + var fileNames = file.getFilteredFileList(srcDir, regExpFilter, true), + copiedFiles = [], i, srcFileName, destFileName; + + for (i = 0; i < fileNames.length; i++) { + srcFileName = fileNames[i]; + destFileName = srcFileName.replace(srcDir, destDir); + + if (file.copyFile(srcFileName, destFileName, onlyCopyNew)) { + copiedFiles.push(destFileName); + } + } + + return copiedFiles.length ? copiedFiles : null; //Array or null + }, + + copyFile: function (/*String*/srcFileName, /*String*/destFileName, /*boolean?*/onlyCopyNew) { + //summary: copies srcFileName to destFileName. If onlyCopyNew is set, it only copies the file if + //srcFileName is newer than destFileName. Returns a boolean indicating if the copy occurred. + var parentDir; + + //logger.trace("Src filename: " + srcFileName); + //logger.trace("Dest filename: " + destFileName); + + //If onlyCopyNew is true, then compare dates and only copy if the src is newer + //than dest. + if (onlyCopyNew) { + if (file.exists(destFileName) && fs.statSync(destFileName).mtime.getTime() >= fs.statSync(srcFileName).mtime.getTime()) { + return false; //Boolean + } + } + + //Make sure destination dir exists. + parentDir = path.dirname(destFileName); + if (!file.exists(parentDir)) { + mkFullDir(parentDir); + } + + fs.writeFileSync(destFileName, fs.readFileSync(srcFileName, 'binary'), 'binary'); + + return true; //Boolean + }, + + /** + * Renames a file. May fail if "to" already exists or is on another drive. + */ + renameFile: function (from, to) { + return fs.renameSync(from, to); + }, + + /** + * Reads a *text* file. + */ + readFile: function (/*String*/path, /*String?*/encoding) { + if (encoding === 'utf-8') { + encoding = 'utf8'; + } + if (!encoding) { + encoding = 'utf8'; + } + + var text = fs.readFileSync(path, encoding); + + //Hmm, would not expect to get A BOM, but it seems to happen, + //remove it just in case. + if (text.indexOf('\uFEFF') === 0) { + text = text.substring(1, text.length); + } + + return text; + }, + + saveUtf8File: function (/*String*/fileName, /*String*/fileContents) { + //summary: saves a *text* file using UTF-8 encoding. + file.saveFile(fileName, fileContents, "utf8"); + }, + + saveFile: function (/*String*/fileName, /*String*/fileContents, /*String?*/encoding) { + //summary: saves a *text* file. + var parentDir; + + if (encoding === 'utf-8') { + encoding = 'utf8'; + } + if (!encoding) { + encoding = 'utf8'; + } + + //Make sure destination directories exist. + parentDir = path.dirname(fileName); + if (!file.exists(parentDir)) { + mkFullDir(parentDir); + } + + fs.writeFileSync(fileName, fileContents, encoding); + }, + + deleteFile: function (/*String*/fileName) { + //summary: deletes a file or directory if it exists. + var files, i, stat; + if (file.exists(fileName)) { + stat = fs.statSync(fileName); + if (stat.isDirectory()) { + files = fs.readdirSync(fileName); + for (i = 0; i < files.length; i++) { + this.deleteFile(path.join(fileName, files[i])); + } + fs.rmdirSync(fileName); + } else { + fs.unlinkSync(fileName); + } + } + }, + + + /** + * Deletes any empty directories under the given directory. + */ + deleteEmptyDirs: function (startDir) { + var dirFileArray, i, fileName, filePath, stat; + + if (file.exists(startDir)) { + dirFileArray = fs.readdirSync(startDir); + for (i = 0; i < dirFileArray.length; i++) { + fileName = dirFileArray[i]; + filePath = path.join(startDir, fileName); + stat = fs.statSync(filePath); + if (stat.isDirectory()) { + file.deleteEmptyDirs(filePath); + } + } + + //If directory is now empty, remove it. + if (fs.readdirSync(startDir).length === 0) { + file.deleteFile(startDir); + } + } + } + }; + + return file; + +}); + +} + +if(env === 'rhino') { +/** + * @license RequireJS Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ +//Helper functions to deal with file I/O. + +/*jslint plusplus: false, strict: true */ +/*global java: false, define: false */ + +define('rhino/file', function () { + var file = { + backSlashRegExp: /\\/g, + + exclusionRegExp: /^\./, + + getLineSeparator: function () { + return file.lineSeparator; + }, + + lineSeparator: java.lang.System.getProperty("line.separator"), //Java String + + exists: function (fileName) { + return (new java.io.File(fileName)).exists(); + }, + + parent: function (fileName) { + return file.absPath((new java.io.File(fileName)).getParentFile()); + }, + + normalize: function (fileName) { + return file.absPath(fileName); + }, + + isFile: function (path) { + return (new java.io.File(path)).isFile(); + }, + + isDirectory: function (path) { + return (new java.io.File(path)).isDirectory(); + }, + + /** + * Gets the absolute file path as a string, normalized + * to using front slashes for path separators. + * @param {java.io.File||String} file + */ + absPath: function (fileObj) { + if (typeof fileObj === "string") { + fileObj = new java.io.File(fileObj); + } + return (fileObj.getCanonicalPath() + "").replace(file.backSlashRegExp, "/"); + }, + + getFilteredFileList: function (/*String*/startDir, /*RegExp*/regExpFilters, /*boolean?*/makeUnixPaths, /*boolean?*/startDirIsJavaObject) { + //summary: Recurses startDir and finds matches to the files that match regExpFilters.include + //and do not match regExpFilters.exclude. Or just one regexp can be passed in for regExpFilters, + //and it will be treated as the "include" case. + //Ignores files/directories that start with a period (.) unless exclusionRegExp + //is set to another value. + var files = [], topDir, regExpInclude, regExpExclude, dirFileArray, + i, fileObj, filePath, ok, dirFiles; + + topDir = startDir; + if (!startDirIsJavaObject) { + topDir = new java.io.File(startDir); + } + + regExpInclude = regExpFilters.include || regExpFilters; + regExpExclude = regExpFilters.exclude || null; + + if (topDir.exists()) { + dirFileArray = topDir.listFiles(); + for (i = 0; i < dirFileArray.length; i++) { + fileObj = dirFileArray[i]; + if (fileObj.isFile()) { + filePath = fileObj.getPath(); + if (makeUnixPaths) { + //Make sure we have a JS string. + filePath = String(filePath); + if (filePath.indexOf("/") === -1) { + filePath = filePath.replace(/\\/g, "/"); + } + } + + ok = true; + if (regExpInclude) { + ok = filePath.match(regExpInclude); + } + if (ok && regExpExclude) { + ok = !filePath.match(regExpExclude); + } + + if (ok && (!file.exclusionRegExp || + !file.exclusionRegExp.test(fileObj.getName()))) { + files.push(filePath); + } + } else if (fileObj.isDirectory() && + (!file.exclusionRegExp || !file.exclusionRegExp.test(fileObj.getName()))) { + dirFiles = this.getFilteredFileList(fileObj, regExpFilters, makeUnixPaths, true); + files.push.apply(files, dirFiles); + } + } + } + + return files; //Array + }, + + copyDir: function (/*String*/srcDir, /*String*/destDir, /*RegExp?*/regExpFilter, /*boolean?*/onlyCopyNew) { + //summary: copies files from srcDir to destDir using the regExpFilter to determine if the + //file should be copied. Returns a list file name strings of the destinations that were copied. + regExpFilter = regExpFilter || /\w/; + + var fileNames = file.getFilteredFileList(srcDir, regExpFilter, true), + copiedFiles = [], i, srcFileName, destFileName; + + for (i = 0; i < fileNames.length; i++) { + srcFileName = fileNames[i]; + destFileName = srcFileName.replace(srcDir, destDir); + + if (file.copyFile(srcFileName, destFileName, onlyCopyNew)) { + copiedFiles.push(destFileName); + } + } + + return copiedFiles.length ? copiedFiles : null; //Array or null + }, + + copyFile: function (/*String*/srcFileName, /*String*/destFileName, /*boolean?*/onlyCopyNew) { + //summary: copies srcFileName to destFileName. If onlyCopyNew is set, it only copies the file if + //srcFileName is newer than destFileName. Returns a boolean indicating if the copy occurred. + var destFile = new java.io.File(destFileName), srcFile, parentDir, + srcChannel, destChannel; + + //logger.trace("Src filename: " + srcFileName); + //logger.trace("Dest filename: " + destFileName); + + //If onlyCopyNew is true, then compare dates and only copy if the src is newer + //than dest. + if (onlyCopyNew) { + srcFile = new java.io.File(srcFileName); + if (destFile.exists() && destFile.lastModified() >= srcFile.lastModified()) { + return false; //Boolean + } + } + + //Make sure destination dir exists. + parentDir = destFile.getParentFile(); + if (!parentDir.exists()) { + if (!parentDir.mkdirs()) { + throw "Could not create directory: " + parentDir.getCanonicalPath(); + } + } + + //Java's version of copy file. + srcChannel = new java.io.FileInputStream(srcFileName).getChannel(); + destChannel = new java.io.FileOutputStream(destFileName).getChannel(); + destChannel.transferFrom(srcChannel, 0, srcChannel.size()); + srcChannel.close(); + destChannel.close(); + + return true; //Boolean + }, + + /** + * Renames a file. May fail if "to" already exists or is on another drive. + */ + renameFile: function (from, to) { + return (new java.io.File(from)).renameTo((new java.io.File(to))); + }, + + readFile: function (/*String*/path, /*String?*/encoding) { + //A file read function that can deal with BOMs + encoding = encoding || "utf-8"; + var fileObj = new java.io.File(path), + input = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(fileObj), encoding)), + stringBuffer, line; + try { + stringBuffer = new java.lang.StringBuffer(); + line = input.readLine(); + + // Byte Order Mark (BOM) - The Unicode Standard, version 3.0, page 324 + // http://www.unicode.org/faq/utf_bom.html + + // Note that when we use utf-8, the BOM should appear as "EF BB BF", but it doesn't due to this bug in the JDK: + // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058 + if (line && line.length() && line.charAt(0) === 0xfeff) { + // Eat the BOM, since we've already found the encoding on this file, + // and we plan to concatenating this buffer with others; the BOM should + // only appear at the top of a file. + line = line.substring(1); + } + while (line !== null) { + stringBuffer.append(line); + stringBuffer.append(file.lineSeparator); + line = input.readLine(); + } + //Make sure we return a JavaScript string and not a Java string. + return String(stringBuffer.toString()); //String + } finally { + input.close(); + } + }, + + saveUtf8File: function (/*String*/fileName, /*String*/fileContents) { + //summary: saves a file using UTF-8 encoding. + file.saveFile(fileName, fileContents, "utf-8"); + }, + + saveFile: function (/*String*/fileName, /*String*/fileContents, /*String?*/encoding) { + //summary: saves a file. + var outFile = new java.io.File(fileName), outWriter, parentDir, os; + + parentDir = outFile.getAbsoluteFile().getParentFile(); + if (!parentDir.exists()) { + if (!parentDir.mkdirs()) { + throw "Could not create directory: " + parentDir.getAbsolutePath(); + } + } + + if (encoding) { + outWriter = new java.io.OutputStreamWriter(new java.io.FileOutputStream(outFile), encoding); + } else { + outWriter = new java.io.OutputStreamWriter(new java.io.FileOutputStream(outFile)); + } + + os = new java.io.BufferedWriter(outWriter); + try { + os.write(fileContents); + } finally { + os.close(); + } + }, + + deleteFile: function (/*String*/fileName) { + //summary: deletes a file or directory if it exists. + var fileObj = new java.io.File(fileName), files, i; + if (fileObj.exists()) { + if (fileObj.isDirectory()) { + files = fileObj.listFiles(); + for (i = 0; i < files.length; i++) { + this.deleteFile(files[i]); + } + } + fileObj["delete"](); + } + }, + + /** + * Deletes any empty directories under the given directory. + * The startDirIsJavaObject is private to this implementation's + * recursion needs. + */ + deleteEmptyDirs: function (startDir, startDirIsJavaObject) { + var topDir = startDir, + dirFileArray, i, fileObj; + + if (!startDirIsJavaObject) { + topDir = new java.io.File(startDir); + } + + if (topDir.exists()) { + dirFileArray = topDir.listFiles(); + for (i = 0; i < dirFileArray.length; i++) { + fileObj = dirFileArray[i]; + if (fileObj.isDirectory()) { + file.deleteEmptyDirs(fileObj, true); + } + } + + //If the directory is empty now, delete it. + if (topDir.listFiles().length === 0) { + file.deleteFile(String(topDir.getPath())); + } + } + } + }; + + return file; +}); + +} + +if(env === 'node') { +/*global process */ +define('node/quit', function () { + 'use strict'; + return function (code) { + return process.exit(code); + }; +}); +} + +if(env === 'rhino') { +/*global quit */ +define('rhino/quit', function () { + 'use strict'; + return function (code) { + return quit(code); + }; +}); + +} +/** + * @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ + +/*jslint plusplus: true */ +/*global define */ + +define('lang', function () { + 'use strict'; + + var lang = { + backSlashRegExp: /\\/g, + ostring: Object.prototype.toString, + + isArray: Array.isArray || function (it) { + return lang.ostring.call(it) === "[object Array]"; + }, + + isFunction: function(it) { + return lang.ostring.call(it) === "[object Function]"; + }, + + isRegExp: function(it) { + return it && it instanceof RegExp; + }, + + _mixin: function(dest, source, override){ + var name; + for (name in source) { + if(source.hasOwnProperty(name) + && (override || !dest.hasOwnProperty(name))) { + dest[name] = source[name]; + } + } + + return dest; // Object + }, + + /** + * mixin({}, obj1, obj2) is allowed. If the last argument is a boolean, + * then the source objects properties are force copied over to dest. + */ + mixin: function(dest){ + var parameters = Array.prototype.slice.call(arguments), + override, i, l; + + if (!dest) { dest = {}; } + + if (parameters.length > 2 && typeof arguments[parameters.length-1] === 'boolean') { + override = parameters.pop(); + } + + for (i = 1, l = parameters.length; i < l; i++) { + lang._mixin(dest, parameters[i], override); + } + return dest; // Object + }, + + delegate: (function () { + // boodman/crockford delegation w/ cornford optimization + function TMP() {} + return function (obj, props) { + TMP.prototype = obj; + var tmp = new TMP(); + TMP.prototype = null; + if (props) { + lang.mixin(tmp, props); + } + return tmp; // Object + }; + }()), + + /** + * Helper function for iterating over an array. If the func returns + * a true value, it will break out of the loop. + */ + each: function each(ary, func) { + if (ary) { + var i; + for (i = 0; i < ary.length; i += 1) { + if (func(ary[i], i, ary)) { + break; + } + } + } + }, + + /** + * Cycles over properties in an object and calls a function for each + * property value. If the function returns a truthy value, then the + * iteration is stopped. + */ + eachProp: function eachProp(obj, func) { + var prop; + for (prop in obj) { + if (obj.hasOwnProperty(prop)) { + if (func(obj[prop], prop)) { + break; + } + } + } + }, + + //Similar to Function.prototype.bind, but the "this" object is specified + //first, since it is easier to read/figure out what "this" will be. + bind: function bind(obj, fn) { + return function () { + return fn.apply(obj, arguments); + }; + }, + + //Escapes a content string to be be a string that has characters escaped + //for inclusion as part of a JS string. + jsEscape: function (content) { + return content.replace(/(["'\\])/g, '\\$1') + .replace(/[\f]/g, "\\f") + .replace(/[\b]/g, "\\b") + .replace(/[\n]/g, "\\n") + .replace(/[\t]/g, "\\t") + .replace(/[\r]/g, "\\r"); + } + }; + return lang; +}); + +if(env === 'node') { +/** + * @license RequireJS Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ + +/*jslint */ +/*global define, process */ + +define('node/print', ['fs'], function (fs) { + 'use strict'; + function print(msg) { + fs.writeSync(process.stdout.fd, msg + '\n'); + fs.fsyncSync(process.stdout.fd); + } + + return print; +}); + +} + +if(env === 'rhino') { +/** + * @license RequireJS Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ + +/*jslint strict: false */ +/*global define: false, print: false */ + +define('rhino/print', function () { + return print; +}); + +} +/** + * @license RequireJS Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ + +/*jslint nomen: false, strict: false */ +/*global define: false */ + +define('logger', ['env!env/print'], function (print) { + var logger = { + TRACE: 0, + INFO: 1, + WARN: 2, + ERROR: 3, + SILENT: 4, + level: 0, + logPrefix: "", + + logLevel: function( level ) { + this.level = level; + }, + + trace: function (message) { + if (this.level <= this.TRACE) { + this._print(message); + } + }, + + info: function (message) { + if (this.level <= this.INFO) { + this._print(message); + } + }, + + warn: function (message) { + if (this.level <= this.WARN) { + this._print(message); + } + }, + + error: function (message) { + if (this.level <= this.ERROR) { + this._print(message); + } + }, + + _print: function (message) { + this._sysPrint((this.logPrefix ? (this.logPrefix + " ") : "") + message); + }, + + _sysPrint: function (message) { + print(message); + } + }; + + return logger; +}); +//Just a blank file to use when building the optimizer with the optimizer, +//so that the build does not attempt to inline some env modules, +//like Node's fs and path. + +//Just a blank file to use when building the optimizer with the optimizer, +//so that the build does not attempt to inline some env modules, +//like Node's fs and path. + +//Commit d72ed0a000c455290fde6f8114fe38f4aaf31469 on May 15, 2012 +define('esprima', ['exports'], function(exports) { +/* + Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com> + Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be> + Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl> + Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com> + Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com> + Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com> + Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/*jslint bitwise:true plusplus:true */ +/*global esprima:true, exports:true, +throwError: true, createLiteral: true, generateStatement: true, +parseAssignmentExpression: true, parseBlock: true, parseExpression: true, +parseFunctionDeclaration: true, parseFunctionExpression: true, +parseFunctionSourceElements: true, parseVariableIdentifier: true, +parseLeftHandSideExpression: true, +parseStatement: true, parseSourceElement: true */ + +(function (exports) { + 'use strict'; + + var Token, + TokenName, + Syntax, + PropertyKind, + Messages, + Regex, + source, + strict, + index, + lineNumber, + lineStart, + length, + buffer, + state, + extra; + + Token = { + BooleanLiteral: 1, + EOF: 2, + Identifier: 3, + Keyword: 4, + NullLiteral: 5, + NumericLiteral: 6, + Punctuator: 7, + StringLiteral: 8 + }; + + TokenName = {}; + TokenName[Token.BooleanLiteral] = 'Boolean'; + TokenName[Token.EOF] = '<end>'; + TokenName[Token.Identifier] = 'Identifier'; + TokenName[Token.Keyword] = 'Keyword'; + TokenName[Token.NullLiteral] = 'Null'; + TokenName[Token.NumericLiteral] = 'Numeric'; + TokenName[Token.Punctuator] = 'Punctuator'; + TokenName[Token.StringLiteral] = 'String'; + + Syntax = { + AssignmentExpression: 'AssignmentExpression', + ArrayExpression: 'ArrayExpression', + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DoWhileStatement: 'DoWhileStatement', + DebuggerStatement: 'DebuggerStatement', + EmptyStatement: 'EmptyStatement', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForInStatement: 'ForInStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + Identifier: 'Identifier', + IfStatement: 'IfStatement', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + Program: 'Program', + Property: 'Property', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SwitchStatement: 'SwitchStatement', + SwitchCase: 'SwitchCase', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement' + }; + + PropertyKind = { + Data: 1, + Get: 2, + Set: 4 + }; + + // Error messages should be identical to V8. + Messages = { + UnexpectedToken: 'Unexpected token %0', + UnexpectedNumber: 'Unexpected number', + UnexpectedString: 'Unexpected string', + UnexpectedIdentifier: 'Unexpected identifier', + UnexpectedReserved: 'Unexpected reserved word', + UnexpectedEOS: 'Unexpected end of input', + NewlineAfterThrow: 'Illegal newline after throw', + InvalidRegExp: 'Invalid regular expression', + UnterminatedRegExp: 'Invalid regular expression: missing /', + InvalidLHSInAssignment: 'Invalid left-hand side in assignment', + InvalidLHSInForIn: 'Invalid left-hand side in for-in', + NoCatchOrFinally: 'Missing catch or finally after try', + UnknownLabel: 'Undefined label \'%0\'', + Redeclaration: '%0 \'%1\' has already been declared', + IllegalContinue: 'Illegal continue statement', + IllegalBreak: 'Illegal break statement', + IllegalReturn: 'Illegal return statement', + StrictModeWith: 'Strict mode code may not include a with statement', + StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode', + StrictVarName: 'Variable name may not be eval or arguments in strict mode', + StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode', + StrictParamDupe: 'Strict mode function may not have duplicate parameter names', + StrictFunctionName: 'Function name may not be eval or arguments in strict mode', + StrictOctalLiteral: 'Octal literals are not allowed in strict mode.', + StrictDelete: 'Delete of an unqualified identifier in strict mode.', + StrictDuplicateProperty: 'Duplicate data property in object literal not allowed in strict mode', + AccessorDataProperty: 'Object literal may not have data and accessor property with the same name', + AccessorGetSet: 'Object literal may not have multiple get/set accessors with the same name', + StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode', + StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode', + StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode', + StrictReservedWord: 'Use of future reserved word in strict mode' + }; + + // See also tools/generate-unicode-regex.py. + Regex = { + NonAsciiIdentifierStart: new RegExp('[\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa80-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]'), + NonAsciiIdentifierPart: new RegExp('[\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0300-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u0483-\u0487\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u05d0-\u05ea\u05f0-\u05f2\u0610-\u061a\u0620-\u0669\u066e-\u06d3\u06d5-\u06dc\u06df-\u06e8\u06ea-\u06fc\u06ff\u0710-\u074a\u074d-\u07b1\u07c0-\u07f5\u07fa\u0800-\u082d\u0840-\u085b\u08a0\u08a2-\u08ac\u08e4-\u08fe\u0900-\u0963\u0966-\u096f\u0971-\u0977\u0979-\u097f\u0981-\u0983\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bc-\u09c4\u09c7\u09c8\u09cb-\u09ce\u09d7\u09dc\u09dd\u09df-\u09e3\u09e6-\u09f1\u0a01-\u0a03\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a59-\u0a5c\u0a5e\u0a66-\u0a75\u0a81-\u0a83\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abc-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ad0\u0ae0-\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3c-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b5c\u0b5d\u0b5f-\u0b63\u0b66-\u0b6f\u0b71\u0b82\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd0\u0bd7\u0be6-\u0bef\u0c01-\u0c03\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c58\u0c59\u0c60-\u0c63\u0c66-\u0c6f\u0c82\u0c83\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbc-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0cde\u0ce0-\u0ce3\u0ce6-\u0cef\u0cf1\u0cf2\u0d02\u0d03\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d-\u0d44\u0d46-\u0d48\u0d4a-\u0d4e\u0d57\u0d60-\u0d63\u0d66-\u0d6f\u0d7a-\u0d7f\u0d82\u0d83\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e01-\u0e3a\u0e40-\u0e4e\u0e50-\u0e59\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb9\u0ebb-\u0ebd\u0ec0-\u0ec4\u0ec6\u0ec8-\u0ecd\u0ed0-\u0ed9\u0edc-\u0edf\u0f00\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e-\u0f47\u0f49-\u0f6c\u0f71-\u0f84\u0f86-\u0f97\u0f99-\u0fbc\u0fc6\u1000-\u1049\u1050-\u109d\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u135d-\u135f\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176c\u176e-\u1770\u1772\u1773\u1780-\u17d3\u17d7\u17dc\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u1820-\u1877\u1880-\u18aa\u18b0-\u18f5\u1900-\u191c\u1920-\u192b\u1930-\u193b\u1946-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u19d0-\u19d9\u1a00-\u1a1b\u1a20-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1aa7\u1b00-\u1b4b\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1bf3\u1c00-\u1c37\u1c40-\u1c49\u1c4d-\u1c7d\u1cd0-\u1cd2\u1cd4-\u1cf6\u1d00-\u1de6\u1dfc-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u200c\u200d\u203f\u2040\u2054\u2071\u207f\u2090-\u209c\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d7f-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2de0-\u2dff\u2e2f\u3005-\u3007\u3021-\u302f\u3031-\u3035\u3038-\u303c\u3041-\u3096\u3099\u309a\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua62b\ua640-\ua66f\ua674-\ua67d\ua67f-\ua697\ua69f-\ua6f1\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua827\ua840-\ua873\ua880-\ua8c4\ua8d0-\ua8d9\ua8e0-\ua8f7\ua8fb\ua900-\ua92d\ua930-\ua953\ua960-\ua97c\ua980-\ua9c0\ua9cf-\ua9d9\uaa00-\uaa36\uaa40-\uaa4d\uaa50-\uaa59\uaa60-\uaa76\uaa7a\uaa7b\uaa80-\uaac2\uaadb-\uaadd\uaae0-\uaaef\uaaf2-\uaaf6\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabea\uabec\uabed\uabf0-\uabf9\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe00-\ufe0f\ufe20-\ufe26\ufe33\ufe34\ufe4d-\ufe4f\ufe70-\ufe74\ufe76-\ufefc\uff10-\uff19\uff21-\uff3a\uff3f\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]') + }; + + // Ensure the condition is true, otherwise throw an error. + // This is only to have a better contract semantic, i.e. another safety net + // to catch a logic error. The condition shall be fulfilled in normal case. + // Do NOT use this to enforce a certain condition on any user input. + + function assert(condition, message) { + if (!condition) { + throw new Error('ASSERT: ' + message); + } + } + + function sliceSource(from, to) { + return source.slice(from, to); + } + + if (typeof 'esprima'[0] === 'undefined') { + sliceSource = function sliceArraySource(from, to) { + return source.slice(from, to).join(''); + }; + } + + function isDecimalDigit(ch) { + return '0123456789'.indexOf(ch) >= 0; + } + + function isHexDigit(ch) { + return '0123456789abcdefABCDEF'.indexOf(ch) >= 0; + } + + function isOctalDigit(ch) { + return '01234567'.indexOf(ch) >= 0; + } + + + // 7.2 White Space + + function isWhiteSpace(ch) { + return (ch === ' ') || (ch === '\u0009') || (ch === '\u000B') || + (ch === '\u000C') || (ch === '\u00A0') || + (ch.charCodeAt(0) >= 0x1680 && + '\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\uFEFF'.indexOf(ch) >= 0); + } + + // 7.3 Line Terminators + + function isLineTerminator(ch) { + return (ch === '\n' || ch === '\r' || ch === '\u2028' || ch === '\u2029'); + } + + // 7.6 Identifier Names and Identifiers + + function isIdentifierStart(ch) { + return (ch === '$') || (ch === '_') || (ch === '\\') || + (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || + ((ch.charCodeAt(0) >= 0x80) && Regex.NonAsciiIdentifierStart.test(ch)); + } + + function isIdentifierPart(ch) { + return (ch === '$') || (ch === '_') || (ch === '\\') || + (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || + ((ch >= '0') && (ch <= '9')) || + ((ch.charCodeAt(0) >= 0x80) && Regex.NonAsciiIdentifierPart.test(ch)); + } + + // 7.6.1.2 Future Reserved Words + + function isFutureReservedWord(id) { + switch (id) { + + // Future reserved words. + case 'class': + case 'enum': + case 'export': + case 'extends': + case 'import': + case 'super': + return true; + } + + return false; + } + + function isStrictModeReservedWord(id) { + switch (id) { + + // Strict Mode reserved words. + case 'implements': + case 'interface': + case 'package': + case 'private': + case 'protected': + case 'public': + case 'static': + case 'yield': + case 'let': + return true; + } + + return false; + } + + function isRestrictedWord(id) { + return id === 'eval' || id === 'arguments'; + } + + // 7.6.1.1 Keywords + + function isKeyword(id) { + var keyword = false; + switch (id.length) { + case 2: + keyword = (id === 'if') || (id === 'in') || (id === 'do'); + break; + case 3: + keyword = (id === 'var') || (id === 'for') || (id === 'new') || (id === 'try'); + break; + case 4: + keyword = (id === 'this') || (id === 'else') || (id === 'case') || (id === 'void') || (id === 'with'); + break; + case 5: + keyword = (id === 'while') || (id === 'break') || (id === 'catch') || (id === 'throw'); + break; + case 6: + keyword = (id === 'return') || (id === 'typeof') || (id === 'delete') || (id === 'switch'); + break; + case 7: + keyword = (id === 'default') || (id === 'finally'); + break; + case 8: + keyword = (id === 'function') || (id === 'continue') || (id === 'debugger'); + break; + case 10: + keyword = (id === 'instanceof'); + break; + } + + if (keyword) { + return true; + } + + switch (id) { + // Future reserved words. + // 'const' is specialized as Keyword in V8. + case 'const': + return true; + + // For compatiblity to SpiderMonkey and ES.next + case 'yield': + case 'let': + return true; + } + + if (strict && isStrictModeReservedWord(id)) { + return true; + } + + return isFutureReservedWord(id); + } + + // Return the next character and move forward. + + function nextChar() { + return source[index++]; + } + + // 7.4 Comments + + function skipComment() { + var ch, blockComment, lineComment; + + blockComment = false; + lineComment = false; + + while (index < length) { + ch = source[index]; + + if (lineComment) { + ch = nextChar(); + if (isLineTerminator(ch)) { + lineComment = false; + if (ch === '\r' && source[index] === '\n') { + ++index; + } + ++lineNumber; + lineStart = index; + } + } else if (blockComment) { + if (isLineTerminator(ch)) { + if (ch === '\r' && source[index + 1] === '\n') { + ++index; + } + ++lineNumber; + ++index; + lineStart = index; + if (index >= length) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } else { + ch = nextChar(); + if (index >= length) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + if (ch === '*') { + ch = source[index]; + if (ch === '/') { + ++index; + blockComment = false; + } + } + } + } else if (ch === '/') { + ch = source[index + 1]; + if (ch === '/') { + index += 2; + lineComment = true; + } else if (ch === '*') { + index += 2; + blockComment = true; + if (index >= length) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } else { + break; + } + } else if (isWhiteSpace(ch)) { + ++index; + } else if (isLineTerminator(ch)) { + ++index; + if (ch === '\r' && source[index] === '\n') { + ++index; + } + ++lineNumber; + lineStart = index; + } else { + break; + } + } + } + + function scanHexEscape(prefix) { + var i, len, ch, code = 0; + + len = (prefix === 'u') ? 4 : 2; + for (i = 0; i < len; ++i) { + if (index < length && isHexDigit(source[index])) { + ch = nextChar(); + code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); + } else { + return ''; + } + } + return String.fromCharCode(code); + } + + function scanIdentifier() { + var ch, start, id, restore; + + ch = source[index]; + if (!isIdentifierStart(ch)) { + return; + } + + start = index; + if (ch === '\\') { + ++index; + if (source[index] !== 'u') { + return; + } + ++index; + restore = index; + ch = scanHexEscape('u'); + if (ch) { + if (ch === '\\' || !isIdentifierStart(ch)) { + return; + } + id = ch; + } else { + index = restore; + id = 'u'; + } + } else { + id = nextChar(); + } + + while (index < length) { + ch = source[index]; + if (!isIdentifierPart(ch)) { + break; + } + if (ch === '\\') { + ++index; + if (source[index] !== 'u') { + return; + } + ++index; + restore = index; + ch = scanHexEscape('u'); + if (ch) { + if (ch === '\\' || !isIdentifierPart(ch)) { + return; + } + id += ch; + } else { + index = restore; + id += 'u'; + } + } else { + id += nextChar(); + } + } + + // There is no keyword or literal with only one character. + // Thus, it must be an identifier. + if (id.length === 1) { + return { + type: Token.Identifier, + value: id, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + if (isKeyword(id)) { + return { + type: Token.Keyword, + value: id, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // 7.8.1 Null Literals + + if (id === 'null') { + return { + type: Token.NullLiteral, + value: id, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // 7.8.2 Boolean Literals + + if (id === 'true' || id === 'false') { + return { + type: Token.BooleanLiteral, + value: id, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + return { + type: Token.Identifier, + value: id, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // 7.7 Punctuators + + function scanPunctuator() { + var start = index, + ch1 = source[index], + ch2, + ch3, + ch4; + + // Check for most common single-character punctuators. + + if (ch1 === ';' || ch1 === '{' || ch1 === '}') { + ++index; + return { + type: Token.Punctuator, + value: ch1, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + if (ch1 === ',' || ch1 === '(' || ch1 === ')') { + ++index; + return { + type: Token.Punctuator, + value: ch1, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // Dot (.) can also start a floating-point number, hence the need + // to check the next character. + + ch2 = source[index + 1]; + if (ch1 === '.' && !isDecimalDigit(ch2)) { + return { + type: Token.Punctuator, + value: nextChar(), + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // Peek more characters. + + ch3 = source[index + 2]; + ch4 = source[index + 3]; + + // 4-character punctuator: >>>= + + if (ch1 === '>' && ch2 === '>' && ch3 === '>') { + if (ch4 === '=') { + index += 4; + return { + type: Token.Punctuator, + value: '>>>=', + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + } + + // 3-character punctuators: === !== >>> <<= >>= + + if (ch1 === '=' && ch2 === '=' && ch3 === '=') { + index += 3; + return { + type: Token.Punctuator, + value: '===', + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + if (ch1 === '!' && ch2 === '=' && ch3 === '=') { + index += 3; + return { + type: Token.Punctuator, + value: '!==', + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + if (ch1 === '>' && ch2 === '>' && ch3 === '>') { + index += 3; + return { + type: Token.Punctuator, + value: '>>>', + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + if (ch1 === '<' && ch2 === '<' && ch3 === '=') { + index += 3; + return { + type: Token.Punctuator, + value: '<<=', + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + if (ch1 === '>' && ch2 === '>' && ch3 === '=') { + index += 3; + return { + type: Token.Punctuator, + value: '>>=', + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // 2-character punctuators: <= >= == != ++ -- << >> && || + // += -= *= %= &= |= ^= /= + + if (ch2 === '=') { + if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) { + index += 2; + return { + type: Token.Punctuator, + value: ch1 + ch2, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + } + + if (ch1 === ch2 && ('+-<>&|'.indexOf(ch1) >= 0)) { + if ('+-<>&|'.indexOf(ch2) >= 0) { + index += 2; + return { + type: Token.Punctuator, + value: ch1 + ch2, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + } + + // The remaining 1-character punctuators. + + if ('[]<>+-*%&|^!~?:=/'.indexOf(ch1) >= 0) { + return { + type: Token.Punctuator, + value: nextChar(), + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + } + + // 7.8.3 Numeric Literals + + function scanNumericLiteral() { + var number, start, ch; + + ch = source[index]; + assert(isDecimalDigit(ch) || (ch === '.'), + 'Numeric literal must start with a decimal digit or a decimal point'); + + start = index; + number = ''; + if (ch !== '.') { + number = nextChar(); + ch = source[index]; + + // Hex number starts with '0x'. + // Octal number starts with '0'. + if (number === '0') { + if (ch === 'x' || ch === 'X') { + number += nextChar(); + while (index < length) { + ch = source[index]; + if (!isHexDigit(ch)) { + break; + } + number += nextChar(); + } + + if (number.length <= 2) { + // only 0x + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + + if (index < length) { + ch = source[index]; + if (isIdentifierStart(ch)) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } + return { + type: Token.NumericLiteral, + value: parseInt(number, 16), + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } else if (isOctalDigit(ch)) { + number += nextChar(); + while (index < length) { + ch = source[index]; + if (!isOctalDigit(ch)) { + break; + } + number += nextChar(); + } + + if (index < length) { + ch = source[index]; + if (isIdentifierStart(ch) || isDecimalDigit(ch)) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } + return { + type: Token.NumericLiteral, + value: parseInt(number, 8), + octal: true, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // decimal number starts with '0' such as '09' is illegal. + if (isDecimalDigit(ch)) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } + + while (index < length) { + ch = source[index]; + if (!isDecimalDigit(ch)) { + break; + } + number += nextChar(); + } + } + + if (ch === '.') { + number += nextChar(); + while (index < length) { + ch = source[index]; + if (!isDecimalDigit(ch)) { + break; + } + number += nextChar(); + } + } + + if (ch === 'e' || ch === 'E') { + number += nextChar(); + + ch = source[index]; + if (ch === '+' || ch === '-') { + number += nextChar(); + } + + ch = source[index]; + if (isDecimalDigit(ch)) { + number += nextChar(); + while (index < length) { + ch = source[index]; + if (!isDecimalDigit(ch)) { + break; + } + number += nextChar(); + } + } else { + ch = 'character ' + ch; + if (index >= length) { + ch = '<end>'; + } + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } + + if (index < length) { + ch = source[index]; + if (isIdentifierStart(ch)) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } + + return { + type: Token.NumericLiteral, + value: parseFloat(number), + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // 7.8.4 String Literals + + function scanStringLiteral() { + var str = '', quote, start, ch, code, unescaped, restore, octal = false; + + quote = source[index]; + assert((quote === '\'' || quote === '"'), + 'String literal must starts with a quote'); + + start = index; + ++index; + + while (index < length) { + ch = nextChar(); + + if (ch === quote) { + quote = ''; + break; + } else if (ch === '\\') { + ch = nextChar(); + if (!isLineTerminator(ch)) { + switch (ch) { + case 'n': + str += '\n'; + break; + case 'r': + str += '\r'; + break; + case 't': + str += '\t'; + break; + case 'u': + case 'x': + restore = index; + unescaped = scanHexEscape(ch); + if (unescaped) { + str += unescaped; + } else { + index = restore; + str += ch; + } + break; + case 'b': + str += '\b'; + break; + case 'f': + str += '\f'; + break; + case 'v': + str += '\v'; + break; + + default: + if (isOctalDigit(ch)) { + code = '01234567'.indexOf(ch); + + // \0 is not octal escape sequence + if (code !== 0) { + octal = true; + } + + if (index < length && isOctalDigit(source[index])) { + octal = true; + code = code * 8 + '01234567'.indexOf(nextChar()); + + // 3 digits are only allowed when string starts + // with 0, 1, 2, 3 + if ('0123'.indexOf(ch) >= 0 && + index < length && + isOctalDigit(source[index])) { + code = code * 8 + '01234567'.indexOf(nextChar()); + } + } + str += String.fromCharCode(code); + } else { + str += ch; + } + break; + } + } else { + ++lineNumber; + if (ch === '\r' && source[index] === '\n') { + ++index; + } + } + } else if (isLineTerminator(ch)) { + break; + } else { + str += ch; + } + } + + if (quote !== '') { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + + return { + type: Token.StringLiteral, + value: str, + octal: octal, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + function scanRegExp() { + var str = '', ch, start, pattern, flags, value, classMarker = false, restore; + + buffer = null; + skipComment(); + + start = index; + ch = source[index]; + assert(ch === '/', 'Regular expression literal must start with a slash'); + str = nextChar(); + + while (index < length) { + ch = nextChar(); + str += ch; + if (classMarker) { + if (ch === ']') { + classMarker = false; + } + } else { + if (ch === '\\') { + ch = nextChar(); + // ECMA-262 7.8.5 + if (isLineTerminator(ch)) { + throwError({}, Messages.UnterminatedRegExp); + } + str += ch; + } + else if (ch === '/') { + break; + } + else if (ch === '[') { + classMarker = true; + } + else if (isLineTerminator(ch)) { + throwError({}, Messages.UnterminatedRegExp); + } + } + } + + if (str.length === 1) { + throwError({}, Messages.UnterminatedRegExp); + } + + // Exclude leading and trailing slash. + pattern = str.substr(1, str.length - 2); + + flags = ''; + while (index < length) { + ch = source[index]; + if (!isIdentifierPart(ch)) { + break; + } + + ++index; + if (ch === '\\' && index < length) { + ch = source[index]; + if (ch === 'u') { + ++index; + restore = index; + ch = scanHexEscape('u'); + if (ch) { + flags += ch; + str += '\\u'; + for (; restore < index; ++restore) { + str += source[restore]; + } + } else { + index = restore; + flags += 'u'; + str += '\\u'; + } + } else { + str += '\\'; + } + } else { + flags += ch; + str += ch; + } + } + + try { + value = new RegExp(pattern, flags); + } catch (e) { + throwError({}, Messages.InvalidRegExp); + } + + return { + literal: str, + value: value, + range: [start, index] + }; + } + + function isIdentifierName(token) { + return token.type === Token.Identifier || + token.type === Token.Keyword || + token.type === Token.BooleanLiteral || + token.type === Token.NullLiteral; + } + + function advance() { + var ch, token; + + skipComment(); + + if (index >= length) { + return { + type: Token.EOF, + lineNumber: lineNumber, + lineStart: lineStart, + range: [index, index] + }; + } + + token = scanPunctuator(); + if (typeof token !== 'undefined') { + return token; + } + + ch = source[index]; + + if (ch === '\'' || ch === '"') { + return scanStringLiteral(); + } + + if (ch === '.' || isDecimalDigit(ch)) { + return scanNumericLiteral(); + } + + token = scanIdentifier(); + if (typeof token !== 'undefined') { + return token; + } + + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + + function lex() { + var token; + + if (buffer) { + index = buffer.range[1]; + lineNumber = buffer.lineNumber; + lineStart = buffer.lineStart; + token = buffer; + buffer = null; + return token; + } + + buffer = null; + return advance(); + } + + function lookahead() { + var pos, line, start; + + if (buffer !== null) { + return buffer; + } + + pos = index; + line = lineNumber; + start = lineStart; + buffer = advance(); + index = pos; + lineNumber = line; + lineStart = start; + + return buffer; + } + + // Return true if there is a line terminator before the next token. + + function peekLineTerminator() { + var pos, line, start, found; + + pos = index; + line = lineNumber; + start = lineStart; + skipComment(); + found = lineNumber !== line; + index = pos; + lineNumber = line; + lineStart = start; + + return found; + } + + // Throw an exception + + function throwError(token, messageFormat) { + var error, + args = Array.prototype.slice.call(arguments, 2), + msg = messageFormat.replace( + /%(\d)/g, + function (whole, index) { + return args[index] || ''; + } + ); + + if (typeof token.lineNumber === 'number') { + error = new Error('Line ' + token.lineNumber + ': ' + msg); + error.index = token.range[0]; + error.lineNumber = token.lineNumber; + error.column = token.range[0] - lineStart + 1; + } else { + error = new Error('Line ' + lineNumber + ': ' + msg); + error.index = index; + error.lineNumber = lineNumber; + error.column = index - lineStart + 1; + } + + throw error; + } + + function throwErrorTolerant() { + var error; + try { + throwError.apply(null, arguments); + } catch (e) { + if (extra.errors) { + extra.errors.push(e); + } else { + throw e; + } + } + } + + + // Throw an exception because of the token. + + function throwUnexpected(token) { + var s; + + if (token.type === Token.EOF) { + throwError(token, Messages.UnexpectedEOS); + } + + if (token.type === Token.NumericLiteral) { + throwError(token, Messages.UnexpectedNumber); + } + + if (token.type === Token.StringLiteral) { + throwError(token, Messages.UnexpectedString); + } + + if (token.type === Token.Identifier) { + throwError(token, Messages.UnexpectedIdentifier); + } + + if (token.type === Token.Keyword) { + if (isFutureReservedWord(token.value)) { + throwError(token, Messages.UnexpectedReserved); + } else if (strict && isStrictModeReservedWord(token.value)) { + throwError(token, Messages.StrictReservedWord); + } + throwError(token, Messages.UnexpectedToken, token.value); + } + + // BooleanLiteral, NullLiteral, or Punctuator. + throwError(token, Messages.UnexpectedToken, token.value); + } + + // Expect the next token to match the specified punctuator. + // If not, an exception will be thrown. + + function expect(value) { + var token = lex(); + if (token.type !== Token.Punctuator || token.value !== value) { + throwUnexpected(token); + } + } + + // Expect the next token to match the specified keyword. + // If not, an exception will be thrown. + + function expectKeyword(keyword) { + var token = lex(); + if (token.type !== Token.Keyword || token.value !== keyword) { + throwUnexpected(token); + } + } + + // Return true if the next token matches the specified punctuator. + + function match(value) { + var token = lookahead(); + return token.type === Token.Punctuator && token.value === value; + } + + // Return true if the next token matches the specified keyword + + function matchKeyword(keyword) { + var token = lookahead(); + return token.type === Token.Keyword && token.value === keyword; + } + + // Return true if the next token is an assignment operator + + function matchAssign() { + var token = lookahead(), + op = token.value; + + if (token.type !== Token.Punctuator) { + return false; + } + return op === '=' || + op === '*=' || + op === '/=' || + op === '%=' || + op === '+=' || + op === '-=' || + op === '<<=' || + op === '>>=' || + op === '>>>=' || + op === '&=' || + op === '^=' || + op === '|='; + } + + function consumeSemicolon() { + var token, line; + + // Catch the very common case first. + if (source[index] === ';') { + lex(); + return; + } + + line = lineNumber; + skipComment(); + if (lineNumber !== line) { + return; + } + + if (match(';')) { + lex(); + return; + } + + token = lookahead(); + if (token.type !== Token.EOF && !match('}')) { + throwUnexpected(token); + } + return; + } + + // Return true if provided expression is LeftHandSideExpression + + function isLeftHandSide(expr) { + switch (expr.type) { + case 'AssignmentExpression': + case 'BinaryExpression': + case 'ConditionalExpression': + case 'LogicalExpression': + case 'SequenceExpression': + case 'UnaryExpression': + case 'UpdateExpression': + return false; + } + return true; + } + + // 11.1.4 Array Initialiser + + function parseArrayInitialiser() { + var elements = [], + undef; + + expect('['); + + while (!match(']')) { + if (match(',')) { + lex(); + elements.push(undef); + } else { + elements.push(parseAssignmentExpression()); + + if (!match(']')) { + expect(','); + } + } + } + + expect(']'); + + return { + type: Syntax.ArrayExpression, + elements: elements + }; + } + + // 11.1.5 Object Initialiser + + function parsePropertyFunction(param, first) { + var previousStrict, body; + + previousStrict = strict; + body = parseFunctionSourceElements(); + if (first && strict && isRestrictedWord(param[0].name)) { + throwError(first, Messages.StrictParamName); + } + strict = previousStrict; + + return { + type: Syntax.FunctionExpression, + id: null, + params: param, + body: body + }; + } + + function parseObjectPropertyKey() { + var token = lex(); + + // Note: This function is called only from parseObjectProperty(), where + // EOF and Punctuator tokens are already filtered out. + + if (token.type === Token.StringLiteral || token.type === Token.NumericLiteral) { + if (strict && token.octal) { + throwError(token, Messages.StrictOctalLiteral); + } + return createLiteral(token); + } + + return { + type: Syntax.Identifier, + name: token.value + }; + } + + function parseObjectProperty() { + var token, key, id, param; + + token = lookahead(); + + if (token.type === Token.Identifier) { + + id = parseObjectPropertyKey(); + + // Property Assignment: Getter and Setter. + + if (token.value === 'get' && !match(':')) { + key = parseObjectPropertyKey(); + expect('('); + expect(')'); + return { + type: Syntax.Property, + key: key, + value: parsePropertyFunction([]), + kind: 'get' + }; + } else if (token.value === 'set' && !match(':')) { + key = parseObjectPropertyKey(); + expect('('); + token = lookahead(); + if (token.type !== Token.Identifier) { + throwUnexpected(lex()); + } + param = [ parseVariableIdentifier() ]; + expect(')'); + return { + type: Syntax.Property, + key: key, + value: parsePropertyFunction(param, token), + kind: 'set' + }; + } else { + expect(':'); + return { + type: Syntax.Property, + key: id, + value: parseAssignmentExpression(), + kind: 'init' + }; + } + } else if (token.type === Token.EOF || token.type === Token.Punctuator) { + throwUnexpected(token); + } else { + key = parseObjectPropertyKey(); + expect(':'); + return { + type: Syntax.Property, + key: key, + value: parseAssignmentExpression(), + kind: 'init' + }; + } + } + + function parseObjectInitialiser() { + var token, properties = [], property, name, kind, map = {}, toString = String; + + expect('{'); + + while (!match('}')) { + property = parseObjectProperty(); + + if (property.key.type === Syntax.Identifier) { + name = property.key.name; + } else { + name = toString(property.key.value); + } + kind = (property.kind === 'init') ? PropertyKind.Data : (property.kind === 'get') ? PropertyKind.Get : PropertyKind.Set; + if (Object.prototype.hasOwnProperty.call(map, name)) { + if (map[name] === PropertyKind.Data) { + if (strict && kind === PropertyKind.Data) { + throwErrorTolerant({}, Messages.StrictDuplicateProperty); + } else if (kind !== PropertyKind.Data) { + throwError({}, Messages.AccessorDataProperty); + } + } else { + if (kind === PropertyKind.Data) { + throwError({}, Messages.AccessorDataProperty); + } else if (map[name] & kind) { + throwError({}, Messages.AccessorGetSet); + } + } + map[name] |= kind; + } else { + map[name] = kind; + } + + properties.push(property); + + if (!match('}')) { + expect(','); + } + } + + expect('}'); + + return { + type: Syntax.ObjectExpression, + properties: properties + }; + } + + // 11.1 Primary Expressions + + function parsePrimaryExpression() { + var expr, + token = lookahead(), + type = token.type; + + if (type === Token.Identifier) { + return { + type: Syntax.Identifier, + name: lex().value + }; + } + + if (type === Token.StringLiteral || type === Token.NumericLiteral) { + if (strict && token.octal) { + throwErrorTolerant(token, Messages.StrictOctalLiteral); + } + return createLiteral(lex()); + } + + if (type === Token.Keyword) { + if (matchKeyword('this')) { + lex(); + return { + type: Syntax.ThisExpression + }; + } + + if (matchKeyword('function')) { + return parseFunctionExpression(); + } + } + + if (type === Token.BooleanLiteral) { + lex(); + token.value = (token.value === 'true'); + return createLiteral(token); + } + + if (type === Token.NullLiteral) { + lex(); + token.value = null; + return createLiteral(token); + } + + if (match('[')) { + return parseArrayInitialiser(); + } + + if (match('{')) { + return parseObjectInitialiser(); + } + + if (match('(')) { + lex(); + state.lastParenthesized = expr = parseExpression(); + expect(')'); + return expr; + } + + if (match('/') || match('/=')) { + return createLiteral(scanRegExp()); + } + + return throwUnexpected(lex()); + } + + // 11.2 Left-Hand-Side Expressions + + function parseArguments() { + var args = []; + + expect('('); + + if (!match(')')) { + while (index < length) { + args.push(parseAssignmentExpression()); + if (match(')')) { + break; + } + expect(','); + } + } + + expect(')'); + + return args; + } + + function parseNonComputedProperty() { + var token = lex(); + + if (!isIdentifierName(token)) { + throwUnexpected(token); + } + + return { + type: Syntax.Identifier, + name: token.value + }; + } + + function parseNonComputedMember(object) { + return { + type: Syntax.MemberExpression, + computed: false, + object: object, + property: parseNonComputedProperty() + }; + } + + function parseComputedMember(object) { + var property, expr; + + expect('['); + property = parseExpression(); + expr = { + type: Syntax.MemberExpression, + computed: true, + object: object, + property: property + }; + expect(']'); + return expr; + } + + function parseCallMember(object) { + return { + type: Syntax.CallExpression, + callee: object, + 'arguments': parseArguments() + }; + } + + function parseNewExpression() { + var expr; + + expectKeyword('new'); + + expr = { + type: Syntax.NewExpression, + callee: parseLeftHandSideExpression(), + 'arguments': [] + }; + + if (match('(')) { + expr['arguments'] = parseArguments(); + } + + return expr; + } + + function parseLeftHandSideExpressionAllowCall() { + var useNew, expr; + + useNew = matchKeyword('new'); + expr = useNew ? parseNewExpression() : parsePrimaryExpression(); + + while (index < length) { + if (match('.')) { + lex(); + expr = parseNonComputedMember(expr); + } else if (match('[')) { + expr = parseComputedMember(expr); + } else if (match('(')) { + expr = parseCallMember(expr); + } else { + break; + } + } + + return expr; + } + + function parseLeftHandSideExpression() { + var useNew, expr; + + useNew = matchKeyword('new'); + expr = useNew ? parseNewExpression() : parsePrimaryExpression(); + + while (index < length) { + if (match('.')) { + lex(); + expr = parseNonComputedMember(expr); + } else if (match('[')) { + expr = parseComputedMember(expr); + } else { + break; + } + } + + return expr; + } + + // 11.3 Postfix Expressions + + function parsePostfixExpression() { + var expr = parseLeftHandSideExpressionAllowCall(); + + if ((match('++') || match('--')) && !peekLineTerminator()) { + // 11.3.1, 11.3.2 + if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) { + throwError({}, Messages.StrictLHSPostfix); + } + expr = { + type: Syntax.UpdateExpression, + operator: lex().value, + argument: expr, + prefix: false + }; + } + + return expr; + } + + // 11.4 Unary Operators + + function parseUnaryExpression() { + var token, expr; + + if (match('++') || match('--')) { + token = lex(); + expr = parseUnaryExpression(); + // 11.4.4, 11.4.5 + if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) { + throwError({}, Messages.StrictLHSPrefix); + } + expr = { + type: Syntax.UpdateExpression, + operator: token.value, + argument: expr, + prefix: true + }; + return expr; + } + + if (match('+') || match('-') || match('~') || match('!')) { + expr = { + type: Syntax.UnaryExpression, + operator: lex().value, + argument: parseUnaryExpression() + }; + return expr; + } + + if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) { + expr = { + type: Syntax.UnaryExpression, + operator: lex().value, + argument: parseUnaryExpression() + }; + if (strict && expr.operator === 'delete' && expr.argument.type === Syntax.Identifier) { + throwErrorTolerant({}, Messages.StrictDelete); + } + return expr; + } + + return parsePostfixExpression(); + } + + // 11.5 Multiplicative Operators + + function parseMultiplicativeExpression() { + var expr = parseUnaryExpression(); + + while (match('*') || match('/') || match('%')) { + expr = { + type: Syntax.BinaryExpression, + operator: lex().value, + left: expr, + right: parseUnaryExpression() + }; + } + + return expr; + } + + // 11.6 Additive Operators + + function parseAdditiveExpression() { + var expr = parseMultiplicativeExpression(); + + while (match('+') || match('-')) { + expr = { + type: Syntax.BinaryExpression, + operator: lex().value, + left: expr, + right: parseMultiplicativeExpression() + }; + } + + return expr; + } + + // 11.7 Bitwise Shift Operators + + function parseShiftExpression() { + var expr = parseAdditiveExpression(); + + while (match('<<') || match('>>') || match('>>>')) { + expr = { + type: Syntax.BinaryExpression, + operator: lex().value, + left: expr, + right: parseAdditiveExpression() + }; + } + + return expr; + } + // 11.8 Relational Operators + + function parseRelationalExpression() { + var expr, previousAllowIn; + + previousAllowIn = state.allowIn; + state.allowIn = true; + expr = parseShiftExpression(); + state.allowIn = previousAllowIn; + + if (match('<') || match('>') || match('<=') || match('>=')) { + expr = { + type: Syntax.BinaryExpression, + operator: lex().value, + left: expr, + right: parseRelationalExpression() + }; + } else if (state.allowIn && matchKeyword('in')) { + lex(); + expr = { + type: Syntax.BinaryExpression, + operator: 'in', + left: expr, + right: parseRelationalExpression() + }; + } else if (matchKeyword('instanceof')) { + lex(); + expr = { + type: Syntax.BinaryExpression, + operator: 'instanceof', + left: expr, + right: parseRelationalExpression() + }; + } + + return expr; + } + + // 11.9 Equality Operators + + function parseEqualityExpression() { + var expr = parseRelationalExpression(); + + while (match('==') || match('!=') || match('===') || match('!==')) { + expr = { + type: Syntax.BinaryExpression, + operator: lex().value, + left: expr, + right: parseRelationalExpression() + }; + } + + return expr; + } + + // 11.10 Binary Bitwise Operators + + function parseBitwiseANDExpression() { + var expr = parseEqualityExpression(); + + while (match('&')) { + lex(); + expr = { + type: Syntax.BinaryExpression, + operator: '&', + left: expr, + right: parseEqualityExpression() + }; + } + + return expr; + } + + function parseBitwiseORExpression() { + var expr = parseBitwiseANDExpression(); + + while (match('|')) { + lex(); + expr = { + type: Syntax.BinaryExpression, + operator: '|', + left: expr, + right: parseBitwiseANDExpression() + }; + } + + return expr; + } + + function parseBitwiseXORExpression() { + var expr = parseBitwiseORExpression(); + + while (match('^')) { + lex(); + expr = { + type: Syntax.BinaryExpression, + operator: '^', + left: expr, + right: parseBitwiseORExpression() + }; + } + + return expr; + } + + // 11.11 Binary Logical Operators + + function parseLogicalANDExpression() { + var expr = parseBitwiseXORExpression(); + + while (match('&&')) { + lex(); + expr = { + type: Syntax.LogicalExpression, + operator: '&&', + left: expr, + right: parseBitwiseXORExpression() + }; + } + + return expr; + } + + function parseLogicalORExpression() { + var expr = parseLogicalANDExpression(); + + while (match('||')) { + lex(); + expr = { + type: Syntax.LogicalExpression, + operator: '||', + left: expr, + right: parseLogicalANDExpression() + }; + } + + return expr; + } + + // 11.12 Conditional Operator + + function parseConditionalExpression() { + var expr, previousAllowIn, consequent; + + expr = parseLogicalORExpression(); + + if (match('?')) { + lex(); + previousAllowIn = state.allowIn; + state.allowIn = true; + consequent = parseAssignmentExpression(); + state.allowIn = previousAllowIn; + expect(':'); + + expr = { + type: Syntax.ConditionalExpression, + test: expr, + consequent: consequent, + alternate: parseAssignmentExpression() + }; + } + + return expr; + } + + // 11.13 Assignment Operators + + function parseAssignmentExpression() { + var expr; + + expr = parseConditionalExpression(); + + if (matchAssign()) { + // LeftHandSideExpression + if (state.lastParenthesized !== expr && !isLeftHandSide(expr)) { + throwError({}, Messages.InvalidLHSInAssignment); + } + + // 11.13.1 + if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) { + throwError({}, Messages.StrictLHSAssignment); + } + + expr = { + type: Syntax.AssignmentExpression, + operator: lex().value, + left: expr, + right: parseAssignmentExpression() + }; + } + + return expr; + } + + // 11.14 Comma Operator + + function parseExpression() { + var expr = parseAssignmentExpression(); + + if (match(',')) { + expr = { + type: Syntax.SequenceExpression, + expressions: [ expr ] + }; + + while (index < length) { + if (!match(',')) { + break; + } + lex(); + expr.expressions.push(parseAssignmentExpression()); + } + + } + return expr; + } + + // 12.1 Block + + function parseStatementList() { + var list = [], + statement; + + while (index < length) { + if (match('}')) { + break; + } + statement = parseSourceElement(); + if (typeof statement === 'undefined') { + break; + } + list.push(statement); + } + + return list; + } + + function parseBlock() { + var block; + + expect('{'); + + block = parseStatementList(); + + expect('}'); + + return { + type: Syntax.BlockStatement, + body: block + }; + } + + // 12.2 Variable Statement + + function parseVariableIdentifier() { + var token = lex(); + + if (token.type !== Token.Identifier) { + throwUnexpected(token); + } + + return { + type: Syntax.Identifier, + name: token.value + }; + } + + function parseVariableDeclaration(kind) { + var id = parseVariableIdentifier(), + init = null; + + // 12.2.1 + if (strict && isRestrictedWord(id.name)) { + throwErrorTolerant({}, Messages.StrictVarName); + } + + if (kind === 'const') { + expect('='); + init = parseAssignmentExpression(); + } else if (match('=')) { + lex(); + init = parseAssignmentExpression(); + } + + return { + type: Syntax.VariableDeclarator, + id: id, + init: init + }; + } + + function parseVariableDeclarationList(kind) { + var list = []; + + while (index < length) { + list.push(parseVariableDeclaration(kind)); + if (!match(',')) { + break; + } + lex(); + } + + return list; + } + + function parseVariableStatement() { + var declarations; + + expectKeyword('var'); + + declarations = parseVariableDeclarationList(); + + consumeSemicolon(); + + return { + type: Syntax.VariableDeclaration, + declarations: declarations, + kind: 'var' + }; + } + + // kind may be `const` or `let` + // Both are experimental and not in the specification yet. + // see http://wiki.ecmascript.org/doku.php?id=harmony:const + // and http://wiki.ecmascript.org/doku.php?id=harmony:let + function parseConstLetDeclaration(kind) { + var declarations; + + expectKeyword(kind); + + declarations = parseVariableDeclarationList(kind); + + consumeSemicolon(); + + return { + type: Syntax.VariableDeclaration, + declarations: declarations, + kind: kind + }; + } + + // 12.3 Empty Statement + + function parseEmptyStatement() { + expect(';'); + + return { + type: Syntax.EmptyStatement + }; + } + + // 12.4 Expression Statement + + function parseExpressionStatement() { + var expr = parseExpression(); + + consumeSemicolon(); + + return { + type: Syntax.ExpressionStatement, + expression: expr + }; + } + + // 12.5 If statement + + function parseIfStatement() { + var test, consequent, alternate; + + expectKeyword('if'); + + expect('('); + + test = parseExpression(); + + expect(')'); + + consequent = parseStatement(); + + if (matchKeyword('else')) { + lex(); + alternate = parseStatement(); + } else { + alternate = null; + } + + return { + type: Syntax.IfStatement, + test: test, + consequent: consequent, + alternate: alternate + }; + } + + // 12.6 Iteration Statements + + function parseDoWhileStatement() { + var body, test, oldInIteration; + + expectKeyword('do'); + + oldInIteration = state.inIteration; + state.inIteration = true; + + body = parseStatement(); + + state.inIteration = oldInIteration; + + expectKeyword('while'); + + expect('('); + + test = parseExpression(); + + expect(')'); + + if (match(';')) { + lex(); + } + + return { + type: Syntax.DoWhileStatement, + body: body, + test: test + }; + } + + function parseWhileStatement() { + var test, body, oldInIteration; + + expectKeyword('while'); + + expect('('); + + test = parseExpression(); + + expect(')'); + + oldInIteration = state.inIteration; + state.inIteration = true; + + body = parseStatement(); + + state.inIteration = oldInIteration; + + return { + type: Syntax.WhileStatement, + test: test, + body: body + }; + } + + function parseForVariableDeclaration() { + var token = lex(); + + return { + type: Syntax.VariableDeclaration, + declarations: parseVariableDeclarationList(), + kind: token.value + }; + } + + function parseForStatement() { + var init, test, update, left, right, body, oldInIteration; + + init = test = update = null; + + expectKeyword('for'); + + expect('('); + + if (match(';')) { + lex(); + } else { + if (matchKeyword('var') || matchKeyword('let')) { + state.allowIn = false; + init = parseForVariableDeclaration(); + state.allowIn = true; + + if (init.declarations.length === 1 && matchKeyword('in')) { + lex(); + left = init; + right = parseExpression(); + init = null; + } + } else { + state.allowIn = false; + init = parseExpression(); + state.allowIn = true; + + if (matchKeyword('in')) { + // LeftHandSideExpression + if (matchKeyword('in') && (state.lastParenthesized !== init && !isLeftHandSide(init))) { + throwError({}, Messages.InvalidLHSInForIn); + } + lex(); + left = init; + right = parseExpression(); + init = null; + } + } + + if (typeof left === 'undefined') { + expect(';'); + } + } + + if (typeof left === 'undefined') { + + if (!match(';')) { + test = parseExpression(); + } + expect(';'); + + if (!match(')')) { + update = parseExpression(); + } + } + + expect(')'); + + oldInIteration = state.inIteration; + state.inIteration = true; + + body = parseStatement(); + + state.inIteration = oldInIteration; + + if (typeof left === 'undefined') { + return { + type: Syntax.ForStatement, + init: init, + test: test, + update: update, + body: body + }; + } + + return { + type: Syntax.ForInStatement, + left: left, + right: right, + body: body, + each: false + }; + } + + // 12.7 The continue statement + + function parseContinueStatement() { + var token, label = null; + + expectKeyword('continue'); + + // Optimize the most common form: 'continue;'. + if (source[index] === ';') { + lex(); + + if (!state.inIteration) { + throwError({}, Messages.IllegalContinue); + } + + return { + type: Syntax.ContinueStatement, + label: null + }; + } + + if (peekLineTerminator()) { + if (!state.inIteration) { + throwError({}, Messages.IllegalContinue); + } + + return { + type: Syntax.ContinueStatement, + label: null + }; + } + + token = lookahead(); + if (token.type === Token.Identifier) { + label = parseVariableIdentifier(); + + if (!Object.prototype.hasOwnProperty.call(state.labelSet, label.name)) { + throwError({}, Messages.UnknownLabel, label.name); + } + } + + consumeSemicolon(); + + if (label === null && !state.inIteration) { + throwError({}, Messages.IllegalContinue); + } + + return { + type: Syntax.ContinueStatement, + label: label + }; + } + + // 12.8 The break statement + + function parseBreakStatement() { + var token, label = null; + + expectKeyword('break'); + + // Optimize the most common form: 'break;'. + if (source[index] === ';') { + lex(); + + if (!(state.inIteration || state.inSwitch)) { + throwError({}, Messages.IllegalBreak); + } + + return { + type: Syntax.BreakStatement, + label: null + }; + } + + if (peekLineTerminator()) { + if (!(state.inIteration || state.inSwitch)) { + throwError({}, Messages.IllegalBreak); + } + + return { + type: Syntax.BreakStatement, + label: null + }; + } + + token = lookahead(); + if (token.type === Token.Identifier) { + label = parseVariableIdentifier(); + + if (!Object.prototype.hasOwnProperty.call(state.labelSet, label.name)) { + throwError({}, Messages.UnknownLabel, label.name); + } + } + + consumeSemicolon(); + + if (label === null && !(state.inIteration || state.inSwitch)) { + throwError({}, Messages.IllegalBreak); + } + + return { + type: Syntax.BreakStatement, + label: label + }; + } + + // 12.9 The return statement + + function parseReturnStatement() { + var token, argument = null; + + expectKeyword('return'); + + if (!state.inFunctionBody) { + throwErrorTolerant({}, Messages.IllegalReturn); + } + + // 'return' followed by a space and an identifier is very common. + if (source[index] === ' ') { + if (isIdentifierStart(source[index + 1])) { + argument = parseExpression(); + consumeSemicolon(); + return { + type: Syntax.ReturnStatement, + argument: argument + }; + } + } + + if (peekLineTerminator()) { + return { + type: Syntax.ReturnStatement, + argument: null + }; + } + + if (!match(';')) { + token = lookahead(); + if (!match('}') && token.type !== Token.EOF) { + argument = parseExpression(); + } + } + + consumeSemicolon(); + + return { + type: Syntax.ReturnStatement, + argument: argument + }; + } + + // 12.10 The with statement + + function parseWithStatement() { + var object, body; + + if (strict) { + throwErrorTolerant({}, Messages.StrictModeWith); + } + + expectKeyword('with'); + + expect('('); + + object = parseExpression(); + + expect(')'); + + body = parseStatement(); + + return { + type: Syntax.WithStatement, + object: object, + body: body + }; + } + + // 12.10 The swith statement + + function parseSwitchCase() { + var test, + consequent = [], + statement; + + if (matchKeyword('default')) { + lex(); + test = null; + } else { + expectKeyword('case'); + test = parseExpression(); + } + expect(':'); + + while (index < length) { + if (match('}') || matchKeyword('default') || matchKeyword('case')) { + break; + } + statement = parseStatement(); + if (typeof statement === 'undefined') { + break; + } + consequent.push(statement); + } + + return { + type: Syntax.SwitchCase, + test: test, + consequent: consequent + }; + } + + function parseSwitchStatement() { + var discriminant, cases, oldInSwitch; + + expectKeyword('switch'); + + expect('('); + + discriminant = parseExpression(); + + expect(')'); + + expect('{'); + + if (match('}')) { + lex(); + return { + type: Syntax.SwitchStatement, + discriminant: discriminant + }; + } + + cases = []; + + oldInSwitch = state.inSwitch; + state.inSwitch = true; + + while (index < length) { + if (match('}')) { + break; + } + cases.push(parseSwitchCase()); + } + + state.inSwitch = oldInSwitch; + + expect('}'); + + return { + type: Syntax.SwitchStatement, + discriminant: discriminant, + cases: cases + }; + } + + // 12.13 The throw statement + + function parseThrowStatement() { + var argument; + + expectKeyword('throw'); + + if (peekLineTerminator()) { + throwError({}, Messages.NewlineAfterThrow); + } + + argument = parseExpression(); + + consumeSemicolon(); + + return { + type: Syntax.ThrowStatement, + argument: argument + }; + } + + // 12.14 The try statement + + function parseCatchClause() { + var param; + + expectKeyword('catch'); + + expect('('); + if (!match(')')) { + param = parseExpression(); + // 12.14.1 + if (strict && param.type === Syntax.Identifier && isRestrictedWord(param.name)) { + throwErrorTolerant({}, Messages.StrictCatchVariable); + } + } + expect(')'); + + return { + type: Syntax.CatchClause, + param: param, + guard: null, + body: parseBlock() + }; + } + + function parseTryStatement() { + var block, handlers = [], finalizer = null; + + expectKeyword('try'); + + block = parseBlock(); + + if (matchKeyword('catch')) { + handlers.push(parseCatchClause()); + } + + if (matchKeyword('finally')) { + lex(); + finalizer = parseBlock(); + } + + if (handlers.length === 0 && !finalizer) { + throwError({}, Messages.NoCatchOrFinally); + } + + return { + type: Syntax.TryStatement, + block: block, + handlers: handlers, + finalizer: finalizer + }; + } + + // 12.15 The debugger statement + + function parseDebuggerStatement() { + expectKeyword('debugger'); + + consumeSemicolon(); + + return { + type: Syntax.DebuggerStatement + }; + } + + // 12 Statements + + function parseStatement() { + var token = lookahead(), + expr, + labeledBody; + + if (token.type === Token.EOF) { + throwUnexpected(token); + } + + if (token.type === Token.Punctuator) { + switch (token.value) { + case ';': + return parseEmptyStatement(); + case '{': + return parseBlock(); + case '(': + return parseExpressionStatement(); + default: + break; + } + } + + if (token.type === Token.Keyword) { + switch (token.value) { + case 'break': + return parseBreakStatement(); + case 'continue': + return parseContinueStatement(); + case 'debugger': + return parseDebuggerStatement(); + case 'do': + return parseDoWhileStatement(); + case 'for': + return parseForStatement(); + case 'function': + return parseFunctionDeclaration(); + case 'if': + return parseIfStatement(); + case 'return': + return parseReturnStatement(); + case 'switch': + return parseSwitchStatement(); + case 'throw': + return parseThrowStatement(); + case 'try': + return parseTryStatement(); + case 'var': + return parseVariableStatement(); + case 'while': + return parseWhileStatement(); + case 'with': + return parseWithStatement(); + default: + break; + } + } + + expr = parseExpression(); + + // 12.12 Labelled Statements + if ((expr.type === Syntax.Identifier) && match(':')) { + lex(); + + if (Object.prototype.hasOwnProperty.call(state.labelSet, expr.name)) { + throwError({}, Messages.Redeclaration, 'Label', expr.name); + } + + state.labelSet[expr.name] = true; + labeledBody = parseStatement(); + delete state.labelSet[expr.name]; + + return { + type: Syntax.LabeledStatement, + label: expr, + body: labeledBody + }; + } + + consumeSemicolon(); + + return { + type: Syntax.ExpressionStatement, + expression: expr + }; + } + + // 13 Function Definition + + function parseFunctionSourceElements() { + var sourceElement, sourceElements = [], token, directive, firstRestricted, + oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody; + + expect('{'); + + while (index < length) { + token = lookahead(); + if (token.type !== Token.StringLiteral) { + break; + } + + sourceElement = parseSourceElement(); + sourceElements.push(sourceElement); + if (sourceElement.expression.type !== Syntax.Literal) { + // this is not directive + break; + } + directive = sliceSource(token.range[0] + 1, token.range[1] - 1); + if (directive === 'use strict') { + strict = true; + if (firstRestricted) { + throwError(firstRestricted, Messages.StrictOctalLiteral); + } + } else { + if (!firstRestricted && token.octal) { + firstRestricted = token; + } + } + } + + oldLabelSet = state.labelSet; + oldInIteration = state.inIteration; + oldInSwitch = state.inSwitch; + oldInFunctionBody = state.inFunctionBody; + + state.labelSet = {}; + state.inIteration = false; + state.inSwitch = false; + state.inFunctionBody = true; + + while (index < length) { + if (match('}')) { + break; + } + sourceElement = parseSourceElement(); + if (typeof sourceElement === 'undefined') { + break; + } + sourceElements.push(sourceElement); + } + + expect('}'); + + state.labelSet = oldLabelSet; + state.inIteration = oldInIteration; + state.inSwitch = oldInSwitch; + state.inFunctionBody = oldInFunctionBody; + + return { + type: Syntax.BlockStatement, + body: sourceElements + }; + } + + function parseFunctionDeclaration() { + var id, param, params = [], body, token, firstRestricted, message, previousStrict, paramSet; + + expectKeyword('function'); + token = lookahead(); + id = parseVariableIdentifier(); + if (strict) { + if (isRestrictedWord(token.value)) { + throwError(token, Messages.StrictFunctionName); + } + } else { + if (isRestrictedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictFunctionName; + } else if (isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictReservedWord; + } + } + + expect('('); + + if (!match(')')) { + paramSet = {}; + while (index < length) { + token = lookahead(); + param = parseVariableIdentifier(); + if (strict) { + if (isRestrictedWord(token.value)) { + throwError(token, Messages.StrictParamName); + } + if (Object.prototype.hasOwnProperty.call(paramSet, token.value)) { + throwError(token, Messages.StrictParamDupe); + } + } else if (!firstRestricted) { + if (isRestrictedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictParamName; + } else if (isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictReservedWord; + } else if (Object.prototype.hasOwnProperty.call(paramSet, token.value)) { + firstRestricted = token; + message = Messages.StrictParamDupe; + } + } + params.push(param); + paramSet[param.name] = true; + if (match(')')) { + break; + } + expect(','); + } + } + + expect(')'); + + previousStrict = strict; + body = parseFunctionSourceElements(); + if (strict && firstRestricted) { + throwError(firstRestricted, message); + } + strict = previousStrict; + + return { + type: Syntax.FunctionDeclaration, + id: id, + params: params, + body: body + }; + } + + function parseFunctionExpression() { + var token, id = null, firstRestricted, message, param, params = [], body, previousStrict, paramSet; + + expectKeyword('function'); + + if (!match('(')) { + token = lookahead(); + id = parseVariableIdentifier(); + if (strict) { + if (isRestrictedWord(token.value)) { + throwError(token, Messages.StrictFunctionName); + } + } else { + if (isRestrictedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictFunctionName; + } else if (isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictReservedWord; + } + } + } + + expect('('); + + if (!match(')')) { + paramSet = {}; + while (index < length) { + token = lookahead(); + param = parseVariableIdentifier(); + if (strict) { + if (isRestrictedWord(token.value)) { + throwError(token, Messages.StrictParamName); + } + if (Object.prototype.hasOwnProperty.call(paramSet, token.value)) { + throwError(token, Messages.StrictParamDupe); + } + } else if (!firstRestricted) { + if (isRestrictedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictParamName; + } else if (isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictReservedWord; + } else if (Object.prototype.hasOwnProperty.call(paramSet, token.value)) { + firstRestricted = token; + message = Messages.StrictParamDupe; + } + } + params.push(param); + paramSet[param.name] = true; + if (match(')')) { + break; + } + expect(','); + } + } + + expect(')'); + + previousStrict = strict; + body = parseFunctionSourceElements(); + if (strict && firstRestricted) { + throwError(firstRestricted, message); + } + strict = previousStrict; + + return { + type: Syntax.FunctionExpression, + id: id, + params: params, + body: body + }; + } + + // 14 Program + + function parseSourceElement() { + var token = lookahead(); + + if (token.type === Token.Keyword) { + switch (token.value) { + case 'const': + case 'let': + return parseConstLetDeclaration(token.value); + case 'function': + return parseFunctionDeclaration(); + default: + return parseStatement(); + } + } + + if (token.type !== Token.EOF) { + return parseStatement(); + } + } + + function parseSourceElements() { + var sourceElement, sourceElements = [], token, directive, firstRestricted; + + while (index < length) { + token = lookahead(); + if (token.type !== Token.StringLiteral) { + break; + } + + sourceElement = parseSourceElement(); + sourceElements.push(sourceElement); + if (sourceElement.expression.type !== Syntax.Literal) { + // this is not directive + break; + } + directive = sliceSource(token.range[0] + 1, token.range[1] - 1); + if (directive === 'use strict') { + strict = true; + if (firstRestricted) { + throwError(firstRestricted, Messages.StrictOctalLiteral); + } + } else { + if (!firstRestricted && token.octal) { + firstRestricted = token; + } + } + } + + while (index < length) { + sourceElement = parseSourceElement(); + if (typeof sourceElement === 'undefined') { + break; + } + sourceElements.push(sourceElement); + } + return sourceElements; + } + + function parseProgram() { + var program; + strict = false; + program = { + type: Syntax.Program, + body: parseSourceElements() + }; + return program; + } + + // The following functions are needed only when the option to preserve + // the comments is active. + + function addComment(start, end, type, value) { + assert(typeof start === 'number', 'Comment must have valid position'); + + // Because the way the actual token is scanned, often the comments + // (if any) are skipped twice during the lexical analysis. + // Thus, we need to skip adding a comment if the comment array already + // handled it. + if (extra.comments.length > 0) { + if (extra.comments[extra.comments.length - 1].range[1] > start) { + return; + } + } + + extra.comments.push({ + range: [start, end], + type: type, + value: value + }); + } + + function scanComment() { + var comment, ch, start, blockComment, lineComment; + + comment = ''; + blockComment = false; + lineComment = false; + + while (index < length) { + ch = source[index]; + + if (lineComment) { + ch = nextChar(); + if (index >= length) { + lineComment = false; + comment += ch; + addComment(start, index, 'Line', comment); + } else if (isLineTerminator(ch)) { + lineComment = false; + addComment(start, index, 'Line', comment); + if (ch === '\r' && source[index] === '\n') { + ++index; + } + ++lineNumber; + lineStart = index; + comment = ''; + } else { + comment += ch; + } + } else if (blockComment) { + if (isLineTerminator(ch)) { + if (ch === '\r' && source[index + 1] === '\n') { + ++index; + comment += '\r\n'; + } else { + comment += ch; + } + ++lineNumber; + ++index; + lineStart = index; + if (index >= length) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } else { + ch = nextChar(); + if (index >= length) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + comment += ch; + if (ch === '*') { + ch = source[index]; + if (ch === '/') { + comment = comment.substr(0, comment.length - 1); + blockComment = false; + ++index; + addComment(start, index, 'Block', comment); + comment = ''; + } + } + } + } else if (ch === '/') { + ch = source[index + 1]; + if (ch === '/') { + start = index; + index += 2; + lineComment = true; + } else if (ch === '*') { + start = index; + index += 2; + blockComment = true; + if (index >= length) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } else { + break; + } + } else if (isWhiteSpace(ch)) { + ++index; + } else if (isLineTerminator(ch)) { + ++index; + if (ch === '\r' && source[index] === '\n') { + ++index; + } + ++lineNumber; + lineStart = index; + } else { + break; + } + } + } + + function collectToken() { + var token = extra.advance(), + range, + value; + + if (token.type !== Token.EOF) { + range = [token.range[0], token.range[1]]; + value = sliceSource(token.range[0], token.range[1]); + extra.tokens.push({ + type: TokenName[token.type], + value: value, + range: range + }); + } + + return token; + } + + function collectRegex() { + var pos, regex, token; + + skipComment(); + + pos = index; + regex = extra.scanRegExp(); + + // Pop the previous token, which is likely '/' or '/=' + if (extra.tokens.length > 0) { + token = extra.tokens[extra.tokens.length - 1]; + if (token.range[0] === pos && token.type === 'Punctuator') { + if (token.value === '/' || token.value === '/=') { + extra.tokens.pop(); + } + } + } + + extra.tokens.push({ + type: 'RegularExpression', + value: regex.literal, + range: [pos, index] + }); + + return regex; + } + + function createLiteral(token) { + return { + type: Syntax.Literal, + value: token.value + }; + } + + function createRawLiteral(token) { + return { + type: Syntax.Literal, + value: token.value, + raw: sliceSource(token.range[0], token.range[1]) + }; + } + + function wrapTrackingFunction(range, loc) { + + return function (parseFunction) { + + function isBinary(node) { + return node.type === Syntax.LogicalExpression || + node.type === Syntax.BinaryExpression; + } + + function visit(node) { + if (isBinary(node.left)) { + visit(node.left); + } + if (isBinary(node.right)) { + visit(node.right); + } + + if (range && typeof node.range === 'undefined') { + node.range = [node.left.range[0], node.right.range[1]]; + } + if (loc && typeof node.loc === 'undefined') { + node.loc = { + start: node.left.loc.start, + end: node.right.loc.end + }; + } + } + + return function () { + var node, rangeInfo, locInfo; + + skipComment(); + rangeInfo = [index, 0]; + locInfo = { + start: { + line: lineNumber, + column: index - lineStart + } + }; + + node = parseFunction.apply(null, arguments); + if (typeof node !== 'undefined') { + + if (range) { + rangeInfo[1] = index; + node.range = rangeInfo; + } + + if (loc) { + locInfo.end = { + line: lineNumber, + column: index - lineStart + }; + node.loc = locInfo; + } + + if (isBinary(node)) { + visit(node); + } + + if (node.type === Syntax.MemberExpression) { + if (typeof node.object.range !== 'undefined') { + node.range[0] = node.object.range[0]; + } + if (typeof node.object.loc !== 'undefined') { + node.loc.start = node.object.loc.start; + } + } + return node; + } + }; + + }; + } + + function patch() { + + var wrapTracking; + + if (extra.comments) { + extra.skipComment = skipComment; + skipComment = scanComment; + } + + if (extra.raw) { + extra.createLiteral = createLiteral; + createLiteral = createRawLiteral; + } + + if (extra.range || extra.loc) { + + wrapTracking = wrapTrackingFunction(extra.range, extra.loc); + + extra.parseAdditiveExpression = parseAdditiveExpression; + extra.parseAssignmentExpression = parseAssignmentExpression; + extra.parseBitwiseANDExpression = parseBitwiseANDExpression; + extra.parseBitwiseORExpression = parseBitwiseORExpression; + extra.parseBitwiseXORExpression = parseBitwiseXORExpression; + extra.parseBlock = parseBlock; + extra.parseFunctionSourceElements = parseFunctionSourceElements; + extra.parseCallMember = parseCallMember; + extra.parseCatchClause = parseCatchClause; + extra.parseComputedMember = parseComputedMember; + extra.parseConditionalExpression = parseConditionalExpression; + extra.parseConstLetDeclaration = parseConstLetDeclaration; + extra.parseEqualityExpression = parseEqualityExpression; + extra.parseExpression = parseExpression; + extra.parseForVariableDeclaration = parseForVariableDeclaration; + extra.parseFunctionDeclaration = parseFunctionDeclaration; + extra.parseFunctionExpression = parseFunctionExpression; + extra.parseLogicalANDExpression = parseLogicalANDExpression; + extra.parseLogicalORExpression = parseLogicalORExpression; + extra.parseMultiplicativeExpression = parseMultiplicativeExpression; + extra.parseNewExpression = parseNewExpression; + extra.parseNonComputedMember = parseNonComputedMember; + extra.parseNonComputedProperty = parseNonComputedProperty; + extra.parseObjectProperty = parseObjectProperty; + extra.parseObjectPropertyKey = parseObjectPropertyKey; + extra.parsePostfixExpression = parsePostfixExpression; + extra.parsePrimaryExpression = parsePrimaryExpression; + extra.parseProgram = parseProgram; + extra.parsePropertyFunction = parsePropertyFunction; + extra.parseRelationalExpression = parseRelationalExpression; + extra.parseStatement = parseStatement; + extra.parseShiftExpression = parseShiftExpression; + extra.parseSwitchCase = parseSwitchCase; + extra.parseUnaryExpression = parseUnaryExpression; + extra.parseVariableDeclaration = parseVariableDeclaration; + extra.parseVariableIdentifier = parseVariableIdentifier; + + parseAdditiveExpression = wrapTracking(extra.parseAdditiveExpression); + parseAssignmentExpression = wrapTracking(extra.parseAssignmentExpression); + parseBitwiseANDExpression = wrapTracking(extra.parseBitwiseANDExpression); + parseBitwiseORExpression = wrapTracking(extra.parseBitwiseORExpression); + parseBitwiseXORExpression = wrapTracking(extra.parseBitwiseXORExpression); + parseBlock = wrapTracking(extra.parseBlock); + parseFunctionSourceElements = wrapTracking(extra.parseFunctionSourceElements); + parseCallMember = wrapTracking(extra.parseCallMember); + parseCatchClause = wrapTracking(extra.parseCatchClause); + parseComputedMember = wrapTracking(extra.parseComputedMember); + parseConditionalExpression = wrapTracking(extra.parseConditionalExpression); + parseConstLetDeclaration = wrapTracking(extra.parseConstLetDeclaration); + parseEqualityExpression = wrapTracking(extra.parseEqualityExpression); + parseExpression = wrapTracking(extra.parseExpression); + parseForVariableDeclaration = wrapTracking(extra.parseForVariableDeclaration); + parseFunctionDeclaration = wrapTracking(extra.parseFunctionDeclaration); + parseFunctionExpression = wrapTracking(extra.parseFunctionExpression); + parseLogicalANDExpression = wrapTracking(extra.parseLogicalANDExpression); + parseLogicalORExpression = wrapTracking(extra.parseLogicalORExpression); + parseMultiplicativeExpression = wrapTracking(extra.parseMultiplicativeExpression); + parseNewExpression = wrapTracking(extra.parseNewExpression); + parseNonComputedMember = wrapTracking(extra.parseNonComputedMember); + parseNonComputedProperty = wrapTracking(extra.parseNonComputedProperty); + parseObjectProperty = wrapTracking(extra.parseObjectProperty); + parseObjectPropertyKey = wrapTracking(extra.parseObjectPropertyKey); + parsePostfixExpression = wrapTracking(extra.parsePostfixExpression); + parsePrimaryExpression = wrapTracking(extra.parsePrimaryExpression); + parseProgram = wrapTracking(extra.parseProgram); + parsePropertyFunction = wrapTracking(extra.parsePropertyFunction); + parseRelationalExpression = wrapTracking(extra.parseRelationalExpression); + parseStatement = wrapTracking(extra.parseStatement); + parseShiftExpression = wrapTracking(extra.parseShiftExpression); + parseSwitchCase = wrapTracking(extra.parseSwitchCase); + parseUnaryExpression = wrapTracking(extra.parseUnaryExpression); + parseVariableDeclaration = wrapTracking(extra.parseVariableDeclaration); + parseVariableIdentifier = wrapTracking(extra.parseVariableIdentifier); + } + + if (typeof extra.tokens !== 'undefined') { + extra.advance = advance; + extra.scanRegExp = scanRegExp; + + advance = collectToken; + scanRegExp = collectRegex; + } + } + + function unpatch() { + if (typeof extra.skipComment === 'function') { + skipComment = extra.skipComment; + } + + if (extra.raw) { + createLiteral = extra.createLiteral; + } + + if (extra.range || extra.loc) { + parseAdditiveExpression = extra.parseAdditiveExpression; + parseAssignmentExpression = extra.parseAssignmentExpression; + parseBitwiseANDExpression = extra.parseBitwiseANDExpression; + parseBitwiseORExpression = extra.parseBitwiseORExpression; + parseBitwiseXORExpression = extra.parseBitwiseXORExpression; + parseBlock = extra.parseBlock; + parseFunctionSourceElements = extra.parseFunctionSourceElements; + parseCallMember = extra.parseCallMember; + parseCatchClause = extra.parseCatchClause; + parseComputedMember = extra.parseComputedMember; + parseConditionalExpression = extra.parseConditionalExpression; + parseConstLetDeclaration = extra.parseConstLetDeclaration; + parseEqualityExpression = extra.parseEqualityExpression; + parseExpression = extra.parseExpression; + parseForVariableDeclaration = extra.parseForVariableDeclaration; + parseFunctionDeclaration = extra.parseFunctionDeclaration; + parseFunctionExpression = extra.parseFunctionExpression; + parseLogicalANDExpression = extra.parseLogicalANDExpression; + parseLogicalORExpression = extra.parseLogicalORExpression; + parseMultiplicativeExpression = extra.parseMultiplicativeExpression; + parseNewExpression = extra.parseNewExpression; + parseNonComputedMember = extra.parseNonComputedMember; + parseNonComputedProperty = extra.parseNonComputedProperty; + parseObjectProperty = extra.parseObjectProperty; + parseObjectPropertyKey = extra.parseObjectPropertyKey; + parsePrimaryExpression = extra.parsePrimaryExpression; + parsePostfixExpression = extra.parsePostfixExpression; + parseProgram = extra.parseProgram; + parsePropertyFunction = extra.parsePropertyFunction; + parseRelationalExpression = extra.parseRelationalExpression; + parseStatement = extra.parseStatement; + parseShiftExpression = extra.parseShiftExpression; + parseSwitchCase = extra.parseSwitchCase; + parseUnaryExpression = extra.parseUnaryExpression; + parseVariableDeclaration = extra.parseVariableDeclaration; + parseVariableIdentifier = extra.parseVariableIdentifier; + } + + if (typeof extra.scanRegExp === 'function') { + advance = extra.advance; + scanRegExp = extra.scanRegExp; + } + } + + function stringToArray(str) { + var length = str.length, + result = [], + i; + for (i = 0; i < length; ++i) { + result[i] = str.charAt(i); + } + return result; + } + + function parse(code, options) { + var program, toString; + + toString = String; + if (typeof code !== 'string' && !(code instanceof String)) { + code = toString(code); + } + + source = code; + index = 0; + lineNumber = (source.length > 0) ? 1 : 0; + lineStart = 0; + length = source.length; + buffer = null; + state = { + allowIn: true, + labelSet: {}, + lastParenthesized: null, + inFunctionBody: false, + inIteration: false, + inSwitch: false + }; + + extra = {}; + if (typeof options !== 'undefined') { + extra.range = (typeof options.range === 'boolean') && options.range; + extra.loc = (typeof options.loc === 'boolean') && options.loc; + extra.raw = (typeof options.raw === 'boolean') && options.raw; + if (typeof options.tokens === 'boolean' && options.tokens) { + extra.tokens = []; + } + if (typeof options.comment === 'boolean' && options.comment) { + extra.comments = []; + } + if (typeof options.tolerant === 'boolean' && options.tolerant) { + extra.errors = []; + } + } + + if (length > 0) { + if (typeof source[0] === 'undefined') { + // Try first to convert to a string. This is good as fast path + // for old IE which understands string indexing for string + // literals only and not for string object. + if (code instanceof String) { + source = code.valueOf(); + } + + // Force accessing the characters via an array. + if (typeof source[0] === 'undefined') { + source = stringToArray(code); + } + } + } + + patch(); + try { + program = parseProgram(); + if (typeof extra.comments !== 'undefined') { + program.comments = extra.comments; + } + if (typeof extra.tokens !== 'undefined') { + program.tokens = extra.tokens; + } + if (typeof extra.errors !== 'undefined') { + program.errors = extra.errors; + } + } catch (e) { + throw e; + } finally { + unpatch(); + extra = {}; + } + + return program; + } + + // Sync with package.json. + exports.version = '1.0.0-dev'; + + exports.parse = parse; + + // Deep copy. + exports.Syntax = (function () { + var name, types = {}; + + if (typeof Object.create === 'function') { + types = Object.create(null); + } + + for (name in Syntax) { + if (Syntax.hasOwnProperty(name)) { + types[name] = Syntax[name]; + } + } + + if (typeof Object.freeze === 'function') { + Object.freeze(types); + } + + return types; + }()); + +}(typeof exports === 'undefined' ? (esprima = {}) : exports)); +/* vim: set sw=4 ts=4 et tw=80 : */ +}); +define('uglifyjs/consolidator', ["require", "exports", "module", "./parse-js", "./process"], function(require, exports, module) { +/** + * @preserve Copyright 2012 Robert Gust-Bardon <http://robert.gust-bardon.org/>. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/** + * @fileoverview Enhances <a href="https://github.com/mishoo/UglifyJS/" + * >UglifyJS</a> with consolidation of null, Boolean, and String values. + * <p>Also known as aliasing, this feature has been deprecated in <a href= + * "http://closure-compiler.googlecode.com/">the Closure Compiler</a> since its + * initial release, where it is unavailable from the <abbr title= + * "command line interface">CLI</a>. The Closure Compiler allows one to log and + * influence this process. In contrast, this implementation does not introduce + * any variable declarations in global code and derives String values from + * identifier names used as property accessors.</p> + * <p>Consolidating literals may worsen the data compression ratio when an <a + * href="http://tools.ietf.org/html/rfc2616#section-3.5">encoding + * transformation</a> is applied. For instance, <a href= + * "http://code.jquery.com/jquery-1.7.1.js">jQuery 1.7.1</a> takes 248235 bytes. + * Building it with <a href="https://github.com/mishoo/UglifyJS/tarball/v1.2.5"> + * UglifyJS v1.2.5</a> results in 93647 bytes (37.73% of the original) which are + * then compressed to 33154 bytes (13.36% of the original) using <a href= + * "http://linux.die.net/man/1/gzip">gzip(1)</a>. Building it with the same + * version of UglifyJS 1.2.5 patched with the implementation of consolidation + * results in 80784 bytes (a decrease of 12863 bytes, i.e. 13.74%, in comparison + * to the aforementioned 93647 bytes) which are then compressed to 34013 bytes + * (an increase of 859 bytes, i.e. 2.59%, in comparison to the aforementioned + * 33154 bytes).</p> + * <p>Written in <a href="http://es5.github.com/#x4.2.2">the strict variant</a> + * of <a href="http://es5.github.com/">ECMA-262 5.1 Edition</a>. Encoded in <a + * href="http://tools.ietf.org/html/rfc3629">UTF-8</a>. Follows <a href= + * "http://google-styleguide.googlecode.com/svn-history/r76/trunk/javascriptguide.xml" + * >Revision 2.28 of the Google JavaScript Style Guide</a> (except for the + * discouraged use of the {@code function} tag and the {@code namespace} tag). + * 100% typed for the <a href= + * "http://closure-compiler.googlecode.com/files/compiler-20120123.tar.gz" + * >Closure Compiler Version 1741</a>.</p> + * <p>Should you find this software useful, please consider <a href= + * "https://paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=JZLW72X8FD4WG" + * >a donation</a>.</p> + * @author follow.me@RGustBardon (Robert Gust-Bardon) + * @supported Tested with: + * <ul> + * <li><a href="http://nodejs.org/dist/v0.6.10/">Node v0.6.10</a>,</li> + * <li><a href="https://github.com/mishoo/UglifyJS/tarball/v1.2.5">UglifyJS + * v1.2.5</a>.</li> + * </ul> + */ + +/*global console:false, exports:true, module:false, require:false */ +/*jshint sub:true */ +/** + * Consolidates null, Boolean, and String values found inside an <abbr title= + * "abstract syntax tree">AST</abbr>. + * @param {!TSyntacticCodeUnit} oAbstractSyntaxTree An array-like object + * representing an <abbr title="abstract syntax tree">AST</abbr>. + * @return {!TSyntacticCodeUnit} An array-like object representing an <abbr + * title="abstract syntax tree">AST</abbr> with its null, Boolean, and + * String values consolidated. + */ +// TODO(user) Consolidation of mathematical values found in numeric literals. +// TODO(user) Unconsolidation. +// TODO(user) Consolidation of ECMA-262 6th Edition programs. +// TODO(user) Rewrite in ECMA-262 6th Edition. +exports['ast_consolidate'] = function(oAbstractSyntaxTree) { + 'use strict'; + /*jshint bitwise:true, curly:true, eqeqeq:true, forin:true, immed:true, + latedef:true, newcap:true, noarge:true, noempty:true, nonew:true, + onevar:true, plusplus:true, regexp:true, undef:true, strict:true, + sub:false, trailing:true */ + + var _, + /** + * A record consisting of data about one or more source elements. + * @constructor + * @nosideeffects + */ + TSourceElementsData = function() { + /** + * The category of the elements. + * @type {number} + * @see ESourceElementCategories + */ + this.nCategory = ESourceElementCategories.N_OTHER; + /** + * The number of occurrences (within the elements) of each primitive + * value that could be consolidated. + * @type {!Array.<!Object.<string, number>>} + */ + this.aCount = []; + this.aCount[EPrimaryExpressionCategories.N_IDENTIFIER_NAMES] = {}; + this.aCount[EPrimaryExpressionCategories.N_STRING_LITERALS] = {}; + this.aCount[EPrimaryExpressionCategories.N_NULL_AND_BOOLEAN_LITERALS] = + {}; + /** + * Identifier names found within the elements. + * @type {!Array.<string>} + */ + this.aIdentifiers = []; + /** + * Prefixed representation Strings of each primitive value that could be + * consolidated within the elements. + * @type {!Array.<string>} + */ + this.aPrimitiveValues = []; + }, + /** + * A record consisting of data about a primitive value that could be + * consolidated. + * @constructor + * @nosideeffects + */ + TPrimitiveValue = function() { + /** + * The difference in the number of terminal symbols between the original + * source text and the one with the primitive value consolidated. If the + * difference is positive, the primitive value is considered worthwhile. + * @type {number} + */ + this.nSaving = 0; + /** + * An identifier name of the variable that will be declared and assigned + * the primitive value if the primitive value is consolidated. + * @type {string} + */ + this.sName = ''; + }, + /** + * A record consisting of data on what to consolidate within the range of + * source elements that is currently being considered. + * @constructor + * @nosideeffects + */ + TSolution = function() { + /** + * An object whose keys are prefixed representation Strings of each + * primitive value that could be consolidated within the elements and + * whose values are corresponding data about those primitive values. + * @type {!Object.<string, {nSaving: number, sName: string}>} + * @see TPrimitiveValue + */ + this.oPrimitiveValues = {}; + /** + * The difference in the number of terminal symbols between the original + * source text and the one with all the worthwhile primitive values + * consolidated. + * @type {number} + * @see TPrimitiveValue#nSaving + */ + this.nSavings = 0; + }, + /** + * The processor of <abbr title="abstract syntax tree">AST</abbr>s found + * in UglifyJS. + * @namespace + * @type {!TProcessor} + */ + oProcessor = (/** @type {!TProcessor} */ require('./process')), + /** + * A record consisting of a number of constants that represent the + * difference in the number of terminal symbols between a source text with + * a modified syntactic code unit and the original one. + * @namespace + * @type {!Object.<string, number>} + */ + oWeights = { + /** + * The difference in the number of punctuators required by the bracket + * notation and the dot notation. + * <p><code>'[]'.length - '.'.length</code></p> + * @const + * @type {number} + */ + N_PROPERTY_ACCESSOR: 1, + /** + * The number of punctuators required by a variable declaration with an + * initialiser. + * <p><code>':'.length + ';'.length</code></p> + * @const + * @type {number} + */ + N_VARIABLE_DECLARATION: 2, + /** + * The number of terminal symbols required to introduce a variable + * statement (excluding its variable declaration list). + * <p><code>'var '.length</code></p> + * @const + * @type {number} + */ + N_VARIABLE_STATEMENT_AFFIXATION: 4, + /** + * The number of terminal symbols needed to enclose source elements + * within a function call with no argument values to a function with an + * empty parameter list. + * <p><code>'(function(){}());'.length</code></p> + * @const + * @type {number} + */ + N_CLOSURE: 17 + }, + /** + * Categories of primary expressions from which primitive values that + * could be consolidated are derivable. + * @namespace + * @enum {number} + */ + EPrimaryExpressionCategories = { + /** + * Identifier names used as property accessors. + * @type {number} + */ + N_IDENTIFIER_NAMES: 0, + /** + * String literals. + * @type {number} + */ + N_STRING_LITERALS: 1, + /** + * Null and Boolean literals. + * @type {number} + */ + N_NULL_AND_BOOLEAN_LITERALS: 2 + }, + /** + * Prefixes of primitive values that could be consolidated. + * The String values of the prefixes must have same number of characters. + * The prefixes must not be used in any properties defined in any version + * of <a href= + * "http://www.ecma-international.org/publications/standards/Ecma-262.htm" + * >ECMA-262</a>. + * @namespace + * @enum {string} + */ + EValuePrefixes = { + /** + * Identifies String values. + * @type {string} + */ + S_STRING: '#S', + /** + * Identifies null and Boolean values. + * @type {string} + */ + S_SYMBOLIC: '#O' + }, + /** + * Categories of source elements in terms of their appropriateness of + * having their primitive values consolidated. + * @namespace + * @enum {number} + */ + ESourceElementCategories = { + /** + * Identifies a source element that includes the <a href= + * "http://es5.github.com/#x12.10">{@code with}</a> statement. + * @type {number} + */ + N_WITH: 0, + /** + * Identifies a source element that includes the <a href= + * "http://es5.github.com/#x15.1.2.1">{@code eval}</a> identifier name. + * @type {number} + */ + N_EVAL: 1, + /** + * Identifies a source element that must be excluded from the process + * unless its whole scope is examined. + * @type {number} + */ + N_EXCLUDABLE: 2, + /** + * Identifies source elements not posing any problems. + * @type {number} + */ + N_OTHER: 3 + }, + /** + * The list of literals (other than the String ones) whose primitive + * values can be consolidated. + * @const + * @type {!Array.<string>} + */ + A_OTHER_SUBSTITUTABLE_LITERALS = [ + 'null', // The null literal. + 'false', // The Boolean literal {@code false}. + 'true' // The Boolean literal {@code true}. + ]; + + (/** + * Consolidates all worthwhile primitive values in a syntactic code unit. + * @param {!TSyntacticCodeUnit} oSyntacticCodeUnit An array-like object + * representing the branch of the abstract syntax tree representing the + * syntactic code unit along with its scope. + * @see TPrimitiveValue#nSaving + */ + function fExamineSyntacticCodeUnit(oSyntacticCodeUnit) { + var _, + /** + * Indicates whether the syntactic code unit represents global code. + * @type {boolean} + */ + bIsGlobal = 'toplevel' === oSyntacticCodeUnit[0], + /** + * Indicates whether the whole scope is being examined. + * @type {boolean} + */ + bIsWhollyExaminable = !bIsGlobal, + /** + * An array-like object representing source elements that constitute a + * syntactic code unit. + * @type {!TSyntacticCodeUnit} + */ + oSourceElements, + /** + * A record consisting of data about the source element that is + * currently being examined. + * @type {!TSourceElementsData} + */ + oSourceElementData, + /** + * The scope of the syntactic code unit. + * @type {!TScope} + */ + oScope, + /** + * An instance of an object that allows the traversal of an <abbr + * title="abstract syntax tree">AST</abbr>. + * @type {!TWalker} + */ + oWalker, + /** + * An object encompassing collections of functions used during the + * traversal of an <abbr title="abstract syntax tree">AST</abbr>. + * @namespace + * @type {!Object.<string, !Object.<string, function(...[*])>>} + */ + oWalkers = { + /** + * A collection of functions used during the surveyance of source + * elements. + * @namespace + * @type {!Object.<string, function(...[*])>} + */ + oSurveySourceElement: { + /**#nocode+*/ // JsDoc Toolkit 2.4.0 hides some of the keys. + /** + * Classifies the source element as excludable if it does not + * contain a {@code with} statement or the {@code eval} identifier + * name. Adds the identifier of the function and its formal + * parameters to the list of identifier names found. + * @param {string} sIdentifier The identifier of the function. + * @param {!Array.<string>} aFormalParameterList Formal parameters. + * @param {!TSyntacticCodeUnit} oFunctionBody Function code. + */ + 'defun': function( + sIdentifier, + aFormalParameterList, + oFunctionBody) { + fClassifyAsExcludable(); + fAddIdentifier(sIdentifier); + aFormalParameterList.forEach(fAddIdentifier); + }, + /** + * Increments the count of the number of occurrences of the String + * value that is equivalent to the sequence of terminal symbols + * that constitute the encountered identifier name. + * @param {!TSyntacticCodeUnit} oExpression The nonterminal + * MemberExpression. + * @param {string} sIdentifierName The identifier name used as the + * property accessor. + * @return {!Array} The encountered branch of an <abbr title= + * "abstract syntax tree">AST</abbr> with its nonterminal + * MemberExpression traversed. + */ + 'dot': function(oExpression, sIdentifierName) { + fCountPrimaryExpression( + EPrimaryExpressionCategories.N_IDENTIFIER_NAMES, + EValuePrefixes.S_STRING + sIdentifierName); + return ['dot', oWalker.walk(oExpression), sIdentifierName]; + }, + /** + * Adds the optional identifier of the function and its formal + * parameters to the list of identifier names found. + * @param {?string} sIdentifier The optional identifier of the + * function. + * @param {!Array.<string>} aFormalParameterList Formal parameters. + * @param {!TSyntacticCodeUnit} oFunctionBody Function code. + */ + 'function': function( + sIdentifier, + aFormalParameterList, + oFunctionBody) { + if ('string' === typeof sIdentifier) { + fAddIdentifier(sIdentifier); + } + aFormalParameterList.forEach(fAddIdentifier); + }, + /** + * Either increments the count of the number of occurrences of the + * encountered null or Boolean value or classifies a source element + * as containing the {@code eval} identifier name. + * @param {string} sIdentifier The identifier encountered. + */ + 'name': function(sIdentifier) { + if (-1 !== A_OTHER_SUBSTITUTABLE_LITERALS.indexOf(sIdentifier)) { + fCountPrimaryExpression( + EPrimaryExpressionCategories.N_NULL_AND_BOOLEAN_LITERALS, + EValuePrefixes.S_SYMBOLIC + sIdentifier); + } else { + if ('eval' === sIdentifier) { + oSourceElementData.nCategory = + ESourceElementCategories.N_EVAL; + } + fAddIdentifier(sIdentifier); + } + }, + /** + * Classifies the source element as excludable if it does not + * contain a {@code with} statement or the {@code eval} identifier + * name. + * @param {TSyntacticCodeUnit} oExpression The expression whose + * value is to be returned. + */ + 'return': function(oExpression) { + fClassifyAsExcludable(); + }, + /** + * Increments the count of the number of occurrences of the + * encountered String value. + * @param {string} sStringValue The String value of the string + * literal encountered. + */ + 'string': function(sStringValue) { + if (sStringValue.length > 0) { + fCountPrimaryExpression( + EPrimaryExpressionCategories.N_STRING_LITERALS, + EValuePrefixes.S_STRING + sStringValue); + } + }, + /** + * Adds the identifier reserved for an exception to the list of + * identifier names found. + * @param {!TSyntacticCodeUnit} oTry A block of code in which an + * exception can occur. + * @param {Array} aCatch The identifier reserved for an exception + * and a block of code to handle the exception. + * @param {TSyntacticCodeUnit} oFinally An optional block of code + * to be evaluated regardless of whether an exception occurs. + */ + 'try': function(oTry, aCatch, oFinally) { + if (Array.isArray(aCatch)) { + fAddIdentifier(aCatch[0]); + } + }, + /** + * Classifies the source element as excludable if it does not + * contain a {@code with} statement or the {@code eval} identifier + * name. Adds the identifier of each declared variable to the list + * of identifier names found. + * @param {!Array.<!Array>} aVariableDeclarationList Variable + * declarations. + */ + 'var': function(aVariableDeclarationList) { + fClassifyAsExcludable(); + aVariableDeclarationList.forEach(fAddVariable); + }, + /** + * Classifies a source element as containing the {@code with} + * statement. + * @param {!TSyntacticCodeUnit} oExpression An expression whose + * value is to be converted to a value of type Object and + * become the binding object of a new object environment + * record of a new lexical environment in which the statement + * is to be executed. + * @param {!TSyntacticCodeUnit} oStatement The statement to be + * executed in the augmented lexical environment. + * @return {!Array} An empty array to stop the traversal. + */ + 'with': function(oExpression, oStatement) { + oSourceElementData.nCategory = ESourceElementCategories.N_WITH; + return []; + } + /**#nocode-*/ // JsDoc Toolkit 2.4.0 hides some of the keys. + }, + /** + * A collection of functions used while looking for nested functions. + * @namespace + * @type {!Object.<string, function(...[*])>} + */ + oExamineFunctions: { + /**#nocode+*/ // JsDoc Toolkit 2.4.0 hides some of the keys. + /** + * Orders an examination of a nested function declaration. + * @this {!TSyntacticCodeUnit} An array-like object representing + * the branch of an <abbr title="abstract syntax tree" + * >AST</abbr> representing the syntactic code unit along with + * its scope. + * @return {!Array} An empty array to stop the traversal. + */ + 'defun': function() { + fExamineSyntacticCodeUnit(this); + return []; + }, + /** + * Orders an examination of a nested function expression. + * @this {!TSyntacticCodeUnit} An array-like object representing + * the branch of an <abbr title="abstract syntax tree" + * >AST</abbr> representing the syntactic code unit along with + * its scope. + * @return {!Array} An empty array to stop the traversal. + */ + 'function': function() { + fExamineSyntacticCodeUnit(this); + return []; + } + /**#nocode-*/ // JsDoc Toolkit 2.4.0 hides some of the keys. + } + }, + /** + * Records containing data about source elements. + * @type {Array.<TSourceElementsData>} + */ + aSourceElementsData = [], + /** + * The index (in the source text order) of the source element + * immediately following a <a href="http://es5.github.com/#x14.1" + * >Directive Prologue</a>. + * @type {number} + */ + nAfterDirectivePrologue = 0, + /** + * The index (in the source text order) of the source element that is + * currently being considered. + * @type {number} + */ + nPosition, + /** + * The index (in the source text order) of the source element that is + * the last element of the range of source elements that is currently + * being considered. + * @type {(undefined|number)} + */ + nTo, + /** + * Initiates the traversal of a source element. + * @param {!TWalker} oWalker An instance of an object that allows the + * traversal of an abstract syntax tree. + * @param {!TSyntacticCodeUnit} oSourceElement A source element from + * which the traversal should commence. + * @return {function(): !TSyntacticCodeUnit} A function that is able to + * initiate the traversal from a given source element. + */ + cContext = function(oWalker, oSourceElement) { + /** + * @return {!TSyntacticCodeUnit} A function that is able to + * initiate the traversal from a given source element. + */ + var fLambda = function() { + return oWalker.walk(oSourceElement); + }; + + return fLambda; + }, + /** + * Classifies the source element as excludable if it does not + * contain a {@code with} statement or the {@code eval} identifier + * name. + */ + fClassifyAsExcludable = function() { + if (oSourceElementData.nCategory === + ESourceElementCategories.N_OTHER) { + oSourceElementData.nCategory = + ESourceElementCategories.N_EXCLUDABLE; + } + }, + /** + * Adds an identifier to the list of identifier names found. + * @param {string} sIdentifier The identifier to be added. + */ + fAddIdentifier = function(sIdentifier) { + if (-1 === oSourceElementData.aIdentifiers.indexOf(sIdentifier)) { + oSourceElementData.aIdentifiers.push(sIdentifier); + } + }, + /** + * Adds the identifier of a variable to the list of identifier names + * found. + * @param {!Array} aVariableDeclaration A variable declaration. + */ + fAddVariable = function(aVariableDeclaration) { + fAddIdentifier(/** @type {string} */ aVariableDeclaration[0]); + }, + /** + * Increments the count of the number of occurrences of the prefixed + * String representation attributed to the primary expression. + * @param {number} nCategory The category of the primary expression. + * @param {string} sName The prefixed String representation attributed + * to the primary expression. + */ + fCountPrimaryExpression = function(nCategory, sName) { + if (!oSourceElementData.aCount[nCategory].hasOwnProperty(sName)) { + oSourceElementData.aCount[nCategory][sName] = 0; + if (-1 === oSourceElementData.aPrimitiveValues.indexOf(sName)) { + oSourceElementData.aPrimitiveValues.push(sName); + } + } + oSourceElementData.aCount[nCategory][sName] += 1; + }, + /** + * Consolidates all worthwhile primitive values in a range of source + * elements. + * @param {number} nFrom The index (in the source text order) of the + * source element that is the first element of the range. + * @param {number} nTo The index (in the source text order) of the + * source element that is the last element of the range. + * @param {boolean} bEnclose Indicates whether the range should be + * enclosed within a function call with no argument values to a + * function with an empty parameter list if any primitive values + * are consolidated. + * @see TPrimitiveValue#nSaving + */ + fExamineSourceElements = function(nFrom, nTo, bEnclose) { + var _, + /** + * The index of the last mangled name. + * @type {number} + */ + nIndex = oScope.cname, + /** + * The index of the source element that is currently being + * considered. + * @type {number} + */ + nPosition, + /** + * A collection of functions used during the consolidation of + * primitive values and identifier names used as property + * accessors. + * @namespace + * @type {!Object.<string, function(...[*])>} + */ + oWalkersTransformers = { + /** + * If the String value that is equivalent to the sequence of + * terminal symbols that constitute the encountered identifier + * name is worthwhile, a syntactic conversion from the dot + * notation to the bracket notation ensues with that sequence + * being substituted by an identifier name to which the value + * is assigned. + * Applies to property accessors that use the dot notation. + * @param {!TSyntacticCodeUnit} oExpression The nonterminal + * MemberExpression. + * @param {string} sIdentifierName The identifier name used as + * the property accessor. + * @return {!Array} A syntactic code unit that is equivalent to + * the one encountered. + * @see TPrimitiveValue#nSaving + */ + 'dot': function(oExpression, sIdentifierName) { + /** + * The prefixed String value that is equivalent to the + * sequence of terminal symbols that constitute the + * encountered identifier name. + * @type {string} + */ + var sPrefixed = EValuePrefixes.S_STRING + sIdentifierName; + + return oSolutionBest.oPrimitiveValues.hasOwnProperty( + sPrefixed) && + oSolutionBest.oPrimitiveValues[sPrefixed].nSaving > 0 ? + ['sub', + oWalker.walk(oExpression), + ['name', + oSolutionBest.oPrimitiveValues[sPrefixed].sName]] : + ['dot', oWalker.walk(oExpression), sIdentifierName]; + }, + /** + * If the encountered identifier is a null or Boolean literal + * and its value is worthwhile, the identifier is substituted + * by an identifier name to which that value is assigned. + * Applies to identifier names. + * @param {string} sIdentifier The identifier encountered. + * @return {!Array} A syntactic code unit that is equivalent to + * the one encountered. + * @see TPrimitiveValue#nSaving + */ + 'name': function(sIdentifier) { + /** + * The prefixed representation String of the identifier. + * @type {string} + */ + var sPrefixed = EValuePrefixes.S_SYMBOLIC + sIdentifier; + + return [ + 'name', + oSolutionBest.oPrimitiveValues.hasOwnProperty(sPrefixed) && + oSolutionBest.oPrimitiveValues[sPrefixed].nSaving > 0 ? + oSolutionBest.oPrimitiveValues[sPrefixed].sName : + sIdentifier + ]; + }, + /** + * If the encountered String value is worthwhile, it is + * substituted by an identifier name to which that value is + * assigned. + * Applies to String values. + * @param {string} sStringValue The String value of the string + * literal encountered. + * @return {!Array} A syntactic code unit that is equivalent to + * the one encountered. + * @see TPrimitiveValue#nSaving + */ + 'string': function(sStringValue) { + /** + * The prefixed representation String of the primitive value + * of the literal. + * @type {string} + */ + var sPrefixed = + EValuePrefixes.S_STRING + sStringValue; + + return oSolutionBest.oPrimitiveValues.hasOwnProperty( + sPrefixed) && + oSolutionBest.oPrimitiveValues[sPrefixed].nSaving > 0 ? + ['name', + oSolutionBest.oPrimitiveValues[sPrefixed].sName] : + ['string', sStringValue]; + } + }, + /** + * Such data on what to consolidate within the range of source + * elements that is currently being considered that lead to the + * greatest known reduction of the number of the terminal symbols + * in comparison to the original source text. + * @type {!TSolution} + */ + oSolutionBest = new TSolution(), + /** + * Data representing an ongoing attempt to find a better + * reduction of the number of the terminal symbols in comparison + * to the original source text than the best one that is + * currently known. + * @type {!TSolution} + * @see oSolutionBest + */ + oSolutionCandidate = new TSolution(), + /** + * A record consisting of data about the range of source elements + * that is currently being examined. + * @type {!TSourceElementsData} + */ + oSourceElementsData = new TSourceElementsData(), + /** + * Variable declarations for each primitive value that is to be + * consolidated within the elements. + * @type {!Array.<!Array>} + */ + aVariableDeclarations = [], + /** + * Augments a list with a prefixed representation String. + * @param {!Array.<string>} aList A list that is to be augmented. + * @return {function(string)} A function that augments a list + * with a prefixed representation String. + */ + cAugmentList = function(aList) { + /** + * @param {string} sPrefixed Prefixed representation String of + * a primitive value that could be consolidated within the + * elements. + */ + var fLambda = function(sPrefixed) { + if (-1 === aList.indexOf(sPrefixed)) { + aList.push(sPrefixed); + } + }; + + return fLambda; + }, + /** + * Adds the number of occurrences of a primitive value of a given + * category that could be consolidated in the source element with + * a given index to the count of occurrences of that primitive + * value within the range of source elements that is currently + * being considered. + * @param {number} nPosition The index (in the source text order) + * of a source element. + * @param {number} nCategory The category of the primary + * expression from which the primitive value is derived. + * @return {function(string)} A function that performs the + * addition. + * @see cAddOccurrencesInCategory + */ + cAddOccurrences = function(nPosition, nCategory) { + /** + * @param {string} sPrefixed The prefixed representation String + * of a primitive value. + */ + var fLambda = function(sPrefixed) { + if (!oSourceElementsData.aCount[nCategory].hasOwnProperty( + sPrefixed)) { + oSourceElementsData.aCount[nCategory][sPrefixed] = 0; + } + oSourceElementsData.aCount[nCategory][sPrefixed] += + aSourceElementsData[nPosition].aCount[nCategory][ + sPrefixed]; + }; + + return fLambda; + }, + /** + * Adds the number of occurrences of each primitive value of a + * given category that could be consolidated in the source + * element with a given index to the count of occurrences of that + * primitive values within the range of source elements that is + * currently being considered. + * @param {number} nPosition The index (in the source text order) + * of a source element. + * @return {function(number)} A function that performs the + * addition. + * @see fAddOccurrences + */ + cAddOccurrencesInCategory = function(nPosition) { + /** + * @param {number} nCategory The category of the primary + * expression from which the primitive value is derived. + */ + var fLambda = function(nCategory) { + Object.keys( + aSourceElementsData[nPosition].aCount[nCategory] + ).forEach(cAddOccurrences(nPosition, nCategory)); + }; + + return fLambda; + }, + /** + * Adds the number of occurrences of each primitive value that + * could be consolidated in the source element with a given index + * to the count of occurrences of that primitive values within + * the range of source elements that is currently being + * considered. + * @param {number} nPosition The index (in the source text order) + * of a source element. + */ + fAddOccurrences = function(nPosition) { + Object.keys(aSourceElementsData[nPosition].aCount).forEach( + cAddOccurrencesInCategory(nPosition)); + }, + /** + * Creates a variable declaration for a primitive value if that + * primitive value is to be consolidated within the elements. + * @param {string} sPrefixed Prefixed representation String of a + * primitive value that could be consolidated within the + * elements. + * @see aVariableDeclarations + */ + cAugmentVariableDeclarations = function(sPrefixed) { + if (oSolutionBest.oPrimitiveValues[sPrefixed].nSaving > 0) { + aVariableDeclarations.push([ + oSolutionBest.oPrimitiveValues[sPrefixed].sName, + [0 === sPrefixed.indexOf(EValuePrefixes.S_SYMBOLIC) ? + 'name' : 'string', + sPrefixed.substring(EValuePrefixes.S_SYMBOLIC.length)] + ]); + } + }, + /** + * Sorts primitive values with regard to the difference in the + * number of terminal symbols between the original source text + * and the one with those primitive values consolidated. + * @param {string} sPrefixed0 The prefixed representation String + * of the first of the two primitive values that are being + * compared. + * @param {string} sPrefixed1 The prefixed representation String + * of the second of the two primitive values that are being + * compared. + * @return {number} + * <dl> + * <dt>-1</dt> + * <dd>if the first primitive value must be placed before + * the other one,</dd> + * <dt>0</dt> + * <dd>if the first primitive value may be placed before + * the other one,</dd> + * <dt>1</dt> + * <dd>if the first primitive value must not be placed + * before the other one.</dd> + * </dl> + * @see TSolution.oPrimitiveValues + */ + cSortPrimitiveValues = function(sPrefixed0, sPrefixed1) { + /** + * The difference between: + * <ol> + * <li>the difference in the number of terminal symbols + * between the original source text and the one with the + * first primitive value consolidated, and</li> + * <li>the difference in the number of terminal symbols + * between the original source text and the one with the + * second primitive value consolidated.</li> + * </ol> + * @type {number} + */ + var nDifference = + oSolutionCandidate.oPrimitiveValues[sPrefixed0].nSaving - + oSolutionCandidate.oPrimitiveValues[sPrefixed1].nSaving; + + return nDifference > 0 ? -1 : nDifference < 0 ? 1 : 0; + }, + /** + * Assigns an identifier name to a primitive value and calculates + * whether instances of that primitive value are worth + * consolidating. + * @param {string} sPrefixed The prefixed representation String + * of a primitive value that is being evaluated. + */ + fEvaluatePrimitiveValue = function(sPrefixed) { + var _, + /** + * The index of the last mangled name. + * @type {number} + */ + nIndex, + /** + * The representation String of the primitive value that is + * being evaluated. + * @type {string} + */ + sName = + sPrefixed.substring(EValuePrefixes.S_SYMBOLIC.length), + /** + * The number of source characters taken up by the + * representation String of the primitive value that is + * being evaluated. + * @type {number} + */ + nLengthOriginal = sName.length, + /** + * The number of source characters taken up by the + * identifier name that could substitute the primitive + * value that is being evaluated. + * substituted. + * @type {number} + */ + nLengthSubstitution, + /** + * The number of source characters taken up by by the + * representation String of the primitive value that is + * being evaluated when it is represented by a string + * literal. + * @type {number} + */ + nLengthString = oProcessor.make_string(sName).length; + + oSolutionCandidate.oPrimitiveValues[sPrefixed] = + new TPrimitiveValue(); + do { // Find an identifier unused in this or any nested scope. + nIndex = oScope.cname; + oSolutionCandidate.oPrimitiveValues[sPrefixed].sName = + oScope.next_mangled(); + } while (-1 !== oSourceElementsData.aIdentifiers.indexOf( + oSolutionCandidate.oPrimitiveValues[sPrefixed].sName)); + nLengthSubstitution = oSolutionCandidate.oPrimitiveValues[ + sPrefixed].sName.length; + if (0 === sPrefixed.indexOf(EValuePrefixes.S_SYMBOLIC)) { + // foo:null, or foo:null; + oSolutionCandidate.oPrimitiveValues[sPrefixed].nSaving -= + nLengthSubstitution + nLengthOriginal + + oWeights.N_VARIABLE_DECLARATION; + // null vs foo + oSolutionCandidate.oPrimitiveValues[sPrefixed].nSaving += + oSourceElementsData.aCount[ + EPrimaryExpressionCategories. + N_NULL_AND_BOOLEAN_LITERALS][sPrefixed] * + (nLengthOriginal - nLengthSubstitution); + } else { + // foo:'fromCharCode'; + oSolutionCandidate.oPrimitiveValues[sPrefixed].nSaving -= + nLengthSubstitution + nLengthString + + oWeights.N_VARIABLE_DECLARATION; + // .fromCharCode vs [foo] + if (oSourceElementsData.aCount[ + EPrimaryExpressionCategories.N_IDENTIFIER_NAMES + ].hasOwnProperty(sPrefixed)) { + oSolutionCandidate.oPrimitiveValues[sPrefixed].nSaving += + oSourceElementsData.aCount[ + EPrimaryExpressionCategories.N_IDENTIFIER_NAMES + ][sPrefixed] * + (nLengthOriginal - nLengthSubstitution - + oWeights.N_PROPERTY_ACCESSOR); + } + // 'fromCharCode' vs foo + if (oSourceElementsData.aCount[ + EPrimaryExpressionCategories.N_STRING_LITERALS + ].hasOwnProperty(sPrefixed)) { + oSolutionCandidate.oPrimitiveValues[sPrefixed].nSaving += + oSourceElementsData.aCount[ + EPrimaryExpressionCategories.N_STRING_LITERALS + ][sPrefixed] * + (nLengthString - nLengthSubstitution); + } + } + if (oSolutionCandidate.oPrimitiveValues[sPrefixed].nSaving > + 0) { + oSolutionCandidate.nSavings += + oSolutionCandidate.oPrimitiveValues[sPrefixed].nSaving; + } else { + oScope.cname = nIndex; // Free the identifier name. + } + }, + /** + * Adds a variable declaration to an existing variable statement. + * @param {!Array} aVariableDeclaration A variable declaration + * with an initialiser. + */ + cAddVariableDeclaration = function(aVariableDeclaration) { + (/** @type {!Array} */ oSourceElements[nFrom][1]).unshift( + aVariableDeclaration); + }; + + if (nFrom > nTo) { + return; + } + // If the range is a closure, reuse the closure. + if (nFrom === nTo && + 'stat' === oSourceElements[nFrom][0] && + 'call' === oSourceElements[nFrom][1][0] && + 'function' === oSourceElements[nFrom][1][1][0]) { + fExamineSyntacticCodeUnit(oSourceElements[nFrom][1][1]); + return; + } + // Create a list of all derived primitive values within the range. + for (nPosition = nFrom; nPosition <= nTo; nPosition += 1) { + aSourceElementsData[nPosition].aPrimitiveValues.forEach( + cAugmentList(oSourceElementsData.aPrimitiveValues)); + } + if (0 === oSourceElementsData.aPrimitiveValues.length) { + return; + } + for (nPosition = nFrom; nPosition <= nTo; nPosition += 1) { + // Add the number of occurrences to the total count. + fAddOccurrences(nPosition); + // Add identifiers of this or any nested scope to the list. + aSourceElementsData[nPosition].aIdentifiers.forEach( + cAugmentList(oSourceElementsData.aIdentifiers)); + } + // Distribute identifier names among derived primitive values. + do { // If there was any progress, find a better distribution. + oSolutionBest = oSolutionCandidate; + if (Object.keys(oSolutionCandidate.oPrimitiveValues).length > 0) { + // Sort primitive values descending by their worthwhileness. + oSourceElementsData.aPrimitiveValues.sort(cSortPrimitiveValues); + } + oSolutionCandidate = new TSolution(); + oSourceElementsData.aPrimitiveValues.forEach( + fEvaluatePrimitiveValue); + oScope.cname = nIndex; + } while (oSolutionCandidate.nSavings > oSolutionBest.nSavings); + // Take the necessity of adding a variable statement into account. + if ('var' !== oSourceElements[nFrom][0]) { + oSolutionBest.nSavings -= oWeights.N_VARIABLE_STATEMENT_AFFIXATION; + } + if (bEnclose) { + // Take the necessity of forming a closure into account. + oSolutionBest.nSavings -= oWeights.N_CLOSURE; + } + if (oSolutionBest.nSavings > 0) { + // Create variable declarations suitable for UglifyJS. + Object.keys(oSolutionBest.oPrimitiveValues).forEach( + cAugmentVariableDeclarations); + // Rewrite expressions that contain worthwhile primitive values. + for (nPosition = nFrom; nPosition <= nTo; nPosition += 1) { + oWalker = oProcessor.ast_walker(); + oSourceElements[nPosition] = + oWalker.with_walkers( + oWalkersTransformers, + cContext(oWalker, oSourceElements[nPosition])); + } + if ('var' === oSourceElements[nFrom][0]) { // Reuse the statement. + (/** @type {!Array.<!Array>} */ aVariableDeclarations.reverse( + )).forEach(cAddVariableDeclaration); + } else { // Add a variable statement. + Array.prototype.splice.call( + oSourceElements, + nFrom, + 0, + ['var', aVariableDeclarations]); + nTo += 1; + } + if (bEnclose) { + // Add a closure. + Array.prototype.splice.call( + oSourceElements, + nFrom, + 0, + ['stat', ['call', ['function', null, [], []], []]]); + // Copy source elements into the closure. + for (nPosition = nTo + 1; nPosition > nFrom; nPosition -= 1) { + Array.prototype.unshift.call( + oSourceElements[nFrom][1][1][3], + oSourceElements[nPosition]); + } + // Remove source elements outside the closure. + Array.prototype.splice.call( + oSourceElements, + nFrom + 1, + nTo - nFrom + 1); + } + } + if (bEnclose) { + // Restore the availability of identifier names. + oScope.cname = nIndex; + } + }; + + oSourceElements = (/** @type {!TSyntacticCodeUnit} */ + oSyntacticCodeUnit[bIsGlobal ? 1 : 3]); + if (0 === oSourceElements.length) { + return; + } + oScope = bIsGlobal ? oSyntacticCodeUnit.scope : oSourceElements.scope; + // Skip a Directive Prologue. + while (nAfterDirectivePrologue < oSourceElements.length && + 'directive' === oSourceElements[nAfterDirectivePrologue][0]) { + nAfterDirectivePrologue += 1; + aSourceElementsData.push(null); + } + if (oSourceElements.length === nAfterDirectivePrologue) { + return; + } + for (nPosition = nAfterDirectivePrologue; + nPosition < oSourceElements.length; + nPosition += 1) { + oSourceElementData = new TSourceElementsData(); + oWalker = oProcessor.ast_walker(); + // Classify a source element. + // Find its derived primitive values and count their occurrences. + // Find all identifiers used (including nested scopes). + oWalker.with_walkers( + oWalkers.oSurveySourceElement, + cContext(oWalker, oSourceElements[nPosition])); + // Establish whether the scope is still wholly examinable. + bIsWhollyExaminable = bIsWhollyExaminable && + ESourceElementCategories.N_WITH !== oSourceElementData.nCategory && + ESourceElementCategories.N_EVAL !== oSourceElementData.nCategory; + aSourceElementsData.push(oSourceElementData); + } + if (bIsWhollyExaminable) { // Examine the whole scope. + fExamineSourceElements( + nAfterDirectivePrologue, + oSourceElements.length - 1, + false); + } else { // Examine unexcluded ranges of source elements. + for (nPosition = oSourceElements.length - 1; + nPosition >= nAfterDirectivePrologue; + nPosition -= 1) { + oSourceElementData = (/** @type {!TSourceElementsData} */ + aSourceElementsData[nPosition]); + if (ESourceElementCategories.N_OTHER === + oSourceElementData.nCategory) { + if ('undefined' === typeof nTo) { + nTo = nPosition; // Indicate the end of a range. + } + // Examine the range if it immediately follows a Directive Prologue. + if (nPosition === nAfterDirectivePrologue) { + fExamineSourceElements(nPosition, nTo, true); + } + } else { + if ('undefined' !== typeof nTo) { + // Examine the range that immediately follows this source element. + fExamineSourceElements(nPosition + 1, nTo, true); + nTo = void 0; // Obliterate the range. + } + // Examine nested functions. + oWalker = oProcessor.ast_walker(); + oWalker.with_walkers( + oWalkers.oExamineFunctions, + cContext(oWalker, oSourceElements[nPosition])); + } + } + } + }(oAbstractSyntaxTree = oProcessor.ast_add_scope(oAbstractSyntaxTree))); + return oAbstractSyntaxTree; +}; +/*jshint sub:false */ + +/* Local Variables: */ +/* mode: js */ +/* coding: utf-8 */ +/* indent-tabs-mode: nil */ +/* tab-width: 2 */ +/* End: */ +/* vim: set ft=javascript fenc=utf-8 et ts=2 sts=2 sw=2: */ +/* :mode=javascript:noTabs=true:tabSize=2:indentSize=2:deepIndent=true: */ +}); +define('uglifyjs/parse-js', ["exports"], function(exports) { +/*********************************************************************** + + A JavaScript tokenizer / parser / beautifier / compressor. + + This version is suitable for Node.js. With minimal changes (the + exports stuff) it should work on any JS platform. + + This file contains the tokenizer/parser. It is a port to JavaScript + of parse-js [1], a JavaScript parser library written in Common Lisp + by Marijn Haverbeke. Thank you Marijn! + + [1] http://marijn.haverbeke.nl/parse-js/ + + Exported functions: + + - tokenizer(code) -- returns a function. Call the returned + function to fetch the next token. + + - parse(code) -- returns an AST of the given JavaScript code. + + -------------------------------- (C) --------------------------------- + + Author: Mihai Bazon + <mihai.bazon@gmail.com> + http://mihai.bazon.net/blog + + Distributed under the BSD license: + + Copyright 2010 (c) Mihai Bazon <mihai.bazon@gmail.com> + Based on parse-js (http://marijn.haverbeke.nl/parse-js/). + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + ***********************************************************************/ + +/* -----[ Tokenizer (constants) ]----- */ + +var KEYWORDS = array_to_hash([ + "break", + "case", + "catch", + "const", + "continue", + "debugger", + "default", + "delete", + "do", + "else", + "finally", + "for", + "function", + "if", + "in", + "instanceof", + "new", + "return", + "switch", + "throw", + "try", + "typeof", + "var", + "void", + "while", + "with" +]); + +var RESERVED_WORDS = array_to_hash([ + "abstract", + "boolean", + "byte", + "char", + "class", + "double", + "enum", + "export", + "extends", + "final", + "float", + "goto", + "implements", + "import", + "int", + "interface", + "long", + "native", + "package", + "private", + "protected", + "public", + "short", + "static", + "super", + "synchronized", + "throws", + "transient", + "volatile" +]); + +var KEYWORDS_BEFORE_EXPRESSION = array_to_hash([ + "return", + "new", + "delete", + "throw", + "else", + "case" +]); + +var KEYWORDS_ATOM = array_to_hash([ + "false", + "null", + "true", + "undefined" +]); + +var OPERATOR_CHARS = array_to_hash(characters("+-*&%=<>!?|~^")); + +var RE_HEX_NUMBER = /^0x[0-9a-f]+$/i; +var RE_OCT_NUMBER = /^0[0-7]+$/; +var RE_DEC_NUMBER = /^\d*\.?\d*(?:e[+-]?\d*(?:\d\.?|\.?\d)\d*)?$/i; + +var OPERATORS = array_to_hash([ + "in", + "instanceof", + "typeof", + "new", + "void", + "delete", + "++", + "--", + "+", + "-", + "!", + "~", + "&", + "|", + "^", + "*", + "/", + "%", + ">>", + "<<", + ">>>", + "<", + ">", + "<=", + ">=", + "==", + "===", + "!=", + "!==", + "?", + "=", + "+=", + "-=", + "/=", + "*=", + "%=", + ">>=", + "<<=", + ">>>=", + "|=", + "^=", + "&=", + "&&", + "||" +]); + +var WHITESPACE_CHARS = array_to_hash(characters(" \u00a0\n\r\t\f\u000b\u200b\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000")); + +var PUNC_BEFORE_EXPRESSION = array_to_hash(characters("[{(,.;:")); + +var PUNC_CHARS = array_to_hash(characters("[]{}(),;:")); + +var REGEXP_MODIFIERS = array_to_hash(characters("gmsiy")); + +/* -----[ Tokenizer ]----- */ + +var UNICODE = { // Unicode 6.1 + letter: new RegExp("[\\u0041-\\u005A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0\\u08A2-\\u08AC\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097F\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F0\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191C\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA697\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA793\\uA7A0-\\uA7AA\\uA7F8-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA80-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"), + combining_mark: new RegExp("[\\u0300-\\u036F\\u0483-\\u0487\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0610-\\u061A\\u064B-\\u065F\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0859-\\u085B\\u08E4-\\u08FE\\u0900-\\u0903\\u093A-\\u093C\\u093E-\\u094F\\u0951-\\u0957\\u0962\\u0963\\u0981-\\u0983\\u09BC\\u09BE-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CD\\u09D7\\u09E2\\u09E3\\u0A01-\\u0A03\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81-\\u0A83\\u0ABC\\u0ABE-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AE2\\u0AE3\\u0B01-\\u0B03\\u0B3C\\u0B3E-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B62\\u0B63\\u0B82\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD7\\u0C01-\\u0C03\\u0C3E-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0C82\\u0C83\\u0CBC\\u0CBE-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CE2\\u0CE3\\u0D02\\u0D03\\u0D3E-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4D\\u0D57\\u0D62\\u0D63\\u0D82\\u0D83\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DF2\\u0DF3\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB4-\\u0EB9\\u0EBB\\u0EBC\\u0EC8-\\u0ECD\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F3E\\u0F3F\\u0F71-\\u0F84\\u0F86\\u0F87\\u0F8D-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102B-\\u103E\\u1056-\\u1059\\u105E-\\u1060\\u1062-\\u1064\\u1067-\\u106D\\u1071-\\u1074\\u1082-\\u108D\\u108F\\u109A-\\u109D\\u135D-\\u135F\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B4-\\u17D3\\u17DD\\u180B-\\u180D\\u18A9\\u1920-\\u192B\\u1930-\\u193B\\u19B0-\\u19C0\\u19C8\\u19C9\\u1A17-\\u1A1B\\u1A55-\\u1A5E\\u1A60-\\u1A7C\\u1A7F\\u1B00-\\u1B04\\u1B34-\\u1B44\\u1B6B-\\u1B73\\u1B80-\\u1B82\\u1BA1-\\u1BAD\\u1BE6-\\u1BF3\\u1C24-\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE8\\u1CED\\u1CF2-\\u1CF4\\u1DC0-\\u1DE6\\u1DFC-\\u1DFF\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2CEF-\\u2CF1\\u2D7F\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\uA66F\\uA674-\\uA67D\\uA69F\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA823-\\uA827\\uA880\\uA881\\uA8B4-\\uA8C4\\uA8E0-\\uA8F1\\uA926-\\uA92D\\uA947-\\uA953\\uA980-\\uA983\\uA9B3-\\uA9C0\\uAA29-\\uAA36\\uAA43\\uAA4C\\uAA4D\\uAA7B\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uAAEB-\\uAAEF\\uAAF5\\uAAF6\\uABE3-\\uABEA\\uABEC\\uABED\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE26]"), + connector_punctuation: new RegExp("[\\u005F\\u203F\\u2040\\u2054\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFF3F]"), + digit: new RegExp("[\\u0030-\\u0039\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0BE6-\\u0BEF\\u0C66-\\u0C6F\\u0CE6-\\u0CEF\\u0D66-\\u0D6F\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F29\\u1040-\\u1049\\u1090-\\u1099\\u17E0-\\u17E9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19D9\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\uA620-\\uA629\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19]") +}; + +function is_letter(ch) { + return UNICODE.letter.test(ch); +}; + +function is_digit(ch) { + ch = ch.charCodeAt(0); + return ch >= 48 && ch <= 57; +}; + +function is_unicode_digit(ch) { + return UNICODE.digit.test(ch); +} + +function is_alphanumeric_char(ch) { + return is_digit(ch) || is_letter(ch); +}; + +function is_unicode_combining_mark(ch) { + return UNICODE.combining_mark.test(ch); +}; + +function is_unicode_connector_punctuation(ch) { + return UNICODE.connector_punctuation.test(ch); +}; + +function is_identifier_start(ch) { + return ch == "$" || ch == "_" || is_letter(ch); +}; + +function is_identifier_char(ch) { + return is_identifier_start(ch) + || is_unicode_combining_mark(ch) + || is_unicode_digit(ch) + || is_unicode_connector_punctuation(ch) + || ch == "\u200c" // zero-width non-joiner <ZWNJ> + || ch == "\u200d" // zero-width joiner <ZWJ> (in my ECMA-262 PDF, this is also 200c) + ; +}; + +function parse_js_number(num) { + if (RE_HEX_NUMBER.test(num)) { + return parseInt(num.substr(2), 16); + } else if (RE_OCT_NUMBER.test(num)) { + return parseInt(num.substr(1), 8); + } else if (RE_DEC_NUMBER.test(num)) { + return parseFloat(num); + } +}; + +function JS_Parse_Error(message, line, col, pos) { + this.message = message; + this.line = line + 1; + this.col = col + 1; + this.pos = pos + 1; + this.stack = new Error().stack; +}; + +JS_Parse_Error.prototype.toString = function() { + return this.message + " (line: " + this.line + ", col: " + this.col + ", pos: " + this.pos + ")" + "\n\n" + this.stack; +}; + +function js_error(message, line, col, pos) { + throw new JS_Parse_Error(message, line, col, pos); +}; + +function is_token(token, type, val) { + return token.type == type && (val == null || token.value == val); +}; + +var EX_EOF = {}; + +function tokenizer($TEXT) { + + var S = { + text : $TEXT.replace(/\r\n?|[\n\u2028\u2029]/g, "\n").replace(/^\uFEFF/, ''), + pos : 0, + tokpos : 0, + line : 0, + tokline : 0, + col : 0, + tokcol : 0, + newline_before : false, + regex_allowed : false, + comments_before : [] + }; + + function peek() { return S.text.charAt(S.pos); }; + + function next(signal_eof, in_string) { + var ch = S.text.charAt(S.pos++); + if (signal_eof && !ch) + throw EX_EOF; + if (ch == "\n") { + S.newline_before = S.newline_before || !in_string; + ++S.line; + S.col = 0; + } else { + ++S.col; + } + return ch; + }; + + function eof() { + return !S.peek(); + }; + + function find(what, signal_eof) { + var pos = S.text.indexOf(what, S.pos); + if (signal_eof && pos == -1) throw EX_EOF; + return pos; + }; + + function start_token() { + S.tokline = S.line; + S.tokcol = S.col; + S.tokpos = S.pos; + }; + + function token(type, value, is_comment) { + S.regex_allowed = ((type == "operator" && !HOP(UNARY_POSTFIX, value)) || + (type == "keyword" && HOP(KEYWORDS_BEFORE_EXPRESSION, value)) || + (type == "punc" && HOP(PUNC_BEFORE_EXPRESSION, value))); + var ret = { + type : type, + value : value, + line : S.tokline, + col : S.tokcol, + pos : S.tokpos, + endpos : S.pos, + nlb : S.newline_before + }; + if (!is_comment) { + ret.comments_before = S.comments_before; + S.comments_before = []; + // make note of any newlines in the comments that came before + for (var i = 0, len = ret.comments_before.length; i < len; i++) { + ret.nlb = ret.nlb || ret.comments_before[i].nlb; + } + } + S.newline_before = false; + return ret; + }; + + function skip_whitespace() { + while (HOP(WHITESPACE_CHARS, peek())) + next(); + }; + + function read_while(pred) { + var ret = "", ch = peek(), i = 0; + while (ch && pred(ch, i++)) { + ret += next(); + ch = peek(); + } + return ret; + }; + + function parse_error(err) { + js_error(err, S.tokline, S.tokcol, S.tokpos); + }; + + function read_num(prefix) { + var has_e = false, after_e = false, has_x = false, has_dot = prefix == "."; + var num = read_while(function(ch, i){ + if (ch == "x" || ch == "X") { + if (has_x) return false; + return has_x = true; + } + if (!has_x && (ch == "E" || ch == "e")) { + if (has_e) return false; + return has_e = after_e = true; + } + if (ch == "-") { + if (after_e || (i == 0 && !prefix)) return true; + return false; + } + if (ch == "+") return after_e; + after_e = false; + if (ch == ".") { + if (!has_dot && !has_x && !has_e) + return has_dot = true; + return false; + } + return is_alphanumeric_char(ch); + }); + if (prefix) + num = prefix + num; + var valid = parse_js_number(num); + if (!isNaN(valid)) { + return token("num", valid); + } else { + parse_error("Invalid syntax: " + num); + } + }; + + function read_escaped_char(in_string) { + var ch = next(true, in_string); + switch (ch) { + case "n" : return "\n"; + case "r" : return "\r"; + case "t" : return "\t"; + case "b" : return "\b"; + case "v" : return "\u000b"; + case "f" : return "\f"; + case "0" : return "\0"; + case "x" : return String.fromCharCode(hex_bytes(2)); + case "u" : return String.fromCharCode(hex_bytes(4)); + case "\n": return ""; + default : return ch; + } + }; + + function hex_bytes(n) { + var num = 0; + for (; n > 0; --n) { + var digit = parseInt(next(true), 16); + if (isNaN(digit)) + parse_error("Invalid hex-character pattern in string"); + num = (num << 4) | digit; + } + return num; + }; + + function read_string() { + return with_eof_error("Unterminated string constant", function(){ + var quote = next(), ret = ""; + for (;;) { + var ch = next(true); + if (ch == "\\") { + // read OctalEscapeSequence (XXX: deprecated if "strict mode") + // https://github.com/mishoo/UglifyJS/issues/178 + var octal_len = 0, first = null; + ch = read_while(function(ch){ + if (ch >= "0" && ch <= "7") { + if (!first) { + first = ch; + return ++octal_len; + } + else if (first <= "3" && octal_len <= 2) return ++octal_len; + else if (first >= "4" && octal_len <= 1) return ++octal_len; + } + return false; + }); + if (octal_len > 0) ch = String.fromCharCode(parseInt(ch, 8)); + else ch = read_escaped_char(true); + } + else if (ch == quote) break; + ret += ch; + } + return token("string", ret); + }); + }; + + function read_line_comment() { + next(); + var i = find("\n"), ret; + if (i == -1) { + ret = S.text.substr(S.pos); + S.pos = S.text.length; + } else { + ret = S.text.substring(S.pos, i); + S.pos = i; + } + return token("comment1", ret, true); + }; + + function read_multiline_comment() { + next(); + return with_eof_error("Unterminated multiline comment", function(){ + var i = find("*/", true), + text = S.text.substring(S.pos, i); + S.pos = i + 2; + S.line += text.split("\n").length - 1; + S.newline_before = S.newline_before || text.indexOf("\n") >= 0; + + // https://github.com/mishoo/UglifyJS/issues/#issue/100 + if (/^@cc_on/i.test(text)) { + warn("WARNING: at line " + S.line); + warn("*** Found \"conditional comment\": " + text); + warn("*** UglifyJS DISCARDS ALL COMMENTS. This means your code might no longer work properly in Internet Explorer."); + } + + return token("comment2", text, true); + }); + }; + + function read_name() { + var backslash = false, name = "", ch, escaped = false, hex; + while ((ch = peek()) != null) { + if (!backslash) { + if (ch == "\\") escaped = backslash = true, next(); + else if (is_identifier_char(ch)) name += next(); + else break; + } + else { + if (ch != "u") parse_error("Expecting UnicodeEscapeSequence -- uXXXX"); + ch = read_escaped_char(); + if (!is_identifier_char(ch)) parse_error("Unicode char: " + ch.charCodeAt(0) + " is not valid in identifier"); + name += ch; + backslash = false; + } + } + if (HOP(KEYWORDS, name) && escaped) { + hex = name.charCodeAt(0).toString(16).toUpperCase(); + name = "\\u" + "0000".substr(hex.length) + hex + name.slice(1); + } + return name; + }; + + function read_regexp(regexp) { + return with_eof_error("Unterminated regular expression", function(){ + var prev_backslash = false, ch, in_class = false; + while ((ch = next(true))) if (prev_backslash) { + regexp += "\\" + ch; + prev_backslash = false; + } else if (ch == "[") { + in_class = true; + regexp += ch; + } else if (ch == "]" && in_class) { + in_class = false; + regexp += ch; + } else if (ch == "/" && !in_class) { + break; + } else if (ch == "\\") { + prev_backslash = true; + } else { + regexp += ch; + } + var mods = read_name(); + return token("regexp", [ regexp, mods ]); + }); + }; + + function read_operator(prefix) { + function grow(op) { + if (!peek()) return op; + var bigger = op + peek(); + if (HOP(OPERATORS, bigger)) { + next(); + return grow(bigger); + } else { + return op; + } + }; + return token("operator", grow(prefix || next())); + }; + + function handle_slash() { + next(); + var regex_allowed = S.regex_allowed; + switch (peek()) { + case "/": + S.comments_before.push(read_line_comment()); + S.regex_allowed = regex_allowed; + return next_token(); + case "*": + S.comments_before.push(read_multiline_comment()); + S.regex_allowed = regex_allowed; + return next_token(); + } + return S.regex_allowed ? read_regexp("") : read_operator("/"); + }; + + function handle_dot() { + next(); + return is_digit(peek()) + ? read_num(".") + : token("punc", "."); + }; + + function read_word() { + var word = read_name(); + return !HOP(KEYWORDS, word) + ? token("name", word) + : HOP(OPERATORS, word) + ? token("operator", word) + : HOP(KEYWORDS_ATOM, word) + ? token("atom", word) + : token("keyword", word); + }; + + function with_eof_error(eof_error, cont) { + try { + return cont(); + } catch(ex) { + if (ex === EX_EOF) parse_error(eof_error); + else throw ex; + } + }; + + function next_token(force_regexp) { + if (force_regexp != null) + return read_regexp(force_regexp); + skip_whitespace(); + start_token(); + var ch = peek(); + if (!ch) return token("eof"); + if (is_digit(ch)) return read_num(); + if (ch == '"' || ch == "'") return read_string(); + if (HOP(PUNC_CHARS, ch)) return token("punc", next()); + if (ch == ".") return handle_dot(); + if (ch == "/") return handle_slash(); + if (HOP(OPERATOR_CHARS, ch)) return read_operator(); + if (ch == "\\" || is_identifier_start(ch)) return read_word(); + parse_error("Unexpected character '" + ch + "'"); + }; + + next_token.context = function(nc) { + if (nc) S = nc; + return S; + }; + + return next_token; + +}; + +/* -----[ Parser (constants) ]----- */ + +var UNARY_PREFIX = array_to_hash([ + "typeof", + "void", + "delete", + "--", + "++", + "!", + "~", + "-", + "+" +]); + +var UNARY_POSTFIX = array_to_hash([ "--", "++" ]); + +var ASSIGNMENT = (function(a, ret, i){ + while (i < a.length) { + ret[a[i]] = a[i].substr(0, a[i].length - 1); + i++; + } + return ret; +})( + ["+=", "-=", "/=", "*=", "%=", ">>=", "<<=", ">>>=", "|=", "^=", "&="], + { "=": true }, + 0 +); + +var PRECEDENCE = (function(a, ret){ + for (var i = 0, n = 1; i < a.length; ++i, ++n) { + var b = a[i]; + for (var j = 0; j < b.length; ++j) { + ret[b[j]] = n; + } + } + return ret; +})( + [ + ["||"], + ["&&"], + ["|"], + ["^"], + ["&"], + ["==", "===", "!=", "!=="], + ["<", ">", "<=", ">=", "in", "instanceof"], + [">>", "<<", ">>>"], + ["+", "-"], + ["*", "/", "%"] + ], + {} +); + +var STATEMENTS_WITH_LABELS = array_to_hash([ "for", "do", "while", "switch" ]); + +var ATOMIC_START_TOKEN = array_to_hash([ "atom", "num", "string", "regexp", "name" ]); + +/* -----[ Parser ]----- */ + +function NodeWithToken(str, start, end) { + this.name = str; + this.start = start; + this.end = end; +}; + +NodeWithToken.prototype.toString = function() { return this.name; }; + +function parse($TEXT, exigent_mode, embed_tokens) { + + var S = { + input : typeof $TEXT == "string" ? tokenizer($TEXT, true) : $TEXT, + token : null, + prev : null, + peeked : null, + in_function : 0, + in_directives : true, + in_loop : 0, + labels : [] + }; + + S.token = next(); + + function is(type, value) { + return is_token(S.token, type, value); + }; + + function peek() { return S.peeked || (S.peeked = S.input()); }; + + function next() { + S.prev = S.token; + if (S.peeked) { + S.token = S.peeked; + S.peeked = null; + } else { + S.token = S.input(); + } + S.in_directives = S.in_directives && ( + S.token.type == "string" || is("punc", ";") + ); + return S.token; + }; + + function prev() { + return S.prev; + }; + + function croak(msg, line, col, pos) { + var ctx = S.input.context(); + js_error(msg, + line != null ? line : ctx.tokline, + col != null ? col : ctx.tokcol, + pos != null ? pos : ctx.tokpos); + }; + + function token_error(token, msg) { + croak(msg, token.line, token.col); + }; + + function unexpected(token) { + if (token == null) + token = S.token; + token_error(token, "Unexpected token: " + token.type + " (" + token.value + ")"); + }; + + function expect_token(type, val) { + if (is(type, val)) { + return next(); + } + token_error(S.token, "Unexpected token " + S.token.type + ", expected " + type); + }; + + function expect(punc) { return expect_token("punc", punc); }; + + function can_insert_semicolon() { + return !exigent_mode && ( + S.token.nlb || is("eof") || is("punc", "}") + ); + }; + + function semicolon() { + if (is("punc", ";")) next(); + else if (!can_insert_semicolon()) unexpected(); + }; + + function as() { + return slice(arguments); + }; + + function parenthesised() { + expect("("); + var ex = expression(); + expect(")"); + return ex; + }; + + function add_tokens(str, start, end) { + return str instanceof NodeWithToken ? str : new NodeWithToken(str, start, end); + }; + + function maybe_embed_tokens(parser) { + if (embed_tokens) return function() { + var start = S.token; + var ast = parser.apply(this, arguments); + ast[0] = add_tokens(ast[0], start, prev()); + return ast; + }; + else return parser; + }; + + var statement = maybe_embed_tokens(function() { + if (is("operator", "/") || is("operator", "/=")) { + S.peeked = null; + S.token = S.input(S.token.value.substr(1)); // force regexp + } + switch (S.token.type) { + case "string": + var dir = S.in_directives, stat = simple_statement(); + if (dir && stat[1][0] == "string" && !is("punc", ",")) + return as("directive", stat[1][1]); + return stat; + case "num": + case "regexp": + case "operator": + case "atom": + return simple_statement(); + + case "name": + return is_token(peek(), "punc", ":") + ? labeled_statement(prog1(S.token.value, next, next)) + : simple_statement(); + + case "punc": + switch (S.token.value) { + case "{": + return as("block", block_()); + case "[": + case "(": + return simple_statement(); + case ";": + next(); + return as("block"); + default: + unexpected(); + } + + case "keyword": + switch (prog1(S.token.value, next)) { + case "break": + return break_cont("break"); + + case "continue": + return break_cont("continue"); + + case "debugger": + semicolon(); + return as("debugger"); + + case "do": + return (function(body){ + expect_token("keyword", "while"); + return as("do", prog1(parenthesised, semicolon), body); + })(in_loop(statement)); + + case "for": + return for_(); + + case "function": + return function_(true); + + case "if": + return if_(); + + case "return": + if (S.in_function == 0) + croak("'return' outside of function"); + return as("return", + is("punc", ";") + ? (next(), null) + : can_insert_semicolon() + ? null + : prog1(expression, semicolon)); + + case "switch": + return as("switch", parenthesised(), switch_block_()); + + case "throw": + if (S.token.nlb) + croak("Illegal newline after 'throw'"); + return as("throw", prog1(expression, semicolon)); + + case "try": + return try_(); + + case "var": + return prog1(var_, semicolon); + + case "const": + return prog1(const_, semicolon); + + case "while": + return as("while", parenthesised(), in_loop(statement)); + + case "with": + return as("with", parenthesised(), statement()); + + default: + unexpected(); + } + } + }); + + function labeled_statement(label) { + S.labels.push(label); + var start = S.token, stat = statement(); + if (exigent_mode && !HOP(STATEMENTS_WITH_LABELS, stat[0])) + unexpected(start); + S.labels.pop(); + return as("label", label, stat); + }; + + function simple_statement() { + return as("stat", prog1(expression, semicolon)); + }; + + function break_cont(type) { + var name; + if (!can_insert_semicolon()) { + name = is("name") ? S.token.value : null; + } + if (name != null) { + next(); + if (!member(name, S.labels)) + croak("Label " + name + " without matching loop or statement"); + } + else if (S.in_loop == 0) + croak(type + " not inside a loop or switch"); + semicolon(); + return as(type, name); + }; + + function for_() { + expect("("); + var init = null; + if (!is("punc", ";")) { + init = is("keyword", "var") + ? (next(), var_(true)) + : expression(true, true); + if (is("operator", "in")) { + if (init[0] == "var" && init[1].length > 1) + croak("Only one variable declaration allowed in for..in loop"); + return for_in(init); + } + } + return regular_for(init); + }; + + function regular_for(init) { + expect(";"); + var test = is("punc", ";") ? null : expression(); + expect(";"); + var step = is("punc", ")") ? null : expression(); + expect(")"); + return as("for", init, test, step, in_loop(statement)); + }; + + function for_in(init) { + var lhs = init[0] == "var" ? as("name", init[1][0]) : init; + next(); + var obj = expression(); + expect(")"); + return as("for-in", init, lhs, obj, in_loop(statement)); + }; + + var function_ = function(in_statement) { + var name = is("name") ? prog1(S.token.value, next) : null; + if (in_statement && !name) + unexpected(); + expect("("); + return as(in_statement ? "defun" : "function", + name, + // arguments + (function(first, a){ + while (!is("punc", ")")) { + if (first) first = false; else expect(","); + if (!is("name")) unexpected(); + a.push(S.token.value); + next(); + } + next(); + return a; + })(true, []), + // body + (function(){ + ++S.in_function; + var loop = S.in_loop; + S.in_directives = true; + S.in_loop = 0; + var a = block_(); + --S.in_function; + S.in_loop = loop; + return a; + })()); + }; + + function if_() { + var cond = parenthesised(), body = statement(), belse; + if (is("keyword", "else")) { + next(); + belse = statement(); + } + return as("if", cond, body, belse); + }; + + function block_() { + expect("{"); + var a = []; + while (!is("punc", "}")) { + if (is("eof")) unexpected(); + a.push(statement()); + } + next(); + return a; + }; + + var switch_block_ = curry(in_loop, function(){ + expect("{"); + var a = [], cur = null; + while (!is("punc", "}")) { + if (is("eof")) unexpected(); + if (is("keyword", "case")) { + next(); + cur = []; + a.push([ expression(), cur ]); + expect(":"); + } + else if (is("keyword", "default")) { + next(); + expect(":"); + cur = []; + a.push([ null, cur ]); + } + else { + if (!cur) unexpected(); + cur.push(statement()); + } + } + next(); + return a; + }); + + function try_() { + var body = block_(), bcatch, bfinally; + if (is("keyword", "catch")) { + next(); + expect("("); + if (!is("name")) + croak("Name expected"); + var name = S.token.value; + next(); + expect(")"); + bcatch = [ name, block_() ]; + } + if (is("keyword", "finally")) { + next(); + bfinally = block_(); + } + if (!bcatch && !bfinally) + croak("Missing catch/finally blocks"); + return as("try", body, bcatch, bfinally); + }; + + function vardefs(no_in) { + var a = []; + for (;;) { + if (!is("name")) + unexpected(); + var name = S.token.value; + next(); + if (is("operator", "=")) { + next(); + a.push([ name, expression(false, no_in) ]); + } else { + a.push([ name ]); + } + if (!is("punc", ",")) + break; + next(); + } + return a; + }; + + function var_(no_in) { + return as("var", vardefs(no_in)); + }; + + function const_() { + return as("const", vardefs()); + }; + + function new_() { + var newexp = expr_atom(false), args; + if (is("punc", "(")) { + next(); + args = expr_list(")"); + } else { + args = []; + } + return subscripts(as("new", newexp, args), true); + }; + + var expr_atom = maybe_embed_tokens(function(allow_calls) { + if (is("operator", "new")) { + next(); + return new_(); + } + if (is("punc")) { + switch (S.token.value) { + case "(": + next(); + return subscripts(prog1(expression, curry(expect, ")")), allow_calls); + case "[": + next(); + return subscripts(array_(), allow_calls); + case "{": + next(); + return subscripts(object_(), allow_calls); + } + unexpected(); + } + if (is("keyword", "function")) { + next(); + return subscripts(function_(false), allow_calls); + } + if (HOP(ATOMIC_START_TOKEN, S.token.type)) { + var atom = S.token.type == "regexp" + ? as("regexp", S.token.value[0], S.token.value[1]) + : as(S.token.type, S.token.value); + return subscripts(prog1(atom, next), allow_calls); + } + unexpected(); + }); + + function expr_list(closing, allow_trailing_comma, allow_empty) { + var first = true, a = []; + while (!is("punc", closing)) { + if (first) first = false; else expect(","); + if (allow_trailing_comma && is("punc", closing)) break; + if (is("punc", ",") && allow_empty) { + a.push([ "atom", "undefined" ]); + } else { + a.push(expression(false)); + } + } + next(); + return a; + }; + + function array_() { + return as("array", expr_list("]", !exigent_mode, true)); + }; + + function object_() { + var first = true, a = []; + while (!is("punc", "}")) { + if (first) first = false; else expect(","); + if (!exigent_mode && is("punc", "}")) + // allow trailing comma + break; + var type = S.token.type; + var name = as_property_name(); + if (type == "name" && (name == "get" || name == "set") && !is("punc", ":")) { + a.push([ as_name(), function_(false), name ]); + } else { + expect(":"); + a.push([ name, expression(false) ]); + } + } + next(); + return as("object", a); + }; + + function as_property_name() { + switch (S.token.type) { + case "num": + case "string": + return prog1(S.token.value, next); + } + return as_name(); + }; + + function as_name() { + switch (S.token.type) { + case "name": + case "operator": + case "keyword": + case "atom": + return prog1(S.token.value, next); + default: + unexpected(); + } + }; + + function subscripts(expr, allow_calls) { + if (is("punc", ".")) { + next(); + return subscripts(as("dot", expr, as_name()), allow_calls); + } + if (is("punc", "[")) { + next(); + return subscripts(as("sub", expr, prog1(expression, curry(expect, "]"))), allow_calls); + } + if (allow_calls && is("punc", "(")) { + next(); + return subscripts(as("call", expr, expr_list(")")), true); + } + return expr; + }; + + function maybe_unary(allow_calls) { + if (is("operator") && HOP(UNARY_PREFIX, S.token.value)) { + return make_unary("unary-prefix", + prog1(S.token.value, next), + maybe_unary(allow_calls)); + } + var val = expr_atom(allow_calls); + while (is("operator") && HOP(UNARY_POSTFIX, S.token.value) && !S.token.nlb) { + val = make_unary("unary-postfix", S.token.value, val); + next(); + } + return val; + }; + + function make_unary(tag, op, expr) { + if ((op == "++" || op == "--") && !is_assignable(expr)) + croak("Invalid use of " + op + " operator"); + return as(tag, op, expr); + }; + + function expr_op(left, min_prec, no_in) { + var op = is("operator") ? S.token.value : null; + if (op && op == "in" && no_in) op = null; + var prec = op != null ? PRECEDENCE[op] : null; + if (prec != null && prec > min_prec) { + next(); + var right = expr_op(maybe_unary(true), prec, no_in); + return expr_op(as("binary", op, left, right), min_prec, no_in); + } + return left; + }; + + function expr_ops(no_in) { + return expr_op(maybe_unary(true), 0, no_in); + }; + + function maybe_conditional(no_in) { + var expr = expr_ops(no_in); + if (is("operator", "?")) { + next(); + var yes = expression(false); + expect(":"); + return as("conditional", expr, yes, expression(false, no_in)); + } + return expr; + }; + + function is_assignable(expr) { + if (!exigent_mode) return true; + switch (expr[0]+"") { + case "dot": + case "sub": + case "new": + case "call": + return true; + case "name": + return expr[1] != "this"; + } + }; + + function maybe_assign(no_in) { + var left = maybe_conditional(no_in), val = S.token.value; + if (is("operator") && HOP(ASSIGNMENT, val)) { + if (is_assignable(left)) { + next(); + return as("assign", ASSIGNMENT[val], left, maybe_assign(no_in)); + } + croak("Invalid assignment"); + } + return left; + }; + + var expression = maybe_embed_tokens(function(commas, no_in) { + if (arguments.length == 0) + commas = true; + var expr = maybe_assign(no_in); + if (commas && is("punc", ",")) { + next(); + return as("seq", expr, expression(true, no_in)); + } + return expr; + }); + + function in_loop(cont) { + try { + ++S.in_loop; + return cont(); + } finally { + --S.in_loop; + } + }; + + return as("toplevel", (function(a){ + while (!is("eof")) + a.push(statement()); + return a; + })([])); + +}; + +/* -----[ Utilities ]----- */ + +function curry(f) { + var args = slice(arguments, 1); + return function() { return f.apply(this, args.concat(slice(arguments))); }; +}; + +function prog1(ret) { + if (ret instanceof Function) + ret = ret(); + for (var i = 1, n = arguments.length; --n > 0; ++i) + arguments[i](); + return ret; +}; + +function array_to_hash(a) { + var ret = {}; + for (var i = 0; i < a.length; ++i) + ret[a[i]] = true; + return ret; +}; + +function slice(a, start) { + return Array.prototype.slice.call(a, start || 0); +}; + +function characters(str) { + return str.split(""); +}; + +function member(name, array) { + for (var i = array.length; --i >= 0;) + if (array[i] == name) + return true; + return false; +}; + +function HOP(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +}; + +var warn = function() {}; + +/* -----[ Exports ]----- */ + +exports.tokenizer = tokenizer; +exports.parse = parse; +exports.slice = slice; +exports.curry = curry; +exports.member = member; +exports.array_to_hash = array_to_hash; +exports.PRECEDENCE = PRECEDENCE; +exports.KEYWORDS_ATOM = KEYWORDS_ATOM; +exports.RESERVED_WORDS = RESERVED_WORDS; +exports.KEYWORDS = KEYWORDS; +exports.ATOMIC_START_TOKEN = ATOMIC_START_TOKEN; +exports.OPERATORS = OPERATORS; +exports.is_alphanumeric_char = is_alphanumeric_char; +exports.is_identifier_start = is_identifier_start; +exports.is_identifier_char = is_identifier_char; +exports.set_logger = function(logger) { + warn = logger; +}; +}); +define('uglifyjs/squeeze-more', ["require", "exports", "module", "./parse-js", "./process"], function(require, exports, module) { + var jsp = require("./parse-js"), + pro = require("./process"), + slice = jsp.slice, + member = jsp.member, + curry = jsp.curry, + MAP = pro.MAP, + PRECEDENCE = jsp.PRECEDENCE, + OPERATORS = jsp.OPERATORS; + +function ast_squeeze_more(ast) { + var w = pro.ast_walker(), walk = w.walk, scope; + function with_scope(s, cont) { + var save = scope, ret; + scope = s; + ret = cont(); + scope = save; + return ret; + }; + function _lambda(name, args, body) { + return [ this[0], name, args, with_scope(body.scope, curry(MAP, body, walk)) ]; + }; + return w.with_walkers({ + "toplevel": function(body) { + return [ this[0], with_scope(this.scope, curry(MAP, body, walk)) ]; + }, + "function": _lambda, + "defun": _lambda, + "new": function(ctor, args) { + if (ctor[0] == "name") { + if (ctor[1] == "Array" && !scope.has("Array")) { + if (args.length != 1) { + return [ "array", args ]; + } else { + return walk([ "call", [ "name", "Array" ], args ]); + } + } else if (ctor[1] == "Object" && !scope.has("Object")) { + if (!args.length) { + return [ "object", [] ]; + } else { + return walk([ "call", [ "name", "Object" ], args ]); + } + } else if ((ctor[1] == "RegExp" || ctor[1] == "Function" || ctor[1] == "Error") && !scope.has(ctor[1])) { + return walk([ "call", [ "name", ctor[1] ], args]); + } + } + }, + "call": function(expr, args) { + if (expr[0] == "dot" && expr[1][0] == "string" && args.length == 1 + && (args[0][1] > 0 && expr[2] == "substring" || expr[2] == "substr")) { + return [ "call", [ "dot", expr[1], "slice"], args]; + } + if (expr[0] == "dot" && expr[2] == "toString" && args.length == 0) { + // foo.toString() ==> foo+"" + if (expr[1][0] == "string") return expr[1]; + return [ "binary", "+", expr[1], [ "string", "" ]]; + } + if (expr[0] == "name") { + if (expr[1] == "Array" && args.length != 1 && !scope.has("Array")) { + return [ "array", args ]; + } + if (expr[1] == "Object" && !args.length && !scope.has("Object")) { + return [ "object", [] ]; + } + if (expr[1] == "String" && !scope.has("String")) { + return [ "binary", "+", args[0], [ "string", "" ]]; + } + } + } + }, function() { + return walk(pro.ast_add_scope(ast)); + }); +}; + +exports.ast_squeeze_more = ast_squeeze_more; +}); +define('uglifyjs/process', ["require", "exports", "module", "./parse-js", "./squeeze-more"], function(require, exports, module) { + +/*********************************************************************** + + A JavaScript tokenizer / parser / beautifier / compressor. + + This version is suitable for Node.js. With minimal changes (the + exports stuff) it should work on any JS platform. + + This file implements some AST processors. They work on data built + by parse-js. + + Exported functions: + + - ast_mangle(ast, options) -- mangles the variable/function names + in the AST. Returns an AST. + + - ast_squeeze(ast) -- employs various optimizations to make the + final generated code even smaller. Returns an AST. + + - gen_code(ast, options) -- generates JS code from the AST. Pass + true (or an object, see the code for some options) as second + argument to get "pretty" (indented) code. + + -------------------------------- (C) --------------------------------- + + Author: Mihai Bazon + <mihai.bazon@gmail.com> + http://mihai.bazon.net/blog + + Distributed under the BSD license: + + Copyright 2010 (c) Mihai Bazon <mihai.bazon@gmail.com> + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + ***********************************************************************/ + +var jsp = require("./parse-js"), + slice = jsp.slice, + member = jsp.member, + is_identifier_char = jsp.is_identifier_char, + PRECEDENCE = jsp.PRECEDENCE, + OPERATORS = jsp.OPERATORS; + +/* -----[ helper for AST traversal ]----- */ + +function ast_walker() { + function _vardefs(defs) { + return [ this[0], MAP(defs, function(def){ + var a = [ def[0] ]; + if (def.length > 1) + a[1] = walk(def[1]); + return a; + }) ]; + }; + function _block(statements) { + var out = [ this[0] ]; + if (statements != null) + out.push(MAP(statements, walk)); + return out; + }; + var walkers = { + "string": function(str) { + return [ this[0], str ]; + }, + "num": function(num) { + return [ this[0], num ]; + }, + "name": function(name) { + return [ this[0], name ]; + }, + "toplevel": function(statements) { + return [ this[0], MAP(statements, walk) ]; + }, + "block": _block, + "splice": _block, + "var": _vardefs, + "const": _vardefs, + "try": function(t, c, f) { + return [ + this[0], + MAP(t, walk), + c != null ? [ c[0], MAP(c[1], walk) ] : null, + f != null ? MAP(f, walk) : null + ]; + }, + "throw": function(expr) { + return [ this[0], walk(expr) ]; + }, + "new": function(ctor, args) { + return [ this[0], walk(ctor), MAP(args, walk) ]; + }, + "switch": function(expr, body) { + return [ this[0], walk(expr), MAP(body, function(branch){ + return [ branch[0] ? walk(branch[0]) : null, + MAP(branch[1], walk) ]; + }) ]; + }, + "break": function(label) { + return [ this[0], label ]; + }, + "continue": function(label) { + return [ this[0], label ]; + }, + "conditional": function(cond, t, e) { + return [ this[0], walk(cond), walk(t), walk(e) ]; + }, + "assign": function(op, lvalue, rvalue) { + return [ this[0], op, walk(lvalue), walk(rvalue) ]; + }, + "dot": function(expr) { + return [ this[0], walk(expr) ].concat(slice(arguments, 1)); + }, + "call": function(expr, args) { + return [ this[0], walk(expr), MAP(args, walk) ]; + }, + "function": function(name, args, body) { + return [ this[0], name, args.slice(), MAP(body, walk) ]; + }, + "debugger": function() { + return [ this[0] ]; + }, + "defun": function(name, args, body) { + return [ this[0], name, args.slice(), MAP(body, walk) ]; + }, + "if": function(conditional, t, e) { + return [ this[0], walk(conditional), walk(t), walk(e) ]; + }, + "for": function(init, cond, step, block) { + return [ this[0], walk(init), walk(cond), walk(step), walk(block) ]; + }, + "for-in": function(vvar, key, hash, block) { + return [ this[0], walk(vvar), walk(key), walk(hash), walk(block) ]; + }, + "while": function(cond, block) { + return [ this[0], walk(cond), walk(block) ]; + }, + "do": function(cond, block) { + return [ this[0], walk(cond), walk(block) ]; + }, + "return": function(expr) { + return [ this[0], walk(expr) ]; + }, + "binary": function(op, left, right) { + return [ this[0], op, walk(left), walk(right) ]; + }, + "unary-prefix": function(op, expr) { + return [ this[0], op, walk(expr) ]; + }, + "unary-postfix": function(op, expr) { + return [ this[0], op, walk(expr) ]; + }, + "sub": function(expr, subscript) { + return [ this[0], walk(expr), walk(subscript) ]; + }, + "object": function(props) { + return [ this[0], MAP(props, function(p){ + return p.length == 2 + ? [ p[0], walk(p[1]) ] + : [ p[0], walk(p[1]), p[2] ]; // get/set-ter + }) ]; + }, + "regexp": function(rx, mods) { + return [ this[0], rx, mods ]; + }, + "array": function(elements) { + return [ this[0], MAP(elements, walk) ]; + }, + "stat": function(stat) { + return [ this[0], walk(stat) ]; + }, + "seq": function() { + return [ this[0] ].concat(MAP(slice(arguments), walk)); + }, + "label": function(name, block) { + return [ this[0], name, walk(block) ]; + }, + "with": function(expr, block) { + return [ this[0], walk(expr), walk(block) ]; + }, + "atom": function(name) { + return [ this[0], name ]; + }, + "directive": function(dir) { + return [ this[0], dir ]; + } + }; + + var user = {}; + var stack = []; + function walk(ast) { + if (ast == null) + return null; + try { + stack.push(ast); + var type = ast[0]; + var gen = user[type]; + if (gen) { + var ret = gen.apply(ast, ast.slice(1)); + if (ret != null) + return ret; + } + gen = walkers[type]; + return gen.apply(ast, ast.slice(1)); + } finally { + stack.pop(); + } + }; + + function dive(ast) { + if (ast == null) + return null; + try { + stack.push(ast); + return walkers[ast[0]].apply(ast, ast.slice(1)); + } finally { + stack.pop(); + } + }; + + function with_walkers(walkers, cont){ + var save = {}, i; + for (i in walkers) if (HOP(walkers, i)) { + save[i] = user[i]; + user[i] = walkers[i]; + } + var ret = cont(); + for (i in save) if (HOP(save, i)) { + if (!save[i]) delete user[i]; + else user[i] = save[i]; + } + return ret; + }; + + return { + walk: walk, + dive: dive, + with_walkers: with_walkers, + parent: function() { + return stack[stack.length - 2]; // last one is current node + }, + stack: function() { + return stack; + } + }; +}; + +/* -----[ Scope and mangling ]----- */ + +function Scope(parent) { + this.names = {}; // names defined in this scope + this.mangled = {}; // mangled names (orig.name => mangled) + this.rev_mangled = {}; // reverse lookup (mangled => orig.name) + this.cname = -1; // current mangled name + this.refs = {}; // names referenced from this scope + this.uses_with = false; // will become TRUE if with() is detected in this or any subscopes + this.uses_eval = false; // will become TRUE if eval() is detected in this or any subscopes + this.directives = []; // directives activated from this scope + this.parent = parent; // parent scope + this.children = []; // sub-scopes + if (parent) { + this.level = parent.level + 1; + parent.children.push(this); + } else { + this.level = 0; + } +}; + +function base54_digits() { + if (typeof DIGITS_OVERRIDE_FOR_TESTING != "undefined") + return DIGITS_OVERRIDE_FOR_TESTING; + else + return "etnrisouaflchpdvmgybwESxTNCkLAOM_DPHBjFIqRUzWXV$JKQGYZ0516372984"; +} + +var base54 = (function(){ + var DIGITS = base54_digits(); + return function(num) { + var ret = "", base = 54; + do { + ret += DIGITS.charAt(num % base); + num = Math.floor(num / base); + base = 64; + } while (num > 0); + return ret; + }; +})(); + +Scope.prototype = { + has: function(name) { + for (var s = this; s; s = s.parent) + if (HOP(s.names, name)) + return s; + }, + has_mangled: function(mname) { + for (var s = this; s; s = s.parent) + if (HOP(s.rev_mangled, mname)) + return s; + }, + toJSON: function() { + return { + names: this.names, + uses_eval: this.uses_eval, + uses_with: this.uses_with + }; + }, + + next_mangled: function() { + // we must be careful that the new mangled name: + // + // 1. doesn't shadow a mangled name from a parent + // scope, unless we don't reference the original + // name from this scope OR from any sub-scopes! + // This will get slow. + // + // 2. doesn't shadow an original name from a parent + // scope, in the event that the name is not mangled + // in the parent scope and we reference that name + // here OR IN ANY SUBSCOPES! + // + // 3. doesn't shadow a name that is referenced but not + // defined (possibly global defined elsewhere). + for (;;) { + var m = base54(++this.cname), prior; + + // case 1. + prior = this.has_mangled(m); + if (prior && this.refs[prior.rev_mangled[m]] === prior) + continue; + + // case 2. + prior = this.has(m); + if (prior && prior !== this && this.refs[m] === prior && !prior.has_mangled(m)) + continue; + + // case 3. + if (HOP(this.refs, m) && this.refs[m] == null) + continue; + + // I got "do" once. :-/ + if (!is_identifier(m)) + continue; + + return m; + } + }, + set_mangle: function(name, m) { + this.rev_mangled[m] = name; + return this.mangled[name] = m; + }, + get_mangled: function(name, newMangle) { + if (this.uses_eval || this.uses_with) return name; // no mangle if eval or with is in use + var s = this.has(name); + if (!s) return name; // not in visible scope, no mangle + if (HOP(s.mangled, name)) return s.mangled[name]; // already mangled in this scope + if (!newMangle) return name; // not found and no mangling requested + return s.set_mangle(name, s.next_mangled()); + }, + references: function(name) { + return name && !this.parent || this.uses_with || this.uses_eval || this.refs[name]; + }, + define: function(name, type) { + if (name != null) { + if (type == "var" || !HOP(this.names, name)) + this.names[name] = type || "var"; + return name; + } + }, + active: function(dir) { + return member(dir, this.directives) || this.parent && this.parent.active(dir); + } +}; + +function ast_add_scope(ast) { + + var current_scope = null; + var w = ast_walker(), walk = w.walk; + var having_eval = []; + + function with_new_scope(cont) { + current_scope = new Scope(current_scope); + current_scope.labels = new Scope(); + var ret = current_scope.body = cont(); + ret.scope = current_scope; + current_scope = current_scope.parent; + return ret; + }; + + function define(name, type) { + return current_scope.define(name, type); + }; + + function reference(name) { + current_scope.refs[name] = true; + }; + + function _lambda(name, args, body) { + var is_defun = this[0] == "defun"; + return [ this[0], is_defun ? define(name, "defun") : name, args, with_new_scope(function(){ + if (!is_defun) define(name, "lambda"); + MAP(args, function(name){ define(name, "arg") }); + return MAP(body, walk); + })]; + }; + + function _vardefs(type) { + return function(defs) { + MAP(defs, function(d){ + define(d[0], type); + if (d[1]) reference(d[0]); + }); + }; + }; + + function _breacont(label) { + if (label) + current_scope.labels.refs[label] = true; + }; + + return with_new_scope(function(){ + // process AST + var ret = w.with_walkers({ + "function": _lambda, + "defun": _lambda, + "label": function(name, stat) { current_scope.labels.define(name) }, + "break": _breacont, + "continue": _breacont, + "with": function(expr, block) { + for (var s = current_scope; s; s = s.parent) + s.uses_with = true; + }, + "var": _vardefs("var"), + "const": _vardefs("const"), + "try": function(t, c, f) { + if (c != null) return [ + this[0], + MAP(t, walk), + [ define(c[0], "catch"), MAP(c[1], walk) ], + f != null ? MAP(f, walk) : null + ]; + }, + "name": function(name) { + if (name == "eval") + having_eval.push(current_scope); + reference(name); + } + }, function(){ + return walk(ast); + }); + + // the reason why we need an additional pass here is + // that names can be used prior to their definition. + + // scopes where eval was detected and their parents + // are marked with uses_eval, unless they define the + // "eval" name. + MAP(having_eval, function(scope){ + if (!scope.has("eval")) while (scope) { + scope.uses_eval = true; + scope = scope.parent; + } + }); + + // for referenced names it might be useful to know + // their origin scope. current_scope here is the + // toplevel one. + function fixrefs(scope, i) { + // do children first; order shouldn't matter + for (i = scope.children.length; --i >= 0;) + fixrefs(scope.children[i]); + for (i in scope.refs) if (HOP(scope.refs, i)) { + // find origin scope and propagate the reference to origin + for (var origin = scope.has(i), s = scope; s; s = s.parent) { + s.refs[i] = origin; + if (s === origin) break; + } + } + }; + fixrefs(current_scope); + + return ret; + }); + +}; + +/* -----[ mangle names ]----- */ + +function ast_mangle(ast, options) { + var w = ast_walker(), walk = w.walk, scope; + options = defaults(options, { + mangle : true, + toplevel : false, + defines : null, + except : null, + no_functions : false + }); + + function get_mangled(name, newMangle) { + if (!options.mangle) return name; + if (!options.toplevel && !scope.parent) return name; // don't mangle toplevel + if (options.except && member(name, options.except)) + return name; + if (options.no_functions && HOP(scope.names, name) && + (scope.names[name] == 'defun' || scope.names[name] == 'lambda')) + return name; + return scope.get_mangled(name, newMangle); + }; + + function get_define(name) { + if (options.defines) { + // we always lookup a defined symbol for the current scope FIRST, so declared + // vars trump a DEFINE symbol, but if no such var is found, then match a DEFINE value + if (!scope.has(name)) { + if (HOP(options.defines, name)) { + return options.defines[name]; + } + } + return null; + } + }; + + function _lambda(name, args, body) { + if (!options.no_functions && options.mangle) { + var is_defun = this[0] == "defun", extra; + if (name) { + if (is_defun) name = get_mangled(name); + else if (body.scope.references(name)) { + extra = {}; + if (!(scope.uses_eval || scope.uses_with)) + name = extra[name] = scope.next_mangled(); + else + extra[name] = name; + } + else name = null; + } + } + body = with_scope(body.scope, function(){ + args = MAP(args, function(name){ return get_mangled(name) }); + return MAP(body, walk); + }, extra); + return [ this[0], name, args, body ]; + }; + + function with_scope(s, cont, extra) { + var _scope = scope; + scope = s; + if (extra) for (var i in extra) if (HOP(extra, i)) { + s.set_mangle(i, extra[i]); + } + for (var i in s.names) if (HOP(s.names, i)) { + get_mangled(i, true); + } + var ret = cont(); + ret.scope = s; + scope = _scope; + return ret; + }; + + function _vardefs(defs) { + return [ this[0], MAP(defs, function(d){ + return [ get_mangled(d[0]), walk(d[1]) ]; + }) ]; + }; + + function _breacont(label) { + if (label) return [ this[0], scope.labels.get_mangled(label) ]; + }; + + return w.with_walkers({ + "function": _lambda, + "defun": function() { + // move function declarations to the top when + // they are not in some block. + var ast = _lambda.apply(this, arguments); + switch (w.parent()[0]) { + case "toplevel": + case "function": + case "defun": + return MAP.at_top(ast); + } + return ast; + }, + "label": function(label, stat) { + if (scope.labels.refs[label]) return [ + this[0], + scope.labels.get_mangled(label, true), + walk(stat) + ]; + return walk(stat); + }, + "break": _breacont, + "continue": _breacont, + "var": _vardefs, + "const": _vardefs, + "name": function(name) { + return get_define(name) || [ this[0], get_mangled(name) ]; + }, + "try": function(t, c, f) { + return [ this[0], + MAP(t, walk), + c != null ? [ get_mangled(c[0]), MAP(c[1], walk) ] : null, + f != null ? MAP(f, walk) : null ]; + }, + "toplevel": function(body) { + var self = this; + return with_scope(self.scope, function(){ + return [ self[0], MAP(body, walk) ]; + }); + }, + "directive": function() { + return MAP.at_top(this); + } + }, function() { + return walk(ast_add_scope(ast)); + }); +}; + +/* -----[ + - compress foo["bar"] into foo.bar, + - remove block brackets {} where possible + - join consecutive var declarations + - various optimizations for IFs: + - if (cond) foo(); else bar(); ==> cond?foo():bar(); + - if (cond) foo(); ==> cond&&foo(); + - if (foo) return bar(); else return baz(); ==> return foo?bar():baz(); // also for throw + - if (foo) return bar(); else something(); ==> {if(foo)return bar();something()} + ]----- */ + +var warn = function(){}; + +function best_of(ast1, ast2) { + return gen_code(ast1).length > gen_code(ast2[0] == "stat" ? ast2[1] : ast2).length ? ast2 : ast1; +}; + +function last_stat(b) { + if (b[0] == "block" && b[1] && b[1].length > 0) + return b[1][b[1].length - 1]; + return b; +} + +function aborts(t) { + if (t) switch (last_stat(t)[0]) { + case "return": + case "break": + case "continue": + case "throw": + return true; + } +}; + +function boolean_expr(expr) { + return ( (expr[0] == "unary-prefix" + && member(expr[1], [ "!", "delete" ])) || + + (expr[0] == "binary" + && member(expr[1], [ "in", "instanceof", "==", "!=", "===", "!==", "<", "<=", ">=", ">" ])) || + + (expr[0] == "binary" + && member(expr[1], [ "&&", "||" ]) + && boolean_expr(expr[2]) + && boolean_expr(expr[3])) || + + (expr[0] == "conditional" + && boolean_expr(expr[2]) + && boolean_expr(expr[3])) || + + (expr[0] == "assign" + && expr[1] === true + && boolean_expr(expr[3])) || + + (expr[0] == "seq" + && boolean_expr(expr[expr.length - 1])) + ); +}; + +function empty(b) { + return !b || (b[0] == "block" && (!b[1] || b[1].length == 0)); +}; + +function is_string(node) { + return (node[0] == "string" || + node[0] == "unary-prefix" && node[1] == "typeof" || + node[0] == "binary" && node[1] == "+" && + (is_string(node[2]) || is_string(node[3]))); +}; + +var when_constant = (function(){ + + var $NOT_CONSTANT = {}; + + // this can only evaluate constant expressions. If it finds anything + // not constant, it throws $NOT_CONSTANT. + function evaluate(expr) { + switch (expr[0]) { + case "string": + case "num": + return expr[1]; + case "name": + case "atom": + switch (expr[1]) { + case "true": return true; + case "false": return false; + case "null": return null; + } + break; + case "unary-prefix": + switch (expr[1]) { + case "!": return !evaluate(expr[2]); + case "typeof": return typeof evaluate(expr[2]); + case "~": return ~evaluate(expr[2]); + case "-": return -evaluate(expr[2]); + case "+": return +evaluate(expr[2]); + } + break; + case "binary": + var left = expr[2], right = expr[3]; + switch (expr[1]) { + case "&&" : return evaluate(left) && evaluate(right); + case "||" : return evaluate(left) || evaluate(right); + case "|" : return evaluate(left) | evaluate(right); + case "&" : return evaluate(left) & evaluate(right); + case "^" : return evaluate(left) ^ evaluate(right); + case "+" : return evaluate(left) + evaluate(right); + case "*" : return evaluate(left) * evaluate(right); + case "/" : return evaluate(left) / evaluate(right); + case "%" : return evaluate(left) % evaluate(right); + case "-" : return evaluate(left) - evaluate(right); + case "<<" : return evaluate(left) << evaluate(right); + case ">>" : return evaluate(left) >> evaluate(right); + case ">>>" : return evaluate(left) >>> evaluate(right); + case "==" : return evaluate(left) == evaluate(right); + case "===" : return evaluate(left) === evaluate(right); + case "!=" : return evaluate(left) != evaluate(right); + case "!==" : return evaluate(left) !== evaluate(right); + case "<" : return evaluate(left) < evaluate(right); + case "<=" : return evaluate(left) <= evaluate(right); + case ">" : return evaluate(left) > evaluate(right); + case ">=" : return evaluate(left) >= evaluate(right); + case "in" : return evaluate(left) in evaluate(right); + case "instanceof" : return evaluate(left) instanceof evaluate(right); + } + } + throw $NOT_CONSTANT; + }; + + return function(expr, yes, no) { + try { + var val = evaluate(expr), ast; + switch (typeof val) { + case "string": ast = [ "string", val ]; break; + case "number": ast = [ "num", val ]; break; + case "boolean": ast = [ "name", String(val) ]; break; + default: + if (val === null) { ast = [ "atom", "null" ]; break; } + throw new Error("Can't handle constant of type: " + (typeof val)); + } + return yes.call(expr, ast, val); + } catch(ex) { + if (ex === $NOT_CONSTANT) { + if (expr[0] == "binary" + && (expr[1] == "===" || expr[1] == "!==") + && ((is_string(expr[2]) && is_string(expr[3])) + || (boolean_expr(expr[2]) && boolean_expr(expr[3])))) { + expr[1] = expr[1].substr(0, 2); + } + else if (no && expr[0] == "binary" + && (expr[1] == "||" || expr[1] == "&&")) { + // the whole expression is not constant but the lval may be... + try { + var lval = evaluate(expr[2]); + expr = ((expr[1] == "&&" && (lval ? expr[3] : lval)) || + (expr[1] == "||" && (lval ? lval : expr[3])) || + expr); + } catch(ex2) { + // IGNORE... lval is not constant + } + } + return no ? no.call(expr, expr) : null; + } + else throw ex; + } + }; + +})(); + +function warn_unreachable(ast) { + if (!empty(ast)) + warn("Dropping unreachable code: " + gen_code(ast, true)); +}; + +function prepare_ifs(ast) { + var w = ast_walker(), walk = w.walk; + // In this first pass, we rewrite ifs which abort with no else with an + // if-else. For example: + // + // if (x) { + // blah(); + // return y; + // } + // foobar(); + // + // is rewritten into: + // + // if (x) { + // blah(); + // return y; + // } else { + // foobar(); + // } + function redo_if(statements) { + statements = MAP(statements, walk); + + for (var i = 0; i < statements.length; ++i) { + var fi = statements[i]; + if (fi[0] != "if") continue; + + if (fi[3] && walk(fi[3])) continue; + + var t = walk(fi[2]); + if (!aborts(t)) continue; + + var conditional = walk(fi[1]); + + var e_body = redo_if(statements.slice(i + 1)); + var e = e_body.length == 1 ? e_body[0] : [ "block", e_body ]; + + return statements.slice(0, i).concat([ [ + fi[0], // "if" + conditional, // conditional + t, // then + e // else + ] ]); + } + + return statements; + }; + + function redo_if_lambda(name, args, body) { + body = redo_if(body); + return [ this[0], name, args, body ]; + }; + + function redo_if_block(statements) { + return [ this[0], statements != null ? redo_if(statements) : null ]; + }; + + return w.with_walkers({ + "defun": redo_if_lambda, + "function": redo_if_lambda, + "block": redo_if_block, + "splice": redo_if_block, + "toplevel": function(statements) { + return [ this[0], redo_if(statements) ]; + }, + "try": function(t, c, f) { + return [ + this[0], + redo_if(t), + c != null ? [ c[0], redo_if(c[1]) ] : null, + f != null ? redo_if(f) : null + ]; + } + }, function() { + return walk(ast); + }); +}; + +function for_side_effects(ast, handler) { + var w = ast_walker(), walk = w.walk; + var $stop = {}, $restart = {}; + function stop() { throw $stop }; + function restart() { throw $restart }; + function found(){ return handler.call(this, this, w, stop, restart) }; + function unary(op) { + if (op == "++" || op == "--") + return found.apply(this, arguments); + }; + return w.with_walkers({ + "try": found, + "throw": found, + "return": found, + "new": found, + "switch": found, + "break": found, + "continue": found, + "assign": found, + "call": found, + "if": found, + "for": found, + "for-in": found, + "while": found, + "do": found, + "return": found, + "unary-prefix": unary, + "unary-postfix": unary, + "defun": found + }, function(){ + while (true) try { + walk(ast); + break; + } catch(ex) { + if (ex === $stop) break; + if (ex === $restart) continue; + throw ex; + } + }); +}; + +function ast_lift_variables(ast) { + var w = ast_walker(), walk = w.walk, scope; + function do_body(body, env) { + var _scope = scope; + scope = env; + body = MAP(body, walk); + var hash = {}, names = MAP(env.names, function(type, name){ + if (type != "var") return MAP.skip; + if (!env.references(name)) return MAP.skip; + hash[name] = true; + return [ name ]; + }); + if (names.length > 0) { + // looking for assignments to any of these variables. + // we can save considerable space by moving the definitions + // in the var declaration. + for_side_effects([ "block", body ], function(ast, walker, stop, restart) { + if (ast[0] == "assign" + && ast[1] === true + && ast[2][0] == "name" + && HOP(hash, ast[2][1])) { + // insert the definition into the var declaration + for (var i = names.length; --i >= 0;) { + if (names[i][0] == ast[2][1]) { + if (names[i][1]) // this name already defined, we must stop + stop(); + names[i][1] = ast[3]; // definition + names.push(names.splice(i, 1)[0]); + break; + } + } + // remove this assignment from the AST. + var p = walker.parent(); + if (p[0] == "seq") { + var a = p[2]; + a.unshift(0, p.length); + p.splice.apply(p, a); + } + else if (p[0] == "stat") { + p.splice(0, p.length, "block"); // empty statement + } + else { + stop(); + } + restart(); + } + stop(); + }); + body.unshift([ "var", names ]); + } + scope = _scope; + return body; + }; + function _vardefs(defs) { + var ret = null; + for (var i = defs.length; --i >= 0;) { + var d = defs[i]; + if (!d[1]) continue; + d = [ "assign", true, [ "name", d[0] ], d[1] ]; + if (ret == null) ret = d; + else ret = [ "seq", d, ret ]; + } + if (ret == null) { + if (w.parent()[0] == "for-in") + return [ "name", defs[0][0] ]; + return MAP.skip; + } + return [ "stat", ret ]; + }; + function _toplevel(body) { + return [ this[0], do_body(body, this.scope) ]; + }; + return w.with_walkers({ + "function": function(name, args, body){ + for (var i = args.length; --i >= 0 && !body.scope.references(args[i]);) + args.pop(); + if (!body.scope.references(name)) name = null; + return [ this[0], name, args, do_body(body, body.scope) ]; + }, + "defun": function(name, args, body){ + if (!scope.references(name)) return MAP.skip; + for (var i = args.length; --i >= 0 && !body.scope.references(args[i]);) + args.pop(); + return [ this[0], name, args, do_body(body, body.scope) ]; + }, + "var": _vardefs, + "toplevel": _toplevel + }, function(){ + return walk(ast_add_scope(ast)); + }); +}; + +function ast_squeeze(ast, options) { + options = defaults(options, { + make_seqs : true, + dead_code : true, + no_warnings : false, + keep_comps : true, + unsafe : false + }); + + var w = ast_walker(), walk = w.walk, scope; + + function negate(c) { + var not_c = [ "unary-prefix", "!", c ]; + switch (c[0]) { + case "unary-prefix": + return c[1] == "!" && boolean_expr(c[2]) ? c[2] : not_c; + case "seq": + c = slice(c); + c[c.length - 1] = negate(c[c.length - 1]); + return c; + case "conditional": + return best_of(not_c, [ "conditional", c[1], negate(c[2]), negate(c[3]) ]); + case "binary": + var op = c[1], left = c[2], right = c[3]; + if (!options.keep_comps) switch (op) { + case "<=" : return [ "binary", ">", left, right ]; + case "<" : return [ "binary", ">=", left, right ]; + case ">=" : return [ "binary", "<", left, right ]; + case ">" : return [ "binary", "<=", left, right ]; + } + switch (op) { + case "==" : return [ "binary", "!=", left, right ]; + case "!=" : return [ "binary", "==", left, right ]; + case "===" : return [ "binary", "!==", left, right ]; + case "!==" : return [ "binary", "===", left, right ]; + case "&&" : return best_of(not_c, [ "binary", "||", negate(left), negate(right) ]); + case "||" : return best_of(not_c, [ "binary", "&&", negate(left), negate(right) ]); + } + break; + } + return not_c; + }; + + function make_conditional(c, t, e) { + var make_real_conditional = function() { + if (c[0] == "unary-prefix" && c[1] == "!") { + return e ? [ "conditional", c[2], e, t ] : [ "binary", "||", c[2], t ]; + } else { + return e ? best_of( + [ "conditional", c, t, e ], + [ "conditional", negate(c), e, t ] + ) : [ "binary", "&&", c, t ]; + } + }; + // shortcut the conditional if the expression has a constant value + return when_constant(c, function(ast, val){ + warn_unreachable(val ? e : t); + return (val ? t : e); + }, make_real_conditional); + }; + + function rmblock(block) { + if (block != null && block[0] == "block" && block[1]) { + if (block[1].length == 1) + block = block[1][0]; + else if (block[1].length == 0) + block = [ "block" ]; + } + return block; + }; + + function _lambda(name, args, body) { + return [ this[0], name, args, with_scope(body.scope, function() { + return tighten(body, "lambda"); + }) ]; + }; + + function with_scope(s, cont) { + var _scope = scope; + scope = s; + var ret = cont(); + scope = _scope; + return ret; + }; + + // this function does a few things: + // 1. discard useless blocks + // 2. join consecutive var declarations + // 3. remove obviously dead code + // 4. transform consecutive statements using the comma operator + // 5. if block_type == "lambda" and it detects constructs like if(foo) return ... - rewrite like if (!foo) { ... } + function tighten(statements, block_type) { + statements = MAP(statements, walk); + + statements = statements.reduce(function(a, stat){ + if (stat[0] == "block") { + if (stat[1]) { + a.push.apply(a, stat[1]); + } + } else { + a.push(stat); + } + return a; + }, []); + + statements = (function(a, prev){ + statements.forEach(function(cur){ + if (prev && ((cur[0] == "var" && prev[0] == "var") || + (cur[0] == "const" && prev[0] == "const"))) { + prev[1] = prev[1].concat(cur[1]); + } else { + a.push(cur); + prev = cur; + } + }); + return a; + })([]); + + if (options.dead_code) statements = (function(a, has_quit){ + statements.forEach(function(st){ + if (has_quit) { + if (st[0] == "function" || st[0] == "defun") { + a.push(st); + } + else if (st[0] == "var" || st[0] == "const") { + if (!options.no_warnings) + warn("Variables declared in unreachable code"); + st[1] = MAP(st[1], function(def){ + if (def[1] && !options.no_warnings) + warn_unreachable([ "assign", true, [ "name", def[0] ], def[1] ]); + return [ def[0] ]; + }); + a.push(st); + } + else if (!options.no_warnings) + warn_unreachable(st); + } + else { + a.push(st); + if (member(st[0], [ "return", "throw", "break", "continue" ])) + has_quit = true; + } + }); + return a; + })([]); + + if (options.make_seqs) statements = (function(a, prev) { + statements.forEach(function(cur){ + if (prev && prev[0] == "stat" && cur[0] == "stat") { + prev[1] = [ "seq", prev[1], cur[1] ]; + } else { + a.push(cur); + prev = cur; + } + }); + if (a.length >= 2 + && a[a.length-2][0] == "stat" + && (a[a.length-1][0] == "return" || a[a.length-1][0] == "throw") + && a[a.length-1][1]) + { + a.splice(a.length - 2, 2, + [ a[a.length-1][0], + [ "seq", a[a.length-2][1], a[a.length-1][1] ]]); + } + return a; + })([]); + + // this increases jQuery by 1K. Probably not such a good idea after all.. + // part of this is done in prepare_ifs anyway. + // if (block_type == "lambda") statements = (function(i, a, stat){ + // while (i < statements.length) { + // stat = statements[i++]; + // if (stat[0] == "if" && !stat[3]) { + // if (stat[2][0] == "return" && stat[2][1] == null) { + // a.push(make_if(negate(stat[1]), [ "block", statements.slice(i) ])); + // break; + // } + // var last = last_stat(stat[2]); + // if (last[0] == "return" && last[1] == null) { + // a.push(make_if(stat[1], [ "block", stat[2][1].slice(0, -1) ], [ "block", statements.slice(i) ])); + // break; + // } + // } + // a.push(stat); + // } + // return a; + // })(0, []); + + return statements; + }; + + function make_if(c, t, e) { + return when_constant(c, function(ast, val){ + if (val) { + t = walk(t); + warn_unreachable(e); + return t || [ "block" ]; + } else { + e = walk(e); + warn_unreachable(t); + return e || [ "block" ]; + } + }, function() { + return make_real_if(c, t, e); + }); + }; + + function abort_else(c, t, e) { + var ret = [ [ "if", negate(c), e ] ]; + if (t[0] == "block") { + if (t[1]) ret = ret.concat(t[1]); + } else { + ret.push(t); + } + return walk([ "block", ret ]); + }; + + function make_real_if(c, t, e) { + c = walk(c); + t = walk(t); + e = walk(e); + + if (empty(e) && empty(t)) + return [ "stat", c ]; + + if (empty(t)) { + c = negate(c); + t = e; + e = null; + } else if (empty(e)) { + e = null; + } else { + // if we have both else and then, maybe it makes sense to switch them? + (function(){ + var a = gen_code(c); + var n = negate(c); + var b = gen_code(n); + if (b.length < a.length) { + var tmp = t; + t = e; + e = tmp; + c = n; + } + })(); + } + var ret = [ "if", c, t, e ]; + if (t[0] == "if" && empty(t[3]) && empty(e)) { + ret = best_of(ret, walk([ "if", [ "binary", "&&", c, t[1] ], t[2] ])); + } + else if (t[0] == "stat") { + if (e) { + if (e[0] == "stat") + ret = best_of(ret, [ "stat", make_conditional(c, t[1], e[1]) ]); + else if (aborts(e)) + ret = abort_else(c, t, e); + } + else { + ret = best_of(ret, [ "stat", make_conditional(c, t[1]) ]); + } + } + else if (e && t[0] == e[0] && (t[0] == "return" || t[0] == "throw") && t[1] && e[1]) { + ret = best_of(ret, [ t[0], make_conditional(c, t[1], e[1] ) ]); + } + else if (e && aborts(t)) { + ret = [ [ "if", c, t ] ]; + if (e[0] == "block") { + if (e[1]) ret = ret.concat(e[1]); + } + else { + ret.push(e); + } + ret = walk([ "block", ret ]); + } + else if (t && aborts(e)) { + ret = abort_else(c, t, e); + } + return ret; + }; + + function _do_while(cond, body) { + return when_constant(cond, function(cond, val){ + if (!val) { + warn_unreachable(body); + return [ "block" ]; + } else { + return [ "for", null, null, null, walk(body) ]; + } + }); + }; + + return w.with_walkers({ + "sub": function(expr, subscript) { + if (subscript[0] == "string") { + var name = subscript[1]; + if (is_identifier(name)) + return [ "dot", walk(expr), name ]; + else if (/^[1-9][0-9]*$/.test(name) || name === "0") + return [ "sub", walk(expr), [ "num", parseInt(name, 10) ] ]; + } + }, + "if": make_if, + "toplevel": function(body) { + return with_scope(this.scope, function() { + return [ "toplevel", tighten(body) ]; + }); + }, + "switch": function(expr, body) { + var last = body.length - 1; + return [ "switch", walk(expr), MAP(body, function(branch, i){ + var block = tighten(branch[1]); + if (i == last && block.length > 0) { + var node = block[block.length - 1]; + if (node[0] == "break" && !node[1]) + block.pop(); + } + return [ branch[0] ? walk(branch[0]) : null, block ]; + }) ]; + }, + "function": _lambda, + "defun": _lambda, + "block": function(body) { + if (body) return rmblock([ "block", tighten(body) ]); + }, + "binary": function(op, left, right) { + return when_constant([ "binary", op, walk(left), walk(right) ], function yes(c){ + return best_of(walk(c), this); + }, function no() { + return function(){ + if(op != "==" && op != "!=") return; + var l = walk(left), r = walk(right); + if(l && l[0] == "unary-prefix" && l[1] == "!" && l[2][0] == "num") + left = ['num', +!l[2][1]]; + else if (r && r[0] == "unary-prefix" && r[1] == "!" && r[2][0] == "num") + right = ['num', +!r[2][1]]; + return ["binary", op, left, right]; + }() || this; + }); + }, + "conditional": function(c, t, e) { + return make_conditional(walk(c), walk(t), walk(e)); + }, + "try": function(t, c, f) { + return [ + "try", + tighten(t), + c != null ? [ c[0], tighten(c[1]) ] : null, + f != null ? tighten(f) : null + ]; + }, + "unary-prefix": function(op, expr) { + expr = walk(expr); + var ret = [ "unary-prefix", op, expr ]; + if (op == "!") + ret = best_of(ret, negate(expr)); + return when_constant(ret, function(ast, val){ + return walk(ast); // it's either true or false, so minifies to !0 or !1 + }, function() { return ret }); + }, + "name": function(name) { + switch (name) { + case "true": return [ "unary-prefix", "!", [ "num", 0 ]]; + case "false": return [ "unary-prefix", "!", [ "num", 1 ]]; + } + }, + "while": _do_while, + "assign": function(op, lvalue, rvalue) { + lvalue = walk(lvalue); + rvalue = walk(rvalue); + var okOps = [ '+', '-', '/', '*', '%', '>>', '<<', '>>>', '|', '^', '&' ]; + if (op === true && lvalue[0] === "name" && rvalue[0] === "binary" && + ~okOps.indexOf(rvalue[1]) && rvalue[2][0] === "name" && + rvalue[2][1] === lvalue[1]) { + return [ this[0], rvalue[1], lvalue, rvalue[3] ] + } + return [ this[0], op, lvalue, rvalue ]; + }, + "directive": function(dir) { + if (scope.active(dir)) + return [ "block" ]; + scope.directives.push(dir); + return [ this[0], dir ]; + }, + "call": function(expr, args) { + expr = walk(expr); + if (options.unsafe && expr[0] == "dot" && expr[1][0] == "string" && expr[2] == "toString") { + return expr[1]; + } + return [ this[0], expr, MAP(args, walk) ]; + }, + "num": function (num) { + if (!isFinite(num)) + return [ "binary", "/", num === 1 / 0 + ? [ "num", 1 ] : num === -1 / 0 + ? [ "unary-prefix", "-", [ "num", 1 ] ] + : [ "num", 0 ], [ "num", 0 ] ]; + + return [ this[0], num ]; + } + }, function() { + for (var i = 0; i < 2; ++i) { + ast = prepare_ifs(ast); + ast = walk(ast_add_scope(ast)); + } + return ast; + }); +}; + +/* -----[ re-generate code from the AST ]----- */ + +var DOT_CALL_NO_PARENS = jsp.array_to_hash([ + "name", + "array", + "object", + "string", + "dot", + "sub", + "call", + "regexp", + "defun" +]); + +function make_string(str, ascii_only) { + var dq = 0, sq = 0; + str = str.replace(/[\\\b\f\n\r\t\x22\x27\u2028\u2029\0]/g, function(s){ + switch (s) { + case "\\": return "\\\\"; + case "\b": return "\\b"; + case "\f": return "\\f"; + case "\n": return "\\n"; + case "\r": return "\\r"; + case "\u2028": return "\\u2028"; + case "\u2029": return "\\u2029"; + case '"': ++dq; return '"'; + case "'": ++sq; return "'"; + case "\0": return "\\0"; + } + return s; + }); + if (ascii_only) str = to_ascii(str); + if (dq > sq) return "'" + str.replace(/\x27/g, "\\'") + "'"; + else return '"' + str.replace(/\x22/g, '\\"') + '"'; +}; + +function to_ascii(str) { + return str.replace(/[\u0080-\uffff]/g, function(ch) { + var code = ch.charCodeAt(0).toString(16); + while (code.length < 4) code = "0" + code; + return "\\u" + code; + }); +}; + +var SPLICE_NEEDS_BRACKETS = jsp.array_to_hash([ "if", "while", "do", "for", "for-in", "with" ]); + +function gen_code(ast, options) { + options = defaults(options, { + indent_start : 0, + indent_level : 4, + quote_keys : false, + space_colon : false, + beautify : false, + ascii_only : false, + inline_script: false + }); + var beautify = !!options.beautify; + var indentation = 0, + newline = beautify ? "\n" : "", + space = beautify ? " " : ""; + + function encode_string(str) { + var ret = make_string(str, options.ascii_only); + if (options.inline_script) + ret = ret.replace(/<\x2fscript([>\/\t\n\f\r ])/gi, "<\\/script$1"); + return ret; + }; + + function make_name(name) { + name = name.toString(); + if (options.ascii_only) + name = to_ascii(name); + return name; + }; + + function indent(line) { + if (line == null) + line = ""; + if (beautify) + line = repeat_string(" ", options.indent_start + indentation * options.indent_level) + line; + return line; + }; + + function with_indent(cont, incr) { + if (incr == null) incr = 1; + indentation += incr; + try { return cont.apply(null, slice(arguments, 1)); } + finally { indentation -= incr; } + }; + + function last_char(str) { + str = str.toString(); + return str.charAt(str.length - 1); + }; + + function first_char(str) { + return str.toString().charAt(0); + }; + + function add_spaces(a) { + if (beautify) + return a.join(" "); + var b = []; + for (var i = 0; i < a.length; ++i) { + var next = a[i + 1]; + b.push(a[i]); + if (next && + ((is_identifier_char(last_char(a[i])) && (is_identifier_char(first_char(next)) + || first_char(next) == "\\")) || + (/[\+\-]$/.test(a[i].toString()) && /^[\+\-]/.test(next.toString())))) { + b.push(" "); + } + } + return b.join(""); + }; + + function add_commas(a) { + return a.join("," + space); + }; + + function parenthesize(expr) { + var gen = make(expr); + for (var i = 1; i < arguments.length; ++i) { + var el = arguments[i]; + if ((el instanceof Function && el(expr)) || expr[0] == el) + return "(" + gen + ")"; + } + return gen; + }; + + function best_of(a) { + if (a.length == 1) { + return a[0]; + } + if (a.length == 2) { + var b = a[1]; + a = a[0]; + return a.length <= b.length ? a : b; + } + return best_of([ a[0], best_of(a.slice(1)) ]); + }; + + function needs_parens(expr) { + if (expr[0] == "function" || expr[0] == "object") { + // dot/call on a literal function requires the + // function literal itself to be parenthesized + // only if it's the first "thing" in a + // statement. This means that the parent is + // "stat", but it could also be a "seq" and + // we're the first in this "seq" and the + // parent is "stat", and so on. Messy stuff, + // but it worths the trouble. + var a = slice(w.stack()), self = a.pop(), p = a.pop(); + while (p) { + if (p[0] == "stat") return true; + if (((p[0] == "seq" || p[0] == "call" || p[0] == "dot" || p[0] == "sub" || p[0] == "conditional") && p[1] === self) || + ((p[0] == "binary" || p[0] == "assign" || p[0] == "unary-postfix") && p[2] === self)) { + self = p; + p = a.pop(); + } else { + return false; + } + } + } + return !HOP(DOT_CALL_NO_PARENS, expr[0]); + }; + + function make_num(num) { + var str = num.toString(10), a = [ str.replace(/^0\./, ".").replace('e+', 'e') ], m; + if (Math.floor(num) === num) { + if (num >= 0) { + a.push("0x" + num.toString(16).toLowerCase(), // probably pointless + "0" + num.toString(8)); // same. + } else { + a.push("-0x" + (-num).toString(16).toLowerCase(), // probably pointless + "-0" + (-num).toString(8)); // same. + } + if ((m = /^(.*?)(0+)$/.exec(num))) { + a.push(m[1] + "e" + m[2].length); + } + } else if ((m = /^0?\.(0+)(.*)$/.exec(num))) { + a.push(m[2] + "e-" + (m[1].length + m[2].length), + str.substr(str.indexOf("."))); + } + return best_of(a); + }; + + var w = ast_walker(); + var make = w.walk; + return w.with_walkers({ + "string": encode_string, + "num": make_num, + "name": make_name, + "debugger": function(){ return "debugger;" }, + "toplevel": function(statements) { + return make_block_statements(statements) + .join(newline + newline); + }, + "splice": function(statements) { + var parent = w.parent(); + if (HOP(SPLICE_NEEDS_BRACKETS, parent)) { + // we need block brackets in this case + return make_block.apply(this, arguments); + } else { + return MAP(make_block_statements(statements, true), + function(line, i) { + // the first line is already indented + return i > 0 ? indent(line) : line; + }).join(newline); + } + }, + "block": make_block, + "var": function(defs) { + return "var " + add_commas(MAP(defs, make_1vardef)) + ";"; + }, + "const": function(defs) { + return "const " + add_commas(MAP(defs, make_1vardef)) + ";"; + }, + "try": function(tr, ca, fi) { + var out = [ "try", make_block(tr) ]; + if (ca) out.push("catch", "(" + ca[0] + ")", make_block(ca[1])); + if (fi) out.push("finally", make_block(fi)); + return add_spaces(out); + }, + "throw": function(expr) { + return add_spaces([ "throw", make(expr) ]) + ";"; + }, + "new": function(ctor, args) { + args = args.length > 0 ? "(" + add_commas(MAP(args, function(expr){ + return parenthesize(expr, "seq"); + })) + ")" : ""; + return add_spaces([ "new", parenthesize(ctor, "seq", "binary", "conditional", "assign", function(expr){ + var w = ast_walker(), has_call = {}; + try { + w.with_walkers({ + "call": function() { throw has_call }, + "function": function() { return this } + }, function(){ + w.walk(expr); + }); + } catch(ex) { + if (ex === has_call) + return true; + throw ex; + } + }) + args ]); + }, + "switch": function(expr, body) { + return add_spaces([ "switch", "(" + make(expr) + ")", make_switch_block(body) ]); + }, + "break": function(label) { + var out = "break"; + if (label != null) + out += " " + make_name(label); + return out + ";"; + }, + "continue": function(label) { + var out = "continue"; + if (label != null) + out += " " + make_name(label); + return out + ";"; + }, + "conditional": function(co, th, el) { + return add_spaces([ parenthesize(co, "assign", "seq", "conditional"), "?", + parenthesize(th, "seq"), ":", + parenthesize(el, "seq") ]); + }, + "assign": function(op, lvalue, rvalue) { + if (op && op !== true) op += "="; + else op = "="; + return add_spaces([ make(lvalue), op, parenthesize(rvalue, "seq") ]); + }, + "dot": function(expr) { + var out = make(expr), i = 1; + if (expr[0] == "num") { + if (!/[a-f.]/i.test(out)) + out += "."; + } else if (expr[0] != "function" && needs_parens(expr)) + out = "(" + out + ")"; + while (i < arguments.length) + out += "." + make_name(arguments[i++]); + return out; + }, + "call": function(func, args) { + var f = make(func); + if (f.charAt(0) != "(" && needs_parens(func)) + f = "(" + f + ")"; + return f + "(" + add_commas(MAP(args, function(expr){ + return parenthesize(expr, "seq"); + })) + ")"; + }, + "function": make_function, + "defun": make_function, + "if": function(co, th, el) { + var out = [ "if", "(" + make(co) + ")", el ? make_then(th) : make(th) ]; + if (el) { + out.push("else", make(el)); + } + return add_spaces(out); + }, + "for": function(init, cond, step, block) { + var out = [ "for" ]; + init = (init != null ? make(init) : "").replace(/;*\s*$/, ";" + space); + cond = (cond != null ? make(cond) : "").replace(/;*\s*$/, ";" + space); + step = (step != null ? make(step) : "").replace(/;*\s*$/, ""); + var args = init + cond + step; + if (args == "; ; ") args = ";;"; + out.push("(" + args + ")", make(block)); + return add_spaces(out); + }, + "for-in": function(vvar, key, hash, block) { + return add_spaces([ "for", "(" + + (vvar ? make(vvar).replace(/;+$/, "") : make(key)), + "in", + make(hash) + ")", make(block) ]); + }, + "while": function(condition, block) { + return add_spaces([ "while", "(" + make(condition) + ")", make(block) ]); + }, + "do": function(condition, block) { + return add_spaces([ "do", make(block), "while", "(" + make(condition) + ")" ]) + ";"; + }, + "return": function(expr) { + var out = [ "return" ]; + if (expr != null) out.push(make(expr)); + return add_spaces(out) + ";"; + }, + "binary": function(operator, lvalue, rvalue) { + var left = make(lvalue), right = make(rvalue); + // XXX: I'm pretty sure other cases will bite here. + // we need to be smarter. + // adding parens all the time is the safest bet. + if (member(lvalue[0], [ "assign", "conditional", "seq" ]) || + lvalue[0] == "binary" && PRECEDENCE[operator] > PRECEDENCE[lvalue[1]] || + lvalue[0] == "function" && needs_parens(this)) { + left = "(" + left + ")"; + } + if (member(rvalue[0], [ "assign", "conditional", "seq" ]) || + rvalue[0] == "binary" && PRECEDENCE[operator] >= PRECEDENCE[rvalue[1]] && + !(rvalue[1] == operator && member(operator, [ "&&", "||", "*" ]))) { + right = "(" + right + ")"; + } + else if (!beautify && options.inline_script && (operator == "<" || operator == "<<") + && rvalue[0] == "regexp" && /^script/i.test(rvalue[1])) { + right = " " + right; + } + return add_spaces([ left, operator, right ]); + }, + "unary-prefix": function(operator, expr) { + var val = make(expr); + if (!(expr[0] == "num" || (expr[0] == "unary-prefix" && !HOP(OPERATORS, operator + expr[1])) || !needs_parens(expr))) + val = "(" + val + ")"; + return operator + (jsp.is_alphanumeric_char(operator.charAt(0)) ? " " : "") + val; + }, + "unary-postfix": function(operator, expr) { + var val = make(expr); + if (!(expr[0] == "num" || (expr[0] == "unary-postfix" && !HOP(OPERATORS, operator + expr[1])) || !needs_parens(expr))) + val = "(" + val + ")"; + return val + operator; + }, + "sub": function(expr, subscript) { + var hash = make(expr); + if (needs_parens(expr)) + hash = "(" + hash + ")"; + return hash + "[" + make(subscript) + "]"; + }, + "object": function(props) { + var obj_needs_parens = needs_parens(this); + if (props.length == 0) + return obj_needs_parens ? "({})" : "{}"; + var out = "{" + newline + with_indent(function(){ + return MAP(props, function(p){ + if (p.length == 3) { + // getter/setter. The name is in p[0], the arg.list in p[1][2], the + // body in p[1][3] and type ("get" / "set") in p[2]. + return indent(make_function(p[0], p[1][2], p[1][3], p[2], true)); + } + var key = p[0], val = parenthesize(p[1], "seq"); + if (options.quote_keys) { + key = encode_string(key); + } else if ((typeof key == "number" || !beautify && +key + "" == key) + && parseFloat(key) >= 0) { + key = make_num(+key); + } else if (!is_identifier(key)) { + key = encode_string(key); + } + return indent(add_spaces(beautify && options.space_colon + ? [ key, ":", val ] + : [ key + ":", val ])); + }).join("," + newline); + }) + newline + indent("}"); + return obj_needs_parens ? "(" + out + ")" : out; + }, + "regexp": function(rx, mods) { + if (options.ascii_only) rx = to_ascii(rx); + return "/" + rx + "/" + mods; + }, + "array": function(elements) { + if (elements.length == 0) return "[]"; + return add_spaces([ "[", add_commas(MAP(elements, function(el, i){ + if (!beautify && el[0] == "atom" && el[1] == "undefined") return i === elements.length - 1 ? "," : ""; + return parenthesize(el, "seq"); + })), "]" ]); + }, + "stat": function(stmt) { + return make(stmt).replace(/;*\s*$/, ";"); + }, + "seq": function() { + return add_commas(MAP(slice(arguments), make)); + }, + "label": function(name, block) { + return add_spaces([ make_name(name), ":", make(block) ]); + }, + "with": function(expr, block) { + return add_spaces([ "with", "(" + make(expr) + ")", make(block) ]); + }, + "atom": function(name) { + return make_name(name); + }, + "directive": function(dir) { + return make_string(dir) + ";"; + } + }, function(){ return make(ast) }); + + // The squeezer replaces "block"-s that contain only a single + // statement with the statement itself; technically, the AST + // is correct, but this can create problems when we output an + // IF having an ELSE clause where the THEN clause ends in an + // IF *without* an ELSE block (then the outer ELSE would refer + // to the inner IF). This function checks for this case and + // adds the block brackets if needed. + function make_then(th) { + if (th == null) return ";"; + if (th[0] == "do") { + // https://github.com/mishoo/UglifyJS/issues/#issue/57 + // IE croaks with "syntax error" on code like this: + // if (foo) do ... while(cond); else ... + // we need block brackets around do/while + return make_block([ th ]); + } + var b = th; + while (true) { + var type = b[0]; + if (type == "if") { + if (!b[3]) + // no else, we must add the block + return make([ "block", [ th ]]); + b = b[3]; + } + else if (type == "while" || type == "do") b = b[2]; + else if (type == "for" || type == "for-in") b = b[4]; + else break; + } + return make(th); + }; + + function make_function(name, args, body, keyword, no_parens) { + var out = keyword || "function"; + if (name) { + out += " " + make_name(name); + } + out += "(" + add_commas(MAP(args, make_name)) + ")"; + out = add_spaces([ out, make_block(body) ]); + return (!no_parens && needs_parens(this)) ? "(" + out + ")" : out; + }; + + function must_has_semicolon(node) { + switch (node[0]) { + case "with": + case "while": + return empty(node[2]) || must_has_semicolon(node[2]); + case "for": + case "for-in": + return empty(node[4]) || must_has_semicolon(node[4]); + case "if": + if (empty(node[2]) && !node[3]) return true; // `if' with empty `then' and no `else' + if (node[3]) { + if (empty(node[3])) return true; // `else' present but empty + return must_has_semicolon(node[3]); // dive into the `else' branch + } + return must_has_semicolon(node[2]); // dive into the `then' branch + case "directive": + return true; + } + }; + + function make_block_statements(statements, noindent) { + for (var a = [], last = statements.length - 1, i = 0; i <= last; ++i) { + var stat = statements[i]; + var code = make(stat); + if (code != ";") { + if (!beautify && i == last && !must_has_semicolon(stat)) { + code = code.replace(/;+\s*$/, ""); + } + a.push(code); + } + } + return noindent ? a : MAP(a, indent); + }; + + function make_switch_block(body) { + var n = body.length; + if (n == 0) return "{}"; + return "{" + newline + MAP(body, function(branch, i){ + var has_body = branch[1].length > 0, code = with_indent(function(){ + return indent(branch[0] + ? add_spaces([ "case", make(branch[0]) + ":" ]) + : "default:"); + }, 0.5) + (has_body ? newline + with_indent(function(){ + return make_block_statements(branch[1]).join(newline); + }) : ""); + if (!beautify && has_body && i < n - 1) + code += ";"; + return code; + }).join(newline) + newline + indent("}"); + }; + + function make_block(statements) { + if (!statements) return ";"; + if (statements.length == 0) return "{}"; + return "{" + newline + with_indent(function(){ + return make_block_statements(statements).join(newline); + }) + newline + indent("}"); + }; + + function make_1vardef(def) { + var name = def[0], val = def[1]; + if (val != null) + name = add_spaces([ make_name(name), "=", parenthesize(val, "seq") ]); + return name; + }; + +}; + +function split_lines(code, max_line_length) { + var splits = [ 0 ]; + jsp.parse(function(){ + var next_token = jsp.tokenizer(code); + var last_split = 0; + var prev_token; + function current_length(tok) { + return tok.pos - last_split; + }; + function split_here(tok) { + last_split = tok.pos; + splits.push(last_split); + }; + function custom(){ + var tok = next_token.apply(this, arguments); + out: { + if (prev_token) { + if (prev_token.type == "keyword") break out; + } + if (current_length(tok) > max_line_length) { + switch (tok.type) { + case "keyword": + case "atom": + case "name": + case "punc": + split_here(tok); + break out; + } + } + } + prev_token = tok; + return tok; + }; + custom.context = function() { + return next_token.context.apply(this, arguments); + }; + return custom; + }()); + return splits.map(function(pos, i){ + return code.substring(pos, splits[i + 1] || code.length); + }).join("\n"); +}; + +/* -----[ Utilities ]----- */ + +function repeat_string(str, i) { + if (i <= 0) return ""; + if (i == 1) return str; + var d = repeat_string(str, i >> 1); + d += d; + if (i & 1) d += str; + return d; +}; + +function defaults(args, defs) { + var ret = {}; + if (args === true) + args = {}; + for (var i in defs) if (HOP(defs, i)) { + ret[i] = (args && HOP(args, i)) ? args[i] : defs[i]; + } + return ret; +}; + +function is_identifier(name) { + return /^[a-z_$][a-z0-9_$]*$/i.test(name) + && name != "this" + && !HOP(jsp.KEYWORDS_ATOM, name) + && !HOP(jsp.RESERVED_WORDS, name) + && !HOP(jsp.KEYWORDS, name); +}; + +function HOP(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +}; + +// some utilities + +var MAP; + +(function(){ + MAP = function(a, f, o) { + var ret = [], top = [], i; + function doit() { + var val = f.call(o, a[i], i); + if (val instanceof AtTop) { + val = val.v; + if (val instanceof Splice) { + top.push.apply(top, val.v); + } else { + top.push(val); + } + } + else if (val != skip) { + if (val instanceof Splice) { + ret.push.apply(ret, val.v); + } else { + ret.push(val); + } + } + }; + if (a instanceof Array) for (i = 0; i < a.length; ++i) doit(); + else for (i in a) if (HOP(a, i)) doit(); + return top.concat(ret); + }; + MAP.at_top = function(val) { return new AtTop(val) }; + MAP.splice = function(val) { return new Splice(val) }; + var skip = MAP.skip = {}; + function AtTop(val) { this.v = val }; + function Splice(val) { this.v = val }; +})(); + +/* -----[ Exports ]----- */ + +exports.ast_walker = ast_walker; +exports.ast_mangle = ast_mangle; +exports.ast_squeeze = ast_squeeze; +exports.ast_lift_variables = ast_lift_variables; +exports.gen_code = gen_code; +exports.ast_add_scope = ast_add_scope; +exports.set_logger = function(logger) { warn = logger }; +exports.make_string = make_string; +exports.split_lines = split_lines; +exports.MAP = MAP; + +// keep this last! +exports.ast_squeeze_more = require("./squeeze-more").ast_squeeze_more; +}); +define('uglifyjs/index', ["require", "exports", "module", "./parse-js", "./process", "./consolidator"], function(require, exports, module) { +//convienence function(src, [options]); +function uglify(orig_code, options){ + options || (options = {}); + var jsp = uglify.parser; + var pro = uglify.uglify; + + var ast = jsp.parse(orig_code, options.strict_semicolons); // parse code and get the initial AST + ast = pro.ast_mangle(ast, options.mangle_options); // get a new AST with mangled names + ast = pro.ast_squeeze(ast, options.squeeze_options); // get an AST with compression optimizations + var final_code = pro.gen_code(ast, options.gen_options); // compressed code here + return final_code; +}; + +uglify.parser = require("./parse-js"); +uglify.uglify = require("./process"); +uglify.consolidator = require("./consolidator"); + +module.exports = uglify +});/** + * @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ + +/*jslint plusplus: true */ +/*global define: false */ + +define('parse', ['./esprima', './uglifyjs/index'], function (esprima, uglify) { + 'use strict'; + + var parser = uglify.parser, + processor = uglify.uglify, + ostring = Object.prototype.toString, + isArray; + + if (Array.isArray) { + isArray = Array.isArray; + } else { + isArray = function (it) { + return ostring.call(it) === "[object Array]"; + }; + } + + /** + * Determines if the AST node is an array literal + */ + function isArrayLiteral(node) { + return node[0] === 'array'; + } + + /** + * Determines if the AST node is an object literal + */ + function isObjectLiteral(node) { + return node[0] === 'object'; + } + + /** + * Converts a regular JS array of strings to an AST node that + * represents that array. + * @param {Array} ary + * @param {Node} an AST node that represents an array of strings. + */ + function toAstArray(ary) { + var output = [ + 'array', + [] + ], + i, item; + + for (i = 0; i < ary.length; i++) { + item = ary[i]; + output[1].push([ + 'string', + item + ]); + } + + return output; + } + + /** + * Validates a node as being an object literal (like for i18n bundles) + * or an array literal with just string members. If an array literal, + * only return array members that are full strings. So the caller of + * this function should use the return value as the new value for the + * node. + * + * This function does not need to worry about comments, they are not + * present in this AST. + * + * @param {Node} node an AST node. + * + * @returns {Node} an AST node to use for the valid dependencies. + * If null is returned, then it means the input node was not a valid + * dependency. + */ + function validateDeps(node) { + var newDeps = ['array', []], + arrayArgs, i, dep; + + if (!node) { + return null; + } + + if (isObjectLiteral(node) || node[0] === 'function') { + return node; + } + + //Dependencies can be an object literal or an array. + if (!isArrayLiteral(node)) { + return null; + } + + arrayArgs = node[1]; + + for (i = 0; i < arrayArgs.length; i++) { + dep = arrayArgs[i]; + if (dep[0] === 'string') { + newDeps[1].push(dep); + } + } + return newDeps[1].length ? newDeps : null; + } + + /** + * Gets dependencies from a node, but only if it is an array literal, + * and only if the dependency is a string literal. + * + * This function does not need to worry about comments, they are not + * present in this AST. + * + * @param {Node} node an AST node. + * + * @returns {Array} of valid dependencies. + * If null is returned, then it means the input node was not a valid + * array literal, or did not have any string literals.. + */ + function getValidDeps(node) { + var newDeps = [], + arrayArgs, i, dep; + + if (!node) { + return null; + } + + if (isObjectLiteral(node) || node[0] === 'function') { + return null; + } + + //Dependencies can be an object literal or an array. + if (!isArrayLiteral(node)) { + return null; + } + + arrayArgs = node[1]; + + for (i = 0; i < arrayArgs.length; i++) { + dep = arrayArgs[i]; + if (dep[0] === 'string') { + newDeps.push(dep[1]); + } + } + return newDeps.length ? newDeps : null; + } + + /** + * Main parse function. Returns a string of any valid require or define/require.def + * calls as part of one JavaScript source string. + * @param {String} moduleName the module name that represents this file. + * It is used to create a default define if there is not one already for the file. + * This allows properly tracing dependencies for builds. Otherwise, if + * the file just has a require() call, the file dependencies will not be + * properly reflected: the file will come before its dependencies. + * @param {String} moduleName + * @param {String} fileName + * @param {String} fileContents + * @param {Object} options optional options. insertNeedsDefine: true will + * add calls to require.needsDefine() if appropriate. + * @returns {String} JS source string or null, if no require or define/require.def + * calls are found. + */ + function parse(moduleName, fileName, fileContents, options) { + options = options || {}; + + //Set up source input + var moduleDeps = [], + result = '', + moduleList = [], + needsDefine = true, + astRoot = parser.parse(fileContents), + i, moduleCall, depString; + + parse.recurse(astRoot, function (callName, config, name, deps) { + //If name is an array, it means it is an anonymous module, + //so adjust args appropriately. An anonymous module could + //have a FUNCTION as the name type, but just ignore those + //since we just want to find dependencies. + if (name && isArrayLiteral(name)) { + deps = name; + name = null; + } + + deps = getValidDeps(deps); + if (!deps) { + deps = []; + } + + //Get the name as a string literal, if it is available. + if (name && name[0] === 'string') { + name = name[1]; + } else { + name = null; + } + + if (callName === 'define' && (!name || name === moduleName)) { + needsDefine = false; + } + + if (!name) { + //If there is no module name, the dependencies are for + //this file/default module name. + moduleDeps = moduleDeps.concat(deps); + } else { + moduleList.push({ + name: name, + deps: deps + }); + } + + //If define was found, no need to dive deeper, unless + //the config explicitly wants to dig deeper. + return !options.findNestedDependencies; + }, options); + + if (options.insertNeedsDefine && needsDefine) { + result += 'require.needsDefine("' + moduleName + '");'; + } + + if (moduleDeps.length || moduleList.length) { + for (i = 0; i < moduleList.length; i++) { + moduleCall = moduleList[i]; + if (result) { + result += '\n'; + } + + //If this is the main module for this file, combine any + //"anonymous" dependencies (could come from a nested require + //call) with this module. + if (moduleCall.name === moduleName) { + moduleCall.deps = moduleCall.deps.concat(moduleDeps); + moduleDeps = []; + } + + depString = moduleCall.deps.length ? '["' + moduleCall.deps.join('","') + '"]' : '[]'; + result += 'define("' + moduleCall.name + '",' + depString + ');'; + } + if (moduleDeps.length) { + if (result) { + result += '\n'; + } + depString = moduleDeps.length ? '["' + moduleDeps.join('","') + '"]' : '[]'; + result += 'define("' + moduleName + '",' + depString + ');'; + } + } + + return result || null; + } + + //Add some private methods to object for use in derived objects. + parse.isArray = isArray; + parse.isObjectLiteral = isObjectLiteral; + parse.isArrayLiteral = isArrayLiteral; + + /** + * Handles parsing a file recursively for require calls. + * @param {Array} parentNode the AST node to start with. + * @param {Function} onMatch function to call on a parse match. + * @param {Object} [options] This is normally the build config options if + * it is passed. + * @param {Function} [recurseCallback] function to call on each valid + * node, defaults to parse.parseNode. + */ + parse.recurse = function (parentNode, onMatch, options, recurseCallback) { + var hasHas = options && options.has, + i, node; + + recurseCallback = recurseCallback || this.parseNode; + + if (isArray(parentNode)) { + for (i = 0; i < parentNode.length; i++) { + node = parentNode[i]; + if (isArray(node)) { + //If has config is in play, if calls have been converted + //by this point to be true/false values. So, if + //options has a 'has' value, skip if branches that have + //literal false values. + + //uglify returns if constructs in an array: + //[0]: 'if' + //[1]: the condition, ['name', true | false] for the has replaced case. + //[2]: the block to process if true + //[3]: the block to process if false + //For if/else if/else, the else if is in the [3], + //so only ever have to deal with this structure. + if (hasHas && node[0] === 'if' && node[1] && node[1][0] === 'name' && + (node[1][1] === 'true' || node[1][1] === 'false')) { + if (node[1][1] === 'true') { + this.recurse([node[2]], onMatch, options, recurseCallback); + } else { + this.recurse([node[3]], onMatch, options, recurseCallback); + } + } else { + //If the onMatch indicated parsing should + //stop for children of this node, stop, otherwise, + //keep going. + if (!recurseCallback(node, onMatch)) { + this.recurse(node, onMatch, options, recurseCallback); + } + } + } + } + } + }; + + /** + * Determines if the file defines require(). + * @param {String} fileName + * @param {String} fileContents + * @returns {Boolean} + */ + parse.definesRequire = function (fileName, fileContents) { + var astRoot = parser.parse(fileContents); + return this.nodeHasRequire(astRoot); + }; + + /** + * Finds require("") calls inside a CommonJS anonymous module wrapped in a + * define(function(require, exports, module){}) wrapper. These dependencies + * will be added to a modified define() call that lists the dependencies + * on the outside of the function. + * @param {String} fileName + * @param {String} fileContents + * @returns {Array} an array of module names that are dependencies. Always + * returns an array, but could be of length zero. + */ + parse.getAnonDeps = function (fileName, fileContents) { + var astRoot = parser.parse(fileContents), + defFunc = this.findAnonDefineFactory(astRoot); + + return parse.getAnonDepsFromNode(defFunc); + }; + + /** + * Finds require("") calls inside a CommonJS anonymous module wrapped + * in a define function, given an AST node for the definition function. + * @param {Node} node the AST node for the definition function. + * @returns {Array} and array of dependency names. Can be of zero length. + */ + parse.getAnonDepsFromNode = function (node) { + var deps = [], + funcArgLength; + + if (node) { + this.findRequireDepNames(node, deps); + + //If no deps, still add the standard CommonJS require, exports, module, + //in that order, to the deps, but only if specified as function args. + //In particular, if exports is used, it is favored over the return + //value of the function, so only add it if asked. + funcArgLength = node[2] && node[2].length; + if (funcArgLength) { + deps = (funcArgLength > 1 ? ["require", "exports", "module"] : + ["require"]).concat(deps); + } + } + return deps; + }; + + /** + * Finds the function in define(function (require, exports, module){}); + * @param {Array} node + * @returns {Boolean} + */ + parse.findAnonDefineFactory = function (node) { + var callback, i, n, call, args; + + if (isArray(node)) { + if (node[0] === 'call' && node.length > 2) { + call = node[1]; + args = node[2]; + if ((call[0] === 'name' && call[1] === 'define') || + (call[0] === 'dot' && call[1][1] === 'require' && call[2] === 'def')) { + + //There should only be one argument and it should be a function, + //or a named module with function as second arg + if (args.length === 1 && args[0][0] === 'function') { + return args[0]; + } else if (args.length === 2 && args[0][0] === 'string' && + args[1][0] === 'function') { + return args[1]; + } + } + } + + //Check child nodes + for (i = 0; i < node.length; i++) { + n = node[i]; + callback = this.findAnonDefineFactory(n); + if (callback) { + return callback; + } + } + } + + return null; + }; + + /** + * Finds any config that is passed to requirejs. + * @param {String} fileName + * @param {String} fileContents + * + * @returns {Object} a config object. Will be null if no config. + * Can throw an error if the config in the file cannot be evaluated in + * a build context to valid JavaScript. + */ + parse.findConfig = function (fileName, fileContents) { + /*jslint evil: true */ + //This is a litle bit inefficient, it ends up with two uglifyjs parser + //calls. Can revisit later, but trying to build out larger functional + //pieces first. + var foundConfig = null, + astRoot = parser.parse(fileContents); + + parse.recurse(astRoot, function (configNode) { + var jsConfig; + + if (!foundConfig && configNode) { + jsConfig = parse.nodeToString(configNode); + foundConfig = eval('(' + jsConfig + ')'); + return foundConfig; + } + return undefined; + }, null, parse.parseConfigNode); + + return foundConfig; + }; + + /** + * Finds all dependencies specified in dependency arrays and inside + * simplified commonjs wrappers. + * @param {String} fileName + * @param {String} fileContents + * + * @returns {Array} an array of dependency strings. The dependencies + * have not been normalized, they may be relative IDs. + */ + parse.findDependencies = function (fileName, fileContents, options) { + //This is a litle bit inefficient, it ends up with two uglifyjs parser + //calls. Can revisit later, but trying to build out larger functional + //pieces first. + var dependencies = [], + astRoot = parser.parse(fileContents); + + parse.recurse(astRoot, function (callName, config, name, deps) { + //Normalize the input args. + if (name && isArrayLiteral(name)) { + deps = name; + name = null; + } + + deps = getValidDeps(deps); + if (deps) { + dependencies = dependencies.concat(deps); + } + }, options); + + return dependencies; + }; + + /** + * Finds only CJS dependencies, ones that are the form require('stringLiteral') + */ + parse.findCjsDependencies = function (fileName, fileContents, options) { + //This is a litle bit inefficient, it ends up with two uglifyjs parser + //calls. Can revisit later, but trying to build out larger functional + //pieces first. + var dependencies = [], + astRoot = parser.parse(fileContents); + + parse.recurse(astRoot, function (dep) { + dependencies.push(dep); + }, options, function (node, onMatch) { + + var call, args; + + if (!isArray(node)) { + return false; + } + + if (node[0] === 'call') { + call = node[1]; + args = node[2]; + + if (call) { + //A require('') use. + if (call[0] === 'name' && call[1] === 'require' && + args[0][0] === 'string') { + return onMatch(args[0][1]); + } + } + } + + return false; + + }); + + return dependencies; + }; + + /** + * Determines if define(), require({}|[]) or requirejs was called in the + * file. Also finds out if define() is declared and if define.amd is called. + */ + parse.usesAmdOrRequireJs = function (fileName, fileContents, options) { + var astRoot = parser.parse(fileContents), + uses; + + parse.recurse(astRoot, function (prop) { + if (!uses) { + uses = {}; + } + uses[prop] = true; + }, options, parse.findAmdOrRequireJsNode); + + return uses; + }; + + /** + * Determines if require(''), exports.x =, module.exports =, + * __dirname, __filename are used. So, not strictly traditional CommonJS, + * also checks for Node variants. + */ + parse.usesCommonJs = function (fileName, fileContents, options) { + var uses = null, + assignsExports = false, + astRoot = parser.parse(fileContents); + + parse.recurse(astRoot, function (prop) { + if (prop === 'varExports') { + assignsExports = true; + } else if (prop !== 'exports' || !assignsExports) { + if (!uses) { + uses = {}; + } + uses[prop] = true; + } + }, options, function (node, onMatch) { + + var call, args; + + if (!isArray(node)) { + return false; + } + + if (node[0] === 'name' && (node[1] === '__dirname' || node[1] === '__filename')) { + return onMatch(node[1].substring(2)); + } else if (node[0] === 'var' && node[1] && node[1][0] && node[1][0][0] === 'exports') { + //Hmm, a variable assignment for exports, so does not use cjs exports. + return onMatch('varExports'); + } else if (node[0] === 'assign' && node[2] && node[2][0] === 'dot') { + args = node[2][1]; + + if (args) { + //An exports or module.exports assignment. + if (args[0] === 'name' && args[1] === 'module' && + node[2][2] === 'exports') { + return onMatch('moduleExports'); + } else if (args[0] === 'name' && args[1] === 'exports') { + return onMatch('exports'); + } + } + } else if (node[0] === 'call') { + call = node[1]; + args = node[2]; + + if (call) { + //A require('') use. + if (call[0] === 'name' && call[1] === 'require' && + args[0][0] === 'string') { + return onMatch('require'); + } + } + } + + return false; + + }); + + return uses; + }; + + + parse.findRequireDepNames = function (node, deps) { + var moduleName, i, n, call, args; + + if (isArray(node)) { + if (node[0] === 'call') { + call = node[1]; + args = node[2]; + + if (call && call[0] === 'name' && call[1] === 'require') { + moduleName = args[0]; + if (moduleName[0] === 'string') { + deps.push(moduleName[1]); + } + } + + + } + + //Check child nodes + for (i = 0; i < node.length; i++) { + n = node[i]; + this.findRequireDepNames(n, deps); + } + } + }; + + /** + * Determines if a given node contains a require() definition. + * @param {Array} node + * @returns {Boolean} + */ + parse.nodeHasRequire = function (node) { + var i, n; + + if (this.isDefineNode(node)) { + return true; + } + + if (isArray(node)) { + for (i = 0; i < node.length; i++) { + n = node[i]; + if (this.nodeHasRequire(n)) { + return true; + } + } + } + + return false; + }; + + /** + * Is the given node the actual definition of define(). Actually uses + * the definition of define.amd to find require. + * @param {Array} node + * @returns {Boolean} + */ + parse.isDefineNode = function (node) { + //Actually look for the define.amd = assignment, since + //that is more indicative of RequireJS vs a plain require definition. + var assign; + if (!node) { + return null; + } + + if (node[0] === 'assign' && node[1] === true) { + assign = node[2]; + if (assign[0] === 'dot' && assign[1][0] === 'name' && + assign[1][1] === 'define' && assign[2] === 'amd') { + return true; + } + } + return false; + }; + + /** + * Determines if a specific node is a valid require or define/require.def call. + * @param {Array} node + * @param {Function} onMatch a function to call when a match is found. + * It is passed the match name, and the config, name, deps possible args. + * The config, name and deps args are not normalized. + * + * @returns {String} a JS source string with the valid require/define call. + * Otherwise null. + */ + parse.parseNode = function (node, onMatch) { + var call, name, config, deps, args, cjsDeps; + + if (!isArray(node)) { + return false; + } + + if (node[0] === 'call') { + call = node[1]; + args = node[2]; + + if (call) { + if (call[0] === 'name' && + (call[1] === 'require' || call[1] === 'requirejs')) { + + //It is a plain require() call. + config = args[0]; + deps = args[1]; + if (isArrayLiteral(config)) { + deps = config; + config = null; + } + + deps = validateDeps(deps); + if (!deps) { + return null; + } + + return onMatch("require", null, null, deps); + + } else if (call[0] === 'name' && call[1] === 'define') { + + //A define call + name = args[0]; + deps = args[1]; + //Only allow define calls that match what is expected + //in an AMD call: + //* first arg should be string, array, function or object + //* second arg optional, or array, function or object. + //This helps weed out calls to a non-AMD define, but it is + //not completely robust. Someone could create a define + //function that still matches this shape, but this is the + //best that is possible, and at least allows UglifyJS, + //which does create its own internal define in one file, + //to be inlined. + if (((name[0] === 'string' || isArrayLiteral(name) || + name[0] === 'function' || isObjectLiteral(name))) && + (!deps || isArrayLiteral(deps) || + deps[0] === 'function' || isObjectLiteral(deps) || + // allow define(['dep'], factory) pattern + (isArrayLiteral(name) && deps[0] === 'name' && args.length === 2))) { + + //If first arg is a function, could be a commonjs wrapper, + //look inside for commonjs dependencies. + //Also, if deps is a function look for commonjs deps. + if (name && name[0] === 'function') { + cjsDeps = parse.getAnonDepsFromNode(name); + if (cjsDeps.length) { + name = toAstArray(cjsDeps); + } + } else if (deps && deps[0] === 'function') { + cjsDeps = parse.getAnonDepsFromNode(deps); + if (cjsDeps.length) { + deps = toAstArray(cjsDeps); + } + } + + return onMatch("define", null, name, deps); + } + } + } + } + + return false; + }; + + /** + * Looks for define(), require({} || []), requirejs({} || []) calls. + */ + parse.findAmdOrRequireJsNode = function (node, onMatch) { + var call, args, configNode, type; + + if (!isArray(node)) { + return false; + } + + if (node[0] === 'defun' && node[1] === 'define') { + type = 'declaresDefine'; + } else if (node[0] === 'assign' && node[2] && node[2][2] === 'amd' && + node[2][1] && node[2][1][0] === 'name' && + node[2][1][1] === 'define') { + type = 'defineAmd'; + } else if (node[0] === 'call') { + call = node[1]; + args = node[2]; + + if (call) { + if ((call[0] === 'dot' && + (call[1] && call[1][0] === 'name' && + (call[1][1] === 'require' || call[1][1] === 'requirejs')) && + call[2] === 'config')) { + //A require.config() or requirejs.config() call. + type = call[1][1] + 'Config'; + } else if (call[0] === 'name' && + (call[1] === 'require' || call[1] === 'requirejs')) { + //A require() or requirejs() config call. + //Only want ones that start with an object or an array. + configNode = args[0]; + if (configNode[0] === 'object' || configNode[0] === 'array') { + type = call[1]; + } + } else if (call[0] === 'name' && call[1] === 'define') { + //A define call. + type = 'define'; + } + } + } + + if (type) { + return onMatch(type); + } + + return false; + }; + + /** + * Determines if a specific node is a valid require/requirejs config + * call. That includes calls to require/requirejs.config(). + * @param {Array} node + * @param {Function} onMatch a function to call when a match is found. + * It is passed the match name, and the config, name, deps possible args. + * The config, name and deps args are not normalized. + * + * @returns {String} a JS source string with the valid require/define call. + * Otherwise null. + */ + parse.parseConfigNode = function (node, onMatch) { + var call, configNode, args; + + if (!isArray(node)) { + return false; + } + + if (node[0] === 'call') { + call = node[1]; + args = node[2]; + + if (call) { + //A require.config() or requirejs.config() call. + if ((call[0] === 'dot' && + (call[1] && call[1][0] === 'name' && + (call[1][1] === 'require' || call[1][1] === 'requirejs')) && + call[2] === 'config') || + //A require() or requirejs() config call. + + (call[0] === 'name' && + (call[1] === 'require' || call[1] === 'requirejs')) + ) { + //It is a plain require() call. + configNode = args[0]; + + if (configNode[0] !== 'object') { + return null; + } + + return onMatch(configNode); + + } + } + } + + return false; + }; + + /** + * Converts an AST node into a JS source string. Does not maintain formatting + * or even comments from original source, just returns valid JS source. + * @param {Array} node + * @returns {String} a JS source string. + */ + parse.nodeToString = function (node) { + return processor.gen_code(node, true); + }; + + /** + * Extracts license comments from JS text. + * @param {String} fileName + * @param {String} contents + * @returns {String} a string of license comments. + */ + parse.getLicenseComments = function (fileName, contents) { + var ast = esprima.parse(contents, { + comment: true + }), + result = '', + lineEnd = contents.indexOf('\r') === -1 ? '\n' : '\r\n', + commentNode, refNode, subNode, value, i, j; + + if (ast.comments) { + for (i = 0; i < ast.comments.length; i++) { + commentNode = ast.comments[i]; + + if (commentNode.type === 'Line') { + value = '//' + commentNode.value + lineEnd; + refNode = commentNode; + + if (i + 1 >= ast.comments.length) { + value += lineEnd; + } else { + //Look for immediately adjacent single line comments since + //it could from a multiple line comment made out of single + //line comments. Like this comment. + for (j = i + 1; j < ast.comments.length; j++) { + subNode = ast.comments[j]; + if (subNode.type === 'Line' && subNode.range[0] === refNode.range[1]) { + //Adjacent single line comment. Collect it. + value += '//' + subNode.value + lineEnd; + refNode = subNode; + } else { + //No more single line comment blocks. Break out + //and continue outer looping. + value += lineEnd; + i = j - 1; + break; + } + } + } + } else { + value = '/*' + commentNode.value + '*/' + lineEnd + lineEnd; + } + + if (value.indexOf('license') !== -1 || + (commentNode.type === 'Block' && value.indexOf('/*!') === 0) || + value.indexOf('opyright') !== -1 || + value.indexOf('(c)') !== -1) { + + result += value; + } + + } + } + + return result; + }; + + return parse; +}); +/** + * @license Copyright (c) 2012, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ + +/*jslint */ + +define('transform', [ './esprima', './parse', 'logger', 'lang'], +function (esprima, parse, logger, lang) { + + 'use strict'; + var transform; + + return (transform = { + toTransport: function (namespace, moduleName, path, contents, onFound, options) { + options = options || {}; + + var defineRanges = [], + contentInsertion = '', + depString = '', + tokens, info, deps; + + try { + tokens = esprima.parse(contents, { + tokens: true, + range: true + }).tokens; + } catch(e) { + logger.trace('toTransport skipping ' + path + ': ' + + e.toString()); + return contents; + } + + //Find the define calls and their position in the files. + tokens.forEach(function (token, i) { + var namespaceExists = false, + prev, prev2, next, next2, next3, next4, + needsId, depAction, nameCommaRange, foundId, + sourceUrlData; + + if (token.type === 'Identifier' && token.value === 'define') { + //Possible match. Do not want something.define calls + //though, and only defines follow by a paren + prev = tokens[i - 1]; + next = tokens[i + 1]; + + if (prev && prev.type === 'Punctuator' && + prev.value === '.') { + //a define on a sub-object, not a top level + //define() call. If the sub object is the + //namespace, then it is ok. + prev2 = tokens[i - 2]; + if (!prev2) { + return; + } + + //If the prev2 does not match namespace, then bail. + if (!namespace || prev2.type !== 'Identifier' || + prev2.value !== namespace) { + return; + } else if (namespace) { + namespaceExists = true; + } + } + + if (!next || next.type !== 'Punctuator' || + next.value !== '(') { + //Not a define() function call. Bail. + return; + } + + next2 = tokens[i + 2]; + if (!next2) { + return; + } + + //Figure out if this needs a named define call. + if (next2.type === 'Punctuator' && + next2.value === '[') { + //Dependency array + needsId = true; + depAction = 'skip'; + } else if (next2.type === 'Punctuator' && + next2.value === '{') { + //Object literal + needsId = true; + depAction = 'skip'; + } else if (next2.type === 'Keyword' && + next2.value === 'function') { + //function + needsId = true; + depAction = 'scan'; + } else if (next2.type === 'String') { + //Named module + needsId = false; + + //The value includes the quotes around the string, + //so remove them. + foundId = next2.value.substring(1, + next2.value.length - 1); + + //assumed it does not need dependencies injected + + //If next argument is a function it means we need + //dependency scanning. + next3 = tokens[i + 3]; + next4 = tokens[i + 4]; + if (!next3 || !next4) { + return; + } + + if (next3.type === 'Punctuator' && + next3.value === ',' && + next4.type === 'Keyword' && + next4.value === 'function') { + depAction = 'scan'; + nameCommaRange = next3.range; + } else { + depAction = 'skip'; + } + } else if (next2.type === 'Identifier') { + //May be the define(factory); type. + next3 = tokens[i + 3]; + if (!next3) { + return; + } + if (next3.type === 'Punctuator' && + next3.value === ')') { + needsId = true; + depAction = 'empty'; + } else { + return; + } + } else if (next2.type === 'Numeric') { + //May be the define(12345); type. + next3 = tokens[i + 3]; + if (!next3) { + return; + } + if (next3.type === 'Punctuator' && + next3.value === ')') { + needsId = true; + depAction = 'skip'; + } else { + return; + } + } else if (next2.type === 'Punctuator' && + next2.value === '-') { + //May be the define(-12345); type. + next3 = tokens[i + 3]; + if (!next3) { + return; + } + if (next3.type === 'Numeric') { + next4 = tokens[i + 4]; + if (!next4) { + return; + } + if (next4.type === 'Punctuator' && + next4.value === ')') { + needsId = true; + depAction = 'skip'; + } else { + return; + } + } else { + return; + } + } else { + //Not a match, skip it. + return; + } + + defineRanges.push({ + foundId: foundId, + needsId: needsId, + depAction: depAction, + namespaceExists: namespaceExists, + defineRange: token.range, + parenRange: next.range, + nameCommaRange: nameCommaRange, + sourceUrlData: sourceUrlData + }); + } + }); + + //Only do naming and dependency injection if there is one define + //call in the file. + if (defineRanges.length > 1) { + return contents; + } + if (!defineRanges.length) { + return contents; + } + + info = defineRanges[0]; + + //Do the modifications "backwards", in other words, start with the + //one that is farthest down and work up, so that the ranges in the + //defineRanges still apply. So that means deps, id, then namespace. + + if (info.needsId && moduleName) { + contentInsertion += "'" + moduleName + "',"; + } + + if (info.depAction === 'scan') { + deps = parse.getAnonDeps(path, contents); + + if (deps.length) { + depString = '[' + deps.map(function (dep) { + return "'" + dep + "'"; + }) + ']'; + } else { + depString = '[]'; + } + depString += ','; + + if (info.nameCommaRange) { + //Already have a named module, need to insert the + //dependencies after the name. + contents = contents.substring(0, info.nameCommaRange[1]) + + depString + + contents.substring(info.nameCommaRange[1], + contents.length); + } else { + contentInsertion += depString; + } + } else if (info.depAction === 'empty') { + contentInsertion += '[],'; + } + + if (contentInsertion) { + contents = contents.substring(0, info.parenRange[1]) + + contentInsertion + + contents.substring(info.parenRange[1], + contents.length); + } + + //Do namespace last so that ui does not mess upthe parenRange + //used above. + if (namespace && !info.namespaceExists) { + contents = contents.substring(0, info.defineRange[0]) + + namespace + '.' + + contents.substring(info.defineRange[0], + contents.length); + } + + + //Notify any listener for the found info + if (onFound) { + onFound(info); + } + + if (options.useSourceUrl) { + contents = 'eval("' + lang.jsEscape(contents) + + '\\n//@ sourceURL=' + (path.indexOf('/') === 0 ? '' : '/') + path + + '");\n'; + } + + return contents; + } + }); +});/** + * @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ + +/*jslint regexp: true, plusplus: true */ +/*global define: false */ + +define('pragma', ['parse', 'logger'], function (parse, logger) { + 'use strict'; + function Temp() {} + + function create(obj, mixin) { + Temp.prototype = obj; + var temp = new Temp(), prop; + + //Avoid any extra memory hanging around + Temp.prototype = null; + + if (mixin) { + for (prop in mixin) { + if (mixin.hasOwnProperty(prop) && !temp.hasOwnProperty(prop)) { + temp[prop] = mixin[prop]; + } + } + } + + return temp; // Object + } + + var pragma = { + conditionalRegExp: /(exclude|include)Start\s*\(\s*["'](\w+)["']\s*,(.*)\)/, + useStrictRegExp: /['"]use strict['"];/g, + hasRegExp: /has\s*\(\s*['"]([^'"]+)['"]\s*\)/g, + nsRegExp: /(^|[^\.])(requirejs|require|define)(\.config)?\s*\(/g, + nsWrapRegExp: /\/\*requirejs namespace: true \*\//, + apiDefRegExp: /var requirejs, require, define;/, + defineCheckRegExp: /typeof\s+define\s*===\s*["']function["']\s*&&\s*define\s*\.\s*amd/g, + defineTypeFirstCheckRegExp: /\s*["']function["']\s*===\s*typeof\s+define\s*&&\s*define\s*\.\s*amd/g, + defineJQueryRegExp: /typeof\s+define\s*===\s*["']function["']\s*&&\s*define\s*\.\s*amd\s*&&\s*define\s*\.\s*amd\s*\.\s*jQuery/g, + defineHasRegExp: /typeof\s+define\s*==(=)?\s*['"]function['"]\s*&&\s*typeof\s+define\.amd\s*==(=)?\s*['"]object['"]\s*&&\s*define\.amd/g, + defineTernaryRegExp: /typeof\s+define\s*===\s*['"]function["']\s*&&\s*define\s*\.\s*amd\s*\?\s*define/, + amdefineRegExp: /if\s*\(\s*typeof define\s*\!==\s*'function'\s*\)\s*\{\s*[^\{\}]+amdefine[^\{\}]+\}/g, + + removeStrict: function (contents, config) { + return config.useStrict ? contents : contents.replace(pragma.useStrictRegExp, ''); + }, + + namespace: function (fileContents, ns, onLifecycleName) { + if (ns) { + //Namespace require/define calls + fileContents = fileContents.replace(pragma.nsRegExp, '$1' + ns + '.$2$3('); + + //Namespace define ternary use: + fileContents = fileContents.replace(pragma.defineTernaryRegExp, + "typeof " + ns + ".define === 'function' && " + ns + ".define.amd ? " + ns + ".define"); + + //Namespace define jquery use: + fileContents = fileContents.replace(pragma.defineJQueryRegExp, + "typeof " + ns + ".define === 'function' && " + ns + ".define.amd && " + ns + ".define.amd.jQuery"); + + //Namespace has.js define use: + fileContents = fileContents.replace(pragma.defineHasRegExp, + "typeof " + ns + ".define === 'function' && typeof " + ns + ".define.amd === 'object' && " + ns + ".define.amd"); + + //Namespace define checks. + //Do these ones last, since they are a subset of the more specific + //checks above. + fileContents = fileContents.replace(pragma.defineCheckRegExp, + "typeof " + ns + ".define === 'function' && " + ns + ".define.amd"); + fileContents = fileContents.replace(pragma.defineTypeFirstCheckRegExp, + "'function' === typeof " + ns + ".define && " + ns + ".define.amd"); + + //Check for require.js with the require/define definitions + if (pragma.apiDefRegExp.test(fileContents) && + fileContents.indexOf("if (typeof " + ns + " === 'undefined')") === -1) { + //Wrap the file contents in a typeof check, and a function + //to contain the API globals. + fileContents = "var " + ns + ";(function () { if (typeof " + + ns + " === 'undefined') {\n" + + ns + ' = {};\n' + + fileContents + + "\n" + + ns + ".requirejs = requirejs;" + + ns + ".require = require;" + + ns + ".define = define;\n" + + "}\n}());"; + } + + //Finally, if the file wants a special wrapper because it ties + //in to the requirejs internals in a way that would not fit + //the above matches, do that. Look for /*requirejs namespace: true*/ + if (pragma.nsWrapRegExp.test(fileContents)) { + //Remove the pragma. + fileContents = fileContents.replace(pragma.nsWrapRegExp, ''); + + //Alter the contents. + fileContents = '(function () {\n' + + 'var require = ' + ns + '.require,' + + 'requirejs = ' + ns + '.requirejs,' + + 'define = ' + ns + '.define;\n' + + fileContents + + '\n}());'; + } + } + + return fileContents; + }, + + /** + * processes the fileContents for some //>> conditional statements + */ + process: function (fileName, fileContents, config, onLifecycleName, pluginCollector) { + /*jslint evil: true */ + var foundIndex = -1, startIndex = 0, lineEndIndex, conditionLine, + matches, type, marker, condition, isTrue, endRegExp, endMatches, + endMarkerIndex, shouldInclude, startLength, lifecycleHas, deps, + i, dep, moduleName, collectorMod, + lifecyclePragmas, pragmas = config.pragmas, hasConfig = config.has, + //Legacy arg defined to help in dojo conversion script. Remove later + //when dojo no longer needs conversion: + kwArgs = pragmas; + + //Mix in a specific lifecycle scoped object, to allow targeting + //some pragmas/has tests to only when files are saved, or at different + //lifecycle events. Do not bother with kwArgs in this section, since + //the old dojo kwArgs were for all points in the build lifecycle. + if (onLifecycleName) { + lifecyclePragmas = config['pragmas' + onLifecycleName]; + lifecycleHas = config['has' + onLifecycleName]; + + if (lifecyclePragmas) { + pragmas = create(pragmas || {}, lifecyclePragmas); + } + + if (lifecycleHas) { + hasConfig = create(hasConfig || {}, lifecycleHas); + } + } + + //Replace has references if desired + if (hasConfig) { + fileContents = fileContents.replace(pragma.hasRegExp, function (match, test) { + if (hasConfig.hasOwnProperty(test)) { + return !!hasConfig[test]; + } + return match; + }); + } + + if (!config.skipPragmas) { + + while ((foundIndex = fileContents.indexOf("//>>", startIndex)) !== -1) { + //Found a conditional. Get the conditional line. + lineEndIndex = fileContents.indexOf("\n", foundIndex); + if (lineEndIndex === -1) { + lineEndIndex = fileContents.length - 1; + } + + //Increment startIndex past the line so the next conditional search can be done. + startIndex = lineEndIndex + 1; + + //Break apart the conditional. + conditionLine = fileContents.substring(foundIndex, lineEndIndex + 1); + matches = conditionLine.match(pragma.conditionalRegExp); + if (matches) { + type = matches[1]; + marker = matches[2]; + condition = matches[3]; + isTrue = false; + //See if the condition is true. + try { + isTrue = !!eval("(" + condition + ")"); + } catch (e) { + throw "Error in file: " + + fileName + + ". Conditional comment: " + + conditionLine + + " failed with this error: " + e; + } + + //Find the endpoint marker. + endRegExp = new RegExp('\\/\\/\\>\\>\\s*' + type + 'End\\(\\s*[\'"]' + marker + '[\'"]\\s*\\)', "g"); + endMatches = endRegExp.exec(fileContents.substring(startIndex, fileContents.length)); + if (endMatches) { + endMarkerIndex = startIndex + endRegExp.lastIndex - endMatches[0].length; + + //Find the next line return based on the match position. + lineEndIndex = fileContents.indexOf("\n", endMarkerIndex); + if (lineEndIndex === -1) { + lineEndIndex = fileContents.length - 1; + } + + //Should we include the segment? + shouldInclude = ((type === "exclude" && !isTrue) || (type === "include" && isTrue)); + + //Remove the conditional comments, and optionally remove the content inside + //the conditional comments. + startLength = startIndex - foundIndex; + fileContents = fileContents.substring(0, foundIndex) + + (shouldInclude ? fileContents.substring(startIndex, endMarkerIndex) : "") + + fileContents.substring(lineEndIndex + 1, fileContents.length); + + //Move startIndex to foundIndex, since that is the new position in the file + //where we need to look for more conditionals in the next while loop pass. + startIndex = foundIndex; + } else { + throw "Error in file: " + + fileName + + ". Cannot find end marker for conditional comment: " + + conditionLine; + + } + } + } + } + + //If need to find all plugin resources to optimize, do that now, + //before namespacing, since the namespacing will change the API + //names. + //If there is a plugin collector, scan the file for plugin resources. + if (config.optimizeAllPluginResources && pluginCollector) { + try { + deps = parse.findDependencies(fileName, fileContents); + if (deps.length) { + for (i = 0; i < deps.length; i++) { + dep = deps[i]; + if (dep.indexOf('!') !== -1) { + moduleName = dep.split('!')[0]; + collectorMod = pluginCollector[moduleName]; + if (!collectorMod) { + collectorMod = pluginCollector[moduleName] = []; + } + collectorMod.push(dep); + } + } + } + } catch (eDep) { + logger.error('Parse error looking for plugin resources in ' + + fileName + ', skipping.'); + } + } + + //Strip amdefine use for node-shared modules. + fileContents = fileContents.replace(pragma.amdefineRegExp, ''); + + //Do namespacing + if (onLifecycleName === 'OnSave' && config.namespace) { + fileContents = pragma.namespace(fileContents, config.namespace, onLifecycleName); + } + + + return pragma.removeStrict(fileContents, config); + } + }; + + return pragma; +}); +if(env === 'node') { +/** + * @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ + +/*jslint strict: false */ +/*global define: false */ + +define('node/optimize', {}); + +} + +if(env === 'rhino') { +/** + * @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ + +/*jslint strict: false, plusplus: false */ +/*global define: false, java: false, Packages: false */ + +define('rhino/optimize', ['logger'], function (logger) { + + //Add .reduce to Rhino so UglifyJS can run in Rhino, + //inspired by https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/reduce + //but rewritten for brevity, and to be good enough for use by UglifyJS. + if (!Array.prototype.reduce) { + Array.prototype.reduce = function (fn /*, initialValue */) { + var i = 0, + length = this.length, + accumulator; + + if (arguments.length >= 2) { + accumulator = arguments[1]; + } else { + do { + if (i in this) { + accumulator = this[i++]; + break; + } + } + while (true); + } + + for (; i < length; i++) { + if (i in this) { + accumulator = fn.call(undefined, accumulator, this[i], i, this); + } + } + + return accumulator; + }; + } + + var JSSourceFilefromCode, optimize; + + //Bind to Closure compiler, but if it is not available, do not sweat it. + try { + JSSourceFilefromCode = java.lang.Class.forName('com.google.javascript.jscomp.JSSourceFile').getMethod('fromCode', [java.lang.String, java.lang.String]); + } catch (e) {} + + //Helper for closure compiler, because of weird Java-JavaScript interactions. + function closurefromCode(filename, content) { + return JSSourceFilefromCode.invoke(null, [filename, content]); + } + + optimize = { + closure: function (fileName, fileContents, keepLines, config) { + config = config || {}; + var jscomp = Packages.com.google.javascript.jscomp, + flags = Packages.com.google.common.flags, + //Fake extern + externSourceFile = closurefromCode("fakeextern.js", " "), + //Set up source input + jsSourceFile = closurefromCode(String(fileName), String(fileContents)), + options, option, FLAG_compilation_level, compiler, + Compiler = Packages.com.google.javascript.jscomp.Compiler, + result; + + logger.trace("Minifying file: " + fileName); + + //Set up options + options = new jscomp.CompilerOptions(); + for (option in config.CompilerOptions) { + // options are false by default and jslint wanted an if statement in this for loop + if (config.CompilerOptions[option]) { + options[option] = config.CompilerOptions[option]; + } + + } + options.prettyPrint = keepLines || options.prettyPrint; + + FLAG_compilation_level = jscomp.CompilationLevel[config.CompilationLevel || 'SIMPLE_OPTIMIZATIONS']; + FLAG_compilation_level.setOptionsForCompilationLevel(options); + + //Trigger the compiler + Compiler.setLoggingLevel(Packages.java.util.logging.Level[config.loggingLevel || 'WARNING']); + compiler = new Compiler(); + + result = compiler.compile(externSourceFile, jsSourceFile, options); + if (!result.success) { + logger.error('Cannot closure compile file: ' + fileName + '. Skipping it.'); + } else { + fileContents = compiler.toSource(); + } + + return fileContents; + } + }; + + return optimize; +}); +} +/** + * @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ + +/*jslint plusplus: true, nomen: true, regexp: true */ +/*global define: false */ + +define('optimize', [ 'lang', 'logger', 'env!env/optimize', 'env!env/file', 'parse', + 'pragma', 'uglifyjs/index'], +function (lang, logger, envOptimize, file, parse, + pragma, uglify) { + 'use strict'; + + var optimize, + cssImportRegExp = /\@import\s+(url\()?\s*([^);]+)\s*(\))?([\w, ]*)(;)?/g, + cssCommentImportRegExp = /\/\*[^\*]*@import[^\*]*\*\//g, + cssUrlRegExp = /\url\(\s*([^\)]+)\s*\)?/g; + + /** + * If an URL from a CSS url value contains start/end quotes, remove them. + * This is not done in the regexp, since my regexp fu is not that strong, + * and the CSS spec allows for ' and " in the URL if they are backslash escaped. + * @param {String} url + */ + function cleanCssUrlQuotes(url) { + //Make sure we are not ending in whitespace. + //Not very confident of the css regexps above that there will not be ending + //whitespace. + url = url.replace(/\s+$/, ""); + + if (url.charAt(0) === "'" || url.charAt(0) === "\"") { + url = url.substring(1, url.length - 1); + } + + return url; + } + + /** + * Inlines nested stylesheets that have @import calls in them. + * @param {String} fileName the file name + * @param {String} fileContents the file contents + * @param {String} cssImportIgnore comma delimited string of files to ignore + * @param {Object} included an object used to track the files already imported + */ + function flattenCss(fileName, fileContents, cssImportIgnore, included) { + //Find the last slash in the name. + fileName = fileName.replace(lang.backSlashRegExp, "/"); + var endIndex = fileName.lastIndexOf("/"), + //Make a file path based on the last slash. + //If no slash, so must be just a file name. Use empty string then. + filePath = (endIndex !== -1) ? fileName.substring(0, endIndex + 1) : "", + //store a list of merged files + importList = [], + skippedList = []; + + //First make a pass by removing an commented out @import calls. + fileContents = fileContents.replace(cssCommentImportRegExp, ''); + + //Make sure we have a delimited ignore list to make matching faster + if (cssImportIgnore && cssImportIgnore.charAt(cssImportIgnore.length - 1) !== ",") { + cssImportIgnore += ","; + } + + fileContents = fileContents.replace(cssImportRegExp, function (fullMatch, urlStart, importFileName, urlEnd, mediaTypes) { + //Only process media type "all" or empty media type rules. + if (mediaTypes && ((mediaTypes.replace(/^\s\s*/, '').replace(/\s\s*$/, '')) !== "all")) { + skippedList.push(fileName); + return fullMatch; + } + + importFileName = cleanCssUrlQuotes(importFileName); + + //Ignore the file import if it is part of an ignore list. + if (cssImportIgnore && cssImportIgnore.indexOf(importFileName + ",") !== -1) { + return fullMatch; + } + + //Make sure we have a unix path for the rest of the operation. + importFileName = importFileName.replace(lang.backSlashRegExp, "/"); + + try { + //if a relative path, then tack on the filePath. + //If it is not a relative path, then the readFile below will fail, + //and we will just skip that import. + var fullImportFileName = importFileName.charAt(0) === "/" ? importFileName : filePath + importFileName, + importContents = file.readFile(fullImportFileName), i, + importEndIndex, importPath, fixedUrlMatch, colonIndex, parts, flat; + + //Skip the file if it has already been included. + if (included[fullImportFileName]) { + return ''; + } + included[fullImportFileName] = true; + + //Make sure to flatten any nested imports. + flat = flattenCss(fullImportFileName, importContents, cssImportIgnore, included); + importContents = flat.fileContents; + + if (flat.importList.length) { + importList.push.apply(importList, flat.importList); + } + if (flat.skippedList.length) { + skippedList.push.apply(skippedList, flat.skippedList); + } + + //Make the full import path + importEndIndex = importFileName.lastIndexOf("/"); + + //Make a file path based on the last slash. + //If no slash, so must be just a file name. Use empty string then. + importPath = (importEndIndex !== -1) ? importFileName.substring(0, importEndIndex + 1) : ""; + + //fix url() on relative import (#5) + importPath = importPath.replace(/^\.\//, ''); + + //Modify URL paths to match the path represented by this file. + importContents = importContents.replace(cssUrlRegExp, function (fullMatch, urlMatch) { + fixedUrlMatch = cleanCssUrlQuotes(urlMatch); + fixedUrlMatch = fixedUrlMatch.replace(lang.backSlashRegExp, "/"); + + //Only do the work for relative URLs. Skip things that start with / or have + //a protocol. + colonIndex = fixedUrlMatch.indexOf(":"); + if (fixedUrlMatch.charAt(0) !== "/" && (colonIndex === -1 || colonIndex > fixedUrlMatch.indexOf("/"))) { + //It is a relative URL, tack on the path prefix + urlMatch = importPath + fixedUrlMatch; + } else { + logger.trace(importFileName + "\n URL not a relative URL, skipping: " + urlMatch); + } + + //Collapse .. and . + parts = urlMatch.split("/"); + for (i = parts.length - 1; i > 0; i--) { + if (parts[i] === ".") { + parts.splice(i, 1); + } else if (parts[i] === "..") { + if (i !== 0 && parts[i - 1] !== "..") { + parts.splice(i - 1, 2); + i -= 1; + } + } + } + + return "url(" + parts.join("/") + ")"; + }); + + importList.push(fullImportFileName); + return importContents; + } catch (e) { + logger.warn(fileName + "\n Cannot inline css import, skipping: " + importFileName); + return fullMatch; + } + }); + + return { + importList : importList, + skippedList: skippedList, + fileContents : fileContents + }; + } + + optimize = { + /** + * Optimizes a file that contains JavaScript content. Optionally collects + * plugin resources mentioned in a file, and then passes the content + * through an minifier if one is specified via config.optimize. + * + * @param {String} fileName the name of the file to optimize + * @param {String} fileContents the contents to optimize. If this is + * a null value, then fileName will be used to read the fileContents. + * @param {String} outFileName the name of the file to use for the + * saved optimized content. + * @param {Object} config the build config object. + * @param {Array} [pluginCollector] storage for any plugin resources + * found. + */ + jsFile: function (fileName, fileContents, outFileName, config, pluginCollector) { + if (!fileContents) { + fileContents = file.readFile(fileName); + } + + fileContents = optimize.js(fileName, fileContents, config, pluginCollector); + + file.saveUtf8File(outFileName, fileContents); + }, + + /** + * Optimizes a file that contains JavaScript content. Optionally collects + * plugin resources mentioned in a file, and then passes the content + * through an minifier if one is specified via config.optimize. + * + * @param {String} fileName the name of the file that matches the + * fileContents. + * @param {String} fileContents the string of JS to optimize. + * @param {Object} [config] the build config object. + * @param {Array} [pluginCollector] storage for any plugin resources + * found. + */ + js: function (fileName, fileContents, config, pluginCollector) { + var parts = (String(config.optimize)).split('.'), + optimizerName = parts[0], + keepLines = parts[1] === 'keepLines', + licenseContents = '', + optFunc; + + config = config || {}; + + //Apply pragmas/namespace renaming + fileContents = pragma.process(fileName, fileContents, config, 'OnSave', pluginCollector); + + //Optimize the JS files if asked. + if (optimizerName && optimizerName !== 'none') { + optFunc = envOptimize[optimizerName] || optimize.optimizers[optimizerName]; + if (!optFunc) { + throw new Error('optimizer with name of "' + + optimizerName + + '" not found for this environment'); + } + + if (config.preserveLicenseComments) { + //Pull out any license comments for prepending after optimization. + try { + licenseContents = parse.getLicenseComments(fileName, fileContents); + } catch (e) { + logger.error('Cannot parse file: ' + fileName + ' for comments. Skipping it. Error is:\n' + e.toString()); + } + } + + fileContents = licenseContents + optFunc(fileName, fileContents, keepLines, + config[optimizerName]); + } + + return fileContents; + }, + + /** + * Optimizes one CSS file, inlining @import calls, stripping comments, and + * optionally removes line returns. + * @param {String} fileName the path to the CSS file to optimize + * @param {String} outFileName the path to save the optimized file. + * @param {Object} config the config object with the optimizeCss and + * cssImportIgnore options. + */ + cssFile: function (fileName, outFileName, config) { + + //Read in the file. Make sure we have a JS string. + var originalFileContents = file.readFile(fileName), + flat = flattenCss(fileName, originalFileContents, config.cssImportIgnore, {}), + //Do not use the flattened CSS if there was one that was skipped. + fileContents = flat.skippedList.length ? originalFileContents : flat.fileContents, + startIndex, endIndex, buildText, comment; + + if (flat.skippedList.length) { + logger.warn('Cannot inline @imports for ' + fileName + + ',\nthe following files had media queries in them:\n' + + flat.skippedList.join('\n')); + } + + //Do comment removal. + try { + if (config.optimizeCss.indexOf(".keepComments") === -1) { + startIndex = 0; + //Get rid of comments. + while ((startIndex = fileContents.indexOf("/*", startIndex)) !== -1) { + endIndex = fileContents.indexOf("*/", startIndex + 2); + if (endIndex === -1) { + throw "Improper comment in CSS file: " + fileName; + } + comment = fileContents.substring(startIndex, endIndex); + + if (config.preserveLicenseComments && + (comment.indexOf('license') !== -1 || + comment.indexOf('opyright') !== -1 || + comment.indexOf('(c)') !== -1)) { + //Keep the comment, just increment the startIndex + startIndex = endIndex; + } else { + fileContents = fileContents.substring(0, startIndex) + fileContents.substring(endIndex + 2, fileContents.length); + startIndex = 0; + } + } + } + //Get rid of newlines. + if (config.optimizeCss.indexOf(".keepLines") === -1) { + fileContents = fileContents.replace(/[\r\n]/g, ""); + fileContents = fileContents.replace(/\s+/g, " "); + fileContents = fileContents.replace(/\{\s/g, "{"); + fileContents = fileContents.replace(/\s\}/g, "}"); + } else { + //Remove multiple empty lines. + fileContents = fileContents.replace(/(\r\n)+/g, "\r\n"); + fileContents = fileContents.replace(/(\n)+/g, "\n"); + } + } catch (e) { + fileContents = originalFileContents; + logger.error("Could not optimized CSS file: " + fileName + ", error: " + e); + } + + file.saveUtf8File(outFileName, fileContents); + + //text output to stdout and/or written to build.txt file + buildText = "\n"+ outFileName.replace(config.dir, "") +"\n----------------\n"; + flat.importList.push(fileName); + buildText += flat.importList.map(function(path){ + return path.replace(config.dir, ""); + }).join("\n"); + return buildText +"\n"; + }, + + /** + * Optimizes CSS files, inlining @import calls, stripping comments, and + * optionally removes line returns. + * @param {String} startDir the path to the top level directory + * @param {Object} config the config object with the optimizeCss and + * cssImportIgnore options. + */ + css: function (startDir, config) { + var buildText = "", + i, fileName, fileList; + if (config.optimizeCss.indexOf("standard") !== -1) { + fileList = file.getFilteredFileList(startDir, /\.css$/, true); + if (fileList) { + for (i = 0; i < fileList.length; i++) { + fileName = fileList[i]; + logger.trace("Optimizing (" + config.optimizeCss + ") CSS file: " + fileName); + buildText += optimize.cssFile(fileName, fileName, config); + } + } + } + return buildText; + }, + + optimizers: { + uglify: function (fileName, fileContents, keepLines, config) { + var parser = uglify.parser, + processor = uglify.uglify, + ast, errMessage, errMatch; + + config = config || {}; + + logger.trace("Uglifying file: " + fileName); + + try { + ast = parser.parse(fileContents, config.strict_semicolons); + ast = processor.ast_mangle(ast, config); + ast = processor.ast_squeeze(ast, config); + + fileContents = processor.gen_code(ast, config); + + if (config.max_line_length) { + fileContents = processor.split_lines(fileContents, config.max_line_length); + } + } catch (e) { + errMessage = e.toString(); + errMatch = /\nError(\r)?\n/.exec(errMessage); + if (errMatch) { + errMessage = errMessage.substring(0, errMatch.index); + } + logger.error('Cannot uglify file: ' + fileName + '. Skipping it. Error is:\n' + errMessage); + } + return fileContents; + } + } + }; + + return optimize; +}); +/** + * @license RequireJS Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ +/* + * This file patches require.js to communicate with the build system. + */ + +//Using sloppy since this uses eval for some code like plugins, +//which may not be strict mode compliant. So if use strict is used +//below they will have strict rules applied and may cause an error. +/*jslint sloppy: true, nomen: true, plusplus: true, regexp: true */ +/*global require, define: true */ + +//NOT asking for require as a dependency since the goal is to modify the +//global require below +define('requirePatch', [ 'env!env/file', 'pragma', 'parse', 'lang', 'logger', 'commonJs'], +function (file, pragma, parse, lang, logger, commonJs) { + + var allowRun = true; + + //This method should be called when the patches to require should take hold. + return function () { + if (!allowRun) { + return; + } + allowRun = false; + + var layer, + pluginBuilderRegExp = /(["']?)pluginBuilder(["']?)\s*[=\:]\s*["']([^'"\s]+)["']/, + oldNewContext = require.s.newContext, + oldDef, + + //create local undefined values for module and exports, + //so that when files are evaled in this function they do not + //see the node values used for r.js + exports, + module; + + //Stored cached file contents for reuse in other layers. + require._cachedFileContents = {}; + + /** + * Makes sure the URL is something that can be supported by the + * optimization tool. + * @param {String} url + * @returns {Boolean} + */ + require._isSupportedBuildUrl = function (url) { + //Ignore URLs with protocols, hosts or question marks, means either network + //access is needed to fetch it or it is too dynamic. Note that + //on Windows, full paths are used for some urls, which include + //the drive, like c:/something, so need to test for something other + //than just a colon. + if (url.indexOf("://") === -1 && url.indexOf("?") === -1 && + url.indexOf('empty:') !== 0 && url.indexOf('//') !== 0) { + return true; + } else { + if (!layer.ignoredUrls[url]) { + logger.info('Cannot optimize network URL, skipping: ' + url); + layer.ignoredUrls[url] = true; + } + return false; + } + }; + + function normalizeUrlWithBase(context, moduleName, url) { + //Adjust the URL if it was not transformed to use baseUrl. + if (require.jsExtRegExp.test(moduleName)) { + url = (context.config.dir || context.config.dirBaseUrl) + url; + } + return url; + } + + //Overrides the new context call to add existing tracking features. + require.s.newContext = function (name) { + var context = oldNewContext(name), + oldEnable = context.enable, + moduleProto = context.Module.prototype, + oldInit = moduleProto.init, + oldCallPlugin = moduleProto.callPlugin; + + //Only do this for the context used for building. + if (name === '_') { + context.needFullExec = {}; + context.fullExec = {}; + context.plugins = {}; + + //Override the shim exports function generator to just + //spit out strings that can be used in the stringified + //build output. + context.makeShimExports = function (exports) { + var result; + if (typeof exports === 'string') { + result = function () { + return '(function (global) {\n' + + ' return function () {\n' + + ' return global.' + exports + ';\n' + + ' }\n' + + '}(this))'; + }; + } else { + result = function () { + return '(function (global) {\n' + + ' return function () {\n' + + ' var func = ' + exports.toString() + ';\n' + + ' return func.apply(global, arguments);\n' + + ' }\n' + + '}(this))'; + }; + } + + //Mark the result has being tranformed by the build already. + result.__buildReady = true; + return result; + }; + + context.enable = function (depMap, parent) { + var id = depMap.id, + parentId = parent && parent.map.id, + needFullExec = context.needFullExec, + fullExec = context.fullExec, + mod = context.registry[id]; + + if (mod && !mod.defined) { + if (parentId && needFullExec[parentId]) { + needFullExec[id] = true; + } + } else if ((needFullExec[id] && !fullExec[id]) || + (parentId && needFullExec[parentId] && !fullExec[id])) { + context.undef(id); + } + + return oldEnable.apply(context, arguments); + }; + + //Override load so that the file paths can be collected. + context.load = function (moduleName, url) { + /*jslint evil: true */ + var contents, pluginBuilderMatch, builderName; + + //Do not mark the url as fetched if it is + //not an empty: URL, used by the optimizer. + //In that case we need to be sure to call + //load() for each module that is mapped to + //empty: so that dependencies are satisfied + //correctly. + if (url.indexOf('empty:') === 0) { + delete context.urlFetched[url]; + } + + //Only handle urls that can be inlined, so that means avoiding some + //URLs like ones that require network access or may be too dynamic, + //like JSONP + if (require._isSupportedBuildUrl(url)) { + //Adjust the URL if it was not transformed to use baseUrl. + url = normalizeUrlWithBase(context, moduleName, url); + + //Save the module name to path and path to module name mappings. + layer.buildPathMap[moduleName] = url; + layer.buildFileToModule[url] = moduleName; + + if (context.plugins.hasOwnProperty(moduleName)) { + //plugins need to have their source evaled as-is. + context.needFullExec[moduleName] = true; + } + + try { + if (require._cachedFileContents.hasOwnProperty(url) && + (!context.needFullExec[moduleName] || context.fullExec[moduleName])) { + contents = require._cachedFileContents[url]; + } else { + //Load the file contents, process for conditionals, then + //evaluate it. + contents = file.readFile(url); + + if (context.config.cjsTranslate) { + contents = commonJs.convert(url, contents); + } + + //If there is a read filter, run it now. + if (context.config.onBuildRead) { + contents = context.config.onBuildRead(moduleName, url, contents); + } + + contents = pragma.process(url, contents, context.config, 'OnExecute'); + + //Find out if the file contains a require() definition. Need to know + //this so we can inject plugins right after it, but before they are needed, + //and to make sure this file is first, so that define calls work. + //This situation mainly occurs when the build is done on top of the output + //of another build, where the first build may include require somewhere in it. + try { + if (!layer.existingRequireUrl && parse.definesRequire(url, contents)) { + layer.existingRequireUrl = url; + } + } catch (e1) { + throw new Error('Parse error using UglifyJS ' + + 'for file: ' + url + '\n' + e1); + } + + if (context.plugins.hasOwnProperty(moduleName)) { + //This is a loader plugin, check to see if it has a build extension, + //otherwise the plugin will act as the plugin builder too. + pluginBuilderMatch = pluginBuilderRegExp.exec(contents); + if (pluginBuilderMatch) { + //Load the plugin builder for the plugin contents. + builderName = context.makeModuleMap(pluginBuilderMatch[3], + context.makeModuleMap(moduleName), + null, + true).id; + contents = file.readFile(context.nameToUrl(builderName)); + } + } + + //Parse out the require and define calls. + //Do this even for plugins in case they have their own + //dependencies that may be separate to how the pluginBuilder works. + try { + if (!context.needFullExec[moduleName]) { + contents = parse(moduleName, url, contents, { + insertNeedsDefine: true, + has: context.config.has, + findNestedDependencies: context.config.findNestedDependencies + }); + } + } catch (e2) { + throw new Error('Parse error using UglifyJS ' + + 'for file: ' + url + '\n' + e2); + } + + require._cachedFileContents[url] = contents; + } + + if (contents) { + eval(contents); + } + + //Need to close out completion of this module + //so that listeners will get notified that it is available. + try { + context.completeLoad(moduleName); + } catch (e) { + //Track which module could not complete loading. + if (!e.moduleTree) { + e.moduleTree = []; + } + e.moduleTree.push(moduleName); + throw e; + } + + } catch (eOuter) { + if (!eOuter.fileName) { + eOuter.fileName = url; + } + throw eOuter; + } + } else { + //With unsupported URLs still need to call completeLoad to + //finish loading. + context.completeLoad(moduleName); + } + }; + + //Marks module has having a name, and optionally executes the + //callback, but only if it meets certain criteria. + context.execCb = function (name, cb, args, exports) { + if (!layer.needsDefine[name]) { + layer.modulesWithNames[name] = true; + } + if (cb.__requireJsBuild || layer.context.needFullExec[name]) { + return cb.apply(exports, args); + } + return undefined; + }; + + moduleProto.init = function(depMaps) { + if (context.needFullExec[this.map.id]) { + lang.each(depMaps, lang.bind(this, function (depMap) { + if (typeof depMap === 'string') { + depMap = context.makeModuleMap(depMap, + (this.map.isDefine ? this.map : this.map.parentMap)); + } + + if (!context.fullExec[depMap.id]) { + context.undef(depMap.id); + } + })); + } + + return oldInit.apply(this, arguments); + }; + + moduleProto.callPlugin = function () { + var map = this.map, + pluginMap = context.makeModuleMap(map.prefix), + pluginId = pluginMap.id, + pluginMod = context.registry[pluginId]; + + context.plugins[pluginId] = true; + context.needFullExec[pluginId] = true; + + //If the module is not waiting to finish being defined, + //undef it and start over, to get full execution. + if (!context.fullExec[pluginId] && (!pluginMod || pluginMod.defined)) { + context.undef(pluginMap.id); + } + + return oldCallPlugin.apply(this, arguments); + }; + } + + return context; + }; + + //Clear up the existing context so that the newContext modifications + //above will be active. + delete require.s.contexts._; + + /** Reset state for each build layer pass. */ + require._buildReset = function () { + var oldContext = require.s.contexts._; + + //Clear up the existing context. + delete require.s.contexts._; + + //Set up new context, so the layer object can hold onto it. + require({}); + + layer = require._layer = { + buildPathMap: {}, + buildFileToModule: {}, + buildFilePaths: [], + pathAdded: {}, + modulesWithNames: {}, + needsDefine: {}, + existingRequireUrl: "", + ignoredUrls: {}, + context: require.s.contexts._ + }; + + //Return the previous context in case it is needed, like for + //the basic config object. + return oldContext; + }; + + require._buildReset(); + + //Override define() to catch modules that just define an object, so that + //a dummy define call is not put in the build file for them. They do + //not end up getting defined via context.execCb, so we need to catch them + //at the define call. + oldDef = define; + + //This function signature does not have to be exact, just match what we + //are looking for. + define = function (name) { + if (typeof name === "string" && !layer.needsDefine[name]) { + layer.modulesWithNames[name] = true; + } + return oldDef.apply(require, arguments); + }; + + define.amd = oldDef.amd; + + //Add some utilities for plugins + require._readFile = file.readFile; + require._fileExists = function (path) { + return file.exists(path); + }; + + //Called when execManager runs for a dependency. Used to figure out + //what order of execution. + require.onResourceLoad = function (context, map) { + var id = map.id, + url; + + //If build needed a full execution, indicate it + //has been done now. But only do it if the context is tracking + //that. Only valid for the context used in a build, not for + //other contexts being run, like for useLib, plain requirejs + //use in node/rhino. + if (context.needFullExec && context.needFullExec[id]) { + context.fullExec[id] = true; + } + + //A plugin. + if (map.prefix) { + if (!layer.pathAdded[id]) { + layer.buildFilePaths.push(id); + //For plugins the real path is not knowable, use the name + //for both module to file and file to module mappings. + layer.buildPathMap[id] = id; + layer.buildFileToModule[id] = id; + layer.modulesWithNames[id] = true; + layer.pathAdded[id] = true; + } + } else if (map.url && require._isSupportedBuildUrl(map.url)) { + //If the url has not been added to the layer yet, and it + //is from an actual file that was loaded, add it now. + url = normalizeUrlWithBase(context, id, map.url); + if (!layer.pathAdded[url] && layer.buildPathMap[id]) { + //Remember the list of dependencies for this layer. + layer.buildFilePaths.push(url); + layer.pathAdded[url] = true; + } + } + }; + + //Called by output of the parse() function, when a file does not + //explicitly call define, probably just require, but the parse() + //function normalizes on define() for dependency mapping and file + //ordering works correctly. + require.needsDefine = function (moduleName) { + layer.needsDefine[moduleName] = true; + }; + }; +}); +/** + * @license RequireJS Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ + +/*jslint */ +/*global define: false, console: false */ + +define('commonJs', ['env!env/file', 'parse'], function (file, parse) { + 'use strict'; + var commonJs = { + //Set to false if you do not want this file to log. Useful in environments + //like node where you want the work to happen without noise. + useLog: true, + + convertDir: function (commonJsPath, savePath) { + var fileList, i, + jsFileRegExp = /\.js$/, + fileName, convertedFileName, fileContents; + + //Get list of files to convert. + fileList = file.getFilteredFileList(commonJsPath, /\w/, true); + + //Normalize on front slashes and make sure the paths do not end in a slash. + commonJsPath = commonJsPath.replace(/\\/g, "/"); + savePath = savePath.replace(/\\/g, "/"); + if (commonJsPath.charAt(commonJsPath.length - 1) === "/") { + commonJsPath = commonJsPath.substring(0, commonJsPath.length - 1); + } + if (savePath.charAt(savePath.length - 1) === "/") { + savePath = savePath.substring(0, savePath.length - 1); + } + + //Cycle through all the JS files and convert them. + if (!fileList || !fileList.length) { + if (commonJs.useLog) { + if (commonJsPath === "convert") { + //A request just to convert one file. + console.log('\n\n' + commonJs.convert(savePath, file.readFile(savePath))); + } else { + console.log("No files to convert in directory: " + commonJsPath); + } + } + } else { + for (i = 0; i < fileList.length; i++) { + fileName = fileList[i]; + convertedFileName = fileName.replace(commonJsPath, savePath); + + //Handle JS files. + if (jsFileRegExp.test(fileName)) { + fileContents = file.readFile(fileName); + fileContents = commonJs.convert(fileName, fileContents); + file.saveUtf8File(convertedFileName, fileContents); + } else { + //Just copy the file over. + file.copyFile(fileName, convertedFileName, true); + } + } + } + }, + + /** + * Does the actual file conversion. + * + * @param {String} fileName the name of the file. + * + * @param {String} fileContents the contents of a file :) + * + * @returns {String} the converted contents + */ + convert: function (fileName, fileContents) { + //Strip out comments. + try { + var preamble = '', + commonJsProps = parse.usesCommonJs(fileName, fileContents); + + //First see if the module is not already RequireJS-formatted. + if (parse.usesAmdOrRequireJs(fileName, fileContents) || !commonJsProps) { + return fileContents; + } + + if (commonJsProps.dirname || commonJsProps.filename) { + preamble = 'var __filename = module.uri || "", ' + + '__dirname = __filename.substring(0, __filename.lastIndexOf("/") + 1);\n'; + } + + //Construct the wrapper boilerplate. + fileContents = 'define(function (require, exports, module) {\n' + + preamble + + fileContents + + '\n});\n'; + + } catch (e) { + console.log("commonJs.convert: COULD NOT CONVERT: " + fileName + ", so skipping it. Error was: " + e); + return fileContents; + } + + return fileContents; + } + }; + + return commonJs; +}); +/** + * @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ + +/*jslint plusplus: true, nomen: true, regexp: true */ +/*global define, require */ + + +define('build', [ 'lang', 'logger', 'env!env/file', 'parse', 'optimize', 'pragma', + 'transform', 'env!env/load', 'requirePatch', 'env!env/quit', + 'commonJs'], +function (lang, logger, file, parse, optimize, pragma, + transform, load, requirePatch, quit, + commonJs) { + 'use strict'; + + var build, buildBaseConfig, + endsWithSemiColonRegExp = /;\s*$/; + + buildBaseConfig = { + appDir: "", + pragmas: {}, + paths: {}, + optimize: "uglify", + optimizeCss: "standard.keepLines", + inlineText: true, + isBuild: true, + optimizeAllPluginResources: false, + findNestedDependencies: false, + preserveLicenseComments: true, + //By default, all files/directories are copied, unless + //they match this regexp, by default just excludes .folders + dirExclusionRegExp: file.dirExclusionRegExp + }; + + /** + * Some JS may not be valid if concatenated with other JS, in particular + * the style of omitting semicolons and rely on ASI. Add a semicolon in + * those cases. + */ + function addSemiColon(text) { + if (endsWithSemiColonRegExp.test(text)) { + return text; + } else { + return text + ";"; + } + } + + function endsWithSlash(dirName) { + if (dirName.charAt(dirName.length - 1) !== "/") { + dirName += "/"; + } + return dirName; + } + + //Method used by plugin writeFile calls, defined up here to avoid + //jslint warning about "making a function in a loop". + function makeWriteFile(namespace, layer) { + function writeFile(name, contents) { + logger.trace('Saving plugin-optimized file: ' + name); + file.saveUtf8File(name, contents); + } + + writeFile.asModule = function (moduleName, fileName, contents) { + writeFile(fileName, + build.toTransport(namespace, moduleName, fileName, contents, layer)); + }; + + return writeFile; + } + + /** + * Main API entry point into the build. The args argument can either be + * an array of arguments (like the onese passed on a command-line), + * or it can be a JavaScript object that has the format of a build profile + * file. + * + * If it is an object, then in addition to the normal properties allowed in + * a build profile file, the object should contain one other property: + * + * The object could also contain a "buildFile" property, which is a string + * that is the file path to a build profile that contains the rest + * of the build profile directives. + * + * This function does not return a status, it should throw an error if + * there is a problem completing the build. + */ + build = function (args) { + var stackRegExp = /( {4}at[^\n]+)\n/, + standardIndent = ' ', + buildFile, cmdConfig, errorMsg, errorStack, stackMatch, errorTree, + i, j, errorMod; + + try { + if (!args || lang.isArray(args)) { + if (!args || args.length < 1) { + logger.error("build.js buildProfile.js\n" + + "where buildProfile.js is the name of the build file (see example.build.js for hints on how to make a build file)."); + return undefined; + } + + //Next args can include a build file path as well as other build args. + //build file path comes first. If it does not contain an = then it is + //a build file path. Otherwise, just all build args. + if (args[0].indexOf("=") === -1) { + buildFile = args[0]; + args.splice(0, 1); + } + + //Remaining args are options to the build + cmdConfig = build.convertArrayToObject(args); + cmdConfig.buildFile = buildFile; + } else { + cmdConfig = args; + } + + return build._run(cmdConfig); + } catch (e) { + errorMsg = e.toString(); + errorTree = e.moduleTree; + stackMatch = stackRegExp.exec(errorMsg); + + if (stackMatch) { + errorMsg += errorMsg.substring(0, stackMatch.index + stackMatch[0].length + 1); + } + + //If a module tree that shows what module triggered the error, + //print it out. + if (errorTree && errorTree.length > 0) { + errorMsg += '\nIn module tree:\n'; + + for (i = errorTree.length - 1; i > -1; i--) { + errorMod = errorTree[i]; + if (errorMod) { + for (j = errorTree.length - i; j > -1; j--) { + errorMsg += standardIndent; + } + errorMsg += errorMod + '\n'; + } + } + + logger.error(errorMsg); + } + + errorStack = e.stack; + + if (typeof args === 'string' && args.indexOf('stacktrace=true') !== -1) { + errorMsg += '\n' + errorStack; + } else { + if (!stackMatch && errorStack) { + //Just trim out the first "at" in the stack. + stackMatch = stackRegExp.exec(errorStack); + if (stackMatch) { + errorMsg += '\n' + stackMatch[0] || ''; + } + } + } + + if (logger.level > logger.ERROR) { + throw new Error(errorMsg); + } else { + logger.error(errorMsg); + quit(1); + } + } + }; + + build._run = function (cmdConfig) { + var buildFileContents = "", + pluginCollector = {}, + buildPaths, fileName, fileNames, + prop, paths, i, + baseConfig, config, + modules, builtModule, srcPath, buildContext, + destPath, moduleName, moduleMap, parentModuleMap, context, + resources, resource, pluginProcessed = {}, plugin, fileContents; + + //Can now run the patches to require.js to allow it to be used for + //build generation. Do it here instead of at the top of the module + //because we want normal require behavior to load the build tool + //then want to switch to build mode. + requirePatch(); + + config = build.createConfig(cmdConfig); + paths = config.paths; + + if (config.logLevel) { + logger.logLevel(config.logLevel); + } + + //Remove the previous build dir, in case it contains source transforms, + //like the ones done with onBuildRead and onBuildWrite. + if (config.dir && !config.keepBuildDir && file.exists(config.dir)) { + file.deleteFile(config.dir); + } + + if (!config.out && !config.cssIn) { + //This is not just a one-off file build but a full build profile, with + //lots of files to process. + + //First copy all the baseUrl content + file.copyDir((config.appDir || config.baseUrl), config.dir, /\w/, true); + + //Adjust baseUrl if config.appDir is in play, and set up build output paths. + buildPaths = {}; + if (config.appDir) { + //All the paths should be inside the appDir, so just adjust + //the paths to use the dirBaseUrl + for (prop in paths) { + if (paths.hasOwnProperty(prop)) { + buildPaths[prop] = paths[prop].replace(config.appDir, config.dir); + } + } + } else { + //If no appDir, then make sure to copy the other paths to this directory. + for (prop in paths) { + if (paths.hasOwnProperty(prop)) { + //Set up build path for each path prefix, but only do so + //if the path falls out of the current baseUrl + if (paths[prop].indexOf(config.baseUrl) === 0) { + buildPaths[prop] = paths[prop].replace(config.baseUrl, config.dirBaseUrl); + } else { + buildPaths[prop] = paths[prop] === 'empty:' ? 'empty:' : prop.replace(/\./g, "/"); + + //Make sure source path is fully formed with baseUrl, + //if it is a relative URL. + srcPath = paths[prop]; + if (srcPath.indexOf('/') !== 0 && srcPath.indexOf(':') === -1) { + srcPath = config.baseUrl + srcPath; + } + + destPath = config.dirBaseUrl + buildPaths[prop]; + + //Skip empty: paths + if (srcPath !== 'empty:') { + //If the srcPath is a directory, copy the whole directory. + if (file.exists(srcPath) && file.isDirectory(srcPath)) { + //Copy files to build area. Copy all files (the /\w/ regexp) + file.copyDir(srcPath, destPath, /\w/, true); + } else { + //Try a .js extension + srcPath += '.js'; + destPath += '.js'; + file.copyFile(srcPath, destPath); + } + } + } + } + } + } + } + + //Figure out source file location for each module layer. Do this by seeding require + //with source area configuration. This is needed so that later the module layers + //can be manually copied over to the source area, since the build may be + //require multiple times and the above copyDir call only copies newer files. + require({ + baseUrl: config.baseUrl, + paths: paths, + packagePaths: config.packagePaths, + packages: config.packages + }); + buildContext = require.s.contexts._; + modules = config.modules; + + if (modules) { + modules.forEach(function (module) { + if (module.name) { + module._sourcePath = buildContext.nameToUrl(module.name); + //If the module does not exist, and this is not a "new" module layer, + //as indicated by a true "create" property on the module, and + //it is not a plugin-loaded resource, then throw an error. + if (!file.exists(module._sourcePath) && !module.create && + module.name.indexOf('!') === -1) { + throw new Error("ERROR: module path does not exist: " + + module._sourcePath + " for module named: " + module.name + + ". Path is relative to: " + file.absPath('.')); + } + } + }); + } + + if (config.out) { + //Just set up the _buildPath for the module layer. + require(config); + if (!config.cssIn) { + config.modules[0]._buildPath = typeof config.out === 'function' ? + 'FUNCTION' : config.out; + } + } else if (!config.cssIn) { + //Now set up the config for require to use the build area, and calculate the + //build file locations. Pass along any config info too. + baseConfig = { + baseUrl: config.dirBaseUrl, + paths: buildPaths + }; + + lang.mixin(baseConfig, config); + require(baseConfig); + + if (modules) { + modules.forEach(function (module) { + if (module.name) { + module._buildPath = buildContext.nameToUrl(module.name, null); + if (!module.create) { + file.copyFile(module._sourcePath, module._buildPath); + } + } + }); + } + } + + //Run CSS optimizations before doing JS module tracing, to allow + //things like text loader plugins loading CSS to get the optimized + //CSS. + if (config.optimizeCss && config.optimizeCss !== "none" && config.dir) { + buildFileContents += optimize.css(config.dir, config); + } + + if (modules) { + //For each module layer, call require to calculate dependencies. + modules.forEach(function (module) { + module.layer = build.traceDependencies(module, config); + }); + + //Now build up shadow layers for anything that should be excluded. + //Do this after tracing dependencies for each module, in case one + //of those modules end up being one of the excluded values. + modules.forEach(function (module) { + if (module.exclude) { + module.excludeLayers = []; + module.exclude.forEach(function (exclude, i) { + //See if it is already in the list of modules. + //If not trace dependencies for it. + module.excludeLayers[i] = build.findBuildModule(exclude, modules) || + {layer: build.traceDependencies({name: exclude}, config)}; + }); + } + }); + + modules.forEach(function (module) { + if (module.exclude) { + //module.exclude is an array of module names. For each one, + //get the nested dependencies for it via a matching entry + //in the module.excludeLayers array. + module.exclude.forEach(function (excludeModule, i) { + var excludeLayer = module.excludeLayers[i].layer, map = excludeLayer.buildPathMap, prop; + for (prop in map) { + if (map.hasOwnProperty(prop)) { + build.removeModulePath(prop, map[prop], module.layer); + } + } + }); + } + if (module.excludeShallow) { + //module.excludeShallow is an array of module names. + //shallow exclusions are just that module itself, and not + //its nested dependencies. + module.excludeShallow.forEach(function (excludeShallowModule) { + var path = module.layer.buildPathMap[excludeShallowModule]; + if (path) { + build.removeModulePath(excludeShallowModule, path, module.layer); + } + }); + } + + //Flatten them and collect the build output for each module. + builtModule = build.flattenModule(module, module.layer, config); + + //Save it to a temp file for now, in case there are other layers that + //contain optimized content that should not be included in later + //layer optimizations. See issue #56. + if (module._buildPath === 'FUNCTION') { + module._buildText = builtModule.text; + } else { + file.saveUtf8File(module._buildPath + '-temp', builtModule.text); + } + buildFileContents += builtModule.buildText; + }); + + //Now move the build layers to their final position. + modules.forEach(function (module) { + var finalPath = module._buildPath; + if (finalPath !== 'FUNCTION') { + if (file.exists(finalPath)) { + file.deleteFile(finalPath); + } + file.renameFile(finalPath + '-temp', finalPath); + + //And finally, if removeCombined is specified, remove + //any of the files that were used in this layer. + //Be sure not to remove other build layers. + if (config.removeCombined) { + module.layer.buildFilePaths.forEach(function (path) { + if (file.exists(path) && !modules.some(function (mod) { + return mod._buildPath === path; + })) { + file.deleteFile(path); + } + }); + } + } + }); + } + + //If removeCombined in play, remove any empty directories that + //may now exist because of its use + if (config.removeCombined && !config.out && config.dir) { + file.deleteEmptyDirs(config.dir); + } + + //Do other optimizations. + if (config.out && !config.cssIn) { + //Just need to worry about one JS file. + fileName = config.modules[0]._buildPath; + if (fileName === 'FUNCTION') { + config.modules[0]._buildText = optimize.js(fileName, + config.modules[0]._buildText, + config); + } else { + optimize.jsFile(fileName, null, fileName, config); + } + } else if (!config.cssIn) { + //Normal optimizations across modules. + + //JS optimizations. + fileNames = file.getFilteredFileList(config.dir, /\.js$/, true); + for (i = 0; i < fileNames.length; i++) { + fileName = fileNames[i]; + + //Generate the module name from the config.dir root. + moduleName = fileName.replace(config.dir, ''); + //Get rid of the extension + moduleName = moduleName.substring(0, moduleName.length - 3); + + //Convert the file to transport format, but without a name + //inserted (by passing null for moduleName) since the files are + //standalone, one module per file. + fileContents = file.readFile(fileName); + + //For builds, if wanting cjs translation, do it now, so that + //the individual modules can be loaded cross domain via + //plain script tags. + if (config.cjsTranslate) { + fileContents = commonJs.convert(fileName, fileContents); + } + + fileContents = build.toTransport(config.namespace, + null, + fileName, + fileContents); + + optimize.jsFile(fileName, fileContents, fileName, config, pluginCollector); + } + + //Normalize all the plugin resources. + context = require.s.contexts._; + + for (moduleName in pluginCollector) { + if (pluginCollector.hasOwnProperty(moduleName)) { + parentModuleMap = context.makeModuleMap(moduleName); + resources = pluginCollector[moduleName]; + for (i = 0; i < resources.length; i++) { + resource = resources[i]; + moduleMap = context.makeModuleMap(resource, parentModuleMap); + if (!context.plugins[moduleMap.prefix]) { + //Set the value in context.plugins so it + //will be evaluated as a full plugin. + context.plugins[moduleMap.prefix] = true; + + //Do not bother if the plugin is not available. + if (!file.exists(require.toUrl(moduleMap.prefix + '.js'))) { + continue; + } + + //Rely on the require in the build environment + //to be synchronous + context.require([moduleMap.prefix]); + + //Now that the plugin is loaded, redo the moduleMap + //since the plugin will need to normalize part of the path. + moduleMap = context.makeModuleMap(resource, parentModuleMap); + } + + //Only bother with plugin resources that can be handled + //processed by the plugin, via support of the writeFile + //method. + if (!pluginProcessed[moduleMap.id]) { + //Only do the work if the plugin was really loaded. + //Using an internal access because the file may + //not really be loaded. + plugin = context.defined[moduleMap.prefix]; + if (plugin && plugin.writeFile) { + plugin.writeFile( + moduleMap.prefix, + moduleMap.name, + require, + makeWriteFile( + config.namespace + ), + context.config + ); + } + + pluginProcessed[moduleMap.id] = true; + } + } + + } + } + + //console.log('PLUGIN COLLECTOR: ' + JSON.stringify(pluginCollector, null, " ")); + + + //All module layers are done, write out the build.txt file. + file.saveUtf8File(config.dir + "build.txt", buildFileContents); + } + + //If just have one CSS file to optimize, do that here. + if (config.cssIn) { + buildFileContents += optimize.cssFile(config.cssIn, config.out, config); + } + + if (typeof config.out === 'function') { + config.out(config.modules[0]._buildText); + } + + //Print out what was built into which layers. + if (buildFileContents) { + logger.info(buildFileContents); + return buildFileContents; + } + + return ''; + }; + + /** + * Converts command line args like "paths.foo=../some/path" + * result.paths = { foo: '../some/path' } where prop = paths, + * name = paths.foo and value = ../some/path, so it assumes the + * name=value splitting has already happened. + */ + function stringDotToObj(result, name, value) { + var parts = name.split('.'), + prop = parts[0]; + + parts.forEach(function (prop, i) { + if (i === parts.length - 1) { + result[prop] = value; + } else { + if (!result[prop]) { + result[prop] = {}; + } + result = result[prop]; + } + + }); + } + + //Used by convertArrayToObject to convert some things from prop.name=value + //to a prop: { name: value} + build.dotProps = [ + 'paths.', + 'wrap.', + 'pragmas.', + 'pragmasOnSave.', + 'has.', + 'hasOnSave.', + 'wrap.', + 'uglify.', + 'closure.' + ]; + + build.hasDotPropMatch = function (prop) { + return build.dotProps.some(function (dotProp) { + return prop.indexOf(dotProp) === 0; + }); + }; + + /** + * Converts an array that has String members of "name=value" + * into an object, where the properties on the object are the names in the array. + * Also converts the strings "true" and "false" to booleans for the values. + * member name/value pairs, and converts some comma-separated lists into + * arrays. + * @param {Array} ary + */ + build.convertArrayToObject = function (ary) { + var result = {}, i, separatorIndex, prop, value, + needArray = { + "include": true, + "exclude": true, + "excludeShallow": true, + "insertRequire": true + }; + + for (i = 0; i < ary.length; i++) { + separatorIndex = ary[i].indexOf("="); + if (separatorIndex === -1) { + throw "Malformed name/value pair: [" + ary[i] + "]. Format should be name=value"; + } + + value = ary[i].substring(separatorIndex + 1, ary[i].length); + if (value === "true") { + value = true; + } else if (value === "false") { + value = false; + } + + prop = ary[i].substring(0, separatorIndex); + + //Convert to array if necessary + if (needArray[prop]) { + value = value.split(","); + } + + if (build.hasDotPropMatch(prop)) { + stringDotToObj(result, prop, value); + } else { + result[prop] = value; + } + } + return result; //Object + }; + + build.makeAbsPath = function (path, absFilePath) { + //Add abspath if necessary. If path starts with a slash or has a colon, + //then already is an abolute path. + if (path.indexOf('/') !== 0 && path.indexOf(':') === -1) { + path = absFilePath + + (absFilePath.charAt(absFilePath.length - 1) === '/' ? '' : '/') + + path; + path = file.normalize(path); + } + return path.replace(lang.backSlashRegExp, '/'); + }; + + build.makeAbsObject = function (props, obj, absFilePath) { + var i, prop; + if (obj) { + for (i = 0; i < props.length; i++) { + prop = props[i]; + if (obj.hasOwnProperty(prop) && typeof obj[prop] === 'string') { + obj[prop] = build.makeAbsPath(obj[prop], absFilePath); + } + } + } + }; + + /** + * For any path in a possible config, make it absolute relative + * to the absFilePath passed in. + */ + build.makeAbsConfig = function (config, absFilePath) { + var props, prop, i; + + props = ["appDir", "dir", "baseUrl"]; + for (i = 0; i < props.length; i++) { + prop = props[i]; + + if (config[prop]) { + //Add abspath if necessary, make sure these paths end in + //slashes + if (prop === "baseUrl") { + config.originalBaseUrl = config.baseUrl; + if (config.appDir) { + //If baseUrl with an appDir, the baseUrl is relative to + //the appDir, *not* the absFilePath. appDir and dir are + //made absolute before baseUrl, so this will work. + config.baseUrl = build.makeAbsPath(config.originalBaseUrl, config.appDir); + } else { + //The dir output baseUrl is same as regular baseUrl, both + //relative to the absFilePath. + config.baseUrl = build.makeAbsPath(config[prop], absFilePath); + } + } else { + config[prop] = build.makeAbsPath(config[prop], absFilePath); + } + + config[prop] = endsWithSlash(config[prop]); + } + } + + //Do not allow URLs for paths resources. + if (config.paths) { + for (prop in config.paths) { + if (config.paths.hasOwnProperty(prop)) { + config.paths[prop] = build.makeAbsPath(config.paths[prop], + (config.baseUrl || absFilePath)); + } + } + } + + build.makeAbsObject(["out", "cssIn"], config, absFilePath); + build.makeAbsObject(["startFile", "endFile"], config.wrap, absFilePath); + }; + + build.nestedMix = { + paths: true, + has: true, + hasOnSave: true, + pragmas: true, + pragmasOnSave: true + }; + + /** + * Mixes additional source config into target config, and merges some + * nested config, like paths, correctly. + */ + function mixConfig(target, source) { + var prop, value; + + for (prop in source) { + if (source.hasOwnProperty(prop)) { + //If the value of the property is a plain object, then + //allow a one-level-deep mixing of it. + value = source[prop]; + if (typeof value === 'object' && value && + !lang.isArray(value) && !lang.isFunction(value) && + !lang.isRegExp(value)) { + target[prop] = lang.mixin({}, target[prop], value, true); + } else { + target[prop] = value; + } + } + } + } + + /** + * Creates a config object for an optimization build. + * It will also read the build profile if it is available, to create + * the configuration. + * + * @param {Object} cfg config options that take priority + * over defaults and ones in the build file. These options could + * be from a command line, for instance. + * + * @param {Object} the created config object. + */ + build.createConfig = function (cfg) { + /*jslint evil: true */ + var config = {}, buildFileContents, buildFileConfig, mainConfig, + mainConfigFile, mainConfigPath, prop, buildFile, absFilePath; + + //Make sure all paths are relative to current directory. + absFilePath = file.absPath('.'); + build.makeAbsConfig(cfg, absFilePath); + build.makeAbsConfig(buildBaseConfig, absFilePath); + + lang.mixin(config, buildBaseConfig); + lang.mixin(config, cfg, true); + + if (config.buildFile) { + //A build file exists, load it to get more config. + buildFile = file.absPath(config.buildFile); + + //Find the build file, and make sure it exists, if this is a build + //that has a build profile, and not just command line args with an in=path + if (!file.exists(buildFile)) { + throw new Error("ERROR: build file does not exist: " + buildFile); + } + + absFilePath = config.baseUrl = file.absPath(file.parent(buildFile)); + + //Load build file options. + buildFileContents = file.readFile(buildFile); + try { + buildFileConfig = eval("(" + buildFileContents + ")"); + build.makeAbsConfig(buildFileConfig, absFilePath); + + //Mix in the config now so that items in mainConfigFile can + //be resolved relative to them if necessary, like if appDir + //is set here, but the baseUrl is in mainConfigFile. Will + //re-mix in the same build config later after mainConfigFile + //is processed, since build config should take priority. + mixConfig(config, buildFileConfig); + } catch (e) { + throw new Error("Build file " + buildFile + " is malformed: " + e); + } + } + + mainConfigFile = config.mainConfigFile || (buildFileConfig && buildFileConfig.mainConfigFile); + if (mainConfigFile) { + mainConfigFile = build.makeAbsPath(mainConfigFile, absFilePath); + if (!file.exists(mainConfigFile)) { + throw new Error(mainConfigFile + ' does not exist.'); + } + try { + mainConfig = parse.findConfig(mainConfigFile, file.readFile(mainConfigFile)); + } catch (configError) { + throw new Error('The config in mainConfigFile ' + + mainConfigFile + + ' cannot be used because it cannot be evaluated' + + ' correctly while running in the optimizer. Try only' + + ' using a config that is also valid JSON, or do not use' + + ' mainConfigFile and instead copy the config values needed' + + ' into a build file or command line arguments given to the optimizer.'); + } + if (mainConfig) { + mainConfigPath = mainConfigFile.substring(0, mainConfigFile.lastIndexOf('/')); + + //Add in some existing config, like appDir, since they can be + //used inside the mainConfigFile -- paths and baseUrl are + //relative to them. + if (config.appDir && !mainConfig.appDir) { + mainConfig.appDir = config.appDir; + } + + //If no baseUrl, then use the directory holding the main config. + if (!mainConfig.baseUrl) { + mainConfig.baseUrl = mainConfigPath; + } + + build.makeAbsConfig(mainConfig, mainConfigPath); + mixConfig(config, mainConfig); + } + } + + //Mix in build file config, but only after mainConfig has been mixed in. + if (buildFileConfig) { + mixConfig(config, buildFileConfig); + } + + //Re-apply the override config values. Command line + //args should take precedence over build file values. + mixConfig(config, cfg); + + //Set final output dir + if (config.hasOwnProperty("baseUrl")) { + if (config.appDir) { + config.dirBaseUrl = build.makeAbsPath(config.originalBaseUrl, config.dir); + } else { + config.dirBaseUrl = config.dir || config.baseUrl; + } + //Make sure dirBaseUrl ends in a slash, since it is + //concatenated with other strings. + config.dirBaseUrl = endsWithSlash(config.dirBaseUrl); + } + + //Check for errors in config + if (config.main) { + throw new Error('"main" passed as an option, but the ' + + 'supported option is called "name".'); + } + if (!config.name && !config.modules && !config.include && !config.cssIn) { + throw new Error('Missing either a "name", "include" or "modules" ' + + 'option'); + } + if (config.cssIn && !config.out) { + throw new Error("ERROR: 'out' option missing."); + } + if (!config.cssIn && !config.baseUrl) { + //Just use the current directory as the baseUrl + config.baseUrl = './'; + } + if (!config.out && !config.dir) { + throw new Error('Missing either an "out" or "dir" config value. ' + + 'If using "appDir" for a full project optimization, ' + + 'use "dir". If you want to optimize to one file, ' + + 'use "out".'); + } + if (config.appDir && config.out) { + throw new Error('"appDir" is not compatible with "out". Use "dir" ' + + 'instead. appDir is used to copy whole projects, ' + + 'where "out" is used to just optimize to one file.'); + } + if (config.out && config.dir) { + throw new Error('The "out" and "dir" options are incompatible.' + + ' Use "out" if you are targeting a single file for' + + ' for optimization, and "dir" if you want the appDir' + + ' or baseUrl directories optimized.'); + } + + if (config.insertRequire && !lang.isArray(config.insertRequire)) { + throw new Error('insertRequire should be a list of module IDs' + + ' to insert in to a require([]) call.'); + } + + if ((config.name || config.include) && !config.modules) { + //Just need to build one file, but may be part of a whole appDir/ + //baseUrl copy, but specified on the command line, so cannot do + //the modules array setup. So create a modules section in that + //case. + config.modules = [ + { + name: config.name, + out: config.out, + include: config.include, + exclude: config.exclude, + excludeShallow: config.excludeShallow, + insertRequire: config.insertRequire + } + ]; + } else if (config.modules && config.out) { + throw new Error('If the "modules" option is used, then there ' + + 'should be a "dir" option set and "out" should ' + + 'not be used since "out" is only for single file ' + + 'optimization output.'); + } else if (config.modules && config.name) { + throw new Error('"name" and "modules" options are incompatible. ' + + 'Either use "name" if doing a single file ' + + 'optimization, or "modules" if you want to target ' + + 'more than one file for optimization.'); + } + + if (config.out && !config.cssIn) { + //Just one file to optimize. + + //Does not have a build file, so set up some defaults. + //Optimizing CSS should not be allowed, unless explicitly + //asked for on command line. In that case the only task is + //to optimize a CSS file. + if (!cfg.optimizeCss) { + config.optimizeCss = "none"; + } + } + + //Create a hash lookup for the stubModules config to make lookup + //cheaper later. + if (config.stubModules) { + config.stubModules._byName = {}; + config.stubModules.forEach(function (id) { + config.stubModules._byName[id] = true; + }); + } + + //Get any wrap text. + try { + if (config.wrap) { + if (config.wrap === true) { + //Use default values. + config.wrap = { + start: '(function () {', + end: '}());' + }; + } else { + config.wrap.start = config.wrap.start || + file.readFile(build.makeAbsPath(config.wrap.startFile, absFilePath)); + config.wrap.end = config.wrap.end || + file.readFile(build.makeAbsPath(config.wrap.endFile, absFilePath)); + } + } + } catch (wrapError) { + throw new Error('Malformed wrap config: need both start/end or ' + + 'startFile/endFile: ' + wrapError.toString()); + } + + //Do final input verification + if (config.context) { + throw new Error('The build argument "context" is not supported' + + ' in a build. It should only be used in web' + + ' pages.'); + } + + //Set file.fileExclusionRegExp if desired + if (config.hasOwnProperty('fileExclusionRegExp')) { + if (typeof config.fileExclusionRegExp === "string") { + file.exclusionRegExp = new RegExp(config.fileExclusionRegExp); + } else { + file.exclusionRegExp = config.fileExclusionRegExp; + } + } else if (config.hasOwnProperty('dirExclusionRegExp')) { + //Set file.dirExclusionRegExp if desired, this is the old + //name for fileExclusionRegExp before 1.0.2. Support for backwards + //compatibility + file.exclusionRegExp = config.dirExclusionRegExp; + } + + //Remove things that may cause problems in the build. + delete config.jQuery; + + return config; + }; + + /** + * finds the module being built/optimized with the given moduleName, + * or returns null. + * @param {String} moduleName + * @param {Array} modules + * @returns {Object} the module object from the build profile, or null. + */ + build.findBuildModule = function (moduleName, modules) { + var i, module; + for (i = 0; i < modules.length; i++) { + module = modules[i]; + if (module.name === moduleName) { + return module; + } + } + return null; + }; + + /** + * Removes a module name and path from a layer, if it is supposed to be + * excluded from the layer. + * @param {String} moduleName the name of the module + * @param {String} path the file path for the module + * @param {Object} layer the layer to remove the module/path from + */ + build.removeModulePath = function (module, path, layer) { + var index = layer.buildFilePaths.indexOf(path); + if (index !== -1) { + layer.buildFilePaths.splice(index, 1); + } + }; + + /** + * Uses the module build config object to trace the dependencies for the + * given module. + * + * @param {Object} module the module object from the build config info. + * @param {Object} the build config object. + * + * @returns {Object} layer information about what paths and modules should + * be in the flattened module. + */ + build.traceDependencies = function (module, config) { + var include, override, layer, context, baseConfig, oldContext, + registry, id, idParts, pluginId, + errMessage = '', + failedPluginMap = {}, + failedPluginIds = [], + errIds = [], + errUrlMap = {}, + errUrlConflicts = {}, + hasErrUrl = false, + errUrl, prop; + + //Reset some state set up in requirePatch.js, and clean up require's + //current context. + oldContext = require._buildReset(); + + //Grab the reset layer and context after the reset, but keep the + //old config to reuse in the new context. + baseConfig = oldContext.config; + layer = require._layer; + context = layer.context; + + //Put back basic config, use a fresh object for it. + //WARNING: probably not robust for paths and packages/packagePaths, + //since those property's objects can be modified. But for basic + //config clone it works out. + require(lang.mixin({}, baseConfig, true)); + + logger.trace("\nTracing dependencies for: " + (module.name || module.out)); + include = module.name && !module.create ? [module.name] : []; + if (module.include) { + include = include.concat(module.include); + } + + //If there are overrides to basic config, set that up now.; + if (module.override) { + override = lang.mixin({}, baseConfig, true); + lang.mixin(override, module.override, true); + require(override); + } + + //Figure out module layer dependencies by calling require to do the work. + require(include); + + //Reset config + if (module.override) { + require(baseConfig); + } + + //Check to see if it all loaded. If not, then stop, and give + //a message on what is left. + registry = context.registry; + for (id in registry) { + if (registry.hasOwnProperty(id) && id.indexOf('_@r') !== 0) { + if (id.indexOf('_unnormalized') === -1 && registry[id].enabled) { + errIds.push(id); + errUrl = registry[id].map.url; + + if (errUrlMap[errUrl]) { + hasErrUrl = true; + //This error module has the same URL as another + //error module, could be misconfiguration. + if (!errUrlConflicts[errUrl]) { + errUrlConflicts[errUrl] = []; + //Store the original module that had the same URL. + errUrlConflicts[errUrl].push(errUrlMap[errUrl]); + } + errUrlConflicts[errUrl].push(id); + } else { + errUrlMap[errUrl] = id; + } + } + + //Look for plugins that did not call load() + idParts = id.split('!'); + pluginId = idParts[0]; + if (idParts.length > 1 && !failedPluginMap.hasOwnProperty(pluginId)) { + failedPluginIds.push(pluginId); + failedPluginMap[pluginId] = true; + } + } + } + + if (errIds.length || failedPluginIds.length) { + if (failedPluginIds.length) { + errMessage += 'Loader plugin' + + (failedPluginIds.length === 1 ? '' : 's') + + ' did not call ' + + 'the load callback in the build: ' + + failedPluginIds.join(', ') + '\n'; + } + errMessage += 'Module loading did not complete for: ' + errIds.join(', '); + + if (hasErrUrl) { + errMessage += '\nThe following modules share the same URL. This ' + + 'could be a misconfiguration if that URL only has ' + + 'one anonymous module in it:'; + for (prop in errUrlConflicts) { + if (errUrlConflicts.hasOwnProperty(prop)) { + errMessage += '\n' + prop + ': ' + + errUrlConflicts[prop].join(', '); + } + } + } + throw new Error(errMessage); + } + + return layer; + }; + + /** + * Uses the module build config object to create an flattened version + * of the module, with deep dependencies included. + * + * @param {Object} module the module object from the build config info. + * + * @param {Object} layer the layer object returned from build.traceDependencies. + * + * @param {Object} the build config object. + * + * @returns {Object} with two properties: "text", the text of the flattened + * module, and "buildText", a string of text representing which files were + * included in the flattened module text. + */ + build.flattenModule = function (module, layer, config) { + var buildFileContents = "", + namespace = config.namespace || '', + namespaceWithDot = namespace ? namespace + '.' : '', + stubModulesByName = (config.stubModules && config.stubModules._byName) || {}, + context = layer.context, + path, reqIndex, fileContents, currContents, + i, moduleName, shim, packageConfig, + parts, builder, writeApi; + + //Use override settings, particularly for pragmas + if (module.override) { + config = lang.mixin({}, config, true); + lang.mixin(config, module.override, true); + } + + //Start build output for the module. + buildFileContents += "\n" + + (config.dir ? module._buildPath.replace(config.dir, "") : module._buildPath) + + "\n----------------\n"; + + //If there was an existing file with require in it, hoist to the top. + if (layer.existingRequireUrl) { + reqIndex = layer.buildFilePaths.indexOf(layer.existingRequireUrl); + if (reqIndex !== -1) { + layer.buildFilePaths.splice(reqIndex, 1); + layer.buildFilePaths.unshift(layer.existingRequireUrl); + } + } + + //Write the built module to disk, and build up the build output. + fileContents = ""; + for (i = 0; i < layer.buildFilePaths.length; i++) { + path = layer.buildFilePaths[i]; + moduleName = layer.buildFileToModule[path]; + + //If the moduleName is for a package main, then update it to the + //real main value. + packageConfig = layer.context.config.pkgs && + layer.context.config.pkgs[moduleName]; + if (packageConfig) { + moduleName += '/' + packageConfig.main; + } + + //Figure out if the module is a result of a build plugin, and if so, + //then delegate to that plugin. + parts = context.makeModuleMap(moduleName); + builder = parts.prefix && context.defined[parts.prefix]; + if (builder) { + if (builder.write) { + writeApi = function (input) { + fileContents += "\n" + addSemiColon(input); + if (config.onBuildWrite) { + fileContents = config.onBuildWrite(moduleName, path, fileContents); + } + }; + writeApi.asModule = function (moduleName, input) { + fileContents += "\n" + + addSemiColon( + build.toTransport(namespace, moduleName, path, input, layer, { + useSourceUrl: layer.context.config.useSourceUrl + })); + if (config.onBuildWrite) { + fileContents = config.onBuildWrite(moduleName, path, fileContents); + } + }; + builder.write(parts.prefix, parts.name, writeApi); + } + } else { + if (stubModulesByName.hasOwnProperty(moduleName)) { + //Just want to insert a simple module definition instead + //of the source module. Useful for plugins that inline + //all their resources. + if (layer.context.plugins.hasOwnProperty(moduleName)) { + //Slightly different content for plugins, to indicate + //that dynamic loading will not work. + currContents = 'define({load: function(id){throw new Error("Dynamic load not allowed: " + id);}});'; + } else { + currContents = 'define({});'; + } + } else { + currContents = file.readFile(path); + } + + if (config.cjsTranslate) { + currContents = commonJs.convert(path, currContents); + } + + if (config.onBuildRead) { + currContents = config.onBuildRead(moduleName, path, currContents); + } + + if (namespace) { + currContents = pragma.namespace(currContents, namespace); + } + + currContents = build.toTransport(namespace, moduleName, path, currContents, layer, { + useSourceUrl: config.useSourceUrl + }); + + if (packageConfig) { + currContents = addSemiColon(currContents) + '\n'; + currContents += namespaceWithDot + "define('" + + packageConfig.name + "', ['" + moduleName + + "'], function (main) { return main; });\n"; + } + + if (config.onBuildWrite) { + currContents = config.onBuildWrite(moduleName, path, currContents); + } + + //Semicolon is for files that are not well formed when + //concatenated with other content. + fileContents += "\n" + addSemiColon(currContents); + } + + buildFileContents += path.replace(config.dir, "") + "\n"; + //Some files may not have declared a require module, and if so, + //put in a placeholder call so the require does not try to load them + //after the module is processed. + //If we have a name, but no defined module, then add in the placeholder. + if (moduleName && !layer.modulesWithNames[moduleName] && !config.skipModuleInsertion) { + shim = config.shim && config.shim[moduleName]; + if (shim) { + fileContents += '\n' + namespaceWithDot + 'define("' + moduleName + '", ' + + (shim.deps && shim.deps.length ? + build.makeJsArrayString(shim.deps) + ', ' : '') + + (shim.exports ? shim.exports() : 'function(){}') + + ');\n'; + } else { + fileContents += '\n' + namespaceWithDot + 'define("' + moduleName + '", function(){});\n'; + } + } + } + + //Add a require at the end to kick start module execution, if that + //was desired. Usually this is only specified when using small shim + //loaders like almond. + if (module.insertRequire) { + fileContents += '\n' + namespaceWithDot + 'require(["' + module.insertRequire.join('", "') + '"]);\n'; + } + + return { + text: config.wrap ? + config.wrap.start + fileContents + config.wrap.end : + fileContents, + buildText: buildFileContents + }; + }; + + //Converts an JS array of strings to a string representation. + //Not using JSON.stringify() for Rhino's sake. + build.makeJsArrayString = function (ary) { + return '["' + ary.map(function (item) { + //Escape any double quotes, backslashes + return lang.jsEscape(item); + }).join('","') + '"]'; + }; + + build.toTransport = function (namespace, moduleName, path, contents, layer, options) { + var baseUrl = layer && layer.context.config.baseUrl; + + function onFound(info) { + //Only mark this module as having a name if not a named module, + //or if a named module and the name matches expectations. + if (layer && (info.needsId || info.foundId === moduleName)) { + layer.modulesWithNames[moduleName] = true; + } + } + + //Convert path to be a local one to the baseUrl, useful for + //useSourceUrl. + if (baseUrl) { + path = path.replace(baseUrl, ''); + } + + return transform.toTransport(namespace, moduleName, path, contents, onFound, options); + }; + + return build; +}); + + } + + + /** + * Sets the default baseUrl for requirejs to be directory of top level + * script. + */ + function setBaseUrl(fileName) { + //Use the file name's directory as the baseUrl if available. + dir = fileName.replace(/\\/g, '/'); + if (dir.indexOf('/') !== -1) { + dir = dir.split('/'); + dir.pop(); + dir = dir.join('/'); + exec("require({baseUrl: '" + dir + "'});"); + } + } + + //If in Node, and included via a require('requirejs'), just export and + //THROW IT ON THE GROUND! + if (env === 'node' && reqMain !== module) { + setBaseUrl(path.resolve(reqMain ? reqMain.filename : '.')); + + //Create a method that will run the optimzer given an object + //config. + requirejs.optimize = function (config, callback) { + if (!loadedOptimizedLib) { + loadLib(); + loadedOptimizedLib = true; + } + + //Create the function that will be called once build modules + //have been loaded. + var runBuild = function (build, logger) { + //Make sure config has a log level, and if not, + //make it "silent" by default. + config.logLevel = config.hasOwnProperty('logLevel') ? + config.logLevel : logger.SILENT; + + var result = build(config); + + //Reset build internals on each run. + requirejs._buildReset(); + + if (callback) { + callback(result); + } + }; + + requirejs({ + context: 'build' + }, ['build', 'logger'], runBuild); + }; + + requirejs.tools = { + useLib: function (contextName, callback) { + if (!callback) { + callback = contextName; + contextName = 'uselib'; + } + + if (!useLibLoaded[contextName]) { + loadLib(); + useLibLoaded[contextName] = true; + } + + var req = requirejs({ + context: contextName + }); + + req(['build'], function () { + callback(req); + }); + } + }; + + requirejs.define = define; + + module.exports = requirejs; + return; + } + + if (commandOption === 'o') { + //Do the optimizer work. + loadLib(); + + /** + * @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/jrburke/requirejs for details + */ + +/* + * Create a build.js file that has the build options you want and pass that + * build file to this file to do the build. See example.build.js for more information. + */ + +/*jslint strict: false, nomen: false */ +/*global require: false */ + +require({ + baseUrl: require.s.contexts._.config.baseUrl, + //Use a separate context than the default context so that the + //build can use the default context. + context: 'build', + catchError: { + define: true + } +}, ['env!env/args', 'build'], +function (args, build) { + build(args); +}); + + + } else if (commandOption === 'v') { + console.log('r.js: ' + version + ', RequireJS: ' + this.requirejsVars.require.version); + } else if (commandOption === 'convert') { + loadLib(); + + this.requirejsVars.require(['env!env/args', 'commonJs', 'env!env/print'], + function (args, commonJs, print) { + + var srcDir, outDir; + srcDir = args[0]; + outDir = args[1]; + + if (!srcDir || !outDir) { + print('Usage: path/to/commonjs/modules output/dir'); + return; + } + + commonJs.convertDir(args[0], args[1]); + }); + } else { + //Just run an app + + //Load the bundled libraries for use in the app. + if (commandOption === 'lib') { + loadLib(); + } + + setBaseUrl(fileName); + + if (exists(fileName)) { + exec(readFile(fileName), fileName); + } else { + showHelp(); + } + } + +}((typeof console !== 'undefined' ? console : undefined), + (typeof Packages !== 'undefined' ? Array.prototype.slice.call(arguments, 0) : []), + (typeof readFile !== 'undefined' ? readFile : undefined))); diff --git a/src/main/webapp/plugins/RequireJS/require.js b/src/main/webapp/plugins/RequireJS/require.js new file mode 100644 index 0000000..4e0dea6 --- /dev/null +++ b/src/main/webapp/plugins/RequireJS/require.js @@ -0,0 +1,35 @@ +/* + RequireJS 2.0.4 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. + Available via the MIT or new BSD license. + see: http://github.com/jrburke/requirejs for details +*/ +var requirejs,require,define; +(function(Y){function x(b){return J.call(b)==="[object Function]"}function G(b){return J.call(b)==="[object Array]"}function q(b,c){if(b){var e;for(e=0;e<b.length;e+=1)if(b[e]&&c(b[e],e,b))break}}function N(b,c){if(b){var e;for(e=b.length-1;e>-1;e-=1)if(b[e]&&c(b[e],e,b))break}}function y(b,c){for(var e in b)if(b.hasOwnProperty(e)&&c(b[e],e))break}function K(b,c,e,i){c&&y(c,function(c,j){if(e||!b.hasOwnProperty(j))i&&typeof c!=="string"?(b[j]||(b[j]={}),K(b[j],c,e,i)):b[j]=c});return b}function s(b, +c){return function(){return c.apply(b,arguments)}}function Z(b){if(!b)return b;var c=Y;q(b.split("."),function(b){c=c[b]});return c}function $(b,c,e){return function(){var i=fa.call(arguments,0),g;if(e&&x(g=i[i.length-1]))g.__requireJsBuild=!0;i.push(c);return b.apply(null,i)}}function aa(b,c,e){q([["toUrl"],["undef"],["defined","requireDefined"],["specified","requireSpecified"]],function(i){var g=i[1]||i[0];b[i[0]]=c?$(c[g],e):function(){var b=z[O];return b[g].apply(b,arguments)}})}function H(b, +c,e,i){c=Error(c+"\nhttp://requirejs.org/docs/errors.html#"+b);c.requireType=b;c.requireModules=i;if(e)c.originalError=e;return c}function ga(){if(I&&I.readyState==="interactive")return I;N(document.getElementsByTagName("script"),function(b){if(b.readyState==="interactive")return I=b});return I}var ha=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,ia=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,ba=/\.js$/,ja=/^\.\//,J=Object.prototype.toString,A=Array.prototype,fa=A.slice,ka=A.splice,w=!!(typeof window!== +"undefined"&&navigator&&document),ca=!w&&typeof importScripts!=="undefined",la=w&&navigator.platform==="PLAYSTATION 3"?/^complete$/:/^(complete|loaded)$/,O="_",S=typeof opera!=="undefined"&&opera.toString()==="[object Opera]",z={},p={},P=[],L=!1,j,t,C,u,D,I,E,da,ea;if(typeof define==="undefined"){if(typeof requirejs!=="undefined"){if(x(requirejs))return;p=requirejs;requirejs=void 0}typeof require!=="undefined"&&!x(require)&&(p=require,require=void 0);j=requirejs=function(b,c,e,i){var g=O,r;!G(b)&& +typeof b!=="string"&&(r=b,G(c)?(b=c,c=e,e=i):b=[]);if(r&&r.context)g=r.context;(i=z[g])||(i=z[g]=j.s.newContext(g));r&&i.configure(r);return i.require(b,c,e)};j.config=function(b){return j(b)};require||(require=j);j.version="2.0.4";j.jsExtRegExp=/^\/|:|\?|\.js$/;j.isBrowser=w;A=j.s={contexts:z,newContext:function(b){function c(a,d,o){var l=d&&d.split("/"),f=l,b=k.map,c=b&&b["*"],e,g,h;if(a&&a.charAt(0)===".")if(d){f=k.pkgs[d]?l=[d]:l.slice(0,l.length-1);d=a=f.concat(a.split("/"));for(f=0;d[f];f+= +1)if(e=d[f],e===".")d.splice(f,1),f-=1;else if(e==="..")if(f===1&&(d[2]===".."||d[0]===".."))break;else f>0&&(d.splice(f-1,2),f-=2);f=k.pkgs[d=a[0]];a=a.join("/");f&&a===d+"/"+f.main&&(a=d)}else a.indexOf("./")===0&&(a=a.substring(2));if(o&&(l||c)&&b){d=a.split("/");for(f=d.length;f>0;f-=1){g=d.slice(0,f).join("/");if(l)for(e=l.length;e>0;e-=1)if(o=b[l.slice(0,e).join("/")])if(o=o[g]){h=o;break}!h&&c&&c[g]&&(h=c[g]);if(h){d.splice(0,f,h);a=d.join("/");break}}}return a}function e(a){w&&q(document.getElementsByTagName("script"), +function(d){if(d.getAttribute("data-requiremodule")===a&&d.getAttribute("data-requirecontext")===h.contextName)return d.parentNode.removeChild(d),!0})}function i(a){var d=k.paths[a];if(d&&G(d)&&d.length>1)return e(a),d.shift(),h.undef(a),h.require([a]),!0}function g(a,d,o,b){var f=a?a.indexOf("!"):-1,v=null,e=d?d.name:null,g=a,i=!0,j="",k,m;a||(i=!1,a="_@r"+(N+=1));f!==-1&&(v=a.substring(0,f),a=a.substring(f+1,a.length));v&&(v=c(v,e,b),m=n[v]);a&&(v?j=m&&m.normalize?m.normalize(a,function(a){return c(a, +e,b)}):c(a,e,b):(j=c(a,e,b),k=h.nameToUrl(j)));a=v&&!m&&!o?"_unnormalized"+(O+=1):"";return{prefix:v,name:j,parentMap:d,unnormalized:!!a,url:k,originalName:g,isDefine:i,id:(v?v+"!"+j:j)+a}}function r(a){var d=a.id,o=m[d];o||(o=m[d]=new h.Module(a));return o}function p(a,d,o){var b=a.id,f=m[b];if(n.hasOwnProperty(b)&&(!f||f.defineEmitComplete))d==="defined"&&o(n[b]);else r(a).on(d,o)}function B(a,d){var b=a.requireModules,l=!1;if(d)d(a);else if(q(b,function(d){if(d=m[d])d.error=a,d.events.error&&(l= +!0,d.emit("error",a))}),!l)j.onError(a)}function u(){P.length&&(ka.apply(F,[F.length-1,0].concat(P)),P=[])}function t(a,d,b){a=a&&a.map;d=$(b||h.require,a,d);aa(d,h,a);d.isBrowser=w;return d}function z(a){delete m[a];q(M,function(d,b){if(d.map.id===a)return M.splice(b,1),d.defined||(h.waitCount-=1),!0})}function A(a,d){var b=a.map.id,l=a.depMaps,f;if(a.inited){if(d[b])return a;d[b]=!0;q(l,function(a){if(a=m[a.id])return!a.inited||!a.enabled?(f=null,delete d[b],!0):f=A(a,K({},d))});return f}}function C(a, +d,b){var l=a.map.id,f=a.depMaps;if(a.inited&&a.map.isDefine){if(d[l])return n[l];d[l]=a;q(f,function(f){var f=f.id,c=m[f];!Q[f]&&c&&(!c.inited||!c.enabled?b[l]=!0:(c=C(c,d,b),b[f]||a.defineDepById(f,c)))});a.check(!0);return n[l]}}function D(a){a.check()}function E(){var a=k.waitSeconds*1E3,d=a&&h.startTime+a<(new Date).getTime(),b=[],l=!1,f=!0,c,g,j;if(!T){T=!0;y(m,function(a){c=a.map;g=c.id;if(a.enabled&&!a.error)if(!a.inited&&d)i(g)?l=j=!0:(b.push(g),e(g));else if(!a.inited&&a.fetched&&c.isDefine&& +(l=!0,!c.prefix))return f=!1});if(d&&b.length)return a=H("timeout","Load timeout for modules: "+b,null,b),a.contextName=h.contextName,B(a);f&&(q(M,function(a){if(!a.defined){var a=A(a,{}),d={};a&&(C(a,d,{}),y(d,D))}}),y(m,D));if((!d||j)&&l)if((w||ca)&&!U)U=setTimeout(function(){U=0;E()},50);T=!1}}function V(a){r(g(a[0],null,!0)).init(a[1],a[2])}function J(a){var a=a.currentTarget||a.srcElement,d=h.onScriptLoad;a.detachEvent&&!S?a.detachEvent("onreadystatechange",d):a.removeEventListener("load",d, +!1);d=h.onScriptError;a.detachEvent&&!S||a.removeEventListener("error",d,!1);return{node:a,id:a&&a.getAttribute("data-requiremodule")}}var k={waitSeconds:7,baseUrl:"./",paths:{},pkgs:{},shim:{}},m={},W={},F=[],n={},R={},N=1,O=1,M=[],T,X,h,Q,U;Q={require:function(a){return t(a)},exports:function(a){a.usingExports=!0;if(a.map.isDefine)return a.exports=n[a.map.id]={}},module:function(a){return a.module={id:a.map.id,uri:a.map.url,config:function(){return k.config&&k.config[a.map.id]||{}},exports:n[a.map.id]}}}; +X=function(a){this.events=W[a.id]||{};this.map=a;this.shim=k.shim[a.id];this.depExports=[];this.depMaps=[];this.depMatched=[];this.pluginMaps={};this.depCount=0};X.prototype={init:function(a,d,b,l){l=l||{};if(!this.inited){this.factory=d;if(b)this.on("error",b);else this.events.error&&(b=s(this,function(a){this.emit("error",a)}));this.depMaps=a&&a.slice(0);this.depMaps.rjsSkipMap=a.rjsSkipMap;this.errback=b;this.inited=!0;this.ignore=l.ignore;l.enabled||this.enabled?this.enable():this.check()}},defineDepById:function(a, +d){var b;q(this.depMaps,function(d,f){if(d.id===a)return b=f,!0});return this.defineDep(b,d)},defineDep:function(a,d){this.depMatched[a]||(this.depMatched[a]=!0,this.depCount-=1,this.depExports[a]=d)},fetch:function(){if(!this.fetched){this.fetched=!0;h.startTime=(new Date).getTime();var a=this.map;if(this.shim)t(this,!0)(this.shim.deps||[],s(this,function(){return a.prefix?this.callPlugin():this.load()}));else return a.prefix?this.callPlugin():this.load()}},load:function(){var a=this.map.url;R[a]|| +(R[a]=!0,h.load(this.map.id,a))},check:function(a){if(this.enabled&&!this.enabling){var d=this.map.id,b=this.depExports,c=this.exports,f=this.factory,e;if(this.inited)if(this.error)this.emit("error",this.error);else{if(!this.defining){this.defining=!0;if(this.depCount<1&&!this.defined){if(x(f)){if(this.events.error)try{c=h.execCb(d,f,b,c)}catch(g){e=g}else c=h.execCb(d,f,b,c);if(this.map.isDefine)if((b=this.module)&&b.exports!==void 0&&b.exports!==this.exports)c=b.exports;else if(c===void 0&&this.usingExports)c= +this.exports;if(e)return e.requireMap=this.map,e.requireModules=[this.map.id],e.requireType="define",B(this.error=e)}else c=f;this.exports=c;if(this.map.isDefine&&!this.ignore&&(n[d]=c,j.onResourceLoad))j.onResourceLoad(h,this.map,this.depMaps);delete m[d];this.defined=!0;h.waitCount-=1;h.waitCount===0&&(M=[])}this.defining=!1;if(!a&&this.defined&&!this.defineEmitted)this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0}}else this.fetch()}},callPlugin:function(){var a= +this.map,d=a.id,b=g(a.prefix,null,!1,!0);p(b,"defined",s(this,function(b){var f=this.map.name,e=this.map.parentMap?this.map.parentMap.name:null;if(this.map.unnormalized){if(b.normalize&&(f=b.normalize(f,function(a){return c(a,e,!0)})||""),b=g(a.prefix+"!"+f,this.map.parentMap,!1,!0),p(b,"defined",s(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),b=m[b.id]){if(this.events.error)b.on("error",s(this,function(a){this.emit("error",a)}));b.enable()}}else f=s(this,function(a){this.init([], +function(){return a},null,{enabled:!0})}),f.error=s(this,function(a){this.inited=!0;this.error=a;a.requireModules=[d];y(m,function(a){a.map.id.indexOf(d+"_unnormalized")===0&&z(a.map.id)});B(a)}),f.fromText=function(a,d){var b=L;b&&(L=!1);r(g(a));j.exec(d);b&&(L=!0);h.completeLoad(a)},b.load(a.name,t(a.parentMap,!0,function(a,d){a.rjsSkipMap=!0;return h.require(a,d)}),f,k)}));h.enable(b,this);this.pluginMaps[b.id]=b},enable:function(){this.enabled=!0;if(!this.waitPushed)M.push(this),h.waitCount+= +1,this.waitPushed=!0;this.enabling=!0;q(this.depMaps,s(this,function(a,d){var b,c;if(typeof a==="string"){a=g(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.depMaps.rjsSkipMap);this.depMaps[d]=a;if(b=Q[a.id]){this.depExports[d]=b(this);return}this.depCount+=1;p(a,"defined",s(this,function(a){this.defineDep(d,a);this.check()}));this.errback&&p(a,"error",this.errback)}b=a.id;c=m[b];!Q[b]&&c&&!c.enabled&&h.enable(a,this)}));y(this.pluginMaps,s(this,function(a){var b=m[a.id];b&&!b.enabled&& +h.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){q(this.events[a],function(a){a(b)});a==="error"&&delete this.events[a]}};return h={config:k,contextName:b,registry:m,defined:n,urlFetched:R,waitCount:0,defQueue:F,Module:X,makeModuleMap:g,configure:function(a){a.baseUrl&&a.baseUrl.charAt(a.baseUrl.length-1)!=="/"&&(a.baseUrl+="/");var b=k.pkgs,c=k.shim,e=k.paths,f=k.map;K(k,a,!0);k.paths=K(e,a.paths,!0);if(a.map)k.map= +K(f||{},a.map,!0,!0);if(a.shim)y(a.shim,function(a,b){G(a)&&(a={deps:a});if(a.exports&&!a.exports.__buildReady)a.exports=h.makeShimExports(a.exports);c[b]=a}),k.shim=c;if(a.packages)q(a.packages,function(a){a=typeof a==="string"?{name:a}:a;b[a.name]={name:a.name,location:a.location||a.name,main:(a.main||"main").replace(ja,"").replace(ba,"")}}),k.pkgs=b;y(m,function(a,b){a.map=g(b)});if(a.deps||a.callback)h.require(a.deps||[],a.callback)},makeShimExports:function(a){var b;return typeof a==="string"? +(b=function(){return Z(a)},b.exports=a,b):function(){return a.apply(Y,arguments)}},requireDefined:function(a,b){var c=g(a,b,!1,!0).id;return n.hasOwnProperty(c)},requireSpecified:function(a,b){a=g(a,b,!1,!0).id;return n.hasOwnProperty(a)||m.hasOwnProperty(a)},require:function(a,d,c,e){var f;if(typeof a==="string"){if(x(d))return B(H("requireargs","Invalid require call"),c);if(j.get)return j.get(h,a,d);a=g(a,d,!1,!0);a=a.id;return!n.hasOwnProperty(a)?B(H("notloaded",'Module name "'+a+'" has not been loaded yet for context: '+ +b)):n[a]}c&&!x(c)&&(e=c,c=void 0);d&&!x(d)&&(e=d,d=void 0);for(u();F.length;)if(f=F.shift(),f[0]===null)return B(H("mismatch","Mismatched anonymous define() module: "+f[f.length-1]));else V(f);r(g(null,e)).init(a,d,c,{enabled:!0});E();return h.require},undef:function(a){var b=g(a,null,!0),c=m[a];delete n[a];delete R[b.url];delete W[a];if(c){if(c.events.defined)W[a]=c.events;z(a)}},enable:function(a){m[a.id]&&r(a).enable()},completeLoad:function(a){var b=k.shim[a]||{},c=b.exports&&b.exports.exports, +e,f;for(u();F.length;){f=F.shift();if(f[0]===null){f[0]=a;if(e)break;e=!0}else f[0]===a&&(e=!0);V(f)}f=m[a];if(!e&&!n[a]&&f&&!f.inited)if(k.enforceDefine&&(!c||!Z(c)))if(i(a))return;else return B(H("nodefine","No define call for "+a,null,[a]));else V([a,b.deps||[],b.exports]);E()},toUrl:function(a,b){var e=a.lastIndexOf("."),g=null;e!==-1&&(g=a.substring(e,a.length),a=a.substring(0,e));return h.nameToUrl(c(a,b&&b.id,!0),g)},nameToUrl:function(a,b){var c,e,f,g,h,i;if(j.jsExtRegExp.test(a))g=a+(b|| +"");else{c=k.paths;e=k.pkgs;g=a.split("/");for(h=g.length;h>0;h-=1)if(i=g.slice(0,h).join("/"),f=e[i],i=c[i]){G(i)&&(i=i[0]);g.splice(0,h,i);break}else if(f){c=a===f.name?f.location+"/"+f.main:f.location;g.splice(0,h,c);break}g=g.join("/")+(b||".js");g=(g.charAt(0)==="/"||g.match(/^[\w\+\.\-]+:/)?"":k.baseUrl)+g}return k.urlArgs?g+((g.indexOf("?")===-1?"?":"&")+k.urlArgs):g},load:function(a,b){j.load(h,a,b)},execCb:function(a,b,c,e){return b.apply(e,c)},onScriptLoad:function(a){if(a.type==="load"|| +la.test((a.currentTarget||a.srcElement).readyState))I=null,a=J(a),h.completeLoad(a.id)},onScriptError:function(a){var b=J(a);if(!i(b.id))return B(H("scripterror","Script error",a,[b.id]))}}}};j({});aa(j);if(w&&(t=A.head=document.getElementsByTagName("head")[0],C=document.getElementsByTagName("base")[0]))t=A.head=C.parentNode;j.onError=function(b){throw b;};j.load=function(b,c,e){var i=b&&b.config||{},g;if(w)return g=i.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script"), +g.type=i.scriptType||"text/javascript",g.charset="utf-8",g.async=!0,g.setAttribute("data-requirecontext",b.contextName),g.setAttribute("data-requiremodule",c),g.attachEvent&&!(g.attachEvent.toString&&g.attachEvent.toString().indexOf("[native code")<0)&&!S?(L=!0,g.attachEvent("onreadystatechange",b.onScriptLoad)):(g.addEventListener("load",b.onScriptLoad,!1),g.addEventListener("error",b.onScriptError,!1)),g.src=e,E=g,C?t.insertBefore(g,C):t.appendChild(g),E=null,g;else ca&&(importScripts(e),b.completeLoad(c))}; +w&&N(document.getElementsByTagName("script"),function(b){if(!t)t=b.parentNode;if(u=b.getAttribute("data-main")){if(!p.baseUrl)D=u.split("/"),da=D.pop(),ea=D.length?D.join("/")+"/":"./",p.baseUrl=ea,u=da;u=u.replace(ba,"");p.deps=p.deps?p.deps.concat(u):[u];return!0}});define=function(b,c,e){var i,g;typeof b!=="string"&&(e=c,c=b,b=null);G(c)||(e=c,c=[]);!c.length&&x(e)&&e.length&&(e.toString().replace(ha,"").replace(ia,function(b,e){c.push(e)}),c=(e.length===1?["require"]:["require","exports","module"]).concat(c)); +if(L&&(i=E||ga()))b||(b=i.getAttribute("data-requiremodule")),g=z[i.getAttribute("data-requirecontext")];(g?g.defQueue:P).push([b,c,e])};define.amd={jQuery:!0};j.exec=function(b){return eval(b)};j(p)}})(this); diff --git a/src/main/webapp/rewrite.cfm b/src/main/webapp/rewrite.cfm new file mode 100644 index 0000000..2a4a3b1 --- /dev/null +++ b/src/main/webapp/rewrite.cfm @@ -0,0 +1 @@ +<cfinclude template="wheels/index.cfm">
\ No newline at end of file diff --git a/src/main/webapp/root.cfm b/src/main/webapp/root.cfm new file mode 100644 index 0000000..d5e4bda --- /dev/null +++ b/src/main/webapp/root.cfm @@ -0,0 +1 @@ +<cfinvoke attributeCollection="#arguments#">
\ No newline at end of file diff --git a/src/main/webapp/stylesheets/.gitignore b/src/main/webapp/stylesheets/.gitignore new file mode 100644 index 0000000..d3f5a12 --- /dev/null +++ b/src/main/webapp/stylesheets/.gitignore @@ -0,0 +1 @@ +
diff --git a/src/main/webapp/stylesheets/about.css b/src/main/webapp/stylesheets/about.css new file mode 100644 index 0000000..e85c433 --- /dev/null +++ b/src/main/webapp/stylesheets/about.css @@ -0,0 +1,35 @@ +body{ + padding-top: 60px; +} +.hero-unit{ + +} +.hero-unit h1{ +/* margin-top: 75px;*/ +} +.hero-unit p{ + clear: both; +} +.thumbnail .image{ + +} +.panel{ + margin: 1em 0; +} +.panel h2{ + margin-top: 1em; +} +.span12.hr-bar{ + margin-left: 0; +} +.hr-bar hr{ + margin: 18px 0 0; +} + +.panel { + margin-top: 70px; +} + +.use_case { + font-weight: bold; +}
\ No newline at end of file diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/accordion.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/accordion.less new file mode 100644 index 0000000..31b8cdc --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/accordion.less @@ -0,0 +1,33 @@ +// ACCORDION +// --------- + + +// Parent container +.accordion { + margin-bottom: @baseLineHeight; +} + +// Group == heading + body +.accordion-group { + margin-bottom: 2px; + border: 1px solid #e5e5e5; + .border-radius(4px); +} +.accordion-heading { + border-bottom: 0; +} +.accordion-heading .accordion-toggle { + display: block; + padding: 8px 15px; +} + +// General toggle styles +.accordion-toggle { + cursor: pointer; +} + +// Inner needs the styles because you can't animate properly with any styles on the element +.accordion-inner { + padding: 9px 15px; + border-top: 1px solid #e5e5e5; +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/alerts.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/alerts.less new file mode 100644 index 0000000..46a0d77 --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/alerts.less @@ -0,0 +1,58 @@ +// ALERT STYLES +// ------------ + +// Base alert styles +.alert { + padding: 8px 35px 8px 14px; + margin-bottom: @baseLineHeight; + text-shadow: 0 1px 0 rgba(255,255,255,.5); + background-color: @warningBackground; + border: 1px solid @warningBorder; + .border-radius(4px); + color: @warningText; +} +.alert-heading { + color: inherit; +} + +// Adjust close link position +.alert .close { + position: relative; + top: -2px; + right: -21px; + line-height: 18px; +} + +// Alternate styles +// ---------------- + +.alert-success { + background-color: @successBackground; + border-color: @successBorder; + color: @successText; +} +.alert-danger, +.alert-error { + background-color: @errorBackground; + border-color: @errorBorder; + color: @errorText; +} +.alert-info { + background-color: @infoBackground; + border-color: @infoBorder; + color: @infoText; +} + +// Block alerts +// ------------------------ +.alert-block { + padding-top: 14px; + padding-bottom: 14px; +} +.alert-block > p, +.alert-block > ul { + margin-bottom: 0; +} +.alert-block p + p { + margin-top: 5px; +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/bootstrap.css b/src/main/webapp/stylesheets/bootstrap-2.0.4/bootstrap.css new file mode 100644 index 0000000..0bf01f1 --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/bootstrap.css @@ -0,0 +1,4200 @@ +/*! + * Bootstrap v2.0.4 + * + * Copyright 2012 Twitter, Inc + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Designed and built with all the love in the world @twitter by @mdo and @fat. + */ +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +nav, +section { + display: block; +} +audio, +canvas, +video { + display: inline-block; + *display: inline; + *zoom: 1; +} +audio:not([controls]) { + display: none; +} +html { + font-size: 100%; + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; +} +a:focus { + outline: thin dotted #333; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} +a:hover, +a:active { + outline: 0; +} +sub, +sup { + position: relative; + font-size: 75%; + line-height: 0; + vertical-align: baseline; +} +sup { + top: -0.5em; +} +sub { + bottom: -0.25em; +} +img { + max-width: 100%; + vertical-align: middle; + border: 0; + -ms-interpolation-mode: bicubic; +} +#map_canvas img { + max-width: none; +} +button, +input, +select, +textarea { + margin: 0; + font-size: 100%; + vertical-align: middle; +} +button, +input { + *overflow: visible; + line-height: normal; +} +button::-moz-focus-inner, +input::-moz-focus-inner { + padding: 0; + border: 0; +} +button, +input[type="button"], +input[type="reset"], +input[type="submit"] { + cursor: pointer; + -webkit-appearance: button; +} +input[type="search"] { + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + -webkit-appearance: textfield; +} +input[type="search"]::-webkit-search-decoration, +input[type="search"]::-webkit-search-cancel-button { + -webkit-appearance: none; +} +textarea { + overflow: auto; + vertical-align: top; +} +.clearfix { + *zoom: 1; +} +.clearfix:before, +.clearfix:after { + display: table; + content: ""; +} +.clearfix:after { + clear: both; +} +.hide-text { + font: 0/0 a; + color: transparent; + text-shadow: none; + background-color: transparent; + border: 0; +} +.input-block-level { + display: block; + width: 100%; + min-height: 28px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; +} +body { + margin: 0; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 13px; + line-height: 18px; + color: #333333; + background-color: #ffffff; +} +a { + color: #0088cc; + text-decoration: none; +} +a:hover { + color: #005580; + text-decoration: underline; +} +.row { + margin-left: -20px; + *zoom: 1; +} +.row:before, +.row:after { + display: table; + content: ""; +} +.row:after { + clear: both; +} +[class*="span"] { + float: left; + margin-left: 20px; +} +.container, +.navbar-fixed-top .container, +.navbar-fixed-bottom .container { + width: 940px; +} +.span12 { + width: 940px; +} +.span11 { + width: 860px; +} +.span10 { + width: 780px; +} +.span9 { + width: 700px; +} +.span8 { + width: 620px; +} +.span7 { + width: 540px; +} +.span6 { + width: 460px; +} +.span5 { + width: 380px; +} +.span4 { + width: 300px; +} +.span3 { + width: 220px; +} +.span2 { + width: 140px; +} +.span1 { + width: 60px; +} +.offset12 { + margin-left: 980px; +} +.offset11 { + margin-left: 900px; +} +.offset10 { + margin-left: 820px; +} +.offset9 { + margin-left: 740px; +} +.offset8 { + margin-left: 660px; +} +.offset7 { + margin-left: 580px; +} +.offset6 { + margin-left: 500px; +} +.offset5 { + margin-left: 420px; +} +.offset4 { + margin-left: 340px; +} +.offset3 { + margin-left: 260px; +} +.offset2 { + margin-left: 180px; +} +.offset1 { + margin-left: 100px; +} +.row-fluid { + width: 100%; + *zoom: 1; +} +.row-fluid:before, +.row-fluid:after { + display: table; + content: ""; +} +.row-fluid:after { + clear: both; +} +.row-fluid [class*="span"] { + display: block; + width: 100%; + min-height: 28px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; + float: left; + margin-left: 2.127659574%; + *margin-left: 2.0744680846382977%; +} +.row-fluid [class*="span"]:first-child { + margin-left: 0; +} +.row-fluid .span12 { + width: 99.99999998999999%; + *width: 99.94680850063828%; +} +.row-fluid .span11 { + width: 91.489361693%; + *width: 91.4361702036383%; +} +.row-fluid .span10 { + width: 82.97872339599999%; + *width: 82.92553190663828%; +} +.row-fluid .span9 { + width: 74.468085099%; + *width: 74.4148936096383%; +} +.row-fluid .span8 { + width: 65.95744680199999%; + *width: 65.90425531263828%; +} +.row-fluid .span7 { + width: 57.446808505%; + *width: 57.3936170156383%; +} +.row-fluid .span6 { + width: 48.93617020799999%; + *width: 48.88297871863829%; +} +.row-fluid .span5 { + width: 40.425531911%; + *width: 40.3723404216383%; +} +.row-fluid .span4 { + width: 31.914893614%; + *width: 31.8617021246383%; +} +.row-fluid .span3 { + width: 23.404255317%; + *width: 23.3510638276383%; +} +.row-fluid .span2 { + width: 14.89361702%; + *width: 14.8404255306383%; +} +.row-fluid .span1 { + width: 6.382978723%; + *width: 6.329787233638298%; +} +.container { + margin-right: auto; + margin-left: auto; + *zoom: 1; +} +.container:before, +.container:after { + display: table; + content: ""; +} +.container:after { + clear: both; +} +.container-fluid { + padding-right: 20px; + padding-left: 20px; + *zoom: 1; +} +.container-fluid:before, +.container-fluid:after { + display: table; + content: ""; +} +.container-fluid:after { + clear: both; +} +p { + margin: 0 0 9px; +} +p small { + font-size: 11px; + color: #999999; +} +.lead { + margin-bottom: 18px; + font-size: 20px; + font-weight: 200; + line-height: 27px; +} +h1, +h2, +h3, +h4, +h5, +h6 { + margin: 0; + font-family: inherit; + font-weight: bold; + color: inherit; + text-rendering: optimizelegibility; +} +h1 small, +h2 small, +h3 small, +h4 small, +h5 small, +h6 small { + font-weight: normal; + color: #999999; +} +h1 { + font-size: 30px; + line-height: 36px; +} +h1 small { + font-size: 18px; +} +h2 { + font-size: 24px; + line-height: 36px; +} +h2 small { + font-size: 18px; +} +h3 { + font-size: 18px; + line-height: 27px; +} +h3 small { + font-size: 14px; +} +h4, +h5, +h6 { + line-height: 18px; +} +h4 { + font-size: 14px; +} +h4 small { + font-size: 12px; +} +h5 { + font-size: 12px; +} +h6 { + font-size: 11px; + color: #999999; + text-transform: uppercase; +} +.page-header { + padding-bottom: 17px; + margin: 18px 0; + border-bottom: 1px solid #eeeeee; +} +.page-header h1 { + line-height: 1; +} +ul, +ol { + padding: 0; + margin: 0 0 9px 25px; +} +ul ul, +ul ol, +ol ol, +ol ul { + margin-bottom: 0; +} +ul { + list-style: disc; +} +ol { + list-style: decimal; +} +li { + line-height: 18px; +} +ul.unstyled, +ol.unstyled { + margin-left: 0; + list-style: none; +} +dl { + margin-bottom: 18px; +} +dt, +dd { + line-height: 18px; +} +dt { + font-weight: bold; + line-height: 17px; +} +dd { + margin-left: 9px; +} +.dl-horizontal dt { + float: left; + width: 120px; + clear: left; + text-align: right; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.dl-horizontal dd { + margin-left: 130px; +} +hr { + margin: 18px 0; + border: 0; + border-top: 1px solid #eeeeee; + border-bottom: 1px solid #ffffff; +} +strong { + font-weight: bold; +} +em { + font-style: italic; +} +.muted { + color: #999999; +} +abbr[title] { + cursor: help; + border-bottom: 1px dotted #999999; +} +abbr.initialism { + font-size: 90%; + text-transform: uppercase; +} +blockquote { + padding: 0 0 0 15px; + margin: 0 0 18px; + border-left: 5px solid #eeeeee; +} +blockquote p { + margin-bottom: 0; + font-size: 16px; + font-weight: 300; + line-height: 22.5px; +} +blockquote small { + display: block; + line-height: 18px; + color: #999999; +} +blockquote small:before { + content: '\2014 \00A0'; +} +blockquote.pull-right { + float: right; + padding-right: 15px; + padding-left: 0; + border-right: 5px solid #eeeeee; + border-left: 0; +} +blockquote.pull-right p, +blockquote.pull-right small { + text-align: right; +} +q:before, +q:after, +blockquote:before, +blockquote:after { + content: ""; +} +address { + display: block; + margin-bottom: 18px; + font-style: normal; + line-height: 18px; +} +small { + font-size: 100%; +} +cite { + font-style: normal; +} +code, +pre { + padding: 0 3px 2px; + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; + font-size: 12px; + color: #333333; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} +code { + padding: 2px 4px; + color: #d14; + background-color: #f7f7f9; + border: 1px solid #e1e1e8; +} +pre { + display: block; + padding: 8.5px; + margin: 0 0 9px; + font-size: 12.025px; + line-height: 18px; + word-break: break-all; + word-wrap: break-word; + white-space: pre; + white-space: pre-wrap; + background-color: #f5f5f5; + border: 1px solid #ccc; + border: 1px solid rgba(0, 0, 0, 0.15); + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} +pre.prettyprint { + margin-bottom: 18px; +} +pre code { + padding: 0; + color: inherit; + background-color: transparent; + border: 0; +} +.pre-scrollable { + max-height: 340px; + overflow-y: scroll; +} +form { + margin: 0 0 18px; +} +fieldset { + padding: 0; + margin: 0; + border: 0; +} +legend { + display: block; + width: 100%; + padding: 0; + margin-bottom: 27px; + font-size: 19.5px; + line-height: 36px; + color: #333333; + border: 0; + border-bottom: 1px solid #e5e5e5; +} +legend small { + font-size: 13.5px; + color: #999999; +} +label, +input, +button, +select, +textarea { + font-size: 13px; + font-weight: normal; + line-height: 18px; +} +input, +button, +select, +textarea { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; +} +label { + display: block; + margin-bottom: 5px; +} +select, +textarea, +input[type="text"], +input[type="password"], +input[type="datetime"], +input[type="datetime-local"], +input[type="date"], +input[type="month"], +input[type="time"], +input[type="week"], +input[type="number"], +input[type="email"], +input[type="url"], +input[type="search"], +input[type="tel"], +input[type="color"], +.uneditable-input { + display: inline-block; + height: 18px; + padding: 4px; + margin-bottom: 9px; + font-size: 13px; + line-height: 18px; + color: #555555; +} +input, +textarea { + width: 210px; +} +textarea { + height: auto; +} +textarea, +input[type="text"], +input[type="password"], +input[type="datetime"], +input[type="datetime-local"], +input[type="date"], +input[type="month"], +input[type="time"], +input[type="week"], +input[type="number"], +input[type="email"], +input[type="url"], +input[type="search"], +input[type="tel"], +input[type="color"], +.uneditable-input { + background-color: #ffffff; + border: 1px solid #cccccc; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + -webkit-transition: border linear 0.2s, box-shadow linear 0.2s; + -moz-transition: border linear 0.2s, box-shadow linear 0.2s; + -ms-transition: border linear 0.2s, box-shadow linear 0.2s; + -o-transition: border linear 0.2s, box-shadow linear 0.2s; + transition: border linear 0.2s, box-shadow linear 0.2s; +} +textarea:focus, +input[type="text"]:focus, +input[type="password"]:focus, +input[type="datetime"]:focus, +input[type="datetime-local"]:focus, +input[type="date"]:focus, +input[type="month"]:focus, +input[type="time"]:focus, +input[type="week"]:focus, +input[type="number"]:focus, +input[type="email"]:focus, +input[type="url"]:focus, +input[type="search"]:focus, +input[type="tel"]:focus, +input[type="color"]:focus, +.uneditable-input:focus { + border-color: rgba(82, 168, 236, 0.8); + outline: 0; + outline: thin dotted \9; + /* IE6-9 */ + + -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6); + -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6); + box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6); +} +input[type="radio"], +input[type="checkbox"] { + margin: 3px 0; + *margin-top: 0; + /* IE7 */ + + line-height: normal; + cursor: pointer; +} +input[type="submit"], +input[type="reset"], +input[type="button"], +input[type="radio"], +input[type="checkbox"] { + width: auto; +} +.uneditable-textarea { + width: auto; + height: auto; +} +select, +input[type="file"] { + height: 28px; + /* In IE7, the height of the select element cannot be changed by height, only font-size */ + + *margin-top: 4px; + /* For IE7, add top margin to align select with labels */ + + line-height: 28px; +} +select { + width: 220px; + border: 1px solid #bbb; +} +select[multiple], +select[size] { + height: auto; +} +select:focus, +input[type="file"]:focus, +input[type="radio"]:focus, +input[type="checkbox"]:focus { + outline: thin dotted #333; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} +.radio, +.checkbox { + min-height: 18px; + padding-left: 18px; +} +.radio input[type="radio"], +.checkbox input[type="checkbox"] { + float: left; + margin-left: -18px; +} +.controls > .radio:first-child, +.controls > .checkbox:first-child { + padding-top: 5px; +} +.radio.inline, +.checkbox.inline { + display: inline-block; + padding-top: 5px; + margin-bottom: 0; + vertical-align: middle; +} +.radio.inline + .radio.inline, +.checkbox.inline + .checkbox.inline { + margin-left: 10px; +} +.input-mini { + width: 60px; +} +.input-small { + width: 90px; +} +.input-medium { + width: 150px; +} +.input-large { + width: 210px; +} +.input-xlarge { + width: 270px; +} +.input-xxlarge { + width: 530px; +} +input[class*="span"], +select[class*="span"], +textarea[class*="span"], +.uneditable-input[class*="span"], +.row-fluid input[class*="span"], +.row-fluid select[class*="span"], +.row-fluid textarea[class*="span"], +.row-fluid .uneditable-input[class*="span"] { + float: none; + margin-left: 0; +} +.input-append input[class*="span"], +.input-append .uneditable-input[class*="span"], +.input-prepend input[class*="span"], +.input-prepend .uneditable-input[class*="span"], +.row-fluid .input-prepend [class*="span"], +.row-fluid .input-append [class*="span"] { + display: inline-block; +} +input, +textarea, +.uneditable-input { + margin-left: 0; +} +input.span12, textarea.span12, .uneditable-input.span12 { + width: 930px; +} +input.span11, textarea.span11, .uneditable-input.span11 { + width: 850px; +} +input.span10, textarea.span10, .uneditable-input.span10 { + width: 770px; +} +input.span9, textarea.span9, .uneditable-input.span9 { + width: 690px; +} +input.span8, textarea.span8, .uneditable-input.span8 { + width: 610px; +} +input.span7, textarea.span7, .uneditable-input.span7 { + width: 530px; +} +input.span6, textarea.span6, .uneditable-input.span6 { + width: 450px; +} +input.span5, textarea.span5, .uneditable-input.span5 { + width: 370px; +} +input.span4, textarea.span4, .uneditable-input.span4 { + width: 290px; +} +input.span3, textarea.span3, .uneditable-input.span3 { + width: 210px; +} +input.span2, textarea.span2, .uneditable-input.span2 { + width: 130px; +} +input.span1, textarea.span1, .uneditable-input.span1 { + width: 50px; +} +input[disabled], +select[disabled], +textarea[disabled], +input[readonly], +select[readonly], +textarea[readonly] { + cursor: not-allowed; + background-color: #eeeeee; + border-color: #ddd; +} +input[type="radio"][disabled], +input[type="checkbox"][disabled], +input[type="radio"][readonly], +input[type="checkbox"][readonly] { + background-color: transparent; +} +.control-group.warning > label, +.control-group.warning .help-block, +.control-group.warning .help-inline { + color: #c09853; +} +.control-group.warning .checkbox, +.control-group.warning .radio, +.control-group.warning input, +.control-group.warning select, +.control-group.warning textarea { + color: #c09853; + border-color: #c09853; +} +.control-group.warning .checkbox:focus, +.control-group.warning .radio:focus, +.control-group.warning input:focus, +.control-group.warning select:focus, +.control-group.warning textarea:focus { + border-color: #a47e3c; + -webkit-box-shadow: 0 0 6px #dbc59e; + -moz-box-shadow: 0 0 6px #dbc59e; + box-shadow: 0 0 6px #dbc59e; +} +.control-group.warning .input-prepend .add-on, +.control-group.warning .input-append .add-on { + color: #c09853; + background-color: #fcf8e3; + border-color: #c09853; +} +.control-group.error > label, +.control-group.error .help-block, +.control-group.error .help-inline { + color: #b94a48; +} +.control-group.error .checkbox, +.control-group.error .radio, +.control-group.error input, +.control-group.error select, +.control-group.error textarea { + color: #b94a48; + border-color: #b94a48; +} +.control-group.error .checkbox:focus, +.control-group.error .radio:focus, +.control-group.error input:focus, +.control-group.error select:focus, +.control-group.error textarea:focus { + border-color: #953b39; + -webkit-box-shadow: 0 0 6px #d59392; + -moz-box-shadow: 0 0 6px #d59392; + box-shadow: 0 0 6px #d59392; +} +.control-group.error .input-prepend .add-on, +.control-group.error .input-append .add-on { + color: #b94a48; + background-color: #f2dede; + border-color: #b94a48; +} +.control-group.success > label, +.control-group.success .help-block, +.control-group.success .help-inline { + color: #468847; +} +.control-group.success .checkbox, +.control-group.success .radio, +.control-group.success input, +.control-group.success select, +.control-group.success textarea { + color: #468847; + border-color: #468847; +} +.control-group.success .checkbox:focus, +.control-group.success .radio:focus, +.control-group.success input:focus, +.control-group.success select:focus, +.control-group.success textarea:focus { + border-color: #356635; + -webkit-box-shadow: 0 0 6px #7aba7b; + -moz-box-shadow: 0 0 6px #7aba7b; + box-shadow: 0 0 6px #7aba7b; +} +.control-group.success .input-prepend .add-on, +.control-group.success .input-append .add-on { + color: #468847; + background-color: #dff0d8; + border-color: #468847; +} +input:focus:required:invalid, +textarea:focus:required:invalid, +select:focus:required:invalid { + color: #b94a48; + border-color: #ee5f5b; +} +input:focus:required:invalid:focus, +textarea:focus:required:invalid:focus, +select:focus:required:invalid:focus { + border-color: #e9322d; + -webkit-box-shadow: 0 0 6px #f8b9b7; + -moz-box-shadow: 0 0 6px #f8b9b7; + box-shadow: 0 0 6px #f8b9b7; +} +.form-actions { + padding: 17px 20px 18px; + margin-top: 18px; + margin-bottom: 18px; + background-color: #f5f5f5; + border-top: 1px solid #e5e5e5; + *zoom: 1; +} +.form-actions:before, +.form-actions:after { + display: table; + content: ""; +} +.form-actions:after { + clear: both; +} +.uneditable-input { + overflow: hidden; + white-space: nowrap; + cursor: not-allowed; + background-color: #ffffff; + border-color: #eee; + -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025); + -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025); + box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025); +} +:-moz-placeholder { + color: #999999; +} +:-ms-input-placeholder { + color: #999999; +} +::-webkit-input-placeholder { + color: #999999; +} +.help-block, +.help-inline { + color: #555555; +} +.help-block { + display: block; + margin-bottom: 9px; +} +.help-inline { + display: inline-block; + *display: inline; + /* IE7 inline-block hack */ + + *zoom: 1; + vertical-align: middle; + padding-left: 5px; +} +.input-prepend, +.input-append { + margin-bottom: 5px; +} +.input-prepend input, +.input-append input, +.input-prepend select, +.input-append select, +.input-prepend .uneditable-input, +.input-append .uneditable-input { + position: relative; + margin-bottom: 0; + *margin-left: 0; + vertical-align: middle; + -webkit-border-radius: 0 3px 3px 0; + -moz-border-radius: 0 3px 3px 0; + border-radius: 0 3px 3px 0; +} +.input-prepend input:focus, +.input-append input:focus, +.input-prepend select:focus, +.input-append select:focus, +.input-prepend .uneditable-input:focus, +.input-append .uneditable-input:focus { + z-index: 2; +} +.input-prepend .uneditable-input, +.input-append .uneditable-input { + border-left-color: #ccc; +} +.input-prepend .add-on, +.input-append .add-on { + display: inline-block; + width: auto; + height: 18px; + min-width: 16px; + padding: 4px 5px; + font-weight: normal; + line-height: 18px; + text-align: center; + text-shadow: 0 1px 0 #ffffff; + vertical-align: middle; + background-color: #eeeeee; + border: 1px solid #ccc; +} +.input-prepend .add-on, +.input-append .add-on, +.input-prepend .btn, +.input-append .btn { + margin-left: -1px; + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; +} +.input-prepend .active, +.input-append .active { + background-color: #a9dba9; + border-color: #46a546; +} +.input-prepend .add-on, +.input-prepend .btn { + margin-right: -1px; +} +.input-prepend .add-on:first-child, +.input-prepend .btn:first-child { + -webkit-border-radius: 3px 0 0 3px; + -moz-border-radius: 3px 0 0 3px; + border-radius: 3px 0 0 3px; +} +.input-append input, +.input-append select, +.input-append .uneditable-input { + -webkit-border-radius: 3px 0 0 3px; + -moz-border-radius: 3px 0 0 3px; + border-radius: 3px 0 0 3px; +} +.input-append .uneditable-input { + border-right-color: #ccc; + border-left-color: #eee; +} +.input-append .add-on:last-child, +.input-append .btn:last-child { + -webkit-border-radius: 0 3px 3px 0; + -moz-border-radius: 0 3px 3px 0; + border-radius: 0 3px 3px 0; +} +.input-prepend.input-append input, +.input-prepend.input-append select, +.input-prepend.input-append .uneditable-input { + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; +} +.input-prepend.input-append .add-on:first-child, +.input-prepend.input-append .btn:first-child { + margin-right: -1px; + -webkit-border-radius: 3px 0 0 3px; + -moz-border-radius: 3px 0 0 3px; + border-radius: 3px 0 0 3px; +} +.input-prepend.input-append .add-on:last-child, +.input-prepend.input-append .btn:last-child { + margin-left: -1px; + -webkit-border-radius: 0 3px 3px 0; + -moz-border-radius: 0 3px 3px 0; + border-radius: 0 3px 3px 0; +} +.search-query { + padding-right: 14px; + padding-right: 4px \9; + padding-left: 14px; + padding-left: 4px \9; + /* IE7-8 doesn't have border-radius, so don't indent the padding */ + + margin-bottom: 0; + -webkit-border-radius: 14px; + -moz-border-radius: 14px; + border-radius: 14px; +} +.form-search input, +.form-inline input, +.form-horizontal input, +.form-search textarea, +.form-inline textarea, +.form-horizontal textarea, +.form-search select, +.form-inline select, +.form-horizontal select, +.form-search .help-inline, +.form-inline .help-inline, +.form-horizontal .help-inline, +.form-search .uneditable-input, +.form-inline .uneditable-input, +.form-horizontal .uneditable-input, +.form-search .input-prepend, +.form-inline .input-prepend, +.form-horizontal .input-prepend, +.form-search .input-append, +.form-inline .input-append, +.form-horizontal .input-append { + display: inline-block; + *display: inline; + /* IE7 inline-block hack */ + + *zoom: 1; + margin-bottom: 0; +} +.form-search .hide, +.form-inline .hide, +.form-horizontal .hide { + display: none; +} +.form-search label, +.form-inline label { + display: inline-block; +} +.form-search .input-append, +.form-inline .input-append, +.form-search .input-prepend, +.form-inline .input-prepend { + margin-bottom: 0; +} +.form-search .radio, +.form-search .checkbox, +.form-inline .radio, +.form-inline .checkbox { + padding-left: 0; + margin-bottom: 0; + vertical-align: middle; +} +.form-search .radio input[type="radio"], +.form-search .checkbox input[type="checkbox"], +.form-inline .radio input[type="radio"], +.form-inline .checkbox input[type="checkbox"] { + float: left; + margin-right: 3px; + margin-left: 0; +} +.control-group { + margin-bottom: 9px; +} +legend + .control-group { + margin-top: 18px; + -webkit-margin-top-collapse: separate; +} +.form-horizontal .control-group { + margin-bottom: 18px; + *zoom: 1; +} +.form-horizontal .control-group:before, +.form-horizontal .control-group:after { + display: table; + content: ""; +} +.form-horizontal .control-group:after { + clear: both; +} +.form-horizontal .control-label { + float: left; + width: 140px; + padding-top: 5px; + text-align: right; +} +.form-horizontal .controls { + *display: inline-block; + *padding-left: 20px; + margin-left: 160px; + *margin-left: 0; +} +.form-horizontal .controls:first-child { + *padding-left: 160px; +} +.form-horizontal .help-block { + margin-top: 9px; + margin-bottom: 0; +} +.form-horizontal .form-actions { + padding-left: 160px; +} +table { + max-width: 100%; + background-color: transparent; + border-collapse: collapse; + border-spacing: 0; +} +.table { + width: 100%; + margin-bottom: 18px; +} +.table th, +.table td { + padding: 8px; + line-height: 18px; + text-align: left; + vertical-align: top; + border-top: 1px solid #dddddd; +} +.table th { + font-weight: bold; +} +.table thead th { + vertical-align: bottom; +} +.table caption + thead tr:first-child th, +.table caption + thead tr:first-child td, +.table colgroup + thead tr:first-child th, +.table colgroup + thead tr:first-child td, +.table thead:first-child tr:first-child th, +.table thead:first-child tr:first-child td { + border-top: 0; +} +.table tbody + tbody { + border-top: 2px solid #dddddd; +} +.table-condensed th, +.table-condensed td { + padding: 4px 5px; +} +.table-bordered { + border: 1px solid #dddddd; + border-collapse: separate; + *border-collapse: collapsed; + border-left: 0; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} +.table-bordered th, +.table-bordered td { + border-left: 1px solid #dddddd; +} +.table-bordered caption + thead tr:first-child th, +.table-bordered caption + tbody tr:first-child th, +.table-bordered caption + tbody tr:first-child td, +.table-bordered colgroup + thead tr:first-child th, +.table-bordered colgroup + tbody tr:first-child th, +.table-bordered colgroup + tbody tr:first-child td, +.table-bordered thead:first-child tr:first-child th, +.table-bordered tbody:first-child tr:first-child th, +.table-bordered tbody:first-child tr:first-child td { + border-top: 0; +} +.table-bordered thead:first-child tr:first-child th:first-child, +.table-bordered tbody:first-child tr:first-child td:first-child { + -webkit-border-top-left-radius: 4px; + border-top-left-radius: 4px; + -moz-border-radius-topleft: 4px; +} +.table-bordered thead:first-child tr:first-child th:last-child, +.table-bordered tbody:first-child tr:first-child td:last-child { + -webkit-border-top-right-radius: 4px; + border-top-right-radius: 4px; + -moz-border-radius-topright: 4px; +} +.table-bordered thead:last-child tr:last-child th:first-child, +.table-bordered tbody:last-child tr:last-child td:first-child { + -webkit-border-radius: 0 0 0 4px; + -moz-border-radius: 0 0 0 4px; + border-radius: 0 0 0 4px; + -webkit-border-bottom-left-radius: 4px; + border-bottom-left-radius: 4px; + -moz-border-radius-bottomleft: 4px; +} +.table-bordered thead:last-child tr:last-child th:last-child, +.table-bordered tbody:last-child tr:last-child td:last-child { + -webkit-border-bottom-right-radius: 4px; + border-bottom-right-radius: 4px; + -moz-border-radius-bottomright: 4px; +} +.table-striped tbody tr:nth-child(odd) td, +.table-striped tbody tr:nth-child(odd) th { + background-color: #f9f9f9; +} +.table tbody tr:hover td, +.table tbody tr:hover th { + background-color: #f5f5f5; +} +table .span1 { + float: none; + width: 44px; + margin-left: 0; +} +table .span2 { + float: none; + width: 124px; + margin-left: 0; +} +table .span3 { + float: none; + width: 204px; + margin-left: 0; +} +table .span4 { + float: none; + width: 284px; + margin-left: 0; +} +table .span5 { + float: none; + width: 364px; + margin-left: 0; +} +table .span6 { + float: none; + width: 444px; + margin-left: 0; +} +table .span7 { + float: none; + width: 524px; + margin-left: 0; +} +table .span8 { + float: none; + width: 604px; + margin-left: 0; +} +table .span9 { + float: none; + width: 684px; + margin-left: 0; +} +table .span10 { + float: none; + width: 764px; + margin-left: 0; +} +table .span11 { + float: none; + width: 844px; + margin-left: 0; +} +table .span12 { + float: none; + width: 924px; + margin-left: 0; +} +table .span13 { + float: none; + width: 1004px; + margin-left: 0; +} +table .span14 { + float: none; + width: 1084px; + margin-left: 0; +} +table .span15 { + float: none; + width: 1164px; + margin-left: 0; +} +table .span16 { + float: none; + width: 1244px; + margin-left: 0; +} +table .span17 { + float: none; + width: 1324px; + margin-left: 0; +} +table .span18 { + float: none; + width: 1404px; + margin-left: 0; +} +table .span19 { + float: none; + width: 1484px; + margin-left: 0; +} +table .span20 { + float: none; + width: 1564px; + margin-left: 0; +} +table .span21 { + float: none; + width: 1644px; + margin-left: 0; +} +table .span22 { + float: none; + width: 1724px; + margin-left: 0; +} +table .span23 { + float: none; + width: 1804px; + margin-left: 0; +} +table .span24 { + float: none; + width: 1884px; + margin-left: 0; +} +[class^="icon-"], +[class*=" icon-"] { + display: inline-block; + width: 14px; + height: 14px; + *margin-right: .3em; + line-height: 14px; + vertical-align: text-top; + background-image: url("../../images/glyphicons-halflings.png"); + background-position: 14px 14px; + background-repeat: no-repeat; +} +[class^="icon-"]:last-child, +[class*=" icon-"]:last-child { + *margin-left: 0; +} +.icon-white { + background-image: url("../../images/glyphicons-halflings-white.png"); +} +.icon-glass { + background-position: 0 0; +} +.icon-music { + background-position: -24px 0; +} +.icon-search { + background-position: -48px 0; +} +.icon-envelope { + background-position: -72px 0; +} +.icon-heart { + background-position: -96px 0; +} +.icon-star { + background-position: -120px 0; +} +.icon-star-empty { + background-position: -144px 0; +} +.icon-user { + background-position: -168px 0; +} +.icon-film { + background-position: -192px 0; +} +.icon-th-large { + background-position: -216px 0; +} +.icon-th { + background-position: -240px 0; +} +.icon-th-list { + background-position: -264px 0; +} +.icon-ok { + background-position: -288px 0; +} +.icon-remove { + background-position: -312px 0; +} +.icon-zoom-in { + background-position: -336px 0; +} +.icon-zoom-out { + background-position: -360px 0; +} +.icon-off { + background-position: -384px 0; +} +.icon-signal { + background-position: -408px 0; +} +.icon-cog { + background-position: -432px 0; +} +.icon-trash { + background-position: -456px 0; +} +.icon-home { + background-position: 0 -24px; +} +.icon-file { + background-position: -24px -24px; +} +.icon-time { + background-position: -48px -24px; +} +.icon-road { + background-position: -72px -24px; +} +.icon-download-alt { + background-position: -96px -24px; +} +.icon-download { + background-position: -120px -24px; +} +.icon-upload { + background-position: -144px -24px; +} +.icon-inbox { + background-position: -168px -24px; +} +.icon-play-circle { + background-position: -192px -24px; +} +.icon-repeat { + background-position: -216px -24px; +} +.icon-refresh { + background-position: -240px -24px; +} +.icon-list-alt { + background-position: -264px -24px; +} +.icon-lock { + background-position: -287px -24px; +} +.icon-flag { + background-position: -312px -24px; +} +.icon-headphones { + background-position: -336px -24px; +} +.icon-volume-off { + background-position: -360px -24px; +} +.icon-volume-down { + background-position: -384px -24px; +} +.icon-volume-up { + background-position: -408px -24px; +} +.icon-qrcode { + background-position: -432px -24px; +} +.icon-barcode { + background-position: -456px -24px; +} +.icon-tag { + background-position: 0 -48px; +} +.icon-tags { + background-position: -25px -48px; +} +.icon-book { + background-position: -48px -48px; +} +.icon-bookmark { + background-position: -72px -48px; +} +.icon-print { + background-position: -96px -48px; +} +.icon-camera { + background-position: -120px -48px; +} +.icon-font { + background-position: -144px -48px; +} +.icon-bold { + background-position: -167px -48px; +} +.icon-italic { + background-position: -192px -48px; +} +.icon-text-height { + background-position: -216px -48px; +} +.icon-text-width { + background-position: -240px -48px; +} +.icon-align-left { + background-position: -264px -48px; +} +.icon-align-center { + background-position: -288px -48px; +} +.icon-align-right { + background-position: -312px -48px; +} +.icon-align-justify { + background-position: -336px -48px; +} +.icon-list { + background-position: -360px -48px; +} +.icon-indent-left { + background-position: -384px -48px; +} +.icon-indent-right { + background-position: -408px -48px; +} +.icon-facetime-video { + background-position: -432px -48px; +} +.icon-picture { + background-position: -456px -48px; +} +.icon-pencil { + background-position: 0 -72px; +} +.icon-map-marker { + background-position: -24px -72px; +} +.icon-adjust { + background-position: -48px -72px; +} +.icon-tint { + background-position: -72px -72px; +} +.icon-edit { + background-position: -96px -72px; +} +.icon-share { + background-position: -120px -72px; +} +.icon-check { + background-position: -144px -72px; +} +.icon-move { + background-position: -168px -72px; +} +.icon-step-backward { + background-position: -192px -72px; +} +.icon-fast-backward { + background-position: -216px -72px; +} +.icon-backward { + background-position: -240px -72px; +} +.icon-play { + background-position: -264px -72px; +} +.icon-pause { + background-position: -288px -72px; +} +.icon-stop { + background-position: -312px -72px; +} +.icon-forward { + background-position: -336px -72px; +} +.icon-fast-forward { + background-position: -360px -72px; +} +.icon-step-forward { + background-position: -384px -72px; +} +.icon-eject { + background-position: -408px -72px; +} +.icon-chevron-left { + background-position: -432px -72px; +} +.icon-chevron-right { + background-position: -456px -72px; +} +.icon-plus-sign { + background-position: 0 -96px; +} +.icon-minus-sign { + background-position: -24px -96px; +} +.icon-remove-sign { + background-position: -48px -96px; +} +.icon-ok-sign { + background-position: -72px -96px; +} +.icon-question-sign { + background-position: -96px -96px; +} +.icon-info-sign { + background-position: -120px -96px; +} +.icon-screenshot { + background-position: -144px -96px; +} +.icon-remove-circle { + background-position: -168px -96px; +} +.icon-ok-circle { + background-position: -192px -96px; +} +.icon-ban-circle { + background-position: -216px -96px; +} +.icon-arrow-left { + background-position: -240px -96px; +} +.icon-arrow-right { + background-position: -264px -96px; +} +.icon-arrow-up { + background-position: -289px -96px; +} +.icon-arrow-down { + background-position: -312px -96px; +} +.icon-share-alt { + background-position: -336px -96px; +} +.icon-resize-full { + background-position: -360px -96px; +} +.icon-resize-small { + background-position: -384px -96px; +} +.icon-plus { + background-position: -408px -96px; +} +.icon-minus { + background-position: -433px -96px; +} +.icon-asterisk { + background-position: -456px -96px; +} +.icon-exclamation-sign { + background-position: 0 -120px; +} +.icon-gift { + background-position: -24px -120px; +} +.icon-leaf { + background-position: -48px -120px; +} +.icon-fire { + background-position: -72px -120px; +} +.icon-eye-open { + background-position: -96px -120px; +} +.icon-eye-close { + background-position: -120px -120px; +} +.icon-warning-sign { + background-position: -144px -120px; +} +.icon-plane { + background-position: -168px -120px; +} +.icon-calendar { + background-position: -192px -120px; +} +.icon-random { + background-position: -216px -120px; +} +.icon-comment { + background-position: -240px -120px; +} +.icon-magnet { + background-position: -264px -120px; +} +.icon-chevron-up { + background-position: -288px -120px; +} +.icon-chevron-down { + background-position: -313px -119px; +} +.icon-retweet { + background-position: -336px -120px; +} +.icon-shopping-cart { + background-position: -360px -120px; +} +.icon-folder-close { + background-position: -384px -120px; +} +.icon-folder-open { + background-position: -408px -120px; +} +.icon-resize-vertical { + background-position: -432px -119px; +} +.icon-resize-horizontal { + background-position: -456px -118px; +} +.icon-hdd { + background-position: 0 -144px; +} +.icon-bullhorn { + background-position: -24px -144px; +} +.icon-bell { + background-position: -48px -144px; +} +.icon-certificate { + background-position: -72px -144px; +} +.icon-thumbs-up { + background-position: -96px -144px; +} +.icon-thumbs-down { + background-position: -120px -144px; +} +.icon-hand-right { + background-position: -144px -144px; +} +.icon-hand-left { + background-position: -168px -144px; +} +.icon-hand-up { + background-position: -192px -144px; +} +.icon-hand-down { + background-position: -216px -144px; +} +.icon-circle-arrow-right { + background-position: -240px -144px; +} +.icon-circle-arrow-left { + background-position: -264px -144px; +} +.icon-circle-arrow-up { + background-position: -288px -144px; +} +.icon-circle-arrow-down { + background-position: -312px -144px; +} +.icon-globe { + background-position: -336px -144px; +} +.icon-wrench { + background-position: -360px -144px; +} +.icon-tasks { + background-position: -384px -144px; +} +.icon-filter { + background-position: -408px -144px; +} +.icon-briefcase { + background-position: -432px -144px; +} +.icon-fullscreen { + background-position: -456px -144px; +} +.dropup, +.dropdown { + position: relative; +} +.dropdown-toggle { + *margin-bottom: -3px; +} +.dropdown-toggle:active, +.open .dropdown-toggle { + outline: 0; +} +.caret { + display: inline-block; + width: 0; + height: 0; + vertical-align: top; + border-top: 4px solid #000000; + border-right: 4px solid transparent; + border-left: 4px solid transparent; + content: ""; + opacity: 0.3; + filter: alpha(opacity=30); +} +.dropdown .caret { + margin-top: 8px; + margin-left: 2px; +} +.dropdown:hover .caret, +.open .caret { + opacity: 1; + filter: alpha(opacity=100); +} +.dropdown-menu { + position: absolute; + top: 100%; + left: 0; + z-index: 1000; + display: none; + float: left; + min-width: 160px; + padding: 4px 0; + margin: 1px 0 0; + list-style: none; + 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; +} +.dropdown-menu.pull-right { + right: 0; + left: auto; +} +.dropdown-menu .divider { + *width: 100%; + height: 1px; + margin: 8px 1px; + *margin: -5px 0 5px; + overflow: hidden; + background-color: #e5e5e5; + border-bottom: 1px solid #ffffff; +} +.dropdown-menu a { + display: block; + padding: 3px 15px; + clear: both; + font-weight: normal; + line-height: 18px; + color: #333333; + white-space: nowrap; +} +.dropdown-menu li > a:hover, +.dropdown-menu .active > a, +.dropdown-menu .active > a:hover { + color: #ffffff; + text-decoration: none; + background-color: #0088cc; +} +.open { + *z-index: 1000; +} +.open > .dropdown-menu { + display: block; +} +.pull-right > .dropdown-menu { + right: 0; + left: auto; +} +.dropup .caret, +.navbar-fixed-bottom .dropdown .caret { + border-top: 0; + border-bottom: 4px solid #000000; + content: "\2191"; +} +.dropup .dropdown-menu, +.navbar-fixed-bottom .dropdown .dropdown-menu { + top: auto; + bottom: 100%; + margin-bottom: 1px; +} +.typeahead { + margin-top: 2px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} +.well { + min-height: 20px; + padding: 19px; + margin-bottom: 20px; + background-color: #f5f5f5; + border: 1px solid #eee; + border: 1px solid rgba(0, 0, 0, 0.05); + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); +} +.well blockquote { + border-color: #ddd; + border-color: rgba(0, 0, 0, 0.15); +} +.well-large { + padding: 24px; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; +} +.well-small { + padding: 9px; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} +.fade { + opacity: 0; + -webkit-transition: opacity 0.15s linear; + -moz-transition: opacity 0.15s linear; + -ms-transition: opacity 0.15s linear; + -o-transition: opacity 0.15s linear; + transition: opacity 0.15s linear; +} +.fade.in { + opacity: 1; +} +.collapse { + position: relative; + height: 0; + overflow: hidden; + -webkit-transition: height 0.35s ease; + -moz-transition: height 0.35s ease; + -ms-transition: height 0.35s ease; + -o-transition: height 0.35s ease; + transition: height 0.35s ease; +} +.collapse.in { + height: auto; +} +.close { + 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); +} +.close:hover { + color: #000000; + text-decoration: none; + cursor: pointer; + opacity: 0.4; + filter: alpha(opacity=40); +} +button.close { + padding: 0; + cursor: pointer; + background: transparent; + border: 0; + -webkit-appearance: none; +} +.btn { + display: inline-block; + *display: inline; + /* IE7 inline-block hack */ + + *zoom: 1; + padding: 4px 10px 4px; + margin-bottom: 0; + font-size: 13px; + line-height: 18px; + *line-height: 20px; + color: #333333; + text-align: center; + text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); + vertical-align: middle; + cursor: pointer; + background-color: #f5f5f5; + background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); + background-image: -ms-linear-gradient(top, #ffffff, #e6e6e6); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); + background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); + background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); + background-image: linear-gradient(top, #ffffff, #e6e6e6); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#e6e6e6', GradientType=0); + border-color: #e6e6e6 #e6e6e6 #bfbfbf; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + *background-color: #e6e6e6; + /* Darken IE7 buttons by default so they stand out more given they won't have borders */ + + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + border: 1px solid #cccccc; + *border: 0; + border-bottom-color: #b3b3b3; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + *margin-left: .3em; + -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); + -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); + box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); +} +.btn:hover, +.btn:active, +.btn.active, +.btn.disabled, +.btn[disabled] { + background-color: #e6e6e6; + *background-color: #d9d9d9; +} +.btn:active, +.btn.active { + background-color: #cccccc \9; +} +.btn:first-child { + *margin-left: 0; +} +.btn:hover { + color: #333333; + text-decoration: none; + background-color: #e6e6e6; + *background-color: #d9d9d9; + /* Buttons in IE7 don't get borders, so darken on hover */ + + background-position: 0 -15px; + -webkit-transition: background-position 0.1s linear; + -moz-transition: background-position 0.1s linear; + -ms-transition: background-position 0.1s linear; + -o-transition: background-position 0.1s linear; + transition: background-position 0.1s linear; +} +.btn:focus { + outline: thin dotted #333; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} +.btn.active, +.btn:active { + background-color: #e6e6e6; + background-color: #d9d9d9 \9; + background-image: none; + outline: 0; + -webkit-box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05); + -moz-box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05); + box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05); +} +.btn.disabled, +.btn[disabled] { + cursor: default; + background-color: #e6e6e6; + background-image: none; + opacity: 0.65; + filter: alpha(opacity=65); + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; +} +.btn-large { + padding: 9px 14px; + font-size: 15px; + line-height: normal; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; +} +.btn-large [class^="icon-"] { + margin-top: 1px; +} +.btn-small { + padding: 5px 9px; + font-size: 11px; + line-height: 16px; +} +.btn-small [class^="icon-"] { + margin-top: -1px; +} +.btn-mini { + padding: 2px 6px; + font-size: 11px; + line-height: 14px; +} +.btn-primary, +.btn-primary:hover, +.btn-warning, +.btn-warning:hover, +.btn-danger, +.btn-danger:hover, +.btn-success, +.btn-success:hover, +.btn-info, +.btn-info:hover, +.btn-inverse, +.btn-inverse:hover { + color: #ffffff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); +} +.btn-primary.active, +.btn-warning.active, +.btn-danger.active, +.btn-success.active, +.btn-info.active, +.btn-inverse.active { + color: rgba(255, 255, 255, 0.75); +} +.btn { + border-color: #ccc; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); +} +.btn-primary { + background-color: #0074cc; + background-image: -moz-linear-gradient(top, #0088cc, #0055cc); + background-image: -ms-linear-gradient(top, #0088cc, #0055cc); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0055cc)); + background-image: -webkit-linear-gradient(top, #0088cc, #0055cc); + background-image: -o-linear-gradient(top, #0088cc, #0055cc); + background-image: linear-gradient(top, #0088cc, #0055cc); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0055cc', GradientType=0); + border-color: #0055cc #0055cc #003580; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + *background-color: #0055cc; + /* Darken IE7 buttons by default so they stand out more given they won't have borders */ + + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); +} +.btn-primary:hover, +.btn-primary:active, +.btn-primary.active, +.btn-primary.disabled, +.btn-primary[disabled] { + background-color: #0055cc; + *background-color: #004ab3; +} +.btn-primary:active, +.btn-primary.active { + background-color: #004099 \9; +} +.btn-warning { + background-color: #faa732; + background-image: -moz-linear-gradient(top, #fbb450, #f89406); + background-image: -ms-linear-gradient(top, #fbb450, #f89406); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406)); + background-image: -webkit-linear-gradient(top, #fbb450, #f89406); + background-image: -o-linear-gradient(top, #fbb450, #f89406); + background-image: linear-gradient(top, #fbb450, #f89406); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fbb450', endColorstr='#f89406', GradientType=0); + border-color: #f89406 #f89406 #ad6704; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + *background-color: #f89406; + /* Darken IE7 buttons by default so they stand out more given they won't have borders */ + + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); +} +.btn-warning:hover, +.btn-warning:active, +.btn-warning.active, +.btn-warning.disabled, +.btn-warning[disabled] { + background-color: #f89406; + *background-color: #df8505; +} +.btn-warning:active, +.btn-warning.active { + background-color: #c67605 \9; +} +.btn-danger { + background-color: #da4f49; + background-image: -moz-linear-gradient(top, #ee5f5b, #bd362f); + background-image: -ms-linear-gradient(top, #ee5f5b, #bd362f); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#bd362f)); + background-image: -webkit-linear-gradient(top, #ee5f5b, #bd362f); + background-image: -o-linear-gradient(top, #ee5f5b, #bd362f); + background-image: linear-gradient(top, #ee5f5b, #bd362f); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ee5f5b', endColorstr='#bd362f', GradientType=0); + border-color: #bd362f #bd362f #802420; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + *background-color: #bd362f; + /* Darken IE7 buttons by default so they stand out more given they won't have borders */ + + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); +} +.btn-danger:hover, +.btn-danger:active, +.btn-danger.active, +.btn-danger.disabled, +.btn-danger[disabled] { + background-color: #bd362f; + *background-color: #a9302a; +} +.btn-danger:active, +.btn-danger.active { + background-color: #942a25 \9; +} +.btn-success { + background-color: #5bb75b; + background-image: -moz-linear-gradient(top, #62c462, #51a351); + background-image: -ms-linear-gradient(top, #62c462, #51a351); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#51a351)); + background-image: -webkit-linear-gradient(top, #62c462, #51a351); + background-image: -o-linear-gradient(top, #62c462, #51a351); + background-image: linear-gradient(top, #62c462, #51a351); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#51a351', GradientType=0); + border-color: #51a351 #51a351 #387038; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + *background-color: #51a351; + /* Darken IE7 buttons by default so they stand out more given they won't have borders */ + + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); +} +.btn-success:hover, +.btn-success:active, +.btn-success.active, +.btn-success.disabled, +.btn-success[disabled] { + background-color: #51a351; + *background-color: #499249; +} +.btn-success:active, +.btn-success.active { + background-color: #408140 \9; +} +.btn-info { + background-color: #49afcd; + background-image: -moz-linear-gradient(top, #5bc0de, #2f96b4); + background-image: -ms-linear-gradient(top, #5bc0de, #2f96b4); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#2f96b4)); + background-image: -webkit-linear-gradient(top, #5bc0de, #2f96b4); + background-image: -o-linear-gradient(top, #5bc0de, #2f96b4); + background-image: linear-gradient(top, #5bc0de, #2f96b4); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5bc0de', endColorstr='#2f96b4', GradientType=0); + border-color: #2f96b4 #2f96b4 #1f6377; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + *background-color: #2f96b4; + /* Darken IE7 buttons by default so they stand out more given they won't have borders */ + + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); +} +.btn-info:hover, +.btn-info:active, +.btn-info.active, +.btn-info.disabled, +.btn-info[disabled] { + background-color: #2f96b4; + *background-color: #2a85a0; +} +.btn-info:active, +.btn-info.active { + background-color: #24748c \9; +} +.btn-inverse { + background-color: #414141; + background-image: -moz-linear-gradient(top, #555555, #222222); + background-image: -ms-linear-gradient(top, #555555, #222222); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#555555), to(#222222)); + background-image: -webkit-linear-gradient(top, #555555, #222222); + background-image: -o-linear-gradient(top, #555555, #222222); + background-image: linear-gradient(top, #555555, #222222); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#555555', endColorstr='#222222', GradientType=0); + border-color: #222222 #222222 #000000; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + *background-color: #222222; + /* Darken IE7 buttons by default so they stand out more given they won't have borders */ + + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); +} +.btn-inverse:hover, +.btn-inverse:active, +.btn-inverse.active, +.btn-inverse.disabled, +.btn-inverse[disabled] { + background-color: #222222; + *background-color: #151515; +} +.btn-inverse:active, +.btn-inverse.active { + background-color: #080808 \9; +} +button.btn, +input[type="submit"].btn { + *padding-top: 2px; + *padding-bottom: 2px; +} +button.btn::-moz-focus-inner, +input[type="submit"].btn::-moz-focus-inner { + padding: 0; + border: 0; +} +button.btn.btn-large, +input[type="submit"].btn.btn-large { + *padding-top: 7px; + *padding-bottom: 7px; +} +button.btn.btn-small, +input[type="submit"].btn.btn-small { + *padding-top: 3px; + *padding-bottom: 3px; +} +button.btn.btn-mini, +input[type="submit"].btn.btn-mini { + *padding-top: 1px; + *padding-bottom: 1px; +} +.btn-group { + position: relative; + *zoom: 1; + *margin-left: .3em; +} +.btn-group:before, +.btn-group:after { + display: table; + content: ""; +} +.btn-group:after { + clear: both; +} +.btn-group:first-child { + *margin-left: 0; +} +.btn-group + .btn-group { + margin-left: 5px; +} +.btn-toolbar { + margin-top: 9px; + margin-bottom: 9px; +} +.btn-toolbar .btn-group { + display: inline-block; + *display: inline; + /* IE7 inline-block hack */ + + *zoom: 1; +} +.btn-group > .btn { + position: relative; + float: left; + margin-left: -1px; + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; +} +.btn-group > .btn:first-child { + margin-left: 0; + -webkit-border-top-left-radius: 4px; + -moz-border-radius-topleft: 4px; + border-top-left-radius: 4px; + -webkit-border-bottom-left-radius: 4px; + -moz-border-radius-bottomleft: 4px; + border-bottom-left-radius: 4px; +} +.btn-group > .btn:last-child, +.btn-group > .dropdown-toggle { + -webkit-border-top-right-radius: 4px; + -moz-border-radius-topright: 4px; + border-top-right-radius: 4px; + -webkit-border-bottom-right-radius: 4px; + -moz-border-radius-bottomright: 4px; + border-bottom-right-radius: 4px; +} +.btn-group > .btn.large:first-child { + margin-left: 0; + -webkit-border-top-left-radius: 6px; + -moz-border-radius-topleft: 6px; + border-top-left-radius: 6px; + -webkit-border-bottom-left-radius: 6px; + -moz-border-radius-bottomleft: 6px; + border-bottom-left-radius: 6px; +} +.btn-group > .btn.large:last-child, +.btn-group > .large.dropdown-toggle { + -webkit-border-top-right-radius: 6px; + -moz-border-radius-topright: 6px; + border-top-right-radius: 6px; + -webkit-border-bottom-right-radius: 6px; + -moz-border-radius-bottomright: 6px; + border-bottom-right-radius: 6px; +} +.btn-group > .btn:hover, +.btn-group > .btn:focus, +.btn-group > .btn:active, +.btn-group > .btn.active { + z-index: 2; +} +.btn-group .dropdown-toggle:active, +.btn-group.open .dropdown-toggle { + outline: 0; +} +.btn-group > .dropdown-toggle { + padding-left: 8px; + padding-right: 8px; + -webkit-box-shadow: inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); + -moz-box-shadow: inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); + box-shadow: inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); + *padding-top: 4px; + *padding-bottom: 4px; +} +.btn-group > .btn-mini.dropdown-toggle { + padding-left: 5px; + padding-right: 5px; +} +.btn-group > .btn-small.dropdown-toggle { + *padding-top: 4px; + *padding-bottom: 4px; +} +.btn-group > .btn-large.dropdown-toggle { + padding-left: 12px; + padding-right: 12px; +} +.btn-group.open .dropdown-toggle { + background-image: none; + -webkit-box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05); + -moz-box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05); + box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05); +} +.btn-group.open .btn.dropdown-toggle { + background-color: #e6e6e6; +} +.btn-group.open .btn-primary.dropdown-toggle { + background-color: #0055cc; +} +.btn-group.open .btn-warning.dropdown-toggle { + background-color: #f89406; +} +.btn-group.open .btn-danger.dropdown-toggle { + background-color: #bd362f; +} +.btn-group.open .btn-success.dropdown-toggle { + background-color: #51a351; +} +.btn-group.open .btn-info.dropdown-toggle { + background-color: #2f96b4; +} +.btn-group.open .btn-inverse.dropdown-toggle { + background-color: #222222; +} +.btn .caret { + margin-top: 7px; + margin-left: 0; +} +.btn:hover .caret, +.open.btn-group .caret { + opacity: 1; + filter: alpha(opacity=100); +} +.btn-mini .caret { + margin-top: 5px; +} +.btn-small .caret { + margin-top: 6px; +} +.btn-large .caret { + margin-top: 6px; + border-left-width: 5px; + border-right-width: 5px; + border-top-width: 5px; +} +.dropup .btn-large .caret { + border-bottom: 5px solid #000000; + border-top: 0; +} +.btn-primary .caret, +.btn-warning .caret, +.btn-danger .caret, +.btn-info .caret, +.btn-success .caret, +.btn-inverse .caret { + border-top-color: #ffffff; + border-bottom-color: #ffffff; + opacity: 0.75; + filter: alpha(opacity=75); +} +.alert { + padding: 8px 35px 8px 14px; + margin-bottom: 18px; + 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; + color: #c09853; +} +.alert-heading { + color: inherit; +} +.alert .close { + position: relative; + top: -2px; + right: -21px; + line-height: 18px; +} +.alert-success { + background-color: #dff0d8; + border-color: #d6e9c6; + color: #468847; +} +.alert-danger, +.alert-error { + background-color: #f2dede; + border-color: #eed3d7; + color: #b94a48; +} +.alert-info { + background-color: #d9edf7; + border-color: #bce8f1; + color: #3a87ad; +} +.alert-block { + padding-top: 14px; + padding-bottom: 14px; +} +.alert-block > p, +.alert-block > ul { + margin-bottom: 0; +} +.alert-block p + p { + margin-top: 5px; +} +.nav { + margin-left: 0; + margin-bottom: 18px; + list-style: none; +} +.nav > li > a { + display: block; +} +.nav > li > a:hover { + text-decoration: none; + background-color: #eeeeee; +} +.nav > .pull-right { + float: right; +} +.nav .nav-header { + display: block; + padding: 3px 15px; + font-size: 11px; + font-weight: bold; + line-height: 18px; + color: #999999; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); + text-transform: uppercase; +} +.nav li + .nav-header { + margin-top: 9px; +} +.nav-list { + padding-left: 15px; + padding-right: 15px; + margin-bottom: 0; +} +.nav-list > li > a, +.nav-list .nav-header { + margin-left: -15px; + margin-right: -15px; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); +} +.nav-list > li > a { + padding: 3px 15px; +} +.nav-list > .active > a, +.nav-list > .active > a:hover { + color: #ffffff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); + background-color: #0088cc; +} +.nav-list [class^="icon-"] { + margin-right: 2px; +} +.nav-list .divider { + *width: 100%; + height: 1px; + margin: 8px 1px; + *margin: -5px 0 5px; + overflow: hidden; + background-color: #e5e5e5; + border-bottom: 1px solid #ffffff; +} +.nav-tabs, +.nav-pills { + *zoom: 1; +} +.nav-tabs:before, +.nav-pills:before, +.nav-tabs:after, +.nav-pills:after { + display: table; + content: ""; +} +.nav-tabs:after, +.nav-pills:after { + clear: both; +} +.nav-tabs > li, +.nav-pills > li { + float: left; +} +.nav-tabs > li > a, +.nav-pills > li > a { + padding-right: 12px; + padding-left: 12px; + margin-right: 2px; + line-height: 14px; +} +.nav-tabs { + border-bottom: 1px solid #ddd; +} +.nav-tabs > li { + margin-bottom: -1px; +} +.nav-tabs > li > a { + padding-top: 8px; + padding-bottom: 8px; + line-height: 18px; + border: 1px solid transparent; + -webkit-border-radius: 4px 4px 0 0; + -moz-border-radius: 4px 4px 0 0; + border-radius: 4px 4px 0 0; +} +.nav-tabs > li > a:hover { + border-color: #eeeeee #eeeeee #dddddd; +} +.nav-tabs > .active > a, +.nav-tabs > .active > a:hover { + color: #555555; + background-color: #ffffff; + border: 1px solid #ddd; + border-bottom-color: transparent; + cursor: default; +} +.nav-pills > li > a { + padding-top: 8px; + padding-bottom: 8px; + margin-top: 2px; + margin-bottom: 2px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; +} +.nav-pills > .active > a, +.nav-pills > .active > a:hover { + color: #ffffff; + background-color: #0088cc; +} +.nav-stacked > li { + float: none; +} +.nav-stacked > li > a { + margin-right: 0; +} +.nav-tabs.nav-stacked { + border-bottom: 0; +} +.nav-tabs.nav-stacked > li > a { + border: 1px solid #ddd; + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; +} +.nav-tabs.nav-stacked > li:first-child > a { + -webkit-border-radius: 4px 4px 0 0; + -moz-border-radius: 4px 4px 0 0; + border-radius: 4px 4px 0 0; +} +.nav-tabs.nav-stacked > li:last-child > a { + -webkit-border-radius: 0 0 4px 4px; + -moz-border-radius: 0 0 4px 4px; + border-radius: 0 0 4px 4px; +} +.nav-tabs.nav-stacked > li > a:hover { + border-color: #ddd; + z-index: 2; +} +.nav-pills.nav-stacked > li > a { + margin-bottom: 3px; +} +.nav-pills.nav-stacked > li:last-child > a { + margin-bottom: 1px; +} +.nav-tabs .dropdown-menu { + -webkit-border-radius: 0 0 5px 5px; + -moz-border-radius: 0 0 5px 5px; + border-radius: 0 0 5px 5px; +} +.nav-pills .dropdown-menu { + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} +.nav-tabs .dropdown-toggle .caret, +.nav-pills .dropdown-toggle .caret { + border-top-color: #0088cc; + border-bottom-color: #0088cc; + margin-top: 6px; +} +.nav-tabs .dropdown-toggle:hover .caret, +.nav-pills .dropdown-toggle:hover .caret { + border-top-color: #005580; + border-bottom-color: #005580; +} +.nav-tabs .active .dropdown-toggle .caret, +.nav-pills .active .dropdown-toggle .caret { + border-top-color: #333333; + border-bottom-color: #333333; +} +.nav > .dropdown.active > a:hover { + color: #000000; + cursor: pointer; +} +.nav-tabs .open .dropdown-toggle, +.nav-pills .open .dropdown-toggle, +.nav > li.dropdown.open.active > a:hover { + color: #ffffff; + background-color: #999999; + border-color: #999999; +} +.nav li.dropdown.open .caret, +.nav li.dropdown.open.active .caret, +.nav li.dropdown.open a:hover .caret { + border-top-color: #ffffff; + border-bottom-color: #ffffff; + opacity: 1; + filter: alpha(opacity=100); +} +.tabs-stacked .open > a:hover { + border-color: #999999; +} +.tabbable { + *zoom: 1; +} +.tabbable:before, +.tabbable:after { + display: table; + content: ""; +} +.tabbable:after { + clear: both; +} +.tab-content { + overflow: auto; +} +.tabs-below > .nav-tabs, +.tabs-right > .nav-tabs, +.tabs-left > .nav-tabs { + border-bottom: 0; +} +.tab-content > .tab-pane, +.pill-content > .pill-pane { + display: none; +} +.tab-content > .active, +.pill-content > .active { + display: block; +} +.tabs-below > .nav-tabs { + border-top: 1px solid #ddd; +} +.tabs-below > .nav-tabs > li { + margin-top: -1px; + margin-bottom: 0; +} +.tabs-below > .nav-tabs > li > a { + -webkit-border-radius: 0 0 4px 4px; + -moz-border-radius: 0 0 4px 4px; + border-radius: 0 0 4px 4px; +} +.tabs-below > .nav-tabs > li > a:hover { + border-bottom-color: transparent; + border-top-color: #ddd; +} +.tabs-below > .nav-tabs > .active > a, +.tabs-below > .nav-tabs > .active > a:hover { + border-color: transparent #ddd #ddd #ddd; +} +.tabs-left > .nav-tabs > li, +.tabs-right > .nav-tabs > li { + float: none; +} +.tabs-left > .nav-tabs > li > a, +.tabs-right > .nav-tabs > li > a { + min-width: 74px; + margin-right: 0; + margin-bottom: 3px; +} +.tabs-left > .nav-tabs { + float: left; + margin-right: 19px; + border-right: 1px solid #ddd; +} +.tabs-left > .nav-tabs > li > a { + margin-right: -1px; + -webkit-border-radius: 4px 0 0 4px; + -moz-border-radius: 4px 0 0 4px; + border-radius: 4px 0 0 4px; +} +.tabs-left > .nav-tabs > li > a:hover { + border-color: #eeeeee #dddddd #eeeeee #eeeeee; +} +.tabs-left > .nav-tabs .active > a, +.tabs-left > .nav-tabs .active > a:hover { + border-color: #ddd transparent #ddd #ddd; + *border-right-color: #ffffff; +} +.tabs-right > .nav-tabs { + float: right; + margin-left: 19px; + border-left: 1px solid #ddd; +} +.tabs-right > .nav-tabs > li > a { + margin-left: -1px; + -webkit-border-radius: 0 4px 4px 0; + -moz-border-radius: 0 4px 4px 0; + border-radius: 0 4px 4px 0; +} +.tabs-right > .nav-tabs > li > a:hover { + border-color: #eeeeee #eeeeee #eeeeee #dddddd; +} +.tabs-right > .nav-tabs .active > a, +.tabs-right > .nav-tabs .active > a:hover { + border-color: #ddd #ddd #ddd transparent; + *border-left-color: #ffffff; +} +.navbar { + *position: relative; + *z-index: 2; + overflow: visible; + margin-bottom: 18px; +} +.navbar-inner { + min-height: 40px; + padding-left: 20px; + padding-right: 20px; + background-color: #2c2c2c; + background-image: -moz-linear-gradient(top, #333333, #222222); + background-image: -ms-linear-gradient(top, #333333, #222222); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#333333), to(#222222)); + background-image: -webkit-linear-gradient(top, #333333, #222222); + background-image: -o-linear-gradient(top, #333333, #222222); + background-image: linear-gradient(top, #333333, #222222); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0); + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + -webkit-box-shadow: 0 1px 3px rgba(0,0,0,.25), inset 0 -1px 0 rgba(0,0,0,.1); + -moz-box-shadow: 0 1px 3px rgba(0,0,0,.25), inset 0 -1px 0 rgba(0,0,0,.1); + box-shadow: 0 1px 3px rgba(0,0,0,.25), inset 0 -1px 0 rgba(0,0,0,.1); +} +.navbar .container { + width: auto; +} +.nav-collapse.collapse { + height: auto; +} +.navbar { + color: #999999; +} +.navbar .brand:hover { + text-decoration: none; +} +.navbar .brand { + float: left; + display: block; + padding: 8px 20px 12px; + margin-left: -20px; + font-size: 20px; + font-weight: 200; + line-height: 1; + color: #999999; +} +.navbar .navbar-text { + margin-bottom: 0; + line-height: 40px; +} +.navbar .navbar-link { + color: #999999; +} +.navbar .navbar-link:hover { + color: #ffffff; +} +.navbar .btn, +.navbar .btn-group { + margin-top: 5px; +} +.navbar .btn-group .btn { + margin: 0; +} +.navbar-form { + margin-bottom: 0; + *zoom: 1; +} +.navbar-form:before, +.navbar-form:after { + display: table; + content: ""; +} +.navbar-form:after { + clear: both; +} +.navbar-form input, +.navbar-form select, +.navbar-form .radio, +.navbar-form .checkbox { + margin-top: 5px; +} +.navbar-form input, +.navbar-form select { + display: inline-block; + margin-bottom: 0; +} +.navbar-form input[type="image"], +.navbar-form input[type="checkbox"], +.navbar-form input[type="radio"] { + margin-top: 3px; +} +.navbar-form .input-append, +.navbar-form .input-prepend { + margin-top: 6px; + white-space: nowrap; +} +.navbar-form .input-append input, +.navbar-form .input-prepend input { + margin-top: 0; +} +.navbar-search { + position: relative; + float: left; + margin-top: 6px; + margin-bottom: 0; +} +.navbar-search .search-query { + padding: 4px 9px; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 13px; + font-weight: normal; + line-height: 1; + color: #ffffff; + background-color: #626262; + border: 1px solid #151515; + -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15); + -moz-box-shadow: inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15); + box-shadow: inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15); + -webkit-transition: none; + -moz-transition: none; + -ms-transition: none; + -o-transition: none; + transition: none; +} +.navbar-search .search-query:-moz-placeholder { + color: #cccccc; +} +.navbar-search .search-query:-ms-input-placeholder { + color: #cccccc; +} +.navbar-search .search-query::-webkit-input-placeholder { + color: #cccccc; +} +.navbar-search .search-query:focus, +.navbar-search .search-query.focused { + padding: 5px 10px; + color: #333333; + text-shadow: 0 1px 0 #ffffff; + background-color: #ffffff; + border: 0; + -webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); + -moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); + box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); + outline: 0; +} +.navbar-fixed-top, +.navbar-fixed-bottom { + position: fixed; + right: 0; + left: 0; + z-index: 1030; + margin-bottom: 0; +} +.navbar-fixed-top .navbar-inner, +.navbar-fixed-bottom .navbar-inner { + padding-left: 0; + padding-right: 0; + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; +} +.navbar-fixed-top .container, +.navbar-fixed-bottom .container { + width: 940px; +} +.navbar-fixed-top { + top: 0; +} +.navbar-fixed-bottom { + bottom: 0; +} +.navbar .nav { + position: relative; + left: 0; + display: block; + float: left; + margin: 0 10px 0 0; +} +.navbar .nav.pull-right { + float: right; +} +.navbar .nav > li { + display: block; + float: left; +} +.navbar .nav > li > a { + float: none; + padding: 9px 10px 11px; + line-height: 19px; + color: #999999; + text-decoration: none; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); +} +.navbar .btn { + display: inline-block; + padding: 4px 10px 4px; + margin: 5px 5px 6px; + line-height: 18px; +} +.navbar .btn-group { + margin: 0; + padding: 5px 5px 6px; +} +.navbar .nav > li > a:hover { + background-color: transparent; + color: #ffffff; + text-decoration: none; +} +.navbar .nav .active > a, +.navbar .nav .active > a:hover { + color: #ffffff; + text-decoration: none; + background-color: #222222; +} +.navbar .divider-vertical { + height: 40px; + width: 1px; + margin: 0 9px; + overflow: hidden; + background-color: #222222; + border-right: 1px solid #333333; +} +.navbar .nav.pull-right { + margin-left: 10px; + margin-right: 0; +} +.navbar .btn-navbar { + display: none; + float: right; + padding: 7px 10px; + margin-left: 5px; + margin-right: 5px; + background-color: #2c2c2c; + background-image: -moz-linear-gradient(top, #333333, #222222); + background-image: -ms-linear-gradient(top, #333333, #222222); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#333333), to(#222222)); + background-image: -webkit-linear-gradient(top, #333333, #222222); + background-image: -o-linear-gradient(top, #333333, #222222); + background-image: linear-gradient(top, #333333, #222222); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0); + border-color: #222222 #222222 #000000; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + *background-color: #222222; + /* Darken IE7 buttons by default so they stand out more given they won't have borders */ + + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075); + -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075); + box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075); +} +.navbar .btn-navbar:hover, +.navbar .btn-navbar:active, +.navbar .btn-navbar.active, +.navbar .btn-navbar.disabled, +.navbar .btn-navbar[disabled] { + background-color: #222222; + *background-color: #151515; +} +.navbar .btn-navbar:active, +.navbar .btn-navbar.active { + background-color: #080808 \9; +} +.navbar .btn-navbar .icon-bar { + display: block; + width: 18px; + height: 2px; + background-color: #f5f5f5; + -webkit-border-radius: 1px; + -moz-border-radius: 1px; + border-radius: 1px; + -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); + -moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); + box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); +} +.btn-navbar .icon-bar + .icon-bar { + margin-top: 3px; +} +.navbar .dropdown-menu:before { + content: ''; + display: inline-block; + border-left: 7px solid transparent; + border-right: 7px solid transparent; + border-bottom: 7px solid #ccc; + border-bottom-color: rgba(0, 0, 0, 0.2); + position: absolute; + top: -7px; + left: 9px; +} +.navbar .dropdown-menu:after { + content: ''; + display: inline-block; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid #ffffff; + position: absolute; + top: -6px; + left: 10px; +} +.navbar-fixed-bottom .dropdown-menu:before { + border-top: 7px solid #ccc; + border-top-color: rgba(0, 0, 0, 0.2); + border-bottom: 0; + bottom: -7px; + top: auto; +} +.navbar-fixed-bottom .dropdown-menu:after { + border-top: 6px solid #ffffff; + border-bottom: 0; + bottom: -6px; + top: auto; +} +.navbar .nav li.dropdown .dropdown-toggle .caret, +.navbar .nav li.dropdown.open .caret { + border-top-color: #ffffff; + border-bottom-color: #ffffff; +} +.navbar .nav li.dropdown.active .caret { + opacity: 1; + filter: alpha(opacity=100); +} +.navbar .nav li.dropdown.open > .dropdown-toggle, +.navbar .nav li.dropdown.active > .dropdown-toggle, +.navbar .nav li.dropdown.open.active > .dropdown-toggle { + background-color: transparent; +} +.navbar .nav li.dropdown.active > .dropdown-toggle:hover { + color: #ffffff; +} +.navbar .pull-right .dropdown-menu, +.navbar .dropdown-menu.pull-right { + left: auto; + right: 0; +} +.navbar .pull-right .dropdown-menu:before, +.navbar .dropdown-menu.pull-right:before { + left: auto; + right: 12px; +} +.navbar .pull-right .dropdown-menu:after, +.navbar .dropdown-menu.pull-right:after { + left: auto; + right: 13px; +} +.breadcrumb { + padding: 7px 14px; + margin: 0 0 18px; + list-style: none; + background-color: #fbfbfb; + background-image: -moz-linear-gradient(top, #ffffff, #f5f5f5); + background-image: -ms-linear-gradient(top, #ffffff, #f5f5f5); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#f5f5f5)); + background-image: -webkit-linear-gradient(top, #ffffff, #f5f5f5); + background-image: -o-linear-gradient(top, #ffffff, #f5f5f5); + background-image: linear-gradient(top, #ffffff, #f5f5f5); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f5f5f5', GradientType=0); + border: 1px solid #ddd; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + -webkit-box-shadow: inset 0 1px 0 #ffffff; + -moz-box-shadow: inset 0 1px 0 #ffffff; + box-shadow: inset 0 1px 0 #ffffff; +} +.breadcrumb li { + display: inline-block; + *display: inline; + /* IE7 inline-block hack */ + + *zoom: 1; + text-shadow: 0 1px 0 #ffffff; +} +.breadcrumb .divider { + padding: 0 5px; + color: #999999; +} +.breadcrumb .active a { + color: #333333; +} +.pagination { + height: 36px; + margin: 18px 0; +} +.pagination ul { + display: inline-block; + *display: inline; + /* IE7 inline-block hack */ + + *zoom: 1; + margin-left: 0; + margin-bottom: 0; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); + -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); +} +.pagination li { + display: inline; +} +.pagination a { + float: left; + padding: 0 14px; + line-height: 34px; + text-decoration: none; + border: 1px solid #ddd; + border-left-width: 0; +} +.pagination a:hover, +.pagination .active a { + background-color: #f5f5f5; +} +.pagination .active a { + color: #999999; + cursor: default; +} +.pagination .disabled span, +.pagination .disabled a, +.pagination .disabled a:hover { + color: #999999; + background-color: transparent; + cursor: default; +} +.pagination li:first-child a { + border-left-width: 1px; + -webkit-border-radius: 3px 0 0 3px; + -moz-border-radius: 3px 0 0 3px; + border-radius: 3px 0 0 3px; +} +.pagination li:last-child a { + -webkit-border-radius: 0 3px 3px 0; + -moz-border-radius: 0 3px 3px 0; + border-radius: 0 3px 3px 0; +} +.pagination-centered { + text-align: center; +} +.pagination-right { + text-align: right; +} +.pager { + margin-left: 0; + margin-bottom: 18px; + list-style: none; + text-align: center; + *zoom: 1; +} +.pager:before, +.pager:after { + display: table; + content: ""; +} +.pager:after { + clear: both; +} +.pager li { + display: inline; +} +.pager a { + display: inline-block; + padding: 5px 14px; + background-color: #fff; + border: 1px solid #ddd; + -webkit-border-radius: 15px; + -moz-border-radius: 15px; + border-radius: 15px; +} +.pager a:hover { + text-decoration: none; + background-color: #f5f5f5; +} +.pager .next a { + float: right; +} +.pager .previous a { + float: left; +} +.pager .disabled a, +.pager .disabled a:hover { + color: #999999; + background-color: #fff; + cursor: default; +} +.modal-open .dropdown-menu { + z-index: 2050; +} +.modal-open .dropdown.open { + *z-index: 2050; +} +.modal-open .popover { + z-index: 2060; +} +.modal-open .tooltip { + z-index: 2070; +} +.modal-backdrop { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 1040; + background-color: #000000; +} +.modal-backdrop.fade { + opacity: 0; +} +.modal-backdrop, +.modal-backdrop.fade.in { + opacity: 0.8; + filter: alpha(opacity=80); +} +.modal { + position: fixed; + top: 50%; + left: 50%; + z-index: 1050; + overflow: auto; + width: 560px; + margin: -250px 0 0 -280px; + background-color: #ffffff; + border: 1px solid #999; + border: 1px solid rgba(0, 0, 0, 0.3); + *border: 1px solid #999; + /* IE6-7 */ + + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; + -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); + -moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); + box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); + -webkit-background-clip: padding-box; + -moz-background-clip: padding-box; + background-clip: padding-box; +} +.modal.fade { + -webkit-transition: opacity .3s linear, top .3s ease-out; + -moz-transition: opacity .3s linear, top .3s ease-out; + -ms-transition: opacity .3s linear, top .3s ease-out; + -o-transition: opacity .3s linear, top .3s ease-out; + transition: opacity .3s linear, top .3s ease-out; + top: -25%; +} +.modal.fade.in { + top: 50%; +} +.modal-header { + padding: 9px 15px; + border-bottom: 1px solid #eee; +} +.modal-header .close { + margin-top: 2px; +} +.modal-body { + overflow-y: auto; + max-height: 400px; + padding: 15px; +} +.modal-form { + margin-bottom: 0; +} +.modal-footer { + padding: 14px 15px 15px; + margin-bottom: 0; + text-align: right; + background-color: #f5f5f5; + border-top: 1px solid #ddd; + -webkit-border-radius: 0 0 6px 6px; + -moz-border-radius: 0 0 6px 6px; + border-radius: 0 0 6px 6px; + -webkit-box-shadow: inset 0 1px 0 #ffffff; + -moz-box-shadow: inset 0 1px 0 #ffffff; + box-shadow: inset 0 1px 0 #ffffff; + *zoom: 1; +} +.modal-footer:before, +.modal-footer:after { + display: table; + content: ""; +} +.modal-footer:after { + clear: both; +} +.modal-footer .btn + .btn { + margin-left: 5px; + margin-bottom: 0; +} +.modal-footer .btn-group .btn + .btn { + margin-left: -1px; +} +.tooltip { + position: absolute; + z-index: 1020; + display: block; + visibility: visible; + padding: 5px; + font-size: 11px; + opacity: 0; + filter: alpha(opacity=0); +} +.tooltip.in { + opacity: 0.8; + filter: alpha(opacity=80); +} +.tooltip.top { + margin-top: -2px; +} +.tooltip.right { + margin-left: 2px; +} +.tooltip.bottom { + margin-top: 2px; +} +.tooltip.left { + margin-left: -2px; +} +.tooltip.top .tooltip-arrow { + bottom: 0; + left: 50%; + margin-left: -5px; + border-left: 5px solid transparent; + border-right: 5px solid transparent; + border-top: 5px solid #000000; +} +.tooltip.left .tooltip-arrow { + top: 50%; + right: 0; + margin-top: -5px; + border-top: 5px solid transparent; + border-bottom: 5px solid transparent; + border-left: 5px solid #000000; +} +.tooltip.bottom .tooltip-arrow { + top: 0; + left: 50%; + margin-left: -5px; + border-left: 5px solid transparent; + border-right: 5px solid transparent; + border-bottom: 5px solid #000000; +} +.tooltip.right .tooltip-arrow { + top: 50%; + left: 0; + margin-top: -5px; + border-top: 5px solid transparent; + border-bottom: 5px solid transparent; + border-right: 5px solid #000000; +} +.tooltip-inner { + max-width: 200px; + padding: 3px 8px; + color: #ffffff; + text-align: center; + text-decoration: none; + background-color: #000000; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} +.tooltip-arrow { + position: absolute; + width: 0; + height: 0; +} +.popover { + position: absolute; + top: 0; + left: 0; + z-index: 1010; + display: none; + padding: 5px; +} +.popover.top { + margin-top: -5px; +} +.popover.right { + margin-left: 5px; +} +.popover.bottom { + margin-top: 5px; +} +.popover.left { + margin-left: -5px; +} +.popover.top .arrow { + bottom: 0; + left: 50%; + margin-left: -5px; + border-left: 5px solid transparent; + border-right: 5px solid transparent; + border-top: 5px solid #000000; +} +.popover.right .arrow { + top: 50%; + left: 0; + margin-top: -5px; + border-top: 5px solid transparent; + border-bottom: 5px solid transparent; + border-right: 5px solid #000000; +} +.popover.bottom .arrow { + top: 0; + left: 50%; + margin-left: -5px; + border-left: 5px solid transparent; + border-right: 5px solid transparent; + border-bottom: 5px solid #000000; +} +.popover.left .arrow { + top: 50%; + right: 0; + margin-top: -5px; + border-top: 5px solid transparent; + border-bottom: 5px solid transparent; + border-left: 5px solid #000000; +} +.popover .arrow { + position: absolute; + width: 0; + height: 0; +} +.popover-inner { + padding: 3px; + width: 280px; + overflow: hidden; + background: #000000; + background: rgba(0, 0, 0, 0.8); + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; + -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); + -moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); + box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); +} +.popover-title { + padding: 9px 15px; + line-height: 1; + background-color: #f5f5f5; + border-bottom: 1px solid #eee; + -webkit-border-radius: 3px 3px 0 0; + -moz-border-radius: 3px 3px 0 0; + border-radius: 3px 3px 0 0; +} +.popover-content { + padding: 14px; + background-color: #ffffff; + -webkit-border-radius: 0 0 3px 3px; + -moz-border-radius: 0 0 3px 3px; + border-radius: 0 0 3px 3px; + -webkit-background-clip: padding-box; + -moz-background-clip: padding-box; + background-clip: padding-box; +} +.popover-content p, +.popover-content ul, +.popover-content ol { + margin-bottom: 0; +} +.thumbnails { + margin-left: -20px; + list-style: none; + *zoom: 1; +} +.thumbnails:before, +.thumbnails:after { + display: table; + content: ""; +} +.thumbnails:after { + clear: both; +} +.row-fluid .thumbnails { + margin-left: 0; +} +.thumbnails > li { + float: left; + margin-bottom: 18px; + margin-left: 20px; +} +.thumbnail { + display: block; + padding: 4px; + line-height: 1; + border: 1px solid #ddd; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075); + -moz-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075); + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075); +} +a.thumbnail:hover { + border-color: #0088cc; + -webkit-box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25); + -moz-box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25); + box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25); +} +.thumbnail > img { + display: block; + max-width: 100%; + margin-left: auto; + margin-right: auto; +} +.thumbnail .caption { + padding: 9px; +} +.label, +.badge { + font-size: 10.998px; + font-weight: bold; + line-height: 14px; + color: #ffffff; + vertical-align: baseline; + white-space: nowrap; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + background-color: #999999; +} +.label { + padding: 1px 4px 2px; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} +.badge { + padding: 1px 9px 2px; + -webkit-border-radius: 9px; + -moz-border-radius: 9px; + border-radius: 9px; +} +a.label:hover, +a.badge:hover { + color: #ffffff; + text-decoration: none; + cursor: pointer; +} +.label-important, +.badge-important { + background-color: #b94a48; +} +.label-important[href], +.badge-important[href] { + background-color: #953b39; +} +.label-warning, +.badge-warning { + background-color: #f89406; +} +.label-warning[href], +.badge-warning[href] { + background-color: #c67605; +} +.label-success, +.badge-success { + background-color: #468847; +} +.label-success[href], +.badge-success[href] { + background-color: #356635; +} +.label-info, +.badge-info { + background-color: #3a87ad; +} +.label-info[href], +.badge-info[href] { + background-color: #2d6987; +} +.label-inverse, +.badge-inverse { + background-color: #333333; +} +.label-inverse[href], +.badge-inverse[href] { + background-color: #1a1a1a; +} +@-webkit-keyframes progress-bar-stripes { + from { + background-position: 40px 0; + } + to { + background-position: 0 0; + } +} +@-moz-keyframes progress-bar-stripes { + from { + background-position: 40px 0; + } + to { + background-position: 0 0; + } +} +@-ms-keyframes progress-bar-stripes { + from { + background-position: 40px 0; + } + to { + background-position: 0 0; + } +} +@-o-keyframes progress-bar-stripes { + from { + background-position: 0 0; + } + to { + background-position: 40px 0; + } +} +@keyframes progress-bar-stripes { + from { + background-position: 40px 0; + } + to { + background-position: 0 0; + } +} +.progress { + overflow: hidden; + height: 18px; + margin-bottom: 18px; + background-color: #f7f7f7; + background-image: -moz-linear-gradient(top, #f5f5f5, #f9f9f9); + background-image: -ms-linear-gradient(top, #f5f5f5, #f9f9f9); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f5f5f5), to(#f9f9f9)); + background-image: -webkit-linear-gradient(top, #f5f5f5, #f9f9f9); + background-image: -o-linear-gradient(top, #f5f5f5, #f9f9f9); + background-image: linear-gradient(top, #f5f5f5, #f9f9f9); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f5f5f5', endColorstr='#f9f9f9', GradientType=0); + -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); + -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); + box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} +.progress .bar { + width: 0%; + height: 18px; + color: #ffffff; + font-size: 12px; + text-align: center; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + background-color: #0e90d2; + background-image: -moz-linear-gradient(top, #149bdf, #0480be); + background-image: -ms-linear-gradient(top, #149bdf, #0480be); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#149bdf), to(#0480be)); + background-image: -webkit-linear-gradient(top, #149bdf, #0480be); + background-image: -o-linear-gradient(top, #149bdf, #0480be); + background-image: linear-gradient(top, #149bdf, #0480be); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#149bdf', endColorstr='#0480be', GradientType=0); + -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); + -moz-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); + box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; + -webkit-transition: width 0.6s ease; + -moz-transition: width 0.6s ease; + -ms-transition: width 0.6s ease; + -o-transition: width 0.6s ease; + transition: width 0.6s ease; +} +.progress-striped .bar { + background-color: #149bdf; + background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); + background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + -webkit-background-size: 40px 40px; + -moz-background-size: 40px 40px; + -o-background-size: 40px 40px; + background-size: 40px 40px; +} +.progress.active .bar { + -webkit-animation: progress-bar-stripes 2s linear infinite; + -moz-animation: progress-bar-stripes 2s linear infinite; + -ms-animation: progress-bar-stripes 2s linear infinite; + -o-animation: progress-bar-stripes 2s linear infinite; + animation: progress-bar-stripes 2s linear infinite; +} +.progress-danger .bar { + background-color: #dd514c; + background-image: -moz-linear-gradient(top, #ee5f5b, #c43c35); + background-image: -ms-linear-gradient(top, #ee5f5b, #c43c35); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#c43c35)); + background-image: -webkit-linear-gradient(top, #ee5f5b, #c43c35); + background-image: -o-linear-gradient(top, #ee5f5b, #c43c35); + background-image: linear-gradient(top, #ee5f5b, #c43c35); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ee5f5b', endColorstr='#c43c35', GradientType=0); +} +.progress-danger.progress-striped .bar { + background-color: #ee5f5b; + background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); + background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); +} +.progress-success .bar { + background-color: #5eb95e; + background-image: -moz-linear-gradient(top, #62c462, #57a957); + background-image: -ms-linear-gradient(top, #62c462, #57a957); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#57a957)); + background-image: -webkit-linear-gradient(top, #62c462, #57a957); + background-image: -o-linear-gradient(top, #62c462, #57a957); + background-image: linear-gradient(top, #62c462, #57a957); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#57a957', GradientType=0); +} +.progress-success.progress-striped .bar { + background-color: #62c462; + background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); + background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); +} +.progress-info .bar { + background-color: #4bb1cf; + background-image: -moz-linear-gradient(top, #5bc0de, #339bb9); + background-image: -ms-linear-gradient(top, #5bc0de, #339bb9); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#339bb9)); + background-image: -webkit-linear-gradient(top, #5bc0de, #339bb9); + background-image: -o-linear-gradient(top, #5bc0de, #339bb9); + background-image: linear-gradient(top, #5bc0de, #339bb9); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5bc0de', endColorstr='#339bb9', GradientType=0); +} +.progress-info.progress-striped .bar { + background-color: #5bc0de; + background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); + background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); +} +.progress-warning .bar { + background-color: #faa732; + background-image: -moz-linear-gradient(top, #fbb450, #f89406); + background-image: -ms-linear-gradient(top, #fbb450, #f89406); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406)); + background-image: -webkit-linear-gradient(top, #fbb450, #f89406); + background-image: -o-linear-gradient(top, #fbb450, #f89406); + background-image: linear-gradient(top, #fbb450, #f89406); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fbb450', endColorstr='#f89406', GradientType=0); +} +.progress-warning.progress-striped .bar { + background-color: #fbb450; + background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); + background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); +} +.accordion { + margin-bottom: 18px; +} +.accordion-group { + margin-bottom: 2px; + border: 1px solid #e5e5e5; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} +.accordion-heading { + border-bottom: 0; +} +.accordion-heading .accordion-toggle { + display: block; + padding: 8px 15px; +} +.accordion-toggle { + cursor: pointer; +} +.accordion-inner { + padding: 9px 15px; + border-top: 1px solid #e5e5e5; +} +.carousel { + position: relative; + margin-bottom: 18px; + line-height: 1; +} +.carousel-inner { + overflow: hidden; + width: 100%; + position: relative; +} +.carousel .item { + display: none; + position: relative; + -webkit-transition: 0.6s ease-in-out left; + -moz-transition: 0.6s ease-in-out left; + -ms-transition: 0.6s ease-in-out left; + -o-transition: 0.6s ease-in-out left; + transition: 0.6s ease-in-out left; +} +.carousel .item > img { + display: block; + line-height: 1; +} +.carousel .active, +.carousel .next, +.carousel .prev { + display: block; +} +.carousel .active { + left: 0; +} +.carousel .next, +.carousel .prev { + position: absolute; + top: 0; + width: 100%; +} +.carousel .next { + left: 100%; +} +.carousel .prev { + left: -100%; +} +.carousel .next.left, +.carousel .prev.right { + left: 0; +} +.carousel .active.left { + left: -100%; +} +.carousel .active.right { + left: 100%; +} +.carousel-control { + position: absolute; + top: 40%; + left: 15px; + width: 40px; + height: 40px; + margin-top: -20px; + font-size: 60px; + font-weight: 100; + line-height: 30px; + color: #ffffff; + text-align: center; + background: #222222; + border: 3px solid #ffffff; + -webkit-border-radius: 23px; + -moz-border-radius: 23px; + border-radius: 23px; + opacity: 0.5; + filter: alpha(opacity=50); +} +.carousel-control.right { + left: auto; + right: 15px; +} +.carousel-control:hover { + color: #ffffff; + text-decoration: none; + opacity: 0.9; + filter: alpha(opacity=90); +} +.carousel-caption { + position: absolute; + left: 0; + right: 0; + bottom: 0; + padding: 10px 15px 5px; + background: #333333; + background: rgba(0, 0, 0, 0.75); +} +.carousel-caption h4, +.carousel-caption p { + color: #ffffff; +} +.hero-unit { + padding: 60px; + margin-bottom: 30px; + background-color: #eeeeee; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; +} +.hero-unit h1 { + margin-bottom: 0; + font-size: 60px; + line-height: 1; + color: inherit; + letter-spacing: -1px; +} +.hero-unit p { + font-size: 18px; + font-weight: 200; + line-height: 27px; + color: inherit; +} +.pull-right { + float: right; +} +.pull-left { + float: left; +} +.hide { + display: none; +} +.show { + display: block; +} +.invisible { + visibility: hidden; +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/bootstrap.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/bootstrap.less new file mode 100644 index 0000000..a3c34ce --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/bootstrap.less @@ -0,0 +1,62 @@ +/*! + * Bootstrap v2.0.4 + * + * Copyright 2012 Twitter, Inc + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Designed and built with all the love in the world @twitter by @mdo and @fat. + */ + +// CSS Reset +@import "reset.less"; + +// Core variables and mixins +@import "variables.less"; // Modify this for custom colors, font-sizes, etc +@import "mixins.less"; + +// Grid system and page structure +@import "scaffolding.less"; +@import "grid.less"; +@import "layouts.less"; + +// Base CSS +@import "type.less"; +@import "code.less"; +@import "forms.less"; +@import "tables.less"; + +// Components: common +@import "sprites.less"; +@import "dropdowns.less"; +@import "wells.less"; +@import "component-animations.less"; +@import "close.less"; + +// Components: Buttons & Alerts +@import "buttons.less"; +@import "button-groups.less"; +@import "alerts.less"; // Note: alerts share common CSS with buttons and thus have styles in buttons.less + +// Components: Nav +@import "navs.less"; +@import "navbar.less"; +@import "breadcrumbs.less"; +@import "pagination.less"; +@import "pager.less"; + +// Components: Popovers +@import "modals.less"; +@import "tooltip.less"; +@import "popovers.less"; + +// Components: Misc +@import "thumbnails.less"; +@import "labels-badges.less"; +@import "progress-bars.less"; +@import "accordion.less"; +@import "carousel.less"; +@import "hero-unit.less"; + +// Utility classes +@import "utilities.less"; // Has to be last to override when necessary diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/breadcrumbs.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/breadcrumbs.less new file mode 100644 index 0000000..111f122 --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/breadcrumbs.less @@ -0,0 +1,24 @@ +// BREADCRUMBS +// ----------- + +.breadcrumb { + padding: 7px 14px; + margin: 0 0 @baseLineHeight; + list-style: none; + #gradient > .vertical(@white, #f5f5f5); + border: 1px solid #ddd; + .border-radius(3px); + .box-shadow(inset 0 1px 0 @white); + li { + display: inline-block; + .ie7-inline-block(); + text-shadow: 0 1px 0 @white; + } + .divider { + padding: 0 5px; + color: @grayLight; + } + .active a { + color: @grayDark; + } +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/button-groups.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/button-groups.less new file mode 100644 index 0000000..5338c5a --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/button-groups.less @@ -0,0 +1,191 @@ +// BUTTON GROUPS +// ------------- + + +// Make the div behave like a button +.btn-group { + position: relative; + .clearfix(); // clears the floated buttons + .ie7-restore-left-whitespace(); +} + +// Space out series of button groups +.btn-group + .btn-group { + margin-left: 5px; +} + +// Optional: Group multiple button groups together for a toolbar +.btn-toolbar { + margin-top: @baseLineHeight / 2; + margin-bottom: @baseLineHeight / 2; + .btn-group { + display: inline-block; + .ie7-inline-block(); + } +} + +// Float them, remove border radius, then re-add to first and last elements +.btn-group > .btn { + position: relative; + float: left; + margin-left: -1px; + .border-radius(0); +} +// Set corners individual because sometimes a single button can be in a .btn-group and we need :first-child and :last-child to both match +.btn-group > .btn:first-child { + margin-left: 0; + -webkit-border-top-left-radius: 4px; + -moz-border-radius-topleft: 4px; + border-top-left-radius: 4px; + -webkit-border-bottom-left-radius: 4px; + -moz-border-radius-bottomleft: 4px; + border-bottom-left-radius: 4px; +} +// Need .dropdown-toggle since :last-child doesn't apply given a .dropdown-menu immediately after it +.btn-group > .btn:last-child, +.btn-group > .dropdown-toggle { + -webkit-border-top-right-radius: 4px; + -moz-border-radius-topright: 4px; + border-top-right-radius: 4px; + -webkit-border-bottom-right-radius: 4px; + -moz-border-radius-bottomright: 4px; + border-bottom-right-radius: 4px; +} +// Reset corners for large buttons +.btn-group > .btn.large:first-child { + margin-left: 0; + -webkit-border-top-left-radius: 6px; + -moz-border-radius-topleft: 6px; + border-top-left-radius: 6px; + -webkit-border-bottom-left-radius: 6px; + -moz-border-radius-bottomleft: 6px; + border-bottom-left-radius: 6px; +} +.btn-group > .btn.large:last-child, +.btn-group > .large.dropdown-toggle { + -webkit-border-top-right-radius: 6px; + -moz-border-radius-topright: 6px; + border-top-right-radius: 6px; + -webkit-border-bottom-right-radius: 6px; + -moz-border-radius-bottomright: 6px; + border-bottom-right-radius: 6px; +} + +// On hover/focus/active, bring the proper btn to front +.btn-group > .btn:hover, +.btn-group > .btn:focus, +.btn-group > .btn:active, +.btn-group > .btn.active { + z-index: 2; +} + +// On active and open, don't show outline +.btn-group .dropdown-toggle:active, +.btn-group.open .dropdown-toggle { + outline: 0; +} + + + +// Split button dropdowns +// ---------------------- + +// Give the line between buttons some depth +.btn-group > .dropdown-toggle { + padding-left: 8px; + padding-right: 8px; + .box-shadow(~"inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05)"); + *padding-top: 4px; + *padding-bottom: 4px; +} +.btn-group > .btn-mini.dropdown-toggle { + padding-left: 5px; + padding-right: 5px; +} +.btn-group > .btn-small.dropdown-toggle { + *padding-top: 4px; + *padding-bottom: 4px; +} +.btn-group > .btn-large.dropdown-toggle { + padding-left: 12px; + padding-right: 12px; +} + +.btn-group.open { + + // The clickable button for toggling the menu + // Remove the gradient and set the same inset shadow as the :active state + .dropdown-toggle { + background-image: none; + .box-shadow(~"inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05)"); + } + + // Keep the hover's background when dropdown is open + .btn.dropdown-toggle { + background-color: @btnBackgroundHighlight; + } + .btn-primary.dropdown-toggle { + background-color: @btnPrimaryBackgroundHighlight; + } + .btn-warning.dropdown-toggle { + background-color: @btnWarningBackgroundHighlight; + } + .btn-danger.dropdown-toggle { + background-color: @btnDangerBackgroundHighlight; + } + .btn-success.dropdown-toggle { + background-color: @btnSuccessBackgroundHighlight; + } + .btn-info.dropdown-toggle { + background-color: @btnInfoBackgroundHighlight; + } + .btn-inverse.dropdown-toggle { + background-color: @btnInverseBackgroundHighlight; + } +} + + +// Reposition the caret +.btn .caret { + margin-top: 7px; + margin-left: 0; +} +.btn:hover .caret, +.open.btn-group .caret { + .opacity(100); +} +// Carets in other button sizes +.btn-mini .caret { + margin-top: 5px; +} +.btn-small .caret { + margin-top: 6px; +} +.btn-large .caret { + margin-top: 6px; + border-left-width: 5px; + border-right-width: 5px; + border-top-width: 5px; +} +// Upside down carets for .dropup +.dropup .btn-large .caret { + border-bottom: 5px solid @black; + border-top: 0; +} + + + +// Account for other colors +.btn-primary, +.btn-warning, +.btn-danger, +.btn-info, +.btn-success, +.btn-inverse { + .caret { + border-top-color: @white; + border-bottom-color: @white; + .opacity(75); + } +} + diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/buttons.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/buttons.less new file mode 100644 index 0000000..c44ff3e --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/buttons.less @@ -0,0 +1,191 @@ +// BUTTON STYLES +// ------------- + + +// Base styles +// -------------------------------------------------- + +// Core +.btn { + display: inline-block; + .ie7-inline-block(); + padding: 4px 10px 4px; + margin-bottom: 0; // For input.btn + font-size: @baseFontSize; + line-height: @baseLineHeight; + *line-height: 20px; + color: @grayDark; + text-align: center; + text-shadow: 0 1px 1px rgba(255,255,255,.75); + vertical-align: middle; + cursor: pointer; + .buttonBackground(@btnBackground, @btnBackgroundHighlight); + border: 1px solid @btnBorder; + *border: 0; // Remove the border to prevent IE7's black border on input:focus + border-bottom-color: darken(@btnBorder, 10%); + .border-radius(4px); + .ie7-restore-left-whitespace(); // Give IE7 some love + .box-shadow(~"inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05)"); +} + +// Hover state +.btn:hover { + color: @grayDark; + text-decoration: none; + background-color: darken(@white, 10%); + *background-color: darken(@white, 15%); /* Buttons in IE7 don't get borders, so darken on hover */ + background-position: 0 -15px; + + // transition is only when going to hover, otherwise the background + // behind the gradient (there for IE<=9 fallback) gets mismatched + .transition(background-position .1s linear); +} + +// Focus state for keyboard and accessibility +.btn:focus { + .tab-focus(); +} + +// Active state +.btn.active, +.btn:active { + background-color: darken(@white, 10%); + background-color: darken(@white, 15%) e("\9"); + background-image: none; + outline: 0; + .box-shadow(~"inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05)"); +} + +// Disabled state +.btn.disabled, +.btn[disabled] { + cursor: default; + background-color: darken(@white, 10%); + background-image: none; + .opacity(65); + .box-shadow(none); +} + + +// Button Sizes +// -------------------------------------------------- + +// Large +.btn-large { + padding: 9px 14px; + font-size: @baseFontSize + 2px; + line-height: normal; + .border-radius(5px); +} +.btn-large [class^="icon-"] { + margin-top: 1px; +} + +// Small +.btn-small { + padding: 5px 9px; + font-size: @baseFontSize - 2px; + line-height: @baseLineHeight - 2px; +} +.btn-small [class^="icon-"] { + margin-top: -1px; +} + +// Mini +.btn-mini { + padding: 2px 6px; + font-size: @baseFontSize - 2px; + line-height: @baseLineHeight - 4px; +} + + +// Alternate buttons +// -------------------------------------------------- + +// Set text color +// ------------------------- +.btn-primary, +.btn-primary:hover, +.btn-warning, +.btn-warning:hover, +.btn-danger, +.btn-danger:hover, +.btn-success, +.btn-success:hover, +.btn-info, +.btn-info:hover, +.btn-inverse, +.btn-inverse:hover { + color: @white; + text-shadow: 0 -1px 0 rgba(0,0,0,.25); +} +// Provide *some* extra contrast for those who can get it +.btn-primary.active, +.btn-warning.active, +.btn-danger.active, +.btn-success.active, +.btn-info.active, +.btn-inverse.active { + color: rgba(255,255,255,.75); +} + +// Set the backgrounds +// ------------------------- +.btn { + // reset here as of 2.0.3 due to Recess property order + border-color: #ccc; + border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25); +} +.btn-primary { + .buttonBackground(@btnPrimaryBackground, @btnPrimaryBackgroundHighlight); +} +// Warning appears are orange +.btn-warning { + .buttonBackground(@btnWarningBackground, @btnWarningBackgroundHighlight); +} +// Danger and error appear as red +.btn-danger { + .buttonBackground(@btnDangerBackground, @btnDangerBackgroundHighlight); +} +// Success appears as green +.btn-success { + .buttonBackground(@btnSuccessBackground, @btnSuccessBackgroundHighlight); +} +// Info appears as a neutral blue +.btn-info { + .buttonBackground(@btnInfoBackground, @btnInfoBackgroundHighlight); +} +// Inverse appears as dark gray +.btn-inverse { + .buttonBackground(@btnInverseBackground, @btnInverseBackgroundHighlight); +} + + +// Cross-browser Jank +// -------------------------------------------------- + +button.btn, +input[type="submit"].btn { + + // Firefox 3.6 only I believe + &::-moz-focus-inner { + padding: 0; + border: 0; + } + + // IE7 has some default padding on button controls + *padding-top: 2px; + *padding-bottom: 2px; + &.btn-large { + *padding-top: 7px; + *padding-bottom: 7px; + } + &.btn-small { + *padding-top: 3px; + *padding-bottom: 3px; + } + &.btn-mini { + *padding-top: 1px; + *padding-bottom: 1px; + } +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/carousel.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/carousel.less new file mode 100644 index 0000000..8fbd303 --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/carousel.less @@ -0,0 +1,121 @@ +// CAROUSEL +// -------- + +.carousel { + position: relative; + margin-bottom: @baseLineHeight; + line-height: 1; +} + +.carousel-inner { + overflow: hidden; + width: 100%; + position: relative; +} + +.carousel { + + .item { + display: none; + position: relative; + .transition(.6s ease-in-out left); + } + + // Account for jankitude on images + .item > img { + display: block; + line-height: 1; + } + + .active, + .next, + .prev { display: block; } + + .active { + left: 0; + } + + .next, + .prev { + position: absolute; + top: 0; + width: 100%; + } + + .next { + left: 100%; + } + .prev { + left: -100%; + } + .next.left, + .prev.right { + left: 0; + } + + .active.left { + left: -100%; + } + .active.right { + left: 100%; + } + +} + +// Left/right controls for nav +// --------------------------- + +.carousel-control { + position: absolute; + top: 40%; + left: 15px; + width: 40px; + height: 40px; + margin-top: -20px; + font-size: 60px; + font-weight: 100; + line-height: 30px; + color: @white; + text-align: center; + background: @grayDarker; + border: 3px solid @white; + .border-radius(23px); + .opacity(50); + + // we can't have this transition here + // because webkit cancels the carousel + // animation if you trip this while + // in the middle of another animation + // ;_; + // .transition(opacity .2s linear); + + // Reposition the right one + &.right { + left: auto; + right: 15px; + } + + // Hover state + &:hover { + color: @white; + text-decoration: none; + .opacity(90); + } +} + +// Caption for text below images +// ----------------------------- + +.carousel-caption { + position: absolute; + left: 0; + right: 0; + bottom: 0; + padding: 10px 15px 5px; + background: @grayDark; + background: rgba(0,0,0,.75); +} +.carousel-caption h4, +.carousel-caption p { + color: @white; +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/close.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/close.less new file mode 100644 index 0000000..31fe6fc --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/close.less @@ -0,0 +1,29 @@ +// CLOSE ICONS +// ----------- + +.close { + float: right; + font-size: 20px; + font-weight: bold; + line-height: @baseLineHeight; + color: @black; + text-shadow: 0 1px 0 rgba(255,255,255,1); + .opacity(20); + &:hover { + color: @black; + text-decoration: none; + cursor: pointer; + .opacity(40); + } +} + +// Additional properties for button version +// iOS requires the button element instead of an anchor tag. +// If you want the anchor version, it requires `href="#"`. +button.close { + padding: 0; + cursor: pointer; + background: transparent; + border: 0; + -webkit-appearance: none; +}
\ No newline at end of file diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/code.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/code.less new file mode 100644 index 0000000..0cae749 --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/code.less @@ -0,0 +1,57 @@ +// Code.less +// Code typography styles for the <code> and <pre> elements +// -------------------------------------------------------- + +// Inline and block code styles +code, +pre { + padding: 0 3px 2px; + #font > #family > .monospace; + font-size: @baseFontSize - 1; + color: @grayDark; + .border-radius(3px); +} + +// Inline code +code { + padding: 2px 4px; + color: #d14; + background-color: #f7f7f9; + border: 1px solid #e1e1e8; +} + +// Blocks of code +pre { + display: block; + padding: (@baseLineHeight - 1) / 2; + margin: 0 0 @baseLineHeight / 2; + font-size: @baseFontSize * .925; // 13px to 12px + line-height: @baseLineHeight; + word-break: break-all; + word-wrap: break-word; + white-space: pre; + white-space: pre-wrap; + background-color: #f5f5f5; + border: 1px solid #ccc; // fallback for IE7-8 + border: 1px solid rgba(0,0,0,.15); + .border-radius(4px); + + // Make prettyprint styles more spaced out for readability + &.prettyprint { + margin-bottom: @baseLineHeight; + } + + // Account for some code outputs that place code tags in pre tags + code { + padding: 0; + color: inherit; + background-color: transparent; + border: 0; + } +} + +// Enable scrollable blocks of code +.pre-scrollable { + max-height: 340px; + overflow-y: scroll; +}
\ No newline at end of file diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/component-animations.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/component-animations.less new file mode 100644 index 0000000..1e1e78b --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/component-animations.less @@ -0,0 +1,20 @@ +// COMPONENT ANIMATIONS +// -------------------- + +.fade { + opacity: 0; + .transition(opacity .15s linear); + &.in { + opacity: 1; + } +} + +.collapse { + position: relative; + height: 0; + overflow: hidden; + .transition(height .35s ease); + &.in { + height: auto; + } +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/dropdowns.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/dropdowns.less new file mode 100644 index 0000000..5e23255 --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/dropdowns.less @@ -0,0 +1,143 @@ +// DROPDOWN MENUS +// -------------- + +// Use the .menu class on any <li> element within the topbar or ul.tabs and you'll get some superfancy dropdowns +.dropup, +.dropdown { + position: relative; +} +.dropdown-toggle { + // The caret makes the toggle a bit too tall in IE7 + *margin-bottom: -3px; +} +.dropdown-toggle:active, +.open .dropdown-toggle { + outline: 0; +} + +// Dropdown arrow/caret +// -------------------- +.caret { + display: inline-block; + width: 0; + height: 0; + vertical-align: top; + border-top: 4px solid @black; + border-right: 4px solid transparent; + border-left: 4px solid transparent; + content: ""; + .opacity(30); +} + +// Place the caret +.dropdown .caret { + margin-top: 8px; + margin-left: 2px; +} +.dropdown:hover .caret, +.open .caret { + .opacity(100); +} + +// The dropdown menu (ul) +// ---------------------- +.dropdown-menu { + position: absolute; + top: 100%; + left: 0; + z-index: @zindexDropdown; + display: none; // none by default, but block on "open" of the menu + float: left; + min-width: 160px; + padding: 4px 0; + margin: 1px 0 0; // override default ul + list-style: none; + background-color: @dropdownBackground; + border: 1px solid #ccc; + border: 1px solid rgba(0,0,0,.2); + *border-right-width: 2px; + *border-bottom-width: 2px; + .border-radius(5px); + .box-shadow(0 5px 10px rgba(0,0,0,.2)); + -webkit-background-clip: padding-box; + -moz-background-clip: padding; + background-clip: padding-box; + + // Aligns the dropdown menu to right + &.pull-right { + right: 0; + left: auto; + } + + // Dividers (basically an hr) within the dropdown + .divider { + .nav-divider(@dropdownDividerTop, @dropdownDividerBottom); + } + + // Links within the dropdown menu + a { + display: block; + padding: 3px 15px; + clear: both; + font-weight: normal; + line-height: @baseLineHeight; + color: @dropdownLinkColor; + white-space: nowrap; + } +} + +// Hover state +// ----------- +.dropdown-menu li > a:hover, +.dropdown-menu .active > a, +.dropdown-menu .active > a:hover { + color: @dropdownLinkColorHover; + text-decoration: none; + background-color: @dropdownLinkBackgroundHover; +} + +// Open state for the dropdown +// --------------------------- +.open { + // IE7's z-index only goes to the nearest positioned ancestor, which would + // make the menu appear below buttons that appeared later on the page + *z-index: @zindexDropdown; + + & > .dropdown-menu { + display: block; + } +} + +// Right aligned dropdowns +// --------------------------- +.pull-right > .dropdown-menu { + right: 0; + left: auto; +} + +// Allow for dropdowns to go bottom up (aka, dropup-menu) +// ------------------------------------------------------ +// Just add .dropup after the standard .dropdown class and you're set, bro. +// TODO: abstract this so that the navbar fixed styles are not placed here? +.dropup, +.navbar-fixed-bottom .dropdown { + // Reverse the caret + .caret { + border-top: 0; + border-bottom: 4px solid @black; + content: "\2191"; + } + // Different positioning for bottom up menu + .dropdown-menu { + top: auto; + bottom: 100%; + margin-bottom: 1px; + } +} + +// Typeahead +// --------- +.typeahead { + margin-top: 2px; // give it some space to breathe + .border-radius(4px); +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/forms.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/forms.less new file mode 100644 index 0000000..1163fe9 --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/forms.less @@ -0,0 +1,583 @@ +// Forms.less +// Base styles for various input types, form layouts, and states +// ------------------------------------------------------------- + + +// GENERAL STYLES +// -------------- + +// Make all forms have space below them +form { + margin: 0 0 @baseLineHeight; +} + +fieldset { + padding: 0; + margin: 0; + border: 0; +} + +// Groups of fields with labels on top (legends) +legend { + display: block; + width: 100%; + padding: 0; + margin-bottom: @baseLineHeight * 1.5; + font-size: @baseFontSize * 1.5; + line-height: @baseLineHeight * 2; + color: @grayDark; + border: 0; + border-bottom: 1px solid #e5e5e5; + + // Small + small { + font-size: @baseLineHeight * .75; + color: @grayLight; + } +} + +// Set font for forms +label, +input, +button, +select, +textarea { + #font > .shorthand(@baseFontSize,normal,@baseLineHeight); // Set size, weight, line-height here +} +input, +button, +select, +textarea { + font-family: @baseFontFamily; // And only set font-family here for those that need it (note the missing label element) +} + +// Identify controls by their labels +label { + display: block; + margin-bottom: 5px; +} + +// Form controls +// ------------------------- + +// Shared size and type resets +select, +textarea, +input[type="text"], +input[type="password"], +input[type="datetime"], +input[type="datetime-local"], +input[type="date"], +input[type="month"], +input[type="time"], +input[type="week"], +input[type="number"], +input[type="email"], +input[type="url"], +input[type="search"], +input[type="tel"], +input[type="color"], +.uneditable-input { + display: inline-block; + height: @baseLineHeight; + padding: 4px; + margin-bottom: 9px; + font-size: @baseFontSize; + line-height: @baseLineHeight; + color: @gray; +} + +// Reset appearance properties for textual inputs and textarea +// Declare width for legacy (can't be on input[type=*] selectors or it's too specific) +input, +textarea { + width: 210px; +} +// Reset height since textareas have rows +textarea { + height: auto; +} +// Everything else +textarea, +input[type="text"], +input[type="password"], +input[type="datetime"], +input[type="datetime-local"], +input[type="date"], +input[type="month"], +input[type="time"], +input[type="week"], +input[type="number"], +input[type="email"], +input[type="url"], +input[type="search"], +input[type="tel"], +input[type="color"], +.uneditable-input { + background-color: @inputBackground; + border: 1px solid @inputBorder; + .border-radius(@inputBorderRadius); + .box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); + @transition: border linear .2s, box-shadow linear .2s; + .transition(@transition); + + // Focus state + &:focus { + border-color: rgba(82,168,236,.8); + outline: 0; + outline: thin dotted \9; /* IE6-9 */ + .box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6)"); + } +} + +// Position radios and checkboxes better +input[type="radio"], +input[type="checkbox"] { + margin: 3px 0; + *margin-top: 0; /* IE7 */ + line-height: normal; + cursor: pointer; +} + +// Reset width of input buttons, radios, checkboxes +input[type="submit"], +input[type="reset"], +input[type="button"], +input[type="radio"], +input[type="checkbox"] { + width: auto; // Override of generic input selector +} + +// Make uneditable textareas behave like a textarea +.uneditable-textarea { + width: auto; + height: auto; +} + +// Set the height of select and file controls to match text inputs +select, +input[type="file"] { + height: 28px; /* In IE7, the height of the select element cannot be changed by height, only font-size */ + *margin-top: 4px; /* For IE7, add top margin to align select with labels */ + line-height: 28px; +} + +// Make select elements obey height by applying a border +select { + width: 220px; // default input width + 10px of padding that doesn't get applied + border: 1px solid #bbb; +} + +// Make multiple select elements height not fixed +select[multiple], +select[size] { + height: auto; +} + +// Focus for select, file, radio, and checkbox +select:focus, +input[type="file"]:focus, +input[type="radio"]:focus, +input[type="checkbox"]:focus { + .tab-focus(); +} + + + +// CHECKBOXES & RADIOS +// ------------------- + +// Indent the labels to position radios/checkboxes as hanging +.radio, +.checkbox { + min-height: 18px; // clear the floating input if there is no label text + padding-left: 18px; +} +.radio input[type="radio"], +.checkbox input[type="checkbox"] { + float: left; + margin-left: -18px; +} + +// Move the options list down to align with labels +.controls > .radio:first-child, +.controls > .checkbox:first-child { + padding-top: 5px; // has to be padding because margin collaspes +} + +// Radios and checkboxes on same line +// TODO v3: Convert .inline to .control-inline +.radio.inline, +.checkbox.inline { + display: inline-block; + padding-top: 5px; + margin-bottom: 0; + vertical-align: middle; +} +.radio.inline + .radio.inline, +.checkbox.inline + .checkbox.inline { + margin-left: 10px; // space out consecutive inline controls +} + + + +// INPUT SIZES +// ----------- + +// General classes for quick sizes +.input-mini { width: 60px; } +.input-small { width: 90px; } +.input-medium { width: 150px; } +.input-large { width: 210px; } +.input-xlarge { width: 270px; } +.input-xxlarge { width: 530px; } + +// Grid style input sizes +input[class*="span"], +select[class*="span"], +textarea[class*="span"], +.uneditable-input[class*="span"], +// Redeclare since the fluid row class is more specific +.row-fluid input[class*="span"], +.row-fluid select[class*="span"], +.row-fluid textarea[class*="span"], +.row-fluid .uneditable-input[class*="span"] { + float: none; + margin-left: 0; +} +// Ensure input-prepend/append never wraps +.input-append input[class*="span"], +.input-append .uneditable-input[class*="span"], +.input-prepend input[class*="span"], +.input-prepend .uneditable-input[class*="span"], +.row-fluid .input-prepend [class*="span"], +.row-fluid .input-append [class*="span"] { + display: inline-block; +} + + + +// GRID SIZING FOR INPUTS +// ---------------------- + +#grid > .input(@gridColumnWidth, @gridGutterWidth); + + + +// DISABLED STATE +// -------------- + +// Disabled and read-only inputs +input[disabled], +select[disabled], +textarea[disabled], +input[readonly], +select[readonly], +textarea[readonly] { + cursor: not-allowed; + background-color: @inputDisabledBackground; + border-color: #ddd; +} +// Explicitly reset the colors here +input[type="radio"][disabled], +input[type="checkbox"][disabled], +input[type="radio"][readonly], +input[type="checkbox"][readonly] { + background-color: transparent; +} + + + + +// FORM FIELD FEEDBACK STATES +// -------------------------- + +// Warning +.control-group.warning { + .formFieldState(@warningText, @warningText, @warningBackground); +} +// Error +.control-group.error { + .formFieldState(@errorText, @errorText, @errorBackground); +} +// Success +.control-group.success { + .formFieldState(@successText, @successText, @successBackground); +} + +// HTML5 invalid states +// Shares styles with the .control-group.error above +input:focus:required:invalid, +textarea:focus:required:invalid, +select:focus:required:invalid { + color: #b94a48; + border-color: #ee5f5b; + &:focus { + border-color: darken(#ee5f5b, 10%); + .box-shadow(0 0 6px lighten(#ee5f5b, 20%)); + } +} + + + +// FORM ACTIONS +// ------------ + +.form-actions { + padding: (@baseLineHeight - 1) 20px @baseLineHeight; + margin-top: @baseLineHeight; + margin-bottom: @baseLineHeight; + background-color: @formActionsBackground; + border-top: 1px solid #e5e5e5; + .clearfix(); // Adding clearfix to allow for .pull-right button containers +} + +// For text that needs to appear as an input but should not be an input +.uneditable-input { + overflow: hidden; // prevent text from wrapping, but still cut it off like an input does + white-space: nowrap; + cursor: not-allowed; + background-color: @inputBackground; + border-color: #eee; + .box-shadow(inset 0 1px 2px rgba(0,0,0,.025)); +} + +// Placeholder text gets special styles; can't be bundled together though for some reason +.placeholder(); + + + +// HELP TEXT +// --------- + +.help-block, +.help-inline { + color: @gray; // lighten the text some for contrast +} + +.help-block { + display: block; // account for any element using help-block + margin-bottom: @baseLineHeight / 2; +} + +.help-inline { + display: inline-block; + .ie7-inline-block(); + vertical-align: middle; + padding-left: 5px; +} + + + +// INPUT GROUPS +// ------------ + +// Allow us to put symbols and text within the input field for a cleaner look +.input-prepend, +.input-append { + margin-bottom: 5px; + input, + select, + .uneditable-input { + position: relative; // placed here by default so that on :focus we can place the input above the .add-on for full border and box-shadow goodness + margin-bottom: 0; // prevent bottom margin from screwing up alignment in stacked forms + *margin-left: 0; + vertical-align: middle; + .border-radius(0 @inputBorderRadius @inputBorderRadius 0); + // Make input on top when focused so blue border and shadow always show + &:focus { + z-index: 2; + } + } + .uneditable-input { + border-left-color: #ccc; + } + .add-on { + display: inline-block; + width: auto; + height: @baseLineHeight; + min-width: 16px; + padding: 4px 5px; + font-weight: normal; + line-height: @baseLineHeight; + text-align: center; + text-shadow: 0 1px 0 @white; + vertical-align: middle; + background-color: @grayLighter; + border: 1px solid #ccc; + } + .add-on, + .btn { + margin-left: -1px; + .border-radius(0); + } + .active { + background-color: lighten(@green, 30); + border-color: @green; + } +} +.input-prepend { + .add-on, + .btn { + margin-right: -1px; + } + .add-on:first-child, + .btn:first-child { + .border-radius(@inputBorderRadius 0 0 @inputBorderRadius); + } +} +.input-append { + input, + select, + .uneditable-input { + .border-radius(@inputBorderRadius 0 0 @inputBorderRadius); + } + .uneditable-input { + border-right-color: #ccc; + border-left-color: #eee; + } + .add-on:last-child, + .btn:last-child { + .border-radius(0 @inputBorderRadius @inputBorderRadius 0); + } +} +// Remove all border-radius for inputs with both prepend and append +.input-prepend.input-append { + input, + select, + .uneditable-input { + .border-radius(0); + } + .add-on:first-child, + .btn:first-child { + margin-right: -1px; + .border-radius(@inputBorderRadius 0 0 @inputBorderRadius); + } + .add-on:last-child, + .btn:last-child { + margin-left: -1px; + .border-radius(0 @inputBorderRadius @inputBorderRadius 0); + } +} + + + +// SEARCH FORM +// ----------- + +.search-query { + padding-right: 14px; + padding-right: 4px \9; + padding-left: 14px; + padding-left: 4px \9; /* IE7-8 doesn't have border-radius, so don't indent the padding */ + margin-bottom: 0; // remove the default margin on all inputs + .border-radius(14px); +} + + + +// HORIZONTAL & VERTICAL FORMS +// --------------------------- + +// Common properties +// ----------------- + +.form-search, +.form-inline, +.form-horizontal { + input, + textarea, + select, + .help-inline, + .uneditable-input, + .input-prepend, + .input-append { + display: inline-block; + .ie7-inline-block(); + margin-bottom: 0; + } + // Re-hide hidden elements due to specifity + .hide { + display: none; + } +} +.form-search label, +.form-inline label { + display: inline-block; +} +// Remove margin for input-prepend/-append +.form-search .input-append, +.form-inline .input-append, +.form-search .input-prepend, +.form-inline .input-prepend { + margin-bottom: 0; +} +// Inline checkbox/radio labels (remove padding on left) +.form-search .radio, +.form-search .checkbox, +.form-inline .radio, +.form-inline .checkbox { + padding-left: 0; + margin-bottom: 0; + vertical-align: middle; +} +// Remove float and margin, set to inline-block +.form-search .radio input[type="radio"], +.form-search .checkbox input[type="checkbox"], +.form-inline .radio input[type="radio"], +.form-inline .checkbox input[type="checkbox"] { + float: left; + margin-right: 3px; + margin-left: 0; +} + + +// Margin to space out fieldsets +.control-group { + margin-bottom: @baseLineHeight / 2; +} + +// Legend collapses margin, so next element is responsible for spacing +legend + .control-group { + margin-top: @baseLineHeight; + -webkit-margin-top-collapse: separate; +} + +// Horizontal-specific styles +// -------------------------- + +.form-horizontal { + // Increase spacing between groups + .control-group { + margin-bottom: @baseLineHeight; + .clearfix(); + } + // Float the labels left + .control-label { + float: left; + width: 140px; + padding-top: 5px; + text-align: right; + } + // Move over all input controls and content + .controls { + // Super jank IE7 fix to ensure the inputs in .input-append and input-prepend + // don't inherit the margin of the parent, in this case .controls + *display: inline-block; + *padding-left: 20px; + margin-left: 160px; + *margin-left: 0; + &:first-child { + *padding-left: 160px; + } + } + // Remove bottom margin on block level help text since that's accounted for on .control-group + .help-block { + margin-top: @baseLineHeight / 2; + margin-bottom: 0; + } + // Move over buttons in .form-actions to align with .controls + .form-actions { + padding-left: 160px; + } +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/grid.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/grid.less new file mode 100644 index 0000000..e62a960 --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/grid.less @@ -0,0 +1,5 @@ +// Fixed (940px) +#grid > .core(@gridColumnWidth, @gridGutterWidth); + +// Fluid (940px) +#grid > .fluid(@fluidGridColumnWidth, @fluidGridGutterWidth);
\ No newline at end of file diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/hero-unit.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/hero-unit.less new file mode 100644 index 0000000..0ffe829 --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/hero-unit.less @@ -0,0 +1,22 @@ +// HERO UNIT +// --------- + +.hero-unit { + padding: 60px; + margin-bottom: 30px; + background-color: @heroUnitBackground; + .border-radius(6px); + h1 { + margin-bottom: 0; + font-size: 60px; + line-height: 1; + color: @heroUnitHeadingColor; + letter-spacing: -1px; + } + p { + font-size: 18px; + font-weight: 200; + line-height: @baseLineHeight * 1.5; + color: @heroUnitLeadColor; + } +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/labels-badges.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/labels-badges.less new file mode 100644 index 0000000..0fbd7bb --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/labels-badges.less @@ -0,0 +1,55 @@ +// LABELS & BADGES +// --------------- + +// Base classes +.label, +.badge { + font-size: @baseFontSize * .846; + font-weight: bold; + line-height: 14px; // ensure proper line-height if floated + color: @white; + vertical-align: baseline; + white-space: nowrap; + text-shadow: 0 -1px 0 rgba(0,0,0,.25); + background-color: @grayLight; +} +// Set unique padding and border-radii +.label { + padding: 1px 4px 2px; + .border-radius(3px); +} +.badge { + padding: 1px 9px 2px; + .border-radius(9px); +} + +// Hover state, but only for links +a { + &.label:hover, + &.badge:hover { + color: @white; + text-decoration: none; + cursor: pointer; + } +} + +// Colors +// Only give background-color difference to links (and to simplify, we don't qualifty with `a` but [href] attribute) +.label, +.badge { + // Important (red) + &-important { background-color: @errorText; } + &-important[href] { background-color: darken(@errorText, 10%); } + // Warnings (orange) + &-warning { background-color: @orange; } + &-warning[href] { background-color: darken(@orange, 10%); } + // Success (green) + &-success { background-color: @successText; } + &-success[href] { background-color: darken(@successText, 10%); } + // Info (turquoise) + &-info { background-color: @infoText; } + &-info[href] { background-color: darken(@infoText, 10%); } + // Inverse (black) + &-inverse { background-color: @grayDark; } + &-inverse[href] { background-color: darken(@grayDark, 10%); } +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/layouts.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/layouts.less new file mode 100644 index 0000000..cc53627 --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/layouts.less @@ -0,0 +1,17 @@ +// +// Layouts +// Fixed-width and fluid (with sidebar) layouts +// -------------------------------------------- + + +// Container (centered, fixed-width layouts) +.container { + .container-fixed(); +} + +// Fluid layouts (left aligned, with sidebar, min- & max-width content) +.container-fluid { + padding-right: @gridGutterWidth; + padding-left: @gridGutterWidth; + .clearfix(); +}
\ No newline at end of file diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/mixins.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/mixins.less new file mode 100644 index 0000000..c3b57ed --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/mixins.less @@ -0,0 +1,646 @@ +// Mixins.less +// Snippets of reusable CSS to develop faster and keep code readable +// ----------------------------------------------------------------- + + +// UTILITY MIXINS +// -------------------------------------------------- + +// Clearfix +// -------- +// For clearing floats like a boss h5bp.com/q +.clearfix { + *zoom: 1; + &:before, + &:after { + display: table; + content: ""; + } + &:after { + clear: both; + } +} + +// Webkit-style focus +// ------------------ +.tab-focus() { + // Default + outline: thin dotted #333; + // Webkit + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} + +// Center-align a block level element +// ---------------------------------- +.center-block() { + display: block; + margin-left: auto; + margin-right: auto; +} + +// IE7 inline-block +// ---------------- +.ie7-inline-block() { + *display: inline; /* IE7 inline-block hack */ + *zoom: 1; +} + +// IE7 likes to collapse whitespace on either side of the inline-block elements. +// Ems because we're attempting to match the width of a space character. Left +// version is for form buttons, which typically come after other elements, and +// right version is for icons, which come before. Applying both is ok, but it will +// mean that space between those elements will be .6em (~2 space characters) in IE7, +// instead of the 1 space in other browsers. +.ie7-restore-left-whitespace() { + *margin-left: .3em; + + &:first-child { + *margin-left: 0; + } +} + +.ie7-restore-right-whitespace() { + *margin-right: .3em; + + &:last-child { + *margin-left: 0; + } +} + +// Sizing shortcuts +// ------------------------- +.size(@height, @width) { + width: @width; + height: @height; +} +.square(@size) { + .size(@size, @size); +} + +// Placeholder text +// ------------------------- +.placeholder(@color: @placeholderText) { + &:-moz-placeholder { + color: @color; + } + &:-ms-input-placeholder { + color: @color; + } + &::-webkit-input-placeholder { + color: @color; + } +} + +// Text overflow +// ------------------------- +// Requires inline-block or block for proper styling +.text-overflow() { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +// CSS image replacement +// ------------------------- +// Source: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757 +.hide-text { + font: 0/0 a; + color: transparent; + text-shadow: none; + background-color: transparent; + border: 0; +} + + +// FONTS +// -------------------------------------------------- + +#font { + #family { + .serif() { + font-family: @serifFontFamily; + } + .sans-serif() { + font-family: @sansFontFamily; + } + .monospace() { + font-family: @monoFontFamily; + } + } + .shorthand(@size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight) { + font-size: @size; + font-weight: @weight; + line-height: @lineHeight; + } + .serif(@size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight) { + #font > #family > .serif; + #font > .shorthand(@size, @weight, @lineHeight); + } + .sans-serif(@size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight) { + #font > #family > .sans-serif; + #font > .shorthand(@size, @weight, @lineHeight); + } + .monospace(@size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight) { + #font > #family > .monospace; + #font > .shorthand(@size, @weight, @lineHeight); + } +} + + +// FORMS +// -------------------------------------------------- + +// Block level inputs +.input-block-level { + display: block; + width: 100%; + min-height: 28px; // Make inputs at least the height of their button counterpart + .box-sizing(border-box); // Makes inputs behave like true block-level elements +} + + +// Mixin for form field states +.formFieldState(@textColor: #555, @borderColor: #ccc, @backgroundColor: #f5f5f5) { + // Set the text color + > label, + .help-block, + .help-inline { + color: @textColor; + } + // Style inputs accordingly + .checkbox, + .radio, + input, + select, + textarea { + color: @textColor; + border-color: @borderColor; + &:focus { + border-color: darken(@borderColor, 10%); + .box-shadow(0 0 6px lighten(@borderColor, 20%)); + } + } + // Give a small background color for input-prepend/-append + .input-prepend .add-on, + .input-append .add-on { + color: @textColor; + background-color: @backgroundColor; + border-color: @textColor; + } +} + + + +// CSS3 PROPERTIES +// -------------------------------------------------- + +// Border Radius +.border-radius(@radius) { + -webkit-border-radius: @radius; + -moz-border-radius: @radius; + border-radius: @radius; +} + +// Drop shadows +.box-shadow(@shadow) { + -webkit-box-shadow: @shadow; + -moz-box-shadow: @shadow; + box-shadow: @shadow; +} + +// Transitions +.transition(@transition) { + -webkit-transition: @transition; + -moz-transition: @transition; + -ms-transition: @transition; + -o-transition: @transition; + transition: @transition; +} + +// Transformations +.rotate(@degrees) { + -webkit-transform: rotate(@degrees); + -moz-transform: rotate(@degrees); + -ms-transform: rotate(@degrees); + -o-transform: rotate(@degrees); + transform: rotate(@degrees); +} +.scale(@ratio) { + -webkit-transform: scale(@ratio); + -moz-transform: scale(@ratio); + -ms-transform: scale(@ratio); + -o-transform: scale(@ratio); + transform: scale(@ratio); +} +.translate(@x, @y) { + -webkit-transform: translate(@x, @y); + -moz-transform: translate(@x, @y); + -ms-transform: translate(@x, @y); + -o-transform: translate(@x, @y); + transform: translate(@x, @y); +} +.skew(@x, @y) { + -webkit-transform: skew(@x, @y); + -moz-transform: skew(@x, @y); + -ms-transform: skew(@x, @y); + -o-transform: skew(@x, @y); + transform: skew(@x, @y); +} +.translate3d(@x, @y, @z) { + -webkit-transform: translate(@x, @y, @z); + -moz-transform: translate(@x, @y, @z); + -ms-transform: translate(@x, @y, @z); + -o-transform: translate(@x, @y, @z); + transform: translate(@x, @y, @z); +} + +// Backface visibility +// Prevent browsers from flickering when using CSS 3D transforms. +// Default value is `visible`, but can be changed to `hidden +// See git pull https://github.com/dannykeane/bootstrap.git backface-visibility for examples +.backface-visibility(@visibility){ + -webkit-backface-visibility: @visibility; + -moz-backface-visibility: @visibility; + -ms-backface-visibility: @visibility; + backface-visibility: @visibility; +} + +// Background clipping +// Heads up: FF 3.6 and under need "padding" instead of "padding-box" +.background-clip(@clip) { + -webkit-background-clip: @clip; + -moz-background-clip: @clip; + background-clip: @clip; +} + +// Background sizing +.background-size(@size){ + -webkit-background-size: @size; + -moz-background-size: @size; + -o-background-size: @size; + background-size: @size; +} + + +// Box sizing +.box-sizing(@boxmodel) { + -webkit-box-sizing: @boxmodel; + -moz-box-sizing: @boxmodel; + -ms-box-sizing: @boxmodel; + box-sizing: @boxmodel; +} + +// User select +// For selecting text on the page +.user-select(@select) { + -webkit-user-select: @select; + -moz-user-select: @select; + -ms-user-select: @select; + -o-user-select: @select; + user-select: @select; +} + +// Resize anything +.resizable(@direction) { + resize: @direction; // Options: horizontal, vertical, both + overflow: auto; // Safari fix +} + +// CSS3 Content Columns +.content-columns(@columnCount, @columnGap: @gridGutterWidth) { + -webkit-column-count: @columnCount; + -moz-column-count: @columnCount; + column-count: @columnCount; + -webkit-column-gap: @columnGap; + -moz-column-gap: @columnGap; + column-gap: @columnGap; +} + +// Optional hyphenation +.hyphens(@mode: auto) { + word-wrap: break-word; + -webkit-hyphens: @mode; + -moz-hyphens: @mode; + -ms-hyphens: @mode; + -o-hyphens: @mode; + hyphens: @mode; +} + +// Opacity +.opacity(@opacity) { + opacity: @opacity / 100; + filter: ~"alpha(opacity=@{opacity})"; +} + + + +// BACKGROUNDS +// -------------------------------------------------- + +// Add an alphatransparency value to any background or border color (via Elyse Holladay) +#translucent { + .background(@color: @white, @alpha: 1) { + background-color: hsla(hue(@color), saturation(@color), lightness(@color), @alpha); + } + .border(@color: @white, @alpha: 1) { + border-color: hsla(hue(@color), saturation(@color), lightness(@color), @alpha); + .background-clip(padding-box); + } +} + +// Gradient Bar Colors for buttons and alerts +.gradientBar(@primaryColor, @secondaryColor) { + #gradient > .vertical(@primaryColor, @secondaryColor); + border-color: @secondaryColor @secondaryColor darken(@secondaryColor, 15%); + border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) fadein(rgba(0,0,0,.1), 15%); +} + +// Gradients +#gradient { + .horizontal(@startColor: #555, @endColor: #333) { + background-color: @endColor; + background-image: -moz-linear-gradient(left, @startColor, @endColor); // FF 3.6+ + background-image: -ms-linear-gradient(left, @startColor, @endColor); // IE10 + background-image: -webkit-gradient(linear, 0 0, 100% 0, from(@startColor), to(@endColor)); // Safari 4+, Chrome 2+ + background-image: -webkit-linear-gradient(left, @startColor, @endColor); // Safari 5.1+, Chrome 10+ + background-image: -o-linear-gradient(left, @startColor, @endColor); // Opera 11.10 + background-image: linear-gradient(left, @startColor, @endColor); // Le standard + background-repeat: repeat-x; + filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",@startColor,@endColor)); // IE9 and down + } + .vertical(@startColor: #555, @endColor: #333) { + background-color: mix(@startColor, @endColor, 60%); + background-image: -moz-linear-gradient(top, @startColor, @endColor); // FF 3.6+ + background-image: -ms-linear-gradient(top, @startColor, @endColor); // IE10 + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), to(@endColor)); // Safari 4+, Chrome 2+ + background-image: -webkit-linear-gradient(top, @startColor, @endColor); // Safari 5.1+, Chrome 10+ + background-image: -o-linear-gradient(top, @startColor, @endColor); // Opera 11.10 + background-image: linear-gradient(top, @startColor, @endColor); // The standard + background-repeat: repeat-x; + filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@startColor,@endColor)); // IE9 and down + } + .directional(@startColor: #555, @endColor: #333, @deg: 45deg) { + background-color: @endColor; + background-repeat: repeat-x; + background-image: -moz-linear-gradient(@deg, @startColor, @endColor); // FF 3.6+ + background-image: -ms-linear-gradient(@deg, @startColor, @endColor); // IE10 + background-image: -webkit-linear-gradient(@deg, @startColor, @endColor); // Safari 5.1+, Chrome 10+ + background-image: -o-linear-gradient(@deg, @startColor, @endColor); // Opera 11.10 + background-image: linear-gradient(@deg, @startColor, @endColor); // The standard + } + .vertical-three-colors(@startColor: #00b3ee, @midColor: #7a43b6, @colorStop: 50%, @endColor: #c3325f) { + background-color: mix(@midColor, @endColor, 80%); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), color-stop(@colorStop, @midColor), to(@endColor)); + background-image: -webkit-linear-gradient(@startColor, @midColor @colorStop, @endColor); + background-image: -moz-linear-gradient(top, @startColor, @midColor @colorStop, @endColor); + background-image: -ms-linear-gradient(@startColor, @midColor @colorStop, @endColor); + background-image: -o-linear-gradient(@startColor, @midColor @colorStop, @endColor); + background-image: linear-gradient(@startColor, @midColor @colorStop, @endColor); + background-repeat: no-repeat; + filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@startColor,@endColor)); // IE9 and down, gets no color-stop at all for proper fallback + } + .radial(@innerColor: #555, @outerColor: #333) { + background-color: @outerColor; + background-image: -webkit-gradient(radial, center center, 0, center center, 460, from(@innerColor), to(@outerColor)); + background-image: -webkit-radial-gradient(circle, @innerColor, @outerColor); + background-image: -moz-radial-gradient(circle, @innerColor, @outerColor); + background-image: -ms-radial-gradient(circle, @innerColor, @outerColor); + background-image: -o-radial-gradient(circle, @innerColor, @outerColor); + background-repeat: no-repeat; + } + .striped(@color, @angle: -45deg) { + background-color: @color; + background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(.25, rgba(255,255,255,.15)), color-stop(.25, transparent), color-stop(.5, transparent), color-stop(.5, rgba(255,255,255,.15)), color-stop(.75, rgba(255,255,255,.15)), color-stop(.75, transparent), to(transparent)); + background-image: -webkit-linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent); + background-image: -moz-linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent); + background-image: -ms-linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent); + } +} +// Reset filters for IE +.reset-filter() { + filter: e(%("progid:DXImageTransform.Microsoft.gradient(enabled = false)")); +} + + + +// COMPONENT MIXINS +// -------------------------------------------------- + +// Horizontal dividers +// ------------------------- +// Dividers (basically an hr) within dropdowns and nav lists +.nav-divider(@top: #e5e5e5, @bottom: @white) { + // IE7 needs a set width since we gave a height. Restricting just + // to IE7 to keep the 1px left/right space in other browsers. + // It is unclear where IE is getting the extra space that we need + // to negative-margin away, but so it goes. + *width: 100%; + height: 1px; + margin: ((@baseLineHeight / 2) - 1) 1px; // 8px 1px + *margin: -5px 0 5px; + overflow: hidden; + background-color: @top; + border-bottom: 1px solid @bottom; +} + +// Button backgrounds +// ------------------ +.buttonBackground(@startColor, @endColor) { + // gradientBar will set the background to a pleasing blend of these, to support IE<=9 + .gradientBar(@startColor, @endColor); + *background-color: @endColor; /* Darken IE7 buttons by default so they stand out more given they won't have borders */ + .reset-filter(); + + // in these cases the gradient won't cover the background, so we override + &:hover, &:active, &.active, &.disabled, &[disabled] { + background-color: @endColor; + *background-color: darken(@endColor, 5%); + } + + // IE 7 + 8 can't handle box-shadow to show active, so we darken a bit ourselves + &:active, + &.active { + background-color: darken(@endColor, 10%) e("\9"); + } +} + +// Navbar vertical align +// ------------------------- +// Vertically center elements in the navbar. +// Example: an element has a height of 30px, so write out `.navbarVerticalAlign(30px);` to calculate the appropriate top margin. +.navbarVerticalAlign(@elementHeight) { + margin-top: (@navbarHeight - @elementHeight) / 2; +} + +// Popover arrows +// ------------------------- +// For tipsies and popovers +#popoverArrow { + .top(@arrowWidth: 5px, @color: @black) { + bottom: 0; + left: 50%; + margin-left: -@arrowWidth; + border-left: @arrowWidth solid transparent; + border-right: @arrowWidth solid transparent; + border-top: @arrowWidth solid @color; + } + .left(@arrowWidth: 5px, @color: @black) { + top: 50%; + right: 0; + margin-top: -@arrowWidth; + border-top: @arrowWidth solid transparent; + border-bottom: @arrowWidth solid transparent; + border-left: @arrowWidth solid @color; + } + .bottom(@arrowWidth: 5px, @color: @black) { + top: 0; + left: 50%; + margin-left: -@arrowWidth; + border-left: @arrowWidth solid transparent; + border-right: @arrowWidth solid transparent; + border-bottom: @arrowWidth solid @color; + } + .right(@arrowWidth: 5px, @color: @black) { + top: 50%; + left: 0; + margin-top: -@arrowWidth; + border-top: @arrowWidth solid transparent; + border-bottom: @arrowWidth solid transparent; + border-right: @arrowWidth solid @color; + } +} + +// Grid System +// ----------- + +// Centered container element +.container-fixed() { + margin-right: auto; + margin-left: auto; + .clearfix(); +} + +// Table columns +.tableColumns(@columnSpan: 1) { + float: none; // undo default grid column styles + width: ((@gridColumnWidth) * @columnSpan) + (@gridGutterWidth * (@columnSpan - 1)) - 16; // 16 is total padding on left and right of table cells + margin-left: 0; // undo default grid column styles +} + +// Make a Grid +// Use .makeRow and .makeColumn to assign semantic layouts grid system behavior +.makeRow() { + margin-left: @gridGutterWidth * -1; + .clearfix(); +} +.makeColumn(@columns: 1, @offset: 0) { + float: left; + margin-left: (@gridColumnWidth * @offset) + (@gridGutterWidth * (@offset - 1)) + (@gridGutterWidth * 2); + width: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns - 1)); +} + +// The Grid +#grid { + + .core (@gridColumnWidth, @gridGutterWidth) { + + .spanX (@index) when (@index > 0) { + (~".span@{index}") { .span(@index); } + .spanX(@index - 1); + } + .spanX (0) {} + + .offsetX (@index) when (@index > 0) { + (~".offset@{index}") { .offset(@index); } + .offsetX(@index - 1); + } + .offsetX (0) {} + + .offset (@columns) { + margin-left: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns + 1)); + } + + .span (@columns) { + width: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns - 1)); + } + + .row { + margin-left: @gridGutterWidth * -1; + .clearfix(); + } + + [class*="span"] { + float: left; + margin-left: @gridGutterWidth; + } + + // Set the container width, and override it for fixed navbars in media queries + .container, + .navbar-fixed-top .container, + .navbar-fixed-bottom .container { .span(@gridColumns); } + + // generate .spanX and .offsetX + .spanX (@gridColumns); + .offsetX (@gridColumns); + + } + + .fluid (@fluidGridColumnWidth, @fluidGridGutterWidth) { + + .spanX (@index) when (@index > 0) { + (~".span@{index}") { .span(@index); } + .spanX(@index - 1); + } + .spanX (0) {} + + .span (@columns) { + width: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1)); + *width: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1)) - (.5 / @gridRowWidth * 100 * 1%); + } + + .row-fluid { + width: 100%; + .clearfix(); + [class*="span"] { + .input-block-level(); + float: left; + margin-left: @fluidGridGutterWidth; + *margin-left: @fluidGridGutterWidth - (.5 / @gridRowWidth * 100 * 1%); + } + [class*="span"]:first-child { + margin-left: 0; + } + + // generate .spanX + .spanX (@gridColumns); + } + + } + + .input(@gridColumnWidth, @gridGutterWidth) { + + .spanX (@index) when (@index > 0) { + (~"input.span@{index}, textarea.span@{index}, .uneditable-input.span@{index}") { .span(@index); } + .spanX(@index - 1); + } + .spanX (0) {} + + .span(@columns) { + width: ((@gridColumnWidth) * @columns) + (@gridGutterWidth * (@columns - 1)) - 10; + } + + input, + textarea, + .uneditable-input { + margin-left: 0; // override margin-left from core grid system + } + + // generate .spanX + .spanX (@gridColumns); + + } + +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/modals.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/modals.less new file mode 100644 index 0000000..870ad0d --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/modals.less @@ -0,0 +1,90 @@ +// MODALS +// ------ + +// Recalculate z-index where appropriate +.modal-open { + .dropdown-menu { z-index: @zindexDropdown + @zindexModal; } + .dropdown.open { *z-index: @zindexDropdown + @zindexModal; } + .popover { z-index: @zindexPopover + @zindexModal; } + .tooltip { z-index: @zindexTooltip + @zindexModal; } +} + +// Background +.modal-backdrop { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: @zindexModalBackdrop; + background-color: @black; + // Fade for backdrop + &.fade { opacity: 0; } +} + +.modal-backdrop, +.modal-backdrop.fade.in { + .opacity(80); +} + +// Base modal +.modal { + position: fixed; + top: 50%; + left: 50%; + z-index: @zindexModal; + overflow: auto; + width: 560px; + margin: -250px 0 0 -280px; + background-color: @white; + border: 1px solid #999; + border: 1px solid rgba(0,0,0,.3); + *border: 1px solid #999; /* IE6-7 */ + .border-radius(6px); + .box-shadow(0 3px 7px rgba(0,0,0,0.3)); + .background-clip(padding-box); + &.fade { + .transition(e('opacity .3s linear, top .3s ease-out')); + top: -25%; + } + &.fade.in { top: 50%; } +} +.modal-header { + padding: 9px 15px; + border-bottom: 1px solid #eee; + // Close icon + .close { margin-top: 2px; } +} + +// Body (where all modal content resides) +.modal-body { + overflow-y: auto; + max-height: 400px; + padding: 15px; +} +// Remove bottom margin if need be +.modal-form { + margin-bottom: 0; +} + +// Footer (for actions) +.modal-footer { + padding: 14px 15px 15px; + margin-bottom: 0; + text-align: right; // right align buttons + background-color: #f5f5f5; + border-top: 1px solid #ddd; + .border-radius(0 0 6px 6px); + .box-shadow(inset 0 1px 0 @white); + .clearfix(); // clear it in case folks use .pull-* classes on buttons + + // Properly space out buttons + .btn + .btn { + margin-left: 5px; + margin-bottom: 0; // account for input[type="submit"] which gets the bottom margin like all other inputs + } + // but override that for button groups + .btn-group .btn + .btn { + margin-left: -1px; + } +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/navbar.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/navbar.less new file mode 100644 index 0000000..818f8a5 --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/navbar.less @@ -0,0 +1,358 @@ +// NAVBAR (FIXED AND STATIC) +// ------------------------- + + +// COMMON STYLES +// ------------- + +.navbar { + // Fix for IE7's bad z-indexing so dropdowns don't appear below content that follows the navbar + *position: relative; + *z-index: 2; + + overflow: visible; + margin-bottom: @baseLineHeight; +} + +// Gradient is applied to it's own element because overflow visible is not honored by IE when filter is present +.navbar-inner { + min-height: @navbarHeight; + padding-left: 20px; + padding-right: 20px; + #gradient > .vertical(@navbarBackgroundHighlight, @navbarBackground); + .border-radius(4px); + .box-shadow(~"0 1px 3px rgba(0,0,0,.25), inset 0 -1px 0 rgba(0,0,0,.1)"); +} + +// Set width to auto for default container +// We then reset it for fixed navbars in the #gridSystem mixin +.navbar .container { + width: auto; +} + +// Override the default collapsed state +.nav-collapse.collapse { + height: auto; +} + + +// Brand, links, text, and buttons +.navbar { + color: @navbarText; + // Hover and active states + .brand:hover { + text-decoration: none; + } + // Website or project name + .brand { + float: left; + display: block; + // Vertically center the text given @navbarHeight + @elementHeight: 20px; + padding: ((@navbarHeight - @elementHeight) / 2 - 2) 20px ((@navbarHeight - @elementHeight) / 2 + 2); + margin-left: -20px; // negative indent to left-align the text down the page + font-size: 20px; + font-weight: 200; + line-height: 1; + color: @navbarBrandColor; + } + // Plain text in topbar + .navbar-text { + margin-bottom: 0; + line-height: @navbarHeight; + } + // Janky solution for now to account for links outside the .nav + .navbar-link { + color: @navbarLinkColor; + &:hover { + color: @navbarLinkColorHover; + } + } + // Buttons in navbar + .btn, + .btn-group { + .navbarVerticalAlign(30px); // Vertically center in navbar + } + .btn-group .btn { + margin: 0; // then undo the margin here so we don't accidentally double it + } +} + +// Navbar forms +.navbar-form { + margin-bottom: 0; // remove default bottom margin + .clearfix(); + input, + select, + .radio, + .checkbox { + .navbarVerticalAlign(30px); // Vertically center in navbar + } + input, + select { + display: inline-block; + margin-bottom: 0; + } + input[type="image"], + input[type="checkbox"], + input[type="radio"] { + margin-top: 3px; + } + .input-append, + .input-prepend { + margin-top: 6px; + white-space: nowrap; // preven two items from separating within a .navbar-form that has .pull-left + input { + margin-top: 0; // remove the margin on top since it's on the parent + } + } +} + +// Navbar search +.navbar-search { + position: relative; + float: left; + .navbarVerticalAlign(28px); // Vertically center in navbar + margin-bottom: 0; + .search-query { + padding: 4px 9px; + #font > .sans-serif(13px, normal, 1); + color: @white; + background-color: @navbarSearchBackground; + border: 1px solid @navbarSearchBorder; + .box-shadow(~"inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15)"); + .transition(none); + + .placeholder(@navbarSearchPlaceholderColor); + + // Focus states (we use .focused since IE7-8 and down doesn't support :focus) + &:focus, + &.focused { + padding: 5px 10px; + color: @grayDark; + text-shadow: 0 1px 0 @white; + background-color: @navbarSearchBackgroundFocus; + border: 0; + .box-shadow(0 0 3px rgba(0,0,0,.15)); + outline: 0; + } + } +} + + + +// FIXED NAVBAR +// ------------ + +// Shared (top/bottom) styles +.navbar-fixed-top, +.navbar-fixed-bottom { + position: fixed; + right: 0; + left: 0; + z-index: @zindexFixedNavbar; + margin-bottom: 0; // remove 18px margin for static navbar +} +.navbar-fixed-top .navbar-inner, +.navbar-fixed-bottom .navbar-inner { + padding-left: 0; + padding-right: 0; + .border-radius(0); +} + +.navbar-fixed-top .container, +.navbar-fixed-bottom .container { + #grid > .core > .span(@gridColumns); +} + +// Fixed to top +.navbar-fixed-top { + top: 0; +} + +// Fixed to bottom +.navbar-fixed-bottom { + bottom: 0; +} + + + +// NAVIGATION +// ---------- + +.navbar .nav { + position: relative; + left: 0; + display: block; + float: left; + margin: 0 10px 0 0; +} +.navbar .nav.pull-right { + float: right; // redeclare due to specificity +} +.navbar .nav > li { + display: block; + float: left; +} + +// Links +.navbar .nav > li > a { + float: none; + // Vertically center the text given @navbarHeight + @elementHeight: 20px; + padding: ((@navbarHeight - @elementHeight) / 2 - 1) 10px ((@navbarHeight - @elementHeight) / 2 + 1); + line-height: 19px; + color: @navbarLinkColor; + text-decoration: none; + text-shadow: 0 -1px 0 rgba(0,0,0,.25); +} +// Buttons +.navbar .btn { + display: inline-block; + padding: 4px 10px 4px; + // Vertically center the button given @navbarHeight + @elementHeight: 28px; + margin: ((@navbarHeight - @elementHeight) / 2 - 1) 5px ((@navbarHeight - @elementHeight) / 2); + line-height: @baseLineHeight; +} +.navbar .btn-group { + margin: 0; + // Vertically center the button given @navbarHeight + @elementHeight: 28px; + padding: ((@navbarHeight - @elementHeight) / 2 - 1) 5px ((@navbarHeight - @elementHeight) / 2); +} +// Hover +.navbar .nav > li > a:hover { + background-color: @navbarLinkBackgroundHover; // "transparent" is default to differentiate :hover from .active + color: @navbarLinkColorHover; + text-decoration: none; +} + +// Active nav items +.navbar .nav .active > a, +.navbar .nav .active > a:hover { + color: @navbarLinkColorActive; + text-decoration: none; + background-color: @navbarLinkBackgroundActive; +} + +// Dividers (basically a vertical hr) +.navbar .divider-vertical { + height: @navbarHeight; + width: 1px; + margin: 0 9px; + overflow: hidden; + background-color: @navbarBackground; + border-right: 1px solid @navbarBackgroundHighlight; +} + +// Secondary (floated right) nav in topbar +.navbar .nav.pull-right { + margin-left: 10px; + margin-right: 0; +} + +// Navbar button for toggling navbar items in responsive layouts +// These definitions need to come after '.navbar .btn' +.navbar .btn-navbar { + display: none; + float: right; + padding: 7px 10px; + margin-left: 5px; + margin-right: 5px; + .buttonBackground(@navbarBackgroundHighlight, @navbarBackground); + .box-shadow(~"inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075)"); +} +.navbar .btn-navbar .icon-bar { + display: block; + width: 18px; + height: 2px; + background-color: #f5f5f5; + .border-radius(1px); + .box-shadow(0 1px 0 rgba(0,0,0,.25)); +} +.btn-navbar .icon-bar + .icon-bar { + margin-top: 3px; +} + + +// Dropdown menus +// -------------- + +// Menu position and menu carets +.navbar .dropdown-menu { + &:before { + content: ''; + display: inline-block; + border-left: 7px solid transparent; + border-right: 7px solid transparent; + border-bottom: 7px solid #ccc; + border-bottom-color: @dropdownBorder; + position: absolute; + top: -7px; + left: 9px; + } + &:after { + content: ''; + display: inline-block; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid @dropdownBackground; + position: absolute; + top: -6px; + left: 10px; + } +} +// Menu position and menu caret support for dropups via extra dropup class +.navbar-fixed-bottom .dropdown-menu { + &:before { + border-top: 7px solid #ccc; + border-top-color: @dropdownBorder; + border-bottom: 0; + bottom: -7px; + top: auto; + } + &:after { + border-top: 6px solid @dropdownBackground; + border-bottom: 0; + bottom: -6px; + top: auto; + } +} +// Dropdown toggle caret +.navbar .nav li.dropdown .dropdown-toggle .caret, +.navbar .nav li.dropdown.open .caret { + border-top-color: @white; + border-bottom-color: @white; +} +.navbar .nav li.dropdown.active .caret { + .opacity(100); +} + +// Remove background color from open dropdown +.navbar .nav li.dropdown.open > .dropdown-toggle, +.navbar .nav li.dropdown.active > .dropdown-toggle, +.navbar .nav li.dropdown.open.active > .dropdown-toggle { + background-color: transparent; +} + +// Dropdown link on hover +.navbar .nav li.dropdown.active > .dropdown-toggle:hover { + color: @white; +} + +// Right aligned menus need alt position +// TODO: rejigger this at some point to simplify the selectors +.navbar .pull-right .dropdown-menu, +.navbar .dropdown-menu.pull-right { + left: auto; + right: 0; + &:before { + left: auto; + right: 12px; + } + &:after { + left: auto; + right: 13px; + } +}
\ No newline at end of file diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/navs.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/navs.less new file mode 100644 index 0000000..5cb9f9f --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/navs.less @@ -0,0 +1,363 @@ +// NAVIGATIONS +// ----------- + + + +// BASE CLASS +// ---------- + +.nav { + margin-left: 0; + margin-bottom: @baseLineHeight; + list-style: none; +} + +// Make links block level +.nav > li > a { + display: block; +} +.nav > li > a:hover { + text-decoration: none; + background-color: @grayLighter; +} + +// Redeclare pull classes because of specifity +.nav > .pull-right { + float: right; +} + +// Nav headers (for dropdowns and lists) +.nav .nav-header { + display: block; + padding: 3px 15px; + font-size: 11px; + font-weight: bold; + line-height: @baseLineHeight; + color: @grayLight; + text-shadow: 0 1px 0 rgba(255,255,255,.5); + text-transform: uppercase; +} +// Space them out when they follow another list item (link) +.nav li + .nav-header { + margin-top: 9px; +} + + +// NAV LIST +// -------- + +.nav-list { + padding-left: 15px; + padding-right: 15px; + margin-bottom: 0; +} +.nav-list > li > a, +.nav-list .nav-header { + margin-left: -15px; + margin-right: -15px; + text-shadow: 0 1px 0 rgba(255,255,255,.5); +} +.nav-list > li > a { + padding: 3px 15px; +} +.nav-list > .active > a, +.nav-list > .active > a:hover { + color: @white; + text-shadow: 0 -1px 0 rgba(0,0,0,.2); + background-color: @linkColor; +} +.nav-list [class^="icon-"] { + margin-right: 2px; +} +// Dividers (basically an hr) within the dropdown +.nav-list .divider { + .nav-divider(); +} + + + +// TABS AND PILLS +// ------------- + +// Common styles +.nav-tabs, +.nav-pills { + .clearfix(); +} +.nav-tabs > li, +.nav-pills > li { + float: left; +} +.nav-tabs > li > a, +.nav-pills > li > a { + padding-right: 12px; + padding-left: 12px; + margin-right: 2px; + line-height: 14px; // keeps the overall height an even number +} + +// TABS +// ---- + +// Give the tabs something to sit on +.nav-tabs { + border-bottom: 1px solid #ddd; +} +// Make the list-items overlay the bottom border +.nav-tabs > li { + margin-bottom: -1px; +} +// Actual tabs (as links) +.nav-tabs > li > a { + padding-top: 8px; + padding-bottom: 8px; + line-height: @baseLineHeight; + border: 1px solid transparent; + .border-radius(4px 4px 0 0); + &:hover { + border-color: @grayLighter @grayLighter #ddd; + } +} +// Active state, and it's :hover to override normal :hover +.nav-tabs > .active > a, +.nav-tabs > .active > a:hover { + color: @gray; + background-color: @white; + border: 1px solid #ddd; + border-bottom-color: transparent; + cursor: default; +} + + +// PILLS +// ----- + +// Links rendered as pills +.nav-pills > li > a { + padding-top: 8px; + padding-bottom: 8px; + margin-top: 2px; + margin-bottom: 2px; + .border-radius(5px); +} + +// Active state +.nav-pills > .active > a, +.nav-pills > .active > a:hover { + color: @white; + background-color: @linkColor; +} + + + +// STACKED NAV +// ----------- + +// Stacked tabs and pills +.nav-stacked > li { + float: none; +} +.nav-stacked > li > a { + margin-right: 0; // no need for the gap between nav items +} + +// Tabs +.nav-tabs.nav-stacked { + border-bottom: 0; +} +.nav-tabs.nav-stacked > li > a { + border: 1px solid #ddd; + .border-radius(0); +} +.nav-tabs.nav-stacked > li:first-child > a { + .border-radius(4px 4px 0 0); +} +.nav-tabs.nav-stacked > li:last-child > a { + .border-radius(0 0 4px 4px); +} +.nav-tabs.nav-stacked > li > a:hover { + border-color: #ddd; + z-index: 2; +} + +// Pills +.nav-pills.nav-stacked > li > a { + margin-bottom: 3px; +} +.nav-pills.nav-stacked > li:last-child > a { + margin-bottom: 1px; // decrease margin to match sizing of stacked tabs +} + + + +// DROPDOWNS +// --------- + +.nav-tabs .dropdown-menu { + .border-radius(0 0 5px 5px); // remove the top rounded corners here since there is a hard edge above the menu +} +.nav-pills .dropdown-menu { + .border-radius(4px); // make rounded corners match the pills +} + +// Default dropdown links +// ------------------------- +// Make carets use linkColor to start +.nav-tabs .dropdown-toggle .caret, +.nav-pills .dropdown-toggle .caret { + border-top-color: @linkColor; + border-bottom-color: @linkColor; + margin-top: 6px; +} +.nav-tabs .dropdown-toggle:hover .caret, +.nav-pills .dropdown-toggle:hover .caret { + border-top-color: @linkColorHover; + border-bottom-color: @linkColorHover; +} + +// Active dropdown links +// ------------------------- +.nav-tabs .active .dropdown-toggle .caret, +.nav-pills .active .dropdown-toggle .caret { + border-top-color: @grayDark; + border-bottom-color: @grayDark; +} + +// Active:hover dropdown links +// ------------------------- +.nav > .dropdown.active > a:hover { + color: @black; + cursor: pointer; +} + +// Open dropdowns +// ------------------------- +.nav-tabs .open .dropdown-toggle, +.nav-pills .open .dropdown-toggle, +.nav > li.dropdown.open.active > a:hover { + color: @white; + background-color: @grayLight; + border-color: @grayLight; +} +.nav li.dropdown.open .caret, +.nav li.dropdown.open.active .caret, +.nav li.dropdown.open a:hover .caret { + border-top-color: @white; + border-bottom-color: @white; + .opacity(100); +} + +// Dropdowns in stacked tabs +.tabs-stacked .open > a:hover { + border-color: @grayLight; +} + + + +// TABBABLE +// -------- + + +// COMMON STYLES +// ------------- + +// Clear any floats +.tabbable { + .clearfix(); +} +.tab-content { + overflow: auto; // prevent content from running below tabs +} + +// Remove border on bottom, left, right +.tabs-below > .nav-tabs, +.tabs-right > .nav-tabs, +.tabs-left > .nav-tabs { + border-bottom: 0; +} + +// Show/hide tabbable areas +.tab-content > .tab-pane, +.pill-content > .pill-pane { + display: none; +} +.tab-content > .active, +.pill-content > .active { + display: block; +} + + +// BOTTOM +// ------ + +.tabs-below > .nav-tabs { + border-top: 1px solid #ddd; +} +.tabs-below > .nav-tabs > li { + margin-top: -1px; + margin-bottom: 0; +} +.tabs-below > .nav-tabs > li > a { + .border-radius(0 0 4px 4px); + &:hover { + border-bottom-color: transparent; + border-top-color: #ddd; + } +} +.tabs-below > .nav-tabs > .active > a, +.tabs-below > .nav-tabs > .active > a:hover { + border-color: transparent #ddd #ddd #ddd; +} + +// LEFT & RIGHT +// ------------ + +// Common styles +.tabs-left > .nav-tabs > li, +.tabs-right > .nav-tabs > li { + float: none; +} +.tabs-left > .nav-tabs > li > a, +.tabs-right > .nav-tabs > li > a { + min-width: 74px; + margin-right: 0; + margin-bottom: 3px; +} + +// Tabs on the left +.tabs-left > .nav-tabs { + float: left; + margin-right: 19px; + border-right: 1px solid #ddd; +} +.tabs-left > .nav-tabs > li > a { + margin-right: -1px; + .border-radius(4px 0 0 4px); +} +.tabs-left > .nav-tabs > li > a:hover { + border-color: @grayLighter #ddd @grayLighter @grayLighter; +} +.tabs-left > .nav-tabs .active > a, +.tabs-left > .nav-tabs .active > a:hover { + border-color: #ddd transparent #ddd #ddd; + *border-right-color: @white; +} + +// Tabs on the right +.tabs-right > .nav-tabs { + float: right; + margin-left: 19px; + border-left: 1px solid #ddd; +} +.tabs-right > .nav-tabs > li > a { + margin-left: -1px; + .border-radius(0 4px 4px 0); +} +.tabs-right > .nav-tabs > li > a:hover { + border-color: @grayLighter @grayLighter @grayLighter #ddd; +} +.tabs-right > .nav-tabs .active > a, +.tabs-right > .nav-tabs .active > a:hover { + border-color: #ddd #ddd #ddd transparent; + *border-left-color: @white; +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/pager.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/pager.less new file mode 100644 index 0000000..4244b5e --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/pager.less @@ -0,0 +1,36 @@ +// PAGER +// ----- + +.pager { + margin-left: 0; + margin-bottom: @baseLineHeight; + list-style: none; + text-align: center; + .clearfix(); +} +.pager li { + display: inline; +} +.pager a { + display: inline-block; + padding: 5px 14px; + background-color: #fff; + border: 1px solid #ddd; + .border-radius(15px); +} +.pager a:hover { + text-decoration: none; + background-color: #f5f5f5; +} +.pager .next a { + float: right; +} +.pager .previous a { + float: left; +} +.pager .disabled a, +.pager .disabled a:hover { + color: @grayLight; + background-color: #fff; + cursor: default; +}
\ No newline at end of file diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/pagination.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/pagination.less new file mode 100644 index 0000000..38cf65c --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/pagination.less @@ -0,0 +1,56 @@ +// PAGINATION +// ---------- + +.pagination { + height: @baseLineHeight * 2; + margin: @baseLineHeight 0; + } +.pagination ul { + display: inline-block; + .ie7-inline-block(); + margin-left: 0; + margin-bottom: 0; + .border-radius(3px); + .box-shadow(0 1px 2px rgba(0,0,0,.05)); +} +.pagination li { + display: inline; + } +.pagination a { + float: left; + padding: 0 14px; + line-height: (@baseLineHeight * 2) - 2; + text-decoration: none; + border: 1px solid #ddd; + border-left-width: 0; +} +.pagination a:hover, +.pagination .active a { + background-color: #f5f5f5; +} +.pagination .active a { + color: @grayLight; + cursor: default; +} +.pagination .disabled span, +.pagination .disabled a, +.pagination .disabled a:hover { + color: @grayLight; + background-color: transparent; + cursor: default; +} +.pagination li:first-child a { + border-left-width: 1px; + .border-radius(3px 0 0 3px); +} +.pagination li:last-child a { + .border-radius(0 3px 3px 0); +} + +// Centered +.pagination-centered { + text-align: center; +} +.pagination-right { + text-align: right; +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/popovers.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/popovers.less new file mode 100644 index 0000000..558d99e --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/popovers.less @@ -0,0 +1,49 @@ +// POPOVERS +// -------- + +.popover { + position: absolute; + top: 0; + left: 0; + z-index: @zindexPopover; + display: none; + padding: 5px; + &.top { margin-top: -5px; } + &.right { margin-left: 5px; } + &.bottom { margin-top: 5px; } + &.left { margin-left: -5px; } + &.top .arrow { #popoverArrow > .top(); } + &.right .arrow { #popoverArrow > .right(); } + &.bottom .arrow { #popoverArrow > .bottom(); } + &.left .arrow { #popoverArrow > .left(); } + .arrow { + position: absolute; + width: 0; + height: 0; + } +} +.popover-inner { + padding: 3px; + width: 280px; + overflow: hidden; + background: @black; // has to be full background declaration for IE fallback + background: rgba(0,0,0,.8); + .border-radius(6px); + .box-shadow(0 3px 7px rgba(0,0,0,0.3)); +} +.popover-title { + padding: 9px 15px; + line-height: 1; + background-color: #f5f5f5; + border-bottom:1px solid #eee; + .border-radius(3px 3px 0 0); +} +.popover-content { + padding: 14px; + background-color: @white; + .border-radius(0 0 3px 3px); + .background-clip(padding-box); + p, ul, ol { + margin-bottom: 0; + } +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/progress-bars.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/progress-bars.less new file mode 100644 index 0000000..3b47e64 --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/progress-bars.less @@ -0,0 +1,117 @@ +// PROGRESS BARS +// ------------- + + +// ANIMATIONS +// ---------- + +// Webkit +@-webkit-keyframes progress-bar-stripes { + from { background-position: 40px 0; } + to { background-position: 0 0; } +} + +// Firefox +@-moz-keyframes progress-bar-stripes { + from { background-position: 40px 0; } + to { background-position: 0 0; } +} + +// IE9 +@-ms-keyframes progress-bar-stripes { + from { background-position: 40px 0; } + to { background-position: 0 0; } +} + +// Opera +@-o-keyframes progress-bar-stripes { + from { background-position: 0 0; } + to { background-position: 40px 0; } +} + +// Spec +@keyframes progress-bar-stripes { + from { background-position: 40px 0; } + to { background-position: 0 0; } +} + + + +// THE BARS +// -------- + +// Outer container +.progress { + overflow: hidden; + height: 18px; + margin-bottom: 18px; + #gradient > .vertical(#f5f5f5, #f9f9f9); + .box-shadow(inset 0 1px 2px rgba(0,0,0,.1)); + .border-radius(4px); +} + +// Bar of progress +.progress .bar { + width: 0%; + height: 18px; + color: @white; + font-size: 12px; + text-align: center; + text-shadow: 0 -1px 0 rgba(0,0,0,.25); + #gradient > .vertical(#149bdf, #0480be); + .box-shadow(inset 0 -1px 0 rgba(0,0,0,.15)); + .box-sizing(border-box); + .transition(width .6s ease); +} + +// Striped bars +.progress-striped .bar { + #gradient > .striped(#149bdf); + .background-size(40px 40px); +} + +// Call animation for the active one +.progress.active .bar { + -webkit-animation: progress-bar-stripes 2s linear infinite; + -moz-animation: progress-bar-stripes 2s linear infinite; + -ms-animation: progress-bar-stripes 2s linear infinite; + -o-animation: progress-bar-stripes 2s linear infinite; + animation: progress-bar-stripes 2s linear infinite; +} + + + +// COLORS +// ------ + +// Danger (red) +.progress-danger .bar { + #gradient > .vertical(#ee5f5b, #c43c35); +} +.progress-danger.progress-striped .bar { + #gradient > .striped(#ee5f5b); +} + +// Success (green) +.progress-success .bar { + #gradient > .vertical(#62c462, #57a957); +} +.progress-success.progress-striped .bar { + #gradient > .striped(#62c462); +} + +// Info (teal) +.progress-info .bar { + #gradient > .vertical(#5bc0de, #339bb9); +} +.progress-info.progress-striped .bar { + #gradient > .striped(#5bc0de); +} + +// Warning (orange) +.progress-warning .bar { + #gradient > .vertical(lighten(@orange, 15%), @orange); +} +.progress-warning.progress-striped .bar { + #gradient > .striped(lighten(@orange, 15%)); +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/reset.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/reset.less new file mode 100644 index 0000000..2332e03 --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/reset.less @@ -0,0 +1,131 @@ +// Reset.less +// Adapted from Normalize.css http://github.com/necolas/normalize.css +// ------------------------------------------------------------------------ + +// Display in IE6-9 and FF3 +// ------------------------- + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +nav, +section { + display: block; +} + +// Display block in IE6-9 and FF3 +// ------------------------- + +audio, +canvas, +video { + display: inline-block; + *display: inline; + *zoom: 1; +} + +// Prevents modern browsers from displaying 'audio' without controls +// ------------------------- + +audio:not([controls]) { + display: none; +} + +// Base settings +// ------------------------- + +html { + font-size: 100%; + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; +} +// Focus states +a:focus { + .tab-focus(); +} +// Hover & Active +a:hover, +a:active { + outline: 0; +} + +// Prevents sub and sup affecting line-height in all browsers +// ------------------------- + +sub, +sup { + position: relative; + font-size: 75%; + line-height: 0; + vertical-align: baseline; +} +sup { + top: -0.5em; +} +sub { + bottom: -0.25em; +} + +// Img border in a's and image quality +// ------------------------- + +img { + max-width: 100%; // Make images inherently responsive + vertical-align: middle; + border: 0; + -ms-interpolation-mode: bicubic; +} + +// Prevent max-width from affecting Google Maps +#map_canvas img { + max-width: none; +} + +// Forms +// ------------------------- + +// Font size in all browsers, margin changes, misc consistency +button, +input, +select, +textarea { + margin: 0; + font-size: 100%; + vertical-align: middle; +} +button, +input { + *overflow: visible; // Inner spacing ie IE6/7 + line-height: normal; // FF3/4 have !important on line-height in UA stylesheet +} +button::-moz-focus-inner, +input::-moz-focus-inner { // Inner padding and border oddities in FF3/4 + padding: 0; + border: 0; +} +button, +input[type="button"], +input[type="reset"], +input[type="submit"] { + cursor: pointer; // Cursors on all buttons applied consistently + -webkit-appearance: button; // Style clickable inputs in iOS +} +input[type="search"] { // Appearance in Safari/Chrome + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + -webkit-appearance: textfield; +} +input[type="search"]::-webkit-search-decoration, +input[type="search"]::-webkit-search-cancel-button { + -webkit-appearance: none; // Inner-padding issues in Chrome OSX, Safari 5 +} +textarea { + overflow: auto; // Remove vertical scrollbar in IE6-9 + vertical-align: top; // Readability and alignment cross-browser +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/responsive-1200px-min.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/responsive-1200px-min.less new file mode 100644 index 0000000..a7c9f4e --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/responsive-1200px-min.less @@ -0,0 +1,26 @@ +// LARGE DESKTOP & UP +// ------------------ + +@media (min-width: 1200px) { + + // Fixed grid + #grid > .core(70px, 30px); + + // Fluid grid + #grid > .fluid(5.982905983%, 2.564102564%); + + // Input grid + #grid > .input(70px, 30px); + + // Thumbnails + .thumbnails { + margin-left: -30px; + } + .thumbnails > li { + margin-left: 30px; + } + .row-fluid .thumbnails { + margin-left: 0; + } + +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/responsive-767px-max.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/responsive-767px-max.less new file mode 100644 index 0000000..614c690 --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/responsive-767px-max.less @@ -0,0 +1,149 @@ +// UP TO LANDSCAPE PHONE +// --------------------- + +@media (max-width: 480px) { + + // Smooth out the collapsing/expanding nav + .nav-collapse { + -webkit-transform: translate3d(0, 0, 0); // activate the GPU + } + + // Block level the page header small tag for readability + .page-header h1 small { + display: block; + line-height: @baseLineHeight; + } + + // Update checkboxes for iOS + input[type="checkbox"], + input[type="radio"] { + border: 1px solid #ccc; + } + + // Remove the horizontal form styles + .form-horizontal .control-group > label { + float: none; + width: auto; + padding-top: 0; + text-align: left; + } + // Move over all input controls and content + .form-horizontal .controls { + margin-left: 0; + } + // Move the options list down to align with labels + .form-horizontal .control-list { + padding-top: 0; // has to be padding because margin collaspes + } + // Move over buttons in .form-actions to align with .controls + .form-horizontal .form-actions { + padding-left: 10px; + padding-right: 10px; + } + + // Modals + .modal { + position: absolute; + top: 10px; + left: 10px; + right: 10px; + width: auto; + margin: 0; + &.fade.in { top: auto; } + } + .modal-header .close { + padding: 10px; + margin: -10px; + } + + // Carousel + .carousel-caption { + position: static; + } + +} + + + +// LANDSCAPE PHONE TO SMALL DESKTOP & PORTRAIT TABLET +// -------------------------------------------------- + +@media (max-width: 767px) { + + // Padding to set content in a bit + body { + padding-left: 20px; + padding-right: 20px; + } + // Negative indent the now static "fixed" navbar + .navbar-fixed-top, + .navbar-fixed-bottom { + margin-left: -20px; + margin-right: -20px; + } + // Remove padding on container given explicit padding set on body + .container-fluid { + padding: 0; + } + + // TYPOGRAPHY + // ---------- + // Reset horizontal dl + .dl-horizontal { + dt { + float: none; + clear: none; + width: auto; + text-align: left; + } + dd { + margin-left: 0; + } + } + + // GRID & CONTAINERS + // ----------------- + // Remove width from containers + .container { + width: auto; + } + // Fluid rows + .row-fluid { + width: 100%; + } + // Undo negative margin on rows and thumbnails + .row, + .thumbnails { + margin-left: 0; + } + // Make all grid-sized elements block level again + [class*="span"], + .row-fluid [class*="span"] { + float: none; + display: block; + width: auto; + margin-left: 0; + } + + // FORM FIELDS + // ----------- + // Make span* classes full width + .input-large, + .input-xlarge, + .input-xxlarge, + input[class*="span"], + select[class*="span"], + textarea[class*="span"], + .uneditable-input { + .input-block-level(); + } + // But don't let it screw up prepend/append inputs + .input-prepend input, + .input-append input, + .input-prepend input[class*="span"], + .input-append input[class*="span"] { + display: inline-block; // redeclare so they don't wrap to new lines + width: auto; + } + +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/responsive-768px-979px.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/responsive-768px-979px.less new file mode 100644 index 0000000..76f4f6d --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/responsive-768px-979px.less @@ -0,0 +1,17 @@ +// PORTRAIT TABLET TO DEFAULT DESKTOP +// ---------------------------------- + +@media (min-width: 768px) and (max-width: 979px) { + + // Fixed grid + #grid > .core(42px, 20px); + + // Fluid grid + #grid > .fluid(5.801104972%, 2.762430939%); + + // Input grid + #grid > .input(42px, 20px); + + // No need to reset .thumbnails here since it's the same @gridGutterWidth + +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/responsive-navbar.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/responsive-navbar.less new file mode 100644 index 0000000..8d31db5 --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/responsive-navbar.less @@ -0,0 +1,153 @@ +// TABLETS AND BELOW +// ----------------- +@media (max-width: 979px) { + + // UNFIX THE TOPBAR + // ---------------- + // Remove any padding from the body + body { + padding-top: 0; + } + // Unfix the navbar + .navbar-fixed-top, + .navbar-fixed-bottom { + position: static; + } + .navbar-fixed-top { + margin-bottom: @baseLineHeight; + } + .navbar-fixed-bottom { + margin-top: @baseLineHeight; + } + .navbar-fixed-top .navbar-inner, + .navbar-fixed-bottom .navbar-inner { + padding: 5px; + } + .navbar .container { + width: auto; + padding: 0; + } + // Account for brand name + .navbar .brand { + padding-left: 10px; + padding-right: 10px; + margin: 0 0 0 -5px; + } + + // COLLAPSIBLE NAVBAR + // ------------------ + // Nav collapse clears brand + .nav-collapse { + clear: both; + } + // Block-level the nav + .nav-collapse .nav { + float: none; + margin: 0 0 (@baseLineHeight / 2); + } + .nav-collapse .nav > li { + float: none; + } + .nav-collapse .nav > li > a { + margin-bottom: 2px; + } + .nav-collapse .nav > .divider-vertical { + display: none; + } + .nav-collapse .nav .nav-header { + color: @navbarText; + text-shadow: none; + } + // Nav and dropdown links in navbar + .nav-collapse .nav > li > a, + .nav-collapse .dropdown-menu a { + padding: 6px 15px; + font-weight: bold; + color: @navbarLinkColor; + .border-radius(3px); + } + // Buttons + .nav-collapse .btn { + padding: 4px 10px 4px; + font-weight: normal; + .border-radius(4px); + } + .nav-collapse .dropdown-menu li + li a { + margin-bottom: 2px; + } + .nav-collapse .nav > li > a:hover, + .nav-collapse .dropdown-menu a:hover { + background-color: @navbarBackground; + } + // Buttons in the navbar + .nav-collapse.in .btn-group { + margin-top: 5px; + padding: 0; + } + // Dropdowns in the navbar + .nav-collapse .dropdown-menu { + position: static; + top: auto; + left: auto; + float: none; + display: block; + max-width: none; + margin: 0 15px; + padding: 0; + background-color: transparent; + border: none; + .border-radius(0); + .box-shadow(none); + } + .nav-collapse .dropdown-menu:before, + .nav-collapse .dropdown-menu:after { + display: none; + } + .nav-collapse .dropdown-menu .divider { + display: none; + } + // Forms in navbar + .nav-collapse .navbar-form, + .nav-collapse .navbar-search { + float: none; + padding: (@baseLineHeight / 2) 15px; + margin: (@baseLineHeight / 2) 0; + border-top: 1px solid @navbarBackground; + border-bottom: 1px solid @navbarBackground; + .box-shadow(~"inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1)"); + } + // Pull right (secondary) nav content + .navbar .nav-collapse .nav.pull-right { + float: none; + margin-left: 0; + } + // Hide everything in the navbar save .brand and toggle button */ + .nav-collapse, + .nav-collapse.collapse { + overflow: hidden; + height: 0; + } + // Navbar button + .navbar .btn-navbar { + display: block; + } + + // STATIC NAVBAR + // ------------- + .navbar-static .navbar-inner { + padding-left: 10px; + padding-right: 10px; + } +} + + +// DEFAULT DESKTOP +// --------------- + +// Required to make the collapsing navbar work on regular desktops +@media (min-width: 980px) { + .nav-collapse.collapse { + height: auto !important; + overflow: visible !important; + } +}
\ No newline at end of file diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/responsive-utilities.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/responsive-utilities.less new file mode 100644 index 0000000..572846c --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/responsive-utilities.less @@ -0,0 +1,41 @@ +// RESPONSIVE CLASSES +// ------------------ + +// Hide from screenreaders and browsers +// Credit: HTML5 Boilerplate +.hidden { + display: none; + visibility: hidden; +} + +// Visibility utilities + +// For desktops +.visible-phone { display: none !important; } +.visible-tablet { display: none !important; } +.visible-desktop { } // Don't set initially +.hidden-phone { } +.hidden-tablet { } +.hidden-desktop { display: none !important; } + +// Phones only +@media (max-width: 767px) { + // Show + .visible-phone { display: inherit !important; } // Use inherit to restore previous behavior + // Hide + .hidden-phone { display: none !important; } + // Hide everything else + .hidden-desktop { display: inherit !important; } + .visible-desktop { display: none !important; } +} + +// Tablets & small desktops only +@media (min-width: 768px) and (max-width: 979px) { + // Show + .visible-tablet { display: inherit !important; } + // Hide + .hidden-tablet { display: none !important; } + // Hide everything else + .hidden-desktop { display: inherit !important; } + .visible-desktop { display: none !important ; } +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/responsive.css b/src/main/webapp/stylesheets/bootstrap-2.0.4/responsive.css new file mode 100644 index 0000000..fff850f --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/responsive.css @@ -0,0 +1,750 @@ +/*! + * Bootstrap Responsive v2.0.4 + * + * Copyright 2012 Twitter, Inc + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Designed and built with all the love in the world @twitter by @mdo and @fat. + */ +.clearfix { + *zoom: 1; +} +.clearfix:before, +.clearfix:after { + display: table; + content: ""; +} +.clearfix:after { + clear: both; +} +.hide-text { + font: 0/0 a; + color: transparent; + text-shadow: none; + background-color: transparent; + border: 0; +} +.input-block-level { + display: block; + width: 100%; + min-height: 28px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; +} +.hidden { + display: none; + visibility: hidden; +} +.visible-phone { + display: none !important; +} +.visible-tablet { + display: none !important; +} +.hidden-desktop { + display: none !important; +} +@media (max-width: 767px) { + .visible-phone { + display: inherit !important; + } + .hidden-phone { + display: none !important; + } + .hidden-desktop { + display: inherit !important; + } + .visible-desktop { + display: none !important; + } +} +@media (min-width: 768px) and (max-width: 979px) { + .visible-tablet { + display: inherit !important; + } + .hidden-tablet { + display: none !important; + } + .hidden-desktop { + display: inherit !important; + } + .visible-desktop { + display: none !important ; + } +} +@media (max-width: 480px) { + .nav-collapse { + -webkit-transform: translate3d(0, 0, 0); + } + .page-header h1 small { + display: block; + line-height: 18px; + } + input[type="checkbox"], + input[type="radio"] { + border: 1px solid #ccc; + } + .form-horizontal .control-group > label { + float: none; + width: auto; + padding-top: 0; + text-align: left; + } + .form-horizontal .controls { + margin-left: 0; + } + .form-horizontal .control-list { + padding-top: 0; + } + .form-horizontal .form-actions { + padding-left: 10px; + padding-right: 10px; + } + .modal { + position: absolute; + top: 10px; + left: 10px; + right: 10px; + width: auto; + margin: 0; + } + .modal.fade.in { + top: auto; + } + .modal-header .close { + padding: 10px; + margin: -10px; + } + .carousel-caption { + position: static; + } +} +@media (max-width: 767px) { + body { + padding-left: 20px; + padding-right: 20px; + } + .navbar-fixed-top, + .navbar-fixed-bottom { + margin-left: -20px; + margin-right: -20px; + } + .container-fluid { + padding: 0; + } + .dl-horizontal dt { + float: none; + clear: none; + width: auto; + text-align: left; + } + .dl-horizontal dd { + margin-left: 0; + } + .container { + width: auto; + } + .row-fluid { + width: 100%; + } + .row, + .thumbnails { + margin-left: 0; + } + [class*="span"], + .row-fluid [class*="span"] { + float: none; + display: block; + width: auto; + margin-left: 0; + } + .input-large, + .input-xlarge, + .input-xxlarge, + input[class*="span"], + select[class*="span"], + textarea[class*="span"], + .uneditable-input { + display: block; + width: 100%; + min-height: 28px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; + } + .input-prepend input, + .input-append input, + .input-prepend input[class*="span"], + .input-append input[class*="span"] { + display: inline-block; + width: auto; + } +} +@media (min-width: 768px) and (max-width: 979px) { + .row { + margin-left: -20px; + *zoom: 1; + } + .row:before, + .row:after { + display: table; + content: ""; + } + .row:after { + clear: both; + } + [class*="span"] { + float: left; + margin-left: 20px; + } + .container, + .navbar-fixed-top .container, + .navbar-fixed-bottom .container { + width: 724px; + } + .span12 { + width: 724px; + } + .span11 { + width: 662px; + } + .span10 { + width: 600px; + } + .span9 { + width: 538px; + } + .span8 { + width: 476px; + } + .span7 { + width: 414px; + } + .span6 { + width: 352px; + } + .span5 { + width: 290px; + } + .span4 { + width: 228px; + } + .span3 { + width: 166px; + } + .span2 { + width: 104px; + } + .span1 { + width: 42px; + } + .offset12 { + margin-left: 764px; + } + .offset11 { + margin-left: 702px; + } + .offset10 { + margin-left: 640px; + } + .offset9 { + margin-left: 578px; + } + .offset8 { + margin-left: 516px; + } + .offset7 { + margin-left: 454px; + } + .offset6 { + margin-left: 392px; + } + .offset5 { + margin-left: 330px; + } + .offset4 { + margin-left: 268px; + } + .offset3 { + margin-left: 206px; + } + .offset2 { + margin-left: 144px; + } + .offset1 { + margin-left: 82px; + } + .row-fluid { + width: 100%; + *zoom: 1; + } + .row-fluid:before, + .row-fluid:after { + display: table; + content: ""; + } + .row-fluid:after { + clear: both; + } + .row-fluid [class*="span"] { + display: block; + width: 100%; + min-height: 28px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; + float: left; + margin-left: 2.762430939%; + *margin-left: 2.709239449638298%; + } + .row-fluid [class*="span"]:first-child { + margin-left: 0; + } + .row-fluid .span12 { + width: 99.999999993%; + *width: 99.9468085036383%; + } + .row-fluid .span11 { + width: 91.436464082%; + *width: 91.38327259263829%; + } + .row-fluid .span10 { + width: 82.87292817100001%; + *width: 82.8197366816383%; + } + .row-fluid .span9 { + width: 74.30939226%; + *width: 74.25620077063829%; + } + .row-fluid .span8 { + width: 65.74585634900001%; + *width: 65.6926648596383%; + } + .row-fluid .span7 { + width: 57.182320438000005%; + *width: 57.129128948638304%; + } + .row-fluid .span6 { + width: 48.618784527%; + *width: 48.5655930376383%; + } + .row-fluid .span5 { + width: 40.055248616%; + *width: 40.0020571266383%; + } + .row-fluid .span4 { + width: 31.491712705%; + *width: 31.4385212156383%; + } + .row-fluid .span3 { + width: 22.928176794%; + *width: 22.874985304638297%; + } + .row-fluid .span2 { + width: 14.364640883%; + *width: 14.311449393638298%; + } + .row-fluid .span1 { + width: 5.801104972%; + *width: 5.747913482638298%; + } + input, + textarea, + .uneditable-input { + margin-left: 0; + } + input.span12, textarea.span12, .uneditable-input.span12 { + width: 714px; + } + input.span11, textarea.span11, .uneditable-input.span11 { + width: 652px; + } + input.span10, textarea.span10, .uneditable-input.span10 { + width: 590px; + } + input.span9, textarea.span9, .uneditable-input.span9 { + width: 528px; + } + input.span8, textarea.span8, .uneditable-input.span8 { + width: 466px; + } + input.span7, textarea.span7, .uneditable-input.span7 { + width: 404px; + } + input.span6, textarea.span6, .uneditable-input.span6 { + width: 342px; + } + input.span5, textarea.span5, .uneditable-input.span5 { + width: 280px; + } + input.span4, textarea.span4, .uneditable-input.span4 { + width: 218px; + } + input.span3, textarea.span3, .uneditable-input.span3 { + width: 156px; + } + input.span2, textarea.span2, .uneditable-input.span2 { + width: 94px; + } + input.span1, textarea.span1, .uneditable-input.span1 { + width: 32px; + } +} +@media (min-width: 1200px) { + .row { + margin-left: -30px; + *zoom: 1; + } + .row:before, + .row:after { + display: table; + content: ""; + } + .row:after { + clear: both; + } + [class*="span"] { + float: left; + margin-left: 30px; + } + .container, + .navbar-fixed-top .container, + .navbar-fixed-bottom .container { + width: 1170px; + } + .span12 { + width: 1170px; + } + .span11 { + width: 1070px; + } + .span10 { + width: 970px; + } + .span9 { + width: 870px; + } + .span8 { + width: 770px; + } + .span7 { + width: 670px; + } + .span6 { + width: 570px; + } + .span5 { + width: 470px; + } + .span4 { + width: 370px; + } + .span3 { + width: 270px; + } + .span2 { + width: 170px; + } + .span1 { + width: 70px; + } + .offset12 { + margin-left: 1230px; + } + .offset11 { + margin-left: 1130px; + } + .offset10 { + margin-left: 1030px; + } + .offset9 { + margin-left: 930px; + } + .offset8 { + margin-left: 830px; + } + .offset7 { + margin-left: 730px; + } + .offset6 { + margin-left: 630px; + } + .offset5 { + margin-left: 530px; + } + .offset4 { + margin-left: 430px; + } + .offset3 { + margin-left: 330px; + } + .offset2 { + margin-left: 230px; + } + .offset1 { + margin-left: 130px; + } + .row-fluid { + width: 100%; + *zoom: 1; + } + .row-fluid:before, + .row-fluid:after { + display: table; + content: ""; + } + .row-fluid:after { + clear: both; + } + .row-fluid [class*="span"] { + display: block; + width: 100%; + min-height: 28px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; + float: left; + margin-left: 2.564102564%; + *margin-left: 2.510911074638298%; + } + .row-fluid [class*="span"]:first-child { + margin-left: 0; + } + .row-fluid .span12 { + width: 100%; + *width: 99.94680851063829%; + } + .row-fluid .span11 { + width: 91.45299145300001%; + *width: 91.3997999636383%; + } + .row-fluid .span10 { + width: 82.905982906%; + *width: 82.8527914166383%; + } + .row-fluid .span9 { + width: 74.358974359%; + *width: 74.30578286963829%; + } + .row-fluid .span8 { + width: 65.81196581200001%; + *width: 65.7587743226383%; + } + .row-fluid .span7 { + width: 57.264957265%; + *width: 57.2117657756383%; + } + .row-fluid .span6 { + width: 48.717948718%; + *width: 48.6647572286383%; + } + .row-fluid .span5 { + width: 40.170940171000005%; + *width: 40.117748681638304%; + } + .row-fluid .span4 { + width: 31.623931624%; + *width: 31.5707401346383%; + } + .row-fluid .span3 { + width: 23.076923077%; + *width: 23.0237315876383%; + } + .row-fluid .span2 { + width: 14.529914530000001%; + *width: 14.4767230406383%; + } + .row-fluid .span1 { + width: 5.982905983%; + *width: 5.929714493638298%; + } + input, + textarea, + .uneditable-input { + margin-left: 0; + } + input.span12, textarea.span12, .uneditable-input.span12 { + width: 1160px; + } + input.span11, textarea.span11, .uneditable-input.span11 { + width: 1060px; + } + input.span10, textarea.span10, .uneditable-input.span10 { + width: 960px; + } + input.span9, textarea.span9, .uneditable-input.span9 { + width: 860px; + } + input.span8, textarea.span8, .uneditable-input.span8 { + width: 760px; + } + input.span7, textarea.span7, .uneditable-input.span7 { + width: 660px; + } + input.span6, textarea.span6, .uneditable-input.span6 { + width: 560px; + } + input.span5, textarea.span5, .uneditable-input.span5 { + width: 460px; + } + input.span4, textarea.span4, .uneditable-input.span4 { + width: 360px; + } + input.span3, textarea.span3, .uneditable-input.span3 { + width: 260px; + } + input.span2, textarea.span2, .uneditable-input.span2 { + width: 160px; + } + input.span1, textarea.span1, .uneditable-input.span1 { + width: 60px; + } + .thumbnails { + margin-left: -30px; + } + .thumbnails > li { + margin-left: 30px; + } + .row-fluid .thumbnails { + margin-left: 0; + } +} +@media (max-width: 979px) { + body { + padding-top: 0; + } + .navbar-fixed-top, + .navbar-fixed-bottom { + position: static; + } + .navbar-fixed-top { + margin-bottom: 18px; + } + .navbar-fixed-bottom { + margin-top: 18px; + } + .navbar-fixed-top .navbar-inner, + .navbar-fixed-bottom .navbar-inner { + padding: 5px; + } + .navbar .container { + width: auto; + padding: 0; + } + .navbar .brand { + padding-left: 10px; + padding-right: 10px; + margin: 0 0 0 -5px; + } + .nav-collapse { + clear: both; + } + .nav-collapse .nav { + float: none; + margin: 0 0 9px; + } + .nav-collapse .nav > li { + float: none; + } + .nav-collapse .nav > li > a { + margin-bottom: 2px; + } + .nav-collapse .nav > .divider-vertical { + display: none; + } + .nav-collapse .nav .nav-header { + color: #999999; + text-shadow: none; + } + .nav-collapse .nav > li > a, + .nav-collapse .dropdown-menu a { + padding: 6px 15px; + font-weight: bold; + color: #999999; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + } + .nav-collapse .btn { + padding: 4px 10px 4px; + font-weight: normal; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + } + .nav-collapse .dropdown-menu li + li a { + margin-bottom: 2px; + } + .nav-collapse .nav > li > a:hover, + .nav-collapse .dropdown-menu a:hover { + background-color: #222222; + } + .nav-collapse.in .btn-group { + margin-top: 5px; + padding: 0; + } + .nav-collapse .dropdown-menu { + position: static; + top: auto; + left: auto; + float: none; + display: block; + max-width: none; + margin: 0 15px; + padding: 0; + background-color: transparent; + border: none; + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; + } + .nav-collapse .dropdown-menu:before, + .nav-collapse .dropdown-menu:after { + display: none; + } + .nav-collapse .dropdown-menu .divider { + display: none; + } + .nav-collapse .navbar-form, + .nav-collapse .navbar-search { + float: none; + padding: 9px 15px; + margin: 9px 0; + border-top: 1px solid #222222; + border-bottom: 1px solid #222222; + -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1); + -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1); + box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1); + } + .navbar .nav-collapse .nav.pull-right { + float: none; + margin-left: 0; + } + .nav-collapse, + .nav-collapse.collapse { + overflow: hidden; + height: 0; + } + .navbar .btn-navbar { + display: block; + } + .navbar-static .navbar-inner { + padding-left: 10px; + padding-right: 10px; + } +} +@media (min-width: 980px) { + .nav-collapse.collapse { + height: auto !important; + overflow: visible !important; + } +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/responsive.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/responsive.less new file mode 100644 index 0000000..734b198 --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/responsive.less @@ -0,0 +1,48 @@ +/*! + * Bootstrap Responsive v2.0.4 + * + * Copyright 2012 Twitter, Inc + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Designed and built with all the love in the world @twitter by @mdo and @fat. + */ + + +// Responsive.less +// For phone and tablet devices +// ------------------------------------------------------------- + + +// REPEAT VARIABLES & MIXINS +// ------------------------- +// Required since we compile the responsive stuff separately + +@import "variables.less"; // Modify this for custom colors, font-sizes, etc +@import "mixins.less"; + + +// RESPONSIVE CLASSES +// ------------------ + +@import "responsive-utilities.less"; + + +// MEDIA QUERIES +// ------------------ + +// Phones to portrait tablets and narrow desktops +@import "responsive-767px-max.less"; + +// Tablets to regular desktops +@import "responsive-768px-979px.less"; + +// Large desktops +@import "responsive-1200px-min.less"; + + +// RESPONSIVE NAVBAR +// ------------------ + +// From 979px and below, show a button to toggle navbar contents +@import "responsive-navbar.less"; diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/scaffolding.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/scaffolding.less new file mode 100644 index 0000000..57c74ed --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/scaffolding.less @@ -0,0 +1,29 @@ +// Scaffolding +// Basic and global styles for generating a grid system, structural layout, and page templates +// ------------------------------------------------------------------------------------------- + + +// Body reset +// ---------- + +body { + margin: 0; + font-family: @baseFontFamily; + font-size: @baseFontSize; + line-height: @baseLineHeight; + color: @textColor; + background-color: @bodyBackground; +} + + +// Links +// ----- + +a { + color: @linkColor; + text-decoration: none; +} +a:hover { + color: @linkColorHover; + text-decoration: underline; +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/sprites.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/sprites.less new file mode 100644 index 0000000..72a3a91 --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/sprites.less @@ -0,0 +1,191 @@ +// SPRITES +// Glyphs and icons for buttons, nav, and more +// ------------------------------------------- + + +// ICONS +// ----- + +// All icons receive the styles of the <i> tag with a base class +// of .i and are then given a unique class to add width, height, +// and background-position. Your resulting HTML will look like +// <i class="icon-inbox"></i>. + +// For the white version of the icons, just add the .icon-white class: +// <i class="icon-inbox icon-white"></i> + +[class^="icon-"], +[class*=" icon-"] { + display: inline-block; + width: 14px; + height: 14px; + .ie7-restore-right-whitespace(); + line-height: 14px; + vertical-align: text-top; + background-image: url("@{iconSpritePath}"); + background-position: 14px 14px; + background-repeat: no-repeat; + +} +.icon-white { + background-image: url("@{iconWhiteSpritePath}"); +} + +.icon-glass { background-position: 0 0; } +.icon-music { background-position: -24px 0; } +.icon-search { background-position: -48px 0; } +.icon-envelope { background-position: -72px 0; } +.icon-heart { background-position: -96px 0; } +.icon-star { background-position: -120px 0; } +.icon-star-empty { background-position: -144px 0; } +.icon-user { background-position: -168px 0; } +.icon-film { background-position: -192px 0; } +.icon-th-large { background-position: -216px 0; } +.icon-th { background-position: -240px 0; } +.icon-th-list { background-position: -264px 0; } +.icon-ok { background-position: -288px 0; } +.icon-remove { background-position: -312px 0; } +.icon-zoom-in { background-position: -336px 0; } +.icon-zoom-out { background-position: -360px 0; } +.icon-off { background-position: -384px 0; } +.icon-signal { background-position: -408px 0; } +.icon-cog { background-position: -432px 0; } +.icon-trash { background-position: -456px 0; } + +.icon-home { background-position: 0 -24px; } +.icon-file { background-position: -24px -24px; } +.icon-time { background-position: -48px -24px; } +.icon-road { background-position: -72px -24px; } +.icon-download-alt { background-position: -96px -24px; } +.icon-download { background-position: -120px -24px; } +.icon-upload { background-position: -144px -24px; } +.icon-inbox { background-position: -168px -24px; } +.icon-play-circle { background-position: -192px -24px; } +.icon-repeat { background-position: -216px -24px; } +.icon-refresh { background-position: -240px -24px; } +.icon-list-alt { background-position: -264px -24px; } +.icon-lock { background-position: -287px -24px; } // 1px off +.icon-flag { background-position: -312px -24px; } +.icon-headphones { background-position: -336px -24px; } +.icon-volume-off { background-position: -360px -24px; } +.icon-volume-down { background-position: -384px -24px; } +.icon-volume-up { background-position: -408px -24px; } +.icon-qrcode { background-position: -432px -24px; } +.icon-barcode { background-position: -456px -24px; } + +.icon-tag { background-position: 0 -48px; } +.icon-tags { background-position: -25px -48px; } // 1px off +.icon-book { background-position: -48px -48px; } +.icon-bookmark { background-position: -72px -48px; } +.icon-print { background-position: -96px -48px; } +.icon-camera { background-position: -120px -48px; } +.icon-font { background-position: -144px -48px; } +.icon-bold { background-position: -167px -48px; } // 1px off +.icon-italic { background-position: -192px -48px; } +.icon-text-height { background-position: -216px -48px; } +.icon-text-width { background-position: -240px -48px; } +.icon-align-left { background-position: -264px -48px; } +.icon-align-center { background-position: -288px -48px; } +.icon-align-right { background-position: -312px -48px; } +.icon-align-justify { background-position: -336px -48px; } +.icon-list { background-position: -360px -48px; } +.icon-indent-left { background-position: -384px -48px; } +.icon-indent-right { background-position: -408px -48px; } +.icon-facetime-video { background-position: -432px -48px; } +.icon-picture { background-position: -456px -48px; } + +.icon-pencil { background-position: 0 -72px; } +.icon-map-marker { background-position: -24px -72px; } +.icon-adjust { background-position: -48px -72px; } +.icon-tint { background-position: -72px -72px; } +.icon-edit { background-position: -96px -72px; } +.icon-share { background-position: -120px -72px; } +.icon-check { background-position: -144px -72px; } +.icon-move { background-position: -168px -72px; } +.icon-step-backward { background-position: -192px -72px; } +.icon-fast-backward { background-position: -216px -72px; } +.icon-backward { background-position: -240px -72px; } +.icon-play { background-position: -264px -72px; } +.icon-pause { background-position: -288px -72px; } +.icon-stop { background-position: -312px -72px; } +.icon-forward { background-position: -336px -72px; } +.icon-fast-forward { background-position: -360px -72px; } +.icon-step-forward { background-position: -384px -72px; } +.icon-eject { background-position: -408px -72px; } +.icon-chevron-left { background-position: -432px -72px; } +.icon-chevron-right { background-position: -456px -72px; } + +.icon-plus-sign { background-position: 0 -96px; } +.icon-minus-sign { background-position: -24px -96px; } +.icon-remove-sign { background-position: -48px -96px; } +.icon-ok-sign { background-position: -72px -96px; } +.icon-question-sign { background-position: -96px -96px; } +.icon-info-sign { background-position: -120px -96px; } +.icon-screenshot { background-position: -144px -96px; } +.icon-remove-circle { background-position: -168px -96px; } +.icon-ok-circle { background-position: -192px -96px; } +.icon-ban-circle { background-position: -216px -96px; } +.icon-arrow-left { background-position: -240px -96px; } +.icon-arrow-right { background-position: -264px -96px; } +.icon-arrow-up { background-position: -289px -96px; } // 1px off +.icon-arrow-down { background-position: -312px -96px; } +.icon-share-alt { background-position: -336px -96px; } +.icon-resize-full { background-position: -360px -96px; } +.icon-resize-small { background-position: -384px -96px; } +.icon-plus { background-position: -408px -96px; } +.icon-minus { background-position: -433px -96px; } +.icon-asterisk { background-position: -456px -96px; } + +.icon-exclamation-sign { background-position: 0 -120px; } +.icon-gift { background-position: -24px -120px; } +.icon-leaf { background-position: -48px -120px; } +.icon-fire { background-position: -72px -120px; } +.icon-eye-open { background-position: -96px -120px; } +.icon-eye-close { background-position: -120px -120px; } +.icon-warning-sign { background-position: -144px -120px; } +.icon-plane { background-position: -168px -120px; } +.icon-calendar { background-position: -192px -120px; } +.icon-random { background-position: -216px -120px; } +.icon-comment { background-position: -240px -120px; } +.icon-magnet { background-position: -264px -120px; } +.icon-chevron-up { background-position: -288px -120px; } +.icon-chevron-down { background-position: -313px -119px; } // 1px, 1px off +.icon-retweet { background-position: -336px -120px; } +.icon-shopping-cart { background-position: -360px -120px; } +.icon-folder-close { background-position: -384px -120px; } +.icon-folder-open { background-position: -408px -120px; } +.icon-resize-vertical { background-position: -432px -119px; } // 1px, 1px off +.icon-resize-horizontal { background-position: -456px -118px; } // 1px, 2px off + +.icon-hdd { background-position: 0 -144px; } +.icon-bullhorn { background-position: -24px -144px; } +.icon-bell { background-position: -48px -144px; } +.icon-certificate { background-position: -72px -144px; } +.icon-thumbs-up { background-position: -96px -144px; } +.icon-thumbs-down { background-position: -120px -144px; } +.icon-hand-right { background-position: -144px -144px; } +.icon-hand-left { background-position: -168px -144px; } +.icon-hand-up { background-position: -192px -144px; } +.icon-hand-down { background-position: -216px -144px; } +.icon-circle-arrow-right { background-position: -240px -144px; } +.icon-circle-arrow-left { background-position: -264px -144px; } +.icon-circle-arrow-up { background-position: -288px -144px; } +.icon-circle-arrow-down { background-position: -312px -144px; } +.icon-globe { background-position: -336px -144px; } +.icon-wrench { background-position: -360px -144px; } +.icon-tasks { background-position: -384px -144px; } +.icon-filter { background-position: -408px -144px; } +.icon-briefcase { background-position: -432px -144px; } +.icon-fullscreen { background-position: -456px -144px; } + + + + + + + + + + + + diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/tables.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/tables.less new file mode 100644 index 0000000..b4f6027 --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/tables.less @@ -0,0 +1,176 @@ +// +// Tables.less +// Tables for, you guessed it, tabular data +// ---------------------------------------- + + +// BASE TABLES +// ----------------- + +table { + max-width: 100%; + background-color: @tableBackground; + border-collapse: collapse; + border-spacing: 0; +} + +// BASELINE STYLES +// --------------- + +.table { + width: 100%; + margin-bottom: @baseLineHeight; + // Cells + th, + td { + padding: 8px; + line-height: @baseLineHeight; + text-align: left; + vertical-align: top; + border-top: 1px solid @tableBorder; + } + th { + font-weight: bold; + } + // Bottom align for column headings + thead th { + vertical-align: bottom; + } + // Remove top border from thead by default + caption + thead tr:first-child th, + caption + thead tr:first-child td, + colgroup + thead tr:first-child th, + colgroup + thead tr:first-child td, + thead:first-child tr:first-child th, + thead:first-child tr:first-child td { + border-top: 0; + } + // Account for multiple tbody instances + tbody + tbody { + border-top: 2px solid @tableBorder; + } +} + + + +// CONDENSED TABLE W/ HALF PADDING +// ------------------------------- + +.table-condensed { + th, + td { + padding: 4px 5px; + } +} + + +// BORDERED VERSION +// ---------------- + +.table-bordered { + border: 1px solid @tableBorder; + border-collapse: separate; // Done so we can round those corners! + *border-collapse: collapsed; // IE7 can't round corners anyway + border-left: 0; + .border-radius(4px); + th, + td { + border-left: 1px solid @tableBorder; + } + // Prevent a double border + caption + thead tr:first-child th, + caption + tbody tr:first-child th, + caption + tbody tr:first-child td, + colgroup + thead tr:first-child th, + colgroup + tbody tr:first-child th, + colgroup + tbody tr:first-child td, + thead:first-child tr:first-child th, + tbody:first-child tr:first-child th, + tbody:first-child tr:first-child td { + border-top: 0; + } + // For first th or td in the first row in the first thead or tbody + thead:first-child tr:first-child th:first-child, + tbody:first-child tr:first-child td:first-child { + -webkit-border-top-left-radius: 4px; + border-top-left-radius: 4px; + -moz-border-radius-topleft: 4px; + } + thead:first-child tr:first-child th:last-child, + tbody:first-child tr:first-child td:last-child { + -webkit-border-top-right-radius: 4px; + border-top-right-radius: 4px; + -moz-border-radius-topright: 4px; + } + // For first th or td in the first row in the first thead or tbody + thead:last-child tr:last-child th:first-child, + tbody:last-child tr:last-child td:first-child { + .border-radius(0 0 0 4px); + -webkit-border-bottom-left-radius: 4px; + border-bottom-left-radius: 4px; + -moz-border-radius-bottomleft: 4px; + } + thead:last-child tr:last-child th:last-child, + tbody:last-child tr:last-child td:last-child { + -webkit-border-bottom-right-radius: 4px; + border-bottom-right-radius: 4px; + -moz-border-radius-bottomright: 4px; + } +} + + +// ZEBRA-STRIPING +// -------------- + +// Default zebra-stripe styles (alternating gray and transparent backgrounds) +.table-striped { + tbody { + tr:nth-child(odd) td, + tr:nth-child(odd) th { + background-color: @tableBackgroundAccent; + } + } +} + + +// HOVER EFFECT +// ------------ +// Placed here since it has to come after the potential zebra striping +.table { + tbody tr:hover td, + tbody tr:hover th { + background-color: @tableBackgroundHover; + } +} + + +// TABLE CELL SIZING +// ----------------- + +// Change the columns +table { + .span1 { .tableColumns(1); } + .span2 { .tableColumns(2); } + .span3 { .tableColumns(3); } + .span4 { .tableColumns(4); } + .span5 { .tableColumns(5); } + .span6 { .tableColumns(6); } + .span7 { .tableColumns(7); } + .span8 { .tableColumns(8); } + .span9 { .tableColumns(9); } + .span10 { .tableColumns(10); } + .span11 { .tableColumns(11); } + .span12 { .tableColumns(12); } + .span13 { .tableColumns(13); } + .span14 { .tableColumns(14); } + .span15 { .tableColumns(15); } + .span16 { .tableColumns(16); } + .span17 { .tableColumns(17); } + .span18 { .tableColumns(18); } + .span19 { .tableColumns(19); } + .span20 { .tableColumns(20); } + .span21 { .tableColumns(21); } + .span22 { .tableColumns(22); } + .span23 { .tableColumns(23); } + .span24 { .tableColumns(24); } +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/thumbnails.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/thumbnails.less new file mode 100644 index 0000000..aa69f8e --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/thumbnails.less @@ -0,0 +1,47 @@ +// THUMBNAILS +// ---------- +// Note: `.thumbnails` and `.thumbnails > li` are overriden in responsive files + +// Make wrapper ul behave like the grid +.thumbnails { + margin-left: -@gridGutterWidth; + list-style: none; + .clearfix(); +} +// Fluid rows have no left margin +.row-fluid .thumbnails { + margin-left: 0; +} + +// Float li to make thumbnails appear in a row +.thumbnails > li { + float: left; // Explicity set the float since we don't require .span* classes + margin-bottom: @baseLineHeight; + margin-left: @gridGutterWidth; +} + +// The actual thumbnail (can be `a` or `div`) +.thumbnail { + display: block; + padding: 4px; + line-height: 1; + border: 1px solid #ddd; + .border-radius(4px); + .box-shadow(0 1px 1px rgba(0,0,0,.075)); +} +// Add a hover state for linked versions only +a.thumbnail:hover { + border-color: @linkColor; + .box-shadow(0 1px 4px rgba(0,105,214,.25)); +} + +// Images and captions +.thumbnail > img { + display: block; + max-width: 100%; + margin-left: auto; + margin-right: auto; +} +.thumbnail .caption { + padding: 9px; +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/tooltip.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/tooltip.less new file mode 100644 index 0000000..5111a19 --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/tooltip.less @@ -0,0 +1,35 @@ +// TOOLTIP +// ------= + +.tooltip { + position: absolute; + z-index: @zindexTooltip; + display: block; + visibility: visible; + padding: 5px; + font-size: 11px; + .opacity(0); + &.in { .opacity(80); } + &.top { margin-top: -2px; } + &.right { margin-left: 2px; } + &.bottom { margin-top: 2px; } + &.left { margin-left: -2px; } + &.top .tooltip-arrow { #popoverArrow > .top(); } + &.left .tooltip-arrow { #popoverArrow > .left(); } + &.bottom .tooltip-arrow { #popoverArrow > .bottom(); } + &.right .tooltip-arrow { #popoverArrow > .right(); } +} +.tooltip-inner { + max-width: 200px; + padding: 3px 8px; + color: @white; + text-align: center; + text-decoration: none; + background-color: @black; + .border-radius(4px); +} +.tooltip-arrow { + position: absolute; + width: 0; + height: 0; +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/type.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/type.less new file mode 100644 index 0000000..bdf8e60 --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/type.less @@ -0,0 +1,232 @@ +// Typography.less +// Headings, body text, lists, code, and more for a versatile and durable typography system +// ---------------------------------------------------------------------------------------- + + +// BODY TEXT +// --------- + +p { + margin: 0 0 @baseLineHeight / 2; + small { + font-size: @baseFontSize - 2; + color: @grayLight; + } +} +.lead { + margin-bottom: @baseLineHeight; + font-size: 20px; + font-weight: 200; + line-height: @baseLineHeight * 1.5; +} + +// HEADINGS +// -------- + +h1, h2, h3, h4, h5, h6 { + margin: 0; + font-family: @headingsFontFamily; + font-weight: @headingsFontWeight; + color: @headingsColor; + text-rendering: optimizelegibility; // Fix the character spacing for headings + small { + font-weight: normal; + color: @grayLight; + } +} +h1 { + font-size: 30px; + line-height: @baseLineHeight * 2; + small { + font-size: 18px; + } +} +h2 { + font-size: 24px; + line-height: @baseLineHeight * 2; + small { + font-size: 18px; + } +} +h3 { + font-size: 18px; + line-height: @baseLineHeight * 1.5; + small { + font-size: 14px; + } +} +h4, h5, h6 { + line-height: @baseLineHeight; +} +h4 { + font-size: 14px; + small { + font-size: 12px; + } +} +h5 { + font-size: 12px; +} +h6 { + font-size: 11px; + color: @grayLight; + text-transform: uppercase; +} + +// Page header +.page-header { + padding-bottom: @baseLineHeight - 1; + margin: @baseLineHeight 0; + border-bottom: 1px solid @grayLighter; +} +.page-header h1 { + line-height: 1; +} + + + +// LISTS +// ----- + +// Unordered and Ordered lists +ul, ol { + padding: 0; + margin: 0 0 @baseLineHeight / 2 25px; +} +ul ul, +ul ol, +ol ol, +ol ul { + margin-bottom: 0; +} +ul { + list-style: disc; +} +ol { + list-style: decimal; +} +li { + line-height: @baseLineHeight; +} +ul.unstyled, +ol.unstyled { + margin-left: 0; + list-style: none; +} + +// Description Lists +dl { + margin-bottom: @baseLineHeight; +} +dt, +dd { + line-height: @baseLineHeight; +} +dt { + font-weight: bold; + line-height: @baseLineHeight - 1; // fix jank Helvetica Neue font bug +} +dd { + margin-left: @baseLineHeight / 2; +} +// Horizontal layout (like forms) +.dl-horizontal { + dt { + float: left; + width: 120px; + clear: left; + text-align: right; + .text-overflow(); + } + dd { + margin-left: 130px; + } +} + +// MISC +// ---- + +// Horizontal rules +hr { + margin: @baseLineHeight 0; + border: 0; + border-top: 1px solid @hrBorder; + border-bottom: 1px solid @white; +} + +// Emphasis +strong { + font-weight: bold; +} +em { + font-style: italic; +} +.muted { + color: @grayLight; +} + +// Abbreviations and acronyms +abbr[title] { + cursor: help; + border-bottom: 1px dotted @grayLight; +} +abbr.initialism { + font-size: 90%; + text-transform: uppercase; +} + +// Blockquotes +blockquote { + padding: 0 0 0 15px; + margin: 0 0 @baseLineHeight; + border-left: 5px solid @grayLighter; + p { + margin-bottom: 0; + #font > .shorthand(16px,300,@baseLineHeight * 1.25); + } + small { + display: block; + line-height: @baseLineHeight; + color: @grayLight; + &:before { + content: '\2014 \00A0'; + } + } + + // Float right with text-align: right + &.pull-right { + float: right; + padding-right: 15px; + padding-left: 0; + border-right: 5px solid @grayLighter; + border-left: 0; + p, + small { + text-align: right; + } + } +} + +// Quotes +q:before, +q:after, +blockquote:before, +blockquote:after { + content: ""; +} + +// Addresses +address { + display: block; + margin-bottom: @baseLineHeight; + font-style: normal; + line-height: @baseLineHeight; +} + +// Misc +small { + font-size: 100%; +} +cite { + font-style: normal; +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/utilities.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/utilities.less new file mode 100644 index 0000000..d60d220 --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/utilities.less @@ -0,0 +1,23 @@ +// UTILITY CLASSES +// --------------- + +// Quick floats +.pull-right { + float: right; +} +.pull-left { + float: left; +} + +// Toggling content +.hide { + display: none; +} +.show { + display: block; +} + +// Visibility +.invisible { + visibility: hidden; +} diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/variables.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/variables.less new file mode 100644 index 0000000..c69c006 --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/variables.less @@ -0,0 +1,206 @@ +// Variables.less +// Variables to customize the look and feel of Bootstrap +// ----------------------------------------------------- + + + +// GLOBAL VALUES +// -------------------------------------------------- + + +// Grays +// ------------------------- +@black: #000; +@grayDarker: #222; +@grayDark: #333; +@gray: #555; +@grayLight: #999; +@grayLighter: #eee; +@white: #fff; + + +// Accent colors +// ------------------------- +@blue: #049cdb; +@blueDark: #0064cd; +@green: #46a546; +@red: #9d261d; +@yellow: #ffc40d; +@orange: #f89406; +@pink: #c3325f; +@purple: #7a43b6; + + +// Scaffolding +// ------------------------- +@bodyBackground: @white; +@textColor: @grayDark; + + +// Links +// ------------------------- +@linkColor: #08c; +@linkColorHover: darken(@linkColor, 15%); + + +// Typography +// ------------------------- +@sansFontFamily: "Helvetica Neue", Helvetica, Arial, sans-serif; +@serifFontFamily: Georgia, "Times New Roman", Times, serif; +@monoFontFamily: Menlo, Monaco, Consolas, "Courier New", monospace; + +@baseFontSize: 13px; +@baseFontFamily: @sansFontFamily; +@baseLineHeight: 18px; +@altFontFamily: @serifFontFamily; + +@headingsFontFamily: inherit; // empty to use BS default, @baseFontFamily +@headingsFontWeight: bold; // instead of browser default, bold +@headingsColor: inherit; // empty to use BS default, @textColor + + +// Tables +// ------------------------- +@tableBackground: transparent; // overall background-color +@tableBackgroundAccent: #f9f9f9; // for striping +@tableBackgroundHover: #f5f5f5; // for hover +@tableBorder: #ddd; // table and cell border + + +// Buttons +// ------------------------- +@btnBackground: @white; +@btnBackgroundHighlight: darken(@white, 10%); +@btnBorder: #ccc; + +@btnPrimaryBackground: @linkColor; +@btnPrimaryBackgroundHighlight: spin(@btnPrimaryBackground, 15%); + +@btnInfoBackground: #5bc0de; +@btnInfoBackgroundHighlight: #2f96b4; + +@btnSuccessBackground: #62c462; +@btnSuccessBackgroundHighlight: #51a351; + +@btnWarningBackground: lighten(@orange, 15%); +@btnWarningBackgroundHighlight: @orange; + +@btnDangerBackground: #ee5f5b; +@btnDangerBackgroundHighlight: #bd362f; + +@btnInverseBackground: @gray; +@btnInverseBackgroundHighlight: @grayDarker; + + +// Forms +// ------------------------- +@inputBackground: @white; +@inputBorder: #ccc; +@inputBorderRadius: 3px; +@inputDisabledBackground: @grayLighter; +@formActionsBackground: #f5f5f5; + +// Dropdowns +// ------------------------- +@dropdownBackground: @white; +@dropdownBorder: rgba(0,0,0,.2); +@dropdownLinkColor: @grayDark; +@dropdownLinkColorHover: @white; +@dropdownLinkBackgroundHover: @linkColor; +@dropdownDividerTop: #e5e5e5; +@dropdownDividerBottom: @white; + + + +// COMPONENT VARIABLES +// -------------------------------------------------- + +// Z-index master list +// ------------------------- +// Used for a bird's eye view of components dependent on the z-axis +// Try to avoid customizing these :) +@zindexDropdown: 1000; +@zindexPopover: 1010; +@zindexTooltip: 1020; +@zindexFixedNavbar: 1030; +@zindexModalBackdrop: 1040; +@zindexModal: 1050; + + +// Sprite icons path +// ------------------------- +@iconSpritePath: "../../images/glyphicons-halflings.png"; +@iconWhiteSpritePath: "../../images/glyphicons-halflings-white.png"; + + +// Input placeholder text color +// ------------------------- +@placeholderText: @grayLight; + + +// Hr border color +// ------------------------- +@hrBorder: @grayLighter; + + +// Navbar +// ------------------------- +@navbarHeight: 40px; +@navbarBackground: @grayDarker; +@navbarBackgroundHighlight: @grayDark; + +@navbarText: @grayLight; +@navbarLinkColor: @grayLight; +@navbarLinkColorHover: @white; +@navbarLinkColorActive: @navbarLinkColorHover; +@navbarLinkBackgroundHover: transparent; +@navbarLinkBackgroundActive: @navbarBackground; + +@navbarSearchBackground: lighten(@navbarBackground, 25%); +@navbarSearchBackgroundFocus: @white; +@navbarSearchBorder: darken(@navbarSearchBackground, 30%); +@navbarSearchPlaceholderColor: #ccc; +@navbarBrandColor: @navbarLinkColor; + + +// Hero unit +// ------------------------- +@heroUnitBackground: @grayLighter; +@heroUnitHeadingColor: inherit; +@heroUnitLeadColor: inherit; + + +// Form states and alerts +// ------------------------- +@warningText: #c09853; +@warningBackground: #fcf8e3; +@warningBorder: darken(spin(@warningBackground, -10), 3%); + +@errorText: #b94a48; +@errorBackground: #f2dede; +@errorBorder: darken(spin(@errorBackground, -10), 3%); + +@successText: #468847; +@successBackground: #dff0d8; +@successBorder: darken(spin(@successBackground, -10), 5%); + +@infoText: #3a87ad; +@infoBackground: #d9edf7; +@infoBorder: darken(spin(@infoBackground, -10), 7%); + + + +// GRID +// -------------------------------------------------- + +// Default 940px grid +// ------------------------- +@gridColumns: 12; +@gridColumnWidth: 60px; +@gridGutterWidth: 20px; +@gridRowWidth: (@gridColumns * @gridColumnWidth) + (@gridGutterWidth * (@gridColumns - 1)); + +// Fluid grid +// ------------------------- +@fluidGridColumnWidth: 6.382978723%; +@fluidGridGutterWidth: 2.127659574%; diff --git a/src/main/webapp/stylesheets/bootstrap-2.0.4/wells.less b/src/main/webapp/stylesheets/bootstrap-2.0.4/wells.less new file mode 100644 index 0000000..9300061 --- /dev/null +++ b/src/main/webapp/stylesheets/bootstrap-2.0.4/wells.less @@ -0,0 +1,27 @@ +// WELLS +// ----- + +.well { + min-height: 20px; + padding: 19px; + margin-bottom: 20px; + background-color: #f5f5f5; + border: 1px solid #eee; + border: 1px solid rgba(0,0,0,.05); + .border-radius(4px); + .box-shadow(inset 0 1px 1px rgba(0,0,0,.05)); + blockquote { + border-color: #ddd; + border-color: rgba(0,0,0,.15); + } +} + +// Sizes +.well-large { + padding: 24px; + .border-radius(6px); +} +.well-small { + padding: 9px; + .border-radius(3px); +} diff --git a/src/main/webapp/stylesheets/codemirror.css b/src/main/webapp/stylesheets/codemirror.css new file mode 100644 index 0000000..9c9c29a --- /dev/null +++ b/src/main/webapp/stylesheets/codemirror.css @@ -0,0 +1,114 @@ +.CodeMirror { + line-height: 1em; + font-family: monospace; +} + +.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; +} + +.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; +} +.CodeMirror-lines { + padding: .4em; + white-space: pre; +} + +.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; +} + +.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; +} +.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: #a0a;} +.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;} + +div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;} +div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;} diff --git a/src/main/webapp/stylesheets/fiddle.css b/src/main/webapp/stylesheets/fiddle.css new file mode 100644 index 0000000..75b4673 --- /dev/null +++ b/src/main/webapp/stylesheets/fiddle.css @@ -0,0 +1,482 @@ +/*//*/ +@media (max-width: 440px) { + #exit_fullscreen span, + .helpTip { + display: none !important; + } +} +@media (min-width: 480px) and (max-width: 979px) { + #db_type_label_collapsed { + display: inline !important; + } +} +/* + * These selectively disable the less-important nav bar elements, as the screen width shrinks + * (but before we get to the collapsed nav bar view) + */ +@media (min-width: 820px) and (max-width: 1024px) { + .nav-collapse .pull-right { + display: none; + } +} +@media (min-width: 820px) and (max-width: 1100px) { + .nav-collapse .pull-right .optional { + display: none; + } +} +@media (max-width: 767px) { + div.sql { + width: 100% !important; + } + .helpTip { + width: 180px !important; + height: 30% !important; + } +} +@media (min-width: 768px) and (max-width: 979px) { + .helpTip { + width: 100px !important; + height: 50% !important; + } +} +@media (max-width: 979px) { + body { + padding-top: 0px !important; + } + textarea.fullscreen { + top: 50px !important; + } + #paypal_donate { + padding-left: 15px; + } +} +/* Offset to make room for the nav bar */ +body { + padding-top: 60px; +} +/* elements used as part of fullscreen edit mode */ +#db_type_label_collapsed, +#exit_fullscreen { + display: none; +} +#db_type_label_collapsed li { + display: inline-block; +} +textarea.fullscreen { + z-index: 10000; + height: 100%; + width: 100%; + position: fixed; + top: 40px; + left: 0; +} +/* Fine tuning various fiddle element styles */ +.schema { + position: relative; +} +.helpTip { + position: absolute; + display: none; + width: 180px; + height: 60%; + min-height: 50px; + overflow-y: auto; + right: 0px; + z-index: 1001; + margin: 10px 20px; +} +#browser, +.browser_actions { + padding-left: 15px; + display: none; + width: 100%; +} +#browser { + overflow: auto; + border: solid thin lightgray; +} +#sql, +#schema_ddl { + width: 98%; + font-family: monospace; + white-space: nowrap; + overflow: auto; + font-size: 10pt; + min-height: 100px; +} +.tables, +.columns { + list-style-type: none; +} +.tables .columns { + display: none; +} +.popover .tables .columns { + display: block; +} +.resultSetWrapper, +.schemaPreviewWrapper, +.queryLog-hidden { + display: none; +} +.resultSetPreview { + list-style-type: none; + margin: 0; +} +.resultSetPreview li { + white-space: nowrap; +} +.resultSetPreview pre { + margin-bottom: 2px; + overflow-x: hidden; + max-height: 75px; + overflow-y: hidden; + background-color: white; +} +.resultSetPreview > pre, +.schemaPreview > pre { + margin-bottom: 2px; + overflow-x: hidden; + max-height: 200px; + overflow-y: hidden; + background-color: white; +} +pre.results, +.resultSetPreview li pre { + font-family: monospace; + font-size: 10pt; +} +.database-error { + white-space: pre-wrap; +} +#runQueryOptions { + min-width: 120px; +} +#content .panel form textarea { + display: block; + /* height: 97%; + width: 98%;*/ + + margin: 0; + resize: none; +} +#content .panel.schema { + margin: 0; +} +#output { + margin: 0; + height: 50%; + clear: both; + padding-top: 5px; +} +#content #output form label { + top: 10px; +} +#schema-output { + margin: 0; + height: 50%; + padding-bottom: 5px; +} +#content form { + margin: 0; +} +.tab-content .tab-pane { + height: 100%; +} +.database-messages i { + margin-right: 5px; + opacity: .5; +} +#fiddleFormDDL { + position: relative; +} +#content .panel form label { + z-index: 250; + /* bottom: 5px; + top: auto;*/ + +} +#fiddleFormDDL label a i { + margin: 1px; +} +/* Execution Plans */ +.executionPlan { + width: 90%; + margin-left: 10%; + display: none; +} +.executionPlanLink, +.setLink { + margin-left: 20px; +} +.oracle_xplan { + margin: 0px; + overflow: hidden; + width: 800px; + height: 600px; + border: solid thin black; + display: inline-block; +} +/* Used primarily to emphasize a particular result set */ +.highlight { + border: solid thin blue; + margin: 5px; +} +/* Buttons below the editable panels */.action_buttons { + margin: 5px 0; + padding: 0 10px; +} +.action_buttons > a, +.action_buttons > div { + margin-bottom: 3px; + vertical-align: top; + display: inline-block; +} +.action_buttons .dropdown-menu { + text-align: right; +} +/* CodeMirror Customizations */ +#content .CodeMirror { + border: 1px solid #cccccc; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} +.CodeMirror-scroll { + height: 200px; + overflow-y: scroll; + overflow-x: auto; +} +.CodeMirror-fullscreen { + display: block; + position: fixed; + top: 42px; + left: 0; + width: 100%; + height: 100%; + z-index: 9999; + margin: 0; + padding: 0; + border: 0px solid #BBBBBB; + opacity: 1; + background-color: white; +} +/* Hosting styles */ +#hosting { + display: block; + margin: 10px auto 0 auto; + text-align: center; +} +#hosting h4 { + text-align: center; +} +#hostingPartners { + padding: 0px; + display: inline-block; + text-align: left; + list-style-type: none; +} +#hostingPartners li { + margin: 20px 0; + font-family: sans-serif; + font-size: 8pt; + height: 50px; + display: inline; +} +#hostingPartners a { + display: inline-block; + float: left; +} +#hostingPartners img { + height: 90px; + margin: 0 auto; + text-align: center; + display: block; + border: none; +} +#hostingPartners span { + float: left; + display: block; + width: 150px; +} +.modal { + display: none; +} +#myFiddlesModal { + width: 800px; + margin: -250px 0 0 -420px; +} +#myFiddlesModal .modal-body { + overflow-y: auto; +} +#myFiddlesTabs { + margin-bottom: 0; +} +/* DDL Builder UI Styles */ +#raw, +#parseResults { + width: 90%; +} +#parseResults { + height: 60px; + overflow: auto; +} +/* Customizations for third-party UI elements */ +#openid_identifier { + width: 250px; + margin: 0px; + padding: 2px; + padding-left: 20px; + vertical-align: middle; + background-image: url('http://www.idselector.com/images/openid.ico'); + background-repeat: no-repeat; + background-position: 3px 2px; +} +#gravatar { + height: 20px; + width: 20px; + margin: 0 10px 0 5px; +} +/* Bootstrap overrides */ +.navbar .nav.pull-right { + margin-left: 2px; +} +.nav-collapse > .nav { + margin-right: 2px; +} +.navbar .brand { + padding-left: 10px; +} +.container-fluid .pull-right { + float: right !important; +} +.nav-collapse.in .pull-right { + float: left !important; +} +.navbar .btn-navbar { + background-color: #d6d6d6; + background-image: -moz-linear-gradient(top, #ffffff, #999999); + background-image: -ms-linear-gradient(top, #ffffff, #999999); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#999999)); + background-image: -webkit-linear-gradient(top, #ffffff, #999999); + background-image: -o-linear-gradient(top, #ffffff, #999999); + background-image: linear-gradient(top, #ffffff, #999999); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#999999', GradientType=0); + border-color: #999999 #999999 #737373; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075); + -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075); +} +.btn-navbar:hover, +.btn-navbar:active, +.btn-navbar.active, +.btn-navbar.disabled, +.btn-navbar[disabled] { + background-color: #999999; +} +.btn-navbar:active, +.btn-navbar.active { + background-color: #808080 \9; +} +.navbar .brand { + white-space: nowrap; +} +.navbar { + color: black; +} +.navbar-inner { + background-color: #d6d6d6; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#999999', GradientType=0); + background-image: -moz-linear-gradient(top, #ffffff, #999999); + background-image: -ms-linear-gradient(top, #ffffff, #999999); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#999999)); + background-image: -webkit-linear-gradient(top, #ffffff, #999999); + background-image: -o-linear-gradient(top, #ffffff, #999999); + background-image: linear-gradient(top, #ffffff, #999999); +} +.navbar .nav > li > a { + color: #333333; + text-shadow: none; +} +.navbar .divider-vertical { + background-color: #999; + border-right: 1px solid white; +} +.navbar .nav .active > a, +.navbar .nav .active > a:hover { + color: #999999; + text-decoration: none; + background-color: #999999; + background-color: rgba(0, 0, 0, 0.5); +} +.navbar .nav .active > a { + color: #eeeeee; +} +.navbar .nav .active > a:hover { + color: #eeeeee; +} +.navbar .nav > li > a i { + margin-right: 5px; +} +.navbar .brand { + color: #000000; +} +.dropdown-menu a i { + margin-right: 5px; +} +.dropdown-toggle b.caret { + color: #999999; + opacity: .5; +} +.dropdown-menu.nav { + z-index: 1050 !important; +} +.dropdown-menu.nav li > a:hover, +.dropdown-menu.nav .active > a, +.dropdown-menu.nav .active > a:hover { + color: #ffffff; + text-decoration: none; + background-color: #0088cc; +} +.form-horizontal .control-group { + margin-bottom: 6px; +} +.modal form { + margin: 0; +} +.popover-inner { + min-width: 280px; + width: auto; + overflow-x: visible; + overflow-y: hidden; + max-height: 400px; +} +.popover-inner .alert { + max-width: 400px; + overflow-x: hidden; +} +#sidebar .well { + padding: 8px 0; +} +/* +.navbar, #content { + min-width: 920px !important; +} +*/ +#content { + height: 100%; +} +#content .panel { + margin: 0; +} +#content .panel { + min-height: 125px; + height: 100%; + position: relative; +} +#content .panel form { + height: 100%; +} diff --git a/src/main/webapp/stylesheets/fiddle.less b/src/main/webapp/stylesheets/fiddle.less new file mode 100644 index 0000000..4dc326b --- /dev/null +++ b/src/main/webapp/stylesheets/fiddle.less @@ -0,0 +1,339 @@ +/*//*/ +@import "fiddle_responsive.less"; + +/* Offset to make room for the nav bar */ +body { + padding-top: 60px; +} + + +/* elements used as part of fullscreen edit mode */ +#db_type_label_collapsed, #exit_fullscreen { + display: none; +} +#db_type_label_collapsed li { + display: inline-block; +} +textarea.fullscreen { + z-index: 10000; + height: 100%; + width: 100%; + position: fixed; + top: 40px; + left: 0; +} + + + +/* Fine tuning various fiddle element styles */ + +.schema { + position: relative; +} +.helpTip { + position: absolute; + display: none; + width: 180px; + height: 60%; + min-height: 50px; + overflow-y: auto; + right: 0px; + z-index: 1001; + margin: 10px 20px; +} +#browser, .browser_actions { + padding-left: 15px; + display: none; + width: 100%; +} +#browser { + overflow: auto; + border: solid thin lightgray; +} + +#sql, #schema_ddl { + width: 98%; + font-family: monospace; + white-space: nowrap; + overflow: auto; + font-size: 10pt; + min-height: 100px; +} + +.tables, .columns { + list-style-type: none; +} + +.tables .columns { + display: none; +} +.popover .tables .columns { + display: block; +} + +.resultSetWrapper, .schemaPreviewWrapper, .queryLog-hidden { + display: none; +} + +.resultSetPreview { + list-style-type: none; + margin: 0; +} + +.resultSetPreview li { + white-space: nowrap; +} + +.resultSetPreview pre { + margin-bottom: 2px; + overflow-x: hidden; + max-height: 75px; + overflow-y: hidden; + background-color: white; +} +.resultSetPreview>pre, .schemaPreview>pre { + margin-bottom: 2px; + overflow-x: hidden; + max-height: 200px; + overflow-y: hidden; + background-color: white; +} + + +pre.results, .resultSetPreview li pre { + font-family:monospace; + font-size: 10pt; +} + + +.database-error { + white-space: pre-wrap; +} + + +#runQueryOptions { + min-width: 120px; +} + +#content .panel form textarea { + display: block; + /* height: 97%; + width: 98%;*/ + + margin: 0; + resize: none; +} +#content .panel.schema { + margin: 0; +} +#output { + margin: 0; + height: 50%; + clear:both; + padding-top: 5px; +} +#content #output form label { + top: 10px; +} + +#schema-output { + margin: 0; + height: 50%; + padding-bottom: 5px; + +} +#content form { + margin: 0; +} +.tab-content .tab-pane { + height: 100%; +} + + +.database-messages i { + margin-right: 5px; + opacity: .5; +} +#fiddleFormDDL { + position: relative; +} +#content .panel form label { + z-index: 250; + /* bottom: 5px; + top: auto;*/ + +} +#fiddleFormDDL label a i { + margin: 1px; +} + +/* Execution Plans */ + +.executionPlan { + width: 90%; + margin-left: 10%; + display: none; +} + +.executionPlanLink, .setLink { + margin-left: 20px; +} + +.oracle_xplan { + margin: 0px; + overflow:hidden; + width: 800px; + height: 600px; + border: solid thin black; + display: inline-block; +} + + + + +/* Used primarily to emphasize a particular result set */ +.highlight { + border: solid thin blue; + margin: 5px; +} + + +/* Buttons below the editable panels */ +.action_buttons { + margin: 5px 0; + padding: 0 10px; +} +.action_buttons>a, .action_buttons>div { + margin-bottom: 3px; + vertical-align: top; + display: inline-block; +} +.action_buttons .dropdown-menu { + text-align: right; +} + + +/* CodeMirror Customizations */ + +#content .CodeMirror { + border: 1px solid #cccccc; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} + +.CodeMirror-scroll { + height: 200px; + + overflow-y: scroll; + overflow-x: auto; +} + + +.CodeMirror-fullscreen { + display: block; + position: fixed; + top: 42px; + left: 0; + width: 100%; + height: 100%; + z-index: 9999; + margin: 0; + padding: 0; + border: 0px solid #BBBBBB; + opacity: 1; + background-color: white; +} + + + +/* Hosting styles */ +#hosting { + display: block; + margin: 10px auto 0 auto; + text-align: center; +} +#hosting h4 { + text-align: center; +} +#hostingPartners { + padding: 0px; + display: inline-block; + text-align: left; + list-style-type: none; +} + +#hostingPartners li { + margin: 20px 0; + font-family: sans-serif; + font-size: 8pt; + height: 50px; + display: inline; +} + +#hostingPartners a { + display: inline-block; + float: left; +} +#hostingPartners img { + height: 90px; + margin: 0 auto; + text-align: center; + display: block; + border: none; +} + +#hostingPartners span { + float: left; + display: block; + width: 150px; +} + +.modal { + display: none; +} + +#myFiddlesModal { + width: 800px; + margin: -250px 0 0 -420px; +} + +#myFiddlesModal .modal-body { + overflow-y: auto; +} +#myFiddlesTabs { + margin-bottom: 0; +} + +/* DDL Builder UI Styles */ +#raw, #parseResults { + width: 90%; +} + +#parseResults { + height: 60px; + overflow: auto; +} + +/* Customizations for third-party UI elements */ + +#openid_identifier { + width: 250px; + margin: 0px; + padding: 2px; + padding-left: 20px; + vertical-align: middle; + background-image: url('http://www.idselector.com/images/openid.ico'); + background-repeat: no-repeat; + background-position: 3px 2px; +} + +#gravatar { + height: 20px; + width: 20px; + margin: 0 10px 0 5px; +} + + +@import "fiddle_bootstrap_overrides.less"; + diff --git a/src/main/webapp/stylesheets/fiddle_bootstrap_overrides.less b/src/main/webapp/stylesheets/fiddle_bootstrap_overrides.less new file mode 100644 index 0000000..2174b5c --- /dev/null +++ b/src/main/webapp/stylesheets/fiddle_bootstrap_overrides.less @@ -0,0 +1,164 @@ + +/* Bootstrap overrides */ + + +.navbar .nav.pull-right { margin-left: 2px; } + +.nav-collapse>.nav { margin-right: 2px; } + +.navbar .brand { + padding-left: 10px; +} + +.container-fluid .pull-right { + float: right !important; +} + + +.nav-collapse.in .pull-right { + float: left !important; +} + + +.navbar .btn-navbar { + background-color: #d6d6d6; + background-image: -moz-linear-gradient(top, #ffffff, #999999); + background-image: -ms-linear-gradient(top, #ffffff, #999999); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#999999)); + background-image: -webkit-linear-gradient(top, #ffffff, #999999); + background-image: -o-linear-gradient(top, #ffffff, #999999); + background-image: linear-gradient(top, #ffffff, #999999); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#999999', GradientType=0); + border-color: #999999 #999999 #737373; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075); + -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075); +} + +.btn-navbar:hover, +.btn-navbar:active, +.btn-navbar.active, +.btn-navbar.disabled, +.btn-navbar[disabled] { + background-color: #999999; +} +.btn-navbar:active, .btn-navbar.active { + background-color: #808080 \9; +} + +.navbar .brand { + white-space: nowrap; +} + +.navbar { + color: black; +} + +.navbar-inner { + background-color: #d6d6d6; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#999999', GradientType=0); + background-image: -moz-linear-gradient(top, #ffffff, #999999); + background-image: -ms-linear-gradient(top, #ffffff, #999999); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#999999)); + background-image: -webkit-linear-gradient(top, #ffffff, #999999); + background-image: -o-linear-gradient(top, #ffffff, #999999); + background-image: linear-gradient(top, #ffffff, #999999); + +} +.navbar .nav > li > a { + color: #333333; + text-shadow: none; +} + +.navbar .divider-vertical { + background-color: #999; + border-right: 1px solid white; +} +.navbar .nav .active > a, .navbar .nav .active > a:hover { + color: #999999; + text-decoration: none; + background-color: #999999; + background-color: rgba(0, 0, 0, 0.5); +} +.navbar .nav .active > a { + color: #eeeeee; +} +.navbar .nav .active > a:hover { + color: #eeeeee; +} + + + + +.navbar .nav > li > a i { + margin-right: 5px; +} +.navbar .brand { + color: #000000; +} + +.dropdown-menu a i { + margin-right: 5px; +} +.dropdown-toggle b.caret { + color: #999999; + opacity: .5; +} +.dropdown-menu.nav { + z-index:1050 !important; +} +.dropdown-menu.nav li > a:hover, +.dropdown-menu.nav .active > a, +.dropdown-menu.nav .active > a:hover { + color: #ffffff; + text-decoration: none; + background-color: #0088cc; +} + +.form-horizontal .control-group { + margin-bottom: 6px; +} + +.modal form { + margin:0; +} + +.popover-inner { + min-width: 280px; + width: auto; + overflow-x: visible; + overflow-y: hidden; + max-height: 400px; +} + +.popover-inner .alert { + max-width: 400px; + overflow-x: hidden; +} + + +#sidebar .well { + padding: 8px 0; +} +/* +.navbar, #content { + min-width: 920px !important; +} +*/ +#content { + height: 100%; +} +#content .panel { + margin: 0; +} +#content .panel { + min-height: 125px; + height: 100%; + position: relative; +} +#content .panel form { + height: 100%; +} diff --git a/src/main/webapp/stylesheets/fiddle_responsive.less b/src/main/webapp/stylesheets/fiddle_responsive.less new file mode 100644 index 0000000..45c6c17 --- /dev/null +++ b/src/main/webapp/stylesheets/fiddle_responsive.less @@ -0,0 +1,61 @@ +@media (max-width:440px) +{ + #exit_fullscreen span, .helpTip { + display: none !important; + } +} + +@media (min-width:480px) and (max-width:979px) +{ + #db_type_label_collapsed { + display: inline !important; + } +} + +/* + * These selectively disable the less-important nav bar elements, as the screen width shrinks + * (but before we get to the collapsed nav bar view) + */ + +@media (min-width:820px) and (max-width:1024px) { .nav-collapse .pull-right { display: none; } } +@media (min-width:820px) and (max-width:1100px) { .nav-collapse .pull-right .optional { display: none; } } + + +@media (max-width:767px) +{ + div.sql { + width: 100% !important; + } + + .helpTip { + width: 180px !important; + height: 30% !important; + } + +} + +@media (min-width:768px) and (max-width:979px) +{ + .helpTip { + width: 100px !important; + height: 50% !important; + } +} + +@media (max-width:979px) +{ + body { + padding-top: 0px !important; + } + + + textarea.fullscreen { + top: 50px !important; + } + + #paypal_donate { + padding-left:15px; + } + + +} diff --git a/src/main/webapp/stylesheets/print.css b/src/main/webapp/stylesheets/print.css new file mode 100644 index 0000000..4e831a6 --- /dev/null +++ b/src/main/webapp/stylesheets/print.css @@ -0,0 +1,14 @@ +a.executionPlanLink, .btn-navbar, .action_buttons, #hosting { + display: none !important; +} + + .CodeMirror-scroll, #browser { + height: auto !important; + overflow-y: hidden; + overflow-x: auto; + width: 100%; + } + + #schema-output { + height: auto !important; + } diff --git a/src/main/webapp/stylesheets/qp.css b/src/main/webapp/stylesheets/qp.css new file mode 100644 index 0000000..7d785b0 --- /dev/null +++ b/src/main/webapp/stylesheets/qp.css @@ -0,0 +1,181 @@ +div.qp-node
+{
+ background-color: #FFFFCC;
+ margin: 2px;
+ padding: 2px;
+ border: 1px solid black;
+ font-size: 11px;
+ line-height: normal;
+}
+.qp-node > div
+{
+ font-family: Monospace;
+ text-align: center;
+}
+div[class|='qp-icon']
+{
+ height: 32px;
+ width: 32px;
+ margin-left: auto;
+ margin-right: auto;
+ background-repeat: no-repeat;
+}
+.qp-tt
+{
+ top: 4em;
+ left: 2em;
+ border: 1px solid black;
+ background-color: #FFFFEE;
+ padding: 2px;
+}
+.qp-tt div, .qp-tt table
+{
+ font-family: Sans-Serif;
+ text-align: left;
+}
+.qp-tt table
+{
+ border-width: 0px;
+ border-spacing: 0px;
+ margin-top: 10px;
+ margin-bottom: 10px;
+ width: 100%;
+}
+.qp-tt td, .qp-tt th
+{
+ font-size: 11px;
+ border-bottom: solid 1px Black;
+ padding: 1px;
+}
+.qp-tt td
+{
+ text-align: right;
+ padding-left: 10px;
+}
+.qp-tt th
+{
+ text-align: left;
+}
+.qp-bold, .qp-tt-header
+{
+ font-weight: bold;
+}
+.qp-tt-header
+{
+ text-align: center;
+}
+
+/* Icons */
+.qp-icon-Catchall{background-image:url('../images/qp/bitmap.gif')}
+.qp-icon-ArithmeticExpression{background-image:url('../images/qp/arithmetic_expression.gif')}
+.qp-icon-Assert{background-image:url('../images/qp/assert.gif')}
+.qp-icon-Assign{background-image:url('../images/qp/assign.gif')}
+.qp-icon-Bitmap{background-image:url('../images/qp/bitmap.gif')}
+.qp-icon-BookmarkLookup{background-image:url('../images/qp/bookmark_lookup.gif')}
+.qp-icon-ClusteredIndexDelete{background-image:url('../images/qp/clustered_index_delete.gif')}
+.qp-icon-ClusteredIndexInsert{background-image:url('../images/qp/clustered_index_insert.gif')}
+.qp-icon-ClusteredIndexScan{background-image:url('../images/qp/clustered_index_scan.gif')}
+.qp-icon-ClusteredIndexSeek{background-image:url('../images/qp/clustered_index_seek.gif')}
+.qp-icon-ClusteredIndexUpdate{background-image:url('../images/qp/clustered_index_update.gif')}
+.qp-icon-Collapse{background-image:url('../images/qp/collapse.gif')}
+.qp-icon-ComputeScalar{background-image:url('../images/qp/compute_scalar.gif')}
+.qp-icon-Concatenation{background-image:url('../images/qp/concatenation.gif')}
+.qp-icon-ConstantScan{background-image:url('../images/qp/constant_scan.gif')}
+.qp-icon-Convert{background-image:url('../images/qp/convert.gif')}
+.qp-icon-CursorCatchall{background-image:url('../images/qp/bitmap.gif')}
+.qp-icon-Declare{background-image:url('../images/qp/declare.gif')}
+.qp-icon-Delete{background-image:url('../images/qp/table_delete.gif')}
+.qp-icon-DistributeStreams{background-image:url('../images/qp/distribute_streams.gif')}
+.qp-icon-Dynamic{background-image:url('../images/qp/dynamic.gif')}
+.qp-icon-EagerSpool{background-image:url('../images/qp/spool.gif')}
+.qp-icon-FetchQuery{background-image:url('../images/qp/fetch_query.gif')}
+.qp-icon-Filter{background-image:url('../images/qp/filter.gif')}
+.qp-icon-GatherStreams{background-image:url('../images/qp/gather_streams.gif')}
+.qp-icon-HashMatch{background-image:url('../images/qp/hash_match.gif')}
+.qp-icon-HashMatchRoot{background-image:url('../images/qp/hash_match.gif')}
+.qp-icon-HashMatchTeam{background-image:url('../images/qp/hash_match.gif')}
+.qp-icon-If{background-image:url('../images/qp/if.gif')}
+.qp-icon-Insert{background-image:url('../images/qp/table_insert.gif')}
+.qp-icon-InsertedScan{background-image:url('../images/qp/inserted_scan.gif')}
+.qp-icon-Intrinsic{background-image:url('../images/qp/intrinsic.gif')}
+.qp-icon-IteratorCatchall{background-image:url('../images/qp/bitmap.gif')}
+.qp-icon-Keyset{background-image:url('../images/qp/keyset.gif')}
+.qp-icon-LanguageElementCatchall{background-image:url('../images/qp/bitmap.gif')}
+.qp-icon-LazySpool{background-image:url('../images/qp/spool.gif')}
+.qp-icon-LogRowScan{background-image:url('../images/qp/log_row_scan.gif')}
+.qp-icon-MergeInterval{background-image:url('../images/qp/merge_interval.gif')}
+.qp-icon-MergeJoin{background-image:url('../images/qp/merge_join.gif')}
+.qp-icon-NestedLoops{background-image:url('../images/qp/nested_loops.gif')}
+.qp-icon-NonclusteredIndexDelete{background-image:url('../images/qp/nonclustered_index_delete.gif')}
+.qp-icon-NonclusteredIndexInsert{background-image:url('../images/qp/nonclustered_index_insert.gif')}
+.qp-icon-NonclusteredIndexScan{background-image:url('../images/qp/nonclustered_index_scan.gif')}
+.qp-icon-IndexSeek{background-image:url('../images/qp/nonclustered_index_seek.gif')}
+.qp-icon-NonclusteredIndexSpool{background-image:url('../images/qp/nonclustered_index_spool.gif')}
+.qp-icon-NonclusteredIndexUpdate{background-image:url('../images/qp/nonclustered_index_update.gif')}
+.qp-icon-OnlineIndexInsert{background-image:url('../images/qp/online_index_insert.gif')}
+.qp-icon-ParameterTableScan{background-image:url('../images/qp/parameter_table_scan.gif')}
+.qp-icon-PopulationQuery{background-image:url('../images/qp/population_query.gif')}
+.qp-icon-RdiLookup{background-image:url('../images/qp/rdi_lookup.gif')}
+.qp-icon-RefreshQuery{background-image:url('../images/qp/refresh_query.gif')}
+.qp-icon-RemoteDelete{background-image:url('../images/qp/remote_delete.gif')}
+.qp-icon-RemoteInsert{background-image:url('../images/qp/remote_insert.gif')}
+.qp-icon-RemoteQuery{background-image:url('../images/qp/remote_query.gif')}
+.qp-icon-RemoteScan{background-image:url('../images/qp/remote_scan.gif')}
+.qp-icon-RemoteUpdate{background-image:url('../images/qp/remote_update.gif')}
+.qp-icon-RepartitionStreams{background-image:url('../images/qp/repartition_streams.gif')}
+.qp-icon-Result{background-image:url('../images/qp/result.gif')}
+.qp-icon-RowCountSpool{background-image:url('../images/qp/row_count_spool.gif')}
+.qp-icon-Segment{background-image:url('../images/qp/segment.gif')}
+.qp-icon-Sequence{background-image:url('../images/qp/sequence.gif')}
+.qp-icon-Sequenceproject{background-image:url('../images/qp/sequenceproject.gif')}
+.qp-icon-Snapshot{background-image:url('../images/qp/snapshot.gif')}
+.qp-icon-Sort{background-image:url('../images/qp/sort.gif')}
+.qp-icon-Split{background-image:url('../images/qp/split.gif')}
+.qp-icon-Spool{background-image:url('../images/qp/spool.gif')}
+.qp-icon-Statement{background-image:url('../images/qp/result.gif')}
+.qp-icon-StreamAggregate{background-image:url('../images/qp/stream_aggregate.gif')}
+.qp-icon-Switch{background-image:url('../images/qp/switch.gif')}
+.qp-icon-TableDelete{background-image:url('../images/qp/table_delete.gif')}
+.qp-icon-TableInsert{background-image:url('../images/qp/table_insert.gif')}
+.qp-icon-TableScan{background-image:url('../images/qp/table_scan.gif')}
+.qp-icon-TableSpool{background-image:url('../images/qp/table_spool.gif')}
+.qp-icon-TableUpdate{background-image:url('../images/qp/table_update.gif')}
+.qp-icon-TableValuedFunction{background-image:url('../images/qp/table_valued_function.gif')}
+.qp-icon-Top{background-image:url('../images/qp/top.gif')}
+.qp-icon-Udx{background-image:url('../images/qp/udx.gif')}
+.qp-icon-Update{background-image:url('../images/qp/table_update.gif.gif')}
+.qp-icon-While{background-image:url('../images/qp/while.gif')}
+
+/* Layout - can't touch this */
+.qp-tt
+{
+ position: absolute;
+ display: none;
+ z-index: 1;
+ white-space: normal;
+}
+div.qp-node:hover .qp-tt
+{
+ display: block;
+}
+.qp-tt table
+{
+ white-space: nowrap;
+}
+.qp-node
+{
+ position: relative;
+ white-space: nowrap;
+}
+.qp-tr
+{
+ display: table;
+}
+.qp-tr > div
+{
+ display: table-cell;
+ padding-left: 15px;
+}
+.qp-tr canvas,.qp-root canvas {
+ height: 100%;
+}
\ No newline at end of file diff --git a/src/main/webapp/stylesheets/qunit-1.10.0.css b/src/main/webapp/stylesheets/qunit-1.10.0.css new file mode 100644 index 0000000..55970e0 --- /dev/null +++ b/src/main/webapp/stylesheets/qunit-1.10.0.css @@ -0,0 +1,235 @@ +/** + * QUnit v1.10.0 - A JavaScript Unit Testing Framework + * + * http://qunitjs.com + * + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +/** Font Family and Sizes */ + +#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult { + font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif; +} + +#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; } +#qunit-tests { font-size: smaller; } + + +/** Resets */ + +#qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter { + margin: 0; + padding: 0; +} + + +/** Header */ + +#qunit-header { + padding: 0.5em 0 0.5em 1em; + + color: #8699a4; + background-color: #0d3349; + + font-size: 1.5em; + line-height: 1em; + font-weight: normal; + + border-radius: 5px 5px 0 0; + -moz-border-radius: 5px 5px 0 0; + -webkit-border-top-right-radius: 5px; + -webkit-border-top-left-radius: 5px; +} + +#qunit-header a { + text-decoration: none; + color: #c2ccd1; +} + +#qunit-header a:hover, +#qunit-header a:focus { + color: #fff; +} + +#qunit-testrunner-toolbar label { + display: inline-block; + padding: 0 .5em 0 .1em; +} + +#qunit-banner { + height: 5px; +} + +#qunit-testrunner-toolbar { + padding: 0.5em 0 0.5em 2em; + color: #5E740B; + background-color: #eee; + overflow: hidden; +} + +#qunit-userAgent { + padding: 0.5em 0 0.5em 2.5em; + background-color: #2b81af; + color: #fff; + text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px; +} + +#qunit-modulefilter-container { + float: right; +} + +/** Tests: Pass/Fail */ + +#qunit-tests { + list-style-position: inside; +} + +#qunit-tests li { + padding: 0.4em 0.5em 0.4em 2.5em; + border-bottom: 1px solid #fff; + list-style-position: inside; +} + +#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running { + display: none; +} + +#qunit-tests li strong { + cursor: pointer; +} + +#qunit-tests li a { + padding: 0.5em; + color: #c2ccd1; + text-decoration: none; +} +#qunit-tests li a:hover, +#qunit-tests li a:focus { + color: #000; +} + +#qunit-tests ol { + margin-top: 0.5em; + padding: 0.5em; + + background-color: #fff; + + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; +} + +#qunit-tests table { + border-collapse: collapse; + margin-top: .2em; +} + +#qunit-tests th { + text-align: right; + vertical-align: top; + padding: 0 .5em 0 0; +} + +#qunit-tests td { + vertical-align: top; +} + +#qunit-tests pre { + margin: 0; + white-space: pre-wrap; + word-wrap: break-word; +} + +#qunit-tests del { + background-color: #e0f2be; + color: #374e0c; + text-decoration: none; +} + +#qunit-tests ins { + background-color: #ffcaca; + color: #500; + text-decoration: none; +} + +/*** Test Counts */ + +#qunit-tests b.counts { color: black; } +#qunit-tests b.passed { color: #5E740B; } +#qunit-tests b.failed { color: #710909; } + +#qunit-tests li li { + padding: 5px; + background-color: #fff; + border-bottom: none; + list-style-position: inside; +} + +/*** Passing Styles */ + +#qunit-tests li li.pass { + color: #3c510c; + background-color: #fff; + border-left: 10px solid #C6E746; +} + +#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; } +#qunit-tests .pass .test-name { color: #366097; } + +#qunit-tests .pass .test-actual, +#qunit-tests .pass .test-expected { color: #999999; } + +#qunit-banner.qunit-pass { background-color: #C6E746; } + +/*** Failing Styles */ + +#qunit-tests li li.fail { + color: #710909; + background-color: #fff; + border-left: 10px solid #EE5757; + white-space: pre; +} + +#qunit-tests > li:last-child { + border-radius: 0 0 5px 5px; + -moz-border-radius: 0 0 5px 5px; + -webkit-border-bottom-right-radius: 5px; + -webkit-border-bottom-left-radius: 5px; +} + +#qunit-tests .fail { color: #000000; background-color: #EE5757; } +#qunit-tests .fail .test-name, +#qunit-tests .fail .module-name { color: #000000; } + +#qunit-tests .fail .test-actual { color: #EE5757; } +#qunit-tests .fail .test-expected { color: green; } + +#qunit-banner.qunit-fail { background-color: #EE5757; } + + +/** Result */ + +#qunit-testresult { + padding: 0.5em 0.5em 0.5em 2.5em; + + color: #2b81af; + background-color: #D2E0E6; + + border-bottom: 1px solid white; +} +#qunit-testresult .module-name { + font-weight: bold; +} + +/** Fixture */ + +#qunit-fixture { + position: absolute; + top: -10000px; + left: -10000px; + width: 1000px; + height: 1000px; +} diff --git a/src/main/webapp/stylesheets_min/_index.css b/src/main/webapp/stylesheets_min/_index.css new file mode 100644 index 0000000..d25060b --- /dev/null +++ b/src/main/webapp/stylesheets_min/_index.css @@ -0,0 +1,5 @@ +.CodeMirror {line-height: 1em; font-family: monospace;}.CodeMirror-scroll {overflow: auto; height: 300px; position: relative; outline: none;}.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;}.CodeMirror-lines {padding: .4em; white-space: pre;}.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;}.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;}.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);}.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: #a0a;}.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;}div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;} +/*! * Bootstrap v2.0.4 * * Copyright 2012 Twitter, Inc * Licensed under the Apache License v2.0 * http://www.apache.org/licenses/LICENSE-2.0 * * Designed and built with all the love in the world @twitter by @mdo and @fat. */article,aside,details,figcaption,figure,footer,header,hgroup,nav,section {display: block;}audio,canvas,video {display: inline-block; *display: inline; *zoom: 1;}audio:not([controls]) {display: none;}html {font-size: 100%; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%;}a:focus {outline: thin dotted #333; outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px;}a:hover,a:active {outline: 0;}sub,sup {position: relative; font-size: 75%; line-height: 0; vertical-align: baseline;}sup {top: -0.5em;}sub {bottom: -0.25em;}img {max-width: 100%; vertical-align: middle; border: 0; -ms-interpolation-mode: bicubic;}#map_canvas img {max-width: none;}button,input,select,textarea {margin: 0; font-size: 100%; vertical-align: middle;}button,input {*overflow: visible; line-height: normal;}button::-moz-focus-inner,input::-moz-focus-inner {padding: 0; border: 0;}button,input[type="button"],input[type="reset"],input[type="submit"] {cursor: pointer; -webkit-appearance: button;}input[type="search"] {-webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; -webkit-appearance: textfield;}input[type="search"]::-webkit-search-decoration,input[type="search"]::-webkit-search-cancel-button {-webkit-appearance: none;}textarea {overflow: auto; vertical-align: top;}.clearfix {*zoom: 1;}.clearfix:before,.clearfix:after {display: table; content: "";}.clearfix:after {clear: both;}.hide-text {font: 0/0 a; color: transparent; text-shadow: none; background-color: transparent; border: 0;}.input-block-level {display: block; width: 100%; min-height: 28px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box;}body {margin: 0; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; color: #333333; background-color: #ffffff;}a {color: #0088cc; text-decoration: none;}a:hover {color: #005580; text-decoration: underline;}.row {margin-left: -20px; *zoom: 1;}.row:before,.row:after {display: table; content: "";}.row:after {clear: both;}[class*="span"] {float: left; margin-left: 20px;}.container,.navbar-fixed-top .container,.navbar-fixed-bottom .container {width: 940px;}.span12 {width: 940px;}.span11 {width: 860px;}.span10 {width: 780px;}.span9 {width: 700px;}.span8 {width: 620px;}.span7 {width: 540px;}.span6 {width: 460px;}.span5 {width: 380px;}.span4 {width: 300px;}.span3 {width: 220px;}.span2 {width: 140px;}.span1 {width: 60px;}.offset12 {margin-left: 980px;}.offset11 {margin-left: 900px;}.offset10 {margin-left: 820px;}.offset9 {margin-left: 740px;}.offset8 {margin-left: 660px;}.offset7 {margin-left: 580px;}.offset6 {margin-left: 500px;}.offset5 {margin-left: 420px;}.offset4 {margin-left: 340px;}.offset3 {margin-left: 260px;}.offset2 {margin-left: 180px;}.offset1 {margin-left: 100px;}.row-fluid {width: 100%; *zoom: 1;}.row-fluid:before,.row-fluid:after {display: table; content: "";}.row-fluid:after {clear: both;}.row-fluid [class*="span"] {display: block; width: 100%; min-height: 28px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box; float: left; margin-left: 2.127659574%; *margin-left: 2.0744680846382977%;}.row-fluid [class*="span"]:first-child {margin-left: 0;}.row-fluid .span12 {width: 99.99999998999999%; *width: 99.94680850063828%;}.row-fluid .span11 {width: 91.489361693%; *width: 91.4361702036383%;}.row-fluid .span10 {width: 82.97872339599999%; *width: 82.92553190663828%;}.row-fluid .span9 {width: 74.468085099%; *width: 74.4148936096383%;}.row-fluid .span8 {width: 65.95744680199999%; *width: 65.90425531263828%;}.row-fluid .span7 {width: 57.446808505%; *width: 57.3936170156383%;}.row-fluid .span6 {width: 48.93617020799999%; *width: 48.88297871863829%;}.row-fluid .span5 {width: 40.425531911%; *width: 40.3723404216383%;}.row-fluid .span4 {width: 31.914893614%; *width: 31.8617021246383%;}.row-fluid .span3 {width: 23.404255317%; *width: 23.3510638276383%;}.row-fluid .span2 {width: 14.89361702%; *width: 14.8404255306383%;}.row-fluid .span1 {width: 6.382978723%; *width: 6.329787233638298%;}.container {margin-right: auto; margin-left: auto; *zoom: 1;}.container:before,.container:after {display: table; content: "";}.container:after {clear: both;}.container-fluid {padding-right: 20px; padding-left: 20px; *zoom: 1;}.container-fluid:before,.container-fluid:after {display: table; content: "";}.container-fluid:after {clear: both;}p {margin: 0 0 9px;}p small {font-size: 11px; color: #999999;}.lead {margin-bottom: 18px; font-size: 20px; font-weight: 200; line-height: 27px;}h1,h2,h3,h4,h5,h6 {margin: 0; font-family: inherit; font-weight: bold; color: inherit; text-rendering: optimizelegibility;}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small {font-weight: normal; color: #999999;}h1 {font-size: 30px; line-height: 36px;}h1 small {font-size: 18px;}h2 {font-size: 24px; line-height: 36px;}h2 small {font-size: 18px;}h3 {font-size: 18px; line-height: 27px;}h3 small {font-size: 14px;}h4,h5,h6 {line-height: 18px;}h4 {font-size: 14px;}h4 small {font-size: 12px;}h5 {font-size: 12px;}h6 {font-size: 11px; color: #999999; text-transform: uppercase;}.page-header {padding-bottom: 17px; margin: 18px 0; border-bottom: 1px solid #eeeeee;}.page-header h1 {line-height: 1;}ul,ol {padding: 0; margin: 0 0 9px 25px;}ul ul,ul ol,ol ol,ol ul {margin-bottom: 0;}ul {list-style: disc;}ol {list-style: decimal;}li {line-height: 18px;}ul.unstyled,ol.unstyled {margin-left: 0; list-style: none;}dl {margin-bottom: 18px;}dt,dd {line-height: 18px;}dt {font-weight: bold; line-height: 17px;}dd {margin-left: 9px;}.dl-horizontal dt {float: left; width: 120px; clear: left; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}.dl-horizontal dd {margin-left: 130px;}hr {margin: 18px 0; border: 0; border-top: 1px solid #eeeeee; border-bottom: 1px solid #ffffff;}strong {font-weight: bold;}em {font-style: italic;}.muted {color: #999999;}abbr[title] {cursor: help; border-bottom: 1px dotted #999999;}abbr.initialism {font-size: 90%; text-transform: uppercase;}blockquote {padding: 0 0 0 15px; margin: 0 0 18px; border-left: 5px solid #eeeeee;}blockquote p {margin-bottom: 0; font-size: 16px; font-weight: 300; line-height: 22.5px;}blockquote small {display: block; line-height: 18px; color: #999999;}blockquote small:before {content: '\2014 \00A0';}blockquote.pull-right {float: right; padding-right: 15px; padding-left: 0; border-right: 5px solid #eeeeee; border-left: 0;}blockquote.pull-right p,blockquote.pull-right small {text-align: right;}q:before,q:after,blockquote:before,blockquote:after {content: "";}address {display: block; margin-bottom: 18px; font-style: normal; line-height: 18px;}small {font-size: 100%;}cite {font-style: normal;}code,pre {padding: 0 3px 2px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12px; color: #333333; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px;}code {padding: 2px 4px; color: #d14; background-color: #f7f7f9; border: 1px solid #e1e1e8;}pre {display: block; padding: 8.5px; margin: 0 0 9px; font-size: 12.025px; line-height: 18px; word-break: break-all; word-wrap: break-word; white-space: pre; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, 0.15); -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px;}pre.prettyprint {margin-bottom: 18px;}pre code {padding: 0; color: inherit; background-color: transparent; border: 0;}.pre-scrollable {max-height: 340px; overflow-y: scroll;}form {margin: 0 0 18px;}fieldset {padding: 0; margin: 0; border: 0;}legend {display: block; width: 100%; padding: 0; margin-bottom: 27px; font-size: 19.5px; line-height: 36px; color: #333333; border: 0; border-bottom: 1px solid #e5e5e5;}legend small {font-size: 13.5px; color: #999999;}label,input,button,select,textarea {font-size: 13px; font-weight: normal; line-height: 18px;}input,button,select,textarea {font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;}label {display: block; margin-bottom: 5px;}select,textarea,input[type="text"],input[type="password"],input[type="datetime"],input[type="datetime-local"],input[type="date"],input[type="month"],input[type="time"],input[type="week"],input[type="number"],input[type="email"],input[type="url"],input[type="search"],input[type="tel"],input[type="color"],.uneditable-input {display: inline-block; height: 18px; padding: 4px; margin-bottom: 9px; font-size: 13px; line-height: 18px; color: #555555;}input,textarea {width: 210px;}textarea {height: auto;}textarea,input[type="text"],input[type="password"],input[type="datetime"],input[type="datetime-local"],input[type="date"],input[type="month"],input[type="time"],input[type="week"],input[type="number"],input[type="email"],input[type="url"],input[type="search"],input[type="tel"],input[type="color"],.uneditable-input {background-color: #ffffff; border: 1px solid #cccccc; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -webkit-transition: border linear 0.2s, box-shadow linear 0.2s; -moz-transition: border linear 0.2s, box-shadow linear 0.2s; -ms-transition: border linear 0.2s, box-shadow linear 0.2s; -o-transition: border linear 0.2s, box-shadow linear 0.2s; transition: border linear 0.2s, box-shadow linear 0.2s;}textarea:focus,input[type="text"]:focus,input[type="password"]:focus,input[type="datetime"]:focus,input[type="datetime-local"]:focus,input[type="date"]:focus,input[type="month"]:focus,input[type="time"]:focus,input[type="week"]:focus,input[type="number"]:focus,input[type="email"]:focus,input[type="url"]:focus,input[type="search"]:focus,input[type="tel"]:focus,input[type="color"]:focus,.uneditable-input:focus {border-color: rgba(82, 168, 236, 0.8); outline: 0; outline: thin dotted \9; -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6); -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6); box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6);}input[type="radio"],input[type="checkbox"] {margin: 3px 0; *margin-top: 0; line-height: normal; cursor: pointer;}input[type="submit"],input[type="reset"],input[type="button"],input[type="radio"],input[type="checkbox"] {width: auto;}.uneditable-textarea {width: auto; height: auto;}select,input[type="file"] {height: 28px; *margin-top: 4px; line-height: 28px;}select {width: 220px; border: 1px solid #bbb;}select[multiple],select[size] {height: auto;}select:focus,input[type="file"]:focus,input[type="radio"]:focus,input[type="checkbox"]:focus {outline: thin dotted #333; outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px;}.radio,.checkbox {min-height: 18px; padding-left: 18px;}.radio input[type="radio"],.checkbox input[type="checkbox"] {float: left; margin-left: -18px;}.controls > .radio:first-child,.controls > .checkbox:first-child {padding-top: 5px;}.radio.inline,.checkbox.inline {display: inline-block; padding-top: 5px; margin-bottom: 0; vertical-align: middle;}.radio.inline + .radio.inline,.checkbox.inline + .checkbox.inline {margin-left: 10px;}.input-mini {width: 60px;}.input-small {width: 90px;}.input-medium {width: 150px;}.input-large {width: 210px;}.input-xlarge {width: 270px;}.input-xxlarge {width: 530px;}input[class*="span"],select[class*="span"],textarea[class*="span"],.uneditable-input[class*="span"],.row-fluid input[class*="span"],.row-fluid select[class*="span"],.row-fluid textarea[class*="span"],.row-fluid .uneditable-input[class*="span"] {float: none; margin-left: 0;}.input-append input[class*="span"],.input-append .uneditable-input[class*="span"],.input-prepend input[class*="span"],.input-prepend .uneditable-input[class*="span"],.row-fluid .input-prepend [class*="span"],.row-fluid .input-append [class*="span"] {display: inline-block;}input,textarea,.uneditable-input {margin-left: 0;}input.span12, textarea.span12, .uneditable-input.span12 {width: 930px;}input.span11, textarea.span11, .uneditable-input.span11 {width: 850px;}input.span10, textarea.span10, .uneditable-input.span10 {width: 770px;}input.span9, textarea.span9, .uneditable-input.span9 {width: 690px;}input.span8, textarea.span8, .uneditable-input.span8 {width: 610px;}input.span7, textarea.span7, .uneditable-input.span7 {width: 530px;}input.span6, textarea.span6, .uneditable-input.span6 {width: 450px;}input.span5, textarea.span5, .uneditable-input.span5 {width: 370px;}input.span4, textarea.span4, .uneditable-input.span4 {width: 290px;}input.span3, textarea.span3, .uneditable-input.span3 {width: 210px;}input.span2, textarea.span2, .uneditable-input.span2 {width: 130px;}input.span1, textarea.span1, .uneditable-input.span1 {width: 50px;}input[disabled],select[disabled],textarea[disabled],input[readonly],select[readonly],textarea[readonly] {cursor: not-allowed; background-color: #eeeeee; border-color: #ddd;}input[type="radio"][disabled],input[type="checkbox"][disabled],input[type="radio"][readonly],input[type="checkbox"][readonly] {background-color: transparent;}.control-group.warning > label,.control-group.warning .help-block,.control-group.warning .help-inline {color: #c09853;}.control-group.warning .checkbox,.control-group.warning .radio,.control-group.warning input,.control-group.warning select,.control-group.warning textarea {color: #c09853; border-color: #c09853;}.control-group.warning .checkbox:focus,.control-group.warning .radio:focus,.control-group.warning input:focus,.control-group.warning select:focus,.control-group.warning textarea:focus {border-color: #a47e3c; -webkit-box-shadow: 0 0 6px #dbc59e; -moz-box-shadow: 0 0 6px #dbc59e; box-shadow: 0 0 6px #dbc59e;}.control-group.warning .input-prepend .add-on,.control-group.warning .input-append .add-on {color: #c09853; background-color: #fcf8e3; border-color: #c09853;}.control-group.error > label,.control-group.error .help-block,.control-group.error .help-inline {color: #b94a48;}.control-group.error .checkbox,.control-group.error .radio,.control-group.error input,.control-group.error select,.control-group.error textarea {color: #b94a48; border-color: #b94a48;}.control-group.error .checkbox:focus,.control-group.error .radio:focus,.control-group.error input:focus,.control-group.error select:focus,.control-group.error textarea:focus {border-color: #953b39; -webkit-box-shadow: 0 0 6px #d59392; -moz-box-shadow: 0 0 6px #d59392; box-shadow: 0 0 6px #d59392;}.control-group.error .input-prepend .add-on,.control-group.error .input-append .add-on {color: #b94a48; background-color: #f2dede; border-color: #b94a48;}.control-group.success > label,.control-group.success .help-block,.control-group.success .help-inline {color: #468847;}.control-group.success .checkbox,.control-group.success .radio,.control-group.success input,.control-group.success select,.control-group.success textarea {color: #468847; border-color: #468847;}.control-group.success .checkbox:focus,.control-group.success .radio:focus,.control-group.success input:focus,.control-group.success select:focus,.control-group.success textarea:focus {border-color: #356635; -webkit-box-shadow: 0 0 6px #7aba7b; -moz-box-shadow: 0 0 6px #7aba7b; box-shadow: 0 0 6px #7aba7b;}.control-group.success .input-prepend .add-on,.control-group.success .input-append .add-on {color: #468847; background-color: #dff0d8; border-color: #468847;}input:focus:required:invalid,textarea:focus:required:invalid,select:focus:required:invalid {color: #b94a48; border-color: #ee5f5b;}input:focus:required:invalid:focus,textarea:focus:required:invalid:focus,select:focus:required:invalid:focus {border-color: #e9322d; -webkit-box-shadow: 0 0 6px #f8b9b7; -moz-box-shadow: 0 0 6px #f8b9b7; box-shadow: 0 0 6px #f8b9b7;}.form-actions {padding: 17px 20px 18px; margin-top: 18px; margin-bottom: 18px; background-color: #f5f5f5; border-top: 1px solid #e5e5e5; *zoom: 1;}.form-actions:before,.form-actions:after {display: table; content: "";}.form-actions:after {clear: both;}.uneditable-input {overflow: hidden; white-space: nowrap; cursor: not-allowed; background-color: #ffffff; border-color: #eee; -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025); -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025);}:-moz-placeholder {color: #999999;}:-ms-input-placeholder {color: #999999;}::-webkit-input-placeholder {color: #999999;}.help-block,.help-inline {color: #555555;}.help-block {display: block; margin-bottom: 9px;}.help-inline {display: inline-block; *display: inline; *zoom: 1; vertical-align: middle; padding-left: 5px;}.input-prepend,.input-append {margin-bottom: 5px;}.input-prepend input,.input-append input,.input-prepend select,.input-append select,.input-prepend .uneditable-input,.input-append .uneditable-input {position: relative; margin-bottom: 0; *margin-left: 0; vertical-align: middle; -webkit-border-radius: 0 3px 3px 0; -moz-border-radius: 0 3px 3px 0; border-radius: 0 3px 3px 0;}.input-prepend input:focus,.input-append input:focus,.input-prepend select:focus,.input-append select:focus,.input-prepend .uneditable-input:focus,.input-append .uneditable-input:focus {z-index: 2;}.input-prepend .uneditable-input,.input-append .uneditable-input {border-left-color: #ccc;}.input-prepend .add-on,.input-append .add-on {display: inline-block; width: auto; height: 18px; min-width: 16px; padding: 4px 5px; font-weight: normal; line-height: 18px; text-align: center; text-shadow: 0 1px 0 #ffffff; vertical-align: middle; background-color: #eeeeee; border: 1px solid #ccc;}.input-prepend .add-on,.input-append .add-on,.input-prepend .btn,.input-append .btn {margin-left: -1px; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0;}.input-prepend .active,.input-append .active {background-color: #a9dba9; border-color: #46a546;}.input-prepend .add-on,.input-prepend .btn {margin-right: -1px;}.input-prepend .add-on:first-child,.input-prepend .btn:first-child {-webkit-border-radius: 3px 0 0 3px; -moz-border-radius: 3px 0 0 3px; border-radius: 3px 0 0 3px;}.input-append input,.input-append select,.input-append .uneditable-input {-webkit-border-radius: 3px 0 0 3px; -moz-border-radius: 3px 0 0 3px; border-radius: 3px 0 0 3px;}.input-append .uneditable-input {border-right-color: #ccc; border-left-color: #eee;}.input-append .add-on:last-child,.input-append .btn:last-child {-webkit-border-radius: 0 3px 3px 0; -moz-border-radius: 0 3px 3px 0; border-radius: 0 3px 3px 0;}.input-prepend.input-append input,.input-prepend.input-append select,.input-prepend.input-append .uneditable-input {-webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0;}.input-prepend.input-append .add-on:first-child,.input-prepend.input-append .btn:first-child {margin-right: -1px; -webkit-border-radius: 3px 0 0 3px; -moz-border-radius: 3px 0 0 3px; border-radius: 3px 0 0 3px;}.input-prepend.input-append .add-on:last-child,.input-prepend.input-append .btn:last-child {margin-left: -1px; -webkit-border-radius: 0 3px 3px 0; -moz-border-radius: 0 3px 3px 0; border-radius: 0 3px 3px 0;}.search-query {padding-right: 14px; padding-right: 4px \9; padding-left: 14px; padding-left: 4px \9; margin-bottom: 0; -webkit-border-radius: 14px; -moz-border-radius: 14px; border-radius: 14px;}.form-search input,.form-inline input,.form-horizontal input,.form-search textarea,.form-inline textarea,.form-horizontal textarea,.form-search select,.form-inline select,.form-horizontal select,.form-search .help-inline,.form-inline .help-inline,.form-horizontal .help-inline,.form-search .uneditable-input,.form-inline .uneditable-input,.form-horizontal .uneditable-input,.form-search .input-prepend,.form-inline .input-prepend,.form-horizontal .input-prepend,.form-search .input-append,.form-inline .input-append,.form-horizontal .input-append {display: inline-block; *display: inline; *zoom: 1; margin-bottom: 0;}.form-search .hide,.form-inline .hide,.form-horizontal .hide {display: none;}.form-search label,.form-inline label {display: inline-block;}.form-search .input-append,.form-inline .input-append,.form-search .input-prepend,.form-inline .input-prepend {margin-bottom: 0;}.form-search .radio,.form-search .checkbox,.form-inline .radio,.form-inline .checkbox {padding-left: 0; margin-bottom: 0; vertical-align: middle;}.form-search .radio input[type="radio"],.form-search .checkbox input[type="checkbox"],.form-inline .radio input[type="radio"],.form-inline .checkbox input[type="checkbox"] {float: left; margin-right: 3px; margin-left: 0;}.control-group {margin-bottom: 9px;}legend + .control-group {margin-top: 18px; -webkit-margin-top-collapse: separate;}.form-horizontal .control-group {margin-bottom: 18px; *zoom: 1;}.form-horizontal .control-group:before,.form-horizontal .control-group:after {display: table; content: "";}.form-horizontal .control-group:after {clear: both;}.form-horizontal .control-label {float: left; width: 140px; padding-top: 5px; text-align: right;}.form-horizontal .controls {*display: inline-block; *padding-left: 20px; margin-left: 160px; *margin-left: 0;}.form-horizontal .controls:first-child {*padding-left: 160px;}.form-horizontal .help-block {margin-top: 9px; margin-bottom: 0;}.form-horizontal .form-actions {padding-left: 160px;}table {max-width: 100%; background-color: transparent; border-collapse: collapse; border-spacing: 0;}.table {width: 100%; margin-bottom: 18px;}.table th,.table td {padding: 8px; line-height: 18px; text-align: left; vertical-align: top; border-top: 1px solid #dddddd;}.table th {font-weight: bold;}.table thead th {vertical-align: bottom;}.table caption + thead tr:first-child th,.table caption + thead tr:first-child td,.table colgroup + thead tr:first-child th,.table colgroup + thead tr:first-child td,.table thead:first-child tr:first-child th,.table thead:first-child tr:first-child td {border-top: 0;}.table tbody + tbody {border-top: 2px solid #dddddd;}.table-condensed th,.table-condensed td {padding: 4px 5px;}.table-bordered {border: 1px solid #dddddd; border-collapse: separate; *border-collapse: collapsed; border-left: 0; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px;}.table-bordered th,.table-bordered td {border-left: 1px solid #dddddd;}.table-bordered caption + thead tr:first-child th,.table-bordered caption + tbody tr:first-child th,.table-bordered caption + tbody tr:first-child td,.table-bordered colgroup + thead tr:first-child th,.table-bordered colgroup + tbody tr:first-child th,.table-bordered colgroup + tbody tr:first-child td,.table-bordered thead:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child td {border-top: 0;}.table-bordered thead:first-child tr:first-child th:first-child,.table-bordered tbody:first-child tr:first-child td:first-child {-webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topleft: 4px;}.table-bordered thead:first-child tr:first-child th:last-child,.table-bordered tbody:first-child tr:first-child td:last-child {-webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-topright: 4px;}.table-bordered thead:last-child tr:last-child th:first-child,.table-bordered tbody:last-child tr:last-child td:first-child {-webkit-border-radius: 0 0 0 4px; -moz-border-radius: 0 0 0 4px; border-radius: 0 0 0 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomleft: 4px;}.table-bordered thead:last-child tr:last-child th:last-child,.table-bordered tbody:last-child tr:last-child td:last-child {-webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; -moz-border-radius-bottomright: 4px;}.table-striped tbody tr:nth-child(odd) td,.table-striped tbody tr:nth-child(odd) th {background-color: #f9f9f9;}.table tbody tr:hover td,.table tbody tr:hover th {background-color: #f5f5f5;}table .span1 {float: none; width: 44px; margin-left: 0;}table .span2 {float: none; width: 124px; margin-left: 0;}table .span3 {float: none; width: 204px; margin-left: 0;}table .span4 {float: none; width: 284px; margin-left: 0;}table .span5 {float: none; width: 364px; margin-left: 0;}table .span6 {float: none; width: 444px; margin-left: 0;}table .span7 {float: none; width: 524px; margin-left: 0;}table .span8 {float: none; width: 604px; margin-left: 0;}table .span9 {float: none; width: 684px; margin-left: 0;}table .span10 {float: none; width: 764px; margin-left: 0;}table .span11 {float: none; width: 844px; margin-left: 0;}table .span12 {float: none; width: 924px; margin-left: 0;}table .span13 {float: none; width: 1004px; margin-left: 0;}table .span14 {float: none; width: 1084px; margin-left: 0;}table .span15 {float: none; width: 1164px; margin-left: 0;}table .span16 {float: none; width: 1244px; margin-left: 0;}table .span17 {float: none; width: 1324px; margin-left: 0;}table .span18 {float: none; width: 1404px; margin-left: 0;}table .span19 {float: none; width: 1484px; margin-left: 0;}table .span20 {float: none; width: 1564px; margin-left: 0;}table .span21 {float: none; width: 1644px; margin-left: 0;}table .span22 {float: none; width: 1724px; margin-left: 0;}table .span23 {float: none; width: 1804px; margin-left: 0;}table .span24 {float: none; width: 1884px; margin-left: 0;}[class^="icon-"],[class*=" icon-"] {display: inline-block; width: 14px; height: 14px; *margin-right: .3em; line-height: 14px; vertical-align: text-top; background-image: url("../../images/glyphicons-halflings.png"); background-position: 14px 14px; background-repeat: no-repeat;}[class^="icon-"]:last-child,[class*=" icon-"]:last-child {*margin-left: 0;}.icon-white {background-image: url("../../images/glyphicons-halflings-white.png");}.icon-glass {background-position: 0 0;}.icon-music {background-position: -24px 0;}.icon-search {background-position: -48px 0;}.icon-envelope {background-position: -72px 0;}.icon-heart {background-position: -96px 0;}.icon-star {background-position: -120px 0;}.icon-star-empty {background-position: -144px 0;}.icon-user {background-position: -168px 0;}.icon-film {background-position: -192px 0;}.icon-th-large {background-position: -216px 0;}.icon-th {background-position: -240px 0;}.icon-th-list {background-position: -264px 0;}.icon-ok {background-position: -288px 0;}.icon-remove {background-position: -312px 0;}.icon-zoom-in {background-position: -336px 0;}.icon-zoom-out {background-position: -360px 0;}.icon-off {background-position: -384px 0;}.icon-signal {background-position: -408px 0;}.icon-cog {background-position: -432px 0;}.icon-trash {background-position: -456px 0;}.icon-home {background-position: 0 -24px;}.icon-file {background-position: -24px -24px;}.icon-time {background-position: -48px -24px;}.icon-road {background-position: -72px -24px;}.icon-download-alt {background-position: -96px -24px;}.icon-download {background-position: -120px -24px;}.icon-upload {background-position: -144px -24px;}.icon-inbox {background-position: -168px -24px;}.icon-play-circle {background-position: -192px -24px;}.icon-repeat {background-position: -216px -24px;}.icon-refresh {background-position: -240px -24px;}.icon-list-alt {background-position: -264px -24px;}.icon-lock {background-position: -287px -24px;}.icon-flag {background-position: -312px -24px;}.icon-headphones {background-position: -336px -24px;}.icon-volume-off {background-position: -360px -24px;}.icon-volume-down {background-position: -384px -24px;}.icon-volume-up {background-position: -408px -24px;}.icon-qrcode {background-position: -432px -24px;}.icon-barcode {background-position: -456px -24px;}.icon-tag {background-position: 0 -48px;}.icon-tags {background-position: -25px -48px;}.icon-book {background-position: -48px -48px;}.icon-bookmark {background-position: -72px -48px;}.icon-print {background-position: -96px -48px;}.icon-camera {background-position: -120px -48px;}.icon-font {background-position: -144px -48px;}.icon-bold {background-position: -167px -48px;}.icon-italic {background-position: -192px -48px;}.icon-text-height {background-position: -216px -48px;}.icon-text-width {background-position: -240px -48px;}.icon-align-left {background-position: -264px -48px;}.icon-align-center {background-position: -288px -48px;}.icon-align-right {background-position: -312px -48px;}.icon-align-justify {background-position: -336px -48px;}.icon-list {background-position: -360px -48px;}.icon-indent-left {background-position: -384px -48px;}.icon-indent-right {background-position: -408px -48px;}.icon-facetime-video {background-position: -432px -48px;}.icon-picture {background-position: -456px -48px;}.icon-pencil {background-position: 0 -72px;}.icon-map-marker {background-position: -24px -72px;}.icon-adjust {background-position: -48px -72px;}.icon-tint {background-position: -72px -72px;}.icon-edit {background-position: -96px -72px;}.icon-share {background-position: -120px -72px;}.icon-check {background-position: -144px -72px;}.icon-move {background-position: -168px -72px;}.icon-step-backward {background-position: -192px -72px;}.icon-fast-backward {background-position: -216px -72px;}.icon-backward {background-position: -240px -72px;}.icon-play {background-position: -264px -72px;}.icon-pause {background-position: -288px -72px;}.icon-stop {background-position: -312px -72px;}.icon-forward {background-position: -336px -72px;}.icon-fast-forward {background-position: -360px -72px;}.icon-step-forward {background-position: -384px -72px;}.icon-eject {background-position: -408px -72px;}.icon-chevron-left {background-position: -432px -72px;}.icon-chevron-right {background-position: -456px -72px;}.icon-plus-sign {background-position: 0 -96px;}.icon-minus-sign {background-position: -24px -96px;}.icon-remove-sign {background-position: -48px -96px;}.icon-ok-sign {background-position: -72px -96px;}.icon-question-sign {background-position: -96px -96px;}.icon-info-sign {background-position: -120px -96px;}.icon-screenshot {background-position: -144px -96px;}.icon-remove-circle {background-position: -168px -96px;}.icon-ok-circle {background-position: -192px -96px;}.icon-ban-circle {background-position: -216px -96px;}.icon-arrow-left {background-position: -240px -96px;}.icon-arrow-right {background-position: -264px -96px;}.icon-arrow-up {background-position: -289px -96px;}.icon-arrow-down {background-position: -312px -96px;}.icon-share-alt {background-position: -336px -96px;}.icon-resize-full {background-position: -360px -96px;}.icon-resize-small {background-position: -384px -96px;}.icon-plus {background-position: -408px -96px;}.icon-minus {background-position: -433px -96px;}.icon-asterisk {background-position: -456px -96px;}.icon-exclamation-sign {background-position: 0 -120px;}.icon-gift {background-position: -24px -120px;}.icon-leaf {background-position: -48px -120px;}.icon-fire {background-position: -72px -120px;}.icon-eye-open {background-position: -96px -120px;}.icon-eye-close {background-position: -120px -120px;}.icon-warning-sign {background-position: -144px -120px;}.icon-plane {background-position: -168px -120px;}.icon-calendar {background-position: -192px -120px;}.icon-random {background-position: -216px -120px;}.icon-comment {background-position: -240px -120px;}.icon-magnet {background-position: -264px -120px;}.icon-chevron-up {background-position: -288px -120px;}.icon-chevron-down {background-position: -313px -119px;}.icon-retweet {background-position: -336px -120px;}.icon-shopping-cart {background-position: -360px -120px;}.icon-folder-close {background-position: -384px -120px;}.icon-folder-open {background-position: -408px -120px;}.icon-resize-vertical {background-position: -432px -119px;}.icon-resize-horizontal {background-position: -456px -118px;}.icon-hdd {background-position: 0 -144px;}.icon-bullhorn {background-position: -24px -144px;}.icon-bell {background-position: -48px -144px;}.icon-certificate {background-position: -72px -144px;}.icon-thumbs-up {background-position: -96px -144px;}.icon-thumbs-down {background-position: -120px -144px;}.icon-hand-right {background-position: -144px -144px;}.icon-hand-left {background-position: -168px -144px;}.icon-hand-up {background-position: -192px -144px;}.icon-hand-down {background-position: -216px -144px;}.icon-circle-arrow-right {background-position: -240px -144px;}.icon-circle-arrow-left {background-position: -264px -144px;}.icon-circle-arrow-up {background-position: -288px -144px;}.icon-circle-arrow-down {background-position: -312px -144px;}.icon-globe {background-position: -336px -144px;}.icon-wrench {background-position: -360px -144px;}.icon-tasks {background-position: -384px -144px;}.icon-filter {background-position: -408px -144px;}.icon-briefcase {background-position: -432px -144px;}.icon-fullscreen {background-position: -456px -144px;}.dropup,.dropdown {position: relative;}.dropdown-toggle {*margin-bottom: -3px;}.dropdown-toggle:active,.open .dropdown-toggle {outline: 0;}.caret {display: inline-block; width: 0; height: 0; vertical-align: top; border-top: 4px solid #000000; border-right: 4px solid transparent; border-left: 4px solid transparent; content: ""; opacity: 0.3; filter: alpha(opacity=30);}.dropdown .caret {margin-top: 8px; margin-left: 2px;}.dropdown:hover .caret,.open .caret {opacity: 1; filter: alpha(opacity=100);}.dropdown-menu {position: absolute; top: 100%; left: 0; z-index: 1000; display: none; float: left; min-width: 160px; padding: 4px 0; margin: 1px 0 0; list-style: none; 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;}.dropdown-menu.pull-right {right: 0; left: auto;}.dropdown-menu .divider {*width: 100%; height: 1px; margin: 8px 1px; *margin: -5px 0 5px; overflow: hidden; background-color: #e5e5e5; border-bottom: 1px solid #ffffff;}.dropdown-menu a {display: block; padding: 3px 15px; clear: both; font-weight: normal; line-height: 18px; color: #333333; white-space: nowrap;}.dropdown-menu li > a:hover,.dropdown-menu .active > a,.dropdown-menu .active > a:hover {color: #ffffff; text-decoration: none; background-color: #0088cc;}.open {*z-index: 1000;}.open > .dropdown-menu {display: block;}.pull-right > .dropdown-menu {right: 0; left: auto;}.dropup .caret,.navbar-fixed-bottom .dropdown .caret {border-top: 0; border-bottom: 4px solid #000000; content: "\2191";}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu {top: auto; bottom: 100%; margin-bottom: 1px;}.typeahead {margin-top: 2px; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px;}.well {min-height: 20px; padding: 19px; margin-bottom: 20px; background-color: #f5f5f5; border: 1px solid #eee; border: 1px solid rgba(0, 0, 0, 0.05); -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);}.well blockquote {border-color: #ddd; border-color: rgba(0, 0, 0, 0.15);}.well-large {padding: 24px; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px;}.well-small {padding: 9px; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px;}.fade {opacity: 0; -webkit-transition: opacity 0.15s linear; -moz-transition: opacity 0.15s linear; -ms-transition: opacity 0.15s linear; -o-transition: opacity 0.15s linear; transition: opacity 0.15s linear;}.fade.in {opacity: 1;}.collapse {position: relative; height: 0; overflow: hidden; -webkit-transition: height 0.35s ease; -moz-transition: height 0.35s ease; -ms-transition: height 0.35s ease; -o-transition: height 0.35s ease; transition: height 0.35s ease;}.collapse.in {height: auto;}.close {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);}.close:hover {color: #000000; text-decoration: none; cursor: pointer; opacity: 0.4; filter: alpha(opacity=40);}button.close {padding: 0; cursor: pointer; background: transparent; border: 0; -webkit-appearance: none;}.btn {display: inline-block; *display: inline; *zoom: 1; padding: 4px 10px 4px; margin-bottom: 0; font-size: 13px; line-height: 18px; *line-height: 20px; color: #333333; text-align: center; text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); vertical-align: middle; cursor: pointer; background-color: #f5f5f5; background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); background-image: -ms-linear-gradient(top, #ffffff, #e6e6e6); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); background-image: linear-gradient(top, #ffffff, #e6e6e6); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#e6e6e6', GradientType=0); border-color: #e6e6e6 #e6e6e6 #bfbfbf; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #e6e6e6; filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); border: 1px solid #cccccc; *border: 0; border-bottom-color: #b3b3b3; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; *margin-left: .3em; -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);}.btn:hover,.btn:active,.btn.active,.btn.disabled,.btn[disabled] {background-color: #e6e6e6; *background-color: #d9d9d9;}.btn:active,.btn.active {background-color: #cccccc \9;}.btn:first-child {*margin-left: 0;}.btn:hover {color: #333333; text-decoration: none; background-color: #e6e6e6; *background-color: #d9d9d9; background-position: 0 -15px; -webkit-transition: background-position 0.1s linear; -moz-transition: background-position 0.1s linear; -ms-transition: background-position 0.1s linear; -o-transition: background-position 0.1s linear; transition: background-position 0.1s linear;}.btn:focus {outline: thin dotted #333; outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px;}.btn.active,.btn:active {background-color: #e6e6e6; background-color: #d9d9d9 \9; background-image: none; outline: 0; -webkit-box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05); -moz-box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05); box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);}.btn.disabled,.btn[disabled] {cursor: default; background-color: #e6e6e6; background-image: none; opacity: 0.65; filter: alpha(opacity=65); -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none;}.btn-large {padding: 9px 14px; font-size: 15px; line-height: normal; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px;}.btn-large [class^="icon-"] {margin-top: 1px;}.btn-small {padding: 5px 9px; font-size: 11px; line-height: 16px;}.btn-small [class^="icon-"] {margin-top: -1px;}.btn-mini {padding: 2px 6px; font-size: 11px; line-height: 14px;}.btn-primary,.btn-primary:hover,.btn-warning,.btn-warning:hover,.btn-danger,.btn-danger:hover,.btn-success,.btn-success:hover,.btn-info,.btn-info:hover,.btn-inverse,.btn-inverse:hover {color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);}.btn-primary.active,.btn-warning.active,.btn-danger.active,.btn-success.active,.btn-info.active,.btn-inverse.active {color: rgba(255, 255, 255, 0.75);}.btn {border-color: #ccc; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);}.btn-primary {background-color: #0074cc; background-image: -moz-linear-gradient(top, #0088cc, #0055cc); background-image: -ms-linear-gradient(top, #0088cc, #0055cc); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0055cc)); background-image: -webkit-linear-gradient(top, #0088cc, #0055cc); background-image: -o-linear-gradient(top, #0088cc, #0055cc); background-image: linear-gradient(top, #0088cc, #0055cc); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0055cc', GradientType=0); border-color: #0055cc #0055cc #003580; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #0055cc; filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-primary:hover,.btn-primary:active,.btn-primary.active,.btn-primary.disabled,.btn-primary[disabled] {background-color: #0055cc; *background-color: #004ab3;}.btn-primary:active,.btn-primary.active {background-color: #004099 \9;}.btn-warning {background-color: #faa732; background-image: -moz-linear-gradient(top, #fbb450, #f89406); background-image: -ms-linear-gradient(top, #fbb450, #f89406); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406)); background-image: -webkit-linear-gradient(top, #fbb450, #f89406); background-image: -o-linear-gradient(top, #fbb450, #f89406); background-image: linear-gradient(top, #fbb450, #f89406); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fbb450', endColorstr='#f89406', GradientType=0); border-color: #f89406 #f89406 #ad6704; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #f89406; filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-warning:hover,.btn-warning:active,.btn-warning.active,.btn-warning.disabled,.btn-warning[disabled] {background-color: #f89406; *background-color: #df8505;}.btn-warning:active,.btn-warning.active {background-color: #c67605 \9;}.btn-danger {background-color: #da4f49; background-image: -moz-linear-gradient(top, #ee5f5b, #bd362f); background-image: -ms-linear-gradient(top, #ee5f5b, #bd362f); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#bd362f)); background-image: -webkit-linear-gradient(top, #ee5f5b, #bd362f); background-image: -o-linear-gradient(top, #ee5f5b, #bd362f); background-image: linear-gradient(top, #ee5f5b, #bd362f); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ee5f5b', endColorstr='#bd362f', GradientType=0); border-color: #bd362f #bd362f #802420; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #bd362f; filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-danger:hover,.btn-danger:active,.btn-danger.active,.btn-danger.disabled,.btn-danger[disabled] {background-color: #bd362f; *background-color: #a9302a;}.btn-danger:active,.btn-danger.active {background-color: #942a25 \9;}.btn-success {background-color: #5bb75b; background-image: -moz-linear-gradient(top, #62c462, #51a351); background-image: -ms-linear-gradient(top, #62c462, #51a351); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#51a351)); background-image: -webkit-linear-gradient(top, #62c462, #51a351); background-image: -o-linear-gradient(top, #62c462, #51a351); background-image: linear-gradient(top, #62c462, #51a351); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#51a351', GradientType=0); border-color: #51a351 #51a351 #387038; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #51a351; filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-success:hover,.btn-success:active,.btn-success.active,.btn-success.disabled,.btn-success[disabled] {background-color: #51a351; *background-color: #499249;}.btn-success:active,.btn-success.active {background-color: #408140 \9;}.btn-info {background-color: #49afcd; background-image: -moz-linear-gradient(top, #5bc0de, #2f96b4); background-image: -ms-linear-gradient(top, #5bc0de, #2f96b4); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#2f96b4)); background-image: -webkit-linear-gradient(top, #5bc0de, #2f96b4); background-image: -o-linear-gradient(top, #5bc0de, #2f96b4); background-image: linear-gradient(top, #5bc0de, #2f96b4); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5bc0de', endColorstr='#2f96b4', GradientType=0); border-color: #2f96b4 #2f96b4 #1f6377; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #2f96b4; filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-info:hover,.btn-info:active,.btn-info.active,.btn-info.disabled,.btn-info[disabled] {background-color: #2f96b4; *background-color: #2a85a0;}.btn-info:active,.btn-info.active {background-color: #24748c \9;}.btn-inverse {background-color: #414141; background-image: -moz-linear-gradient(top, #555555, #222222); background-image: -ms-linear-gradient(top, #555555, #222222); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#555555), to(#222222)); background-image: -webkit-linear-gradient(top, #555555, #222222); background-image: -o-linear-gradient(top, #555555, #222222); background-image: linear-gradient(top, #555555, #222222); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#555555', endColorstr='#222222', GradientType=0); border-color: #222222 #222222 #000000; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #222222; filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-inverse:hover,.btn-inverse:active,.btn-inverse.active,.btn-inverse.disabled,.btn-inverse[disabled] {background-color: #222222; *background-color: #151515;}.btn-inverse:active,.btn-inverse.active {background-color: #080808 \9;}button.btn,input[type="submit"].btn {*padding-top: 2px; *padding-bottom: 2px;}button.btn::-moz-focus-inner,input[type="submit"].btn::-moz-focus-inner {padding: 0; border: 0;}button.btn.btn-large,input[type="submit"].btn.btn-large {*padding-top: 7px; *padding-bottom: 7px;}button.btn.btn-small,input[type="submit"].btn.btn-small {*padding-top: 3px; *padding-bottom: 3px;}button.btn.btn-mini,input[type="submit"].btn.btn-mini {*padding-top: 1px; *padding-bottom: 1px;}.btn-group {position: relative; *zoom: 1; *margin-left: .3em;}.btn-group:before,.btn-group:after {display: table; content: "";}.btn-group:after {clear: both;}.btn-group:first-child {*margin-left: 0;}.btn-group + .btn-group {margin-left: 5px;}.btn-toolbar {margin-top: 9px; margin-bottom: 9px;}.btn-toolbar .btn-group {display: inline-block; *display: inline; *zoom: 1;}.btn-group > .btn {position: relative; float: left; margin-left: -1px; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0;}.btn-group > .btn:first-child {margin-left: 0; -webkit-border-top-left-radius: 4px; -moz-border-radius-topleft: 4px; border-top-left-radius: 4px; -webkit-border-bottom-left-radius: 4px; -moz-border-radius-bottomleft: 4px; border-bottom-left-radius: 4px;}.btn-group > .btn:last-child,.btn-group > .dropdown-toggle {-webkit-border-top-right-radius: 4px; -moz-border-radius-topright: 4px; border-top-right-radius: 4px; -webkit-border-bottom-right-radius: 4px; -moz-border-radius-bottomright: 4px; border-bottom-right-radius: 4px;}.btn-group > .btn.large:first-child {margin-left: 0; -webkit-border-top-left-radius: 6px; -moz-border-radius-topleft: 6px; border-top-left-radius: 6px; -webkit-border-bottom-left-radius: 6px; -moz-border-radius-bottomleft: 6px; border-bottom-left-radius: 6px;}.btn-group > .btn.large:last-child,.btn-group > .large.dropdown-toggle {-webkit-border-top-right-radius: 6px; -moz-border-radius-topright: 6px; border-top-right-radius: 6px; -webkit-border-bottom-right-radius: 6px; -moz-border-radius-bottomright: 6px; border-bottom-right-radius: 6px;}.btn-group > .btn:hover,.btn-group > .btn:focus,.btn-group > .btn:active,.btn-group > .btn.active {z-index: 2;}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle {outline: 0;}.btn-group > .dropdown-toggle {padding-left: 8px; padding-right: 8px; -webkit-box-shadow: inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); -moz-box-shadow: inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); box-shadow: inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); *padding-top: 4px; *padding-bottom: 4px;}.btn-group > .btn-mini.dropdown-toggle {padding-left: 5px; padding-right: 5px;}.btn-group > .btn-small.dropdown-toggle {*padding-top: 4px; *padding-bottom: 4px;}.btn-group > .btn-large.dropdown-toggle {padding-left: 12px; padding-right: 12px;}.btn-group.open .dropdown-toggle {background-image: none; -webkit-box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05); -moz-box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05); box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);}.btn-group.open .btn.dropdown-toggle {background-color: #e6e6e6;}.btn-group.open .btn-primary.dropdown-toggle {background-color: #0055cc;}.btn-group.open .btn-warning.dropdown-toggle {background-color: #f89406;}.btn-group.open .btn-danger.dropdown-toggle {background-color: #bd362f;}.btn-group.open .btn-success.dropdown-toggle {background-color: #51a351;}.btn-group.open .btn-info.dropdown-toggle {background-color: #2f96b4;}.btn-group.open .btn-inverse.dropdown-toggle {background-color: #222222;}.btn .caret {margin-top: 7px; margin-left: 0;}.btn:hover .caret,.open.btn-group .caret {opacity: 1; filter: alpha(opacity=100);}.btn-mini .caret {margin-top: 5px;}.btn-small .caret {margin-top: 6px;}.btn-large .caret {margin-top: 6px; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px;}.dropup .btn-large .caret {border-bottom: 5px solid #000000; border-top: 0;}.btn-primary .caret,.btn-warning .caret,.btn-danger .caret,.btn-info .caret,.btn-success .caret,.btn-inverse .caret {border-top-color: #ffffff; border-bottom-color: #ffffff; opacity: 0.75; filter: alpha(opacity=75);}.alert {padding: 8px 35px 8px 14px; margin-bottom: 18px; 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; color: #c09853;}.alert-heading {color: inherit;}.alert .close {position: relative; top: -2px; right: -21px; line-height: 18px;}.alert-success {background-color: #dff0d8; border-color: #d6e9c6; color: #468847;}.alert-danger,.alert-error {background-color: #f2dede; border-color: #eed3d7; color: #b94a48;}.alert-info {background-color: #d9edf7; border-color: #bce8f1; color: #3a87ad;}.alert-block {padding-top: 14px; padding-bottom: 14px;}.alert-block > p,.alert-block > ul {margin-bottom: 0;}.alert-block p + p {margin-top: 5px;}.nav {margin-left: 0; margin-bottom: 18px; list-style: none;}.nav > li > a {display: block;}.nav > li > a:hover {text-decoration: none; background-color: #eeeeee;}.nav > .pull-right {float: right;}.nav .nav-header {display: block; padding: 3px 15px; font-size: 11px; font-weight: bold; line-height: 18px; color: #999999; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); text-transform: uppercase;}.nav li + .nav-header {margin-top: 9px;}.nav-list {padding-left: 15px; padding-right: 15px; margin-bottom: 0;}.nav-list > li > a,.nav-list .nav-header {margin-left: -15px; margin-right: -15px; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);}.nav-list > li > a {padding: 3px 15px;}.nav-list > .active > a,.nav-list > .active > a:hover {color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); background-color: #0088cc;}.nav-list [class^="icon-"] {margin-right: 2px;}.nav-list .divider {*width: 100%; height: 1px; margin: 8px 1px; *margin: -5px 0 5px; overflow: hidden; background-color: #e5e5e5; border-bottom: 1px solid #ffffff;}.nav-tabs,.nav-pills {*zoom: 1;}.nav-tabs:before,.nav-pills:before,.nav-tabs:after,.nav-pills:after {display: table; content: "";}.nav-tabs:after,.nav-pills:after {clear: both;}.nav-tabs > li,.nav-pills > li {float: left;}.nav-tabs > li > a,.nav-pills > li > a {padding-right: 12px; padding-left: 12px; margin-right: 2px; line-height: 14px;}.nav-tabs {border-bottom: 1px solid #ddd;}.nav-tabs > li {margin-bottom: -1px;}.nav-tabs > li > a {padding-top: 8px; padding-bottom: 8px; line-height: 18px; border: 1px solid transparent; -webkit-border-radius: 4px 4px 0 0; -moz-border-radius: 4px 4px 0 0; border-radius: 4px 4px 0 0;}.nav-tabs > li > a:hover {border-color: #eeeeee #eeeeee #dddddd;}.nav-tabs > .active > a,.nav-tabs > .active > a:hover {color: #555555; background-color: #ffffff; border: 1px solid #ddd; border-bottom-color: transparent; cursor: default;}.nav-pills > li > a {padding-top: 8px; padding-bottom: 8px; margin-top: 2px; margin-bottom: 2px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px;}.nav-pills > .active > a,.nav-pills > .active > a:hover {color: #ffffff; background-color: #0088cc;}.nav-stacked > li {float: none;}.nav-stacked > li > a {margin-right: 0;}.nav-tabs.nav-stacked {border-bottom: 0;}.nav-tabs.nav-stacked > li > a {border: 1px solid #ddd; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0;}.nav-tabs.nav-stacked > li:first-child > a {-webkit-border-radius: 4px 4px 0 0; -moz-border-radius: 4px 4px 0 0; border-radius: 4px 4px 0 0;}.nav-tabs.nav-stacked > li:last-child > a {-webkit-border-radius: 0 0 4px 4px; -moz-border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px;}.nav-tabs.nav-stacked > li > a:hover {border-color: #ddd; z-index: 2;}.nav-pills.nav-stacked > li > a {margin-bottom: 3px;}.nav-pills.nav-stacked > li:last-child > a {margin-bottom: 1px;}.nav-tabs .dropdown-menu {-webkit-border-radius: 0 0 5px 5px; -moz-border-radius: 0 0 5px 5px; border-radius: 0 0 5px 5px;}.nav-pills .dropdown-menu {-webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px;}.nav-tabs .dropdown-toggle .caret,.nav-pills .dropdown-toggle .caret {border-top-color: #0088cc; border-bottom-color: #0088cc; margin-top: 6px;}.nav-tabs .dropdown-toggle:hover .caret,.nav-pills .dropdown-toggle:hover .caret {border-top-color: #005580; border-bottom-color: #005580;}.nav-tabs .active .dropdown-toggle .caret,.nav-pills .active .dropdown-toggle .caret {border-top-color: #333333; border-bottom-color: #333333;}.nav > .dropdown.active > a:hover {color: #000000; cursor: pointer;}.nav-tabs .open .dropdown-toggle,.nav-pills .open .dropdown-toggle,.nav > li.dropdown.open.active > a:hover {color: #ffffff; background-color: #999999; border-color: #999999;}.nav li.dropdown.open .caret,.nav li.dropdown.open.active .caret,.nav li.dropdown.open a:hover .caret {border-top-color: #ffffff; border-bottom-color: #ffffff; opacity: 1; filter: alpha(opacity=100);}.tabs-stacked .open > a:hover {border-color: #999999;}.tabbable {*zoom: 1;}.tabbable:before,.tabbable:after {display: table; content: "";}.tabbable:after {clear: both;}.tab-content {overflow: auto;}.tabs-below > .nav-tabs,.tabs-right > .nav-tabs,.tabs-left > .nav-tabs {border-bottom: 0;}.tab-content > .tab-pane,.pill-content > .pill-pane {display: none;}.tab-content > .active,.pill-content > .active {display: block;}.tabs-below > .nav-tabs {border-top: 1px solid #ddd;}.tabs-below > .nav-tabs > li {margin-top: -1px; margin-bottom: 0;}.tabs-below > .nav-tabs > li > a {-webkit-border-radius: 0 0 4px 4px; -moz-border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px;}.tabs-below > .nav-tabs > li > a:hover {border-bottom-color: transparent; border-top-color: #ddd;}.tabs-below > .nav-tabs > .active > a,.tabs-below > .nav-tabs > .active > a:hover {border-color: transparent #ddd #ddd #ddd;}.tabs-left > .nav-tabs > li,.tabs-right > .nav-tabs > li {float: none;}.tabs-left > .nav-tabs > li > a,.tabs-right > .nav-tabs > li > a {min-width: 74px; margin-right: 0; margin-bottom: 3px;}.tabs-left > .nav-tabs {float: left; margin-right: 19px; border-right: 1px solid #ddd;}.tabs-left > .nav-tabs > li > a {margin-right: -1px; -webkit-border-radius: 4px 0 0 4px; -moz-border-radius: 4px 0 0 4px; border-radius: 4px 0 0 4px;}.tabs-left > .nav-tabs > li > a:hover {border-color: #eeeeee #dddddd #eeeeee #eeeeee;}.tabs-left > .nav-tabs .active > a,.tabs-left > .nav-tabs .active > a:hover {border-color: #ddd transparent #ddd #ddd; *border-right-color: #ffffff;}.tabs-right > .nav-tabs {float: right; margin-left: 19px; border-left: 1px solid #ddd;}.tabs-right > .nav-tabs > li > a {margin-left: -1px; -webkit-border-radius: 0 4px 4px 0; -moz-border-radius: 0 4px 4px 0; border-radius: 0 4px 4px 0;}.tabs-right > .nav-tabs > li > a:hover {border-color: #eeeeee #eeeeee #eeeeee #dddddd;}.tabs-right > .nav-tabs .active > a,.tabs-right > .nav-tabs .active > a:hover {border-color: #ddd #ddd #ddd transparent; *border-left-color: #ffffff;}.navbar {*position: relative; *z-index: 2; overflow: visible; margin-bottom: 18px;}.navbar-inner {min-height: 40px; padding-left: 20px; padding-right: 20px; background-color: #2c2c2c; background-image: -moz-linear-gradient(top, #333333, #222222); background-image: -ms-linear-gradient(top, #333333, #222222); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#333333), to(#222222)); background-image: -webkit-linear-gradient(top, #333333, #222222); background-image: -o-linear-gradient(top, #333333, #222222); background-image: linear-gradient(top, #333333, #222222); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0); -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; -webkit-box-shadow: 0 1px 3px rgba(0,0,0,.25), inset 0 -1px 0 rgba(0,0,0,.1); -moz-box-shadow: 0 1px 3px rgba(0,0,0,.25), inset 0 -1px 0 rgba(0,0,0,.1); box-shadow: 0 1px 3px rgba(0,0,0,.25), inset 0 -1px 0 rgba(0,0,0,.1);}.navbar .container {width: auto;}.nav-collapse.collapse {height: auto;}.navbar {color: #999999;}.navbar .brand:hover {text-decoration: none;}.navbar .brand {float: left; display: block; padding: 8px 20px 12px; margin-left: -20px; font-size: 20px; font-weight: 200; line-height: 1; color: #999999;}.navbar .navbar-text {margin-bottom: 0; line-height: 40px;}.navbar .navbar-link {color: #999999;}.navbar .navbar-link:hover {color: #ffffff;}.navbar .btn,.navbar .btn-group {margin-top: 5px;}.navbar .btn-group .btn {margin: 0;}.navbar-form {margin-bottom: 0; *zoom: 1;}.navbar-form:before,.navbar-form:after {display: table; content: "";}.navbar-form:after {clear: both;}.navbar-form input,.navbar-form select,.navbar-form .radio,.navbar-form .checkbox {margin-top: 5px;}.navbar-form input,.navbar-form select {display: inline-block; margin-bottom: 0;}.navbar-form input[type="image"],.navbar-form input[type="checkbox"],.navbar-form input[type="radio"] {margin-top: 3px;}.navbar-form .input-append,.navbar-form .input-prepend {margin-top: 6px; white-space: nowrap;}.navbar-form .input-append input,.navbar-form .input-prepend input {margin-top: 0;}.navbar-search {position: relative; float: left; margin-top: 6px; margin-bottom: 0;}.navbar-search .search-query {padding: 4px 9px; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 1; color: #ffffff; background-color: #626262; border: 1px solid #151515; -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15); -moz-box-shadow: inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15); box-shadow: inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15); -webkit-transition: none; -moz-transition: none; -ms-transition: none; -o-transition: none; transition: none;}.navbar-search .search-query:-moz-placeholder {color: #cccccc;}.navbar-search .search-query:-ms-input-placeholder {color: #cccccc;}.navbar-search .search-query::-webkit-input-placeholder {color: #cccccc;}.navbar-search .search-query:focus,.navbar-search .search-query.focused {padding: 5px 10px; color: #333333; text-shadow: 0 1px 0 #ffffff; background-color: #ffffff; border: 0; -webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); -moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); outline: 0;}.navbar-fixed-top,.navbar-fixed-bottom {position: fixed; right: 0; left: 0; z-index: 1030; margin-bottom: 0;}.navbar-fixed-top .navbar-inner,.navbar-fixed-bottom .navbar-inner {padding-left: 0; padding-right: 0; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0;}.navbar-fixed-top .container,.navbar-fixed-bottom .container {width: 940px;}.navbar-fixed-top {top: 0;}.navbar-fixed-bottom {bottom: 0;}.navbar .nav {position: relative; left: 0; display: block; float: left; margin: 0 10px 0 0;}.navbar .nav.pull-right {float: right;}.navbar .nav > li {display: block; float: left;}.navbar .nav > li > a {float: none; padding: 9px 10px 11px; line-height: 19px; color: #999999; text-decoration: none; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);}.navbar .btn {display: inline-block; padding: 4px 10px 4px; margin: 5px 5px 6px; line-height: 18px;}.navbar .btn-group {margin: 0; padding: 5px 5px 6px;}.navbar .nav > li > a:hover {background-color: transparent; color: #ffffff; text-decoration: none;}.navbar .nav .active > a,.navbar .nav .active > a:hover {color: #ffffff; text-decoration: none; background-color: #222222;}.navbar .divider-vertical {height: 40px; width: 1px; margin: 0 9px; overflow: hidden; background-color: #222222; border-right: 1px solid #333333;}.navbar .nav.pull-right {margin-left: 10px; margin-right: 0;}.navbar .btn-navbar {display: none; float: right; padding: 7px 10px; margin-left: 5px; margin-right: 5px; background-color: #2c2c2c; background-image: -moz-linear-gradient(top, #333333, #222222); background-image: -ms-linear-gradient(top, #333333, #222222); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#333333), to(#222222)); background-image: -webkit-linear-gradient(top, #333333, #222222); background-image: -o-linear-gradient(top, #333333, #222222); background-image: linear-gradient(top, #333333, #222222); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0); border-color: #222222 #222222 #000000; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #222222; filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075); -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075); box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075);}.navbar .btn-navbar:hover,.navbar .btn-navbar:active,.navbar .btn-navbar.active,.navbar .btn-navbar.disabled,.navbar .btn-navbar[disabled] {background-color: #222222; *background-color: #151515;}.navbar .btn-navbar:active,.navbar .btn-navbar.active {background-color: #080808 \9;}.navbar .btn-navbar .icon-bar {display: block; width: 18px; height: 2px; background-color: #f5f5f5; -webkit-border-radius: 1px; -moz-border-radius: 1px; border-radius: 1px; -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); -moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);}.btn-navbar .icon-bar + .icon-bar {margin-top: 3px;}.navbar .dropdown-menu:before {content: ''; display: inline-block; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 7px solid #ccc; border-bottom-color: rgba(0, 0, 0, 0.2); position: absolute; top: -7px; left: 9px;}.navbar .dropdown-menu:after {content: ''; display: inline-block; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 6px solid #ffffff; position: absolute; top: -6px; left: 10px;}.navbar-fixed-bottom .dropdown-menu:before {border-top: 7px solid #ccc; border-top-color: rgba(0, 0, 0, 0.2); border-bottom: 0; bottom: -7px; top: auto;}.navbar-fixed-bottom .dropdown-menu:after {border-top: 6px solid #ffffff; border-bottom: 0; bottom: -6px; top: auto;}.navbar .nav li.dropdown .dropdown-toggle .caret,.navbar .nav li.dropdown.open .caret {border-top-color: #ffffff; border-bottom-color: #ffffff;}.navbar .nav li.dropdown.active .caret {opacity: 1; filter: alpha(opacity=100);}.navbar .nav li.dropdown.open > .dropdown-toggle,.navbar .nav li.dropdown.active > .dropdown-toggle,.navbar .nav li.dropdown.open.active > .dropdown-toggle {background-color: transparent;}.navbar .nav li.dropdown.active > .dropdown-toggle:hover {color: #ffffff;}.navbar .pull-right .dropdown-menu,.navbar .dropdown-menu.pull-right {left: auto; right: 0;}.navbar .pull-right .dropdown-menu:before,.navbar .dropdown-menu.pull-right:before {left: auto; right: 12px;}.navbar .pull-right .dropdown-menu:after,.navbar .dropdown-menu.pull-right:after {left: auto; right: 13px;}.breadcrumb {padding: 7px 14px; margin: 0 0 18px; list-style: none; background-color: #fbfbfb; background-image: -moz-linear-gradient(top, #ffffff, #f5f5f5); background-image: -ms-linear-gradient(top, #ffffff, #f5f5f5); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#f5f5f5)); background-image: -webkit-linear-gradient(top, #ffffff, #f5f5f5); background-image: -o-linear-gradient(top, #ffffff, #f5f5f5); background-image: linear-gradient(top, #ffffff, #f5f5f5); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f5f5f5', GradientType=0); border: 1px solid #ddd; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; -webkit-box-shadow: inset 0 1px 0 #ffffff; -moz-box-shadow: inset 0 1px 0 #ffffff; box-shadow: inset 0 1px 0 #ffffff;}.breadcrumb li {display: inline-block; *display: inline; *zoom: 1; text-shadow: 0 1px 0 #ffffff;}.breadcrumb .divider {padding: 0 5px; color: #999999;}.breadcrumb .active a {color: #333333;}.pagination {height: 36px; margin: 18px 0;}.pagination ul {display: inline-block; *display: inline; *zoom: 1; margin-left: 0; margin-bottom: 0; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);}.pagination li {display: inline;}.pagination a {float: left; padding: 0 14px; line-height: 34px; text-decoration: none; border: 1px solid #ddd; border-left-width: 0;}.pagination a:hover,.pagination .active a {background-color: #f5f5f5;}.pagination .active a {color: #999999; cursor: default;}.pagination .disabled span,.pagination .disabled a,.pagination .disabled a:hover {color: #999999; background-color: transparent; cursor: default;}.pagination li:first-child a {border-left-width: 1px; -webkit-border-radius: 3px 0 0 3px; -moz-border-radius: 3px 0 0 3px; border-radius: 3px 0 0 3px;}.pagination li:last-child a {-webkit-border-radius: 0 3px 3px 0; -moz-border-radius: 0 3px 3px 0; border-radius: 0 3px 3px 0;}.pagination-centered {text-align: center;}.pagination-right {text-align: right;}.pager {margin-left: 0; margin-bottom: 18px; list-style: none; text-align: center; *zoom: 1;}.pager:before,.pager:after {display: table; content: "";}.pager:after {clear: both;}.pager li {display: inline;}.pager a {display: inline-block; padding: 5px 14px; background-color: #fff; border: 1px solid #ddd; -webkit-border-radius: 15px; -moz-border-radius: 15px; border-radius: 15px;}.pager a:hover {text-decoration: none; background-color: #f5f5f5;}.pager .next a {float: right;}.pager .previous a {float: left;}.pager .disabled a,.pager .disabled a:hover {color: #999999; background-color: #fff; cursor: default;}.modal-open .dropdown-menu {z-index: 2050;}.modal-open .dropdown.open {*z-index: 2050;}.modal-open .popover {z-index: 2060;}.modal-open .tooltip {z-index: 2070;}.modal-backdrop {position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1040; background-color: #000000;}.modal-backdrop.fade {opacity: 0;}.modal-backdrop,.modal-backdrop.fade.in {opacity: 0.8; filter: alpha(opacity=80);}.modal {position: fixed; top: 50%; left: 50%; z-index: 1050; overflow: auto; width: 560px; margin: -250px 0 0 -280px; background-color: #ffffff; border: 1px solid #999; border: 1px solid rgba(0, 0, 0, 0.3); *border: 1px solid #999; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); -moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); -webkit-background-clip: padding-box; -moz-background-clip: padding-box; background-clip: padding-box;}.modal.fade {-webkit-transition: opacity .3s linear, top .3s ease-out; -moz-transition: opacity .3s linear, top .3s ease-out; -ms-transition: opacity .3s linear, top .3s ease-out; -o-transition: opacity .3s linear, top .3s ease-out; transition: opacity .3s linear, top .3s ease-out; top: -25%;}.modal.fade.in {top: 50%;}.modal-header {padding: 9px 15px; border-bottom: 1px solid #eee;}.modal-header .close {margin-top: 2px;}.modal-body {overflow-y: auto; max-height: 400px; padding: 15px;}.modal-form {margin-bottom: 0;}.modal-footer {padding: 14px 15px 15px; margin-bottom: 0; text-align: right; background-color: #f5f5f5; border-top: 1px solid #ddd; -webkit-border-radius: 0 0 6px 6px; -moz-border-radius: 0 0 6px 6px; border-radius: 0 0 6px 6px; -webkit-box-shadow: inset 0 1px 0 #ffffff; -moz-box-shadow: inset 0 1px 0 #ffffff; box-shadow: inset 0 1px 0 #ffffff; *zoom: 1;}.modal-footer:before,.modal-footer:after {display: table; content: "";}.modal-footer:after {clear: both;}.modal-footer .btn + .btn {margin-left: 5px; margin-bottom: 0;}.modal-footer .btn-group .btn + .btn {margin-left: -1px;}.tooltip {position: absolute; z-index: 1020; display: block; visibility: visible; padding: 5px; font-size: 11px; opacity: 0; filter: alpha(opacity=0);}.tooltip.in {opacity: 0.8; filter: alpha(opacity=80);}.tooltip.top {margin-top: -2px;}.tooltip.right {margin-left: 2px;}.tooltip.bottom {margin-top: 2px;}.tooltip.left {margin-left: -2px;}.tooltip.top .tooltip-arrow {bottom: 0; left: 50%; margin-left: -5px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 5px solid #000000;}.tooltip.left .tooltip-arrow {top: 50%; right: 0; margin-top: -5px; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 5px solid #000000;}.tooltip.bottom .tooltip-arrow {top: 0; left: 50%; margin-left: -5px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 5px solid #000000;}.tooltip.right .tooltip-arrow {top: 50%; left: 0; margin-top: -5px; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-right: 5px solid #000000;}.tooltip-inner {max-width: 200px; padding: 3px 8px; color: #ffffff; text-align: center; text-decoration: none; background-color: #000000; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px;}.tooltip-arrow {position: absolute; width: 0; height: 0;}.popover {position: absolute; top: 0; left: 0; z-index: 1010; display: none; padding: 5px;}.popover.top {margin-top: -5px;}.popover.right {margin-left: 5px;}.popover.bottom {margin-top: 5px;}.popover.left {margin-left: -5px;}.popover.top .arrow {bottom: 0; left: 50%; margin-left: -5px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 5px solid #000000;}.popover.right .arrow {top: 50%; left: 0; margin-top: -5px; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-right: 5px solid #000000;}.popover.bottom .arrow {top: 0; left: 50%; margin-left: -5px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 5px solid #000000;}.popover.left .arrow {top: 50%; right: 0; margin-top: -5px; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 5px solid #000000;}.popover .arrow {position: absolute; width: 0; height: 0;}.popover-inner {padding: 3px; width: 280px; overflow: hidden; background: #000000; background: rgba(0, 0, 0, 0.8); -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); -moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);}.popover-title {padding: 9px 15px; line-height: 1; background-color: #f5f5f5; border-bottom: 1px solid #eee; -webkit-border-radius: 3px 3px 0 0; -moz-border-radius: 3px 3px 0 0; border-radius: 3px 3px 0 0;}.popover-content {padding: 14px; background-color: #ffffff; -webkit-border-radius: 0 0 3px 3px; -moz-border-radius: 0 0 3px 3px; border-radius: 0 0 3px 3px; -webkit-background-clip: padding-box; -moz-background-clip: padding-box; background-clip: padding-box;}.popover-content p,.popover-content ul,.popover-content ol {margin-bottom: 0;}.thumbnails {margin-left: -20px; list-style: none; *zoom: 1;}.thumbnails:before,.thumbnails:after {display: table; content: "";}.thumbnails:after {clear: both;}.row-fluid .thumbnails {margin-left: 0;}.thumbnails > li {float: left; margin-bottom: 18px; margin-left: 20px;}.thumbnail {display: block; padding: 4px; line-height: 1; border: 1px solid #ddd; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075); -moz-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075);}a.thumbnail:hover {border-color: #0088cc; -webkit-box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25); -moz-box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25); box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25);}.thumbnail > img {display: block; max-width: 100%; margin-left: auto; margin-right: auto;}.thumbnail .caption {padding: 9px;}.label,.badge {font-size: 10.998px; font-weight: bold; line-height: 14px; color: #ffffff; vertical-align: baseline; white-space: nowrap; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #999999;}.label {padding: 1px 4px 2px; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px;}.badge {padding: 1px 9px 2px; -webkit-border-radius: 9px; -moz-border-radius: 9px; border-radius: 9px;}a.label:hover,a.badge:hover {color: #ffffff; text-decoration: none; cursor: pointer;}.label-important,.badge-important {background-color: #b94a48;}.label-important[href],.badge-important[href] {background-color: #953b39;}.label-warning,.badge-warning {background-color: #f89406;}.label-warning[href],.badge-warning[href] {background-color: #c67605;}.label-success,.badge-success {background-color: #468847;}.label-success[href],.badge-success[href] {background-color: #356635;}.label-info,.badge-info {background-color: #3a87ad;}.label-info[href],.badge-info[href] {background-color: #2d6987;}.label-inverse,.badge-inverse {background-color: #333333;}.label-inverse[href],.badge-inverse[href] {background-color: #1a1a1a;}@-webkit-keyframes progress-bar-stripes {from {background-position: 40px 0;} to {background-position: 0 0;}}@-moz-keyframes progress-bar-stripes {from {background-position: 40px 0;} to {background-position: 0 0;}}@-ms-keyframes progress-bar-stripes {from {background-position: 40px 0;} to {background-position: 0 0;}}@-o-keyframes progress-bar-stripes {from {background-position: 0 0;} to {background-position: 40px 0;}}@keyframes progress-bar-stripes {from {background-position: 40px 0;} to {background-position: 0 0;}}.progress {overflow: hidden; height: 18px; margin-bottom: 18px; background-color: #f7f7f7; background-image: -moz-linear-gradient(top, #f5f5f5, #f9f9f9); background-image: -ms-linear-gradient(top, #f5f5f5, #f9f9f9); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f5f5f5), to(#f9f9f9)); background-image: -webkit-linear-gradient(top, #f5f5f5, #f9f9f9); background-image: -o-linear-gradient(top, #f5f5f5, #f9f9f9); background-image: linear-gradient(top, #f5f5f5, #f9f9f9); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f5f5f5', endColorstr='#f9f9f9', GradientType=0); -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px;}.progress .bar {width: 0%; height: 18px; color: #ffffff; font-size: 12px; text-align: center; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #0e90d2; background-image: -moz-linear-gradient(top, #149bdf, #0480be); background-image: -ms-linear-gradient(top, #149bdf, #0480be); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#149bdf), to(#0480be)); background-image: -webkit-linear-gradient(top, #149bdf, #0480be); background-image: -o-linear-gradient(top, #149bdf, #0480be); background-image: linear-gradient(top, #149bdf, #0480be); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#149bdf', endColorstr='#0480be', GradientType=0); -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); -moz-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box; -webkit-transition: width 0.6s ease; -moz-transition: width 0.6s ease; -ms-transition: width 0.6s ease; -o-transition: width 0.6s ease; transition: width 0.6s ease;}.progress-striped .bar {background-color: #149bdf; background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); -webkit-background-size: 40px 40px; -moz-background-size: 40px 40px; -o-background-size: 40px 40px; background-size: 40px 40px;}.progress.active .bar {-webkit-animation: progress-bar-stripes 2s linear infinite; -moz-animation: progress-bar-stripes 2s linear infinite; -ms-animation: progress-bar-stripes 2s linear infinite; -o-animation: progress-bar-stripes 2s linear infinite; animation: progress-bar-stripes 2s linear infinite;}.progress-danger .bar {background-color: #dd514c; background-image: -moz-linear-gradient(top, #ee5f5b, #c43c35); background-image: -ms-linear-gradient(top, #ee5f5b, #c43c35); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#c43c35)); background-image: -webkit-linear-gradient(top, #ee5f5b, #c43c35); background-image: -o-linear-gradient(top, #ee5f5b, #c43c35); background-image: linear-gradient(top, #ee5f5b, #c43c35); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ee5f5b', endColorstr='#c43c35', GradientType=0);}.progress-danger.progress-striped .bar {background-color: #ee5f5b; background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);}.progress-success .bar {background-color: #5eb95e; background-image: -moz-linear-gradient(top, #62c462, #57a957); background-image: -ms-linear-gradient(top, #62c462, #57a957); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#57a957)); background-image: -webkit-linear-gradient(top, #62c462, #57a957); background-image: -o-linear-gradient(top, #62c462, #57a957); background-image: linear-gradient(top, #62c462, #57a957); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#57a957', GradientType=0);}.progress-success.progress-striped .bar {background-color: #62c462; background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);}.progress-info .bar {background-color: #4bb1cf; background-image: -moz-linear-gradient(top, #5bc0de, #339bb9); background-image: -ms-linear-gradient(top, #5bc0de, #339bb9); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#339bb9)); background-image: -webkit-linear-gradient(top, #5bc0de, #339bb9); background-image: -o-linear-gradient(top, #5bc0de, #339bb9); background-image: linear-gradient(top, #5bc0de, #339bb9); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5bc0de', endColorstr='#339bb9', GradientType=0);}.progress-info.progress-striped .bar {background-color: #5bc0de; background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);}.progress-warning .bar {background-color: #faa732; background-image: -moz-linear-gradient(top, #fbb450, #f89406); background-image: -ms-linear-gradient(top, #fbb450, #f89406); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406)); background-image: -webkit-linear-gradient(top, #fbb450, #f89406); background-image: -o-linear-gradient(top, #fbb450, #f89406); background-image: linear-gradient(top, #fbb450, #f89406); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fbb450', endColorstr='#f89406', GradientType=0);}.progress-warning.progress-striped .bar {background-color: #fbb450; background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);}.accordion {margin-bottom: 18px;}.accordion-group {margin-bottom: 2px; border: 1px solid #e5e5e5; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px;}.accordion-heading {border-bottom: 0;}.accordion-heading .accordion-toggle {display: block; padding: 8px 15px;}.accordion-toggle {cursor: pointer;}.accordion-inner {padding: 9px 15px; border-top: 1px solid #e5e5e5;}.carousel {position: relative; margin-bottom: 18px; line-height: 1;}.carousel-inner {overflow: hidden; width: 100%; position: relative;}.carousel .item {display: none; position: relative; -webkit-transition: 0.6s ease-in-out left; -moz-transition: 0.6s ease-in-out left; -ms-transition: 0.6s ease-in-out left; -o-transition: 0.6s ease-in-out left; transition: 0.6s ease-in-out left;}.carousel .item > img {display: block; line-height: 1;}.carousel .active,.carousel .next,.carousel .prev {display: block;}.carousel .active {left: 0;}.carousel .next,.carousel .prev {position: absolute; top: 0; width: 100%;}.carousel .next {left: 100%;}.carousel .prev {left: -100%;}.carousel .next.left,.carousel .prev.right {left: 0;}.carousel .active.left {left: -100%;}.carousel .active.right {left: 100%;}.carousel-control {position: absolute; top: 40%; left: 15px; width: 40px; height: 40px; margin-top: -20px; font-size: 60px; font-weight: 100; line-height: 30px; color: #ffffff; text-align: center; background: #222222; border: 3px solid #ffffff; -webkit-border-radius: 23px; -moz-border-radius: 23px; border-radius: 23px; opacity: 0.5; filter: alpha(opacity=50);}.carousel-control.right {left: auto; right: 15px;}.carousel-control:hover {color: #ffffff; text-decoration: none; opacity: 0.9; filter: alpha(opacity=90);}.carousel-caption {position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 15px 5px; background: #333333; background: rgba(0, 0, 0, 0.75);}.carousel-caption h4,.carousel-caption p {color: #ffffff;}.hero-unit {padding: 60px; margin-bottom: 30px; background-color: #eeeeee; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px;}.hero-unit h1 {margin-bottom: 0; font-size: 60px; line-height: 1; color: inherit; letter-spacing: -1px;}.hero-unit p {font-size: 18px; font-weight: 200; line-height: 27px; color: inherit;}.pull-right {float: right;}.pull-left {float: left;}.hide {display: none;}.show {display: block;}.invisible {visibility: hidden;} +/*! * Bootstrap Responsive v2.0.4 * * Copyright 2012 Twitter, Inc * Licensed under the Apache License v2.0 * http://www.apache.org/licenses/LICENSE-2.0 * * Designed and built with all the love in the world @twitter by @mdo and @fat. */.clearfix {*zoom: 1;}.clearfix:before,.clearfix:after {display: table; content: "";}.clearfix:after {clear: both;}.hide-text {font: 0/0 a; color: transparent; text-shadow: none; background-color: transparent; border: 0;}.input-block-level {display: block; width: 100%; min-height: 28px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box;}.hidden {display: none; visibility: hidden;}.visible-phone {display: none !important;}.visible-tablet {display: none !important;}.hidden-desktop {display: none !important;}@media (max-width: 767px) {.visible-phone {display: inherit !important;} .hidden-phone {display: none !important;} .hidden-desktop {display: inherit !important;} .visible-desktop {display: none !important;}}@media (min-width: 768px) and (max-width: 979px) {.visible-tablet {display: inherit !important;} .hidden-tablet {display: none !important;} .hidden-desktop {display: inherit !important;} .visible-desktop {display: none !important ;}}@media (max-width: 480px) {.nav-collapse {-webkit-transform: translate3d(0, 0, 0);} .page-header h1 small {display: block; line-height: 18px;} input[type="checkbox"], input[type="radio"] {border: 1px solid #ccc;} .form-horizontal .control-group > label {float: none; width: auto; padding-top: 0; text-align: left;} .form-horizontal .controls {margin-left: 0;} .form-horizontal .control-list {padding-top: 0;} .form-horizontal .form-actions {padding-left: 10px; padding-right: 10px;} .modal {position: absolute; top: 10px; left: 10px; right: 10px; width: auto; margin: 0;} .modal.fade.in {top: auto;} .modal-header .close {padding: 10px; margin: -10px;} .carousel-caption {position: static;}}@media (max-width: 767px) {body {padding-left: 20px; padding-right: 20px;} .navbar-fixed-top, .navbar-fixed-bottom {margin-left: -20px; margin-right: -20px;} .container-fluid {padding: 0;} .dl-horizontal dt {float: none; clear: none; width: auto; text-align: left;} .dl-horizontal dd {margin-left: 0;} .container {width: auto;} .row-fluid {width: 100%;} .row, .thumbnails {margin-left: 0;} [class*="span"], .row-fluid [class*="span"] {float: none; display: block; width: auto; margin-left: 0;} .input-large, .input-xlarge, .input-xxlarge, input[class*="span"], select[class*="span"], textarea[class*="span"], .uneditable-input {display: block; width: 100%; min-height: 28px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box;} .input-prepend input, .input-append input, .input-prepend input[class*="span"], .input-append input[class*="span"] {display: inline-block; width: auto;}}@media (min-width: 768px) and (max-width: 979px) {.row {margin-left: -20px; *zoom: 1;} .row:before, .row:after {display: table; content: "";} .row:after {clear: both;} [class*="span"] {float: left; margin-left: 20px;} .container, .navbar-fixed-top .container, .navbar-fixed-bottom .container {width: 724px;} .span12 {width: 724px;} .span11 {width: 662px;} .span10 {width: 600px;} .span9 {width: 538px;} .span8 {width: 476px;} .span7 {width: 414px;} .span6 {width: 352px;} .span5 {width: 290px;} .span4 {width: 228px;} .span3 {width: 166px;} .span2 {width: 104px;} .span1 {width: 42px;} .offset12 {margin-left: 764px;} .offset11 {margin-left: 702px;} .offset10 {margin-left: 640px;} .offset9 {margin-left: 578px;} .offset8 {margin-left: 516px;} .offset7 {margin-left: 454px;} .offset6 {margin-left: 392px;} .offset5 {margin-left: 330px;} .offset4 {margin-left: 268px;} .offset3 {margin-left: 206px;} .offset2 {margin-left: 144px;} .offset1 {margin-left: 82px;} .row-fluid {width: 100%; *zoom: 1;} .row-fluid:before, .row-fluid:after {display: table; content: "";} .row-fluid:after {clear: both;} .row-fluid [class*="span"] {display: block; width: 100%; min-height: 28px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box; float: left; margin-left: 2.762430939%; *margin-left: 2.709239449638298%;} .row-fluid [class*="span"]:first-child {margin-left: 0;} .row-fluid .span12 {width: 99.999999993%; *width: 99.9468085036383%;} .row-fluid .span11 {width: 91.436464082%; *width: 91.38327259263829%;} .row-fluid .span10 {width: 82.87292817100001%; *width: 82.8197366816383%;} .row-fluid .span9 {width: 74.30939226%; *width: 74.25620077063829%;} .row-fluid .span8 {width: 65.74585634900001%; *width: 65.6926648596383%;} .row-fluid .span7 {width: 57.182320438000005%; *width: 57.129128948638304%;} .row-fluid .span6 {width: 48.618784527%; *width: 48.5655930376383%;} .row-fluid .span5 {width: 40.055248616%; *width: 40.0020571266383%;} .row-fluid .span4 {width: 31.491712705%; *width: 31.4385212156383%;} .row-fluid .span3 {width: 22.928176794%; *width: 22.874985304638297%;} .row-fluid .span2 {width: 14.364640883%; *width: 14.311449393638298%;} .row-fluid .span1 {width: 5.801104972%; *width: 5.747913482638298%;} input, textarea, .uneditable-input {margin-left: 0;} input.span12, textarea.span12, .uneditable-input.span12 {width: 714px;} input.span11, textarea.span11, .uneditable-input.span11 {width: 652px;} input.span10, textarea.span10, .uneditable-input.span10 {width: 590px;} input.span9, textarea.span9, .uneditable-input.span9 {width: 528px;} input.span8, textarea.span8, .uneditable-input.span8 {width: 466px;} input.span7, textarea.span7, .uneditable-input.span7 {width: 404px;} input.span6, textarea.span6, .uneditable-input.span6 {width: 342px;} input.span5, textarea.span5, .uneditable-input.span5 {width: 280px;} input.span4, textarea.span4, .uneditable-input.span4 {width: 218px;} input.span3, textarea.span3, .uneditable-input.span3 {width: 156px;} input.span2, textarea.span2, .uneditable-input.span2 {width: 94px;} input.span1, textarea.span1, .uneditable-input.span1 {width: 32px;}}@media (min-width: 1200px) {.row {margin-left: -30px; *zoom: 1;} .row:before, .row:after {display: table; content: "";} .row:after {clear: both;} [class*="span"] {float: left; margin-left: 30px;} .container, .navbar-fixed-top .container, .navbar-fixed-bottom .container {width: 1170px;} .span12 {width: 1170px;} .span11 {width: 1070px;} .span10 {width: 970px;} .span9 {width: 870px;} .span8 {width: 770px;} .span7 {width: 670px;} .span6 {width: 570px;} .span5 {width: 470px;} .span4 {width: 370px;} .span3 {width: 270px;} .span2 {width: 170px;} .span1 {width: 70px;} .offset12 {margin-left: 1230px;} .offset11 {margin-left: 1130px;} .offset10 {margin-left: 1030px;} .offset9 {margin-left: 930px;} .offset8 {margin-left: 830px;} .offset7 {margin-left: 730px;} .offset6 {margin-left: 630px;} .offset5 {margin-left: 530px;} .offset4 {margin-left: 430px;} .offset3 {margin-left: 330px;} .offset2 {margin-left: 230px;} .offset1 {margin-left: 130px;} .row-fluid {width: 100%; *zoom: 1;} .row-fluid:before, .row-fluid:after {display: table; content: "";} .row-fluid:after {clear: both;} .row-fluid [class*="span"] {display: block; width: 100%; min-height: 28px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box; float: left; margin-left: 2.564102564%; *margin-left: 2.510911074638298%;} .row-fluid [class*="span"]:first-child {margin-left: 0;} .row-fluid .span12 {width: 100%; *width: 99.94680851063829%;} .row-fluid .span11 {width: 91.45299145300001%; *width: 91.3997999636383%;} .row-fluid .span10 {width: 82.905982906%; *width: 82.8527914166383%;} .row-fluid .span9 {width: 74.358974359%; *width: 74.30578286963829%;} .row-fluid .span8 {width: 65.81196581200001%; *width: 65.7587743226383%;} .row-fluid .span7 {width: 57.264957265%; *width: 57.2117657756383%;} .row-fluid .span6 {width: 48.717948718%; *width: 48.6647572286383%;} .row-fluid .span5 {width: 40.170940171000005%; *width: 40.117748681638304%;} .row-fluid .span4 {width: 31.623931624%; *width: 31.5707401346383%;} .row-fluid .span3 {width: 23.076923077%; *width: 23.0237315876383%;} .row-fluid .span2 {width: 14.529914530000001%; *width: 14.4767230406383%;} .row-fluid .span1 {width: 5.982905983%; *width: 5.929714493638298%;} input, textarea, .uneditable-input {margin-left: 0;} input.span12, textarea.span12, .uneditable-input.span12 {width: 1160px;} input.span11, textarea.span11, .uneditable-input.span11 {width: 1060px;} input.span10, textarea.span10, .uneditable-input.span10 {width: 960px;} input.span9, textarea.span9, .uneditable-input.span9 {width: 860px;} input.span8, textarea.span8, .uneditable-input.span8 {width: 760px;} input.span7, textarea.span7, .uneditable-input.span7 {width: 660px;} input.span6, textarea.span6, .uneditable-input.span6 {width: 560px;} input.span5, textarea.span5, .uneditable-input.span5 {width: 460px;} input.span4, textarea.span4, .uneditable-input.span4 {width: 360px;} input.span3, textarea.span3, .uneditable-input.span3 {width: 260px;} input.span2, textarea.span2, .uneditable-input.span2 {width: 160px;} input.span1, textarea.span1, .uneditable-input.span1 {width: 60px;} .thumbnails {margin-left: -30px;} .thumbnails > li {margin-left: 30px;} .row-fluid .thumbnails {margin-left: 0;}}@media (max-width: 979px) {body {padding-top: 0;} .navbar-fixed-top, .navbar-fixed-bottom {position: static;} .navbar-fixed-top {margin-bottom: 18px;} .navbar-fixed-bottom {margin-top: 18px;} .navbar-fixed-top .navbar-inner, .navbar-fixed-bottom .navbar-inner {padding: 5px;} .navbar .container {width: auto; padding: 0;} .navbar .brand {padding-left: 10px; padding-right: 10px; margin: 0 0 0 -5px;} .nav-collapse {clear: both;} .nav-collapse .nav {float: none; margin: 0 0 9px;} .nav-collapse .nav > li {float: none;} .nav-collapse .nav > li > a {margin-bottom: 2px;} .nav-collapse .nav > .divider-vertical {display: none;} .nav-collapse .nav .nav-header {color: #999999; text-shadow: none;} .nav-collapse .nav > li > a, .nav-collapse .dropdown-menu a {padding: 6px 15px; font-weight: bold; color: #999999; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px;} .nav-collapse .btn {padding: 4px 10px 4px; font-weight: normal; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px;} .nav-collapse .dropdown-menu li + li a {margin-bottom: 2px;} .nav-collapse .nav > li > a:hover, .nav-collapse .dropdown-menu a:hover {background-color: #222222;} .nav-collapse.in .btn-group {margin-top: 5px; padding: 0;} .nav-collapse .dropdown-menu {position: static; top: auto; left: auto; float: none; display: block; max-width: none; margin: 0 15px; padding: 0; background-color: transparent; border: none; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none;} .nav-collapse .dropdown-menu:before, .nav-collapse .dropdown-menu:after {display: none;} .nav-collapse .dropdown-menu .divider {display: none;} .nav-collapse .navbar-form, .nav-collapse .navbar-search {float: none; padding: 9px 15px; margin: 9px 0; border-top: 1px solid #222222; border-bottom: 1px solid #222222; -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1); -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1); box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1);} .navbar .nav-collapse .nav.pull-right {float: none; margin-left: 0;} .nav-collapse, .nav-collapse.collapse {overflow: hidden; height: 0;} .navbar .btn-navbar {display: block;} .navbar-static .navbar-inner {padding-left: 10px; padding-right: 10px;}}@media (min-width: 980px) {.nav-collapse.collapse {height: auto !important; overflow: visible !important;}} +@media (max-width: 440px) {#exit_fullscreen span, .helpTip {display: none !important;}}@media (min-width: 480px) and (max-width: 979px) {#db_type_label_collapsed {display: inline !important;}}@media (min-width: 820px) and (max-width: 1024px) {.nav-collapse .pull-right {display: none;}}@media (min-width: 820px) and (max-width: 1100px) {.nav-collapse .pull-right .optional {display: none;}}@media (max-width: 767px) {div.sql {width: 100% !important;} .helpTip {width: 180px !important; height: 30% !important;}}@media (min-width: 768px) and (max-width: 979px) {.helpTip {width: 100px !important; height: 50% !important;}}@media (max-width: 979px) {body {padding-top: 0px !important;} textarea.fullscreen {top: 50px !important;} #paypal_donate {padding-left: 15px;}}body {padding-top: 60px;}#db_type_label_collapsed,#exit_fullscreen {display: none;}#db_type_label_collapsed li {display: inline-block;}textarea.fullscreen {z-index: 10000; height: 100%; width: 100%; position: fixed; top: 40px; left: 0;}.schema {position: relative;}.helpTip {position: absolute; display: none; width: 180px; height: 60%; min-height: 50px; overflow-y: auto; right: 0px; z-index: 1001; margin: 10px 20px;}#browser,.browser_actions {padding-left: 15px; display: none; width: 100%;}#browser {overflow: auto; border: solid thin lightgray;}#sql,#schema_ddl {width: 98%; font-family: monospace; white-space: nowrap; overflow: auto; font-size: 10pt; min-height: 100px;}.tables,.columns {list-style-type: none;}.tables .columns {display: none;}.popover .tables .columns {display: block;}.resultSetWrapper,.schemaPreviewWrapper,.queryLog-hidden {display: none;}.resultSetPreview {list-style-type: none; margin: 0;}.resultSetPreview li {white-space: nowrap;}.resultSetPreview pre {margin-bottom: 2px; overflow-x: hidden; max-height: 75px; overflow-y: hidden; background-color: white;}.resultSetPreview > pre,.schemaPreview > pre {margin-bottom: 2px; overflow-x: hidden; max-height: 200px; overflow-y: hidden; background-color: white;}pre.results,.resultSetPreview li pre {font-family: monospace; font-size: 10pt;}.database-error {white-space: pre-wrap;}#runQueryOptions {min-width: 120px;}#content .panel form textarea {display: block; margin: 0; resize: none;}#content .panel.schema {margin: 0;}#output {margin: 0; height: 50%; clear: both; padding-top: 5px;}#content #output form label {top: 10px;}#schema-output {margin: 0; height: 50%; padding-bottom: 5px;}#content form {margin: 0;}.tab-content .tab-pane {height: 100%;}.database-messages i {margin-right: 5px; opacity: .5;}#fiddleFormDDL {position: relative;}#content .panel form label {z-index: 250;}#fiddleFormDDL label a i {margin: 1px;}.executionPlan {width: 90%; margin-left: 10%; display: none;}.executionPlanLink,.setLink {margin-left: 20px;}.oracle_xplan {margin: 0px; overflow: hidden; width: 800px; height: 600px; border: solid thin black; display: inline-block;}.highlight {border: solid thin blue; margin: 5px;}.action_buttons {margin: 5px 0; padding: 0 10px;}.action_buttons > a,.action_buttons > div {margin-bottom: 3px; vertical-align: top; display: inline-block;}.action_buttons .dropdown-menu {text-align: right;}#content .CodeMirror {border: 1px solid #cccccc; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px;}.CodeMirror-scroll {height: 200px; overflow-y: scroll; overflow-x: auto;}.CodeMirror-fullscreen {display: block; position: fixed; top: 42px; left: 0; width: 100%; height: 100%; z-index: 9999; margin: 0; padding: 0; border: 0px solid #BBBBBB; opacity: 1; background-color: white;}#hosting {display: block; margin: 10px auto 0 auto; text-align: center;}#hosting h4 {text-align: center;}#hostingPartners {padding: 0px; display: inline-block; text-align: left; list-style-type: none;}#hostingPartners li {margin: 20px 0; font-family: sans-serif; font-size: 8pt; height: 50px; display: inline;}#hostingPartners a {display: inline-block; float: left;}#hostingPartners img {height: 90px; margin: 0 auto; text-align: center; display: block; border: none;}#hostingPartners span {float: left; display: block; width: 150px;}.modal {display: none;}#myFiddlesModal {width: 800px; margin: -250px 0 0 -420px;}#myFiddlesModal .modal-body {overflow-y: auto;}#myFiddlesTabs {margin-bottom: 0;}#raw,#parseResults {width: 90%;}#parseResults {height: 60px; overflow: auto;}#openid_identifier {width: 250px; margin: 0px; padding: 2px; padding-left: 20px; vertical-align: middle; background-image: url('http://www.idselector.com/images/openid.ico'); background-repeat: no-repeat; background-position: 3px 2px;}#gravatar {height: 20px; width: 20px; margin: 0 10px 0 5px;}.navbar .nav.pull-right {margin-left: 2px;}.nav-collapse > .nav {margin-right: 2px;}.navbar .brand {padding-left: 10px;}.container-fluid .pull-right {float: right !important;}.nav-collapse.in .pull-right {float: left !important;}.navbar .btn-navbar {background-color: #d6d6d6; background-image: -moz-linear-gradient(top, #ffffff, #999999); background-image: -ms-linear-gradient(top, #ffffff, #999999); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#999999)); background-image: -webkit-linear-gradient(top, #ffffff, #999999); background-image: -o-linear-gradient(top, #ffffff, #999999); background-image: linear-gradient(top, #ffffff, #999999); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#999999', GradientType=0); border-color: #999999 #999999 #737373; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075); -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075);}.btn-navbar:hover,.btn-navbar:active,.btn-navbar.active,.btn-navbar.disabled,.btn-navbar[disabled] {background-color: #999999;}.btn-navbar:active,.btn-navbar.active {background-color: #808080 \9;}.navbar .brand {white-space: nowrap;}.navbar {color: black;}.navbar-inner {background-color: #d6d6d6; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#999999', GradientType=0); background-image: -moz-linear-gradient(top, #ffffff, #999999); background-image: -ms-linear-gradient(top, #ffffff, #999999); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#999999)); background-image: -webkit-linear-gradient(top, #ffffff, #999999); background-image: -o-linear-gradient(top, #ffffff, #999999); background-image: linear-gradient(top, #ffffff, #999999);}.navbar .nav > li > a {color: #333333; text-shadow: none;}.navbar .divider-vertical {background-color: #999; border-right: 1px solid white;}.navbar .nav .active > a,.navbar .nav .active > a:hover {color: #999999; text-decoration: none; background-color: #999999; background-color: rgba(0, 0, 0, 0.5);}.navbar .nav .active > a {color: #eeeeee;}.navbar .nav .active > a:hover {color: #eeeeee;}.navbar .nav > li > a i {margin-right: 5px;}.navbar .brand {color: #000000;}.dropdown-menu a i {margin-right: 5px;}.dropdown-toggle b.caret {color: #999999; opacity: .5;}.dropdown-menu.nav {z-index: 1050 !important;}.dropdown-menu.nav li > a:hover,.dropdown-menu.nav .active > a,.dropdown-menu.nav .active > a:hover {color: #ffffff; text-decoration: none; background-color: #0088cc;}.form-horizontal .control-group {margin-bottom: 6px;}.modal form {margin: 0;}.popover-inner {min-width: 280px; width: auto; overflow-x: visible; overflow-y: hidden; max-height: 400px;}.popover-inner .alert {max-width: 400px; overflow-x: hidden;}#sidebar .well {padding: 8px 0;}#content {height: 100%;}#content .panel {margin: 0;}#content .panel {min-height: 125px; height: 100%; position: relative;}#content .panel form {height: 100%;} +div.qp-node{background-color: #FFFFCC; margin: 2px; padding: 2px; border: 1px solid black; font-size: 11px; line-height: normal;}.qp-node > div{font-family: Monospace; text-align: center;}div[class|='qp-icon']{height: 32px; width: 32px; margin-left: auto; margin-right: auto; background-repeat: no-repeat;}.qp-tt{top: 4em; left: 2em; border: 1px solid black; background-color: #FFFFEE; padding: 2px;}.qp-tt div, .qp-tt table{font-family: Sans-Serif; text-align: left;}.qp-tt table{border-width: 0px; border-spacing: 0px; margin-top: 10px; margin-bottom: 10px; width: 100%;}.qp-tt td, .qp-tt th{font-size: 11px; border-bottom: solid 1px Black; padding: 1px;}.qp-tt td{text-align: right; padding-left: 10px;}.qp-tt th{text-align: left;}.qp-bold, .qp-tt-header{font-weight: bold;}.qp-tt-header{text-align: center;}.qp-icon-Catchall{background-image:url('../images/qp/bitmap.gif')}.qp-icon-ArithmeticExpression{background-image:url('../images/qp/arithmetic_expression.gif')}.qp-icon-Assert{background-image:url('../images/qp/assert.gif')}.qp-icon-Assign{background-image:url('../images/qp/assign.gif')}.qp-icon-Bitmap{background-image:url('../images/qp/bitmap.gif')}.qp-icon-BookmarkLookup{background-image:url('../images/qp/bookmark_lookup.gif')}.qp-icon-ClusteredIndexDelete{background-image:url('../images/qp/clustered_index_delete.gif')}.qp-icon-ClusteredIndexInsert{background-image:url('../images/qp/clustered_index_insert.gif')}.qp-icon-ClusteredIndexScan{background-image:url('../images/qp/clustered_index_scan.gif')}.qp-icon-ClusteredIndexSeek{background-image:url('../images/qp/clustered_index_seek.gif')}.qp-icon-ClusteredIndexUpdate{background-image:url('../images/qp/clustered_index_update.gif')}.qp-icon-Collapse{background-image:url('../images/qp/collapse.gif')}.qp-icon-ComputeScalar{background-image:url('../images/qp/compute_scalar.gif')}.qp-icon-Concatenation{background-image:url('../images/qp/concatenation.gif')}.qp-icon-ConstantScan{background-image:url('../images/qp/constant_scan.gif')}.qp-icon-Convert{background-image:url('../images/qp/convert.gif')}.qp-icon-CursorCatchall{background-image:url('../images/qp/bitmap.gif')}.qp-icon-Declare{background-image:url('../images/qp/declare.gif')}.qp-icon-Delete{background-image:url('../images/qp/table_delete.gif')}.qp-icon-DistributeStreams{background-image:url('../images/qp/distribute_streams.gif')}.qp-icon-Dynamic{background-image:url('../images/qp/dynamic.gif')}.qp-icon-EagerSpool{background-image:url('../images/qp/spool.gif')}.qp-icon-FetchQuery{background-image:url('../images/qp/fetch_query.gif')}.qp-icon-Filter{background-image:url('../images/qp/filter.gif')}.qp-icon-GatherStreams{background-image:url('../images/qp/gather_streams.gif')}.qp-icon-HashMatch{background-image:url('../images/qp/hash_match.gif')}.qp-icon-HashMatchRoot{background-image:url('../images/qp/hash_match.gif')}.qp-icon-HashMatchTeam{background-image:url('../images/qp/hash_match.gif')}.qp-icon-If{background-image:url('../images/qp/if.gif')}.qp-icon-Insert{background-image:url('../images/qp/table_insert.gif')}.qp-icon-InsertedScan{background-image:url('../images/qp/inserted_scan.gif')}.qp-icon-Intrinsic{background-image:url('../images/qp/intrinsic.gif')}.qp-icon-IteratorCatchall{background-image:url('../images/qp/bitmap.gif')}.qp-icon-Keyset{background-image:url('../images/qp/keyset.gif')}.qp-icon-LanguageElementCatchall{background-image:url('../images/qp/bitmap.gif')}.qp-icon-LazySpool{background-image:url('../images/qp/spool.gif')}.qp-icon-LogRowScan{background-image:url('../images/qp/log_row_scan.gif')}.qp-icon-MergeInterval{background-image:url('../images/qp/merge_interval.gif')}.qp-icon-MergeJoin{background-image:url('../images/qp/merge_join.gif')}.qp-icon-NestedLoops{background-image:url('../images/qp/nested_loops.gif')}.qp-icon-NonclusteredIndexDelete{background-image:url('../images/qp/nonclustered_index_delete.gif')}.qp-icon-NonclusteredIndexInsert{background-image:url('../images/qp/nonclustered_index_insert.gif')}.qp-icon-NonclusteredIndexScan{background-image:url('../images/qp/nonclustered_index_scan.gif')}.qp-icon-IndexSeek{background-image:url('../images/qp/nonclustered_index_seek.gif')}.qp-icon-NonclusteredIndexSpool{background-image:url('../images/qp/nonclustered_index_spool.gif')}.qp-icon-NonclusteredIndexUpdate{background-image:url('../images/qp/nonclustered_index_update.gif')}.qp-icon-OnlineIndexInsert{background-image:url('../images/qp/online_index_insert.gif')}.qp-icon-ParameterTableScan{background-image:url('../images/qp/parameter_table_scan.gif')}.qp-icon-PopulationQuery{background-image:url('../images/qp/population_query.gif')}.qp-icon-RdiLookup{background-image:url('../images/qp/rdi_lookup.gif')}.qp-icon-RefreshQuery{background-image:url('../images/qp/refresh_query.gif')}.qp-icon-RemoteDelete{background-image:url('../images/qp/remote_delete.gif')}.qp-icon-RemoteInsert{background-image:url('../images/qp/remote_insert.gif')}.qp-icon-RemoteQuery{background-image:url('../images/qp/remote_query.gif')}.qp-icon-RemoteScan{background-image:url('../images/qp/remote_scan.gif')}.qp-icon-RemoteUpdate{background-image:url('../images/qp/remote_update.gif')}.qp-icon-RepartitionStreams{background-image:url('../images/qp/repartition_streams.gif')}.qp-icon-Result{background-image:url('../images/qp/result.gif')}.qp-icon-RowCountSpool{background-image:url('../images/qp/row_count_spool.gif')}.qp-icon-Segment{background-image:url('../images/qp/segment.gif')}.qp-icon-Sequence{background-image:url('../images/qp/sequence.gif')}.qp-icon-Sequenceproject{background-image:url('../images/qp/sequenceproject.gif')}.qp-icon-Snapshot{background-image:url('../images/qp/snapshot.gif')}.qp-icon-Sort{background-image:url('../images/qp/sort.gif')}.qp-icon-Split{background-image:url('../images/qp/split.gif')}.qp-icon-Spool{background-image:url('../images/qp/spool.gif')}.qp-icon-Statement{background-image:url('../images/qp/result.gif')}.qp-icon-StreamAggregate{background-image:url('../images/qp/stream_aggregate.gif')}.qp-icon-Switch{background-image:url('../images/qp/switch.gif')}.qp-icon-TableDelete{background-image:url('../images/qp/table_delete.gif')}.qp-icon-TableInsert{background-image:url('../images/qp/table_insert.gif')}.qp-icon-TableScan{background-image:url('../images/qp/table_scan.gif')}.qp-icon-TableSpool{background-image:url('../images/qp/table_spool.gif')}.qp-icon-TableUpdate{background-image:url('../images/qp/table_update.gif')}.qp-icon-TableValuedFunction{background-image:url('../images/qp/table_valued_function.gif')}.qp-icon-Top{background-image:url('../images/qp/top.gif')}.qp-icon-Udx{background-image:url('../images/qp/udx.gif')}.qp-icon-Update{background-image:url('../images/qp/table_update.gif.gif')}.qp-icon-While{background-image:url('../images/qp/while.gif')}.qp-tt{position: absolute; display: none; z-index: 1; white-space: normal;}div.qp-node:hover .qp-tt{display: block;}.qp-tt table{white-space: nowrap;}.qp-node{position: relative; white-space: nowrap;}.qp-tr{display: table;}.qp-tr > div{display: table-cell; padding-left: 15px;}.qp-tr canvas,.qp-root canvas {height: 100%;} diff --git a/src/main/webapp/stylesheets_min/bootstrap-2.0.4/bootstrap.css b/src/main/webapp/stylesheets_min/bootstrap-2.0.4/bootstrap.css new file mode 100644 index 0000000..b338941 --- /dev/null +++ b/src/main/webapp/stylesheets_min/bootstrap-2.0.4/bootstrap.css @@ -0,0 +1 @@ +/*! * Bootstrap v2.0.4 * * Copyright 2012 Twitter, Inc * Licensed under the Apache License v2.0 * http://www.apache.org/licenses/LICENSE-2.0 * * Designed and built with all the love in the world @twitter by @mdo and @fat. */article,aside,details,figcaption,figure,footer,header,hgroup,nav,section {display: block;}audio,canvas,video {display: inline-block; *display: inline; *zoom: 1;}audio:not([controls]) {display: none;}html {font-size: 100%; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%;}a:focus {outline: thin dotted #333; outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px;}a:hover,a:active {outline: 0;}sub,sup {position: relative; font-size: 75%; line-height: 0; vertical-align: baseline;}sup {top: -0.5em;}sub {bottom: -0.25em;}img {max-width: 100%; vertical-align: middle; border: 0; -ms-interpolation-mode: bicubic;}#map_canvas img {max-width: none;}button,input,select,textarea {margin: 0; font-size: 100%; vertical-align: middle;}button,input {*overflow: visible; line-height: normal;}button::-moz-focus-inner,input::-moz-focus-inner {padding: 0; border: 0;}button,input[type="button"],input[type="reset"],input[type="submit"] {cursor: pointer; -webkit-appearance: button;}input[type="search"] {-webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; -webkit-appearance: textfield;}input[type="search"]::-webkit-search-decoration,input[type="search"]::-webkit-search-cancel-button {-webkit-appearance: none;}textarea {overflow: auto; vertical-align: top;}.clearfix {*zoom: 1;}.clearfix:before,.clearfix:after {display: table; content: "";}.clearfix:after {clear: both;}.hide-text {font: 0/0 a; color: transparent; text-shadow: none; background-color: transparent; border: 0;}.input-block-level {display: block; width: 100%; min-height: 28px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box;}body {margin: 0; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; color: #333333; background-color: #ffffff;}a {color: #0088cc; text-decoration: none;}a:hover {color: #005580; text-decoration: underline;}.row {margin-left: -20px; *zoom: 1;}.row:before,.row:after {display: table; content: "";}.row:after {clear: both;}[class*="span"] {float: left; margin-left: 20px;}.container,.navbar-fixed-top .container,.navbar-fixed-bottom .container {width: 940px;}.span12 {width: 940px;}.span11 {width: 860px;}.span10 {width: 780px;}.span9 {width: 700px;}.span8 {width: 620px;}.span7 {width: 540px;}.span6 {width: 460px;}.span5 {width: 380px;}.span4 {width: 300px;}.span3 {width: 220px;}.span2 {width: 140px;}.span1 {width: 60px;}.offset12 {margin-left: 980px;}.offset11 {margin-left: 900px;}.offset10 {margin-left: 820px;}.offset9 {margin-left: 740px;}.offset8 {margin-left: 660px;}.offset7 {margin-left: 580px;}.offset6 {margin-left: 500px;}.offset5 {margin-left: 420px;}.offset4 {margin-left: 340px;}.offset3 {margin-left: 260px;}.offset2 {margin-left: 180px;}.offset1 {margin-left: 100px;}.row-fluid {width: 100%; *zoom: 1;}.row-fluid:before,.row-fluid:after {display: table; content: "";}.row-fluid:after {clear: both;}.row-fluid [class*="span"] {display: block; width: 100%; min-height: 28px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box; float: left; margin-left: 2.127659574%; *margin-left: 2.0744680846382977%;}.row-fluid [class*="span"]:first-child {margin-left: 0;}.row-fluid .span12 {width: 99.99999998999999%; *width: 99.94680850063828%;}.row-fluid .span11 {width: 91.489361693%; *width: 91.4361702036383%;}.row-fluid .span10 {width: 82.97872339599999%; *width: 82.92553190663828%;}.row-fluid .span9 {width: 74.468085099%; *width: 74.4148936096383%;}.row-fluid .span8 {width: 65.95744680199999%; *width: 65.90425531263828%;}.row-fluid .span7 {width: 57.446808505%; *width: 57.3936170156383%;}.row-fluid .span6 {width: 48.93617020799999%; *width: 48.88297871863829%;}.row-fluid .span5 {width: 40.425531911%; *width: 40.3723404216383%;}.row-fluid .span4 {width: 31.914893614%; *width: 31.8617021246383%;}.row-fluid .span3 {width: 23.404255317%; *width: 23.3510638276383%;}.row-fluid .span2 {width: 14.89361702%; *width: 14.8404255306383%;}.row-fluid .span1 {width: 6.382978723%; *width: 6.329787233638298%;}.container {margin-right: auto; margin-left: auto; *zoom: 1;}.container:before,.container:after {display: table; content: "";}.container:after {clear: both;}.container-fluid {padding-right: 20px; padding-left: 20px; *zoom: 1;}.container-fluid:before,.container-fluid:after {display: table; content: "";}.container-fluid:after {clear: both;}p {margin: 0 0 9px;}p small {font-size: 11px; color: #999999;}.lead {margin-bottom: 18px; font-size: 20px; font-weight: 200; line-height: 27px;}h1,h2,h3,h4,h5,h6 {margin: 0; font-family: inherit; font-weight: bold; color: inherit; text-rendering: optimizelegibility;}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small {font-weight: normal; color: #999999;}h1 {font-size: 30px; line-height: 36px;}h1 small {font-size: 18px;}h2 {font-size: 24px; line-height: 36px;}h2 small {font-size: 18px;}h3 {font-size: 18px; line-height: 27px;}h3 small {font-size: 14px;}h4,h5,h6 {line-height: 18px;}h4 {font-size: 14px;}h4 small {font-size: 12px;}h5 {font-size: 12px;}h6 {font-size: 11px; color: #999999; text-transform: uppercase;}.page-header {padding-bottom: 17px; margin: 18px 0; border-bottom: 1px solid #eeeeee;}.page-header h1 {line-height: 1;}ul,ol {padding: 0; margin: 0 0 9px 25px;}ul ul,ul ol,ol ol,ol ul {margin-bottom: 0;}ul {list-style: disc;}ol {list-style: decimal;}li {line-height: 18px;}ul.unstyled,ol.unstyled {margin-left: 0; list-style: none;}dl {margin-bottom: 18px;}dt,dd {line-height: 18px;}dt {font-weight: bold; line-height: 17px;}dd {margin-left: 9px;}.dl-horizontal dt {float: left; width: 120px; clear: left; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}.dl-horizontal dd {margin-left: 130px;}hr {margin: 18px 0; border: 0; border-top: 1px solid #eeeeee; border-bottom: 1px solid #ffffff;}strong {font-weight: bold;}em {font-style: italic;}.muted {color: #999999;}abbr[title] {cursor: help; border-bottom: 1px dotted #999999;}abbr.initialism {font-size: 90%; text-transform: uppercase;}blockquote {padding: 0 0 0 15px; margin: 0 0 18px; border-left: 5px solid #eeeeee;}blockquote p {margin-bottom: 0; font-size: 16px; font-weight: 300; line-height: 22.5px;}blockquote small {display: block; line-height: 18px; color: #999999;}blockquote small:before {content: '\2014 \00A0';}blockquote.pull-right {float: right; padding-right: 15px; padding-left: 0; border-right: 5px solid #eeeeee; border-left: 0;}blockquote.pull-right p,blockquote.pull-right small {text-align: right;}q:before,q:after,blockquote:before,blockquote:after {content: "";}address {display: block; margin-bottom: 18px; font-style: normal; line-height: 18px;}small {font-size: 100%;}cite {font-style: normal;}code,pre {padding: 0 3px 2px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12px; color: #333333; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px;}code {padding: 2px 4px; color: #d14; background-color: #f7f7f9; border: 1px solid #e1e1e8;}pre {display: block; padding: 8.5px; margin: 0 0 9px; font-size: 12.025px; line-height: 18px; word-break: break-all; word-wrap: break-word; white-space: pre; white-space: pre-wrap; background-color: #f5f5f5; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, 0.15); -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px;}pre.prettyprint {margin-bottom: 18px;}pre code {padding: 0; color: inherit; background-color: transparent; border: 0;}.pre-scrollable {max-height: 340px; overflow-y: scroll;}form {margin: 0 0 18px;}fieldset {padding: 0; margin: 0; border: 0;}legend {display: block; width: 100%; padding: 0; margin-bottom: 27px; font-size: 19.5px; line-height: 36px; color: #333333; border: 0; border-bottom: 1px solid #e5e5e5;}legend small {font-size: 13.5px; color: #999999;}label,input,button,select,textarea {font-size: 13px; font-weight: normal; line-height: 18px;}input,button,select,textarea {font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;}label {display: block; margin-bottom: 5px;}select,textarea,input[type="text"],input[type="password"],input[type="datetime"],input[type="datetime-local"],input[type="date"],input[type="month"],input[type="time"],input[type="week"],input[type="number"],input[type="email"],input[type="url"],input[type="search"],input[type="tel"],input[type="color"],.uneditable-input {display: inline-block; height: 18px; padding: 4px; margin-bottom: 9px; font-size: 13px; line-height: 18px; color: #555555;}input,textarea {width: 210px;}textarea {height: auto;}textarea,input[type="text"],input[type="password"],input[type="datetime"],input[type="datetime-local"],input[type="date"],input[type="month"],input[type="time"],input[type="week"],input[type="number"],input[type="email"],input[type="url"],input[type="search"],input[type="tel"],input[type="color"],.uneditable-input {background-color: #ffffff; border: 1px solid #cccccc; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -webkit-transition: border linear 0.2s, box-shadow linear 0.2s; -moz-transition: border linear 0.2s, box-shadow linear 0.2s; -ms-transition: border linear 0.2s, box-shadow linear 0.2s; -o-transition: border linear 0.2s, box-shadow linear 0.2s; transition: border linear 0.2s, box-shadow linear 0.2s;}textarea:focus,input[type="text"]:focus,input[type="password"]:focus,input[type="datetime"]:focus,input[type="datetime-local"]:focus,input[type="date"]:focus,input[type="month"]:focus,input[type="time"]:focus,input[type="week"]:focus,input[type="number"]:focus,input[type="email"]:focus,input[type="url"]:focus,input[type="search"]:focus,input[type="tel"]:focus,input[type="color"]:focus,.uneditable-input:focus {border-color: rgba(82, 168, 236, 0.8); outline: 0; outline: thin dotted \9; -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6); -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6); box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6);}input[type="radio"],input[type="checkbox"] {margin: 3px 0; *margin-top: 0; line-height: normal; cursor: pointer;}input[type="submit"],input[type="reset"],input[type="button"],input[type="radio"],input[type="checkbox"] {width: auto;}.uneditable-textarea {width: auto; height: auto;}select,input[type="file"] {height: 28px; *margin-top: 4px; line-height: 28px;}select {width: 220px; border: 1px solid #bbb;}select[multiple],select[size] {height: auto;}select:focus,input[type="file"]:focus,input[type="radio"]:focus,input[type="checkbox"]:focus {outline: thin dotted #333; outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px;}.radio,.checkbox {min-height: 18px; padding-left: 18px;}.radio input[type="radio"],.checkbox input[type="checkbox"] {float: left; margin-left: -18px;}.controls > .radio:first-child,.controls > .checkbox:first-child {padding-top: 5px;}.radio.inline,.checkbox.inline {display: inline-block; padding-top: 5px; margin-bottom: 0; vertical-align: middle;}.radio.inline + .radio.inline,.checkbox.inline + .checkbox.inline {margin-left: 10px;}.input-mini {width: 60px;}.input-small {width: 90px;}.input-medium {width: 150px;}.input-large {width: 210px;}.input-xlarge {width: 270px;}.input-xxlarge {width: 530px;}input[class*="span"],select[class*="span"],textarea[class*="span"],.uneditable-input[class*="span"],.row-fluid input[class*="span"],.row-fluid select[class*="span"],.row-fluid textarea[class*="span"],.row-fluid .uneditable-input[class*="span"] {float: none; margin-left: 0;}.input-append input[class*="span"],.input-append .uneditable-input[class*="span"],.input-prepend input[class*="span"],.input-prepend .uneditable-input[class*="span"],.row-fluid .input-prepend [class*="span"],.row-fluid .input-append [class*="span"] {display: inline-block;}input,textarea,.uneditable-input {margin-left: 0;}input.span12, textarea.span12, .uneditable-input.span12 {width: 930px;}input.span11, textarea.span11, .uneditable-input.span11 {width: 850px;}input.span10, textarea.span10, .uneditable-input.span10 {width: 770px;}input.span9, textarea.span9, .uneditable-input.span9 {width: 690px;}input.span8, textarea.span8, .uneditable-input.span8 {width: 610px;}input.span7, textarea.span7, .uneditable-input.span7 {width: 530px;}input.span6, textarea.span6, .uneditable-input.span6 {width: 450px;}input.span5, textarea.span5, .uneditable-input.span5 {width: 370px;}input.span4, textarea.span4, .uneditable-input.span4 {width: 290px;}input.span3, textarea.span3, .uneditable-input.span3 {width: 210px;}input.span2, textarea.span2, .uneditable-input.span2 {width: 130px;}input.span1, textarea.span1, .uneditable-input.span1 {width: 50px;}input[disabled],select[disabled],textarea[disabled],input[readonly],select[readonly],textarea[readonly] {cursor: not-allowed; background-color: #eeeeee; border-color: #ddd;}input[type="radio"][disabled],input[type="checkbox"][disabled],input[type="radio"][readonly],input[type="checkbox"][readonly] {background-color: transparent;}.control-group.warning > label,.control-group.warning .help-block,.control-group.warning .help-inline {color: #c09853;}.control-group.warning .checkbox,.control-group.warning .radio,.control-group.warning input,.control-group.warning select,.control-group.warning textarea {color: #c09853; border-color: #c09853;}.control-group.warning .checkbox:focus,.control-group.warning .radio:focus,.control-group.warning input:focus,.control-group.warning select:focus,.control-group.warning textarea:focus {border-color: #a47e3c; -webkit-box-shadow: 0 0 6px #dbc59e; -moz-box-shadow: 0 0 6px #dbc59e; box-shadow: 0 0 6px #dbc59e;}.control-group.warning .input-prepend .add-on,.control-group.warning .input-append .add-on {color: #c09853; background-color: #fcf8e3; border-color: #c09853;}.control-group.error > label,.control-group.error .help-block,.control-group.error .help-inline {color: #b94a48;}.control-group.error .checkbox,.control-group.error .radio,.control-group.error input,.control-group.error select,.control-group.error textarea {color: #b94a48; border-color: #b94a48;}.control-group.error .checkbox:focus,.control-group.error .radio:focus,.control-group.error input:focus,.control-group.error select:focus,.control-group.error textarea:focus {border-color: #953b39; -webkit-box-shadow: 0 0 6px #d59392; -moz-box-shadow: 0 0 6px #d59392; box-shadow: 0 0 6px #d59392;}.control-group.error .input-prepend .add-on,.control-group.error .input-append .add-on {color: #b94a48; background-color: #f2dede; border-color: #b94a48;}.control-group.success > label,.control-group.success .help-block,.control-group.success .help-inline {color: #468847;}.control-group.success .checkbox,.control-group.success .radio,.control-group.success input,.control-group.success select,.control-group.success textarea {color: #468847; border-color: #468847;}.control-group.success .checkbox:focus,.control-group.success .radio:focus,.control-group.success input:focus,.control-group.success select:focus,.control-group.success textarea:focus {border-color: #356635; -webkit-box-shadow: 0 0 6px #7aba7b; -moz-box-shadow: 0 0 6px #7aba7b; box-shadow: 0 0 6px #7aba7b;}.control-group.success .input-prepend .add-on,.control-group.success .input-append .add-on {color: #468847; background-color: #dff0d8; border-color: #468847;}input:focus:required:invalid,textarea:focus:required:invalid,select:focus:required:invalid {color: #b94a48; border-color: #ee5f5b;}input:focus:required:invalid:focus,textarea:focus:required:invalid:focus,select:focus:required:invalid:focus {border-color: #e9322d; -webkit-box-shadow: 0 0 6px #f8b9b7; -moz-box-shadow: 0 0 6px #f8b9b7; box-shadow: 0 0 6px #f8b9b7;}.form-actions {padding: 17px 20px 18px; margin-top: 18px; margin-bottom: 18px; background-color: #f5f5f5; border-top: 1px solid #e5e5e5; *zoom: 1;}.form-actions:before,.form-actions:after {display: table; content: "";}.form-actions:after {clear: both;}.uneditable-input {overflow: hidden; white-space: nowrap; cursor: not-allowed; background-color: #ffffff; border-color: #eee; -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025); -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025);}:-moz-placeholder {color: #999999;}:-ms-input-placeholder {color: #999999;}::-webkit-input-placeholder {color: #999999;}.help-block,.help-inline {color: #555555;}.help-block {display: block; margin-bottom: 9px;}.help-inline {display: inline-block; *display: inline; *zoom: 1; vertical-align: middle; padding-left: 5px;}.input-prepend,.input-append {margin-bottom: 5px;}.input-prepend input,.input-append input,.input-prepend select,.input-append select,.input-prepend .uneditable-input,.input-append .uneditable-input {position: relative; margin-bottom: 0; *margin-left: 0; vertical-align: middle; -webkit-border-radius: 0 3px 3px 0; -moz-border-radius: 0 3px 3px 0; border-radius: 0 3px 3px 0;}.input-prepend input:focus,.input-append input:focus,.input-prepend select:focus,.input-append select:focus,.input-prepend .uneditable-input:focus,.input-append .uneditable-input:focus {z-index: 2;}.input-prepend .uneditable-input,.input-append .uneditable-input {border-left-color: #ccc;}.input-prepend .add-on,.input-append .add-on {display: inline-block; width: auto; height: 18px; min-width: 16px; padding: 4px 5px; font-weight: normal; line-height: 18px; text-align: center; text-shadow: 0 1px 0 #ffffff; vertical-align: middle; background-color: #eeeeee; border: 1px solid #ccc;}.input-prepend .add-on,.input-append .add-on,.input-prepend .btn,.input-append .btn {margin-left: -1px; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0;}.input-prepend .active,.input-append .active {background-color: #a9dba9; border-color: #46a546;}.input-prepend .add-on,.input-prepend .btn {margin-right: -1px;}.input-prepend .add-on:first-child,.input-prepend .btn:first-child {-webkit-border-radius: 3px 0 0 3px; -moz-border-radius: 3px 0 0 3px; border-radius: 3px 0 0 3px;}.input-append input,.input-append select,.input-append .uneditable-input {-webkit-border-radius: 3px 0 0 3px; -moz-border-radius: 3px 0 0 3px; border-radius: 3px 0 0 3px;}.input-append .uneditable-input {border-right-color: #ccc; border-left-color: #eee;}.input-append .add-on:last-child,.input-append .btn:last-child {-webkit-border-radius: 0 3px 3px 0; -moz-border-radius: 0 3px 3px 0; border-radius: 0 3px 3px 0;}.input-prepend.input-append input,.input-prepend.input-append select,.input-prepend.input-append .uneditable-input {-webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0;}.input-prepend.input-append .add-on:first-child,.input-prepend.input-append .btn:first-child {margin-right: -1px; -webkit-border-radius: 3px 0 0 3px; -moz-border-radius: 3px 0 0 3px; border-radius: 3px 0 0 3px;}.input-prepend.input-append .add-on:last-child,.input-prepend.input-append .btn:last-child {margin-left: -1px; -webkit-border-radius: 0 3px 3px 0; -moz-border-radius: 0 3px 3px 0; border-radius: 0 3px 3px 0;}.search-query {padding-right: 14px; padding-right: 4px \9; padding-left: 14px; padding-left: 4px \9; margin-bottom: 0; -webkit-border-radius: 14px; -moz-border-radius: 14px; border-radius: 14px;}.form-search input,.form-inline input,.form-horizontal input,.form-search textarea,.form-inline textarea,.form-horizontal textarea,.form-search select,.form-inline select,.form-horizontal select,.form-search .help-inline,.form-inline .help-inline,.form-horizontal .help-inline,.form-search .uneditable-input,.form-inline .uneditable-input,.form-horizontal .uneditable-input,.form-search .input-prepend,.form-inline .input-prepend,.form-horizontal .input-prepend,.form-search .input-append,.form-inline .input-append,.form-horizontal .input-append {display: inline-block; *display: inline; *zoom: 1; margin-bottom: 0;}.form-search .hide,.form-inline .hide,.form-horizontal .hide {display: none;}.form-search label,.form-inline label {display: inline-block;}.form-search .input-append,.form-inline .input-append,.form-search .input-prepend,.form-inline .input-prepend {margin-bottom: 0;}.form-search .radio,.form-search .checkbox,.form-inline .radio,.form-inline .checkbox {padding-left: 0; margin-bottom: 0; vertical-align: middle;}.form-search .radio input[type="radio"],.form-search .checkbox input[type="checkbox"],.form-inline .radio input[type="radio"],.form-inline .checkbox input[type="checkbox"] {float: left; margin-right: 3px; margin-left: 0;}.control-group {margin-bottom: 9px;}legend + .control-group {margin-top: 18px; -webkit-margin-top-collapse: separate;}.form-horizontal .control-group {margin-bottom: 18px; *zoom: 1;}.form-horizontal .control-group:before,.form-horizontal .control-group:after {display: table; content: "";}.form-horizontal .control-group:after {clear: both;}.form-horizontal .control-label {float: left; width: 140px; padding-top: 5px; text-align: right;}.form-horizontal .controls {*display: inline-block; *padding-left: 20px; margin-left: 160px; *margin-left: 0;}.form-horizontal .controls:first-child {*padding-left: 160px;}.form-horizontal .help-block {margin-top: 9px; margin-bottom: 0;}.form-horizontal .form-actions {padding-left: 160px;}table {max-width: 100%; background-color: transparent; border-collapse: collapse; border-spacing: 0;}.table {width: 100%; margin-bottom: 18px;}.table th,.table td {padding: 8px; line-height: 18px; text-align: left; vertical-align: top; border-top: 1px solid #dddddd;}.table th {font-weight: bold;}.table thead th {vertical-align: bottom;}.table caption + thead tr:first-child th,.table caption + thead tr:first-child td,.table colgroup + thead tr:first-child th,.table colgroup + thead tr:first-child td,.table thead:first-child tr:first-child th,.table thead:first-child tr:first-child td {border-top: 0;}.table tbody + tbody {border-top: 2px solid #dddddd;}.table-condensed th,.table-condensed td {padding: 4px 5px;}.table-bordered {border: 1px solid #dddddd; border-collapse: separate; *border-collapse: collapsed; border-left: 0; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px;}.table-bordered th,.table-bordered td {border-left: 1px solid #dddddd;}.table-bordered caption + thead tr:first-child th,.table-bordered caption + tbody tr:first-child th,.table-bordered caption + tbody tr:first-child td,.table-bordered colgroup + thead tr:first-child th,.table-bordered colgroup + tbody tr:first-child th,.table-bordered colgroup + tbody tr:first-child td,.table-bordered thead:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child td {border-top: 0;}.table-bordered thead:first-child tr:first-child th:first-child,.table-bordered tbody:first-child tr:first-child td:first-child {-webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topleft: 4px;}.table-bordered thead:first-child tr:first-child th:last-child,.table-bordered tbody:first-child tr:first-child td:last-child {-webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-topright: 4px;}.table-bordered thead:last-child tr:last-child th:first-child,.table-bordered tbody:last-child tr:last-child td:first-child {-webkit-border-radius: 0 0 0 4px; -moz-border-radius: 0 0 0 4px; border-radius: 0 0 0 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomleft: 4px;}.table-bordered thead:last-child tr:last-child th:last-child,.table-bordered tbody:last-child tr:last-child td:last-child {-webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; -moz-border-radius-bottomright: 4px;}.table-striped tbody tr:nth-child(odd) td,.table-striped tbody tr:nth-child(odd) th {background-color: #f9f9f9;}.table tbody tr:hover td,.table tbody tr:hover th {background-color: #f5f5f5;}table .span1 {float: none; width: 44px; margin-left: 0;}table .span2 {float: none; width: 124px; margin-left: 0;}table .span3 {float: none; width: 204px; margin-left: 0;}table .span4 {float: none; width: 284px; margin-left: 0;}table .span5 {float: none; width: 364px; margin-left: 0;}table .span6 {float: none; width: 444px; margin-left: 0;}table .span7 {float: none; width: 524px; margin-left: 0;}table .span8 {float: none; width: 604px; margin-left: 0;}table .span9 {float: none; width: 684px; margin-left: 0;}table .span10 {float: none; width: 764px; margin-left: 0;}table .span11 {float: none; width: 844px; margin-left: 0;}table .span12 {float: none; width: 924px; margin-left: 0;}table .span13 {float: none; width: 1004px; margin-left: 0;}table .span14 {float: none; width: 1084px; margin-left: 0;}table .span15 {float: none; width: 1164px; margin-left: 0;}table .span16 {float: none; width: 1244px; margin-left: 0;}table .span17 {float: none; width: 1324px; margin-left: 0;}table .span18 {float: none; width: 1404px; margin-left: 0;}table .span19 {float: none; width: 1484px; margin-left: 0;}table .span20 {float: none; width: 1564px; margin-left: 0;}table .span21 {float: none; width: 1644px; margin-left: 0;}table .span22 {float: none; width: 1724px; margin-left: 0;}table .span23 {float: none; width: 1804px; margin-left: 0;}table .span24 {float: none; width: 1884px; margin-left: 0;}[class^="icon-"],[class*=" icon-"] {display: inline-block; width: 14px; height: 14px; *margin-right: .3em; line-height: 14px; vertical-align: text-top; background-image: url("../../images/glyphicons-halflings.png"); background-position: 14px 14px; background-repeat: no-repeat;}[class^="icon-"]:last-child,[class*=" icon-"]:last-child {*margin-left: 0;}.icon-white {background-image: url("../../images/glyphicons-halflings-white.png");}.icon-glass {background-position: 0 0;}.icon-music {background-position: -24px 0;}.icon-search {background-position: -48px 0;}.icon-envelope {background-position: -72px 0;}.icon-heart {background-position: -96px 0;}.icon-star {background-position: -120px 0;}.icon-star-empty {background-position: -144px 0;}.icon-user {background-position: -168px 0;}.icon-film {background-position: -192px 0;}.icon-th-large {background-position: -216px 0;}.icon-th {background-position: -240px 0;}.icon-th-list {background-position: -264px 0;}.icon-ok {background-position: -288px 0;}.icon-remove {background-position: -312px 0;}.icon-zoom-in {background-position: -336px 0;}.icon-zoom-out {background-position: -360px 0;}.icon-off {background-position: -384px 0;}.icon-signal {background-position: -408px 0;}.icon-cog {background-position: -432px 0;}.icon-trash {background-position: -456px 0;}.icon-home {background-position: 0 -24px;}.icon-file {background-position: -24px -24px;}.icon-time {background-position: -48px -24px;}.icon-road {background-position: -72px -24px;}.icon-download-alt {background-position: -96px -24px;}.icon-download {background-position: -120px -24px;}.icon-upload {background-position: -144px -24px;}.icon-inbox {background-position: -168px -24px;}.icon-play-circle {background-position: -192px -24px;}.icon-repeat {background-position: -216px -24px;}.icon-refresh {background-position: -240px -24px;}.icon-list-alt {background-position: -264px -24px;}.icon-lock {background-position: -287px -24px;}.icon-flag {background-position: -312px -24px;}.icon-headphones {background-position: -336px -24px;}.icon-volume-off {background-position: -360px -24px;}.icon-volume-down {background-position: -384px -24px;}.icon-volume-up {background-position: -408px -24px;}.icon-qrcode {background-position: -432px -24px;}.icon-barcode {background-position: -456px -24px;}.icon-tag {background-position: 0 -48px;}.icon-tags {background-position: -25px -48px;}.icon-book {background-position: -48px -48px;}.icon-bookmark {background-position: -72px -48px;}.icon-print {background-position: -96px -48px;}.icon-camera {background-position: -120px -48px;}.icon-font {background-position: -144px -48px;}.icon-bold {background-position: -167px -48px;}.icon-italic {background-position: -192px -48px;}.icon-text-height {background-position: -216px -48px;}.icon-text-width {background-position: -240px -48px;}.icon-align-left {background-position: -264px -48px;}.icon-align-center {background-position: -288px -48px;}.icon-align-right {background-position: -312px -48px;}.icon-align-justify {background-position: -336px -48px;}.icon-list {background-position: -360px -48px;}.icon-indent-left {background-position: -384px -48px;}.icon-indent-right {background-position: -408px -48px;}.icon-facetime-video {background-position: -432px -48px;}.icon-picture {background-position: -456px -48px;}.icon-pencil {background-position: 0 -72px;}.icon-map-marker {background-position: -24px -72px;}.icon-adjust {background-position: -48px -72px;}.icon-tint {background-position: -72px -72px;}.icon-edit {background-position: -96px -72px;}.icon-share {background-position: -120px -72px;}.icon-check {background-position: -144px -72px;}.icon-move {background-position: -168px -72px;}.icon-step-backward {background-position: -192px -72px;}.icon-fast-backward {background-position: -216px -72px;}.icon-backward {background-position: -240px -72px;}.icon-play {background-position: -264px -72px;}.icon-pause {background-position: -288px -72px;}.icon-stop {background-position: -312px -72px;}.icon-forward {background-position: -336px -72px;}.icon-fast-forward {background-position: -360px -72px;}.icon-step-forward {background-position: -384px -72px;}.icon-eject {background-position: -408px -72px;}.icon-chevron-left {background-position: -432px -72px;}.icon-chevron-right {background-position: -456px -72px;}.icon-plus-sign {background-position: 0 -96px;}.icon-minus-sign {background-position: -24px -96px;}.icon-remove-sign {background-position: -48px -96px;}.icon-ok-sign {background-position: -72px -96px;}.icon-question-sign {background-position: -96px -96px;}.icon-info-sign {background-position: -120px -96px;}.icon-screenshot {background-position: -144px -96px;}.icon-remove-circle {background-position: -168px -96px;}.icon-ok-circle {background-position: -192px -96px;}.icon-ban-circle {background-position: -216px -96px;}.icon-arrow-left {background-position: -240px -96px;}.icon-arrow-right {background-position: -264px -96px;}.icon-arrow-up {background-position: -289px -96px;}.icon-arrow-down {background-position: -312px -96px;}.icon-share-alt {background-position: -336px -96px;}.icon-resize-full {background-position: -360px -96px;}.icon-resize-small {background-position: -384px -96px;}.icon-plus {background-position: -408px -96px;}.icon-minus {background-position: -433px -96px;}.icon-asterisk {background-position: -456px -96px;}.icon-exclamation-sign {background-position: 0 -120px;}.icon-gift {background-position: -24px -120px;}.icon-leaf {background-position: -48px -120px;}.icon-fire {background-position: -72px -120px;}.icon-eye-open {background-position: -96px -120px;}.icon-eye-close {background-position: -120px -120px;}.icon-warning-sign {background-position: -144px -120px;}.icon-plane {background-position: -168px -120px;}.icon-calendar {background-position: -192px -120px;}.icon-random {background-position: -216px -120px;}.icon-comment {background-position: -240px -120px;}.icon-magnet {background-position: -264px -120px;}.icon-chevron-up {background-position: -288px -120px;}.icon-chevron-down {background-position: -313px -119px;}.icon-retweet {background-position: -336px -120px;}.icon-shopping-cart {background-position: -360px -120px;}.icon-folder-close {background-position: -384px -120px;}.icon-folder-open {background-position: -408px -120px;}.icon-resize-vertical {background-position: -432px -119px;}.icon-resize-horizontal {background-position: -456px -118px;}.icon-hdd {background-position: 0 -144px;}.icon-bullhorn {background-position: -24px -144px;}.icon-bell {background-position: -48px -144px;}.icon-certificate {background-position: -72px -144px;}.icon-thumbs-up {background-position: -96px -144px;}.icon-thumbs-down {background-position: -120px -144px;}.icon-hand-right {background-position: -144px -144px;}.icon-hand-left {background-position: -168px -144px;}.icon-hand-up {background-position: -192px -144px;}.icon-hand-down {background-position: -216px -144px;}.icon-circle-arrow-right {background-position: -240px -144px;}.icon-circle-arrow-left {background-position: -264px -144px;}.icon-circle-arrow-up {background-position: -288px -144px;}.icon-circle-arrow-down {background-position: -312px -144px;}.icon-globe {background-position: -336px -144px;}.icon-wrench {background-position: -360px -144px;}.icon-tasks {background-position: -384px -144px;}.icon-filter {background-position: -408px -144px;}.icon-briefcase {background-position: -432px -144px;}.icon-fullscreen {background-position: -456px -144px;}.dropup,.dropdown {position: relative;}.dropdown-toggle {*margin-bottom: -3px;}.dropdown-toggle:active,.open .dropdown-toggle {outline: 0;}.caret {display: inline-block; width: 0; height: 0; vertical-align: top; border-top: 4px solid #000000; border-right: 4px solid transparent; border-left: 4px solid transparent; content: ""; opacity: 0.3; filter: alpha(opacity=30);}.dropdown .caret {margin-top: 8px; margin-left: 2px;}.dropdown:hover .caret,.open .caret {opacity: 1; filter: alpha(opacity=100);}.dropdown-menu {position: absolute; top: 100%; left: 0; z-index: 1000; display: none; float: left; min-width: 160px; padding: 4px 0; margin: 1px 0 0; list-style: none; 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;}.dropdown-menu.pull-right {right: 0; left: auto;}.dropdown-menu .divider {*width: 100%; height: 1px; margin: 8px 1px; *margin: -5px 0 5px; overflow: hidden; background-color: #e5e5e5; border-bottom: 1px solid #ffffff;}.dropdown-menu a {display: block; padding: 3px 15px; clear: both; font-weight: normal; line-height: 18px; color: #333333; white-space: nowrap;}.dropdown-menu li > a:hover,.dropdown-menu .active > a,.dropdown-menu .active > a:hover {color: #ffffff; text-decoration: none; background-color: #0088cc;}.open {*z-index: 1000;}.open > .dropdown-menu {display: block;}.pull-right > .dropdown-menu {right: 0; left: auto;}.dropup .caret,.navbar-fixed-bottom .dropdown .caret {border-top: 0; border-bottom: 4px solid #000000; content: "\2191";}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu {top: auto; bottom: 100%; margin-bottom: 1px;}.typeahead {margin-top: 2px; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px;}.well {min-height: 20px; padding: 19px; margin-bottom: 20px; background-color: #f5f5f5; border: 1px solid #eee; border: 1px solid rgba(0, 0, 0, 0.05); -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);}.well blockquote {border-color: #ddd; border-color: rgba(0, 0, 0, 0.15);}.well-large {padding: 24px; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px;}.well-small {padding: 9px; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px;}.fade {opacity: 0; -webkit-transition: opacity 0.15s linear; -moz-transition: opacity 0.15s linear; -ms-transition: opacity 0.15s linear; -o-transition: opacity 0.15s linear; transition: opacity 0.15s linear;}.fade.in {opacity: 1;}.collapse {position: relative; height: 0; overflow: hidden; -webkit-transition: height 0.35s ease; -moz-transition: height 0.35s ease; -ms-transition: height 0.35s ease; -o-transition: height 0.35s ease; transition: height 0.35s ease;}.collapse.in {height: auto;}.close {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);}.close:hover {color: #000000; text-decoration: none; cursor: pointer; opacity: 0.4; filter: alpha(opacity=40);}button.close {padding: 0; cursor: pointer; background: transparent; border: 0; -webkit-appearance: none;}.btn {display: inline-block; *display: inline; *zoom: 1; padding: 4px 10px 4px; margin-bottom: 0; font-size: 13px; line-height: 18px; *line-height: 20px; color: #333333; text-align: center; text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); vertical-align: middle; cursor: pointer; background-color: #f5f5f5; background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); background-image: -ms-linear-gradient(top, #ffffff, #e6e6e6); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); background-image: linear-gradient(top, #ffffff, #e6e6e6); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#e6e6e6', GradientType=0); border-color: #e6e6e6 #e6e6e6 #bfbfbf; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #e6e6e6; filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); border: 1px solid #cccccc; *border: 0; border-bottom-color: #b3b3b3; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; *margin-left: .3em; -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);}.btn:hover,.btn:active,.btn.active,.btn.disabled,.btn[disabled] {background-color: #e6e6e6; *background-color: #d9d9d9;}.btn:active,.btn.active {background-color: #cccccc \9;}.btn:first-child {*margin-left: 0;}.btn:hover {color: #333333; text-decoration: none; background-color: #e6e6e6; *background-color: #d9d9d9; background-position: 0 -15px; -webkit-transition: background-position 0.1s linear; -moz-transition: background-position 0.1s linear; -ms-transition: background-position 0.1s linear; -o-transition: background-position 0.1s linear; transition: background-position 0.1s linear;}.btn:focus {outline: thin dotted #333; outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px;}.btn.active,.btn:active {background-color: #e6e6e6; background-color: #d9d9d9 \9; background-image: none; outline: 0; -webkit-box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05); -moz-box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05); box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);}.btn.disabled,.btn[disabled] {cursor: default; background-color: #e6e6e6; background-image: none; opacity: 0.65; filter: alpha(opacity=65); -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none;}.btn-large {padding: 9px 14px; font-size: 15px; line-height: normal; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px;}.btn-large [class^="icon-"] {margin-top: 1px;}.btn-small {padding: 5px 9px; font-size: 11px; line-height: 16px;}.btn-small [class^="icon-"] {margin-top: -1px;}.btn-mini {padding: 2px 6px; font-size: 11px; line-height: 14px;}.btn-primary,.btn-primary:hover,.btn-warning,.btn-warning:hover,.btn-danger,.btn-danger:hover,.btn-success,.btn-success:hover,.btn-info,.btn-info:hover,.btn-inverse,.btn-inverse:hover {color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);}.btn-primary.active,.btn-warning.active,.btn-danger.active,.btn-success.active,.btn-info.active,.btn-inverse.active {color: rgba(255, 255, 255, 0.75);}.btn {border-color: #ccc; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);}.btn-primary {background-color: #0074cc; background-image: -moz-linear-gradient(top, #0088cc, #0055cc); background-image: -ms-linear-gradient(top, #0088cc, #0055cc); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0055cc)); background-image: -webkit-linear-gradient(top, #0088cc, #0055cc); background-image: -o-linear-gradient(top, #0088cc, #0055cc); background-image: linear-gradient(top, #0088cc, #0055cc); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0055cc', GradientType=0); border-color: #0055cc #0055cc #003580; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #0055cc; filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-primary:hover,.btn-primary:active,.btn-primary.active,.btn-primary.disabled,.btn-primary[disabled] {background-color: #0055cc; *background-color: #004ab3;}.btn-primary:active,.btn-primary.active {background-color: #004099 \9;}.btn-warning {background-color: #faa732; background-image: -moz-linear-gradient(top, #fbb450, #f89406); background-image: -ms-linear-gradient(top, #fbb450, #f89406); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406)); background-image: -webkit-linear-gradient(top, #fbb450, #f89406); background-image: -o-linear-gradient(top, #fbb450, #f89406); background-image: linear-gradient(top, #fbb450, #f89406); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fbb450', endColorstr='#f89406', GradientType=0); border-color: #f89406 #f89406 #ad6704; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #f89406; filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-warning:hover,.btn-warning:active,.btn-warning.active,.btn-warning.disabled,.btn-warning[disabled] {background-color: #f89406; *background-color: #df8505;}.btn-warning:active,.btn-warning.active {background-color: #c67605 \9;}.btn-danger {background-color: #da4f49; background-image: -moz-linear-gradient(top, #ee5f5b, #bd362f); background-image: -ms-linear-gradient(top, #ee5f5b, #bd362f); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#bd362f)); background-image: -webkit-linear-gradient(top, #ee5f5b, #bd362f); background-image: -o-linear-gradient(top, #ee5f5b, #bd362f); background-image: linear-gradient(top, #ee5f5b, #bd362f); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ee5f5b', endColorstr='#bd362f', GradientType=0); border-color: #bd362f #bd362f #802420; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #bd362f; filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-danger:hover,.btn-danger:active,.btn-danger.active,.btn-danger.disabled,.btn-danger[disabled] {background-color: #bd362f; *background-color: #a9302a;}.btn-danger:active,.btn-danger.active {background-color: #942a25 \9;}.btn-success {background-color: #5bb75b; background-image: -moz-linear-gradient(top, #62c462, #51a351); background-image: -ms-linear-gradient(top, #62c462, #51a351); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#51a351)); background-image: -webkit-linear-gradient(top, #62c462, #51a351); background-image: -o-linear-gradient(top, #62c462, #51a351); background-image: linear-gradient(top, #62c462, #51a351); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#51a351', GradientType=0); border-color: #51a351 #51a351 #387038; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #51a351; filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-success:hover,.btn-success:active,.btn-success.active,.btn-success.disabled,.btn-success[disabled] {background-color: #51a351; *background-color: #499249;}.btn-success:active,.btn-success.active {background-color: #408140 \9;}.btn-info {background-color: #49afcd; background-image: -moz-linear-gradient(top, #5bc0de, #2f96b4); background-image: -ms-linear-gradient(top, #5bc0de, #2f96b4); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#2f96b4)); background-image: -webkit-linear-gradient(top, #5bc0de, #2f96b4); background-image: -o-linear-gradient(top, #5bc0de, #2f96b4); background-image: linear-gradient(top, #5bc0de, #2f96b4); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5bc0de', endColorstr='#2f96b4', GradientType=0); border-color: #2f96b4 #2f96b4 #1f6377; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #2f96b4; filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-info:hover,.btn-info:active,.btn-info.active,.btn-info.disabled,.btn-info[disabled] {background-color: #2f96b4; *background-color: #2a85a0;}.btn-info:active,.btn-info.active {background-color: #24748c \9;}.btn-inverse {background-color: #414141; background-image: -moz-linear-gradient(top, #555555, #222222); background-image: -ms-linear-gradient(top, #555555, #222222); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#555555), to(#222222)); background-image: -webkit-linear-gradient(top, #555555, #222222); background-image: -o-linear-gradient(top, #555555, #222222); background-image: linear-gradient(top, #555555, #222222); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#555555', endColorstr='#222222', GradientType=0); border-color: #222222 #222222 #000000; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #222222; filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-inverse:hover,.btn-inverse:active,.btn-inverse.active,.btn-inverse.disabled,.btn-inverse[disabled] {background-color: #222222; *background-color: #151515;}.btn-inverse:active,.btn-inverse.active {background-color: #080808 \9;}button.btn,input[type="submit"].btn {*padding-top: 2px; *padding-bottom: 2px;}button.btn::-moz-focus-inner,input[type="submit"].btn::-moz-focus-inner {padding: 0; border: 0;}button.btn.btn-large,input[type="submit"].btn.btn-large {*padding-top: 7px; *padding-bottom: 7px;}button.btn.btn-small,input[type="submit"].btn.btn-small {*padding-top: 3px; *padding-bottom: 3px;}button.btn.btn-mini,input[type="submit"].btn.btn-mini {*padding-top: 1px; *padding-bottom: 1px;}.btn-group {position: relative; *zoom: 1; *margin-left: .3em;}.btn-group:before,.btn-group:after {display: table; content: "";}.btn-group:after {clear: both;}.btn-group:first-child {*margin-left: 0;}.btn-group + .btn-group {margin-left: 5px;}.btn-toolbar {margin-top: 9px; margin-bottom: 9px;}.btn-toolbar .btn-group {display: inline-block; *display: inline; *zoom: 1;}.btn-group > .btn {position: relative; float: left; margin-left: -1px; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0;}.btn-group > .btn:first-child {margin-left: 0; -webkit-border-top-left-radius: 4px; -moz-border-radius-topleft: 4px; border-top-left-radius: 4px; -webkit-border-bottom-left-radius: 4px; -moz-border-radius-bottomleft: 4px; border-bottom-left-radius: 4px;}.btn-group > .btn:last-child,.btn-group > .dropdown-toggle {-webkit-border-top-right-radius: 4px; -moz-border-radius-topright: 4px; border-top-right-radius: 4px; -webkit-border-bottom-right-radius: 4px; -moz-border-radius-bottomright: 4px; border-bottom-right-radius: 4px;}.btn-group > .btn.large:first-child {margin-left: 0; -webkit-border-top-left-radius: 6px; -moz-border-radius-topleft: 6px; border-top-left-radius: 6px; -webkit-border-bottom-left-radius: 6px; -moz-border-radius-bottomleft: 6px; border-bottom-left-radius: 6px;}.btn-group > .btn.large:last-child,.btn-group > .large.dropdown-toggle {-webkit-border-top-right-radius: 6px; -moz-border-radius-topright: 6px; border-top-right-radius: 6px; -webkit-border-bottom-right-radius: 6px; -moz-border-radius-bottomright: 6px; border-bottom-right-radius: 6px;}.btn-group > .btn:hover,.btn-group > .btn:focus,.btn-group > .btn:active,.btn-group > .btn.active {z-index: 2;}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle {outline: 0;}.btn-group > .dropdown-toggle {padding-left: 8px; padding-right: 8px; -webkit-box-shadow: inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); -moz-box-shadow: inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); box-shadow: inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); *padding-top: 4px; *padding-bottom: 4px;}.btn-group > .btn-mini.dropdown-toggle {padding-left: 5px; padding-right: 5px;}.btn-group > .btn-small.dropdown-toggle {*padding-top: 4px; *padding-bottom: 4px;}.btn-group > .btn-large.dropdown-toggle {padding-left: 12px; padding-right: 12px;}.btn-group.open .dropdown-toggle {background-image: none; -webkit-box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05); -moz-box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05); box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);}.btn-group.open .btn.dropdown-toggle {background-color: #e6e6e6;}.btn-group.open .btn-primary.dropdown-toggle {background-color: #0055cc;}.btn-group.open .btn-warning.dropdown-toggle {background-color: #f89406;}.btn-group.open .btn-danger.dropdown-toggle {background-color: #bd362f;}.btn-group.open .btn-success.dropdown-toggle {background-color: #51a351;}.btn-group.open .btn-info.dropdown-toggle {background-color: #2f96b4;}.btn-group.open .btn-inverse.dropdown-toggle {background-color: #222222;}.btn .caret {margin-top: 7px; margin-left: 0;}.btn:hover .caret,.open.btn-group .caret {opacity: 1; filter: alpha(opacity=100);}.btn-mini .caret {margin-top: 5px;}.btn-small .caret {margin-top: 6px;}.btn-large .caret {margin-top: 6px; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px;}.dropup .btn-large .caret {border-bottom: 5px solid #000000; border-top: 0;}.btn-primary .caret,.btn-warning .caret,.btn-danger .caret,.btn-info .caret,.btn-success .caret,.btn-inverse .caret {border-top-color: #ffffff; border-bottom-color: #ffffff; opacity: 0.75; filter: alpha(opacity=75);}.alert {padding: 8px 35px 8px 14px; margin-bottom: 18px; 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; color: #c09853;}.alert-heading {color: inherit;}.alert .close {position: relative; top: -2px; right: -21px; line-height: 18px;}.alert-success {background-color: #dff0d8; border-color: #d6e9c6; color: #468847;}.alert-danger,.alert-error {background-color: #f2dede; border-color: #eed3d7; color: #b94a48;}.alert-info {background-color: #d9edf7; border-color: #bce8f1; color: #3a87ad;}.alert-block {padding-top: 14px; padding-bottom: 14px;}.alert-block > p,.alert-block > ul {margin-bottom: 0;}.alert-block p + p {margin-top: 5px;}.nav {margin-left: 0; margin-bottom: 18px; list-style: none;}.nav > li > a {display: block;}.nav > li > a:hover {text-decoration: none; background-color: #eeeeee;}.nav > .pull-right {float: right;}.nav .nav-header {display: block; padding: 3px 15px; font-size: 11px; font-weight: bold; line-height: 18px; color: #999999; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); text-transform: uppercase;}.nav li + .nav-header {margin-top: 9px;}.nav-list {padding-left: 15px; padding-right: 15px; margin-bottom: 0;}.nav-list > li > a,.nav-list .nav-header {margin-left: -15px; margin-right: -15px; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);}.nav-list > li > a {padding: 3px 15px;}.nav-list > .active > a,.nav-list > .active > a:hover {color: #ffffff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); background-color: #0088cc;}.nav-list [class^="icon-"] {margin-right: 2px;}.nav-list .divider {*width: 100%; height: 1px; margin: 8px 1px; *margin: -5px 0 5px; overflow: hidden; background-color: #e5e5e5; border-bottom: 1px solid #ffffff;}.nav-tabs,.nav-pills {*zoom: 1;}.nav-tabs:before,.nav-pills:before,.nav-tabs:after,.nav-pills:after {display: table; content: "";}.nav-tabs:after,.nav-pills:after {clear: both;}.nav-tabs > li,.nav-pills > li {float: left;}.nav-tabs > li > a,.nav-pills > li > a {padding-right: 12px; padding-left: 12px; margin-right: 2px; line-height: 14px;}.nav-tabs {border-bottom: 1px solid #ddd;}.nav-tabs > li {margin-bottom: -1px;}.nav-tabs > li > a {padding-top: 8px; padding-bottom: 8px; line-height: 18px; border: 1px solid transparent; -webkit-border-radius: 4px 4px 0 0; -moz-border-radius: 4px 4px 0 0; border-radius: 4px 4px 0 0;}.nav-tabs > li > a:hover {border-color: #eeeeee #eeeeee #dddddd;}.nav-tabs > .active > a,.nav-tabs > .active > a:hover {color: #555555; background-color: #ffffff; border: 1px solid #ddd; border-bottom-color: transparent; cursor: default;}.nav-pills > li > a {padding-top: 8px; padding-bottom: 8px; margin-top: 2px; margin-bottom: 2px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px;}.nav-pills > .active > a,.nav-pills > .active > a:hover {color: #ffffff; background-color: #0088cc;}.nav-stacked > li {float: none;}.nav-stacked > li > a {margin-right: 0;}.nav-tabs.nav-stacked {border-bottom: 0;}.nav-tabs.nav-stacked > li > a {border: 1px solid #ddd; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0;}.nav-tabs.nav-stacked > li:first-child > a {-webkit-border-radius: 4px 4px 0 0; -moz-border-radius: 4px 4px 0 0; border-radius: 4px 4px 0 0;}.nav-tabs.nav-stacked > li:last-child > a {-webkit-border-radius: 0 0 4px 4px; -moz-border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px;}.nav-tabs.nav-stacked > li > a:hover {border-color: #ddd; z-index: 2;}.nav-pills.nav-stacked > li > a {margin-bottom: 3px;}.nav-pills.nav-stacked > li:last-child > a {margin-bottom: 1px;}.nav-tabs .dropdown-menu {-webkit-border-radius: 0 0 5px 5px; -moz-border-radius: 0 0 5px 5px; border-radius: 0 0 5px 5px;}.nav-pills .dropdown-menu {-webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px;}.nav-tabs .dropdown-toggle .caret,.nav-pills .dropdown-toggle .caret {border-top-color: #0088cc; border-bottom-color: #0088cc; margin-top: 6px;}.nav-tabs .dropdown-toggle:hover .caret,.nav-pills .dropdown-toggle:hover .caret {border-top-color: #005580; border-bottom-color: #005580;}.nav-tabs .active .dropdown-toggle .caret,.nav-pills .active .dropdown-toggle .caret {border-top-color: #333333; border-bottom-color: #333333;}.nav > .dropdown.active > a:hover {color: #000000; cursor: pointer;}.nav-tabs .open .dropdown-toggle,.nav-pills .open .dropdown-toggle,.nav > li.dropdown.open.active > a:hover {color: #ffffff; background-color: #999999; border-color: #999999;}.nav li.dropdown.open .caret,.nav li.dropdown.open.active .caret,.nav li.dropdown.open a:hover .caret {border-top-color: #ffffff; border-bottom-color: #ffffff; opacity: 1; filter: alpha(opacity=100);}.tabs-stacked .open > a:hover {border-color: #999999;}.tabbable {*zoom: 1;}.tabbable:before,.tabbable:after {display: table; content: "";}.tabbable:after {clear: both;}.tab-content {overflow: auto;}.tabs-below > .nav-tabs,.tabs-right > .nav-tabs,.tabs-left > .nav-tabs {border-bottom: 0;}.tab-content > .tab-pane,.pill-content > .pill-pane {display: none;}.tab-content > .active,.pill-content > .active {display: block;}.tabs-below > .nav-tabs {border-top: 1px solid #ddd;}.tabs-below > .nav-tabs > li {margin-top: -1px; margin-bottom: 0;}.tabs-below > .nav-tabs > li > a {-webkit-border-radius: 0 0 4px 4px; -moz-border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px;}.tabs-below > .nav-tabs > li > a:hover {border-bottom-color: transparent; border-top-color: #ddd;}.tabs-below > .nav-tabs > .active > a,.tabs-below > .nav-tabs > .active > a:hover {border-color: transparent #ddd #ddd #ddd;}.tabs-left > .nav-tabs > li,.tabs-right > .nav-tabs > li {float: none;}.tabs-left > .nav-tabs > li > a,.tabs-right > .nav-tabs > li > a {min-width: 74px; margin-right: 0; margin-bottom: 3px;}.tabs-left > .nav-tabs {float: left; margin-right: 19px; border-right: 1px solid #ddd;}.tabs-left > .nav-tabs > li > a {margin-right: -1px; -webkit-border-radius: 4px 0 0 4px; -moz-border-radius: 4px 0 0 4px; border-radius: 4px 0 0 4px;}.tabs-left > .nav-tabs > li > a:hover {border-color: #eeeeee #dddddd #eeeeee #eeeeee;}.tabs-left > .nav-tabs .active > a,.tabs-left > .nav-tabs .active > a:hover {border-color: #ddd transparent #ddd #ddd; *border-right-color: #ffffff;}.tabs-right > .nav-tabs {float: right; margin-left: 19px; border-left: 1px solid #ddd;}.tabs-right > .nav-tabs > li > a {margin-left: -1px; -webkit-border-radius: 0 4px 4px 0; -moz-border-radius: 0 4px 4px 0; border-radius: 0 4px 4px 0;}.tabs-right > .nav-tabs > li > a:hover {border-color: #eeeeee #eeeeee #eeeeee #dddddd;}.tabs-right > .nav-tabs .active > a,.tabs-right > .nav-tabs .active > a:hover {border-color: #ddd #ddd #ddd transparent; *border-left-color: #ffffff;}.navbar {*position: relative; *z-index: 2; overflow: visible; margin-bottom: 18px;}.navbar-inner {min-height: 40px; padding-left: 20px; padding-right: 20px; background-color: #2c2c2c; background-image: -moz-linear-gradient(top, #333333, #222222); background-image: -ms-linear-gradient(top, #333333, #222222); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#333333), to(#222222)); background-image: -webkit-linear-gradient(top, #333333, #222222); background-image: -o-linear-gradient(top, #333333, #222222); background-image: linear-gradient(top, #333333, #222222); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0); -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; -webkit-box-shadow: 0 1px 3px rgba(0,0,0,.25), inset 0 -1px 0 rgba(0,0,0,.1); -moz-box-shadow: 0 1px 3px rgba(0,0,0,.25), inset 0 -1px 0 rgba(0,0,0,.1); box-shadow: 0 1px 3px rgba(0,0,0,.25), inset 0 -1px 0 rgba(0,0,0,.1);}.navbar .container {width: auto;}.nav-collapse.collapse {height: auto;}.navbar {color: #999999;}.navbar .brand:hover {text-decoration: none;}.navbar .brand {float: left; display: block; padding: 8px 20px 12px; margin-left: -20px; font-size: 20px; font-weight: 200; line-height: 1; color: #999999;}.navbar .navbar-text {margin-bottom: 0; line-height: 40px;}.navbar .navbar-link {color: #999999;}.navbar .navbar-link:hover {color: #ffffff;}.navbar .btn,.navbar .btn-group {margin-top: 5px;}.navbar .btn-group .btn {margin: 0;}.navbar-form {margin-bottom: 0; *zoom: 1;}.navbar-form:before,.navbar-form:after {display: table; content: "";}.navbar-form:after {clear: both;}.navbar-form input,.navbar-form select,.navbar-form .radio,.navbar-form .checkbox {margin-top: 5px;}.navbar-form input,.navbar-form select {display: inline-block; margin-bottom: 0;}.navbar-form input[type="image"],.navbar-form input[type="checkbox"],.navbar-form input[type="radio"] {margin-top: 3px;}.navbar-form .input-append,.navbar-form .input-prepend {margin-top: 6px; white-space: nowrap;}.navbar-form .input-append input,.navbar-form .input-prepend input {margin-top: 0;}.navbar-search {position: relative; float: left; margin-top: 6px; margin-bottom: 0;}.navbar-search .search-query {padding: 4px 9px; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 1; color: #ffffff; background-color: #626262; border: 1px solid #151515; -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15); -moz-box-shadow: inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15); box-shadow: inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15); -webkit-transition: none; -moz-transition: none; -ms-transition: none; -o-transition: none; transition: none;}.navbar-search .search-query:-moz-placeholder {color: #cccccc;}.navbar-search .search-query:-ms-input-placeholder {color: #cccccc;}.navbar-search .search-query::-webkit-input-placeholder {color: #cccccc;}.navbar-search .search-query:focus,.navbar-search .search-query.focused {padding: 5px 10px; color: #333333; text-shadow: 0 1px 0 #ffffff; background-color: #ffffff; border: 0; -webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); -moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); outline: 0;}.navbar-fixed-top,.navbar-fixed-bottom {position: fixed; right: 0; left: 0; z-index: 1030; margin-bottom: 0;}.navbar-fixed-top .navbar-inner,.navbar-fixed-bottom .navbar-inner {padding-left: 0; padding-right: 0; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0;}.navbar-fixed-top .container,.navbar-fixed-bottom .container {width: 940px;}.navbar-fixed-top {top: 0;}.navbar-fixed-bottom {bottom: 0;}.navbar .nav {position: relative; left: 0; display: block; float: left; margin: 0 10px 0 0;}.navbar .nav.pull-right {float: right;}.navbar .nav > li {display: block; float: left;}.navbar .nav > li > a {float: none; padding: 9px 10px 11px; line-height: 19px; color: #999999; text-decoration: none; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);}.navbar .btn {display: inline-block; padding: 4px 10px 4px; margin: 5px 5px 6px; line-height: 18px;}.navbar .btn-group {margin: 0; padding: 5px 5px 6px;}.navbar .nav > li > a:hover {background-color: transparent; color: #ffffff; text-decoration: none;}.navbar .nav .active > a,.navbar .nav .active > a:hover {color: #ffffff; text-decoration: none; background-color: #222222;}.navbar .divider-vertical {height: 40px; width: 1px; margin: 0 9px; overflow: hidden; background-color: #222222; border-right: 1px solid #333333;}.navbar .nav.pull-right {margin-left: 10px; margin-right: 0;}.navbar .btn-navbar {display: none; float: right; padding: 7px 10px; margin-left: 5px; margin-right: 5px; background-color: #2c2c2c; background-image: -moz-linear-gradient(top, #333333, #222222); background-image: -ms-linear-gradient(top, #333333, #222222); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#333333), to(#222222)); background-image: -webkit-linear-gradient(top, #333333, #222222); background-image: -o-linear-gradient(top, #333333, #222222); background-image: linear-gradient(top, #333333, #222222); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0); border-color: #222222 #222222 #000000; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color: #222222; filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075); -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075); box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075);}.navbar .btn-navbar:hover,.navbar .btn-navbar:active,.navbar .btn-navbar.active,.navbar .btn-navbar.disabled,.navbar .btn-navbar[disabled] {background-color: #222222; *background-color: #151515;}.navbar .btn-navbar:active,.navbar .btn-navbar.active {background-color: #080808 \9;}.navbar .btn-navbar .icon-bar {display: block; width: 18px; height: 2px; background-color: #f5f5f5; -webkit-border-radius: 1px; -moz-border-radius: 1px; border-radius: 1px; -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); -moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);}.btn-navbar .icon-bar + .icon-bar {margin-top: 3px;}.navbar .dropdown-menu:before {content: ''; display: inline-block; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 7px solid #ccc; border-bottom-color: rgba(0, 0, 0, 0.2); position: absolute; top: -7px; left: 9px;}.navbar .dropdown-menu:after {content: ''; display: inline-block; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 6px solid #ffffff; position: absolute; top: -6px; left: 10px;}.navbar-fixed-bottom .dropdown-menu:before {border-top: 7px solid #ccc; border-top-color: rgba(0, 0, 0, 0.2); border-bottom: 0; bottom: -7px; top: auto;}.navbar-fixed-bottom .dropdown-menu:after {border-top: 6px solid #ffffff; border-bottom: 0; bottom: -6px; top: auto;}.navbar .nav li.dropdown .dropdown-toggle .caret,.navbar .nav li.dropdown.open .caret {border-top-color: #ffffff; border-bottom-color: #ffffff;}.navbar .nav li.dropdown.active .caret {opacity: 1; filter: alpha(opacity=100);}.navbar .nav li.dropdown.open > .dropdown-toggle,.navbar .nav li.dropdown.active > .dropdown-toggle,.navbar .nav li.dropdown.open.active > .dropdown-toggle {background-color: transparent;}.navbar .nav li.dropdown.active > .dropdown-toggle:hover {color: #ffffff;}.navbar .pull-right .dropdown-menu,.navbar .dropdown-menu.pull-right {left: auto; right: 0;}.navbar .pull-right .dropdown-menu:before,.navbar .dropdown-menu.pull-right:before {left: auto; right: 12px;}.navbar .pull-right .dropdown-menu:after,.navbar .dropdown-menu.pull-right:after {left: auto; right: 13px;}.breadcrumb {padding: 7px 14px; margin: 0 0 18px; list-style: none; background-color: #fbfbfb; background-image: -moz-linear-gradient(top, #ffffff, #f5f5f5); background-image: -ms-linear-gradient(top, #ffffff, #f5f5f5); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#f5f5f5)); background-image: -webkit-linear-gradient(top, #ffffff, #f5f5f5); background-image: -o-linear-gradient(top, #ffffff, #f5f5f5); background-image: linear-gradient(top, #ffffff, #f5f5f5); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f5f5f5', GradientType=0); border: 1px solid #ddd; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; -webkit-box-shadow: inset 0 1px 0 #ffffff; -moz-box-shadow: inset 0 1px 0 #ffffff; box-shadow: inset 0 1px 0 #ffffff;}.breadcrumb li {display: inline-block; *display: inline; *zoom: 1; text-shadow: 0 1px 0 #ffffff;}.breadcrumb .divider {padding: 0 5px; color: #999999;}.breadcrumb .active a {color: #333333;}.pagination {height: 36px; margin: 18px 0;}.pagination ul {display: inline-block; *display: inline; *zoom: 1; margin-left: 0; margin-bottom: 0; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);}.pagination li {display: inline;}.pagination a {float: left; padding: 0 14px; line-height: 34px; text-decoration: none; border: 1px solid #ddd; border-left-width: 0;}.pagination a:hover,.pagination .active a {background-color: #f5f5f5;}.pagination .active a {color: #999999; cursor: default;}.pagination .disabled span,.pagination .disabled a,.pagination .disabled a:hover {color: #999999; background-color: transparent; cursor: default;}.pagination li:first-child a {border-left-width: 1px; -webkit-border-radius: 3px 0 0 3px; -moz-border-radius: 3px 0 0 3px; border-radius: 3px 0 0 3px;}.pagination li:last-child a {-webkit-border-radius: 0 3px 3px 0; -moz-border-radius: 0 3px 3px 0; border-radius: 0 3px 3px 0;}.pagination-centered {text-align: center;}.pagination-right {text-align: right;}.pager {margin-left: 0; margin-bottom: 18px; list-style: none; text-align: center; *zoom: 1;}.pager:before,.pager:after {display: table; content: "";}.pager:after {clear: both;}.pager li {display: inline;}.pager a {display: inline-block; padding: 5px 14px; background-color: #fff; border: 1px solid #ddd; -webkit-border-radius: 15px; -moz-border-radius: 15px; border-radius: 15px;}.pager a:hover {text-decoration: none; background-color: #f5f5f5;}.pager .next a {float: right;}.pager .previous a {float: left;}.pager .disabled a,.pager .disabled a:hover {color: #999999; background-color: #fff; cursor: default;}.modal-open .dropdown-menu {z-index: 2050;}.modal-open .dropdown.open {*z-index: 2050;}.modal-open .popover {z-index: 2060;}.modal-open .tooltip {z-index: 2070;}.modal-backdrop {position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1040; background-color: #000000;}.modal-backdrop.fade {opacity: 0;}.modal-backdrop,.modal-backdrop.fade.in {opacity: 0.8; filter: alpha(opacity=80);}.modal {position: fixed; top: 50%; left: 50%; z-index: 1050; overflow: auto; width: 560px; margin: -250px 0 0 -280px; background-color: #ffffff; border: 1px solid #999; border: 1px solid rgba(0, 0, 0, 0.3); *border: 1px solid #999; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); -moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); -webkit-background-clip: padding-box; -moz-background-clip: padding-box; background-clip: padding-box;}.modal.fade {-webkit-transition: opacity .3s linear, top .3s ease-out; -moz-transition: opacity .3s linear, top .3s ease-out; -ms-transition: opacity .3s linear, top .3s ease-out; -o-transition: opacity .3s linear, top .3s ease-out; transition: opacity .3s linear, top .3s ease-out; top: -25%;}.modal.fade.in {top: 50%;}.modal-header {padding: 9px 15px; border-bottom: 1px solid #eee;}.modal-header .close {margin-top: 2px;}.modal-body {overflow-y: auto; max-height: 400px; padding: 15px;}.modal-form {margin-bottom: 0;}.modal-footer {padding: 14px 15px 15px; margin-bottom: 0; text-align: right; background-color: #f5f5f5; border-top: 1px solid #ddd; -webkit-border-radius: 0 0 6px 6px; -moz-border-radius: 0 0 6px 6px; border-radius: 0 0 6px 6px; -webkit-box-shadow: inset 0 1px 0 #ffffff; -moz-box-shadow: inset 0 1px 0 #ffffff; box-shadow: inset 0 1px 0 #ffffff; *zoom: 1;}.modal-footer:before,.modal-footer:after {display: table; content: "";}.modal-footer:after {clear: both;}.modal-footer .btn + .btn {margin-left: 5px; margin-bottom: 0;}.modal-footer .btn-group .btn + .btn {margin-left: -1px;}.tooltip {position: absolute; z-index: 1020; display: block; visibility: visible; padding: 5px; font-size: 11px; opacity: 0; filter: alpha(opacity=0);}.tooltip.in {opacity: 0.8; filter: alpha(opacity=80);}.tooltip.top {margin-top: -2px;}.tooltip.right {margin-left: 2px;}.tooltip.bottom {margin-top: 2px;}.tooltip.left {margin-left: -2px;}.tooltip.top .tooltip-arrow {bottom: 0; left: 50%; margin-left: -5px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 5px solid #000000;}.tooltip.left .tooltip-arrow {top: 50%; right: 0; margin-top: -5px; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 5px solid #000000;}.tooltip.bottom .tooltip-arrow {top: 0; left: 50%; margin-left: -5px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 5px solid #000000;}.tooltip.right .tooltip-arrow {top: 50%; left: 0; margin-top: -5px; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-right: 5px solid #000000;}.tooltip-inner {max-width: 200px; padding: 3px 8px; color: #ffffff; text-align: center; text-decoration: none; background-color: #000000; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px;}.tooltip-arrow {position: absolute; width: 0; height: 0;}.popover {position: absolute; top: 0; left: 0; z-index: 1010; display: none; padding: 5px;}.popover.top {margin-top: -5px;}.popover.right {margin-left: 5px;}.popover.bottom {margin-top: 5px;}.popover.left {margin-left: -5px;}.popover.top .arrow {bottom: 0; left: 50%; margin-left: -5px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 5px solid #000000;}.popover.right .arrow {top: 50%; left: 0; margin-top: -5px; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-right: 5px solid #000000;}.popover.bottom .arrow {top: 0; left: 50%; margin-left: -5px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 5px solid #000000;}.popover.left .arrow {top: 50%; right: 0; margin-top: -5px; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 5px solid #000000;}.popover .arrow {position: absolute; width: 0; height: 0;}.popover-inner {padding: 3px; width: 280px; overflow: hidden; background: #000000; background: rgba(0, 0, 0, 0.8); -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); -moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);}.popover-title {padding: 9px 15px; line-height: 1; background-color: #f5f5f5; border-bottom: 1px solid #eee; -webkit-border-radius: 3px 3px 0 0; -moz-border-radius: 3px 3px 0 0; border-radius: 3px 3px 0 0;}.popover-content {padding: 14px; background-color: #ffffff; -webkit-border-radius: 0 0 3px 3px; -moz-border-radius: 0 0 3px 3px; border-radius: 0 0 3px 3px; -webkit-background-clip: padding-box; -moz-background-clip: padding-box; background-clip: padding-box;}.popover-content p,.popover-content ul,.popover-content ol {margin-bottom: 0;}.thumbnails {margin-left: -20px; list-style: none; *zoom: 1;}.thumbnails:before,.thumbnails:after {display: table; content: "";}.thumbnails:after {clear: both;}.row-fluid .thumbnails {margin-left: 0;}.thumbnails > li {float: left; margin-bottom: 18px; margin-left: 20px;}.thumbnail {display: block; padding: 4px; line-height: 1; border: 1px solid #ddd; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075); -moz-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075);}a.thumbnail:hover {border-color: #0088cc; -webkit-box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25); -moz-box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25); box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25);}.thumbnail > img {display: block; max-width: 100%; margin-left: auto; margin-right: auto;}.thumbnail .caption {padding: 9px;}.label,.badge {font-size: 10.998px; font-weight: bold; line-height: 14px; color: #ffffff; vertical-align: baseline; white-space: nowrap; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #999999;}.label {padding: 1px 4px 2px; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px;}.badge {padding: 1px 9px 2px; -webkit-border-radius: 9px; -moz-border-radius: 9px; border-radius: 9px;}a.label:hover,a.badge:hover {color: #ffffff; text-decoration: none; cursor: pointer;}.label-important,.badge-important {background-color: #b94a48;}.label-important[href],.badge-important[href] {background-color: #953b39;}.label-warning,.badge-warning {background-color: #f89406;}.label-warning[href],.badge-warning[href] {background-color: #c67605;}.label-success,.badge-success {background-color: #468847;}.label-success[href],.badge-success[href] {background-color: #356635;}.label-info,.badge-info {background-color: #3a87ad;}.label-info[href],.badge-info[href] {background-color: #2d6987;}.label-inverse,.badge-inverse {background-color: #333333;}.label-inverse[href],.badge-inverse[href] {background-color: #1a1a1a;}@-webkit-keyframes progress-bar-stripes {from {background-position: 40px 0;} to {background-position: 0 0;}}@-moz-keyframes progress-bar-stripes {from {background-position: 40px 0;} to {background-position: 0 0;}}@-ms-keyframes progress-bar-stripes {from {background-position: 40px 0;} to {background-position: 0 0;}}@-o-keyframes progress-bar-stripes {from {background-position: 0 0;} to {background-position: 40px 0;}}@keyframes progress-bar-stripes {from {background-position: 40px 0;} to {background-position: 0 0;}}.progress {overflow: hidden; height: 18px; margin-bottom: 18px; background-color: #f7f7f7; background-image: -moz-linear-gradient(top, #f5f5f5, #f9f9f9); background-image: -ms-linear-gradient(top, #f5f5f5, #f9f9f9); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f5f5f5), to(#f9f9f9)); background-image: -webkit-linear-gradient(top, #f5f5f5, #f9f9f9); background-image: -o-linear-gradient(top, #f5f5f5, #f9f9f9); background-image: linear-gradient(top, #f5f5f5, #f9f9f9); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f5f5f5', endColorstr='#f9f9f9', GradientType=0); -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px;}.progress .bar {width: 0%; height: 18px; color: #ffffff; font-size: 12px; text-align: center; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #0e90d2; background-image: -moz-linear-gradient(top, #149bdf, #0480be); background-image: -ms-linear-gradient(top, #149bdf, #0480be); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#149bdf), to(#0480be)); background-image: -webkit-linear-gradient(top, #149bdf, #0480be); background-image: -o-linear-gradient(top, #149bdf, #0480be); background-image: linear-gradient(top, #149bdf, #0480be); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#149bdf', endColorstr='#0480be', GradientType=0); -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); -moz-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box; -webkit-transition: width 0.6s ease; -moz-transition: width 0.6s ease; -ms-transition: width 0.6s ease; -o-transition: width 0.6s ease; transition: width 0.6s ease;}.progress-striped .bar {background-color: #149bdf; background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); -webkit-background-size: 40px 40px; -moz-background-size: 40px 40px; -o-background-size: 40px 40px; background-size: 40px 40px;}.progress.active .bar {-webkit-animation: progress-bar-stripes 2s linear infinite; -moz-animation: progress-bar-stripes 2s linear infinite; -ms-animation: progress-bar-stripes 2s linear infinite; -o-animation: progress-bar-stripes 2s linear infinite; animation: progress-bar-stripes 2s linear infinite;}.progress-danger .bar {background-color: #dd514c; background-image: -moz-linear-gradient(top, #ee5f5b, #c43c35); background-image: -ms-linear-gradient(top, #ee5f5b, #c43c35); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#c43c35)); background-image: -webkit-linear-gradient(top, #ee5f5b, #c43c35); background-image: -o-linear-gradient(top, #ee5f5b, #c43c35); background-image: linear-gradient(top, #ee5f5b, #c43c35); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ee5f5b', endColorstr='#c43c35', GradientType=0);}.progress-danger.progress-striped .bar {background-color: #ee5f5b; background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);}.progress-success .bar {background-color: #5eb95e; background-image: -moz-linear-gradient(top, #62c462, #57a957); background-image: -ms-linear-gradient(top, #62c462, #57a957); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#57a957)); background-image: -webkit-linear-gradient(top, #62c462, #57a957); background-image: -o-linear-gradient(top, #62c462, #57a957); background-image: linear-gradient(top, #62c462, #57a957); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#57a957', GradientType=0);}.progress-success.progress-striped .bar {background-color: #62c462; background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);}.progress-info .bar {background-color: #4bb1cf; background-image: -moz-linear-gradient(top, #5bc0de, #339bb9); background-image: -ms-linear-gradient(top, #5bc0de, #339bb9); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#339bb9)); background-image: -webkit-linear-gradient(top, #5bc0de, #339bb9); background-image: -o-linear-gradient(top, #5bc0de, #339bb9); background-image: linear-gradient(top, #5bc0de, #339bb9); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5bc0de', endColorstr='#339bb9', GradientType=0);}.progress-info.progress-striped .bar {background-color: #5bc0de; background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);}.progress-warning .bar {background-color: #faa732; background-image: -moz-linear-gradient(top, #fbb450, #f89406); background-image: -ms-linear-gradient(top, #fbb450, #f89406); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406)); background-image: -webkit-linear-gradient(top, #fbb450, #f89406); background-image: -o-linear-gradient(top, #fbb450, #f89406); background-image: linear-gradient(top, #fbb450, #f89406); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fbb450', endColorstr='#f89406', GradientType=0);}.progress-warning.progress-striped .bar {background-color: #fbb450; background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);}.accordion {margin-bottom: 18px;}.accordion-group {margin-bottom: 2px; border: 1px solid #e5e5e5; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px;}.accordion-heading {border-bottom: 0;}.accordion-heading .accordion-toggle {display: block; padding: 8px 15px;}.accordion-toggle {cursor: pointer;}.accordion-inner {padding: 9px 15px; border-top: 1px solid #e5e5e5;}.carousel {position: relative; margin-bottom: 18px; line-height: 1;}.carousel-inner {overflow: hidden; width: 100%; position: relative;}.carousel .item {display: none; position: relative; -webkit-transition: 0.6s ease-in-out left; -moz-transition: 0.6s ease-in-out left; -ms-transition: 0.6s ease-in-out left; -o-transition: 0.6s ease-in-out left; transition: 0.6s ease-in-out left;}.carousel .item > img {display: block; line-height: 1;}.carousel .active,.carousel .next,.carousel .prev {display: block;}.carousel .active {left: 0;}.carousel .next,.carousel .prev {position: absolute; top: 0; width: 100%;}.carousel .next {left: 100%;}.carousel .prev {left: -100%;}.carousel .next.left,.carousel .prev.right {left: 0;}.carousel .active.left {left: -100%;}.carousel .active.right {left: 100%;}.carousel-control {position: absolute; top: 40%; left: 15px; width: 40px; height: 40px; margin-top: -20px; font-size: 60px; font-weight: 100; line-height: 30px; color: #ffffff; text-align: center; background: #222222; border: 3px solid #ffffff; -webkit-border-radius: 23px; -moz-border-radius: 23px; border-radius: 23px; opacity: 0.5; filter: alpha(opacity=50);}.carousel-control.right {left: auto; right: 15px;}.carousel-control:hover {color: #ffffff; text-decoration: none; opacity: 0.9; filter: alpha(opacity=90);}.carousel-caption {position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 15px 5px; background: #333333; background: rgba(0, 0, 0, 0.75);}.carousel-caption h4,.carousel-caption p {color: #ffffff;}.hero-unit {padding: 60px; margin-bottom: 30px; background-color: #eeeeee; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px;}.hero-unit h1 {margin-bottom: 0; font-size: 60px; line-height: 1; color: inherit; letter-spacing: -1px;}.hero-unit p {font-size: 18px; font-weight: 200; line-height: 27px; color: inherit;}.pull-right {float: right;}.pull-left {float: left;}.hide {display: none;}.show {display: block;}.invisible {visibility: hidden;}
\ No newline at end of file diff --git a/src/main/webapp/stylesheets_min/bootstrap-2.0.4/responsive.css b/src/main/webapp/stylesheets_min/bootstrap-2.0.4/responsive.css new file mode 100644 index 0000000..8648adc --- /dev/null +++ b/src/main/webapp/stylesheets_min/bootstrap-2.0.4/responsive.css @@ -0,0 +1 @@ +/*! * Bootstrap Responsive v2.0.4 * * Copyright 2012 Twitter, Inc * Licensed under the Apache License v2.0 * http://www.apache.org/licenses/LICENSE-2.0 * * Designed and built with all the love in the world @twitter by @mdo and @fat. */.clearfix {*zoom: 1;}.clearfix:before,.clearfix:after {display: table; content: "";}.clearfix:after {clear: both;}.hide-text {font: 0/0 a; color: transparent; text-shadow: none; background-color: transparent; border: 0;}.input-block-level {display: block; width: 100%; min-height: 28px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box;}.hidden {display: none; visibility: hidden;}.visible-phone {display: none !important;}.visible-tablet {display: none !important;}.hidden-desktop {display: none !important;}@media (max-width: 767px) {.visible-phone {display: inherit !important;} .hidden-phone {display: none !important;} .hidden-desktop {display: inherit !important;} .visible-desktop {display: none !important;}}@media (min-width: 768px) and (max-width: 979px) {.visible-tablet {display: inherit !important;} .hidden-tablet {display: none !important;} .hidden-desktop {display: inherit !important;} .visible-desktop {display: none !important ;}}@media (max-width: 480px) {.nav-collapse {-webkit-transform: translate3d(0, 0, 0);} .page-header h1 small {display: block; line-height: 18px;} input[type="checkbox"], input[type="radio"] {border: 1px solid #ccc;} .form-horizontal .control-group > label {float: none; width: auto; padding-top: 0; text-align: left;} .form-horizontal .controls {margin-left: 0;} .form-horizontal .control-list {padding-top: 0;} .form-horizontal .form-actions {padding-left: 10px; padding-right: 10px;} .modal {position: absolute; top: 10px; left: 10px; right: 10px; width: auto; margin: 0;} .modal.fade.in {top: auto;} .modal-header .close {padding: 10px; margin: -10px;} .carousel-caption {position: static;}}@media (max-width: 767px) {body {padding-left: 20px; padding-right: 20px;} .navbar-fixed-top, .navbar-fixed-bottom {margin-left: -20px; margin-right: -20px;} .container-fluid {padding: 0;} .dl-horizontal dt {float: none; clear: none; width: auto; text-align: left;} .dl-horizontal dd {margin-left: 0;} .container {width: auto;} .row-fluid {width: 100%;} .row, .thumbnails {margin-left: 0;} [class*="span"], .row-fluid [class*="span"] {float: none; display: block; width: auto; margin-left: 0;} .input-large, .input-xlarge, .input-xxlarge, input[class*="span"], select[class*="span"], textarea[class*="span"], .uneditable-input {display: block; width: 100%; min-height: 28px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box;} .input-prepend input, .input-append input, .input-prepend input[class*="span"], .input-append input[class*="span"] {display: inline-block; width: auto;}}@media (min-width: 768px) and (max-width: 979px) {.row {margin-left: -20px; *zoom: 1;} .row:before, .row:after {display: table; content: "";} .row:after {clear: both;} [class*="span"] {float: left; margin-left: 20px;} .container, .navbar-fixed-top .container, .navbar-fixed-bottom .container {width: 724px;} .span12 {width: 724px;} .span11 {width: 662px;} .span10 {width: 600px;} .span9 {width: 538px;} .span8 {width: 476px;} .span7 {width: 414px;} .span6 {width: 352px;} .span5 {width: 290px;} .span4 {width: 228px;} .span3 {width: 166px;} .span2 {width: 104px;} .span1 {width: 42px;} .offset12 {margin-left: 764px;} .offset11 {margin-left: 702px;} .offset10 {margin-left: 640px;} .offset9 {margin-left: 578px;} .offset8 {margin-left: 516px;} .offset7 {margin-left: 454px;} .offset6 {margin-left: 392px;} .offset5 {margin-left: 330px;} .offset4 {margin-left: 268px;} .offset3 {margin-left: 206px;} .offset2 {margin-left: 144px;} .offset1 {margin-left: 82px;} .row-fluid {width: 100%; *zoom: 1;} .row-fluid:before, .row-fluid:after {display: table; content: "";} .row-fluid:after {clear: both;} .row-fluid [class*="span"] {display: block; width: 100%; min-height: 28px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box; float: left; margin-left: 2.762430939%; *margin-left: 2.709239449638298%;} .row-fluid [class*="span"]:first-child {margin-left: 0;} .row-fluid .span12 {width: 99.999999993%; *width: 99.9468085036383%;} .row-fluid .span11 {width: 91.436464082%; *width: 91.38327259263829%;} .row-fluid .span10 {width: 82.87292817100001%; *width: 82.8197366816383%;} .row-fluid .span9 {width: 74.30939226%; *width: 74.25620077063829%;} .row-fluid .span8 {width: 65.74585634900001%; *width: 65.6926648596383%;} .row-fluid .span7 {width: 57.182320438000005%; *width: 57.129128948638304%;} .row-fluid .span6 {width: 48.618784527%; *width: 48.5655930376383%;} .row-fluid .span5 {width: 40.055248616%; *width: 40.0020571266383%;} .row-fluid .span4 {width: 31.491712705%; *width: 31.4385212156383%;} .row-fluid .span3 {width: 22.928176794%; *width: 22.874985304638297%;} .row-fluid .span2 {width: 14.364640883%; *width: 14.311449393638298%;} .row-fluid .span1 {width: 5.801104972%; *width: 5.747913482638298%;} input, textarea, .uneditable-input {margin-left: 0;} input.span12, textarea.span12, .uneditable-input.span12 {width: 714px;} input.span11, textarea.span11, .uneditable-input.span11 {width: 652px;} input.span10, textarea.span10, .uneditable-input.span10 {width: 590px;} input.span9, textarea.span9, .uneditable-input.span9 {width: 528px;} input.span8, textarea.span8, .uneditable-input.span8 {width: 466px;} input.span7, textarea.span7, .uneditable-input.span7 {width: 404px;} input.span6, textarea.span6, .uneditable-input.span6 {width: 342px;} input.span5, textarea.span5, .uneditable-input.span5 {width: 280px;} input.span4, textarea.span4, .uneditable-input.span4 {width: 218px;} input.span3, textarea.span3, .uneditable-input.span3 {width: 156px;} input.span2, textarea.span2, .uneditable-input.span2 {width: 94px;} input.span1, textarea.span1, .uneditable-input.span1 {width: 32px;}}@media (min-width: 1200px) {.row {margin-left: -30px; *zoom: 1;} .row:before, .row:after {display: table; content: "";} .row:after {clear: both;} [class*="span"] {float: left; margin-left: 30px;} .container, .navbar-fixed-top .container, .navbar-fixed-bottom .container {width: 1170px;} .span12 {width: 1170px;} .span11 {width: 1070px;} .span10 {width: 970px;} .span9 {width: 870px;} .span8 {width: 770px;} .span7 {width: 670px;} .span6 {width: 570px;} .span5 {width: 470px;} .span4 {width: 370px;} .span3 {width: 270px;} .span2 {width: 170px;} .span1 {width: 70px;} .offset12 {margin-left: 1230px;} .offset11 {margin-left: 1130px;} .offset10 {margin-left: 1030px;} .offset9 {margin-left: 930px;} .offset8 {margin-left: 830px;} .offset7 {margin-left: 730px;} .offset6 {margin-left: 630px;} .offset5 {margin-left: 530px;} .offset4 {margin-left: 430px;} .offset3 {margin-left: 330px;} .offset2 {margin-left: 230px;} .offset1 {margin-left: 130px;} .row-fluid {width: 100%; *zoom: 1;} .row-fluid:before, .row-fluid:after {display: table; content: "";} .row-fluid:after {clear: both;} .row-fluid [class*="span"] {display: block; width: 100%; min-height: 28px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box; float: left; margin-left: 2.564102564%; *margin-left: 2.510911074638298%;} .row-fluid [class*="span"]:first-child {margin-left: 0;} .row-fluid .span12 {width: 100%; *width: 99.94680851063829%;} .row-fluid .span11 {width: 91.45299145300001%; *width: 91.3997999636383%;} .row-fluid .span10 {width: 82.905982906%; *width: 82.8527914166383%;} .row-fluid .span9 {width: 74.358974359%; *width: 74.30578286963829%;} .row-fluid .span8 {width: 65.81196581200001%; *width: 65.7587743226383%;} .row-fluid .span7 {width: 57.264957265%; *width: 57.2117657756383%;} .row-fluid .span6 {width: 48.717948718%; *width: 48.6647572286383%;} .row-fluid .span5 {width: 40.170940171000005%; *width: 40.117748681638304%;} .row-fluid .span4 {width: 31.623931624%; *width: 31.5707401346383%;} .row-fluid .span3 {width: 23.076923077%; *width: 23.0237315876383%;} .row-fluid .span2 {width: 14.529914530000001%; *width: 14.4767230406383%;} .row-fluid .span1 {width: 5.982905983%; *width: 5.929714493638298%;} input, textarea, .uneditable-input {margin-left: 0;} input.span12, textarea.span12, .uneditable-input.span12 {width: 1160px;} input.span11, textarea.span11, .uneditable-input.span11 {width: 1060px;} input.span10, textarea.span10, .uneditable-input.span10 {width: 960px;} input.span9, textarea.span9, .uneditable-input.span9 {width: 860px;} input.span8, textarea.span8, .uneditable-input.span8 {width: 760px;} input.span7, textarea.span7, .uneditable-input.span7 {width: 660px;} input.span6, textarea.span6, .uneditable-input.span6 {width: 560px;} input.span5, textarea.span5, .uneditable-input.span5 {width: 460px;} input.span4, textarea.span4, .uneditable-input.span4 {width: 360px;} input.span3, textarea.span3, .uneditable-input.span3 {width: 260px;} input.span2, textarea.span2, .uneditable-input.span2 {width: 160px;} input.span1, textarea.span1, .uneditable-input.span1 {width: 60px;} .thumbnails {margin-left: -30px;} .thumbnails > li {margin-left: 30px;} .row-fluid .thumbnails {margin-left: 0;}}@media (max-width: 979px) {body {padding-top: 0;} .navbar-fixed-top, .navbar-fixed-bottom {position: static;} .navbar-fixed-top {margin-bottom: 18px;} .navbar-fixed-bottom {margin-top: 18px;} .navbar-fixed-top .navbar-inner, .navbar-fixed-bottom .navbar-inner {padding: 5px;} .navbar .container {width: auto; padding: 0;} .navbar .brand {padding-left: 10px; padding-right: 10px; margin: 0 0 0 -5px;} .nav-collapse {clear: both;} .nav-collapse .nav {float: none; margin: 0 0 9px;} .nav-collapse .nav > li {float: none;} .nav-collapse .nav > li > a {margin-bottom: 2px;} .nav-collapse .nav > .divider-vertical {display: none;} .nav-collapse .nav .nav-header {color: #999999; text-shadow: none;} .nav-collapse .nav > li > a, .nav-collapse .dropdown-menu a {padding: 6px 15px; font-weight: bold; color: #999999; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px;} .nav-collapse .btn {padding: 4px 10px 4px; font-weight: normal; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px;} .nav-collapse .dropdown-menu li + li a {margin-bottom: 2px;} .nav-collapse .nav > li > a:hover, .nav-collapse .dropdown-menu a:hover {background-color: #222222;} .nav-collapse.in .btn-group {margin-top: 5px; padding: 0;} .nav-collapse .dropdown-menu {position: static; top: auto; left: auto; float: none; display: block; max-width: none; margin: 0 15px; padding: 0; background-color: transparent; border: none; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none;} .nav-collapse .dropdown-menu:before, .nav-collapse .dropdown-menu:after {display: none;} .nav-collapse .dropdown-menu .divider {display: none;} .nav-collapse .navbar-form, .nav-collapse .navbar-search {float: none; padding: 9px 15px; margin: 9px 0; border-top: 1px solid #222222; border-bottom: 1px solid #222222; -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1); -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1); box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1);} .navbar .nav-collapse .nav.pull-right {float: none; margin-left: 0;} .nav-collapse, .nav-collapse.collapse {overflow: hidden; height: 0;} .navbar .btn-navbar {display: block;} .navbar-static .navbar-inner {padding-left: 10px; padding-right: 10px;}}@media (min-width: 980px) {.nav-collapse.collapse {height: auto !important; overflow: visible !important;}}
\ No newline at end of file diff --git a/src/main/webapp/stylesheets_min/codemirror.css b/src/main/webapp/stylesheets_min/codemirror.css new file mode 100644 index 0000000..34a9fca --- /dev/null +++ b/src/main/webapp/stylesheets_min/codemirror.css @@ -0,0 +1 @@ +.CodeMirror {line-height: 1em; font-family: monospace;}.CodeMirror-scroll {overflow: auto; height: 300px; position: relative; outline: none;}.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;}.CodeMirror-lines {padding: .4em; white-space: pre;}.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;}.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;}.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);}.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: #a0a;}.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;}div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
\ No newline at end of file diff --git a/src/main/webapp/stylesheets_min/fiddle.css b/src/main/webapp/stylesheets_min/fiddle.css new file mode 100644 index 0000000..cb73364 --- /dev/null +++ b/src/main/webapp/stylesheets_min/fiddle.css @@ -0,0 +1 @@ +@media (max-width: 440px) {#exit_fullscreen span, .helpTip {display: none !important;}}@media (min-width: 480px) and (max-width: 979px) {#db_type_label_collapsed {display: inline !important;}}@media (min-width: 820px) and (max-width: 1024px) {.nav-collapse .pull-right {display: none;}}@media (min-width: 820px) and (max-width: 1100px) {.nav-collapse .pull-right .optional {display: none;}}@media (max-width: 767px) {div.sql {width: 100% !important;} .helpTip {width: 180px !important; height: 30% !important;}}@media (min-width: 768px) and (max-width: 979px) {.helpTip {width: 100px !important; height: 50% !important;}}@media (max-width: 979px) {body {padding-top: 0px !important;} textarea.fullscreen {top: 50px !important;} #paypal_donate {padding-left: 15px;}}body {padding-top: 60px;}#db_type_label_collapsed,#exit_fullscreen {display: none;}#db_type_label_collapsed li {display: inline-block;}textarea.fullscreen {z-index: 10000; height: 100%; width: 100%; position: fixed; top: 40px; left: 0;}.schema {position: relative;}.helpTip {position: absolute; display: none; width: 180px; height: 60%; min-height: 50px; overflow-y: auto; right: 0px; z-index: 1001; margin: 10px 20px;}#browser,.browser_actions {padding-left: 15px; display: none; width: 100%;}#browser {overflow: auto; border: solid thin lightgray;}#sql,#schema_ddl {width: 98%; font-family: monospace; white-space: nowrap; overflow: auto; font-size: 10pt; min-height: 100px;}.tables,.columns {list-style-type: none;}.tables .columns {display: none;}.popover .tables .columns {display: block;}.resultSetWrapper,.schemaPreviewWrapper,.queryLog-hidden {display: none;}.resultSetPreview {list-style-type: none; margin: 0;}.resultSetPreview li {white-space: nowrap;}.resultSetPreview pre {margin-bottom: 2px; overflow-x: hidden; max-height: 75px; overflow-y: hidden; background-color: white;}.resultSetPreview > pre,.schemaPreview > pre {margin-bottom: 2px; overflow-x: hidden; max-height: 200px; overflow-y: hidden; background-color: white;}pre.results,.resultSetPreview li pre {font-family: monospace; font-size: 10pt;}.database-error {white-space: pre-wrap;}#runQueryOptions {min-width: 120px;}#content .panel form textarea {display: block; margin: 0; resize: none;}#content .panel.schema {margin: 0;}#output {margin: 0; height: 50%; clear: both; padding-top: 5px;}#content #output form label {top: 10px;}#schema-output {margin: 0; height: 50%; padding-bottom: 5px;}#content form {margin: 0;}.tab-content .tab-pane {height: 100%;}.database-messages i {margin-right: 5px; opacity: .5;}#fiddleFormDDL {position: relative;}#content .panel form label {z-index: 250;}#fiddleFormDDL label a i {margin: 1px;}.executionPlan {width: 90%; margin-left: 10%; display: none;}.executionPlanLink,.setLink {margin-left: 20px;}.oracle_xplan {margin: 0px; overflow: hidden; width: 800px; height: 600px; border: solid thin black; display: inline-block;}.highlight {border: solid thin blue; margin: 5px;}.action_buttons {margin: 5px 0; padding: 0 10px;}.action_buttons > a,.action_buttons > div {margin-bottom: 3px; vertical-align: top; display: inline-block;}.action_buttons .dropdown-menu {text-align: right;}#content .CodeMirror {border: 1px solid #cccccc; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px;}.CodeMirror-scroll {height: 200px; overflow-y: scroll; overflow-x: auto;}.CodeMirror-fullscreen {display: block; position: fixed; top: 42px; left: 0; width: 100%; height: 100%; z-index: 9999; margin: 0; padding: 0; border: 0px solid #BBBBBB; opacity: 1; background-color: white;}#hosting {display: block; margin: 10px auto 0 auto; text-align: center;}#hosting h4 {text-align: center;}#hostingPartners {padding: 0px; display: inline-block; text-align: left; list-style-type: none;}#hostingPartners li {margin: 20px 0; font-family: sans-serif; font-size: 8pt; height: 50px; display: inline;}#hostingPartners a {display: inline-block; float: left;}#hostingPartners img {height: 90px; margin: 0 auto; text-align: center; display: block; border: none;}#hostingPartners span {float: left; display: block; width: 150px;}.modal {display: none;}#myFiddlesModal {width: 800px; margin: -250px 0 0 -420px;}#myFiddlesModal .modal-body {overflow-y: auto;}#myFiddlesTabs {margin-bottom: 0;}#raw,#parseResults {width: 90%;}#parseResults {height: 60px; overflow: auto;}#openid_identifier {width: 250px; margin: 0px; padding: 2px; padding-left: 20px; vertical-align: middle; background-image: url('http://www.idselector.com/images/openid.ico'); background-repeat: no-repeat; background-position: 3px 2px;}#gravatar {height: 20px; width: 20px; margin: 0 10px 0 5px;}.navbar .nav.pull-right {margin-left: 2px;}.nav-collapse > .nav {margin-right: 2px;}.navbar .brand {padding-left: 10px;}.container-fluid .pull-right {float: right !important;}.nav-collapse.in .pull-right {float: left !important;}.navbar .btn-navbar {background-color: #d6d6d6; background-image: -moz-linear-gradient(top, #ffffff, #999999); background-image: -ms-linear-gradient(top, #ffffff, #999999); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#999999)); background-image: -webkit-linear-gradient(top, #ffffff, #999999); background-image: -o-linear-gradient(top, #ffffff, #999999); background-image: linear-gradient(top, #ffffff, #999999); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#999999', GradientType=0); border-color: #999999 #999999 #737373; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075); -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075);}.btn-navbar:hover,.btn-navbar:active,.btn-navbar.active,.btn-navbar.disabled,.btn-navbar[disabled] {background-color: #999999;}.btn-navbar:active,.btn-navbar.active {background-color: #808080 \9;}.navbar .brand {white-space: nowrap;}.navbar {color: black;}.navbar-inner {background-color: #d6d6d6; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#999999', GradientType=0); background-image: -moz-linear-gradient(top, #ffffff, #999999); background-image: -ms-linear-gradient(top, #ffffff, #999999); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#999999)); background-image: -webkit-linear-gradient(top, #ffffff, #999999); background-image: -o-linear-gradient(top, #ffffff, #999999); background-image: linear-gradient(top, #ffffff, #999999);}.navbar .nav > li > a {color: #333333; text-shadow: none;}.navbar .divider-vertical {background-color: #999; border-right: 1px solid white;}.navbar .nav .active > a,.navbar .nav .active > a:hover {color: #999999; text-decoration: none; background-color: #999999; background-color: rgba(0, 0, 0, 0.5);}.navbar .nav .active > a {color: #eeeeee;}.navbar .nav .active > a:hover {color: #eeeeee;}.navbar .nav > li > a i {margin-right: 5px;}.navbar .brand {color: #000000;}.dropdown-menu a i {margin-right: 5px;}.dropdown-toggle b.caret {color: #999999; opacity: .5;}.dropdown-menu.nav {z-index: 1050 !important;}.dropdown-menu.nav li > a:hover,.dropdown-menu.nav .active > a,.dropdown-menu.nav .active > a:hover {color: #ffffff; text-decoration: none; background-color: #0088cc;}.form-horizontal .control-group {margin-bottom: 6px;}.modal form {margin: 0;}.popover-inner {min-width: 280px; width: auto; overflow-x: visible; overflow-y: hidden; max-height: 400px;}.popover-inner .alert {max-width: 400px; overflow-x: hidden;}#sidebar .well {padding: 8px 0;}#content {height: 100%;}#content .panel {margin: 0;}#content .panel {min-height: 125px; height: 100%; position: relative;}#content .panel form {height: 100%;}
\ No newline at end of file diff --git a/src/main/webapp/stylesheets_min/qp.css b/src/main/webapp/stylesheets_min/qp.css new file mode 100644 index 0000000..d2dac70 --- /dev/null +++ b/src/main/webapp/stylesheets_min/qp.css @@ -0,0 +1 @@ +div.qp-node{background-color: #FFFFCC; margin: 2px; padding: 2px; border: 1px solid black; font-size: 11px; line-height: normal;}.qp-node > div{font-family: Monospace; text-align: center;}div[class|='qp-icon']{height: 32px; width: 32px; margin-left: auto; margin-right: auto; background-repeat: no-repeat;}.qp-tt{top: 4em; left: 2em; border: 1px solid black; background-color: #FFFFEE; padding: 2px;}.qp-tt div, .qp-tt table{font-family: Sans-Serif; text-align: left;}.qp-tt table{border-width: 0px; border-spacing: 0px; margin-top: 10px; margin-bottom: 10px; width: 100%;}.qp-tt td, .qp-tt th{font-size: 11px; border-bottom: solid 1px Black; padding: 1px;}.qp-tt td{text-align: right; padding-left: 10px;}.qp-tt th{text-align: left;}.qp-bold, .qp-tt-header{font-weight: bold;}.qp-tt-header{text-align: center;}.qp-icon-Catchall{background-image:url('../images/qp/bitmap.gif')}.qp-icon-ArithmeticExpression{background-image:url('../images/qp/arithmetic_expression.gif')}.qp-icon-Assert{background-image:url('../images/qp/assert.gif')}.qp-icon-Assign{background-image:url('../images/qp/assign.gif')}.qp-icon-Bitmap{background-image:url('../images/qp/bitmap.gif')}.qp-icon-BookmarkLookup{background-image:url('../images/qp/bookmark_lookup.gif')}.qp-icon-ClusteredIndexDelete{background-image:url('../images/qp/clustered_index_delete.gif')}.qp-icon-ClusteredIndexInsert{background-image:url('../images/qp/clustered_index_insert.gif')}.qp-icon-ClusteredIndexScan{background-image:url('../images/qp/clustered_index_scan.gif')}.qp-icon-ClusteredIndexSeek{background-image:url('../images/qp/clustered_index_seek.gif')}.qp-icon-ClusteredIndexUpdate{background-image:url('../images/qp/clustered_index_update.gif')}.qp-icon-Collapse{background-image:url('../images/qp/collapse.gif')}.qp-icon-ComputeScalar{background-image:url('../images/qp/compute_scalar.gif')}.qp-icon-Concatenation{background-image:url('../images/qp/concatenation.gif')}.qp-icon-ConstantScan{background-image:url('../images/qp/constant_scan.gif')}.qp-icon-Convert{background-image:url('../images/qp/convert.gif')}.qp-icon-CursorCatchall{background-image:url('../images/qp/bitmap.gif')}.qp-icon-Declare{background-image:url('../images/qp/declare.gif')}.qp-icon-Delete{background-image:url('../images/qp/table_delete.gif')}.qp-icon-DistributeStreams{background-image:url('../images/qp/distribute_streams.gif')}.qp-icon-Dynamic{background-image:url('../images/qp/dynamic.gif')}.qp-icon-EagerSpool{background-image:url('../images/qp/spool.gif')}.qp-icon-FetchQuery{background-image:url('../images/qp/fetch_query.gif')}.qp-icon-Filter{background-image:url('../images/qp/filter.gif')}.qp-icon-GatherStreams{background-image:url('../images/qp/gather_streams.gif')}.qp-icon-HashMatch{background-image:url('../images/qp/hash_match.gif')}.qp-icon-HashMatchRoot{background-image:url('../images/qp/hash_match.gif')}.qp-icon-HashMatchTeam{background-image:url('../images/qp/hash_match.gif')}.qp-icon-If{background-image:url('../images/qp/if.gif')}.qp-icon-Insert{background-image:url('../images/qp/table_insert.gif')}.qp-icon-InsertedScan{background-image:url('../images/qp/inserted_scan.gif')}.qp-icon-Intrinsic{background-image:url('../images/qp/intrinsic.gif')}.qp-icon-IteratorCatchall{background-image:url('../images/qp/bitmap.gif')}.qp-icon-Keyset{background-image:url('../images/qp/keyset.gif')}.qp-icon-LanguageElementCatchall{background-image:url('../images/qp/bitmap.gif')}.qp-icon-LazySpool{background-image:url('../images/qp/spool.gif')}.qp-icon-LogRowScan{background-image:url('../images/qp/log_row_scan.gif')}.qp-icon-MergeInterval{background-image:url('../images/qp/merge_interval.gif')}.qp-icon-MergeJoin{background-image:url('../images/qp/merge_join.gif')}.qp-icon-NestedLoops{background-image:url('../images/qp/nested_loops.gif')}.qp-icon-NonclusteredIndexDelete{background-image:url('../images/qp/nonclustered_index_delete.gif')}.qp-icon-NonclusteredIndexInsert{background-image:url('../images/qp/nonclustered_index_insert.gif')}.qp-icon-NonclusteredIndexScan{background-image:url('../images/qp/nonclustered_index_scan.gif')}.qp-icon-IndexSeek{background-image:url('../images/qp/nonclustered_index_seek.gif')}.qp-icon-NonclusteredIndexSpool{background-image:url('../images/qp/nonclustered_index_spool.gif')}.qp-icon-NonclusteredIndexUpdate{background-image:url('../images/qp/nonclustered_index_update.gif')}.qp-icon-OnlineIndexInsert{background-image:url('../images/qp/online_index_insert.gif')}.qp-icon-ParameterTableScan{background-image:url('../images/qp/parameter_table_scan.gif')}.qp-icon-PopulationQuery{background-image:url('../images/qp/population_query.gif')}.qp-icon-RdiLookup{background-image:url('../images/qp/rdi_lookup.gif')}.qp-icon-RefreshQuery{background-image:url('../images/qp/refresh_query.gif')}.qp-icon-RemoteDelete{background-image:url('../images/qp/remote_delete.gif')}.qp-icon-RemoteInsert{background-image:url('../images/qp/remote_insert.gif')}.qp-icon-RemoteQuery{background-image:url('../images/qp/remote_query.gif')}.qp-icon-RemoteScan{background-image:url('../images/qp/remote_scan.gif')}.qp-icon-RemoteUpdate{background-image:url('../images/qp/remote_update.gif')}.qp-icon-RepartitionStreams{background-image:url('../images/qp/repartition_streams.gif')}.qp-icon-Result{background-image:url('../images/qp/result.gif')}.qp-icon-RowCountSpool{background-image:url('../images/qp/row_count_spool.gif')}.qp-icon-Segment{background-image:url('../images/qp/segment.gif')}.qp-icon-Sequence{background-image:url('../images/qp/sequence.gif')}.qp-icon-Sequenceproject{background-image:url('../images/qp/sequenceproject.gif')}.qp-icon-Snapshot{background-image:url('../images/qp/snapshot.gif')}.qp-icon-Sort{background-image:url('../images/qp/sort.gif')}.qp-icon-Split{background-image:url('../images/qp/split.gif')}.qp-icon-Spool{background-image:url('../images/qp/spool.gif')}.qp-icon-Statement{background-image:url('../images/qp/result.gif')}.qp-icon-StreamAggregate{background-image:url('../images/qp/stream_aggregate.gif')}.qp-icon-Switch{background-image:url('../images/qp/switch.gif')}.qp-icon-TableDelete{background-image:url('../images/qp/table_delete.gif')}.qp-icon-TableInsert{background-image:url('../images/qp/table_insert.gif')}.qp-icon-TableScan{background-image:url('../images/qp/table_scan.gif')}.qp-icon-TableSpool{background-image:url('../images/qp/table_spool.gif')}.qp-icon-TableUpdate{background-image:url('../images/qp/table_update.gif')}.qp-icon-TableValuedFunction{background-image:url('../images/qp/table_valued_function.gif')}.qp-icon-Top{background-image:url('../images/qp/top.gif')}.qp-icon-Udx{background-image:url('../images/qp/udx.gif')}.qp-icon-Update{background-image:url('../images/qp/table_update.gif.gif')}.qp-icon-While{background-image:url('../images/qp/while.gif')}.qp-tt{position: absolute; display: none; z-index: 1; white-space: normal;}div.qp-node:hover .qp-tt{display: block;}.qp-tt table{white-space: nowrap;}.qp-node{position: relative; white-space: nowrap;}.qp-tr{display: table;}.qp-tr > div{display: table-cell; padding-left: 15px;}.qp-tr canvas,.qp-root canvas {height: 100%;}
\ No newline at end of file diff --git a/src/main/webapp/stylesheets_min/test.css b/src/main/webapp/stylesheets_min/test.css new file mode 100644 index 0000000..77f4a91 --- /dev/null +++ b/src/main/webapp/stylesheets_min/test.css @@ -0,0 +1 @@ +.box {color: #ff33ac; border-color: #fecdea;}.box div {box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); -moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);}
\ No newline at end of file diff --git a/src/main/webapp/tests/.gitignore b/src/main/webapp/tests/.gitignore new file mode 100644 index 0000000..d3f5a12 --- /dev/null +++ b/src/main/webapp/tests/.gitignore @@ -0,0 +1 @@ +
diff --git a/src/main/webapp/views/Dashboard/index.cfm b/src/main/webapp/views/Dashboard/index.cfm new file mode 100644 index 0000000..66f924c --- /dev/null +++ b/src/main/webapp/views/Dashboard/index.cfm @@ -0,0 +1,11 @@ +<cfoutput> +<h1>Welcome to SQL Fiddle</h1> + +<cfdump var="#session.user#"> + +<img src="http://www.gravatar.com/avatar/#lcase(Hash(lcase(session.user.email)))#" alt="#session.user.firstname# #session.user.lastname#'s Gravatar" title="#session.user.firstname# #session.user.lastname#" /> + +<br><br> +<a href="#URLFor(controller='users', action='logout')#">Logout</a> + +</cfoutput>
\ No newline at end of file diff --git a/src/main/webapp/views/Fiddles/_loginModal.cfm b/src/main/webapp/views/Fiddles/_loginModal.cfm new file mode 100644 index 0000000..34d008e --- /dev/null +++ b/src/main/webapp/views/Fiddles/_loginModal.cfm @@ -0,0 +1,29 @@ + <div id="loginModal" class="modal"> + <form action="index.cfm/Users/auth" method="post" class="form-horizontal"> + <input type="hidden" name="hash" value="" id="hash"> + <div class="modal-header"> + <a class="close" data-dismiss="modal">x</a> + <h3>Login to SQL Fiddle</h3> + </div> + <div class="modal-body"> + <div class="control-group"> + <label class="control-label" for="openid_identifier">OpenID Identity: </label> + <div class="controls"> + <input type="text" id="openid_identifier" name="openid_identity" value="" size="20" /> + </div> + </div> + + <div class="control-group"> + <label class="control-label" for="remember">Remember Me: </label> + <div class="controls"> + <input type="checkbox" value="true" name="remember" id="remember"> + </div> + </div> + </div> + + <div class="modal-footer"> + <input class="btn btn-primary" type="submit" value="Login" /> + </div> + + </form> + </div> diff --git a/src/main/webapp/views/Fiddles/_myFiddlesModal.cfm b/src/main/webapp/views/Fiddles/_myFiddlesModal.cfm new file mode 100644 index 0000000..dd6a66f --- /dev/null +++ b/src/main/webapp/views/Fiddles/_myFiddlesModal.cfm @@ -0,0 +1,16 @@ + <div id="myFiddlesModal" class="modal"> + + <form action="index.cfm/Users/auth" method="post"> + <div class="modal-header"> + <a class="close" data-dismiss="modal">x</a> + <ul class="nav nav-tabs" id="myFiddlesTabs"> + <li class="active"><a href="#fiddle_history" data-toggle="tab">Fiddle History</a></li> + <li><a href="#favorites" data-toggle="tab">Favorites <i class="icon-star"></i></a></li> + </ul> + </div> + + <div class="modal-body tab-content"> + </div> + + </form> + </div> diff --git a/src/main/webapp/views/Fiddles/_textToDDL.cfm b/src/main/webapp/views/Fiddles/_textToDDL.cfm new file mode 100644 index 0000000..7295fd2 --- /dev/null +++ b/src/main/webapp/views/Fiddles/_textToDDL.cfm @@ -0,0 +1,20 @@ + <div id="textToDDLModal" class="modal"> + <div class="modal-header"> + <a class="close" data-dismiss="modal">x</a> + <h3>Formatted Text Table to DDL</h3> + </div> + + <div class="modal-body"> + <label for="tableName">Table Name: </label><input type="text" id="tableName" value="Table1"><br> + <textarea id="raw" cols="40" rows="8" placeholder="Paste formatted text here. CSV, space-separated, pipe-delimited are all valid."></textarea> + <hr> + + <pre id="parseResults"></pre> + + </div> + <div class="modal-footer"> + <a href="#" id="appendDDL" class="btn btn-primary">Append to DDL</a> + <a href="#" id="parseDDL" class="btn">Test Parse</a> + </div> + + </div> diff --git a/src/main/webapp/views/Fiddles/dbtypes.cfm b/src/main/webapp/views/Fiddles/dbtypes.cfm new file mode 100644 index 0000000..0f343ed --- /dev/null +++ b/src/main/webapp/views/Fiddles/dbtypes.cfm @@ -0,0 +1,18 @@ +<cfset dbObjects = []> +<cfloop query="db_types"> + <cfset ArrayAppend(dbObjects, { + "id"= ID, + "sample_fragment"= SAMPLE_FRAGMENT, + "notes"= NOTES, + "simple_name"= SIMPLE_NAME, + "full_name"= FULL_NAME, + "context"= CONTEXT, + "className"= JDBC_CLASS_NAME + })> +</cfloop> +<cfoutput> +// generated from index.cfm/Fiddles/dbTypes?format=js on #Now()# +define([], function () { + return #SerializeJSON(dbObjects)#; +}); +</cfoutput>
\ No newline at end of file diff --git a/src/main/webapp/views/Fiddles/index.cfm b/src/main/webapp/views/Fiddles/index.cfm new file mode 100644 index 0000000..998cee7 --- /dev/null +++ b/src/main/webapp/views/Fiddles/index.cfm @@ -0,0 +1,131 @@ + <div class="span12" id="schema-output"> + <div class="span6 panel schema pull-left"> + + <div class="helpTip alert alert-info alert-block"> + <h4 class="alert-heading">Schema Panel</h4> + Use this panel to setup your database problem (CREATE TABLE, INSERT, and whatever other statements you need to prepare a representative sample of your real database). + Use "Text to DDL" to quickly build your schema objects from text. + </div> + + <form id="fiddleFormDDL" method="post" action=""> + <textarea id="schema_ddl"></textarea> + + <div id="browser"></div> + + <div class="action_buttons ddl_actions"> + + <a href="#" id="buildSchema"> + <label for="result-ddl" class="btn btn-primary"> + Build Schema <i class="icon-download-alt icon-white"></i> + </label> + </a> + + <a href="#" id="schemaFullscreen" class="btn btn-info"> + Edit Fullscreen <i class="icon-resize-full icon-white"></i> + </a> + + <a href="#" id="schemaBrowser" class="btn btn-info"> + Browser <i class="icon-indent-left icon-white"></i> + </a> + <!-- + <a href="#" id="schemaDiagram" class="btn btn-info"> + Diagram <i class="icon-qrcode"></i> + </a> + --> + <div class="btn-group terminator" id="schemaStmtTerminator" data-statement_separator=";"> + <a class="btn btn-info dropdown-toggle" data-toggle="dropdown" href="#"> + [ ; ] + <span class="caret"></span> + </a> + <ul class="dropdown-menu nav"> + <li class="nav-header">Query Terminator</li> + <li class="divider"></li> + <li><a href=";">Semi-colon [ ; ]</a></li> + <li><a href="|">Pipe [ | ]</a></li> + <li><a href="/">Slash [ / ]</a></li> + <li><a href="//">Double-slash [ // ]</a></li> + <li><a href="GO">Keyword [ GO ]</a></li> + </ul> + </div> + + + + </div> + + <div class="action_buttons browser_actions"> + <a href="#" id="ddlEdit" class="btn btn-info"> + DDL Editor <i class="icon-pencil icon-white"></i> + </a> + </div> + + + + </form> + + </div><!-- end ddl div --> + + + <div class="span6 panel sql pull-right needsReadySchema"> + + + <div class="helpTip alert alert-info alert-block"> + <h4 class="alert-heading">Query Panel</h4> + Use this panel to try to solve the problem with other SQL statements (SELECTs, etc...). + Results will be displayed below. Share your queries by copying and pasting the URL that is generated after each run. + </div> + + + <form id="fiddleFormSQL" method="post" action="" class="schema_ready"> + <textarea id="sql"></textarea> + + <div class="action_buttons"> + + <div class="btn-group" id="runQueryOptions"> + + <a href="#" class="runQuery btn btn-primary">Run SQL <i class="icon-play icon-white"></i></a> + + <button class="btn btn-primary dropdown-toggle" data-toggle="dropdown"> + <span class="caret"></span> + </button> + <ul class="dropdown-menu"> + <!-- dropdown menu links --> + <li><a href="#" id="tabular">Tabular Output</a></li> + <li><a href="#" id="plaintext">Plaintext Output</a></li> + </ul> + + </div> + + <a href="#" id="queryFullscreen" class="btn btn-info"> + Edit Fullscreen <i class="icon-resize-full icon-white"></i> + </a> + + <a href="#" id="queryPrettify" class="btn btn-info"> + Format Code <i class="icon-filter icon-white"></i> + </a> + + <div class="btn-group terminator" id="queryStmtTerminator" data-statement_separator=";"> + <a class="btn btn-info dropdown-toggle" data-toggle="dropdown" href="#"> + [ ; ] + <span class="caret"></span> + </a> + <ul class="dropdown-menu nav"> + <li class="nav-header">Query Terminator</li> + <li class="divider"></li> + <li><a href=";">Semi-colon [ ; ]</a></li> + <li><a href="|">Pipe [ | ]</a></li> + <li><a href="/">Slash [ / ]</a></li> + <li><a href="//">Double-slash [ // ]</a></li> + <li><a href="GO">Keyword [ GO ]</a></li> + </ul> + </div> + + + </div> + + </form> + </div><!-- end sql div --> + + </div><!-- end schema-output --> + + <div class="span12 panel needsReadySchema" id="output"> + </div> <!-- end output --> diff --git a/src/main/webapp/views/QUnit/index.cfm b/src/main/webapp/views/QUnit/index.cfm new file mode 100644 index 0000000..e74ffbf --- /dev/null +++ b/src/main/webapp/views/QUnit/index.cfm @@ -0,0 +1,4 @@ +<div id="qunit"></div> +<div id="qunit-fixture"></div> + +<cfoutput>#requireJSTag(main="qunit_main")#</cfoutput> diff --git a/src/main/webapp/views/QUnit/layout.cfm b/src/main/webapp/views/QUnit/layout.cfm new file mode 100644 index 0000000..e6c9592 --- /dev/null +++ b/src/main/webapp/views/QUnit/layout.cfm @@ -0,0 +1,13 @@ +<!doctype html> +<cfoutput> +<html> + <head> + <title>QUnit Tests</title> + <base href="#application.wheels.webPath#"> + #stylesheetLinkTag("qunit-1.10.0.css")# + + <body> + #includeContent()# + </body> +</html> +</cfoutput> diff --git a/src/main/webapp/views/UserFiddles/_favorites.cfm b/src/main/webapp/views/UserFiddles/_favorites.cfm new file mode 100644 index 0000000..6892dee --- /dev/null +++ b/src/main/webapp/views/UserFiddles/_favorites.cfm @@ -0,0 +1,102 @@ + <cfif favorites.recordCount> + + <table class="table table-striped" id="fiddle_favorites_table"> + <thead> + <th>Database Type</th> + <th>Identifier</th> + <th>My Last Access</th> + <th>My # Accesses</th> + <th colspan="3"> </th> + </thead> + <tbody> + <cfoutput query="favorites" group="schema_fragment"> + <cfset query_access = DateAdd('h', #getTimeZoneInfo().utcHourOffset#-#params.tz#, last_accessed)> + + <tr> + <td>#full_name#</td> + <td><a href="##!#schema_fragment#/#query_id#">##!#schema_fragment#/#query_id#</a></td> + <td>#DateFormat(query_access, "mm/dd/yyyy")# #TimeFormat(query_access, "hh:mm tt")#</td> + <td>#num_accesses#</td> + + <td> + <a href="##removeFavorite" schema_def_id="#schema_def_id#" query_id="#query_id#" title="Remove from favorites" class="favorite"><i class="icon-star"></i></a> + </td> + + <td> + <cfif IsJSON(structure_json)> + + <div class="schemaPreviewWrapper"> + <cfset tableCount = 0> + <cfset tables = deserializeJSON(structure_json)> + + <ul class="tables"> + + <cfloop array="#tables#" index="thisTable" > + <cfset tableCount ++> + <li> + #thisTable.table_name# (#thisTable.table_type#) + <ul class="columns"> + <cfloop array="#thisTable.columns#" index="col"> + <li>#col.name# #col.type#</li> + </cfloop> + </ul> + </li> + </cfloop> + + </ul> + </div> + <a href="##!#schema_fragment#" class="label label-info preview-schema popover-anchor">#tableCount# table<cfif tableCount IS NOT 1>s</cfif></a> + + <cfelse> + <div class="schemaPreviewWrapper"> + <div class="schemaPreview"> + #HTMLCodeFormat(Left(ddl, 400))# + </div> + </div> + <a href="##!#schema_fragment#" class="label label-info preview-ddl popover-anchor">preview ddl</a> + </cfif> + </td> + <td> + <cfif IsJSON(structure_json)> + + <cfset numSets = 0> + <div class="resultSetWrapper"> + <ol class="resultSetPreview"> + <cfoutput> + <cfif IsNumeric(set_id)> + <cfset numSets++> + <li class="statement_preview"><pre>#HTMLEditFormat(sql)#</pre></li> + <cfif succeeded> + <li class="alert alert-success">Rows: #row_count#<cfif len(columns_list)> Cols: #columns_list#</cfif></li> + <cfelse> + <li class="alert alert-error">#error_message#</li> + </cfif> + </cfif> + </cfoutput> + </ol> + </div> + <a href="##!#schema_fragment#/#query_id#" class="label label-info result-sets popover-anchor">#numSets# result set<cfif numSets IS NOT 1>s</cfif></a> + + <cfelse> + <div class="resultSetWrapper"> + <div class="resultSetPreview"> + #HTMLCodeFormat(Left(full_sql, 400))# + </div> + </div> + <a href="##!#schema_fragment#/#query_id#" class="label label-info preview-sql popover-anchor">preview sql</a> + </cfif> + + </td> + + </tr> + + </cfoutput> + </tbody> + </table> + + <cfelse> + + <div class="alert"> + <h4 class="alert-heading">No Favorites Found!</h4> Use the "Fiddle History" tab to find those you've used recently, then click on the star for queries you'd like to save as a favorite. + </div> + </cfif> diff --git a/src/main/webapp/views/UserFiddles/_fiddle_history.cfm b/src/main/webapp/views/UserFiddles/_fiddle_history.cfm new file mode 100644 index 0000000..7176114 --- /dev/null +++ b/src/main/webapp/views/UserFiddles/_fiddle_history.cfm @@ -0,0 +1,125 @@ + <cfif fiddles.recordCount> + + <table class="table table-striped" id="fiddle_history_table"> + <thead> + <th>Database Type</th> + <th>Identifier</th> + <th>My Last Access</th> + <th colspan="3"> </th> + </thead> + <tbody> + + <cfoutput query="fiddles" group="schema_fragment"> + <cfset schema_access = DateAdd('h', #getTimeZoneInfo().utcHourOffset#-#params.tz#, MOST_RECENT_SCHEMA_ACCESS)> + <tr class="schemaLog" id="#Replace(schema_fragment, "/", "-")#"> + <td>#full_name#</td> + <td><a href="##!#schema_fragment#">##!#schema_fragment#</a></td> + <!---<td style="text-align:center"><cfif session.user.id IS owner_id><i class="icon-ok"></i><cfelse> </cfif></td>---> + <td>#DateFormat(schema_access, "mm/dd/yyyy")# #TimeFormat(schema_access, "hh:mm tt")#</td> + <td> </td> + <td> + <cfif IsJSON(structure_json)> + + <div class="schemaPreviewWrapper"> + <cfset tableCount = 0> + <cfset tables = deserializeJSON(structure_json)> + + <ul class="tables"> + + <cfloop array="#tables#" index="thisTable" > + <cfset tableCount ++> + <li> + #thisTable.table_name# (#thisTable.table_type#) + <ul class="columns"> + <cfloop array="#thisTable.columns#" index="col"> + <li>#col.name# #col.type#</li> + </cfloop> + </ul> + </li> + </cfloop> + + </ul> + </div> + <a href="##!#schema_fragment#" class="label label-info preview-schema popover-anchor">#tableCount# table<cfif tableCount IS NOT 1>s</cfif></a> + + <cfelse> + <div class="schemaPreviewWrapper"> + <div class="schemaPreview"> + #HTMLCodeFormat(Left(ddl, 400))# + </div> + </div> + <a href="##!#schema_fragment#" class="label label-info preview-ddl popover-anchor">preview ddl</a> + </cfif> + + </td> + + <td> + <button class="btn btn-mini btn-warning forgetSchema" schema_def_id="#schema_def_id#" title="This will remove the schema and all related queries from your list.">Forget Schema</button> + <cfif my_query_count GT 2> + <button class="btn btn-mini showAll">Show All #my_query_count# Queries</button> + </cfif> + </td> + + </tr> + <cfset queryCount = 0> + <cfoutput group="query_id"> + <cfif IsNumeric(query_id)> + <cfset queryCount++> + + <cfset query_access = DateAdd('h', #getTimeZoneInfo().utcHourOffset#-#params.tz#, most_recent_query_access)> + + <tr class="queryLog for-schema-#Replace(schema_fragment, '/', '-')#<cfif queryCount GT 2> queryLog-hidden</cfif>" schema_def_id="#schema_def_id#" query_id="#query_id#"> + <td> </td> + <td><a href="##!#schema_fragment#/#query_id#">##!#schema_fragment#/#query_id#</a></td> + <td>#DateFormat(query_access, "mm/dd/yyyy")# #TimeFormat(query_access, "hh:mm tt")#</td> + <td> + <cfif favorite IS 1> + <a href="##removeFavorite" schema_def_id="#schema_def_id#" query_id="#query_id#" title="Remove from favorites" class="favorite"><i class="icon-star"></i></a> + <cfelse> + <a href="##addFavorite" schema_def_id="#schema_def_id#" query_id="#query_id#" title="Add to favorites" class="favorite"><i class="icon-star-empty"></i></a> + </cfif> + </td> + <td> + <cfif IsJSON(structure_json)> + + <cfset numSets = 0> + <div class="resultSetWrapper"> + <ol class="resultSetPreview"> + <cfoutput> + <cfif IsNumeric(set_id)> + <cfset numSets++> + <li class="statement_preview"><pre>#HTMLEditFormat(sql)#</pre></li> + <cfif succeeded> + <li class="alert alert-success">Rows: #row_count#<cfif len(columns_list)> Cols: #columns_list#</cfif></li> + <cfelse> + <li class="alert alert-error">#error_message#</li> + </cfif> + </cfif> + </cfoutput> + </ol> + </div> + <a href="##!#schema_fragment#/#query_id#" class="label label-info result-sets popover-anchor">#numSets# result set<cfif numSets IS NOT 1>s</cfif></a> + + <cfelse> + <div class="resultSetWrapper"> + <div class="resultSetPreview"> + #HTMLCodeFormat(Left(full_sql, 400))# + </div> + </div> + <a href="##!#schema_fragment#/#query_id#" class="label label-info preview-sql popover-anchor">preview sql</a> + </cfif> + </td> + <td><button class="btn btn-mini btn-warning forgetQuery" schema_def_id="#schema_def_id#" query_id="#query_id#" title="This will remove this query from your list.">Forget This Query</button><cfif my_query_count GT 1> <button class="btn btn-mini btn-warning forgetOtherQueries" schema_def_id="#schema_def_id#" query_id="#query_id#" title="This will remove all other queries for this schema from your list.">Forget Others</button></cfif></td> + </tr> + </cfif> + </cfoutput> + </cfoutput> + </tbody> + </table> + + <cfelse> + + <div class="alert"> + <h4 class="alert-heading">No Fiddles Found!</h4> Why not try a sample fiddle to get some wheels turning? + </div> + </cfif> diff --git a/src/main/webapp/views/UserFiddles/index.cfm b/src/main/webapp/views/UserFiddles/index.cfm new file mode 100644 index 0000000..1f3b59b --- /dev/null +++ b/src/main/webapp/views/UserFiddles/index.cfm @@ -0,0 +1,8 @@ +<cfoutput> +<div class="tab-pane active" id="fiddle_history"> + #includePartial("fiddle_history")# +</div> +<div class="tab-pane" id="favorites"> + #includePartial("favorites")# +</div> +</cfoutput>
\ No newline at end of file diff --git a/src/main/webapp/views/Users/_info.cfm b/src/main/webapp/views/Users/_info.cfm new file mode 100644 index 0000000..f2dcb10 --- /dev/null +++ b/src/main/webapp/views/Users/_info.cfm @@ -0,0 +1,14 @@ +<cfoutput> + + <a class="dropdown-toggle" data-toggle="dropdown" href="##"> + <img id="gravatar" src="http://www.gravatar.com/avatar/#lcase(Hash(lcase(session.user.email)))#" alt="#session.user.firstname# #session.user.lastname#'s Gravatar" title="#session.user.firstname# #session.user.lastname#" /> + #session.user.firstname# + + <span class="caret"></span> + </a> + <ul class="dropdown-menu" id="user_choices"> + <li><a href="##" id="myFiddles">My Fiddles</a></li> + + <li><a href="index.cfm/Users/logout" id="logout">Logout</a></li> + </ul> +</cfoutput>
\ No newline at end of file diff --git a/src/main/webapp/views/Users/_login.cfm b/src/main/webapp/views/Users/_login.cfm new file mode 100644 index 0000000..6742a4e --- /dev/null +++ b/src/main/webapp/views/Users/_login.cfm @@ -0,0 +1,2 @@ + +<a href="#loginModal" data-toggle="modal"><i class="icon-user"></i>Login</a> diff --git a/src/main/webapp/views/helpers.cfm b/src/main/webapp/views/helpers.cfm new file mode 100644 index 0000000..99d44e5 --- /dev/null +++ b/src/main/webapp/views/helpers.cfm @@ -0,0 +1 @@ +<!--- Place helper functions here that should be available for use in all view pages of your application --->
\ No newline at end of file diff --git a/src/main/webapp/views/layout.cfm b/src/main/webapp/views/layout.cfm new file mode 100644 index 0000000..99ae8ff --- /dev/null +++ b/src/main/webapp/views/layout.cfm @@ -0,0 +1,162 @@ +<!doctype html> +<head> + + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> + + <title>SQL Fiddle</title> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <meta name="description" content="Application for testing and sharing SQL queries."> + <meta name="author" content="Jake Feasel"> + + <meta property="og:title" content="SQL Fiddle | A tool for easy online testing and sharing of database problems and their solutions." /> + <meta property="og:type" content="website" /> + <meta property="og:url" content="http://sqlfiddle.com/" /> + <meta property="og:image" content="http://sqlfiddle.com/images/fiddle_transparent.png" /> + <meta property="og:site_name" content="SQL Fiddle" /> + <!-- <meta property="fb:admins" content="_FBID_or_APPID_" /> --> + + <link rel="icon" href="favicon.ico?20120504" type="image/x-icon"> + <link rel="shortcut icon" href="favicon.ico?20120504" type="image/x-icon"> + + <cfoutput> + #requireStyleTags([ + "codemirror.css", + "bootstrap-2.0.4/bootstrap.less", + "bootstrap-2.0.4/responsive.less", + "fiddle.less", + "qp.css" + ])# + </cfoutput> + + <link href="stylesheets/print.css?20120512" media="print" rel="stylesheet" type="text/css" /> + +</head> +<body> + + + <div class="navbar navbar-fixed-top"> + <div class="navbar-inner"> + <div class="container-fluid"> + <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </a> + <a class="brand" href="">SQL Fiddle<img src="images/fiddle_transparent_small.png" style="height: 20px;margin-top: -10px;"> </a> + + <ul class="nav" id="db_type_label_collapsed"> + <li class=""> + <p class="navbar-text"></p> + </li> + </ul> + + <div class="nav-collapse"> + <ul class="nav"> + <li class="dropdown" id="db_type_id"> + <a class="dropdown-toggle" data-toggle="dropdown" href="#"> + Loading... <b class="caret"></b> + </a> + </li> + + <li class="divider-vertical"></li> + + <li class=""> + <a id="sample" href="#viewSample"><i class="icon-list-alt"></i>View Sample Fiddle</a> + </li> + + <li class=""> + <a id="clear" href="#clear"><i class="icon-refresh"></i>Clear</a> + </li> + + <li class="dropdown" id="userInfo"> + <cfoutput> + <cfif !StructKeyExists(session, "user")> + #includePartial("/Users/_login")# + <cfelse> + #includePartial("/Users/_info")# + </cfif> + </cfoutput> + </li> + + <li> + <a href="#textToDDLModal" data-toggle="modal"><i class="icon-wrench"></i>Text to DDL</a> + </li> + + </ul> + + <ul class="nav pull-right"> + <li> + + <form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="paypal_donate" style="margin: 6px 0 0 0;"> + <input type="hidden" name="cmd" value="_s-xclick"> + <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHLwYJKoZIhvcNAQcEoIIHIDCCBxwCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYCfpi+DdEg8o5S0X0x7fkOnc3Tl4+GVgj9kUjN8wj0MzknyIJNHaUoQkvm2QeN8Vqf8MBEqUR9VsKbXx5rsm9TR7xNtgGLTzPkjzMqHTQJAnpQHXHAQZv+qkJ6Kk8oSg+h/VawWeRKPf8WmhG/RGetE4udEMye5EDAhG/u5XVlUJjELMAkGBSsOAwIaBQAwgawGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQICkhAGQuINl2AgYhB7j1zxwGnl0/ZIUDD398PW/dMjkpzwKQYY75F3ENT9jJux0zuN8SU3uiBmyfLf8DiF4FAzgOWeqODKhl7BK6KEr+w9r04qTwW51UqQqc0PcfHDV9ihGpcmM6wAQlPRRDwmsT5aVxgeGCKF7VIqwLhf4TqBsfh/gglrc6iqrbggMrU7oWubabUoIIDhzCCA4MwggLsoAMCAQICAQAwDQYJKoZIhvcNAQEFBQAwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMB4XDTA0MDIxMzEwMTMxNVoXDTM1MDIxMzEwMTMxNVowgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBR07d/ETMS1ycjtkpkvjXZe9k+6CieLuLsPumsJ7QC1odNz3sJiCbs2wC0nLE0uLGaEtXynIgRqIddYCHx88pb5HTXv4SZeuv0Rqq4+axW9PLAAATU8w04qqjaSXgbGLP3NmohqM6bV9kZZwZLR/klDaQGo1u9uDb9lr4Yn+rBQIDAQABo4HuMIHrMB0GA1UdDgQWBBSWn3y7xm8XvVk/UtcKG+wQ1mSUazCBuwYDVR0jBIGzMIGwgBSWn3y7xm8XvVk/UtcKG+wQ1mSUa6GBlKSBkTCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCBXzpWmoBa5e9fo6ujionW1hUhPkOBakTr3YCDjbYfvJEiv/2P+IobhOGJr85+XHhN0v4gUkEDI8r2/rNk1m0GA8HKddvTjyGw/XqXa+LSTlDYkqI8OwR8GEYj4efEtcRpRYBxV8KxAW93YDWzFGvruKnnLbDAF6VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTIwOTIxMDQyMDUyWjAjBgkqhkiG9w0BCQQxFgQU/t+Fkye3KTvt7onofZmqoiZOhaQwDQYJKoZIhvcNAQEBBQAEgYAhjx22VxpWl4NxCJ4o4eGlKmwm5iA5lAAkIUMw/yvZ3rX1iPpeGCNhWo++GkFyGWNQWiEIXutasYnwZDEal8lCPEYZJwrZppm85h0G5chsgrowjXXcLSNNlm8WYibZKk7qo/njQT3cA5NYiZ+uUw3eQIzYvqz9bMW6tj80nO5Qlw==-----END PKCS7----- + "> + <input type="image" style="width:80px;height:24px;" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> + </form> + + </li> + <li> + + <a href="http://flattr.com/thing/679503/SQL-Fiddle" target="_blank"> + <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" /></a> + + </li> + + <li class="optional"> + <a href="about.html"><i class="icon-info-sign"></i>About</a> + </li> + + + </ul> + + </div> + + + <ul class="nav pull-right" id="exit_fullscreen"> + <li class=""> + <a href="#"><span>Exit Fullscreen</span> <i class="icon-resize-small"></i></a> + </li> + </ul> + + + </div> + </div> + </div> + <div class="container-fluid"> + <div class="row-fluid"> + + <div class="span12" id="content"> + + + <cfoutput>#includeContent()#</cfoutput> + + + </div><!-- end content --> + </div><!-- end row-fluid --> + + </div><!-- end container-fluid --> + + <div id="hosting"> + <ul id="hostingPartners"> + <li id="sqlsentry"><a href="http://www.sqlsentry.net/download-trial/landing/complete.asp?ad=201208-sqlfiddle" target="_new"><img src="images/sqlsentry/0<cfoutput>#RandRange(0,4)#</cfoutput>.jpg" alt="SQL Sentry"></a></li> + </ul> + </div> + + <cfoutput>#includeContent('utilityModals')#</cfoutput> + <cfoutput>#requirejsTag()#</cfoutput> + +<script type="text/javascript"> + var _gaq = _gaq || []; + _gaq.push(['_setAccount', 'UA-28576776-1']); + _gaq.push(['_setDomainName', 'sqlfiddle.com']); + _gaq.push(['_trackPageview']); + + (function() { + var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; + ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; + var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); + })(); +</script> + </body> +</html>
\ No newline at end of file diff --git a/src/main/webapp/views/wheels/layout.cfm b/src/main/webapp/views/wheels/layout.cfm new file mode 100644 index 0000000..2a420e7 --- /dev/null +++ b/src/main/webapp/views/wheels/layout.cfm @@ -0,0 +1,5 @@ +<!---
+ This is a view file that Wheels uses internally.
+ Do not delete this file or its containing folder.
+--->
+<cfinclude template="../../wheels/public/layout.cfm">
\ No newline at end of file diff --git a/src/main/webapp/views/wheels/wheels.cfm b/src/main/webapp/views/wheels/wheels.cfm new file mode 100644 index 0000000..52710d3 --- /dev/null +++ b/src/main/webapp/views/wheels/wheels.cfm @@ -0,0 +1,5 @@ +<!---
+ This is a view file that Wheels uses internally.
+ Do not delete this file or its containing folder.
+--->
+<cfinclude template="../../wheels/public/wheels.cfm">
\ No newline at end of file diff --git a/src/main/webapp/web.config b/src/main/webapp/web.config new file mode 100644 index 0000000..0f1eca2 --- /dev/null +++ b/src/main/webapp/web.config @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- this file can be deleted if you're not planning on using URL rewriting with IIS 7. -->
+<!-- you can add your own files and folders that should be excluded from URL rewriting by adding them to the "pattern" below. -->
+<!-- please read the online documentation on http://cfwheels.org for more information about URL rewriting. -->
+
+<!-- SET ENABLED TO TRUE BELOW TO TURN ON THE URL REWRITING RULES -->
+
+<configuration>
+ <system.webServer>
+ <rewrite>
+ <rules>
+ <rule name="ColdFusion on Wheels URL Rewriting" enabled="false">
+ <match url="^(.*)$" ignoreCase="true" />
+ <conditions logicalGrouping="MatchAll">
+ <add input="{SCRIPT_NAME}" negate="true" pattern="^/(flex2gateway|jrunscripts|cfide|cfformgateway|railo-context|files|images|javascripts|miscellaneous|stylesheets|robots.txt|sitemap.xml|rewrite.cfm)($|/.*$)" />
+ </conditions>
+ <action type="Rewrite" url="/rewrite.cfm/{R:1}" />
+ </rule>
+ </rules>
+ </rewrite>
+ </system.webServer>
+</configuration>
\ No newline at end of file diff --git a/src/main/webapp/wheels/CHANGELOG b/src/main/webapp/wheels/CHANGELOG new file mode 100755 index 0000000..9db0bec --- /dev/null +++ b/src/main/webapp/wheels/CHANGELOG @@ -0,0 +1,543 @@ +WHEELS VERSION 1.1.8 (UNRELEASE) + +Model Enhancements +================== + +* Add boolean type to validatesFormatOf() - [Andy Bellenie] + +View Enhancements +================= + +* Add delimiter parameter to the highlight() function - #826 [Per Djurner, Tony Petruzzi] +* Use mark tag in highlight - #836 [Per Djurner, Tony Petruzzi] +* add parameters append and prepend to the submitTag() - #593 [Per Djurner, Tony Petruzzi] + +Bug Fixes +========= + +* Turned off URL rewriting in IIS 7 by default - [Per Djurner, Tony Petruzzi] +* Add CFFileServlet to the pattern list, of the rewrite rules file, to…be able to display an image when using <cfimage action='writeToBrowser'> - [ellor1138] +* radioButtonTag() checked attribute is ignored if value attribute is empty - #733 [Per Djurner, Tony Petruzzi] +* make cached queries respect the 'maxrows' argument (findAll) - #824 [Per Djurner, Tony Petruzzi] + +Other Enhancements +================== + +* update web.config, htaccess to ignore favicon.ico - [Cathy Shapiro, Tony Petruzzi] +* route with only format specified was throwing error - [jjallen, Tony Petruzzi] + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +WHEELS VERSION 1.1.7 (12/11/2011) + +Bug Fixes +========= + +* Filter controller and action params - [Pete Freitag, Andy Bellenie, Tony Petruzzi] + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +WHEELS VERSION 1.1.6 (10/08/2011) + +Model Enhancements +================== + +* validatesUniquenessOf only selects primary keys - [Jordan Clark, Don Humphreys] + +View Enhancements +================= + +* Allow removal height and/or width attributes from imageTag when set to false - [downtroden, Tony Petruzzi] +* Allow delimiter to be specified for stylesheets and javascripts - [Derek, Tony Petruzzi] + +Bug Fixes +========= + +* hasChanged was incorrectly evaluating boolean values - [Jordan Clark, Don Humphreys] +* Do not perform update when no changes have been made to the properties of a model - #786 [Mohamad El-Husseini, Tony Petruzzi] +* OnlyPath argument of urlFor does not correctly recognise HTTPS urls - [Andy Bellenie, Tony Petruzzi] +* Pagination clause wasn't enclosed - [Karl Deterville, Tony Petruzzi] +* Pagination endrow was incorrectly calculated - [Karl Deterville, Tony Petruzzi] + + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +WHEELS VERSION 1.1.5 (08/01/2011) + +View Enhancements +================= + +* escape html entities in text and value of select options - #767 [Richard Herbert, Tony Petruzzi] + +Bug Fixes +========= + +* Fix plugins not loading when application is in a subdirectory - [mcraig, Tony Petruzzi] + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +WHEELS VERSION 1.1.4 (07/20/2011) + +View Enhancements +================= + +* Allow an array of structs to used for options in selectTag() - [Adam Chapman, Tony Petruzzi] +* Added secondStep parameter to date/time select tags - [oxalto, Tony Petruzzi] + +Controller Enhancements +======================= + +Model Enhancements +================== + +* Update to belongsTo(), hasOne() and hasMany() for the new argument joinKey. - [James Gibson, Tony Petruzzi] +* You can pass an unlimited number properties when using dynamic finders - [Tony Petruzzi] +* Dynamic finders now support passing in an array for values - [Tony Petruzzi] +* Added the delimiter argument to dynamic finders, this allow you to change the delimiter - [Tony Petruzzi] +* Added validationTypeForProperty() method - [Tony Petruzzi] + + +Other Enhancements +================== + +* Added proper HTTP status headers - #705 [Randy Johnson , Andy Bellenie] +* Plugin development no longer requires a zip file. - [Tony Petruzzi] + +Bug Fixes +========= + +* Incorrect MIME type for JSON - #751 [daniel.mcq, Tony Petruzzi] +* Route with format will cause exception when route is selected and format is not provided - #738 [Danny Beard, Tony Petruzzi] +* Raise renderError when template is not found for format - #759 [Mike Henke, Tony Petruzzi] +* LabelClass should split up the list of classes and attach one class for each label - #757 [Mohamad El-Husseini, Tony Petruzzi] +* Transactions would not close when used with the dependent argument of hasMany() - #739 [Andy Bellenie] +* Soft deletes do not work correctly with outer joins - #762 [Andy Bellenie] +* Better error message when supplying a query param of type string and omitting single quotes - #763 [Adam Chapman, Tony Petruzzi] +* Allow commas in dynamic finders - #771 [Joshua, Tony Petruzzi] +* AMPM select displaying twice - #768 [John Bliss, Tony Petruzzi] +* $request argumentsCollection: should be argumentCollection - #772 [William Fisk, Tony Petruzzi] +* Pagination pull incorrect number of results with compounded keys - #725 [Jeff Greenhouse, Tony Petruzzi] +* Update hasChanged() to properly chech floats - [Andy Bellenie, Tony Petruzzi] +* Date tags selected date throws out of range error - [Ben Garrett, Tony Petruzzi] + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +WHEELS VERSION 1.1.3 (03/24/2011) + +View Enhancements +================= +* Allows for relative url linking to be turned off in autolink() - [James Gibson, Tony Petruzzi] + +Controller Enhancements +======================= +* Allow for default argument on sendmail for from, to and subject - #727 [Andy Bellenie, Tony Petruzzi] + +Model Enhancements +================== +* You can now have bracket markers for all validation arguments - #706 [Tony Petruzzi] +* Columns marked as not null should allow for blank strings - [Tony Petruzzi] + +Bug Fixes +========= +* Fixed issue with $create supplying incorrect keys to $query - [Don Humphreys, Tony Petruzzi] +* The original transaction mode would not be respected during during callbacks - [Andy Bellenie, Tony Petruzzi] +* "none" transaction modes would never close - [Andy Bellenie, Tony Petruzzi] +* Incorrect $cache argument - #671 [William Fisk, Tony Petruzzi] +* Route formats prevented fullstops from being used in params - #666 [Tom King, Raul Riera, Tony Petruzzi] +* Controller in params should be upper camel case - #703 [William Fisk, Tony Petruzzi] +* Application scope would not initialize in sub - #721 [Adam Chapman, Tony Petruzzi] +* ValidatesUniquenessOf doesn't read soft-deletes - #719 [Andy Bellenie, Tony Petruzzi] +* PaginationLinks(): routes with page number marker variable would produce the wrong links - [Kenneth Barrett, Tony Petruzzi] + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +WHEELS VERSION 1.1.2 (01/29/2011) + +View Enhancements +================= +* Select, SelectTag allow an array of structs to be passed to options - #680 [William Fisk, Tony Petruzzi] + +Controller Enhancements +======================= +* Changed "default" argument on includeContent() to "defaultValue" - #663 [Tony Petruzzi] + +Model Enhancements +================== +* Add 'when' argument to validate() - #643 [Andy Bellenie, Tony Petruzzi] + +Bug Fixes +========= +* Added the varchar_ignorecase type to the H2 adapter - #664 [Per Djurner] +* Fix so that the full tablename is always retuned - #667 [Tony Petruzzi] +* Pagaination with parameterize set to false for numeric keys - #656 [levi730, Tony Petruzzi] +* Blank should be the selected value when includeBlank is set - #633 [Tony Petruzzi] +* validatesLengthOf failed when both maximum and minimum were specified - [Tony Petruzzi] + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +WHEELS VERSION 1.1.1 + +Bug Fixes +========= +* Added number formatting on the value passed in to "count" in the pluralize() function - [Per Djurner] +* Fixed renderWith() so that it works in all environment modes when returning JSON - #644 [Tony Petruzzi] +* Fixed belongsTo association code when using composite keys - #641 [James Gibson, Andy Bellenie] +* Allow cfthread to be used in views - #612 [Cathy Shapiro, Tony Petruzzi] +* Fixed paging code for non-parameterized queries - #656 [Mike Lester, Tony Petruzzi] +* Corrected bug in request verification when session management was disabled in Railo - #658 [Russ Sivak, Per Djurner] +* Changed "if" to "condition" on all validation methods to get around the fact that "if" is a reserved word in cfscript - #660 [Mohamad El-Husseini, Per Djurner] +* Fixed autolink() so that it correctly links and escapes relative paths - #646 [Tony Petruzzi] +* Fixed so including partials with layouts does not cause duplicated content - #659 [Per Djurner] + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +WHEELS VERSION 1.1 FINAL + +Bug Fixes +========= +* Don't use the cfzip "overwrite" attribute when unzipping plugins since it updates the date on the files on Railo - [William Fisk, Per Djurner] +* Update to the error template to make sure errors are not thrown while trying to send out error emails - [James Gibson] +* Fixes a bug with obfuscation on Railo that happens when the mathematical constant "e" is in the string together with no other letters - [Jon Lynch, Tony Petruzzi, Per Djurner] +* Transaction="none" would throw an error if methods within a callback chain also attempted to make database changes - #613 [Andy Bellenie] +* Fixed bug that prevented the use of custom labels on calculated or non-persisted properties in form helpers and error messages - #630 [Andy Bellenie, Mike Henke] +* Update to renderwith() to return the content if "returnAs" equals "string" - [James Gibson, W. Scott Hayes] +* Removed case-sensitivity on labelXXX arguments passed through to form helpers - [Andy Bellenie] + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +WHEELS VERSION 1.1 RC 1 + +Bug Fixes +========= +* The full tag context of an error was missing from the error emails, fixed now - [Andy Bellenie] +* Fixed bug in nested properties related to deleting children via object array - #595 [Adam Michel, Tony Petruzzi] +* Make sure transactions are rolled back and marker gets closed on error - [Tony Petruzzi] +* Fixed so deprecation notices only gets set when the debug info is to be displayed - [John C. Bland II, Per Djurner] +* Fix to make preserveSingleQuotes() call work in Railo 3.2 - [Raul Riera, Per Djurner] +* Fixed bug with dynamic finders where we were looking for a non existing data type on a calculated property - [Brian Ward, Per Djurner] +* Fix to make sure findOne() does not query the database for more records than needed - #605 [Per Djurner, Tony Petruzzi] +* Corrected H2, Oracle and PostgreSQL code for when GROUP BY clause needs to contain columns from the ORDER BY clause - [Per Djurner] +* Correction to get exactly one record when we're dealing with single associations instead of basing it on the "joinType" argument - [Per Djurner] +* Update to error handling to make sure the "rootCause" data exists before trying to use it - [James Gibson] +* Corrections and improvements to Oracle support - [Ryan Hoppitt, Tony Petruzzi, Per Djurner] +* Fixed so the "Message" part is also in lower case when "lowerCaseDynamicClassValues" is "true" in flashMessages() - [John C. Bland II, Per Djurner] +* Case corrections to ensure compatibility with Linux - [Per Djurner] +* Fix for using layouts on AJAX calls when usesLayout() has not been called - [Per Djurner] +* Added missing dependency operation remove with instantiation - [Andy Bellenie] +* Fixed bug with pagination and renamed primary keys - [Tony Petruzzi] + +Miscellaneous +============= +* Added "errorClass" argument to form helpers and set the default to "fieldWithErrors" to make the naming consistent - [Per Djurner] + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +WHEELS VERSION 1.1 BETA 2 + +Bug Fixes +========= +* Corrected some bugs related to case, ordering and pagination on the H2 database - [Per Djurner] +* made it possible to use plugins on the H2 database - [Per Djurner] +* Fixed autoLink() so that it can handle all types of domains - #560 [Tom King, Tony Petruzzi] +* Corrected deobfuscation logic so that it... umm... works :) - #577 [Per Djurner, James Gibson] +* Fix for obfuscateParam() related to leading zeros in integer values on Railo - #578 [Tony Petruzzi] +* Fixed so correct defaults are set for "valueField" and "textField" on select() when dealing with objects - #445 [Per Djurner] +* Adapters now only fall backs on native code for getting the last inserted key when Railo/ACF can't do it automatically - #562 [Per Djurner] +* simpleFormat() now produce the exact same output regardless of the operating system - #570 [Raul Riera, Tony Petruzzi, Per Djurner] +* imageTag() was outputting the "id" attribute twice when caching was on, fixed now - #582 [Andy Bellenie, Per Djurner] +* Changed to using SCOPE_IDENTITY() as fallback for SQL Server - [Tony Petruzzi, Per Djurner] +* Fixed overwrite problem when using composite keys - #587 [Andy Bellenie, Per Djurner] +* Fixed bug with upper case input in humanize() and allow exception list for when abbreviations aren't caught - #587 [Andy Bellenie, Tony Petruzzi, Per Djurner] +* Made it possible to call model (and other) methods on application / session start - [W. Scott Hayes, Per Djurner] +* Fixed bug in setPagination() where floats could be passed in for the numeric values - [Tony Petruzzi] +* Fixed so labels on dateTimeSelectTags() and dateTimeSelect() get applied correctly to all six possible form inputs - #531 [Raul Riera, Tony Petruzzi, Chris Peters, Per Djurner] +* Made it possible to call the controller data function from a partial located in the root or sub folder - [Per Djurner, Chris Peters] +* Fixed a PostgreSQL pagination query that would fail under certain conditions (edge case) - [Per Djurner] +* Fixed deleting in nested properties - #579 [Adam Michel, Tony Petruzzi] + +Miscellaneous +============= +* Removed the `afterFindCallbackLegacySupport` setting and made the new way introduced in Beta 1 the only way - #580 [Per Djurner] +* Changed "class" attribute on flashMessages(), errorMessageOn() and errorMessagesFor() to be camelCased - #554 [Per Djurner] +* Added better error reporting when passing in one primary key value when multiple are expected - #540 [Adam Michel, Tony Petruzzi] + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +WHEELS VERSION 1.1 BETA 1 + +Model Enhancements +================== +* Support for automatic validations based on database settings (column does not allow nulls, has a maximum length etc) - [James Gibson, Andy Bellenie, Tony Petruzzi] +* Support for handling binary data columns - #133 [Tony Petruzzi] +* Callbacks are not pre-loaded anymore - #388 [Andy Bellenie] +* Support for NOT IN, IN, NOT LIKE, IS NULL, IS NOT NULL in where clause with proper use of cfqueryparam - [Per Djurner, Tony Petruzzi] +* Made it possible to use a blank value as a property default - [Andy Bellenie] +* Ability to skip validation when saving, e.g. save(validate=false) - [Tony Petruzzi] +* Added argument for model methods to be able to turn off callbacks, e.g. save(callbacks=false) - #236 [Andy Bellenie] +* Ability to set a default value for column statistics with "ifNull" argument - #330 [Andy Bellenie] +* Support for nested properties (saving data in associated model objects through the parent) - [James Gibson] +* Added automatic deletion of dependent models - #367 (Per Djurner, Andy Bellenie] +* Added "setUpdatedAtOnCreate" to tell Wheels if it should update the "updatedAt" property when creating new records - [James Gibson] +* New setting "useExpandedColumnAliases" that you can set to "true" to prepend included model properties with their model name in queries - #442 [Andy Bellenie] +* Arguments are now always passed in to "afterFind" callback methods and you can return them to set both queries and objects - [Tony Petruzzi] +* Updated findAll() to allow for more than one association as long as they are direct (i.e. include="assoc1,assoc2" works but not include="assoc1(assoc2)) - [James Gibson] +* Update to add GROUP BY functionality in finders - [James Gibson] +* Allow overriding of soft-deletes - #324 [Andy Bellenie] +* Added accessibleProperties() and protectedProperties() to protect model variables from mass assignment - [James Gibson] +* Ability to set defaults on a model using the "defaultValue" argument to property() - #244 [Andy Bellenie] +* Added transaction handling support, use the "transaction" argument on save(), updateAll() etc, callbacks are automatically wrapped in a transaction - #325 [Andy Bellenie] +* Added a position argument to primaryKeys() for easier retrieval - [Tony Petruzzi] +* Added a setPagination() function to make it possible to use paginationLinks() and similar functions for custom queries (i.e. ones not created with the Wheels ORM) - [Tony Petruzzi] +* Allow database views to be used as a model by calling setPrimaryKey() - #390 [Tony Petruzzi] + +View Enhancements +================= +* Labels will now be added automatically for form helpers based on the object's property name (or a custom label set in the model) - [Andy Bellenie] +* Added default for "action" argument on linkTo() - #321 [Andy Bellenie] +* Added 12-hour format to date/time select helpers - #551 [Tony Petruzzi] +* Added a flashMessages() function that outputs all key/values from the Flash - [Per Djurner] +* Added support for inherited / nested layout templates through includeLayout() - [Per Djurner] +* Added "head" argument to styleSheetLinkTag() and JavaScriptIncludeTag() - [Per Djurner] +* flashMessages() can now pass a list of keys that controls which messages to display as well as the order they are displayed in - [Chris Peters] +* Ability for years to display in descending order in date select form tags - [Tony Petruzzi] +* Support for an automatic "assetQueryString" which can be used to force local browser caches to refresh when there is an update to your assets (CSS, JavaScript etc) - [James Gibson] +* Added buttonTag() form helper - [Tony Petruzzi] +* Added "disabled" and "readonly" arguments to form input helpers [Andy Bellenie] +* Allows disabling error elements appearing on form fields by setting "errorElement" - [Andy Bellenie] +* Updates to checkBoxTag() and checkBox() to allow for unchecked values - [James Gibson] +* Added "pageNumberAsParam" argument to paginationLinks() that decides whether the page parameter should be part of the route or just a regular parameter - [James Gibson] +* Added contentFor() and includeContent() used to set/display content - [Tony Petruzzi, Per Djurner] +* Added hasManyRadioButton() and hasManyCheckBox() used to easily add radio buttons / checkboxes for a hasMany relationship on a model when using nested properties. - [James Gibson] +* New global defaults for truncate() and wordTruncate() - [James Gibson] +* Added a toXHTML() function that returns an XHTML compliant string - [Tony Petruzzi] +* Added "dataFunction" argument to includePartial() for getting data from a controller function automatically - [Per Djurner] +* Added a h() function for sanitizing user output - [Tony Petruzzi] +* Added support for external links in linkTo(), startFormTag(), javaScriptIncludeTag() and styleSheetLinkTag() - [Tony Petruzzi] + +Controller Enhancements +======================= +* Updated the request processing to not call the action if a before filter has rendered content - [James Gibson] +* Support for using an onMissingMethod() inside controllers - [James Gibson] +* redirectTo() now accepts a "delay" argument which can be used to delay the redirection until after the action code has completed (useful for testing) - [James Gibson, Tony Petruzzi] +* Added addDefaultRoutes(), used to control exactly where in the route order to place the default routes - [Per Djurner] +* New setting called "loadDefaultRoutes" which you can set to false when you want to use addDefaultRoutes() to load the routes manually - [Per Djurner] +* Added the ability to attach files with sendEmail() - [Per Djurner] +* Added "directory" and "deleteFile" arguments to sendFile() - #323 [Tony Petruzzi] +* Added the ability to set wildcard routes - [Andy Bellenie] +* Controllers can now respond to different formats such as "xml", "json", "csv", "pdf" and "xls" - [James Gibson] +* Ability to store Flash in cookies - [Per Djurner] +* Ability to add Flash messages when redirecting - [Per Djurner] +* redirecTo(back=true) can now fall back on a route/controller/action when the referrer is blank instead of throwing an error - [Per Djurner] +* Support for "format" parsing in route patterns ([controller]/[action].[format]) - [James Gibson] +* Ability to pass through arguments to filters - [Per Djurner] +* Added flashKeep() function for keeping Flash contents for one additional request - [Per Djurner] +* You can now validate type on incoming parameters using verifies() - [Tony Petruzzi] +* Defaulted day to 1 and month to 1 when submitting forms - [Tony Petruzzi] +* Added usesLayout() for specifying a controller specific layout - [Tony Petruzzi, Per Djurner] +* You can now perform a redirect instead of aborting the request using verifies(), any extra arguments passed in are passed through to redirectTo() - [Tony Petruzzi] + +Other Enhancements +================== +* Allowed plugins to run in maintenance mode - [James Gibson] +* Added "excludeFromErrorEmail" setting - #447 [Per Djurner] +* New setting, "errorEmailSubject", that allows you to customize the subject line of error emails - #392 [Per Djurner] +* New setting, "deletePluginDirectories" that tells Wheels whether to delete plugin directories if no corresponding ZIP file exists - #385 [Per Djurner] +* Added a "cachePlugins" setting to allow developers to not cache plugins during the development of them - #304 [Andy Bellenie] +* Allow setting multiple argument defaults at once, e.g. set(functionName="textField,textArea,select", labelPlacement="before" - #426 [Raul Riera, Per Djurner] +* A full testing framework is now included in Wheels, unit tests can be created in the "tests" folder - [Tony Petruzzi] + +Bug Fixes +========= +* Session scope is now locked when accessing the Flash - #275 [James Gibson, Per Djurner] +* Corrected the "id" attribute for radioButton() when value is blank - #373 [Tony Petruzzi] +* findByKey() now correctly returns "false" when passed a blank "key" argument - #514 [Andy Bellenie] +* Fixed so hasChanged() compares dates correctly - #515 [Tony Petruzzi] +* validatesUniquenessOf() now recognizes soft-deleted columns as well - #532 [Andy Bellenie] +* Corrected a bad throw in onMissingMethod() - #555 [Per Djurner, Adam Michel] +* Corrected count() to always return 0 if no records are found - [Per Djurner] +* Removed differences in params structure for form / URL variables - #232 [Mike Henke, Tony Petruzzi] + +Miscellaneous +============= +* Adobe ColdFusion 8.0.1 or Railo 3.1.2.020 is now required [Tony Petruzzi, Per Djurner] +* Deprecated the "class" argument on association methods (belongsTo(), hasMany(), hasOne()), use "modelName" instead. - [Per Djurner] +* Refactor to avoid polluting the Application.cfc's this scope with the "rootDir" variable - [Per Djurner] + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +WHEELS VERSION 1.0.5 + +Bug Fixes +========= +* Fixed the handling for the "errorEmailServer" setting so that error emails can now be sent without having to set the server in the ColdFusion administrator - [Per Djurner] +* Corrected pluralize rules - #450 [Joshua Clingenpeel, Tony Petruzzi] +* Remove possible spaces in list passed in to callback registration - #448 [Raul Riera] +* Check to see that a function has a declaration in the settings before setting defaults - [James Gibson] +* Update to capitalize() to return nothing if the passed in string is empty - [James Gibson] +* validatesPresenceOf() now takes whitespace into account - [Tony Petruzzi] +* Fix for lock timeouts occurring during race conditions in the "design" and "development" modes - #467 [John C. Bland II, Andy Bellenie, Tony Petruzzi] +* Fix so Wheels uses passed in width/height in imageTag() when only one of them is passed in - #328 [Andy Bellenie, Per Djurner] +* Don't append .css, .js to asset files when they end in .cfm - [Tony Petruzzi] +* Update to reload to catch the query blank boolean error - [James Gibson] +* onCreate validations do not run when onSave validations fail - #455 [Andy Bellenie] +* Fixes bug with nullable foreign keys in where clause - [Andy Bellenie] +* Update to clean up variables from all scopes after running plugin injection - [James Gibson] +* Updated PostgreSQL types - [Jaroslaw Krzemienski, Per Djurner] +* Fix for race condition when checking for existing controller files in the "design" and "development" modes - #360 [Andrea Campolonghi, Per Djurner] +* Error in SQL Server pagination with mapped columns - #456 [Don Humphreys, Tony Petruzzi] +* Updated hasChanged() for a race condition that wasn't met - [James Gibson] +* Fixed pagination error in Oracle when using the "include" argument - #449 [Per Djurner] +* Fixed incorrect layout rendering for renderPartial() and includePartial() - #488 [Jordan Sitkin, Per Djurner] +* Fix for complex "include" strings - #453 [Jordan Sitkin, Andy Bellenie] +* Fixed naming conflict occurring for properties starting with the same name as its model on included objects - #461 [Tony Petruzzi, Per Djurner, Raul Riera] +* Fixed pluralization issue related to partials used with object(s)/queries and removed the limitation of the file being tied to the model name - #427 [Per Djurner, James Gibson] +* Prevent additional errors from occurring during display of CFML errors - #466 [John C. Bland II, Per Djurner, Tony Petruzzi] + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +WHEELS VERSION 1.0.4 + +Bug Fixes +========= +* Added missing support for passing in array of model objects as options to select() - #411 [John C. Bland II, Tony Petruzzi] +* Fixed so "afterFind" callback methods are only called once during pagination - #435 [Bucky Schwarz, Doug Giles, Per Djurner] +* Added "prependOnAnchor" and "appendOnAnchor" arguments to paginationLinks() to get around an issue where the "appendToPage" string was added on anchor pages - #434 [Joshua Clingenpeel, Per Djurner] +* Fixed bug in paginationLinks() when using "appendToPage" with single page result - [Joshua Clingenpeel, Per Djurner] +* Fixed bug with count() when using composite primary keys - [Per Djurner] +* Fixed concurrency issue related to setting the model name on associations - #419 [John C. Bland II, Per Djurner] +* Fix for skipping duplicate columns returned from cfdbinfo when using Oracle - #437 & #439 [Mike Henke, Per Djurner] +* Fix for race conditions when setting the join clause in an application scoped model object - #432 [James Gibson, Per Djurner] +* Fixed so URLFor() is not duplicating controller and action when URL rewriting is off - #433 [Per Djurner] +* Added support to imageTag() for all image types that the CFML engine supports - [Cathy Shapiro, Per Djurner] + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +WHEELS VERSION 1.0.3 + +Bug Fixes +========= +* Added support for more domains in autoLink() and also fixed linking when the URL starts at the very beginning of the string - #424 [Per Djurner] +* Corrected the order in which object properties are set when based on a query result - #404 & #422 [Raul Riera, Per Djurner] +* Fixed so the "appendToPage" and "prependToPage" arguments in paginationLinks() apply to the anchor pages - #417 [Raul Riera, Per Djurner] +* Changed so developer supplied arguments to URLFor() are not converted to lowercase - #415 [Per Djurner] +* Made sure you can only reload based on the URL when a reload password exists (either empty or set) - #410 [John C. Bland II, Per Djurner] +* Added escaping on strings used in JavaScript - #393 [Tony Petruzzi] +* Changed so the dispatch object is created with a reference from the root of the Wheels application instead of the entire website - [Per Djurner] +* Fixed so sendEmail() automatically sets the "type" argument to "text" or "html" when only one template is in use - [Per Djurner] +* Fixed so creating SELECT clause works when there are 10 tables or more in use - #421 [Don Humphreys, Tony Petruzzi] +* Fixed a regression bug in the dateTimeSelect() function - #413 [Andy Bellenie] +* Fixed bug in dynamic belongsTo() methods - #420 [Andy Bellenie] +* Fixed error with a call to http://localhost/badtemplate.cfm not showing the output of the onmissingtemplate.cfm file - [Clarke Bishop, Andy Bellenie, Per Djurner] +* Corrected link in error email when URL rewriting is on - [Andy Bellenie] + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +WHEELS VERSION 1.0.2 + +Bug Fixes +========= +* Added work-around for CF9 / OSX related "extends" bug in MySQL adapter - #378 [Russ Johnson, Jordan Sitkin, John C. Bland II, Per Djurner] +* Fixed call to non existing function in URLFor() - [Andy Bellenie, Per Djurner] + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +WHEELS VERSION 1.0.1 + +Bug Fixes +========= +* Fixed bug in MS SQL adapter when paginating and ordering on identically named columns from two tables - #355 [Don Bellamy, Per Djurner] +* Fixed bug where soft deleted rows were returned when using the include argument - #344 [Andy Bellenie, Per Djurner] +* Fixed bug where humanize() would add a space at the beginning of the string if it started with an upper case character - #359 [Per Djurner] +* To fix bugs with change tracking Wheels will now only check for changes to properties that exist on the model object - #353 [James Gibson, Per Djurner] +* Fixed so the keys we use for caching always return identical results so they do not break the cache unnecessarily - [Andy Bellenie, Per Djurner] +* Fixed so average() with integer values work in Railo - #331 [Raul Riera, James Gibson, Per Djurner] +* Fixed so the "for" attribute on form helpers always matches the "id" attribute when it's passed in by the developer - #340 [Chris Peters, Per Djurner] +* Fixed so findAll() afterFind callbacks run when one record is returned - #327 [Ryan Hoppitt, Per Djurner] +* Wrapped debug output completely in "cfoutput" tags so that it works when "enableCFOutputOnly" has been set to true - [William Fisk, Per Djurner] +* Fixed a bug with pagination with outer joins that was creating SQL errors when no records were returned from the pagination query - [James Gibson] +* Made the "objectName" argument check for the object in the "variables" scope by default instead of unscoped - #365 [John C. Bland II, Per Djurner] +* Fixed so the this.dataSource setting is picked up by Wheels when used - #333 [Chris Peters, Per Djurner] +* Fixed so you can use the built-in validation methods for properties that does not exist in the database table - #362 [Andy Bellenie, Per Djurner] +* Fixed so primary key column is not added to order clause when paginating if it has already been specified with tableName.columnName syntax - [Per Djurner] +* Fixed so pluralization/singularization works with camelCased variable names - [Chris Peters, Per Djurner] +* Added line break to stylesheetLinkTag and javaScriptIncludeTag output - #372 [Tony Petruzzi] +* Fixed bug with select() and selectTag() failing with empty collections as options - #374 [Tony Petruzzi] +* Added missing option "variableName" to validatesFormatOf() options - #337 [Raul Riera, Per Djurner] +* Get disallowed methods from Wheels.cfc instead to allow methods in Controller.cfc to be executed as actions - [Per Djurner] +* Fixed so all callbacks run when the valid() method is called - #303 [Tony Petruzzi] +* Allow private methods to be used as controller filters - #380 [Tony Petruzzi] +* Fixed so the date form helpers can accept a blank string as the default value - #391 [Andy Bellenie] +* Fixed so that the "for" and "id" HTML attributes match when passing an empty string in "tagValue" - #303 [Tony Petruzzi] +* Added the datetime2 data type to the Microsoft SQL Server adapter - #401 [Per Djurner] +* Fixed so queries created in afterFind callbacks can be referenced from view helpers - [James Gibson] +* Fixed so links are properly hyphenated when controller/action is part of the placeholder route values. - [William Fisk, Per Djurner] + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +WHEELS VERSION 1.0 FINAL + +Model Enhancements +================== +* Added "xml" datatype for SQL Server 2005/2008 - #295 [Andy Bellenie, Per Djurner] +* Added the Railo specific cfquery attribute called "psq" to make Wheels run on a default installation of Railo - [Raul Riera, Per Djurner] +* Changed setProperties() to allow any passed in variable to be set on the object - [Per Djurner] +* Changed properties() so that it returns anything in the this scope that is not a function - [Per Djurner] +* Modified so SUM, AVG, MIN, MAX returns blank string and COUNT returns 0 when no records are found - [Tony Petruzzi, Per Djurner] +* Support for "if"/"unless" in validate(), validateOnCreate() and validateOnUpdate() - [Per Djurner] +* Support for built-in CFML types in validatesFormatOf() - [Raul Riera, Per Djurner] +* Added "allowBlank" argument on validatesUniquenessOf() - #271 [Per Djurner] +* Removed a query in findAll that didn't need to run when the join type was set to inner - [Mike Henke, Per Djurner] +* Updated model error functions to take and perform actions with properties and name errors - [Tony Petruzzi] + +View Enhancements +================= +* Consistent style and reload links added to debug area - [Per Djurner] +* Trimmed final output's white space - #279 [Chris Peters, Per Djurner] +* Humanized list / array items in $optionsForSelect() - #267 [James Gibson] + +Controller Enhancements +======================= +* Rewrite Rules for IIS7 - [Sameer Gupta, Mike Rampton, Per Djurner] +* Rewrite support in sub folders in Apache - [Peter Amiri] +* Turned off rewriting for "robots.txt" file - #278 [Chris Peters, Per Djurner] + +Other Enhancements +================== +* Support for setting Application.cfc this scoped variables through config/app.cfm - #315 [Jay McEntire, Per Djurner] +* Allow plugin developer to specify a list of supported Wheels versions instead of just one - [Chris Peters, Per Djurner] +* Methods from plugins can now be injected to "Application.cfc" - #288 [James Gibson, Per Djurner] + +Bug Fixes +========= +* Fixed AVG SQL calculation when dealing with integer values - [Tony Petruzzi, Per Djurner] +* Fixed so that CFID and CFTOKEN values do not get obfuscated when passed in the URL - [James Gibson] +* Fixed so javaScriptIncludeTag and styleSheetLinkTag can work with files with multiple dots in them - #312 [Mike Henke, Tony Petruzzi] +* Included calculated properties in the propertyNames(), reload(), updateAll(), deleteAll(), includePartial() and renderPartial() methods - [Per Djurner] +* Allow dynamic methods to be called through callbacks - [James Gibson, Per Djurner] +* Fixed so you can pass in the "properties" argument to dynamic methods (it was overridden previously) - [Per Djurner] +* Allow passing along the original where clause when paginating with a criteria on a joined table - Groups [Don Humphreys, Per Djurner] +* Removed unnecessary singularization for associations - Groups [Don Humphreys, Per Djurner] +* Fixed so validations respect the "allowBlank" setting - Groups [Raul Riera, Per Djurner] +* Corrected execution time report when reloading application - [Tony Petruzzi, Per Djurner] +* Allowing negative values in where clause - Groups [Don Humphreys, Tony Petruzzi] +* Work-around for a Railo mapping bug that was causing slowness - #268 [Tony Petruzzi, Per Djurner] +* Fixed an includePartial() error with caching that occured in production mode - #285 [James Gibson, Per Djurner] +* Support passing in a single column query to select() and selectTag() - #300 [Tony Petruzzi] +* Fixed radio button ids to work properly with negative number values - #274 [Elezotte, Per Djurner] +* Removed display of "rewrite.cfm" in error emails - #280 [Raul Riera, Per Djurner] +* Fix for layout handling in sendEmail() on multipart emails - #269 [Chris Peters, Per Djurner] +* Throw Wheels errors based on the "showErrorInformation" setting instead of production mode - #276 [Tony Petruzzi, Per Djurner] +* Fixed so includePartial() / renderPartial() returns a blank string when passed an empty array instead of an error - #287 [James Gibson, Per Djurner] +* Fixed a problem with file naming and case on Linux / Unix when using helpers and plugins - [Chris Peters, Per Djurner] +* Fixed so pagination aborts early when no records exist in the table instead of causing an error - Groups [Per Djurner, James Gibson] +* Fixed so return type is correct when no records are found on using findOne() with returnAs="object" - [Raul Riera, Per Djurner] +* Fixed Railo bug caused by argument defaults on a number of functions - #201, #264 [William Fisk, Tony Petruzzi, Per Djurner] +* Fixed so you can order on included tables in finders without speciyfing table name - [Per Djurner] +* Fixed so pagination returns an empty query instead of the full record set when specifying a page out of range - [Per Djurner] + +Miscellaneous +============= +* Refactored validations code - #266 [Per Djurner] +* Copied cgi scope to request scope - #277 [Tony Petruzzi, James Gibson, Per Djurner] +* Removed an unnecessary variable assignment - #265 [William Fisk, Per Djurner] +* Added informative error messages for common Wheels mistakes - [James Gibson, Per Djurner]
\ No newline at end of file diff --git a/src/main/webapp/wheels/Connection.cfc b/src/main/webapp/wheels/Connection.cfc new file mode 100755 index 0000000..e70f5e6 --- /dev/null +++ b/src/main/webapp/wheels/Connection.cfc @@ -0,0 +1,51 @@ +<cfcomponent output="false">
+ <cfinclude template="global/cfml.cfm">
+
+ <cffunction name="init" access="public" returntype="any" output="false">
+ <cfargument name="datasource" type="string" required="true">
+ <cfargument name="username" type="string" required="false" default="">
+ <cfargument name="password" type="string" required="false" default="">
+ <cfset variables.instance.connection = arguments>
+ <cfreturn $assignAdapter()>
+ </cffunction>
+
+ <cffunction name="$assignAdapter" returntype="any" access="public" output="false">
+ <cfscript>
+ var loc = {};
+
+ loc.args = duplicate(variables.instance.connection);
+ loc.args.type = "version";
+ if (application.wheels.showErrorInformation)
+ {
+ try
+ {
+ loc.info = $dbinfo(argumentCollection=loc.args);
+ }
+ catch (Any e)
+ {
+ $throw(type="Wheels.DataSourceNotFound", message="The data source could not be reached.", extendedInfo="Make sure your database is reachable and that your data source settings are correct. You either need to setup a data source with the name `#loc.args.datasource#` in the CFML Administrator or tell Wheels to use a different data source in `config/settings.cfm`.");
+ }
+ }
+ else
+ {
+ loc.info = $dbinfo(argumentCollection=loc.args);
+ }
+
+ if (loc.info.driver_name Contains "SQLServer" || loc.info.driver_name Contains "Microsoft SQL Server" || loc.info.driver_name Contains "MS SQL Server")
+ loc.adapterName = "MicrosoftSQLServer";
+ else if (loc.info.driver_name Contains "MySQL")
+ loc.adapterName = "MySQL";
+ else if (loc.info.driver_name Contains "Oracle")
+ loc.adapterName = "Oracle";
+ else if (loc.info.driver_name Contains "PostgreSQL")
+ loc.adapterName = "PostgreSQL";
+ else if (loc.info.driver_name Contains "H2")
+ loc.adapterName = "H2";
+ else
+ $throw(type="Wheels.DatabaseNotSupported", message="#loc.info.database_productname# is not supported by Wheels.", extendedInfo="Use Microsoft SQL Server, MySQL, Oracle or PostgreSQL.");
+ loc.returnValue = CreateObject("component", "model.adapters.#loc.adapterName#").init(argumentCollection=variables.instance.connection);
+ </cfscript>
+ <cfreturn loc.returnValue>
+ </cffunction>
+
+</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/wheels/Controller.cfc b/src/main/webapp/wheels/Controller.cfc new file mode 100755 index 0000000..e7ee606 --- /dev/null +++ b/src/main/webapp/wheels/Controller.cfc @@ -0,0 +1,4 @@ +<!--- This file is only needed to get tests to work --->
+<cfcomponent output="false">
+ <cfinclude template="controller.cfm">
+</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/wheels/Dispatch.cfc b/src/main/webapp/wheels/Dispatch.cfc new file mode 100755 index 0000000..bda0d5e --- /dev/null +++ b/src/main/webapp/wheels/Dispatch.cfc @@ -0,0 +1,5 @@ +<cfcomponent output="false">
+ <cfinclude template="dispatch/functions.cfm">
+ <cfinclude template="global/functions.cfm">
+ <cfinclude template="plugins/injection.cfm">
+</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/wheels/Model.cfc b/src/main/webapp/wheels/Model.cfc new file mode 100755 index 0000000..54d739c --- /dev/null +++ b/src/main/webapp/wheels/Model.cfc @@ -0,0 +1,4 @@ +<!--- This file is only needed to get tests to work --->
+<cfcomponent output="false">
+ <cfinclude template="model.cfm">
+</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/wheels/Plugins.cfc b/src/main/webapp/wheels/Plugins.cfc new file mode 100755 index 0000000..fbb15bd --- /dev/null +++ b/src/main/webapp/wheels/Plugins.cfc @@ -0,0 +1,282 @@ +<cfcomponent output="false"> + + <cfset variables.$class = {}> + <cfset variables.$class.plugins = {}> + <cfset variables.$class.mixins = {}> + <cfset variables.$class.mixableComponents = "application,dispatch,controller,model,cache,base,connection,microsoftsqlserver,mysql,oracle,postgresql,h2"> + <cfset variables.$class.incompatiblePlugins = ""> + <cfset variables.$class.dependantPlugins = ""> + + + <cffunction name="init"> + <cfargument name="pluginPath" type="string" required="true" hint="relative path to the plugin folder"> + <cfargument name="deletePluginDirectories" type="boolean" required="false" default="#application.wheels.deletePluginDirectories#"> + <cfargument name="overwritePlugins" type="boolean" required="false" default="#application.wheels.overwritePlugins#"> + <cfargument name="loadIncompatiblePlugins" type="boolean" required="false" default="#application.wheels.loadIncompatiblePlugins#"> + <cfargument name="wheelsEnvironment" type="string" required="false" default="#application.wheels.environment#"> + <cfargument name="wheelsVersion" type="string" required="false" default="#application.wheels.version#"> + <cfset var loc = {}> + + <cfset structAppend(variables.$class, arguments)> + <!--- handle pathing for different operating systems ---> + <cfset variables.$class.pluginPathFull = ReplaceNoCase(ExpandPath(variables.$class.pluginPath), "\", "/", "all")> + <!--- extract out plugins ---> + <cfset $pluginsExtract()> + <!--- remove orphan plugin directories ---> + <cfif variables.$class.deletePluginDirectories> + <cfset $pluginDelete()> + </cfif> + <!--- process plugins ---> + <cfset $pluginsProcess()> + <!--- process mixins ---> + <cfset $processMixins()> + <!--- incompatibility ---> + <cfset $determineIncompatible()> + <!--- dependancies ---> + <cfset $determinDependancy()> + + <cfreturn this> + </cffunction> + + + <cffunction name="$pluginFolders" returntype="struct"> + <cfset var loc = {}> + + <cfset loc.plugins = {}> + <cfset loc.folders = $folders()> + + <cfloop query="loc.folders"> + <cfset loc.temp = {}> + <cfset loc.temp.name = name> + <cfset loc.temp.folderPath = $fullPathToPlugin(lcase(name))> + <cfset loc.temp.componentName = lcase(name) & "." & name> + <cfset loc.plugins[name] = loc.temp> + </cfloop> + + <cfreturn loc.plugins> + </cffunction> + + + <cffunction name="$pluginFiles" returntype="struct"> + <cfset var loc = {}> + + <!--- get all plugin zip files ---> + <cfset loc.files = $files()> + <cfset loc.plugins = {}> + + <cfloop query="loc.files"> + <cfset loc.name = ListFirst(name, "-")> + <cfset loc.temp = {}> + <cfset loc.temp.file = $fullPathToPlugin(name)> + <cfset loc.temp.name = name> + <cfset loc.temp.folderPath = $fullPathToPlugin(loc.name)> + <cfset loc.temp.folderExists = directoryExists(loc.temp.folderPath)> + <cfset loc.plugins[loc.name] = loc.temp> + </cfloop> + + <cfreturn loc.plugins> + </cffunction> + + + <cffunction name="$pluginsExtract"> + <cfset var loc = {}> + <!--- get all plugin zip files ---> + <cfset loc.plugins = $pluginFiles()> + + <cfloop collection="#loc.plugins#" item="loc.p"> + <cfset loc.plugin = loc.plugins[loc.p]> + <cfif not loc.plugin.folderExists OR (loc.plugin.folderExists AND variables.$class.overwritePlugins)> + <cfif not loc.plugin.folderExists> + <cfdirectory action="create" directory="#loc.plugin.folderPath#"> + </cfif> + <cfzip action="unzip" destination="#loc.plugin.folderPath#" file="#loc.plugin.file#" overwrite="true" /> + </cfif> + </cfloop> + + </cffunction> + + + <cffunction name="$pluginDelete"> + <cfset var loc = {}> + <!--- get all plugin folders ---> + <cfset loc.folders = $pluginFolders()> + <!--- get all plugin zip files ---> + <cfset loc.files = $pluginFiles()> + <!--- put zip files into a list ---> + <cfset loc.files = StructKeyList(loc.files)> + <!--- loop through the plugins folders ---> + <cfloop collection="#loc.folders#" item="loc.iFolder"> + <cfset loc.folder = loc.folders[loc.iFolder]> + <!--- see if a folder is in the list of plugin files ---> + <cfif !ListContainsNoCase(loc.files, loc.folder.name)> + <cfdirectory action="delete" directory="#loc.folder.folderPath#" recurse="true"> + </cfif> + </cfloop> + + </cffunction> + + + <cffunction name="$pluginsProcess"> + <cfset var loc = {}> + + <cfset loc.plugins = $pluginFolders()> + <cfset loc.wheelsVersion = SpanExcluding(variables.$class.wheelsVersion, " ")> + <cfloop collection="#loc.plugins#" item="loc.iPlugins"> + <cfset loc.plugin = createobject("component", $componentPathToPlugin(loc.iPlugins)).init()> + <cfif not StructKeyExists(loc.plugin, "version") OR ListFind(loc.plugin.version, loc.wheelsVersion) OR variables.$class.loadIncompatiblePlugins> + <cfset variables.$class.plugins[loc.iPlugins] = loc.plugin> + <cfif StructKeyExists(loc.plugin, "version") AND not ListFind(loc.plugin.version, loc.wheelsVersion)> + <cfset variables.$class.incompatiblePlugins = ListAppend(variables.$class.incompatiblePlugins, loc.iPlugins)> + </cfif> + </cfif> + </cfloop> + </cffunction> + + + <cffunction name="$determineIncompatible"> + <cfset var loc = {}> + <cfset loc.excludeMethods = "init,version,pluginVersion"> + <cfset loc.loadedMethods = {}> + + <cfloop collection="#variables.$class.plugins#" item="loc.iPlugins"> + <cfset loc.plugin = variables.$class.plugins[loc.iPlugins]> + <cfloop collection="#loc.plugin#" item="loc.method"> + <cfif not ListFindNoCase(loc.excludeMethods, loc.method)> + <cfif StructKeyExists(loc.loadedMethods, loc.method)> + <cfthrow type="Wheels.IncompatiblePlugin" message="#loc.iPlugins# is incompatible with a previously installed plugin." extendedInfo="Make sure none of the plugins you have installed override the same Wheels functions."> + <cfelse> + <cfset loc.loadedMethods[loc.method] = ""> + </cfif> + </cfif> + </cfloop> + </cfloop> + + </cffunction> + + + <cffunction name="$determinDependancy"> + <cfset var loc = {}> + + <cfloop collection="#variables.$class.plugins#" item="loc.iPlugins"> + <cfset loc.pluginMeta = GetMetaData(variables.$class.plugins[loc.iPlugins])> + <cfif StructKeyExists(loc.pluginMeta, "dependency")> + <cfloop list="#loc.pluginMeta.dependency#" index="loc.iDependency"> + <cfset loc.iDependency = trim(loc.iDependency)> + <cfif not StructKeyExists(variables.$class.plugins, loc.iDependency)> + <cfset variables.$class.dependantPlugins = ListAppend(variables.$class.dependantPlugins, Reverse(SpanExcluding(Reverse(loc.pluginMeta.name), ".")) & "|" & loc.iDependency)> + </cfif> + </cfloop> + </cfif> + </cfloop> + + </cffunction> + + + <!--- mixins ---> + + + <cffunction name="$processMixins"> + <cfset var loc = {}> + <!--- setup a container for each mixableComponents type ---> + <cfloop list="#variables.$class.mixableComponents#" index="loc.iMixableComponents"> + <cfset variables.$class.mixins[loc.iMixableComponents] = {}> + </cfloop> + <cfloop collection="#variables.$class.plugins#" item="loc.iPlugin"> + <!--- reference the plugin ---> + <cfset loc.plugin = variables.$class.plugins[loc.iPlugin]> + <!--- grab meta data of the plugin ---> + <cfset loc.pluginMeta = GetMetaData(loc.plugin)> + <cfif not StructKeyExists(loc.pluginMeta, "environment") OR ListFindNoCase(loc.pluginMeta.environment, variables.$class.wheelsEnvironment)> + <!--- by default and for backwards compatibility, we inject all methods into all objects ---> + <cfset loc.pluginMixins = "global"> + <cfif StructKeyExists(loc.pluginMeta, "mixin")> + <!--- if the component has a default mixin value, assign that value ---> + <cfset loc.pluginMixins = loc.pluginMeta["mixin"]> + </cfif> + <!--- loop through all plugin methods and enter injection info accordingly (based on the mixin value on the method or the default one set on the entire component) ---> + <cfset loc.pluginMethods = StructKeyList(loc.plugin)> + <cfloop list="#loc.pluginMethods#" index="loc.iPluginMethods"> + <cfif IsCustomFunction(loc.plugin[loc.iPluginMethods]) AND loc.iPluginMethods NEQ "init"> + <cfset loc.methodMeta = GetMetaData(loc.plugin[loc.iPluginMethods])> + <cfset loc.methodMixins = loc.pluginMixins> + <cfif StructKeyExists(loc.methodMeta, "mixin")> + <cfset loc.methodMixins = loc.methodMeta["mixin"]> + </cfif> + <!--- mixin all methods except those marked as none ---> + <cfif loc.methodMixins NEQ "none"> + <cfloop list="#variables.$class.mixableComponents#" index="loc.iMixableComponent"> + <cfif loc.methodMixins EQ "global" OR ListFindNoCase(loc.methodMixins, loc.iMixableComponent)> + <cfset variables.$class.mixins[loc.iMixableComponent][loc.iPluginMethods] = loc.plugin[loc.iPluginMethods]> + </cfif> + </cfloop> + </cfif> + </cfif> + </cfloop> + </cfif> + </cfloop> + </cffunction> + + + <!--- getters ---> + + + <cffunction name="getPlugins"> + <cfreturn variables.$class.plugins> + </cffunction> + + <cffunction name="getIncompatiblePlugins"> + <cfreturn variables.$class.incompatiblePlugins> + </cffunction> + + <cffunction name="getDependantPlugins"> + <cfreturn variables.$class.dependantPlugins> + </cffunction> + + <cffunction name="getMixins"> + <cfreturn variables.$class.mixins> + </cffunction> + + <cffunction name="getMixableComponents"> + <cfreturn variables.$class.mixableComponents> + </cffunction> + + <cffunction name="inspect"> + <cfreturn variables> + </cffunction> + + <!--- private methods ---> + + <cffunction name="$fullPathToPlugin"> + <cfargument name="folder" type="string" required="true"> + <cfreturn ListAppend(variables.$class.pluginPathFull, arguments.folder, "/")> + </cffunction> + + <cffunction name="$componentPathToPlugin"> + <cfargument name="folder" type="string" required="true"> + <cfset var loc = {}> + <cfset loc.path = [ListChangeDelims(variables.$class.pluginPath, ".", "/"), arguments.folder, arguments.folder]> + <cfreturn ArrayToList(loc.path, ".")> + </cffunction> + + <cffunction name="$folders" returntype="query"> + <cfset var q = ""> + + <cfdirectory action="list" directory="#variables.$class.pluginPathFull#" type="dir" name="q"> + <cfquery name="q" dbtype="query"> + select * from q where name not like '.%' + </cfquery> + <cfreturn q> + </cffunction> + + <cffunction name="$files" returntype="query"> + <cfset var q = ""> + + <cfdirectory directory="#variables.$class.pluginPathFull#" action="list" filter="*.zip" type="file" sort="name DESC" name="q"> + <cfquery name="q" dbtype="query"> + select * from q where name not like '.%' + </cfquery> + + <cfreturn q> + </cffunction> + +</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/wheels/Test.cfc b/src/main/webapp/wheels/Test.cfc new file mode 100755 index 0000000..2cd9e69 --- /dev/null +++ b/src/main/webapp/wheels/Test.cfc @@ -0,0 +1,3 @@ +<cfcomponent>
+ <cfinclude template="test.cfm">
+</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/wheels/controller.cfm b/src/main/webapp/wheels/controller.cfm new file mode 100755 index 0000000..fd22501 --- /dev/null +++ b/src/main/webapp/wheels/controller.cfm @@ -0,0 +1,5 @@ +<cfinclude template="controller/functions.cfm">
+<cfinclude template="global/functions.cfm">
+<cfinclude template="view/functions.cfm">
+<cfinclude template="plugins/injection.cfm">
+<cfinclude template="../#application.wheels.viewPath#/helpers.cfm">
\ No newline at end of file diff --git a/src/main/webapp/wheels/controller/appfunctions.cfm b/src/main/webapp/wheels/controller/appfunctions.cfm new file mode 100755 index 0000000..a5d81d9 --- /dev/null +++ b/src/main/webapp/wheels/controller/appfunctions.cfm @@ -0,0 +1,17 @@ +<cfif StructKeyExists(server, "railo")>
+ <cfinclude template="caching.cfm">
+ <cfinclude template="filters.cfm">
+ <cfinclude template="flash.cfm">
+ <cfinclude template="initialization.cfm">
+ <cfinclude template="miscellaneous.cfm">
+ <cfinclude template="redirection.cfm">
+ <cfinclude template="rendering.cfm">
+<cfelse>
+ <cfinclude template="wheels/controller/caching.cfm">
+ <cfinclude template="wheels/controller/filters.cfm">
+ <cfinclude template="wheels/controller/flash.cfm">
+ <cfinclude template="wheels/controller/initialization.cfm">
+ <cfinclude template="wheels/controller/miscellaneous.cfm">
+ <cfinclude template="wheels/controller/redirection.cfm">
+ <cfinclude template="wheels/controller/rendering.cfm">
+</cfif>
\ No newline at end of file diff --git a/src/main/webapp/wheels/controller/caching.cfm b/src/main/webapp/wheels/controller/caching.cfm new file mode 100755 index 0000000..a25385f --- /dev/null +++ b/src/main/webapp/wheels/controller/caching.cfm @@ -0,0 +1,73 @@ +<!--- PUBLIC CONTROLLER INITIALIZATION FUNCTIONS --->
+
+<cffunction name="caches" returntype="void" access="public" output="false" hint="Tells Wheels to cache one or more actions."
+ examples=
+ '
+ <cfset caches(actions="browseByUser,browseByTitle", time=30)>
+ '
+ categories="controller-initialization,caching" chapters="caching" functions="">
+ <cfargument name="action" type="string" required="false" default="" hint="Action(s) to cache. This argument is also aliased as `actions`.">
+ <cfargument name="time" type="numeric" required="false" hint="Minutes to cache the action(s) for.">
+ <cfargument name="static" type="boolean" required="false" hint="Set to `true` to tell Wheels that this is a static page and that it can skip running the controller filters (before and after filters set on actions) and application events (onSessionStart, onRequestStart etc).">
+ <cfscript>
+ var loc = {};
+ $args(args=arguments, name="caches", combine="action/actions");
+ arguments.action = $listClean(arguments.action);
+ if (!Len(arguments.action))
+ {
+ // since no actions were passed in we assume that all actions should be cachable and indicate this with a *
+ arguments.action = "*";
+ }
+ loc.iEnd = ListLen(arguments.action);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.item = ListGetAt(arguments.action, loc.i);
+ loc.action = {action=loc.item, time=arguments.time, static=arguments.static};
+ $addCachableAction(loc.action);
+ }
+ </cfscript>
+</cffunction>
+
+<!--- PRIVATE FUNCTIONS --->
+
+<cffunction name="$addCachableAction" returntype="void" access="public" output="false">
+ <cfargument name="action" type="struct" required="true">
+ <cfset ArrayAppend(variables.$class.cachableActions, arguments.action)>
+</cffunction>
+
+<cffunction name="$clearCachableActions" returntype="void" access="public" output="false">
+ <cfset ArrayClear(variables.$class.cachableActions)>
+</cffunction>
+
+<cffunction name="$setCachableActions" returntype="void" access="public" output="false">
+ <cfargument name="actions" type="array" required="true">
+ <cfset variables.$class.cachableActions = arguments.actions>
+</cffunction>
+
+<cffunction name="$cachableActions" returntype="array" access="public" output="false">
+ <cfreturn variables.$class.cachableActions>
+</cffunction>
+
+<cffunction name="$hasCachableActions" returntype="boolean" access="public" output="false">
+ <cfreturn ArrayIsEmpty($cachableActions())>
+</cffunction>
+
+<cffunction name="$cacheSettingsForAction" returntype="any" access="public" output="false">
+ <cfargument name="action" type="string" required="true">
+ <cfscript>
+ var loc = {};
+ loc.returnValue = false;
+ loc.cachableActions = $cachableActions();
+ loc.iEnd = ArrayLen(loc.cachableActions);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ if (loc.cachableActions[loc.i].action == arguments.action || loc.cachableActions[loc.i].action == "*")
+ {
+ loc.returnValue = {};
+ loc.returnValue.time = loc.cachableActions[loc.i].time;
+ loc.returnValue.static = loc.cachableActions[loc.i].static;
+ }
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/controller/filters.cfm b/src/main/webapp/wheels/controller/filters.cfm new file mode 100755 index 0000000..66e42e6 --- /dev/null +++ b/src/main/webapp/wheels/controller/filters.cfm @@ -0,0 +1,132 @@ +<!--- PUBLIC CONTROLLER INITIALIZATION FUNCTIONS --->
+
+<cffunction name="filters" returntype="void" access="public" output="false" hint="Tells Wheels to run a function before an action is run or after an action has been run. You can also specify multiple functions and actions."
+ examples=
+ '
+ <!--- Always execute `restrictAccess` before all actions in this controller --->
+ <cfset filters("restrictAccess")>
+
+ <!--- Always execute `isLoggedIn` and `checkIPAddress` (in that order) before all actions in this controller except the `home` and `login` actions --->
+ <cfset filters(through="isLoggedIn,checkIPAddress", except="home,login")>
+ '
+ categories="controller-initialization,filtering" chapters="filters-and-verification" functions="setFilterChain,filterChain">
+ <cfargument name="through" type="string" required="true" hint="Function(s) to execute before or after the action(s).">
+ <cfargument name="type" type="string" required="false" default="before" hint="Whether to run the function(s) before or after the action(s).">
+ <cfargument name="only" type="string" required="false" default="" hint="Pass in a list of action names (or one action name) to tell Wheels that the filter function(s) should only be run on these actions.">
+ <cfargument name="except" type="string" required="false" default="" hint="Pass in a list of action names (or one action name) to tell Wheels that the filter function(s) should be run on all actions except the specified ones.">
+ <cfscript>
+ var loc = {};
+
+ arguments.through = $listClean(arguments.through);
+ arguments.only = $listClean(arguments.only);
+ arguments.except = $listClean(arguments.except);
+
+ loc.namedArguments = "through,type,only,except";
+ loc.iEnd = ListLen(arguments.through);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.filter = {};
+ loc.filter.through = ListGetAt(arguments.through, loc.i);
+ loc.filter.type = arguments.type;
+ loc.filter.only = arguments.only;
+ loc.filter.except = arguments.except;
+ loc.filter.arguments = {};
+ if (StructCount(arguments) > ListLen(loc.namedArguments))
+ {
+ loc.dynamicArgument = loc.filter.through & "Arguments";
+ if (StructKeyExists(arguments, loc.dynamicArgument))
+ loc.filter.arguments = arguments[loc.dynamicArgument];
+ for (loc.key in arguments)
+ {
+ if (!ListFindNoCase(ListAppend(loc.namedArguments, loc.dynamicArgument), loc.key))
+ loc.filter.arguments[loc.key] = arguments[loc.key];
+ }
+ }
+ ArrayAppend(variables.$class.filters, loc.filter);
+ }
+ </cfscript>
+</cffunction>
+
+<cffunction name="setFilterChain" returntype="void" access="public" output="false" hint="Use this function if you need a more low level way of setting the entire filter chain for a controller."
+ examples=
+ '
+ <!--- Set filter chain directly in an array --->
+ <cfset setFilterChain([
+ {through="restrictAccess"},
+ {through="isLoggedIn,checkIPAddress", except="home,login"},
+ {type="after", through="logConversion", only="thankYou"}
+ ])>
+ '
+ categories="controller-initialization,filtering" chapters="filters-and-verification" functions="filters,filterChain">
+ <cfargument name="chain" type="array" required="true" hint="An array of structs, each of which represent an `argumentCollection` that get passed to the `filters` function. This should represent the entire filter chain that you want to use for this controller.">
+ <cfscript>
+ var loc = {};
+
+ // Clear current filter chain
+ variables.$class.filters = [];
+ // Loop through chain passed in arguments and add each item to filter chain
+ for(loc.i = 1; loc.i <= ArrayLen(arguments.chain); loc.i++) {
+ filters(argumentCollection=arguments.chain[loc.i]);
+ }
+ </cfscript>
+</cffunction>
+
+<!--- PUBLIC CONTROLLER CLASS FUNCTIONS --->
+
+<cffunction name="filterChain" returntype="array" access="public" output="false" hint="Returns an array of all the filters set on this controller in the order in which they will be executed."
+ examples=
+ '
+ <!--- Get filter chain, remove the first item, and set it back --->
+ <cfset myFilterChain = filterChain()>
+ <cfset ArrayDeleteAt(myFilterChain, 1)>
+ <cfset setFilterChain(myFilterChain)>
+ '
+ categories="controller-initialization,filtering" chapters="filters-and-verification" functions="filters,setFilterChain">
+ <cfargument name="type" type="string" required="false" default="all" hint="Use this argument to return only `before` or `after` filters.">
+ <cfscript>
+ var loc = {};
+
+ // invalid type
+ if (!ListFindNoCase("before,after,all", arguments.type))
+ $throw(type="Wheels.InvalidFilterType", message="The filter type of `#arguments.type#` is invalid.", extendedInfo="Please use either `before` or `after`.");
+
+ // return all filters
+ if (arguments.type == "all")
+ return variables.$class.filters;
+
+ // loop over the filters and return all those that match the supplied type
+ loc.returnValue = ArrayNew(1);
+ loc.iEnd = ArrayLen(variables.$class.filters);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ if (variables.$class.filters[loc.i].type == arguments.type)
+ ArrayAppend(loc.returnValue, variables.$class.filters[loc.i]);
+ }
+ return loc.returnValue;
+ </cfscript>
+</cffunction>
+
+<!--- PRIVATE FUNCTIONS --->
+
+<cffunction name="$runFilters" returntype="void" access="public" output="false">
+ <cfargument name="type" type="string" required="true">
+ <cfargument name="action" type="string" required="true">
+ <cfscript>
+ var loc = {};
+ loc.filters = filterChain(arguments.type);
+ loc.iEnd = ArrayLen(loc.filters);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.filter = loc.filters[loc.i];
+ if ((!Len(loc.filter.only) && !Len(loc.filter.except)) || (Len(loc.filter.only) && ListFindNoCase(loc.filter.only, arguments.action)) || (Len(loc.filter.except) && !ListFindNoCase(loc.filter.except, arguments.action)))
+ {
+ if (!StructKeyExists(variables, loc.filter.through))
+ $throw(type="Wheels.filterNotFound", message="Wheels tried to run the `#loc.filter.through#` function as a #arguments.type# filter but could not find it.", extendedInfo="Make sure there is a function named `#loc.filter.through#` in the `#variables.$class.name#.cfc` file.");
+ loc.result = $invoke(method=loc.filter.through, invokeArgs=loc.filter.arguments);
+ // if the filter function returned false or rendered content we skip the remaining filters in the chain
+ if ((StructKeyExists(loc, "result") && !loc.result) || $performedRenderOrRedirect())
+ break;
+ }
+ }
+ </cfscript>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/controller/flash.cfm b/src/main/webapp/wheels/controller/flash.cfm new file mode 100755 index 0000000..46d41ab --- /dev/null +++ b/src/main/webapp/wheels/controller/flash.cfm @@ -0,0 +1,335 @@ +<!--- PUBLIC CONTROLLER REQUEST FUNCTIONS ---> + +<cffunction name="flash" returntype="any" access="public" output="false" hint="Returns the value of a specific key in the Flash (or the entire Flash as a struct if no key is passed in)." + examples= + ' + <!--- Display "message" item in flash ---> + <cfoutput> + <cfif flashKeyExists("message")> + <p class="message"> + ##flash("message")## + </p> + </cfif> + </cfoutput> + + <!--- Display all flash items ---> + <cfoutput> + <cfset allFlash = flash()> + <cfloop list="##StructKeyList(allFlash)##" index="flashItem"> + <p class="##flashItem##"> + ##flash(flashItem)## + </p> + </cfloop> + </cfoutput> + ' + categories="controller-request,flash" chapters="using-the-flash" functions="flashClear,flashCount,flashDelete,flashInsert,flashIsEmpty,flashKeep,flashKeyExists,flashMessages"> + <cfargument name="key" type="string" required="false" hint="The key to get the value for."> + <cfscript> + var $flash = $readFlash(); + if (StructKeyExists(arguments, "key")) + { + if (flashKeyExists(key=arguments.key, $flash=$flash)) + $flash = $flash[arguments.key]; + else + $flash = ""; + } + // we can just return the flash since it is created at the beginning of the request + // this way we always return what is expected - a struct + return $flash; + </cfscript> +</cffunction> + +<cffunction name="flashClear" returntype="void" access="public" output="false" hint="Deletes everything from the Flash." + examples= + ' + <cfset flashClear()> + ' + categories="controller-request,flash" chapters="using-the-flash" functions="flash,flashCount,flashDelete,flashInsert,flashIsEmpty,flashKeep,flashKeyExists,flashMessages"> + <cfset $writeFlash()> +</cffunction> + +<cffunction name="flashCount" returntype="numeric" access="public" output="false" hint="Returns how many keys exist in the Flash." + examples= + ' + <cfif flashCount() gt 0> + do something... + </cfif> + ' + categories="controller-request,flash" chapters="using-the-flash" functions="flash,flashClear,flashDelete,flashInsert,flashIsEmpty,flashKeep,flashKeyExists,flashMessages"> + <cfset var $flash = $readFlash()> + <cfreturn StructCount($flash)> +</cffunction> + +<cffunction name="flashDelete" returntype="boolean" access="public" output="false" hint="Deletes a specific key from the Flash." + examples= + ' + <cfset flashDelete(key="errorMessage")> + ' + categories="controller-request,flash" chapters="using-the-flash" functions="flash,flashClear,flashCount,flashInsert,flashIsEmpty,flashKeep,flashKeyExists,flashMessages"> + <cfargument name="key" type="string" required="true" hint="The key to delete."> + <cfscript> + var returnValue = ""; + var $flash = $readFlash(); + returnValue = StructDelete($flash, arguments.key, true); + $writeFlash($flash); + return returnValue; + </cfscript> +</cffunction> + +<cffunction name="flashInsert" returntype="void" access="public" output="false" hint="Inserts a new key/value into the Flash." + examples= + ' + <cfset flashInsert(msg="It Worked!")> + ' + categories="controller-request,flash" chapters="using-the-flash" functions="flash,flashClear,flashCount,flashDelete,flashIsEmpty,flashKeep,flashKeyExists,flashMessages"> + <cfscript> + var loc = {}; + loc.$flash = $readFlash(); + loc.iEnd = StructCount(arguments); + loc.keys = StructKeyList(arguments); + for(loc.i=1; loc.i lte loc.iEnd; loc.i++) + { + loc.key = ListGetAt(loc.keys, loc.i); + StructInsert(loc.$flash, loc.key, arguments[loc.key], true); + } + $writeFlash(loc.$flash); + </cfscript> +</cffunction> + +<cffunction name="flashIsEmpty" returntype="boolean" access="public" output="false" hint="Returns whether or not the Flash is empty." + examples= + ' + <cfif not flashIsEmpty()> + <div id="messages"> + <cfset allFlash = flash()> + <cfloop list="##StructKeyList(allFlash)##" index="flashItem"> + <p class="##flashItem##"> + ##flash(flashItem)## + </p> + </cfloop> + </div> + </cfif> + ' + categories="controller-request,flash" chapters="using-the-flash" functions="flash,flashClear,flashCount,flashDelete,flashInsert,flashKeep,flashKeyExists,flashMessages"> + <cfreturn !flashCount()> +</cffunction> + +<cffunction name="flashKeep" returntype="void" access="public" output="false" hint="Make the entire Flash or specific key in it stick around for one more request." + examples= + ' + <!--- Keep the entire Flash for the next request ---> + <cfset flashKeep()> + + <!--- Keep the "error" key in the Flash for the next request ---> + <cfset flashKeep("error")> + + <!--- Keep both the "error" and "success" keys in the Flash for the next request ---> + <cfset flashKeep("error,success")> + ' + categories="controller-request,flash" chapters="using-the-flash" functions="flash,flashClear,flashCount,flashDelete,flashInsert,flashIsEmpty,flashKeyExists,flashMessages"> + <cfargument name="key" type="string" required="false" default="" hint="A key or list of keys to flag for keeping. This argument is also aliased as `keys`."> + <cfscript> + $args(args=arguments, name="flashKeep", combine="key/keys"); + request.wheels.flashKeep = arguments.key; + </cfscript> +</cffunction> + +<cffunction name="flashKeyExists" returntype="boolean" access="public" output="false" hint="Checks if a specific key exists in the Flash." + examples= + ' + <cfif flashKeyExists("error")> + <cfoutput> + <p>##flash("error")##</p> + </cfoutput> + </cfif> + ' + categories="controller-request,flash" chapters="using-the-flash" functions="flash,flashClear,flashCount,flashDelete,flashInsert,flashIsEmpty,flashKeep,flashMessages"> + <cfargument name="key" type="string" required="true" hint="The key to check if it exists."> + <cfset var $flash = $readFlash()> + <cfreturn StructKeyExists($flash, arguments.key)> +</cffunction> + +<cffunction name="flashMessages" returntype="string" access="public" output="false" hint="Displays a marked-up listing of messages that exists in the Flash." + examples= + ' + <!--- In the controller action ---> + <cfset flashInsert(success="Your post was successfully submitted.")> + <cfset flashInsert(alert="Don''t forget to tweet about this post!")> + <cfset flashInsert(error="This is an error message.")> + + <!--- In the layout or view ---> + <cfoutput> + ##flashMessages()## + </cfoutput> + <!--- + Generates this (sorted alphabetically): + <div class="flashMessages"> + <p class="alertMessage"> + Don''t forget to tweet about this post! + </p> + <p class="errorMessage"> + This is an error message. + </p> + <p class="successMessage"> + Your post was successfully submitted. + </p> + </div> + ---> + + <!--- Only show the "success" key in the view ---> + <cfoutput> + ##flashMessages(key="success")## + </cfoutput> + <!--- + Generates this: + <div class="flashMessage"> + <p class="successMessage"> + Your post was successfully submitted. + </p> + </div> + ---> + + <!--- Show only the "success" and "alert" keys in the view, in that order ---> + <cfoutput> + ##flashMessages(keys="success,alert")## + </cfoutput> + <!--- + Generates this (sorted alphabetically): + <div class="flashMessages"> + <p class="successMessage"> + Your post was successfully submitted. + </p> + <p class="alertMessage"> + Don''t forget to tweet about this post! + </p> + </div> + ---> + ' + categories="controller-request,flash" chapters="using-the-flash" functions="flash,flashClear,flashCount,flashDelete,flashInsert,flashIsEmpty,flashKeep,flashKeyExists"> + <cfargument name="keys" type="string" required="false" hint="The key (or list of keys) to show the value for. You can also use the `key` argument instead for better readability when accessing a single key."> + <cfargument name="class" type="string" required="false" hint="HTML `class` to set on the `div` element that contains the messages."> + <cfargument name="includeEmptyContainer" type="boolean" required="false" hint="Includes the DIV container even if the flash is empty."> + <cfargument name="lowerCaseDynamicClassValues" type="boolean" required="false" hint="Outputs all class attribute values in lower case (except the main one)."> + <cfscript> + // Initialization + var loc = {}; + loc.$flash = $readFlash(); + loc.returnValue = ""; + + $args(name="flashMessages", args=arguments); + $combineArguments(args=arguments, combine="keys,key", required=false); + + // If no keys are requested, populate with everything stored in the Flash and sort them + if(!StructKeyExists(arguments, "keys")) + { + loc.flashKeys = StructKeyList(loc.$flash); + loc.flashKeys = ListSort(loc.flashKeys, "textnocase"); + } + // Otherwise, generate list based on what was passed as `arguments.keys` + else + { + loc.flashKeys = arguments.keys; + } + + // Generate markup for each Flash item in the list + loc.listItems = ""; + loc.iEnd = ListLen(loc.flashKeys); + for (loc.i=1; loc.i <= loc.iEnd; loc.i++) + { + loc.item = ListGetAt(loc.flashKeys, loc.i); + loc.class = loc.item & "Message"; + if (arguments.lowerCaseDynamicClassValues) + loc.class = LCase(loc.class); + loc.attributes = {class=loc.class}; + if (!StructKeyExists(arguments, "key") || arguments.key == loc.item) + { + loc.content = loc.$flash[loc.item]; + if (IsSimpleValue(loc.content)) + { + loc.listItems = loc.listItems & $element(name="p", content=loc.content, attributes=loc.attributes); + } + } + } + + if (Len(loc.listItems) || arguments.includeEmptyContainer) + { + loc.returnValue = $element(name="div", skip="key,keys,includeEmptyContainer,lowerCaseDynamicClassValues", content=loc.listItems, attributes=arguments); + } + return loc.returnValue; + </cfscript> +</cffunction> + +<cffunction name="$readFlash" returntype="struct" access="public" output="false"> + <cfscript> + if (!StructKeyExists(arguments, "$locked")) + { + return $simpleLock(name="flashLock", type="readonly", execute="$readFlash", executeArgs=arguments); + } + if ($getFlashStorage() == "cookie" && StructKeyExists(cookie, "flash")) + { + return DeSerializeJSON(cookie.flash); + } + else if ($getFlashStorage() == "session" && StructKeyExists(session, "flash")) + { + return Duplicate(session.flash); + } + return StructNew(); + </cfscript> +</cffunction> + +<cffunction name="$writeFlash" returntype="void" access="public" output="false"> + <cfargument name="flash" type="struct" required="false" default="#StructNew()#"> + <cfscript> + if (!StructKeyExists(arguments, "$locked")) + { + return $simpleLock(name="flashLock", type="exclusive", execute="$writeFlash", executeArgs=arguments); + } + if ($getFlashStorage() == "cookie") + { + cookie.flash = SerializeJSON(arguments.flash); + } + else + { + session.flash = arguments.flash; + } + </cfscript> +</cffunction> + +<cffunction name="$flashClear" returntype="void" access="public" output="false"> + <cfscript> + var loc = {}; + // only save the old flash if they want to keep anything + if (StructKeyExists(request.wheels, "flashKeep")) + { + loc.$flash = $readFlash(); + } + // clear the current flash + flashClear(); + // see if they wanted to keep anything + if (StructKeyExists(loc, "$flash")) + { + // delete any keys they don't want to keep + if (Len(request.wheels.flashKeep)) + { + for (loc.key in loc.$flash) + { + if (!ListFindNoCase(request.wheels.flashKeep, loc.key)) + { + StructDelete(loc.$flash, loc.key, false); + } + } + } + // write to the flash + $writeFlash(loc.$flash); + } + </cfscript> +</cffunction> + +<cffunction name="$setFlashStorage" returntype="void" access="public" output="false"> + <cfargument name="storage" type="string" required="true"> + <cfset variables.$class.flashStorage = arguments.storage> +</cffunction> + +<cffunction name="$getFlashStorage" returntype="string" access="public" output="false"> + <cfreturn variables.$class.flashStorage> +</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/controller/functions.cfm b/src/main/webapp/wheels/controller/functions.cfm new file mode 100755 index 0000000..9ea2973 --- /dev/null +++ b/src/main/webapp/wheels/controller/functions.cfm @@ -0,0 +1,12 @@ +<cfinclude template="caching.cfm">
+<cfinclude template="filters.cfm">
+<cfinclude template="flash.cfm">
+<cfinclude template="initialization.cfm">
+<cfinclude template="layouts.cfm">
+<cfinclude template="miscellaneous.cfm">
+<cfinclude template="processing.cfm">
+<cfinclude template="provides.cfm">
+<cfinclude template="redirection.cfm">
+<cfinclude template="rendering.cfm">
+<cfinclude template="request.cfm">
+<cfinclude template="verifies.cfm">
\ No newline at end of file diff --git a/src/main/webapp/wheels/controller/initialization.cfm b/src/main/webapp/wheels/controller/initialization.cfm new file mode 100755 index 0000000..396da99 --- /dev/null +++ b/src/main/webapp/wheels/controller/initialization.cfm @@ -0,0 +1,91 @@ +<!--- PRIVATE FUNCTIONS --->
+
+<cffunction name="$createControllerObject" returntype="any" access="public" output="false">
+ <cfargument name="params" type="struct" required="true">
+ <cfscript>
+ var loc = {};
+ // if the controller file exists we instantiate it, otherwise we instantiate the parent controller
+ // this is done so that an action's view page can be rendered without having an actual controller file for it
+ loc.controllerName = $objectFileName(name=variables.$class.name, objectPath=variables.$class.path, type="controller");
+ loc.returnValue = $createObjectFromRoot(path=variables.$class.path, fileName=loc.controllerName, method="$initControllerObject", name=variables.$class.name, params=arguments.params);
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$initControllerClass" returntype="any" access="public" output="false">
+ <cfargument name="name" type="string" required="false" default="">
+ <cfscript>
+ variables.$class.name = arguments.name;
+ variables.$class.path = arguments.path;
+
+ // if our name has pathing in it, remove it and add it to the end of of the $class.path variable
+ if (Find("/", arguments.name))
+ {
+ variables.$class.name = ListLast(arguments.name, "/");
+ variables.$class.path = ListAppend(arguments.path, ListDeleteAt(arguments.name, ListLen(arguments.name, "/"), "/"), "/");
+ }
+
+ variables.$class.verifications = [];
+ variables.$class.filters = [];
+ variables.$class.cachableActions = [];
+ variables.$class.layout = {};
+
+ // default the controller to only respond to html
+ variables.$class.formats = {};
+ variables.$class.formats.default = "html";
+ variables.$class.formats.actions = {};
+ variables.$class.formats.existingTemplates = "";
+ variables.$class.formats.nonExistingTemplates = "";
+
+ $setFlashStorage(get("flashStorage"));
+ if (StructKeyExists(variables, "init"))
+ init();
+ </cfscript>
+ <cfreturn this>
+</cffunction>
+
+<cffunction name="$setControllerClassData" returntype="void" access="public" output="false">
+ <cfscript>
+ variables.$class = application.wheels.controllers[arguments.name].$getControllerClassData();
+ </cfscript>
+</cffunction>
+
+<cffunction name="$initControllerObject" returntype="any" access="public" output="false">
+ <cfargument name="name" type="string" required="true">
+ <cfargument name="params" type="struct" required="true">
+ <cfscript>
+ var loc = {};
+
+ // create a struct for storing request specific data
+ variables.$instance = {};
+ variables.$instance.contentFor = {};
+
+ // include controller specific helper files if they exist, cache the file check for performance reasons
+ loc.helperFileExists = false;
+ if (!ListFindNoCase(application.wheels.existingHelperFiles, arguments.name) && !ListFindNoCase(application.wheels.nonExistingHelperFiles, arguments.name))
+ {
+ if (FileExists(ExpandPath("#application.wheels.viewPath#/#LCase(arguments.name)#/helpers.cfm")))
+ loc.helperFileExists = true;
+ if (application.wheels.cacheFileChecking)
+ {
+ if (loc.helperFileExists)
+ application.wheels.existingHelperFiles = ListAppend(application.wheels.existingHelperFiles, arguments.name);
+ else
+ application.wheels.nonExistingHelperFiles = ListAppend(application.wheels.nonExistingHelperFiles, arguments.name);
+ }
+ }
+ if (ListFindNoCase(application.wheels.existingHelperFiles, arguments.name) || loc.helperFileExists)
+ $include(template="#application.wheels.viewPath#/#arguments.name#/helpers.cfm");
+
+ loc.executeArgs = {};
+ loc.executeArgs.name = arguments.name;
+ $simpleLock(name="controllerLock", type="readonly", execute="$setControllerClassData", executeArgs=loc.executeArgs);
+
+ variables.params = arguments.params;
+ </cfscript>
+ <cfreturn this>
+</cffunction>
+
+<cffunction name="$getControllerClassData" returntype="struct" access="public" output="false">
+ <cfreturn variables.$class>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/controller/layouts.cfm b/src/main/webapp/wheels/controller/layouts.cfm new file mode 100755 index 0000000..1209fdf --- /dev/null +++ b/src/main/webapp/wheels/controller/layouts.cfm @@ -0,0 +1,135 @@ +<cffunction name="usesLayout" access="public" returntype="void" output="false" hint="Used within a controller's `init()` method to specify controller- or action-specific layouts."
+ examples=
+ '
+ <!---
+ Example 1: We want this layout to be used as the default throughout the entire
+ controller, except for the myajax action
+ --->
+ <cffunction name="init">
+ <cfset usesLayout(template="myLayout", except="myajax")>
+ </cffunction>
+
+ <!---
+ Example 2: Use a custom layout for these actions but use the default layout.cfm
+ for the rest
+ --->
+ <cffunction name="init">
+ <cfset usesLayout(template="myLayout", only="termsOfService,shippingPolicy")>
+ </cffunction>
+
+ <!--- Example 3: Define a custom method to decide which layout to display --->
+ <cffunction name="init">
+ <cfset usesLayout("setLayout")>
+ </cffunction>
+
+ <cffunction name="setLayout">
+ <!--- Use holiday theme for the month of December --->
+ <cfif Month(Now()) eq 12>
+ <cfreturn "holiday">
+ <!--- Otherwise, use default layout by returning `true` --->
+ <cfelse>
+ <cfreturn true>
+ </cfif>
+ </cffunction>
+ '
+ categories="controller-initialization,rendering" chapters="rendering-layout" functions="renderPage">
+ <cfargument name="template" required="true" type="string" hint="Name of the layout template or method name you want to use">
+ <cfargument name="ajax" required="false" type="string" default="" hint="Name of the layout template you want to use for AJAX requests">
+ <cfargument name="except" type="string" required="false" hint="List of actions that SHOULD NOT get the layout">
+ <cfargument name="only" type="string" required="false" hint="List of action that SHOULD ONLY get the layout">
+ <cfargument name="useDefault" type="boolean" required="false" default="true" hint="When specifying conditions or a method, pass `true` to use the default `layout.cfm` if none of the conditions are met">
+ <cfscript>
+ // when the layout is a method, the method itself should handle all the logic
+ if ((StructKeyExists(this, arguments.template) && IsCustomFunction(this[arguments.template])) || IsCustomFunction(arguments.template))
+ {
+ StructDelete(arguments, "except", false);
+ StructDelete(arguments, "only", false);
+ }
+ if (StructKeyExists(arguments, "except"))
+ arguments.except = $listClean(arguments.except);
+ if (StructKeyExists(arguments, "only"))
+ arguments.only = $listClean(arguments.only);
+ variables.$class.layout = arguments;
+ </cfscript>
+</cffunction>
+
+<cffunction name="$useLayout" access="public" returntype="any" output="false">
+ <cfargument name="$action" type="string" required="true">
+ <cfscript>
+ var loc = {};
+ loc.returnValue = true;
+ loc.layoutType = "template";
+ if (isAjax() && StructKeyExists(variables.$class.layout, "ajax") && Len(variables.$class.layout.ajax))
+ loc.layoutType = "ajax";
+ if (!StructIsEmpty(variables.$class.layout))
+ {
+ loc.returnValue = variables.$class.layout.useDefault;
+ if ((StructKeyExists(this, variables.$class.layout[loc.layoutType]) && IsCustomFunction(this[variables.$class.layout[loc.layoutType]])) || IsCustomFunction(variables.$class.layout[loc.layoutType]))
+ {
+ // if the developer doesn't return anything from the method or if they return a blank string it should use the default layout still
+ loc.invokeArgs = {};
+ loc.invokeArgs.action = arguments.$action;
+ loc.temp = $invoke(method=variables.$class.layout[loc.layoutType], invokeArgs=loc.invokeArgs);
+ if (StructKeyExists(loc, "temp"))
+ loc.returnValue = loc.temp;
+ }
+ else if ((!StructKeyExists(variables.$class.layout, "except") || !ListFindNoCase(variables.$class.layout.except, arguments.$action)) && (!StructKeyExists(variables.$class.layout, "only") || ListFindNoCase(variables.$class.layout.only, arguments.$action)))
+ {
+ loc.returnValue = variables.$class.layout[loc.layoutType];
+ }
+ }
+ return loc.returnValue;
+ </cfscript>
+</cffunction>
+
+<cffunction name="$renderLayout" returntype="string" access="public" output="false">
+ <cfargument name="$content" type="string" required="true">
+ <cfargument name="$layout" type="any" required="true">
+ <cfscript>
+ var loc = {};
+ if ((IsBoolean(arguments.$layout) && arguments.$layout) || (!IsBoolean(arguments.$layout) && Len(arguments.$layout)))
+ {
+ // store the content in a variable in the request scope so it can be accessed
+ // by the includeContent function that the developer uses in layout files
+ // this is done so we avoid passing data to/from it since it would complicate things for the developer
+ contentFor(body=arguments.$content, overwrite=true);
+ loc.include = application.wheels.viewPath;
+ if (IsBoolean(arguments.$layout))
+ {
+ loc.layoutFileExists = false;
+ if (!ListFindNoCase(application.wheels.existingLayoutFiles, variables.params.controller) && !ListFindNoCase(application.wheels.nonExistingLayoutFiles, variables.params.controller))
+ {
+ if (FileExists(ExpandPath("#application.wheels.viewPath#/#LCase(variables.params.controller)#/layout.cfm")))
+ loc.layoutFileExists = true;
+ if (application.wheels.cacheFileChecking)
+ {
+ if (loc.layoutFileExists)
+ application.wheels.existingLayoutFiles = ListAppend(application.wheels.existingLayoutFiles, variables.params.controller);
+ else
+ application.wheels.nonExistingLayoutFiles = ListAppend(application.wheels.nonExistingLayoutFiles, variables.params.controller);
+ }
+ }
+ if (ListFindNoCase(application.wheels.existingLayoutFiles, variables.params.controller) || loc.layoutFileExists)
+ {
+ loc.include = loc.include & "/" & variables.params.controller & "/" & "layout.cfm";
+ }
+ else
+ {
+ loc.include = loc.include & "/" & "layout.cfm";
+ }
+ loc.returnValue = $includeAndReturnOutput($template=loc.include);
+ }
+ else
+ {
+ arguments.$name = arguments.$layout;
+ arguments.$template = $generateIncludeTemplatePath(argumentCollection=arguments);
+ loc.returnValue = $includeFile(argumentCollection=arguments);
+ }
+ }
+ else
+ {
+ loc.returnValue = arguments.$content;
+ }
+ return loc.returnValue;
+ </cfscript>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/controller/miscellaneous.cfm b/src/main/webapp/wheels/controller/miscellaneous.cfm new file mode 100755 index 0000000..4d37bd0 --- /dev/null +++ b/src/main/webapp/wheels/controller/miscellaneous.cfm @@ -0,0 +1,199 @@ +<!--- PUBLIC CONTROLLER REQUEST FUNCTIONS --->
+
+<cffunction name="sendEmail" returntype="any" access="public" output="false" hint="Sends an email using a template and an optional layout to wrap it in. Besides the Wheels-specific arguments documented here, you can also pass in any argument that is accepted by the `cfmail` tag as well as your own arguments to be used by the view."
+ examples=
+ '
+ <!--- Get a member and send a welcome email, passing in a few custom variables to the template --->
+ <cfset newMember = model("member").findByKey(params.member.id)>
+ <cfset sendEmail(
+ to=newMember.email,
+ template="myemailtemplate",
+ subject="Thank You for Becoming a Member",
+ recipientName=newMember.name,
+ startDate=newMember.startDate
+ )>
+ '
+ categories="controller-request,miscellaneous" chapters="sending-email" functions="">
+ <cfargument name="template" type="string" required="false" default="" hint="The path to the email template or two paths if you want to send a multipart email. if the `detectMultipart` argument is `false`, the template for the text version should be the first one in the list. This argument is also aliased as `templates`.">
+ <cfargument name="from" type="string" required="false" default="" hint="Email address to send from.">
+ <cfargument name="to" type="string" required="false" default="" hint="List of email addresses to send the email to.">
+ <cfargument name="subject" type="string" required="false" default="" hint="The subject line of the email.">
+ <cfargument name="layout" type="any" required="false" hint="Layout(s) to wrap the email template in. This argument is also aliased as `layouts`.">
+ <cfargument name="file" type="string" required="false" default="" hint="A list of the names of the files to attach to the email. This will reference files stored in the `files` folder (or a path relative to it). This argument is also aliased as `files`.">
+ <cfargument name="detectMultipart" type="boolean" required="false" hint="When set to `true` and multiple values are provided for the `template` argument, Wheels will detect which of the templates is text and which one is HTML (by counting the `<` characters).">
+ <cfargument name="$deliver" type="boolean" required="false" default="true">
+ <cfscript>
+ var loc = {};
+ $args(args=arguments, name="sendEmail", combine="template/templates/!,layout/layouts,file/files", required="template,from,to,subject");
+
+ loc.nonPassThruArgs = "template,templates,layout,layouts,file,files,detectMultipart,$deliver";
+ loc.mailTagArgs = "from,to,bcc,cc,charset,debug,failto,group,groupcasesensitive,mailerid,maxrows,mimeattach,password,port,priority,query,replyto,server,spoolenable,startrow,subject,timeout,type,username,useSSL,useTLS,wraptext";
+ loc.deliver = arguments.$deliver;
+
+ // if two templates but only one layout was passed in we set the same layout to be used on both
+ if (ListLen(arguments.template) > 1 && ListLen(arguments.layout) == 1)
+ arguments.layout = ListAppend(arguments.layout, arguments.layout);
+
+ // set the variables that should be available to the email view template (i.e. the custom named arguments passed in by the developer)
+ for (loc.key in arguments)
+ {
+ if (!ListFindNoCase(loc.nonPassThruArgs, loc.key) && !ListFindNoCase(loc.mailTagArgs, loc.key))
+ {
+ variables[loc.key] = arguments[loc.key];
+ StructDelete(arguments, loc.key);
+ }
+ }
+
+ // get the content of the email templates and store them as cfmailparts
+ arguments.mailparts = [];
+ loc.iEnd = ListLen(arguments.template);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ // include the email template and return it
+ loc.content = $renderPage($template=ListGetAt(arguments.template, loc.i), $layout=ListGetAt(arguments.layout, loc.i));
+ loc.mailpart = {};
+ loc.mailpart.tagContent = loc.content;
+ if (ArrayIsEmpty(arguments.mailparts))
+ {
+ ArrayAppend(arguments.mailparts, loc.mailpart);
+ }
+ else
+ {
+ // make sure the text version is the first one in the array
+ loc.existingContentCount = ListLen(arguments.mailparts[1].tagContent, "<");
+ loc.newContentCount = ListLen(loc.content, "<");
+ if (loc.newContentCount < loc.existingContentCount)
+ ArrayPrepend(arguments.mailparts, loc.mailpart);
+ else
+ ArrayAppend(arguments.mailparts, loc.mailpart);
+ arguments.mailparts[1].type = "text";
+ arguments.mailparts[2].type = "html";
+ }
+ }
+
+ // figure out if the email should be sent as html or text when only one template is used and the developer did not specify the type explicitly
+ if (ArrayLen(arguments.mailparts) == 1)
+ {
+ arguments.tagContent = arguments.mailparts[1].tagContent;
+ StructDelete(arguments, "mailparts");
+ if (arguments.detectMultipart && !StructKeyExists(arguments, "type"))
+ {
+ if (Find("<", arguments.tagContent) && Find(">", arguments.tagContent))
+ arguments.type = "html";
+ else
+ arguments.type = "text";
+ }
+ }
+
+ // attach files using the cfmailparam tag
+ if (Len(arguments.file))
+ {
+ arguments.mailparams = [];
+ loc.iEnd = ListLen(arguments.file);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ arguments.mailparams[loc.i] = {};
+ arguments.mailparams[loc.i].file = ExpandPath(application.wheels.filePath) & "/" & ListGetAt(arguments.file, loc.i);
+ }
+ }
+
+ // delete arguments that we don't want to pass through to the cfmail tag
+ loc.iEnd = ListLen(loc.nonPassThruArgs);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ StructDelete(arguments, ListGetAt(loc.nonPassThruArgs, loc.i));
+
+ // send the email using the cfmail tag
+ if (loc.deliver)
+ $mail(argumentCollection=arguments);
+ else
+ return arguments;
+ </cfscript>
+</cffunction>
+
+<cffunction name="sendFile" returntype="any" access="public" output="false" hint="Sends a file to the user (from the `files` folder or a path relative to it by default)."
+ examples=
+ '
+ <!--- Send a PDF file to the user --->
+ <cfset sendFile(file="wheels_tutorial_20081028_J657D6HX.pdf")>
+
+ <!--- Send the same file but give the user a different name in the browser dialog window --->
+ <cfset sendFile(file="wheels_tutorial_20081028_J657D6HX.pdf", name="Tutorial.pdf")>
+
+ <!--- Send a file that is located outside of the web root --->
+ <cfset sendFile(file="../../tutorials/wheels_tutorial_20081028_J657D6HX.pdf")>
+ '
+ categories="controller-request,miscellaneous" chapters="sending-files" functions="">
+ <cfargument name="file" type="string" required="true" hint="The file to send to the user.">
+ <cfargument name="name" type="string" required="false" default="" hint="The file name to show in the browser download dialog box.">
+ <cfargument name="type" type="string" required="false" default="" hint="The HTTP content type to deliver the file as.">
+ <cfargument name="disposition" type="string" required="false" hint="Set to `inline` to have the browser handle the opening of the file (possibly inline in the browser) or set to `attachment` to force a download dialog box.">
+ <cfargument name="directory" type="string" required="false" default="" hint="Directory outside of the webroot where the file exists. Must be a full path.">
+ <cfargument name="deleteFile" type="boolean" required="false" default="false" hint="Pass in `true` to delete the file on the server after sending it.">
+ <cfargument name="$testingMode" type="boolean" required="false" default="false">
+ <cfscript>
+ var loc = {};
+ $args(name="sendFile", args=arguments);
+ loc.relativeRoot = application.wheels.rootPath;
+ if (Right(loc.relativeRoot, 1) != "/")
+ {
+ loc.relativeRoot = loc.relativeRoot & "/";
+ }
+
+ loc.root = ExpandPath(loc.relativeRoot);
+ loc.folder = arguments.directory;
+ if (!Len(loc.folder))
+ {
+ loc.folder = loc.relativeRoot & application.wheels.filePath;
+ }
+
+ if (Left(loc.folder, Len(loc.root)) eq loc.root)
+ {
+ loc.folder = RemoveChars(loc.folder, 1, Len(loc.root));
+ }
+
+ loc.fullPath = Replace(loc.folder, "\", "/", "all");
+ loc.fullPath = ListAppend(loc.fullPath, arguments.file, "/");
+ loc.fullPath = ExpandPath(loc.fullPath);
+ loc.fullPath = Replace(loc.fullPath, "\", "/", "all");
+ loc.file = ListLast(loc.fullPath, "/");
+ loc.directory = Reverse(ListRest(Reverse(loc.fullPath), "/"));
+
+ // if the file is not found, try searching for it
+ if (!FileExists(loc.fullPath))
+ {
+ loc.match = $directory(action="list", directory="#loc.directory#", filter="#loc.file#.*");
+ // only extract the extension if we find a single match
+ if (loc.match.recordCount == 1)
+ {
+ loc.file = loc.file & "." & ListLast(loc.match.name, ".");
+ loc.fullPath = loc.directory & "/" & loc.file;
+ }
+ else
+ {
+ $throw(type="Wheels.FileNotFound", message="A file could not be found.", extendedInfo="Make sure a file with the name `#loc.file#` exists in the `#loc.directory#` folder.");
+ }
+ }
+
+ loc.name = loc.file;
+ loc.extension = ListLast(loc.file, ".");
+
+ // replace the display name for the file if supplied
+ if (Len(arguments.name))
+ loc.name = arguments.name;
+
+ loc.mime = arguments.type;
+ if (!Len(loc.mime))
+ loc.mime = mimeTypes(loc.extension);
+
+ // if testing, return the variables
+ if (arguments.$testingMode)
+ {
+ StructAppend(loc, arguments, false);
+ return loc;
+ }
+
+ // prompt the user to download the file
+ $header(name="content-disposition", value="#arguments.disposition#; filename=""#loc.name#""");
+ $content(type="#loc.mime#", file="#loc.fullPath#", deleteFile="#arguments.deleteFile#");
+ </cfscript>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/controller/processing.cfm b/src/main/webapp/wheels/controller/processing.cfm new file mode 100755 index 0000000..c9225d5 --- /dev/null +++ b/src/main/webapp/wheels/controller/processing.cfm @@ -0,0 +1,139 @@ +<cffunction name="$processAction" returntype="boolean" access="public" output="false">
+ <cfscript>
+ var loc = {};
+ loc.debug = application.wheels.showDebugInformation;
+ if (loc.debug)
+ $debugPoint("beforeFilters");
+ // run verifications and before filters if they exist on the controller
+ this.$runVerifications(action=params.action, params=params);
+ // return immediately if an abort is issue from a verification
+ if ($abortIssued())
+ return true;
+ this.$runFilters(type="before", action=params.action);
+
+ // check to see if the controller params has changed and if so, instantiate the new controller and re-run filters and verifications
+ if (params.controller != variables.$class.name)
+ return false;
+
+ if (loc.debug)
+ $debugPoint("beforeFilters,action");
+
+ // only proceed to call the action if the before filter has not already rendered content
+ if (!$performedRenderOrRedirect())
+ {
+ // call action on controller if it exists
+ loc.actionIsCachable = false;
+ if ($hasCachableActions() && flashIsEmpty() && StructIsEmpty(form))
+ {
+ loc.cachableActions = $cachableActions();
+ loc.iEnd = ArrayLen(loc.cachableActions);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ if (loc.cachableActions[loc.i].action == params.action || loc.cachableActions[loc.i].action == "*")
+ {
+ loc.actionIsCachable = true;
+ loc.time = loc.cachableActions[loc.i].time;
+ loc.static = loc.cachableActions[loc.i].static;
+ }
+ }
+ }
+ if (loc.actionIsCachable)
+ {
+ loc.category = "action";
+ loc.key = $hashedKey(request.cgi.http_host, variables.$class.name, variables.params);
+ loc.lockName = loc.category & loc.key;
+ loc.conditionArgs = {};
+ loc.conditionArgs.key = loc.key;
+ loc.conditionArgs.category = loc.category;
+ loc.executeArgs = {};
+ loc.executeArgs.controller = loc.controller;
+ loc.executeArgs.action = params.action;
+ loc.executeArgs.key = loc.key;
+ loc.executeArgs.time = loc.time;
+ loc.executeArgs.static = loc.static;
+ loc.executeArgs.category = loc.category;
+ // get content from the cache if it exists there and set it to the request scope, if not the $callActionAndAddToCache function will run, caling the controller action (which in turn sets the content to the request scope)
+ variables.$instance.response = $doubleCheckedLock(name=loc.lockName, condition="$getFromCache", execute="$callActionAndAddToCache", conditionArgs=loc.conditionArgs, executeArgs=loc.executeArgs);
+ }
+ else
+ {
+ $callAction(action=params.action);
+ }
+ }
+
+ // run after filters with surrounding debug points (don't run the filters if a delayed redirect will occur though)
+ if (loc.debug)
+ $debugPoint("action,afterFilters");
+ if (!$performedRedirect())
+ $runFilters(type="after", action=params.action);
+ if (loc.debug)
+ $debugPoint("afterFilters");
+ </cfscript>
+ <cfreturn true />
+</cffunction>
+
+<cffunction name="$callAction" returntype="void" access="public" output="false">
+ <cfargument name="action" type="string" required="true">
+ <cfscript>
+ var loc = {};
+
+ if (Left(arguments.action, 1) == "$" || ListFindNoCase(application.wheels.protectedControllerMethods, arguments.action))
+ $throw(type="Wheels.ActionNotAllowed", message="You are not allowed to execute the `#arguments.action#` method as an action.", extendedInfo="Make sure your action does not have the same name as any of the built-in Wheels functions.");
+
+ if (StructKeyExists(this, arguments.action) && IsCustomFunction(this[arguments.action]))
+ {
+ $invoke(method=arguments.action);
+ }
+ else if (StructKeyExists(this, "onMissingMethod"))
+ {
+ loc.invokeArgs = {};
+ loc.invokeArgs.missingMethodName = arguments.action;
+ loc.invokeArgs.missingMethodArguments = {};
+ $invoke(method="onMissingMethod", invokeArgs=loc.invokeArgs);
+ }
+
+ if (!$performedRenderOrRedirect())
+ {
+ try
+ {
+ renderPage();
+ }
+ catch(Any e)
+ {
+ if (FileExists(ExpandPath("#application.wheels.viewPath#/#LCase(variables.$class.name)#/#LCase(arguments.action)#.cfm")))
+ {
+ $throw(object=e);
+ }
+ else
+ {
+ if (application.wheels.showErrorInformation)
+ {
+ $throw(type="Wheels.ViewNotFound", message="Could not find the view page for the `#arguments.action#` action in the `#variables.$class.name#` controller.", extendedInfo="Create a file named `#LCase(arguments.action)#.cfm` in the `views/#LCase(variables.$class.name)#` directory (create the directory as well if it doesn't already exist).");
+ }
+ else
+ {
+ $header(statusCode="404", statusText="Not Found");
+ $includeAndOutput(template="#application.wheels.eventPath#/onmissingtemplate.cfm");
+ $abort();
+ }
+ }
+ }
+ }
+ </cfscript>
+</cffunction>
+
+<cffunction name="$callActionAndAddToCache" returntype="string" access="public" output="false">
+ <cfargument name="action" type="string" required="true">
+ <cfargument name="static" type="boolean" required="true">
+ <cfargument name="time" type="numeric" required="true">
+ <cfargument name="key" type="string" required="true">
+ <cfargument name="category" type="string" required="true">
+ <cfscript>
+ $callAction(action=arguments.action);
+ if (arguments.static)
+ $cache(action="serverCache", timeSpan=$timeSpanForCache(arguments.time, "main"));
+ else
+ $addToCache(key=arguments.key, value=variables.$instance.response, time=arguments.time, category=arguments.category);
+ </cfscript>
+ <cfreturn response()>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/controller/provides.cfm b/src/main/webapp/wheels/controller/provides.cfm new file mode 100755 index 0000000..e936059 --- /dev/null +++ b/src/main/webapp/wheels/controller/provides.cfm @@ -0,0 +1,220 @@ +<cffunction name="provides" access="public" output="false" returntype="void" hint="Defines formats that the controller will respond with upon request. The format can be requested through a URL variable called `format`, by appending the format name to the end of a URL as an extension (when URL rewriting is enabled), or in the request header."
+ examples='
+ <!--- In your controller --->
+ <cffunction name="init">
+ <cfset provides("html,xml,json")>
+ </cffunction>
+ '
+ categories="controller-initialization,provides" chapters="responding-with-multiple-formats" functions="onlyProvides,renderWith">
+ <cfargument name="formats" required="false" default="" type="string" hint="Formats to instruct the controller to provide. Valid values are `html` (the default), `xml`, `json`, `csv`, `pdf`, and `xls`." />
+ <cfscript>
+ var loc = {};
+ $combineArguments(args=arguments, combine="formats,format", required=true);
+ arguments.formats = $listClean(arguments.formats);
+ loc.possibleFormats = StructKeyList(application.wheels.formats);
+
+ for (loc.i = 1; loc.i lte ListLen(arguments.formats); loc.i++)
+ if (application.wheels.showErrorInformation && !ListFindNoCase(loc.possibleFormats, ListGetAt(arguments.formats, loc.i)))
+ $throw(type="Wheels.invalidFormat"
+ , message="An invalid format of `#ListGetAt(arguments.formats, loc.i)#` has been specific. The possible values are #loc.possibleFormats#.");
+
+ variables.$class.formats.default = ListAppend(variables.$class.formats.default, $listClean(arguments.formats));
+ </cfscript>
+ <cfreturn />
+</cffunction>
+
+<cffunction name="onlyProvides" access="public" output="false" returntype="void" hint="Use this in an individual controller action to define which formats the action will respond with. This can be used to define provides behavior in individual actions or to override a global setting set with @provides in the controller's `init()`."
+ examples='
+ <!--- In your controller --->
+ <cffunction name="init">
+ <cfset provides("html,xml,json")>
+ </cffunction>
+
+ <!--- This action will provide the formats defined in `init()` above --->
+ <cffunction name="list">
+ <cfset products = model("product").findAll()>
+ <cfset renderWith(products)>
+ </cffunction>
+
+ <!--- This action will only provide the `html` type and will ignore what was defined in the call to `provides()` in the `init()` method above --->
+ <cffunction name="new">
+ <cfset onlyProvides("html")>
+ <cfset model("product").new()>
+ </cffunction>
+ '
+ categories="controller-request,provides" chapters="responding-with-multiple-formats" functions="provides,renderWith">
+ <cfargument name="formats" required="false" default="" type="string" />
+ <cfargument name="action" type="string" default="#variables.params.action#" />
+ <cfscript>
+ var loc = {};
+ $combineArguments(args=arguments, combine="formats,format", required=true);
+ arguments.formats = $listClean(arguments.formats);
+ loc.possibleFormats = StructKeyList(application.wheels.formats);
+
+ for (loc.i = 1; loc.i lte ListLen(arguments.formats); loc.i++)
+ if (application.wheels.showErrorInformation && !ListFindNoCase(loc.possibleFormats, ListGetAt(arguments.formats, loc.i)))
+ $throw(type="Wheels.invalidFormat"
+ , message="An invalid format of `#ListGetAt(arguments.formats, loc.i)#` has been specific. The possible values are #loc.possibleFormats#.");
+
+ variables.$class.formats.actions[arguments.action] = $listClean(arguments.formats);
+ </cfscript>
+ <cfreturn />
+</cffunction>
+
+<cffunction name="renderWith" access="public" returntype="any" output="false" hint="Instructs the controller to render the data passed in to the format that is requested. If the format requested is `json` or `xml`, Wheels will transform the data into that format automatically. For other formats (or to override the automatic formatting), you can also create a view template in this format: `nameofaction.xml.cfm`, `nameofaction.json.cfm`, `nameofaction.pdf.cfm`, etc."
+ examples='
+ <!--- In your controller --->
+ <cffunction name="init">
+ <cfset provides("html,xml,json")>
+ </cffunction>
+
+ <!--- This action will provide the formats defined in `init()` above --->
+ <cffunction name="list">
+ <cfset products = model("product").findAll()>
+ <cfset renderWith(products)>
+ </cffunction>
+
+ <!--- This action will only provide the `html` type and will ignore what was defined in the call to `provides()` in the `init()` method above --->
+ <cffunction name="new">
+ <cfset onlyProvides("html")>
+ <cfset model("product").new()>
+ </cffunction>
+ '
+ categories="controller-request,provides" chapters="responding-with-multiple-formats" functions="provides,onlyProvides">
+ <cfargument name="data" required="true" type="any" hint="Data to format and render." />
+ <cfargument name="controller" type="string" required="false" default="#variables.params.controller#" hint="See documentation for @renderPage.">
+ <cfargument name="action" type="string" required="false" default="#variables.params.action#" hint="See documentation for @renderPage.">
+ <cfargument name="template" type="string" required="false" default="" hint="See documentation for @renderPage.">
+ <cfargument name="layout" type="any" required="false" hint="See documentation for @renderPage.">
+ <cfargument name="cache" type="any" required="false" default="" hint="See documentation for @renderPage.">
+ <cfargument name="returnAs" type="string" required="false" default="" hint="See documentation for @renderPage.">
+ <cfargument name="hideDebugInformation" type="boolean" required="false" default="false" hint="See documentation for @renderPage.">
+ <cfscript>
+ var loc = {};
+ $args(name="renderWith", args=arguments);
+ loc.contentType = $requestContentType();
+ loc.acceptableFormats = $acceptableFormats(action=arguments.action);
+
+ // default to html if the content type found is not acceptable
+ if (not ListFindNoCase(loc.acceptableFormats, loc.contentType))
+ loc.contentType = "html";
+
+ // call render page and exit if we are just rendering html
+ if (loc.contentType == "html")
+ {
+ StructDelete(arguments, "data", false);
+ return renderPage(argumentCollection=arguments);
+ }
+
+ loc.templateName = $generateRenderWithTemplatePath(argumentCollection=arguments, contentType=loc.contentType);
+ loc.templatePathExists = $formatTemplatePathExists($name=loc.templateName);
+
+ if (loc.templatePathExists)
+ loc.content = renderPage(argumentCollection=arguments, template=loc.templateName, returnAs="string", layout=false, hideDebugInformation=true);
+
+ // throw an error if we rendered a pdf template and we got here, the cfdocument call should have stopped processing
+ if (loc.contentType == "pdf" && application.wheels.showErrorInformation && loc.templatePathExists)
+ $throw(type="Wheels.PdfRenderingError"
+ , message="When rendering the a PDF file, don't specify the filename attribute. This will stream the PDF straight to the browser.");
+
+ // throw an error if we do not have a template to render the content type that we do not have defaults for
+ if (!ListFindNoCase("json,xml", loc.contentType) && !StructKeyExists(loc, "content") && application.wheels.showErrorInformation)
+ {
+ $throw(type="Wheels.renderingError"
+ , message="To render the #loc.contentType# content type, create the template `#loc.templateName#.cfm` for the #arguments.controller# controller.");
+ }
+
+ // set our header based on our mime type
+ $header(name="content-type", value=application.wheels.formats[loc.contentType], charset="utf-8");
+
+ // if we do not have the loc.content variable and we are not rendering html then try to create it
+ if (!StructKeyExists(loc, "content"))
+ {
+ switch (loc.contentType)
+ {
+ case "json": { loc.content = SerializeJSON(arguments.data); break; }
+ case "xml": { loc.content = $toXml(arguments.data); break; };
+ }
+ }
+
+ // if the developer passed in returnAs = string then return the generated content to them
+ if (arguments.returnAs == "string")
+ return loc.content;
+
+ renderText(loc.content);
+ </cfscript>
+</cffunction>
+
+<cffunction name="$acceptableFormats" access="public" output="false" returntype="string" hint="">
+ <cfargument name="action" type="string" required="true">
+ <cfscript>
+ var returnValue = variables.$class.formats.default;
+ if (StructKeyExists(variables.$class.formats, arguments.action))
+ returnValue = variables.$class.formats[arguments.action];
+ </cfscript>
+ <cfreturn returnValue />
+</cffunction>
+
+<cffunction name="$generateRenderWithTemplatePath" access="public" output="false" returntype="string" hint="">
+ <cfargument name="controller" type="string" required="true">
+ <cfargument name="action" type="string" required="true">
+ <cfargument name="template" type="string" required="true">
+ <cfargument name="contentType" type="string" required="true">
+ <cfscript>
+ var templateName = "";
+
+ if (!Len(arguments.template))
+ templateName = "/" & arguments.controller & "/" & arguments.action;
+ else
+ templateName = arguments.template;
+
+ if (Len(arguments.contentType))
+ templateName = templateName & "." & arguments.contentType;
+ </cfscript>
+ <cfreturn templateName />
+</cffunction>
+
+<cffunction name="$formatTemplatePathExists" access="public" output="false" returntype="boolean">
+ <cfargument name="$name" type="string" required="true">
+ <cfscript>
+ var loc = {};
+ loc.templatePath = $generateIncludeTemplatePath($type="page", $name=arguments.$name, $template=arguments.$name);
+ loc.templatePathExists = false;
+
+ if (!ListFindNoCase(variables.$class.formats.existingTemplates, arguments.$name) && !ListFindNoCase(variables.$class.formats.nonExistingTemplates, arguments.$name))
+ {
+ if (FileExists(ExpandPath(loc.templatePath)))
+ loc.templatePathExists = true;
+
+ if (application.wheels.cacheFileChecking)
+ {
+ if (loc.templatePathExists)
+ variables.$class.formats.existingTemplates = ListAppend(variables.$class.formats.existingTemplates, arguments.$name);
+ else
+ variables.$class.formats.nonExistingTemplates = ListAppend(variables.$class.formats.nonExistingTemplates, arguments.$name);
+ }
+ }
+
+ if (!loc.templatePathExists && ListFindNoCase(variables.$class.formats.existingTemplates, arguments.$name))
+ loc.templatePathExists = true;
+ </cfscript>
+ <cfreturn loc.templatePathExists />
+</cffunction>
+
+<cffunction name="$requestContentType" access="public" output="false" returntype="string">
+ <cfargument name="params" type="struct" required="false" default="#variables.params#" />
+ <cfargument name="httpAccept" type="string" required="false" default="#request.cgi.http_accept#" />
+ <cfscript>
+ var loc = {};
+ loc.format = "html";
+
+ // see if we have a format param
+ if (StructKeyExists(arguments.params, "format"))
+ return arguments.params.format;
+
+ for (loc.item in application.wheels.formats)
+ if (arguments.httpAccept == application.wheels.formats[loc.item])
+ return loc.item;
+ </cfscript>
+ <cfreturn loc.format />
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/controller/redirection.cfm b/src/main/webapp/wheels/controller/redirection.cfm new file mode 100755 index 0000000..ea9da9a --- /dev/null +++ b/src/main/webapp/wheels/controller/redirection.cfm @@ -0,0 +1,125 @@ +<!--- PUBLIC CONTROLLER REQUEST FUNCTIONS --->
+
+<cffunction name="redirectTo" returntype="void" access="public" output="false" hint="Redirects the browser to the supplied `controller`/`action`/`key`, `route` or back to the referring page. Internally, this function uses the @URLFor function to build the link and the `cflocation` tag to perform the redirect."
+ examples=
+ '
+ <!--- Redirect to an action after successfully saving a user --->
+ <cfif user.save()>
+ <cfset redirectTo(action="saveSuccessful")>
+ </cfif>
+
+ <!--- Redirect to a specific page on a secure server --->
+ <cfset redirectTo(controller="checkout", action="start", params="type=express", protocol="https")>
+
+ <!--- Redirect to a route specified in `config/routes.cfm` and pass in the screen name that the route takes --->
+ <cfset redirectTo(route="profile", screenName="Joe")>
+
+ <!--- Redirect back to the page the user came from --->
+ <cfset redirectTo(back=true)>
+ '
+ categories="controller-request,miscellaneous" chapters="redirecting-users,using-routes" functions="">
+ <cfargument name="back" type="boolean" required="false" default="false" hint="Set to `true` to redirect back to the referring page.">
+ <cfargument name="addToken" type="boolean" required="false" hint="See documentation for your CFML engine's implementation of `cflocation`.">
+ <cfargument name="statusCode" type="numeric" required="false" hint="See documentation for your CFML engine's implementation of `cflocation`.">
+ <cfargument name="route" type="string" required="false" default="" hint="See documentation for @URLFor.">
+ <cfargument name="controller" type="string" required="false" default="" hint="See documentation for @URLFor.">
+ <cfargument name="action" type="string" required="false" default="" hint="See documentation for @URLFor.">
+ <cfargument name="key" type="any" required="false" default="" hint="See documentation for @URLFor.">
+ <cfargument name="params" type="string" required="false" default="" hint="See documentation for @URLFor.">
+ <cfargument name="anchor" type="string" required="false" default="" hint="See documentation for @URLFor.">
+ <cfargument name="onlyPath" type="boolean" required="false" hint="See documentation for @URLFor.">
+ <cfargument name="host" type="string" required="false" hint="See documentation for @URLFor.">
+ <cfargument name="protocol" type="string" required="false" hint="See documentation for @URLFor.">
+ <cfargument name="port" type="numeric" required="false" hint="See documentation for @URLFor.">
+ <cfargument name="delay" type="boolean" required="false" hint="Set to `true` to delay the redirection until after the rest of your action code has executed.">
+ <cfscript>
+ var loc = {};
+ $args(name="redirectTo", args=arguments);
+
+ // set flash if passed in
+ loc.functionInfo = GetMetaData(variables.redirectTo);
+ if (StructCount(arguments) > ArrayLen(loc.functionInfo.parameters))
+ {
+ // since more than the arguments listed in the function declaration was passed in it's possible that one of them is intended for the flash
+
+ // create a list of all the argument names that should not be set to the flash
+ // this includes arguments to the function itself or ones meant for a route
+ loc.nonFlashArgumentNames = "";
+ if (Len(arguments.route))
+ loc.nonFlashArgumentNames = ListAppend(loc.nonFlashArgumentNames, $findRoute(argumentCollection=arguments).variables);
+ loc.iEnd = ArrayLen(loc.functionInfo.parameters);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ loc.nonFlashArgumentNames = ListAppend(loc.nonFlashArgumentNames, loc.functionInfo.parameters[loc.i].name);
+
+ // loop through arguments and when the first flash argument is found we set it
+ loc.argumentNames = StructKeyList(arguments);
+ loc.iEnd = ListLen(loc.argumentNames);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.item = ListGetAt(loc.argumentNames, loc.i);
+ if (!ListFindNoCase(loc.nonFlashArgumentNames, loc.item))
+ {
+ loc.flashArguments = {};
+ loc.flashArguments[REReplaceNoCase(loc.item, "^flash(.)", "\l\1")] = arguments[loc.item];
+ flashInsert(argumentCollection=loc.flashArguments);
+ }
+ }
+ }
+
+ // set the url that will be used in the cflocation tag
+ if (arguments.back)
+ {
+ if (Len(request.cgi.http_referer) && request.cgi.http_referer Contains request.cgi.server_name)
+ {
+ // referrer exists and points to the same domain so it's ok to redirect to it
+ loc.url = request.cgi.http_referer;
+ if (Len(arguments.params))
+ {
+ // append params to the referrer url
+ loc.params = $constructParams(arguments.params);
+ if (request.cgi.http_referer Contains "?")
+ {
+ loc.params = Replace(loc.params, "?", "&");
+ }
+ else if (left(loc.params, 1) == "&" && !Find(request.cgi.http_referer, "?"))
+ {
+ loc.params = Replace(loc.params, "&", "?", "one");
+ }
+ loc.url = loc.url & loc.params;
+ }
+ }
+ else
+ {
+ // we can't redirect to the referrer so we either use a fallback route/controller/action combo or send to the root of the site
+ if (Len(arguments.route) || Len(arguments.controller) || Len(arguments.action))
+ loc.url = URLFor(argumentCollection=arguments);
+ else
+ loc.url = application.wheels.webPath;
+ }
+ }
+ else
+ {
+ loc.url = URLFor(argumentCollection=arguments);
+ }
+
+ // schedule or perform the redirect right away
+ if (arguments.delay)
+ {
+ if (StructKeyExists(variables.$instance, "redirect"))
+ {
+ // throw an error if the developer has already scheduled a redirect previously in this request
+ $throw(type="Wheels.RedirectToAlreadyCalled", message="`redirectTo()` was already called.");
+ }
+ else
+ {
+ // schedule a redirect that will happen after the action code has been completed
+ variables.$instance.redirect = {url=loc.url, addToken=arguments.addToken, statusCode=arguments.statusCode, $args=arguments};
+ }
+ }
+ else
+ {
+ // do the redirect now using cflocation
+ $location(url=loc.url, addToken=arguments.addToken, statusCode=arguments.statusCode);
+ }
+ </cfscript>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/controller/rendering.cfm b/src/main/webapp/wheels/controller/rendering.cfm new file mode 100755 index 0000000..d3501f0 --- /dev/null +++ b/src/main/webapp/wheels/controller/rendering.cfm @@ -0,0 +1,526 @@ +<!--- PUBLIC CONTROLLER REQUEST FUNCTIONS --->
+
+<cffunction name="renderPage" returntype="any" access="public" output="false" hint="Instructs the controller which view template and layout to render when it's finished processing the action. Note that when passing values for `controller` and/or `action`, this function does not load the actual action but rather just loads the corresponding view template."
+ examples=
+ '
+ <!--- Render a view page for a different action within the same controller --->
+ <cfset renderPage(action="edit")>
+
+ <!--- Render a view page for a different action within a different controller --->
+ <cfset renderPage(controller="blog", action="new")>
+
+ <!--- Another way to render the blog/new template from within a different controller --->
+ <cfset renderPage(template="/blog/new")>
+
+ <!--- Render the view page for the current action but without a layout and cache it for 60 minutes --->
+ <cfset renderPage(layout=false, cache=60)>
+
+ <!--- Load a layout from a different folder within `views` --->
+ <cfset renderPage(layout="/layouts/blog")>
+
+ <!--- Don''t render the view immediately but rather return and store in a variable for further processing --->
+ <cfset myView = renderPage(returnAs="string")>
+ '
+ categories="controller-request,rendering" chapters="rendering-pages" functions="renderNothing,renderText,renderPartial,usesLayout">
+ <cfargument name="controller" type="string" required="false" default="#variables.params.controller#" hint="Controller to include the view page for.">
+ <cfargument name="action" type="string" required="false" default="#variables.params.action#" hint="Action to include the view page for.">
+ <cfargument name="template" type="string" required="false" default="" hint="A specific template to render. Prefix with a leading slash `/` if you need to build a path from the root `views` folder.">
+ <cfargument name="layout" type="any" required="false" hint="The layout to wrap the content in. Prefix with a leading slash `/` if you need to build a path from the root `views` folder. Pass `false` to not load a layout at all.">
+ <cfargument name="cache" type="any" required="false" default="" hint="Number of minutes to cache the content for.">
+ <cfargument name="returnAs" type="string" required="false" default="" hint="Set to `string` to return the result instead of automatically sending it to the client.">
+ <cfargument name="hideDebugInformation" type="boolean" required="false" default="false" hint="Set to `true` to hide the debug information at the end of the output. This is useful when you're testing XML output in an environment where the global setting for `showDebugInformation` is `true`.">
+ <cfscript>
+ var loc = {};
+ $args(name="renderPage", args=arguments);
+ $dollarify(arguments, "controller,action,template,layout,cache,returnAs,hideDebugInformation");
+ if (application.wheels.showDebugInformation)
+ {
+ $debugPoint("view");
+ }
+
+ // if no layout specific arguments were passed in use the this instance's layout
+ if(!Len(arguments.$layout))
+ arguments.$layout = $useLayout(arguments.$action);
+
+ // never show debugging out in ajax requests
+ if (isAjax())
+ arguments.$hideDebugInformation = true;
+
+ // if renderPage was called with a layout set a flag to indicate that it's ok to show debug info at the end of the request
+ if (!arguments.$hideDebugInformation)
+ request.wheels.showDebugInformation = true;
+
+ if (application.wheels.cachePages && (IsNumeric(arguments.$cache) || (IsBoolean(arguments.$cache) && arguments.$cache)))
+ {
+ loc.category = "action";
+ loc.key = $hashedKey(arguments, variables.params);
+ loc.lockName = loc.category & loc.key;
+ loc.conditionArgs = {};
+ loc.conditionArgs.category = loc.category;
+ loc.conditionArgs.key = loc.key;
+ loc.executeArgs = arguments;
+ loc.executeArgs.category = loc.category;
+ loc.executeArgs.key = loc.key;
+ loc.page = $doubleCheckedLock(name=loc.lockName, condition="$getFromCache", execute="$renderPageAndAddToCache", conditionArgs=loc.conditionArgs, executeArgs=loc.executeArgs);
+ }
+ else
+ {
+ loc.page = $renderPage(argumentCollection=arguments);
+ }
+ if (arguments.$returnAs == "string")
+ loc.returnValue = loc.page;
+ else
+ variables.$instance.response = loc.page;
+ if (application.wheels.showDebugInformation)
+ $debugPoint("view");
+ </cfscript>
+ <cfif StructKeyExists(loc, "returnValue")>
+ <cfreturn loc.returnValue>
+ </cfif>
+</cffunction>
+
+<cffunction name="renderNothing" returntype="void" access="public" output="false" hint="Instructs the controller to render an empty string when it's finished processing the action. This is very similar to calling `cfabort` with the advantage that any after filters you have set on the action will still be run."
+ examples=
+ '
+ <!--- Render a blank white page to the client --->
+ <cfset renderNothing()>
+ '
+ categories="controller-request,rendering" chapters="rendering-pages" functions="renderPage,renderText,renderPartial">
+ <cfscript>
+ variables.$instance.response = "";
+ </cfscript>
+</cffunction>
+
+<cffunction name="renderText" returntype="void" access="public" output="false" hint="Instructs the controller to render specified text when it's finished processing the action."
+ examples=
+ '
+ <!--- Render just the text "Done!" to the client --->
+ <cfset renderText("Done!")>
+
+ <!--- Render serialized product data to the client --->
+ <cfset products = model("product").findAll()>
+ <cfset renderText(SerializeJson(products))>
+ '
+ categories="controller-request,rendering" chapters="rendering-pages" functions="renderPage,renderNothing,renderPartial">
+ <cfargument name="text" type="any" required="true" hint="The text to be rendered.">
+ <cfscript>
+ variables.$instance.response = arguments.text;
+ </cfscript>
+</cffunction>
+
+<cffunction name="renderPartial" returntype="any" access="public" output="false" hint="Instructs the controller to render a partial when it's finished processing the action."
+ examples=
+ '
+ <!--- Render the partial `_comment.cfm` located in the current controller''s view folder --->
+ <cfset renderPartial("comment")>
+
+ <!--- Render the partial at `views/shared/_comment.cfm` --->
+ <cfset renderPartial("/shared/comment")>
+ '
+ categories="controller-request,rendering" chapters="rendering-pages" functions="renderPage,renderNothing,renderText">
+ <cfargument name="partial" type="string" required="true" hint="The name of the partial file to be used. Prefix with a leading slash `/` if you need to build a path from the root `views` folder. Do not include the partial filename's underscore and file extension.">
+ <cfargument name="cache" type="any" required="false" default="" hint="See documentation for @renderPage.">
+ <cfargument name="layout" type="string" required="false" hint="See documentation for @renderPage.">
+ <cfargument name="returnAs" type="string" required="false" default="" hint="See documentation for @renderPage.">
+ <cfargument name="dataFunction" type="any" required="false" hint="Name of a controller function to load data from.">
+ <cfscript>
+ var loc = {};
+ $args(name="renderPartial", args=arguments);
+ loc.partial = $includeOrRenderPartial(argumentCollection=$dollarify(arguments, "partial,cache,layout,returnAs,dataFunction"));
+ if (arguments.$returnAs == "string")
+ return loc.partial;
+ else
+ variables.$instance.response = loc.partial;
+ </cfscript>
+</cffunction>
+
+<cffunction name="contentForLayout" returntype="string" access="public" output="false" hint="Includes content for the `body` section, which equates to the output generated by the view template run by the request."
+ examples='
+ <!--- In `views/layout.cfm` --->
+ <html>
+ <head>
+ <title>My Site</title>
+ </head>
+
+ <body>
+ <cfoutput>##contentForLayout()##</cfoutput>
+ </body>
+
+ </html>
+ '
+ categories="controller-request,layout" chapters="using-layouts" functions="">
+ <cfreturn includeContent("body")>
+</cffunction>
+
+<cffunction name="includeContent" returntype="string" access="public" output="false" hint="Used to output the content for a particular section in a layout."
+ examples=
+ '
+ <!--- In your view template, let''s say `views/blog/post.cfm --->
+ <cfset contentFor(head=''<meta name="robots" content="noindex,nofollow" />"'')>
+ <cfset contentFor(head=''<meta name="author" content="wheelsdude@wheelsify.com"'')>
+
+ <!--- In `views/layout.cfm` --->
+ <html>
+ <head>
+ <title>My Site</title>
+ ##includeContent("head")##
+ </head>
+ <body>
+
+ <cfoutput>
+ ##includeContent()##
+ </cfoutput>
+
+ </body>
+ </html>
+ '
+ categories="view-helper,miscellaneous" chapters="using-layouts" functions="">
+ <cfargument name="name" type="string" required="false" default="body" hint="Name of layout section to return content for.">
+ <cfargument name="defaultValue" type="string" required="false" default="" hint="What to display as a default if the section is not defined.">
+ <cfscript>
+ if (StructKeyExists(arguments, "default"))
+ {
+ $deprecated("The `default` argument will be deprecated in a future version of Wheels, please use the `defaultValue` argument instead");
+ arguments.defaultValue = arguments.default;
+ StructDelete(arguments, "default");
+ }
+ if (StructKeyExists(variables.$instance.contentFor, arguments.name))
+ return ArrayToList(variables.$instance.contentFor[arguments.name], Chr(10));
+ else
+ return arguments.defaultValue;
+ </cfscript>
+</cffunction>
+
+<cffunction name="response" returntype="string" access="public" output="false" hint="Returns content that Wheels will send to the client in response to the request."
+ examples='
+ <!--- In a controller --->
+ <cffunction name="init">
+ <cfset filters(type="after", through="translateResponse")>
+ </cffunction>
+
+ <!--- After filter translates response and sets it --->
+ <cffunction name="translateResponse">
+ <cfset var wheelsResponse = response()>
+ <cfset var translatedResponse = someTranslationMethod(wheelsResponse)>
+ <cfset setResponse(translatedResponse)>
+ </cffunction>
+ '
+ categories="controller-request,rendering" chapters="" functions="setResponse">
+ <cfscript>
+ if ($performedRender())
+ return Trim(variables.$instance.response);
+ else
+ return "";
+ </cfscript>
+</cffunction>
+
+<cffunction name="setResponse" returntype="void" access="public" output="false" hint="Sets content that Wheels will send to the client in response to the request."
+ examples='
+ <!--- In a controller --->
+ <cffunction name="init">
+ <cfset filters(type="after", through="translateResponse")>
+ </cffunction>
+
+ <!--- After filter translates response and sets it --->
+ <cffunction name="translateResponse">
+ <cfset var wheelsResponse = response()>
+ <cfset var translatedResponse = someTranslationFunction(wheelsResponse)>
+ <cfset setResponse(translatedResponse)>
+ </cffunction>
+ '
+ categories="controller-request,rendering" chapters="" functions="response">
+ <cfargument name="content" type="string" required="true" hint="The content to set as the response.">
+ <cfset variables.$instance.response = arguments.content>
+</cffunction>
+
+<!--- PRIVATE FUNCTIONS --->
+
+<cffunction name="$renderPageAndAddToCache" returntype="string" access="public" output="false">
+ <cfscript>
+ var returnValue = "";
+ returnValue = $renderPage(argumentCollection=arguments);
+ if (!IsNumeric(arguments.$cache))
+ arguments.$cache = application.wheels.defaultCacheTime;
+ $addToCache(key=arguments.key, value=returnValue, time=arguments.$cache, category=arguments.category);
+ </cfscript>
+ <cfreturn returnValue>
+</cffunction>
+
+<cffunction name="$renderPage" returntype="string" access="public" output="false">
+ <cfscript>
+ var loc = {};
+ if (!Len(arguments.$template))
+ arguments.$template = "/" & arguments.$controller & "/" & arguments.$action;
+ arguments.$type = "page";
+ arguments.$name = arguments.$template;
+ arguments.$template = $generateIncludeTemplatePath(argumentCollection=arguments);
+ loc.content = $includeFile(argumentCollection=arguments);
+ loc.returnValue = $renderLayout($content=loc.content, $layout=arguments.$layout, $type=arguments.$type);
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$renderPartialAndAddToCache" returntype="string" access="public" output="false">
+ <cfscript>
+ var returnValue = "";
+ returnValue = $renderPartial(argumentCollection=arguments);
+ if (!IsNumeric(arguments.$cache))
+ arguments.$cache = application.wheels.defaultCacheTime;
+ $addToCache(key=arguments.key, value=returnValue, time=arguments.$cache, category=arguments.category);
+ </cfscript>
+ <cfreturn returnValue>
+</cffunction>
+
+<cffunction name="$argumentsForPartial" returntype="struct" access="public" output="false">
+ <cfscript>
+ var loc = {};
+ if (StructKeyExists(arguments, "$dataFunction") && arguments.$dataFunction != "false")
+ {
+ if (IsBoolean(arguments.$dataFunction))
+ {
+ loc.dataFunction = SpanExcluding(ListLast(arguments.$name, "/"), ".");
+ if (StructKeyExists(variables, loc.dataFunction))
+ {
+ loc.metaData = GetMetaData(variables[loc.dataFunction]);
+ if (IsStruct(loc.metaData) && StructKeyExists(loc.metaData, "returnType") && loc.metaData.returnType == "struct" && StructKeyExists(loc.metaData, "access") && loc.metaData.access == "private")
+ return $invoke(method=loc.dataFunction);
+ }
+ }
+ else
+ {
+ return $invoke(method=arguments.$dataFunction);
+ }
+ }
+ return StructNew();
+ </cfscript>
+</cffunction>
+
+<cffunction name="$renderPartial" returntype="string" access="public" output="false">
+ <cfscript>
+ var loc = {};
+ if (IsQuery(arguments.$partial) && arguments.$partial.recordCount)
+ {
+ arguments.$name = request.wheels[$hashedKey(arguments.$partial)];
+ arguments.query = arguments.$partial;
+ }
+ else if (IsObject(arguments.$partial))
+ {
+ arguments.$name = arguments.$partial.$classData().modelName;
+ arguments.object = arguments.$partial;
+ }
+ else if (IsArray(arguments.$partial) && ArrayLen(arguments.$partial))
+ {
+ arguments.$name = arguments.$partial[1].$classData().modelName;
+ arguments.objects = arguments.$partial;
+ }
+ else if (IsSimpleValue(arguments.$partial))
+ {
+ arguments.$name = arguments.$partial;
+ }
+ if (StructKeyExists(arguments, "$name"))
+ {
+ arguments.$type = "partial";
+ arguments.$template = $generateIncludeTemplatePath(argumentCollection=arguments);
+ StructAppend(arguments, $argumentsForPartial(argumentCollection=arguments), false);
+ loc.content = $includeFile(argumentCollection=arguments);
+ return $renderLayout($content=loc.content, $layout=arguments.$layout, $type=arguments.$type);
+ }
+ // when $name has not been set (which means that it's either an empty array or query) we just return an empty string
+ return "";
+ </cfscript>
+</cffunction>
+
+<cffunction name="$includeOrRenderPartial" returntype="string" access="public" output="false">
+ <cfscript>
+ var loc = {};
+ if (application.wheels.cachePartials && (isNumeric(arguments.$cache) || (IsBoolean(arguments.$cache) && arguments.$cache)))
+ {
+ loc.category = "partial";
+ loc.key = $hashedKey(arguments);
+ loc.lockName = loc.category & loc.key;
+ loc.conditionArgs = {};
+ loc.conditionArgs.category = loc.category;
+ loc.conditionArgs.key = loc.key;
+ loc.executeArgs = arguments;
+ loc.executeArgs.category = loc.category;
+ loc.executeArgs.key = loc.key;
+ loc.returnValue = $doubleCheckedLock(name=loc.lockName, condition="$getFromCache", execute="$renderPartialAndAddToCache", conditionArgs=loc.conditionArgs, executeArgs=loc.executeArgs);
+ }
+ else
+ {
+ loc.returnValue = $renderPartial(argumentCollection=arguments);
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$generateIncludeTemplatePath" returntype="string" access="public" output="false">
+ <cfargument name="$name" type="any" required="true">
+ <cfargument name="$type" type="any" required="true">
+ <cfargument name="$controllerName" type="string" required="false" default="#variables.params.controller#" />
+ <cfargument name="$baseTemplatePath" type="string" required="false" default="#application.wheels.viewPath#" />
+ <cfargument name="$prependWithUnderscore" type="boolean" required="false" default="true">
+ <cfscript>
+ var loc = {};
+ loc.include = arguments.$baseTemplatePath;
+ loc.fileName = ReplaceNoCase(Reverse(ListFirst(Reverse(arguments.$name), "/")), ".cfm", "", "all") & ".cfm"; // extracts the file part of the path and replace ending ".cfm"
+ if (arguments.$type == "partial" && arguments.$prependWithUnderscore)
+ loc.fileName = Replace("_" & loc.fileName, "__", "_", "one"); // replaces leading "_" when the file is a partial
+ loc.folderName = Reverse(ListRest(Reverse(arguments.$name), "/"));
+ if (Left(arguments.$name, 1) == "/")
+ loc.include = loc.include & loc.folderName & "/" & loc.fileName; // Include a file in a sub folder to views
+ else if (arguments.$name Contains "/")
+ loc.include = loc.include & "/" & arguments.$controllerName & "/" & loc.folderName & "/" & loc.fileName; // Include a file in a sub folder of the current controller
+ else
+ loc.include = loc.include & "/" & arguments.$controllerName & "/" & loc.fileName; // Include a file in the current controller's view folder
+ </cfscript>
+ <cfreturn LCase(loc.include) />
+</cffunction>
+
+<cffunction name="$includeFile" returntype="string" access="public" output="false">
+ <cfargument name="$name" type="any" required="true">
+ <cfargument name="$template" type="any" required="true">
+ <cfargument name="$type" type="string" required="true">
+ <cfscript>
+ var loc = {};
+ if (arguments.$type == "partial")
+ {
+ if (StructKeyExists(arguments, "query") && IsQuery(arguments.query))
+ {
+ loc.query = arguments.query;
+ StructDelete(arguments, "query");
+ loc.returnValue = "";
+ loc.iEnd = loc.query.recordCount;
+ if (Len(arguments.$group))
+ {
+ // we want to group based on a column so loop through the rows until we find, this will break if the query is not ordered by the grouped column
+ loc.tempSpacer = "}|{";
+ loc.groupValue = "";
+ loc.groupQueryCount = 1;
+ arguments.group = QueryNew(loc.query.columnList);
+ if (application.wheels.showErrorInformation && !ListFindNoCase(loc.query.columnList, arguments.$group))
+ $throw(type="Wheels.GroupColumnNotFound", message="Wheels couldn't find a query column with the name of `#arguments.$group#`.", extendedInfo="Make sure your finder method has the column `#arguments.$group#` specified in the `select` argument. If the column does not exist, create it.");
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ if (loc.i == 1)
+ {
+ loc.groupValue = loc.query[arguments.$group][loc.i];
+ }
+ else if (loc.groupValue != loc.query[arguments.$group][loc.i])
+ {
+ // we have a different group for this row so output what we have
+ loc.returnValue = loc.returnValue & $includeAndReturnOutput(argumentCollection=arguments);
+ if (StructKeyExists(arguments, "$spacer"))
+ loc.returnValue = loc.returnValue & loc.tempSpacer;
+ loc.groupValue = loc.query[arguments.$group][loc.i];
+ arguments.group = QueryNew(loc.query.columnList);
+ loc.groupQueryCount = 1;
+ }
+ loc.dump = QueryAddRow(arguments.group);
+ loc.jEnd = ListLen(loc.query.columnList);
+ for (loc.j=1; loc.j <= loc.jEnd; loc.j++)
+ {
+ loc.property = ListGetAt(loc.query.columnList, loc.j);
+ arguments[loc.property] = loc.query[loc.property][loc.i];
+ loc.dump = QuerySetCell(arguments.group, loc.property, loc.query[loc.property][loc.i], loc.groupQueryCount);
+ }
+ arguments.current = (loc.i+1) - arguments.group.recordCount;
+ loc.groupQueryCount++;
+ }
+ // if we have anything left at the end we need to render it too
+ if (arguments.group.RecordCount > 0)
+ {
+ loc.returnValue = loc.returnValue & $includeAndReturnOutput(argumentCollection=arguments);
+ if (StructKeyExists(arguments, "$spacer") && loc.i < loc.iEnd)
+ loc.returnValue = loc.returnValue & loc.tempSpacer;
+ }
+ // now remove the last temp spacer and replace the tempSpacer with $spacer
+ if (Right(loc.returnValue, 3) == loc.tempSpacer)
+ loc.returnValue = Left(loc.returnValue, Len(loc.returnValue) - 3);
+ loc.returnValue = Replace(loc.returnValue, loc.tempSpacer, arguments.$spacer, "all");
+ }
+ else
+ {
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ arguments.current = loc.i;
+ arguments.totalCount = loc.iEnd;
+ loc.jEnd = ListLen(loc.query.columnList);
+ for (loc.j=1; loc.j <= loc.jEnd; loc.j++)
+ {
+ loc.property = ListGetAt(loc.query.columnList, loc.j);
+ try
+ {
+ arguments[loc.property] = loc.query[loc.property][loc.i];
+ }
+ catch (Any e)
+ {
+ arguments[loc.property] = "";
+ }
+ }
+ loc.returnValue = loc.returnValue & $includeAndReturnOutput(argumentCollection=arguments);
+ if (StructKeyExists(arguments, "$spacer") && loc.i < loc.iEnd)
+ loc.returnValue = loc.returnValue & arguments.$spacer;
+ }
+ }
+ }
+ else if (StructKeyExists(arguments, "object") && IsObject(arguments.object))
+ {
+ loc.modelName = arguments.object.$classData().modelName;
+ arguments[loc.modelName] = arguments.object;
+ StructDelete(arguments, "object");
+ StructAppend(arguments, arguments[loc.modelName].properties(), false);
+ }
+ else if (StructKeyExists(arguments, "objects") && IsArray(arguments.objects))
+ {
+ loc.array = arguments.objects;
+ StructDelete(arguments, "objects");
+ loc.originalArguments = Duplicate(arguments);
+ loc.modelName = loc.array[1].$classData().modelName;
+ loc.returnValue = "";
+ loc.iEnd = ArrayLen(loc.array);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ StructClear(arguments);
+ StructAppend(arguments, loc.originalArguments);
+ arguments.current = loc.i;
+ arguments.totalCount = loc.iEnd;
+ arguments[loc.modelName] = loc.array[loc.i];
+ loc.properties = loc.array[loc.i].properties();
+ StructAppend(arguments, loc.properties, true);
+ loc.returnValue = loc.returnValue & $includeAndReturnOutput(argumentCollection=arguments);
+ if (StructKeyExists(arguments, "$spacer") && loc.i < loc.iEnd)
+ loc.returnValue = loc.returnValue & arguments.$spacer;
+ }
+ }
+ }
+ if (!StructKeyExists(loc, "returnValue"))
+ loc.returnValue = $includeAndReturnOutput(argumentCollection=arguments);
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$performedRenderOrRedirect" returntype="boolean" access="public" output="false">
+ <cfreturn ($performedRender() || $performedRedirect())>
+</cffunction>
+
+<cffunction name="$performedRender" returntype="boolean" access="public" output="false">
+ <cfreturn StructKeyExists(variables.$instance, "response")>
+</cffunction>
+
+<cffunction name="$performedRedirect" returntype="boolean" access="public" output="false">
+ <cfreturn StructKeyExists(variables.$instance, "redirect")>
+</cffunction>
+
+<cffunction name="$abortIssued" returntype="boolean" access="public" output="false">
+ <cfreturn StructKeyExists(variables.$instance, "abort")>
+</cffunction>
+
+<cffunction name="$getRedirect" returntype="struct" access="public" output="false">
+ <cfscript>
+ if ($performedRedirect())
+ return variables.$instance.redirect;
+ else
+ return StructNew();
+ </cfscript>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/controller/request.cfm b/src/main/webapp/wheels/controller/request.cfm new file mode 100755 index 0000000..12004bb --- /dev/null +++ b/src/main/webapp/wheels/controller/request.cfm @@ -0,0 +1,57 @@ +<cffunction name="isSecure" returntype="boolean" access="public" output="false" hint="Returns whether Wheels is communicating over a secure port."
+ examples=
+ '
+ <!--- Redirect non-secure connections to the secure version --->
+ <cfif not isSecure()>
+ <cfset redirectTo(protocol="https")>
+ </cfif>
+ '
+ categories="controller-request,miscellaneous" chapters="" functions="isGet,isPost,isAjax">
+ <cfreturn (request.cgi.server_port_secure eq true)>
+</cffunction>
+
+<cffunction name="isAjax" returntype="boolean" access="public" output="false" hint="Returns whether the page was called from JavaScript or not."
+ examples=
+ '
+ <cfset requestIsAjax = isAjax()>
+ '
+ categories="controller-request,miscellaneous" chapters="" functions="isGet,isPost,isSecure">
+ <cfreturn (request.cgi.http_x_requested_with is "XMLHTTPRequest")>
+</cffunction>
+
+<cffunction name="isGet" returntype="boolean" access="public" output="false" hint="Returns whether the request was a normal `GET` request or not."
+ examples=
+ '
+ <cfset requestIsGet = isGet()>
+ '
+ categories="controller-request,miscellaneous" chapters="" functions="isAjax,isPost,isSecure">
+ <cfreturn (request.cgi.request_method is "get")>
+</cffunction>
+
+<cffunction name="isPost" returntype="boolean" access="public" output="false" hint="Returns whether the request came from a form `POST` submission or not."
+ examples=
+ '
+ <cfset requestIsPost = isPost()>
+ '
+ categories="controller-request,miscellaneous" chapters="" functions="isAjax,isGet,isSecure">
+ <cfreturn (request.cgi.request_method is "post")>
+</cffunction>
+
+<cffunction name="pagination" returntype="struct" access="public" output="false" hint="Returns a struct with information about the specificed paginated query. The keys that will be included in the struct are `currentPage`, `totalPages` and `totalRecords`."
+ examples=
+ '
+ <cfparam name="params.page" default="1">
+ <cfset allAuthors = model("author").findAll(page=params.page, perPage=25, order="lastName", handle="authorsData")>
+ <cfset paginationData = pagination("authorsData")>
+ '
+ categories="controller-request,miscellaneous" chapters="getting-paginated-data,displaying-links-for-pagination" functions="paginationLinks,findAll">
+ <cfargument name="handle" type="string" required="false" default="query" hint="The handle given to the query to return pagination information for.">
+ <cfscript>
+ if (application.wheels.showErrorInformation)
+ {
+ if (!StructKeyExists(request.wheels, arguments.handle))
+ $throw(type="Wheels.QueryHandleNotFound", message="Wheels couldn't find a query with the handle of `#arguments.handle#`.", extendedInfo="Make sure your `findAll` call has the `page` argument specified and matching `handle` argument if specified.");
+ }
+ return request.wheels[arguments.handle];
+ </cfscript>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/controller/verifies.cfm b/src/main/webapp/wheels/controller/verifies.cfm new file mode 100755 index 0000000..43a10b6 --- /dev/null +++ b/src/main/webapp/wheels/controller/verifies.cfm @@ -0,0 +1,172 @@ +<cffunction name="verifies" returntype="void" access="public" output="false" hint="Instructs Wheels to verify that some specific criterias are met before running an action. NOTE: All undeclared arguments will be passed to `redirectTo()` call if a handler is not specified."
+ examples=
+ '
+ <!--- Tell Wheels to verify that the `handleForm` action is always a `POST` request when executed --->
+ <cfset verifies(only="handleForm", post=true)>
+
+ <!--- Make sure that the edit action is a `GET` request, that `userId` exists in the `params` struct, and that it''s an integer --->
+ <cfset verifies(only="edit", get=true, params="userId", paramsTypes="integer")>
+
+ <!--- Just like above, only this time we want to invoke a custom method in our controller to handle the request when it is invalid --->
+ <cfset verifies(only="edit", get=true, params="userId", paramsTypes="integer", handler="myCustomMethod")>
+
+ <!--- Just like above, only this time instead of specifying a handler, we want to `redirect` the visitor to the index action of the controller and show an error in The Flash when the request is invalid --->
+ <cfset verifies(only="edit", get=true, params="userId", paramsTypes="integer", action="index", error="Invalid userId")>
+ '
+ categories="controller-initialization,verification" chapters="filters-and-verification" functions="verificationChain,setVerificationChain">
+ <cfargument name="only" type="string" required="false" default="" hint="List of action names to limit this verification to.">
+ <cfargument name="except" type="string" required="false" default="" hint="List of action names to exclude this verification from.">
+ <cfargument name="post" type="any" required="false" default="" hint="Set to `true` to verify that this is a `POST` request.">
+ <cfargument name="get" type="any" required="false" default="" hint="Set to `true` to verify that this is a `GET` request.">
+ <cfargument name="ajax" type="any" required="false" default="" hint="Set to `true` to verify that this is an AJAX request.">
+ <cfargument name="cookie" type="string" required="false" default="" hint="Verify that the passed in variable name exists in the `cookie` scope.">
+ <cfargument name="session" type="string" required="false" default="" hint="Verify that the passed in variable name exists in the `session` scope.">
+ <cfargument name="params" type="string" required="false" default="" hint="Verify that the passed in variable name exists in the `params` struct.">
+ <cfargument name="handler" type="string" required="false" hint="Pass in the name of a function that should handle failed verifications. The default is to just abort the request when a verification fails.">
+ <cfargument name="cookieTypes" type="string" required="false" default="" hint="List of types to check each listed `cookie` value against (will be passed through to your CFML engine's `IsValid` function).">
+ <cfargument name="sessionTypes" type="string" required="false" default="" hint="List of types to check each list `session` value against (will be passed through to your CFML engine's `IsValid` function).">
+ <cfargument name="paramsTypes" type="string" required="false" default="" hint="List of types to check each `params` value against (will be passed through to your CFML engine's `IsValid` function).">
+ <cfscript>
+ $args(name="verifies", args=arguments);
+ ArrayAppend(variables.$class.verifications, Duplicate(arguments));
+ </cfscript>
+</cffunction>
+
+<cffunction name="verificationChain" returntype="array" access="public" output="false" hint="Returns an array of all the verifications set on this controller in the order in which they will be executed."
+ examples='
+ <!--- Get verification chain, remove the first item, and set it back --->
+ <cfset myVerificationChain = verificationChain()>
+ <cfset ArrayDeleteAt(myVerificationChain, 1)>
+ <cfset setVerificationChain(myVerificationChain)>
+ '
+ categories="controller-initialization,verification" chapters="filters-and-verification" functions="verifies,setVerificationChain">
+ <cfreturn variables.$class.verifications>
+</cffunction>
+
+<cffunction name="setVerificationChain" returntype="void" access="public" output="false" hint="Use this function if you need a more low level way of setting the entire verification chain for a controller."
+ examples='
+ <!--- Set verification chain directly in an array --->
+ <cfset setVerificationChain([
+ {only="handleForm", post=true},
+ {only="edit", get=true, params="userId", paramsTypes="integer"},
+ {only="edit", get=true, params="userId", paramsTypes="integer", handler="index", error="Invalid userId"}
+ ])>
+ '
+ categories="controller-initialization,verification" chapters="filters-and-verification" functions="verifies,verificationChain">
+ <cfargument name="chain" type="array" required="true" hint="An array of structs, each of which represent an `argumentCollection` that get passed to the `verifies` function. This should represent the entire verification chain that you want to use for this controller.">
+ <cfscript>
+ var loc = {};
+
+ // Clear current verification chain
+ variables.$class.verifications = [];
+ // Loop through chain passed in arguments and add each item to verification chain
+ for(loc.i = 1; loc.i <= ArrayLen(arguments.chain); loc.i++) {
+ verifies(argumentCollection=arguments.chain[loc.i]);
+ }
+ </cfscript>
+</cffunction>
+
+<cffunction name="$runVerifications" returntype="void" access="public" output="false">
+ <cfargument name="action" type="string" required="true">
+ <cfargument name="params" type="struct" required="true">
+ <cfargument name="cgiScope" type="struct" required="false" default="#request.cgi#">
+ <cfargument name="sessionScope" type="struct" required="false" default="#StructNew()#">
+ <cfargument name="cookieScope" type="struct" required="false" default="#cookie#">
+ <cfscript>
+ var loc = {};
+
+ // only access the session scope when session management is enabled in the app
+ if (StructIsEmpty(arguments.sessionScope) && application.wheels.sessionManagement)
+ arguments.sessionScope = session;
+
+ loc.verifications = verificationChain();
+ loc.$args = "only,except,post,get,ajax,cookie,session,params,cookieTypes,sessionTypes,paramsTypes,handler";
+ loc.abort = false;
+ loc.iEnd = ArrayLen(loc.verifications);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.verification = loc.verifications[loc.i];
+ if ((!Len(loc.verification.only) && !Len(loc.verification.except)) || (Len(loc.verification.only) && ListFindNoCase(loc.verification.only, arguments.action)) || (Len(loc.verification.except) && !ListFindNoCase(loc.verification.except, arguments.action)))
+ {
+ if (IsBoolean(loc.verification.post) && ((loc.verification.post && !isPost()) || (!loc.verification.post && isPost())))
+ loc.abort = true;
+ if (IsBoolean(loc.verification.get) && ((loc.verification.get && !isGet()) || (!loc.verification.get && isGet())))
+ loc.abort = true;
+ if (IsBoolean(loc.verification.ajax) && ((loc.verification.ajax && !isAjax()) || (!loc.verification.ajax && isAjax())))
+ loc.abort = true;
+ if(!$checkVerificationsVars(arguments.params, loc.verification.params, loc.verification.paramsTypes))
+ loc.abort = true;
+ if(!$checkVerificationsVars(arguments.sessionScope, loc.verification.session, loc.verification.sessionTypes))
+ loc.abort = true;
+ if(!$checkVerificationsVars(arguments.cookieScope, loc.verification.cookie, loc.verification.cookieTypes))
+ loc.abort = true;
+ }
+ if (loc.abort)
+ {
+ if (Len(loc.verification.handler))
+ {
+ $invoke(method=loc.verification.handler);
+ redirectTo(back="true");
+ }
+ else
+ {
+ // check to see if we should perform a redirect or abort completly
+ loc.redirectArgs = {};
+ for(loc.key in loc.verification)
+ {
+ if (!ListFindNoCase(loc.$args, loc.key) && StructKeyExists(loc.verification, loc.key))
+ loc.redirectArgs[loc.key] = loc.verification[loc.key];
+ }
+ if (!StructIsEmpty(loc.redirectArgs))
+ {
+ redirectTo(argumentCollection=loc.redirectArgs);
+ }
+ else
+ {
+ variables.$instance.abort = true;
+ }
+ }
+ // an abort was issued, no need to process further in the chain
+ break;
+ }
+ }
+ </cfscript>
+</cffunction>
+
+<cffunction name="$checkVerificationsVars" returntype="boolean" access="public" output="false">
+ <cfargument name="scope" type="struct" required="true">
+ <cfargument name="vars" type="string" required="true">
+ <cfargument name="types" type="string" required="true">
+ <cfscript>
+ var loc = {};
+ loc.iEnd = ListLen(arguments.vars);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.varCheck = ListGetAt(arguments.vars, loc.i);
+ if (!StructKeyExists(arguments.scope, loc.varCheck))
+ {
+ return false;
+ }
+
+ if (Len(arguments.types))
+ {
+ loc.value = arguments.scope[loc.varCheck];
+ loc.typeCheck = ListGetAt(arguments.types, loc.i);
+
+ // by default string aren't allowed to be blank
+ loc.typeAllowedBlank = false;
+ if (loc.typeCheck == "blank")
+ {
+ loc.typeAllowedBlank = true;
+ loc.typeCheck = "string";
+ }
+
+ if(!IsValid(loc.typeCheck, loc.value) || (loc.typeCheck == "string" && !loc.typeAllowedBlank && !Len(trim(loc.value))))
+ {
+ return false;
+ }
+ }
+ }
+ </cfscript>
+ <cfreturn true>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/dispatch/functions.cfm b/src/main/webapp/wheels/dispatch/functions.cfm new file mode 100755 index 0000000..d2f390c --- /dev/null +++ b/src/main/webapp/wheels/dispatch/functions.cfm @@ -0,0 +1 @@ +<cfinclude template="request.cfm">
diff --git a/src/main/webapp/wheels/dispatch/request.cfm b/src/main/webapp/wheels/dispatch/request.cfm new file mode 100755 index 0000000..98eb69b --- /dev/null +++ b/src/main/webapp/wheels/dispatch/request.cfm @@ -0,0 +1,419 @@ +<cffunction name="$init" returntype="any" access="public" output="false">
+ <cfreturn this>
+</cffunction>
+
+<cffunction name="$createParams" returntype="struct" access="public" output="false">
+ <cfargument name="path" type="string" required="true">
+ <cfargument name="route" type="struct" required="true">
+ <cfargument name="formScope" type="struct" required="true">
+ <cfargument name="urlScope" type="struct" required="true">
+ <cfscript>
+ var loc = {};
+
+ loc.params = {};
+ loc.params = $mergeURLAndFormScopes(loc.params, arguments.urlScope, arguments.formScope);
+ loc.params = $mergeRoutePattern(loc.params, arguments.route, arguments.path);
+ loc.params = $decryptParams(loc.params);
+ loc.params = $translateBlankCheckBoxSubmissions(loc.params);
+ loc.params = $translateDatePartSubmissions(loc.params);
+ loc.params = $createNestedParamStruct(loc.params);
+ /***********************************************
+ * We now do the routing and controller
+ * params after we have built all other params
+ * so that we don't have more logic around
+ * params in arrays
+ ***********************************************/
+ loc.params = $ensureControllerAndAction(loc.params, arguments.route);
+ loc.params = $addRouteFormat(loc.params, arguments.route);
+ loc.params = $addRouteName(loc.params, arguments.route);
+ </cfscript>
+ <cfreturn loc.params>
+</cffunction>
+
+<cffunction name="$createNestedParamStruct" returntype="struct" access="public" output="false">
+ <cfargument name="params" type="struct" required="true" />
+ <cfscript>
+ var loc = {};
+ for (loc.key in arguments.params)
+ {
+ if (Find("[", loc.key) && Right(loc.key, 1) == "]")
+ {
+ // object form field
+ loc.name = SpanExcluding(loc.key, "[");
+
+ // we split the key into an array so the developer can have unlimited levels of params passed in
+ loc.nested = ListToArray(ReplaceList(loc.key, loc.name & "[,]", ""), "[", true);
+ if (!StructKeyExists(arguments.params, loc.name))
+ arguments.params[loc.name] = {};
+
+ loc.struct = arguments.params[loc.name]; // we need a reference to the struct so we can nest other structs if needed
+ loc.iEnd = ArrayLen(loc.nested);
+ for (loc.i = 1; loc.i lte loc.iEnd; loc.i++) // looping over the array allows for infinite nesting
+ {
+ loc.item = loc.nested[loc.i];
+ if (!StructKeyExists(loc.struct, loc.item))
+ loc.struct[loc.item] = {};
+ if (loc.i != loc.iEnd)
+ loc.struct = loc.struct[loc.item]; // pass the new reference (structs pass a reference instead of a copy) to the next iteration
+ else
+ loc.struct[loc.item] = arguments.params[loc.key];
+ }
+ // delete the original key so it doesn't show up in the params
+ StructDelete(arguments.params, loc.key, false);
+ }
+ }
+ </cfscript>
+ <cfreturn arguments.params />
+</cffunction>
+
+<cffunction name="$findMatchingRoute" returntype="struct" access="public" output="false">
+ <cfargument name="path" type="string" required="true">
+ <cfscript>
+ var loc = {};
+
+ loc.iEnd = ArrayLen(application.wheels.routes);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.format = "";
+ loc.route = application.wheels.routes[loc.i];
+ if (StructKeyExists(loc.route, "format"))
+ loc.format = loc.route.format;
+
+ loc.currentRoute = loc.route.pattern;
+ if (loc.currentRoute == "*") {
+ loc.returnValue = loc.route;
+ break;
+ }
+ else if (arguments.path == "" && loc.currentRoute == "")
+ {
+ loc.returnValue = loc.route;
+ break;
+ }
+ else if (ListLen(arguments.path, "/") gte ListLen(loc.currentRoute, "/") && loc.currentRoute != "")
+ {
+ loc.match = true;
+ loc.jEnd = ListLen(loc.currentRoute, "/");
+ for (loc.j=1; loc.j <= loc.jEnd; loc.j++)
+ {
+ loc.item = ListGetAt(loc.currentRoute, loc.j, "/");
+ loc.thisRoute = ReplaceList(loc.item, "[,]", "");
+ loc.thisURL = ListFirst(ListGetAt(arguments.path, loc.j, "/"), '.');
+ if (Left(loc.item, 1) != "[" && loc.thisRoute != loc.thisURL)
+ loc.match = false;
+ }
+ if (loc.match)
+ {
+ loc.returnValue = loc.route;
+ if (len(loc.format))
+ {
+ loc.returnValue[ReplaceList(loc.format, "[,]", "")] = $getFormatFromRequest(pathInfo=arguments.path);
+ }
+ break;
+ }
+ }
+ }
+ if (!StructKeyExists(loc, "returnValue"))
+ $throw(type="Wheels.RouteNotFound", message="Wheels couldn't find a route that matched this request.", extendedInfo="Make sure there is a route setup in your `config/routes.cfm` file that matches the `#arguments.path#` request.");
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$getPathFromRequest" returntype="string" access="public" output="false">
+ <cfargument name="pathInfo" type="string" required="true">
+ <cfargument name="scriptName" type="string" required="true">
+ <cfscript>
+ var returnValue = "";
+ // we want the path without the leading "/" so this is why we do some checking here
+ if (arguments.pathInfo == arguments.scriptName || arguments.pathInfo == "/" || arguments.pathInfo == "")
+ returnValue = "";
+ else
+ returnValue = Right(arguments.pathInfo, Len(arguments.pathInfo)-1);
+ </cfscript>
+ <cfreturn returnValue>
+</cffunction>
+
+<cffunction name="$getFormatFromRequest" returntype="string" access="public" output="false">
+ <cfargument name="pathInfo" type="string" required="true">
+ <cfscript>
+ var returnValue = "";
+ if (Find(".", arguments.pathInfo))
+ returnValue = ListLast(arguments.pathInfo, ".");
+ </cfscript>
+ <cfreturn returnValue>
+</cffunction>
+
+<cffunction name="$request" returntype="string" access="public" output="false">
+ <cfargument name="pathInfo" type="string" required="false" default="#request.cgi.path_info#">
+ <cfargument name="scriptName" type="string" required="false" default="#request.cgi.script_name#">
+ <cfargument name="formScope" type="struct" required="false" default="#form#">
+ <cfargument name="urlScope" type="struct" required="false" default="#url#">
+ <cfscript>
+ var loc = {};
+ if (application.wheels.showDebugInformation)
+ $debugPoint("setup");
+
+ loc.params = $paramParser(argumentCollection=arguments);
+
+ // set params in the request scope as well so we can display it in the debug info outside of the dispatch / controller context
+ request.wheels.params = loc.params;
+
+ if (application.wheels.showDebugInformation)
+ $debugPoint("setup");
+
+ // create the requested controller
+ loc.controller = controller(name=loc.params.controller, params=loc.params);
+
+ // if the controller fails to process, instantiate a new controller and try again
+ if (!loc.controller.$processAction())
+ {
+ loc.controller = controller(name=loc.params.controller, params=loc.params);
+ loc.controller.$processAction();
+ }
+
+ // if there is a delayed redirect pending we execute it here thus halting the rest of the request
+ if (loc.controller.$performedRedirect())
+ $location(argumentCollection=loc.controller.$getRedirect());
+
+ // clear out the flash (note that this is not done for redirects since the processing does not get here)
+ loc.controller.$flashClear();
+ </cfscript>
+ <cfreturn loc.controller.response()>
+</cffunction>
+
+<cffunction name="$paramParser" returntype="struct" access="public" output="false">
+ <cfargument name="pathInfo" type="string" required="false" default="#request.cgi.path_info#">
+ <cfargument name="scriptName" type="string" required="false" default="#request.cgi.script_name#">
+ <cfargument name="formScope" type="struct" required="false" default="#form#">
+ <cfargument name="urlScope" type="struct" required="false" default="#url#">
+ <cfscript>
+ var loc = {};
+ loc.path = $getPathFromRequest(pathInfo=arguments.pathInfo, scriptName=arguments.scriptName);
+ loc.route = $findMatchingRoute(path=loc.path);
+ return $createParams(path=loc.path, route=loc.route, formScope=arguments.formScope, urlScope=arguments.urlScope);
+ </cfscript>
+</cffunction>
+
+<cffunction name="$mergeURLAndFormScopes" returntype="struct" access="public" output="false"
+ hint="merges the url and form scope into a single structure. url scope has presidence">
+ <cfargument name="params" type="struct" required="true">
+ <cfargument name="urlScope" type="struct" required="true">
+ <cfargument name="formScope" type="struct" required="true">
+ <cfscript>
+ structAppend(arguments.params, arguments.formScope, true);
+ structAppend(arguments.params, arguments.urlScope, true);
+
+ // get rid of the fieldnames
+ StructDelete(arguments.params, "fieldnames", false);
+ </cfscript>
+ <cfreturn arguments.params>
+</cffunction>
+
+<cffunction name="$mergeRoutePattern" returntype="struct" access="public" output="false"
+ hint="parses the route pattern. identifies the variable markers within the pattern and assigns the value from the url variables with the path">
+ <cfargument name="params" type="struct" required="true">
+ <cfargument name="route" type="struct" required="true">
+ <cfargument name="path" type="string" required="true">
+ <cfscript>
+ var loc = {};
+ loc.iEnd = ListLen(arguments.route.pattern, "/");
+ if (StructKeyExists(arguments.route, "format") AND len(arguments.route.format))
+ {
+ arguments.path = Reverse(ListRest(Reverse(arguments.path), "."));
+ }
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.item = ListGetAt(arguments.route.pattern, loc.i, "/");
+ if (Left(loc.item, 1) == "[")
+ {
+ arguments.params[ReplaceList(loc.item, "[,]", "")] = ListGetAt(arguments.path, loc.i, "/");
+ }
+ }
+ </cfscript>
+ <cfreturn arguments.params>
+</cffunction>
+
+<cffunction name="$decryptParams" returntype="struct" access="public" output="false"
+ hint="loops through the params struct passed in and attempts to deobfuscate them. ignores the controller and action params values.">
+ <cfargument name="params" type="struct" required="true">
+ <cfscript>
+ var loc = {};
+ if (application.wheels.obfuscateUrls)
+ {
+ for (loc.key in arguments.params)
+ {
+ if (loc.key != "controller" && loc.key != "action")
+ {
+ try
+ {
+ arguments.params[loc.key] = deobfuscateParam(arguments.params[loc.key]);
+ }
+ catch(Any e)
+ {}
+ }
+ }
+ }
+ </cfscript>
+ <cfreturn arguments.params>
+</cffunction>
+
+<cffunction name="$translateBlankCheckBoxSubmissions" returntype="struct" access="public" output="false"
+ hint="loops through the params struct and handle the cases where checkboxes are unchecked">
+ <cfargument name="params" type="struct" required="true">
+ <cfscript>
+ var loc = {};
+ for (loc.key in arguments.params)
+ {
+ if (FindNoCase("($checkbox)", loc.key))
+ {
+ // if no other form parameter exists with this name it means that the checkbox was left
+ // blank and therefore we force the value to the unchecked values for the checkbox
+ // (to get around the problem that unchecked checkboxes don't post at all)
+ loc.formParamName = ReplaceNoCase(loc.key, "($checkbox)", "");
+ if (!StructKeyExists(arguments.params, loc.formParamName))
+ {
+ arguments.params[loc.formParamName] = arguments.params[loc.key];
+ }
+ StructDelete(arguments.params, loc.key, false);
+ }
+ }
+ </cfscript>
+ <cfreturn arguments.params>
+</cffunction>
+
+<cffunction name="$translateDatePartSubmissions" returntype="struct" access="public" output="false"
+ hint="combines date parts into a single value">
+ <cfargument name="params" type="struct" required="true">
+ <cfscript>
+ var loc = {};
+ loc.dates = {};
+
+ for (loc.key in arguments.params)
+ {
+ if (REFindNoCase(".*\((\$year|\$month|\$day|\$hour|\$minute|\$second|\$ampm)\)$", loc.key))
+ {
+ loc.temp = ListToArray(loc.key, "(");
+ loc.firstKey = loc.temp[1];
+ loc.secondKey = SpanExcluding(loc.temp[2], ")");
+
+ if (!StructKeyExists(loc.dates, loc.firstKey))
+ {
+ loc.dates[loc.firstKey] = {};
+ }
+ loc.dates[loc.firstKey][ReplaceNoCase(loc.secondKey, "$", "")] = arguments.params[loc.key];
+ }
+ }
+
+ for (loc.key in loc.dates)
+ {
+ if (!StructKeyExists(loc.dates[loc.key], "year"))
+ {
+ loc.dates[loc.key].year = 1899;
+ }
+ if (!StructKeyExists(loc.dates[loc.key], "month"))
+ {
+ loc.dates[loc.key].month = 1;
+ }
+ if (!StructKeyExists(loc.dates[loc.key], "day"))
+ {
+ loc.dates[loc.key].day = 1;
+ }
+ if (!StructKeyExists(loc.dates[loc.key], "hour"))
+ {
+ loc.dates[loc.key].hour = 0;
+ }
+ if (!StructKeyExists(loc.dates[loc.key], "minute"))
+ {
+ loc.dates[loc.key].minute = 0;
+ }
+ if (!StructKeyExists(loc.dates[loc.key], "second"))
+ {
+ loc.dates[loc.key].second = 0;
+ }
+ if (StructKeyExists(loc.dates[loc.key], "ampm"))
+ {
+ if (loc.dates[loc.key].ampm IS "AM" && loc.dates[loc.key].hour EQ 12)
+ {
+ loc.dates[loc.key].hour = 0;
+ }
+ else if (loc.dates[loc.key].ampm IS "PM")
+ {
+ loc.dates[loc.key].hour += 12;
+ }
+ }
+ if (!StructKeyExists(arguments.params, loc.key) || !IsArray(arguments.params[loc.key]))
+ {
+ arguments.params[loc.key] = [];
+ }
+ try
+ {
+ arguments.params[loc.key] = CreateDateTime(loc.dates[loc.key].year, loc.dates[loc.key].month, loc.dates[loc.key].day, loc.dates[loc.key].hour, loc.dates[loc.key].minute, loc.dates[loc.key].second);
+ }
+ catch(Any e)
+ {
+ arguments.params[loc.key] = "";
+ }
+
+ StructDelete(arguments.params, "#loc.key#($year)", false);
+ StructDelete(arguments.params, "#loc.key#($month)", false);
+ StructDelete(arguments.params, "#loc.key#($day)", false);
+ StructDelete(arguments.params, "#loc.key#($hour)", false);
+ StructDelete(arguments.params, "#loc.key#($minute)", false);
+ StructDelete(arguments.params, "#loc.key#($second)", false);
+ }
+ </cfscript>
+ <cfreturn arguments.params>
+</cffunction>
+
+<cffunction name="$ensureControllerAndAction" returntype="struct" access="public" output="false"
+ hint="ensure that the controller and action params exists and camelized">
+ <cfargument name="params" type="struct" required="true">
+ <cfargument name="route" type="struct" required="true">
+ <cfscript>
+
+ if (!StructKeyExists(arguments.params, "controller"))
+ {
+ arguments.params.controller = arguments.route.controller;
+ }
+ if (!StructKeyExists(arguments.params, "action"))
+ {
+ arguments.params.action = arguments.route.action;
+ }
+
+ // filter out illegal characters from the controller and action arguments
+ arguments.params.controller = ReReplace(arguments.params.controller, "[^0-9A-Za-z-_]", "", "all");
+ arguments.params.action = ReReplace(arguments.params.action, "[^0-9A-Za-z-_]", "", "all");
+
+ // convert controller to upperCamelCase and action to normal camelCase
+ arguments.params.controller = REReplace(arguments.params.controller, "(^|-)([a-z])", "\u\2", "all");
+ arguments.params.action = REReplace(arguments.params.action, "-([a-z])", "\u\1", "all");
+
+ </cfscript>
+ <cfreturn arguments.params>
+</cffunction>
+
+<cffunction name="$addRouteFormat" returntype="struct" access="public" output="false"
+ hint="adds in the format variable from the route if it exists">
+ <cfargument name="params" type="struct" required="true">
+ <cfargument name="route" type="struct" required="true">
+ <cfscript>
+ if (StructKeyExists(arguments.route, "formatVariable") && StructKeyExists(arguments.route, "format"))
+ {
+ arguments.params[arguments.route.formatVariable] = arguments.route.format;
+ }
+ </cfscript>
+ <cfreturn arguments.params>
+</cffunction>
+
+<cffunction name="$addRouteName" returntype="struct" access="public" output="false"
+ hint="adds in the name variable from the route if it exists">
+ <cfargument name="params" type="struct" required="true">
+ <cfargument name="route" type="struct" required="true">
+ <cfscript>
+ if (StructKeyExists(arguments.route, "name") && Len(arguments.route.name) && !StructKeyExists(arguments.params, "route"))
+ {
+ arguments.params.route = arguments.route.name;
+ }
+ </cfscript>
+ <cfreturn arguments.params>
+</cffunction>
+
diff --git a/src/main/webapp/wheels/events/onapplicationend.cfm b/src/main/webapp/wheels/events/onapplicationend.cfm new file mode 100755 index 0000000..ab1215e --- /dev/null +++ b/src/main/webapp/wheels/events/onapplicationend.cfm @@ -0,0 +1,6 @@ +<cffunction name="onApplicationEnd" returntype="void" access="public" output="false">
+ <cfargument name="applicationscope" type="struct" required="true">
+ <cfscript>
+ $include(template="#arguments.applicationscope.wheels.eventPath#/onapplicationend.cfm");
+ </cfscript>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/events/onapplicationstart.cfm b/src/main/webapp/wheels/events/onapplicationstart.cfm new file mode 100755 index 0000000..871480a --- /dev/null +++ b/src/main/webapp/wheels/events/onapplicationstart.cfm @@ -0,0 +1,127 @@ +<cffunction name="onApplicationStart" returntype="void" access="public" output="false">
+ <cfscript>
+ var loc = {};
+
+ // abort if called from incorrect file
+ $abortInvalidRequest();
+
+ // setup the wheels storage struct for the current request
+ $initializeRequestScope();
+
+ // set or reset all settings but make sure to pass along the reload password between forced reloads with "reload=x"
+ if (StructKeyExists(application, "wheels") && StructKeyExists(application.wheels, "reloadPassword"))
+ loc.oldReloadPassword = application.wheels.reloadPassword;
+ application.wheels = {};
+ if (StructKeyExists(loc, "oldReloadPassword"))
+ application.wheels.reloadPassword = loc.oldReloadPassword;
+
+ // check and store server engine name, throw error if using a version that we don't support
+ // really need to refactor this into a method
+ if (StructKeyExists(server, "railo"))
+ {
+ application.wheels.serverName = "Railo";
+ application.wheels.serverVersion = server.railo.version;
+ loc.minimumServerVersion = "3.1.2.020";
+ }
+ else
+ {
+ application.wheels.serverName = "Adobe ColdFusion";
+ application.wheels.serverVersion = server.coldfusion.productversion;
+ loc.minimumServerVersion = "8,0,1,0";
+ }
+
+ if (!$checkMinimumVersion(application.wheels.serverVersion, loc.minimumServerVersion))
+ {
+ $throw(type="Wheels.EngineNotSupported", message="#application.wheels.serverName# #application.wheels.serverVersion# is not supported by Wheels.", extendedInfo="Please upgrade to version #loc.minimumServerVersion# or higher.");
+ }
+
+ // copy over the cgi variables we need to the request scope (since we use some of these to determine URL rewrite capabilities we need to be able to access them directly on application start for example)
+ request.cgi = $cgiScope();
+
+ // set up containers for routes, caches, settings etc
+ application.wheels.version = "1.1.8";
+ application.wheels.controllers = {};
+ application.wheels.models = {};
+ application.wheels.existingHelperFiles = "";
+ application.wheels.existingLayoutFiles = "";
+ application.wheels.existingObjectFiles = "";
+ application.wheels.nonExistingHelperFiles = "";
+ application.wheels.nonExistingLayoutFiles = "";
+ application.wheels.nonExistingObjectFiles = "";
+ application.wheels.routes = [];
+ application.wheels.namedRoutePositions = {};
+ application.wheels.mixins = {};
+ application.wheels.cache = {};
+ application.wheels.cache.sql = {};
+ application.wheels.cache.image = {};
+ application.wheels.cache.main = {};
+ application.wheels.cache.action = {};
+ application.wheels.cache.page = {};
+ application.wheels.cache.partial = {};
+ application.wheels.cache.query = {};
+ application.wheels.cacheLastCulledAt = Now();
+
+ // set up paths to various folders in the framework
+ application.wheels.webPath = Replace(request.cgi.script_name, Reverse(spanExcluding(Reverse(request.cgi.script_name), "/")), "");
+ application.wheels.rootPath = "/" & ListChangeDelims(application.wheels.webPath, "/", "/");
+ application.wheels.rootcomponentPath = ListChangeDelims(application.wheels.webPath, ".", "/");
+ application.wheels.wheelsComponentPath = ListAppend(application.wheels.rootcomponentPath, "wheels", ".");
+ application.wheels.configPath = "config";
+ application.wheels.eventPath = "events";
+ application.wheels.filePath = "files";
+ application.wheels.imagePath = "images";
+ application.wheels.javascriptPath = "javascripts";
+ application.wheels.modelPath = "models";
+ application.wheels.modelComponentPath = "models";
+ application.wheels.pluginPath = "plugins";
+ application.wheels.pluginComponentPath = "plugins";
+ application.wheels.stylesheetPath = "stylesheets";
+ application.wheels.viewPath = "views";
+
+ // set environment either from the url or the developer's environment.cfm file
+ if (StructKeyExists(URL, "reload") && !IsBoolean(URL.reload) && Len(url.reload) && StructKeyExists(application.wheels, "reloadPassword") && (!Len(application.wheels.reloadPassword) || (StructKeyExists(URL, "password") && URL.password == application.wheels.reloadPassword)))
+ application.wheels.environment = URL.reload;
+ else
+ $include(template="#application.wheels.configPath#/environment.cfm");
+
+ // load wheels settings
+ $include(template="wheels/events/onapplicationstart/settings.cfm");
+
+ // load general developer settings first, then override with environment specific ones
+ $include(template="#application.wheels.configPath#/settings.cfm");
+ $include(template="#application.wheels.configPath#/#application.wheels.environment#/settings.cfm");
+
+ if(application.wheels.clearQueryCacheOnReload)
+ {
+ $objectcache(action="clear");
+ }
+
+ // add all public controller / view methods to a list of methods that you should not be allowed to call as a controller action from the url
+ loc.allowedGlobalMethods = "get,set,addroute,addDefaultRoutes";
+ loc.protectedControllerMethods = StructKeyList($createObjectFromRoot(path=application.wheels.controllerPath, fileName="Wheels", method="$initControllerClass"));
+ application.wheels.protectedControllerMethods = "";
+ loc.iEnd = ListLen(loc.protectedControllerMethods);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.method = ListGetAt(loc.protectedControllerMethods, loc.i);
+ if (Left(loc.method, 1) != "$" && !ListFindNoCase(loc.allowedGlobalMethods, loc.method))
+ application.wheels.protectedControllerMethods = ListAppend(application.wheels.protectedControllerMethods, loc.method);
+ }
+
+ // reload the plugins each time we reload the application
+ $loadPlugins();
+
+ // allow developers to inject plugins into the application variables scope
+ if (!StructIsEmpty(application.wheels.mixins))
+ $include(template="wheels/plugins/injection.cfm");
+
+ // load developer routes and adds the default wheels routes (unless the developer has specified not to)
+ $loadRoutes();
+
+ // create the dispatcher that will handle all incoming requests
+ application.wheels.dispatch = $createObjectFromRoot(path="wheels", fileName="Dispatch", method="$init");
+
+ // run the developer's on application start code
+ $include(template="#application.wheels.eventPath#/onapplicationstart.cfm");
+ </cfscript>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/events/onapplicationstart/settings.cfm b/src/main/webapp/wheels/events/onapplicationstart/settings.cfm new file mode 100755 index 0000000..e4c02fc --- /dev/null +++ b/src/main/webapp/wheels/events/onapplicationstart/settings.cfm @@ -0,0 +1,241 @@ +<cfscript>
+ // rewrite settings based on web server rewrite capabilites
+ application.wheels.rewriteFile = "rewrite.cfm";
+ if (Right(request.cgi.script_name, 12) == "/" & application.wheels.rewriteFile)
+ application.wheels.URLRewriting = "On";
+ else if (Len(request.cgi.path_info))
+ application.wheels.URLRewriting = "Partial";
+ else
+ application.wheels.URLRewriting = "Off";
+
+ // set datasource name to same as the folder the app resides in unless the developer has set it with the global setting already
+ if (StructKeyExists(this, "dataSource"))
+ application.wheels.dataSourceName = this.dataSource;
+ else
+ application.wheels.dataSourceName = LCase(ListLast(GetDirectoryFromPath(GetBaseTemplatePath()), Right(GetDirectoryFromPath(GetBaseTemplatePath()), 1)));
+ application.wheels.dataSourceUserName = "";
+ application.wheels.dataSourcePassword = "";
+ application.wheels.transactionMode = "commit"; // use 'commit', 'rollback' or 'none' to set default transaction handling for creates, updates and deletes
+
+ // cache settings
+ application.wheels.cacheDatabaseSchema = false;
+ application.wheels.cacheFileChecking = false;
+ application.wheels.cacheImages = false;
+ application.wheels.cacheModelInitialization = false;
+ application.wheels.cacheControllerInitialization = false;
+ application.wheels.cacheRoutes = false;
+ application.wheels.cacheActions = false;
+ application.wheels.cachePages = false;
+ application.wheels.cachePartials = false;
+ application.wheels.cacheQueries = false;
+ application.wheels.cachePlugins = true;
+ if (application.wheels.environment != "design")
+ {
+ application.wheels.cacheDatabaseSchema = true;
+ application.wheels.cacheFileChecking = true;
+ application.wheels.cacheImages = true;
+ application.wheels.cacheModelInitialization = true;
+ application.wheels.cacheControllerInitialization = true;
+ application.wheels.cacheRoutes = true;
+ }
+ if (application.wheels.environment != "design" && application.wheels.environment != "development")
+ {
+ application.wheels.cacheActions = true;
+ application.wheels.cachePages = true;
+ application.wheels.cachePartials = true;
+ application.wheels.cacheQueries = true;
+ }
+
+ // debugging and error settings
+ application.wheels.showDebugInformation = true;
+ application.wheels.showErrorInformation = true;
+ application.wheels.sendEmailOnError = false;
+ application.wheels.errorEmailSubject = "Error";
+ application.wheels.excludeFromErrorEmail = "";
+ if (request.cgi.server_name Contains ".")
+ application.wheels.errorEmailAddress = "webmaster@" & Reverse(ListGetAt(Reverse(request.cgi.server_name), 2,".")) & "." & Reverse(ListGetAt(Reverse(request.cgi.server_name), 1, "."));
+ else
+ application.wheels.errorEmailAddress = "";
+ if (application.wheels.environment == "production")
+ {
+ application.wheels.showErrorInformation = false;
+ application.wheels.sendEmailOnError = true;
+ }
+ if (application.wheels.environment != "design" && application.wheels.environment != "development")
+ application.wheels.showDebugInformation = false;
+
+ // asset path settings
+ // assetPaths can be struct with two keys, http and https, if no https struct key, http is used for secure and non-secure
+ // ex. {http="asset0.domain1.com,asset2.domain1.com,asset3.domain1.com", https="secure.domain1.com"}
+ application.wheels.assetQueryString = false;
+ application.wheels.assetPaths = false;
+ if (application.wheels.environment != "design" && application.wheels.environment != "development")
+ application.wheels.assetQueryString = true;
+
+ // paths
+ application.wheels.controllerPath = "controllers";
+
+ // miscellaneous settings
+ application.wheels.tableNamePrefix = "";
+ application.wheels.obfuscateURLs = false;
+ application.wheels.reloadPassword = "";
+ application.wheels.softDeleteProperty = "deletedAt";
+ application.wheels.timeStampOnCreateProperty = "createdAt";
+ application.wheels.timeStampOnUpdateProperty = "updatedAt";
+ application.wheels.ipExceptions = "";
+ application.wheels.overwritePlugins = true;
+ application.wheels.deletePluginDirectories = true;
+ application.wheels.loadIncompatiblePlugins = true;
+ application.wheels.loadDefaultRoutes = true;
+ application.wheels.automaticValidations = true;
+ application.wheels.setUpdatedAtOnCreate = true;
+ application.wheels.useExpandedColumnAliases = false;
+
+ // if session management is enabled in the application we default to storing flash data in the session scope, if not we use a cookie
+ if (StructKeyExists(this, "sessionManagement") && this.sessionManagement)
+ {
+ application.wheels.sessionManagement = true;
+ application.wheels.flashStorage = "session";
+ }
+ else
+ {
+ application.wheels.sessionManagement = false;
+ application.wheels.flashStorage = "cookie";
+ }
+
+ // caching settings
+ application.wheels.maximumItemsToCache = 5000;
+ application.wheels.cacheCullPercentage = 10;
+ application.wheels.cacheCullInterval = 5;
+ application.wheels.cacheDatePart = "n";
+ application.wheels.defaultCacheTime = 60;
+ application.wheels.clearQueryCacheOnReload = true;
+ application.wheels.cacheQueriesDuringRequest = true;
+
+ // possible formats for provides
+ application.wheels.formats = {};
+ application.wheels.formats.html = "text/html";
+ application.wheels.formats.xml = "text/xml";
+ application.wheels.formats.json = "application/json";
+ application.wheels.formats.csv = "text/csv";
+ application.wheels.formats.pdf = "application/pdf";
+ application.wheels.formats.xls = "application/vnd.ms-excel";
+
+ // function defaults
+ application.wheels.functions = {};
+ application.wheels.functions.average = {distinct=false, parameterize=true, ifNull=""};
+ application.wheels.functions.belongsTo = {joinType="inner"};
+ application.wheels.functions.buttonTo = {onlyPath=true, host="", protocol="", port=0, text="", confirm="", image="", disable=""};
+ application.wheels.functions.buttonTag = {type="submit", value="save", content="Save changes", image="", disable=""};
+ application.wheels.functions.caches = {time=60, static=false};
+ application.wheels.functions.checkBox = {label="useDefaultLabel", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", errorElement="span", errorClass="fieldWithErrors", checkedValue=1, unCheckedValue=0};
+ application.wheels.functions.checkBoxTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", value=1};
+ application.wheels.functions.count = {parameterize=true};
+ application.wheels.functions.create = {parameterize=true, reload=false};
+ application.wheels.functions.dateSelect = {label=false, labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", errorElement="span", errorClass="fieldWithErrors", includeBlank=false, order="month,day,year", separator=" ", startYear=Year(Now())-5, endYear=Year(Now())+5, monthDisplay="names"};
+ application.wheels.functions.dateSelectTags = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", includeBlank=false, order="month,day,year", separator=" ", startYear=Year(Now())-5, endYear=Year(Now())+5, monthDisplay="names"};
+ application.wheels.functions.dateTimeSelect = {label=false, labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", errorElement="span", errorClass="fieldWithErrors", includeBlank=false, dateOrder="month,day,year", dateSeparator=" ", startYear=Year(Now())-5, endYear=Year(Now())+5, monthDisplay="names", timeOrder="hour,minute,second", timeSeparator=":", minuteStep=1, secondStep=1, separator=" - "};
+ application.wheels.functions.dateTimeSelectTags = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", includeBlank=false, dateOrder="month,day,year", dateSeparator=" ", startYear=Year(Now())-5, endYear=Year(Now())+5, monthDisplay="names", timeOrder="hour,minute,second", timeSeparator=":", minuteStep=1, secondStep=1,separator=" - "};
+ application.wheels.functions.daySelectTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", includeBlank=false};
+ application.wheels.functions.delete = {parameterize=true};
+ application.wheels.functions.deleteAll = {reload=false, parameterize=true, instantiate=false};
+ application.wheels.functions.deleteByKey = {reload=false};
+ application.wheels.functions.deleteOne = {reload=false};
+ application.wheels.functions.distanceOfTimeInWords = {includeSeconds=false};
+ application.wheels.functions.errorMessageOn = {prependText="", appendText="", wrapperElement="span", class="errorMessage"};
+ application.wheels.functions.errorMessagesFor = {class="errorMessages", showDuplicates=true};
+ application.wheels.functions.exists = {reload=false, parameterize=true};
+ application.wheels.functions.fileField = {label="useDefaultLabel", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", errorElement="span", errorClass="fieldWithErrors"};
+ application.wheels.functions.fileFieldTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel=""};
+ application.wheels.functions.findAll = {reload=false, parameterize=true, perPage=10, order="", group="", returnAs="query", returnIncluded=true};
+ application.wheels.functions.findByKey = {reload=false, parameterize=true, returnAs="object"};
+ application.wheels.functions.findOne = {reload=false, parameterize=true, returnAs="object"};
+ application.wheels.functions.flashKeep = {};
+ application.wheels.functions.flashMessages = {class="flashMessages", includeEmptyContainer="false", lowerCaseDynamicClassValues=false};
+ application.wheels.functions.hasMany = {joinType="outer", dependent=false};
+ application.wheels.functions.hasOne = {joinType="outer", dependent=false};
+ application.wheels.functions.hiddenField = {};
+ application.wheels.functions.highlight = {delimiter=",", tag="span", class="highlight"};
+ application.wheels.functions.hourSelectTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", includeBlank=false};
+ application.wheels.functions.imageTag = {};
+ application.wheels.functions.includePartial = {layout="", spacer="", dataFunction=true};
+ application.wheels.functions.javaScriptIncludeTag = {type="text/javascript", head=false};
+ application.wheels.functions.linkTo = {onlyPath=true, host="", protocol="", port=0};
+ application.wheels.functions.mailTo = {encode=false};
+ application.wheels.functions.maximum = {parameterize=true, ifNull=""};
+ application.wheels.functions.minimum = {parameterize=true, ifNull=""};
+ application.wheels.functions.minuteSelectTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", includeBlank=false, minuteStep=1};
+ application.wheels.functions.monthSelectTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", includeBlank=false, monthDisplay="names"};
+ application.wheels.functions.nestedProperties = {autoSave=true, allowDelete=false, sortProperty="", rejectIfBlank=""};
+ application.wheels.functions.paginationLinks = {windowSize=2, alwaysShowAnchors=true, anchorDivider=" ... ", linkToCurrentPage=false, prepend="", append="", prependToPage="", prependOnFirst=true, prependOnAnchor=true, appendToPage="", appendOnLast=true, appendOnAnchor=true, classForCurrent="", name="page", showSinglePage=false, pageNumberAsParam=true};
+ application.wheels.functions.passwordField = {label="useDefaultLabel", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", errorElement="span", errorClass="fieldWithErrors"};
+ application.wheels.functions.passwordFieldTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel=""};
+ application.wheels.functions.radioButton = {label="useDefaultLabel", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", errorElement="span", errorClass="fieldWithErrors"};
+ application.wheels.functions.radioButtonTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel=""};
+ application.wheels.functions.redirectTo = {onlyPath=true, host="", protocol="", port=0, addToken=false, statusCode=302, delay=false};
+ application.wheels.functions.renderPage = {layout=""};
+ application.wheels.functions.renderWith = {layout=""};
+ application.wheels.functions.renderPageToString = {layout=true};
+ application.wheels.functions.renderPartial = {layout="", dataFunction=true};
+ application.wheels.functions.save = {parameterize=true, reload=false};
+ application.wheels.functions.secondSelectTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", includeBlank=false, secondStep=1};
+ application.wheels.functions.select = {label="useDefaultLabel", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", errorElement="span", errorClass="fieldWithErrors", includeBlank=false, valueField="", textField=""};
+ application.wheels.functions.selectTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", includeBlank=false, multiple=false, valueField="", textField=""};
+ application.wheels.functions.sendEmail = {layout=false, detectMultipart=true, from="", to="", subject=""};
+ application.wheels.functions.sendFile = {disposition="attachment"};
+ application.wheels.functions.startFormTag = {onlyPath=true, host="", protocol="", port=0, method="post", multipart=false, spamProtection=false};
+ application.wheels.functions.styleSheetLinkTag = {type="text/css", media="all", head=false};
+ application.wheels.functions.submitTag = {value="Save changes", image="", disable="", prepend="", append=""};
+ application.wheels.functions.sum = {distinct=false, parameterize=true, ifNull=""};
+ application.wheels.functions.textArea = {label="useDefaultLabel", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", errorElement="span", errorClass="fieldWithErrors"};
+ application.wheels.functions.textAreaTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel=""};
+ application.wheels.functions.textField = {label="useDefaultLabel", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", errorElement="span", errorClass="fieldWithErrors"};
+ application.wheels.functions.textFieldTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel=""};
+ application.wheels.functions.timeAgoInWords = {includeSeconds=false};
+ application.wheels.functions.timeSelect = {label=false, labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", errorElement="span", errorClass="fieldWithErrors", includeBlank=false, order="hour,minute,second", separator=":", minuteStep=1, secondStep=1};
+ application.wheels.functions.timeSelectTags = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", includeBlank=false, order="hour,minute,second", separator=":", minuteStep=1, secondStep=1};
+ application.wheels.functions.timeUntilInWords = {includeSeconds=false};
+ application.wheels.functions.toggle = {save=true};
+ application.wheels.functions.truncate = {length=30, truncateString="..."};
+ application.wheels.functions.update = {parameterize=true, reload=false};
+ application.wheels.functions.updateAll = {reload=false, parameterize=true, instantiate=false};
+ application.wheels.functions.updateByKey = {reload=false};
+ application.wheels.functions.updateOne = {reload=false};
+ application.wheels.functions.updateProperty = {parameterize=true};
+ application.wheels.functions.updateProperties = {parameterize=true};
+ application.wheels.functions.URLFor = {onlyPath=true, host="", protocol="", port=0};
+ application.wheels.functions.validatesConfirmationOf = {message="[property] should match confirmation"};
+ application.wheels.functions.validatesExclusionOf = {message="[property] is reserved", allowBlank=false};
+ application.wheels.functions.validatesFormatOf = {message="[property] is invalid", allowBlank=false};
+ application.wheels.functions.validatesInclusionOf = {message="[property] is not included in the list", allowBlank=false};
+ application.wheels.functions.validatesLengthOf = {message="[property] is the wrong length", allowBlank=false, exactly=0, maximum=0, minimum=0, within=""};
+ application.wheels.functions.validatesNumericalityOf = {message="[property] is not a number", allowBlank=false, onlyInteger=false, odd="", even="", greaterThan="", greaterThanOrEqualTo="", equalTo="", lessThan="", lessThanOrEqualTo=""};
+ application.wheels.functions.validatesPresenceOf = {message="[property] can't be empty"};
+ application.wheels.functions.validatesUniquenessOf = {message="[property] has already been taken", allowBlank=false};
+ application.wheels.functions.verifies = {handler=""};
+ application.wheels.functions.wordTruncate = {length=5, truncateString="..."};
+ application.wheels.functions.yearSelectTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", includeBlank=false, startYear=Year(Now())-5, endYear=Year(Now())+5};
+
+ // set a flag to indicate that all settings have been loaded
+ application.wheels.initialized = true;
+
+ // mime types
+ application.wheels.mimetypes = {
+ txt="text/plain"
+ ,gif="image/gif"
+ ,jpg="image/jpg"
+ ,jpeg="image/jpg"
+ ,pjpeg="image/jpg"
+ ,png="image/png"
+ ,wav="audio/wav"
+ ,mp3="audio/mpeg3"
+ ,pdf="application/pdf"
+ ,zip="application/zip"
+ ,ppt="application/powerpoint"
+ ,pptx="application/powerpoint"
+ ,doc="application/word"
+ ,docx="application/word"
+ ,xls="application/excel"
+ ,xlsx="application/excel"
+ };
+</cfscript>
\ No newline at end of file diff --git a/src/main/webapp/wheels/events/onerror.cfm b/src/main/webapp/wheels/events/onerror.cfm new file mode 100755 index 0000000..9cace49 --- /dev/null +++ b/src/main/webapp/wheels/events/onerror.cfm @@ -0,0 +1,74 @@ +<cffunction name="onError" returntype="void" access="public" output="true">
+ <cfargument name="exception" type="any" required="true">
+ <cfargument name="eventName" type="any" required="true">
+ <cfscript>
+ var loc = {};
+
+ // In case the error was caused by a timeout we have to add extra time for error handling.
+ // We have to check if onErrorRequestTimeout exists since errors can be triggered before the application.wheels struct has been created.
+ loc.requestTimeout = 70;
+ if (StructKeyExists(application, "wheels") && StructKeyExists(application.wheels, "onErrorRequestTimeout"))
+ loc.requestTimeout = application.wheels.onErrorRequestTimeout;
+ $setting(requestTimeout=loc.requestTimeout);
+
+ loc.returnValue = $simpleLock(execute="$runOnError", executeArgs=arguments, name="wheelsReloadLock", type="readOnly", timeout=180);
+ </cfscript>
+ <cfoutput>
+ #loc.returnValue#
+ </cfoutput>
+</cffunction>
+
+<cffunction name="$runOnError" returntype="string" access="public" output="false">
+ <cfargument name="exception" type="any" required="true">
+ <cfargument name="eventName" type="any" required="true">
+ <cfscript>
+ var loc = {};
+
+ if (StructKeyExists(application, "wheels") && StructKeyExists(application.wheels, "initialized"))
+ {
+ if (application.wheels.sendEmailOnError && Len(application.wheels.errorEmailAddress))
+ {
+ loc.mailArgs = {};
+ $args(name="sendEmail", args=loc.mailArgs);
+ if (StructKeyExists(application.wheels, "errorEmailServer") && Len(application.wheels.errorEmailServer))
+ loc.mailArgs.server = application.wheels.errorEmailServer;
+ loc.mailArgs.from = application.wheels.errorEmailAddress;
+ loc.mailArgs.to = application.wheels.errorEmailAddress;
+ loc.mailArgs.subject = application.wheels.errorEmailSubject;
+ loc.mailArgs.type = "html";
+ loc.mailArgs.tagContent = $includeAndReturnOutput($template="wheels/events/onerror/cfmlerror.cfm", exception=arguments.exception);
+ StructDelete(loc.mailArgs, "layouts", false);
+ StructDelete(loc.mailArgs, "detectMultiPart", false);
+ $mail(argumentCollection=loc.mailArgs);
+ }
+
+ if (application.wheels.showErrorInformation)
+ {
+ if (StructKeyExists(arguments.exception, "rootCause") && Left(arguments.exception.rootCause.type, 6) == "Wheels")
+ loc.wheelsError = arguments.exception.rootCause;
+ else if (StructKeyExists(arguments.exception, "cause") && StructKeyExists(arguments.exception.cause, "rootCause") && Left(arguments.exception.cause.rootCause.type, 6) == "Wheels")
+ loc.wheelsError = arguments.exception.cause.rootCause;
+ if (StructKeyExists(loc, "wheelsError"))
+ {
+ loc.returnValue = $includeAndReturnOutput($template="wheels/styles/header.cfm");
+ loc.returnValue = loc.returnValue & $includeAndReturnOutput($template="wheels/events/onerror/wheelserror.cfm", wheelsError=loc.wheelsError);
+ loc.returnValue = loc.returnValue & $includeAndReturnOutput($template="wheels/styles/footer.cfm");
+ }
+ else
+ {
+ $throw(object=arguments.exception);
+ }
+ }
+ else
+ {
+ $header(statusCode=500, statusText="Internal Server Error");
+ loc.returnValue = $includeAndReturnOutput($template="#application.wheels.eventPath#/onerror.cfm", exception=arguments.exception, eventName=arguments.eventName);
+ }
+ }
+ else
+ {
+ $throw(object=arguments.exception);
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/events/onerror/cfmlerror.cfm b/src/main/webapp/wheels/events/onerror/cfmlerror.cfm new file mode 100755 index 0000000..63544f0 --- /dev/null +++ b/src/main/webapp/wheels/events/onerror/cfmlerror.cfm @@ -0,0 +1,70 @@ +<cfoutput>
+ <h1>Summary</h1>
+ <p>
+ <strong>Error:</strong><br />
+ <cfif StructKeyExists(arguments.exception, "rootcause") and StructKeyExists(arguments.exception.rootcause, "message")>
+ #arguments.exception.rootcause.message#
+ <cfif arguments.exception.rootcause.detail IS NOT ""><br />#arguments.exception.rootcause.detail#</cfif>
+ <cfelse>
+ A root cause was not provided.
+ </cfif>
+ </p>
+ <cfif StructKeyExists(arguments.exception.cause, "tagContext") && ArrayLen(arguments.exception.cause.tagContext)>
+ <p><strong>Location:</strong><br />
+ <cfset loc.path = GetDirectoryFromPath(GetBaseTemplatePath())>
+ <cfset loc.pos = 0>
+ <cfloop array="#arguments.exception.cause.tagContext#" index="loc.i">
+ <cfset loc.pos = loc.pos + 1>
+ <cfset loc.template = Replace(arguments.exception.cause.tagContext[loc.pos].template, loc.path, "")>
+ <!--- show all non wheels lines --->
+ <cfif loc.template Does Not Contain "wheels" AND FindOneOf("/\", loc.template) IS NOT 0>
+ Line #arguments.exception.cause.tagContext[loc.pos].line# in #loc.template#<br />
+ </cfif>
+ </cfloop>
+ </p>
+ </cfif>
+ <cfif IsDefined("application.wheels.rewriteFile")>
+ <p>
+ <strong>URL:</strong><br />
+ #LCase(ListFirst(cgi.server_protocol, "/"))#://#cgi.server_name##Replace(cgi.script_name, "/#application.wheels.rewriteFile#", "")##cgi.path_info#<cfif cgi.query_string IS NOT "">?#cgi.query_string#</cfif>
+ </p>
+ </cfif>
+ <cfif Len(cgi.http_referer)>
+ <p><strong>Referrer:</strong><br />#cgi.http_referer#</p>
+ </cfif>
+ <p><strong>Method:</strong><br />#cgi.request_method#</p>
+ <p><strong>IP Address:</strong><br />#cgi.remote_addr#</p>
+ <p><strong>User Agent:</strong><br />#cgi.http_user_agent#</p>
+ <p><strong>Date & Time:</strong><br />#DateFormat(now(), "MMMM D, YYYY")# at #TimeFormat(now(), "h:MM TT")#</p>
+ <cfset loc.scopes = "CGI,Form,URL,Application,Session,Request,Cookie,Arguments.Exception">
+ <cfset loc.skip = get("excludeFromErrorEmail")>
+ <!--- always skip cause since it's just a copy of rootCause anyway --->
+ <cfset loc.skip = ListAppend(loc.skip, "exception.cause")>
+ <h1>Details</h1>
+ <cfloop list="#loc.scopes#" index="loc.i">
+ <cfset loc.scopeName = ListLast(loc.i, ".")>
+ <cfif NOT ListFindNoCase(loc.skip, loc.scopeName) AND IsDefined(loc.scopeName)>
+ <cftry>
+ <cfset loc.scopeCopy = Duplicate(Evaluate(loc.i))>
+ <cfif IsStruct(loc.scopeCopy)>
+ <cfset loc.keys = StructKeyList(loc.scopeCopy)>
+ <cfloop list="#loc.keys#" index="loc.j">
+ <cfif Left(loc.j, 6) IS "wheels">
+ <cfset StructDelete(loc.scopeCopy, loc.j)>
+ </cfif>
+ </cfloop>
+ <p><strong>#loc.scopeName#</strong>
+ <cfset loc.hide = "">
+ <cfloop list="#loc.skip#" index="loc.j">
+ <cfif loc.j Contains "." AND ListFirst(loc.j, ".") IS loc.scopeName>
+ <cfset loc.hide = ListAppend(loc.hide, ListRest(loc.j, "."))>
+ </cfif>
+ </cfloop>
+ <cfdump var="#loc.scopeCopy#" format="text" showUDFs="false" hide="#loc.hide#">
+ </p>
+ </cfif>
+ <cfcatch type="any"><!--- just keep going, we need to send out error emails ---></cfcatch>
+ </cftry>
+ </cfif>
+ </cfloop>
+</cfoutput>
\ No newline at end of file diff --git a/src/main/webapp/wheels/events/onerror/wheelserror.cfm b/src/main/webapp/wheels/events/onerror/wheelserror.cfm new file mode 100755 index 0000000..3c4370e --- /dev/null +++ b/src/main/webapp/wheels/events/onerror/wheelserror.cfm @@ -0,0 +1,37 @@ +<cfoutput>
+<h1>#arguments.wheelsError.type#</h1>
+<p><strong>#REReplace(arguments.wheelsError.message, "`([^`]*)`", "<tt>\1</tt>", "all")#</strong></p>
+<cfif StructKeyExists(arguments.wheelsError, "extendedInfo") AND Len(arguments.wheelsError.extendedInfo)>
+ <h2>Suggested action</h2>
+ <p>#REReplace(arguments.wheelsError.extendedInfo, "`([^`]*)`", "<tt>\1</tt>", "all")#</p>
+</cfif>
+<cfset loc.path = GetDirectoryFromPath(GetBaseTemplatePath())>
+<cfset loc.errorPos = 0>
+<cfloop array="#arguments.wheelsError.tagContext#" index="loc.i">
+ <cfset loc.errorPos = loc.errorPos + 1>
+ <cfif loc.i.template Does Not Contain loc.path & "wheels" AND loc.i.template IS NOT loc.path & "root.cfm" AND loc.i.template IS NOT loc.path & "index.cfm" AND loc.i.template IS NOT loc.path & application.wheels.rewriteFile AND loc.i.template IS NOT loc.path & "Application.cfc" AND loc.i.template Does Not Contain loc.path & "plugins">
+ <cfset loc.lookupWorked = true>
+ <cftry>
+ <cfsavecontent variable="loc.fileContents"><cfset loc.pos = 0><pre><code><cfloop file="#arguments.wheelsError.tagContext[loc.errorPos].template#" index="loc.i"><cfset loc.pos = loc.pos + 1><cfif loc.pos GTE (arguments.wheelsError.tagContext[loc.errorPos].line-2) AND loc.pos LTE (arguments.wheelsError.tagContext[loc.errorPos].line+2)><cfif loc.pos IS arguments.wheelsError.tagContext[loc.errorPos].line><span style="color: red;">#loc.pos#: #HTMLEditFormat(loc.i)#</span><cfelse>#loc.pos#: #HTMLEditFormat(loc.i)#</cfif>#Chr(13)##Chr(10)#</cfif></cfloop></code></pre></cfsavecontent>
+ <cfcatch>
+ <cfset loc.lookupWorked = false>
+ </cfcatch>
+ </cftry>
+ <cfif loc.lookupWorked>
+ <h2>Error location</h2>
+ <p>Line #arguments.wheelsError.tagContext[loc.errorPos].line# in #Replace(arguments.wheelsError.tagContext[loc.errorPos].template, loc.path, "")#</p>
+ #loc.fileContents#
+ </cfif>
+ <cfbreak>
+ </cfif>
+</cfloop>
+<cfif ArrayLen(arguments.wheelsError.tagContext) gte 2>
+ <h2>Tag context</h2>
+ <p>
+ Error thrown on line #arguments.wheelsError.tagContext[2].line# in #Replace(arguments.wheelsError.tagContext[2].template, loc.path, "")#<br /> <!--- skip the first item in the array as this is always the $throw() method --->
+ <cfloop from="3" to="#ArrayLen(arguments.wheelsError.tagContext)#" index="loc.i">
+ - called from line #arguments.wheelsError.tagContext[loc.i].line# in #Replace(arguments.wheelsError.tagContext[loc.i].template, loc.path, "")#<br />
+ </cfloop>
+ </p>
+</cfif>
+</cfoutput>
\ No newline at end of file diff --git a/src/main/webapp/wheels/events/onmissingtemplate.cfm b/src/main/webapp/wheels/events/onmissingtemplate.cfm new file mode 100755 index 0000000..04b1c7b --- /dev/null +++ b/src/main/webapp/wheels/events/onmissingtemplate.cfm @@ -0,0 +1,15 @@ +<cffunction name="onMissingTemplate" returntype="void" access="public" output="true">
+ <cfargument name="targetpage" type="any" required="true">
+ <cfscript>
+ $simpleLock(execute="$runOnMissingTemplate", executeArgs=arguments, name="wheelsReloadLock", type="readOnly", timeout=180);
+ </cfscript>
+</cffunction>
+
+<cffunction name="$runOnMissingTemplate" returntype="void" access="public" output="true">
+ <cfargument name="targetpage" type="any" required="true">
+ <cfscript>
+ $header(statusCode=404, statustext="Not Found");
+ $includeAndOutput(template="#application.wheels.eventPath#/onmissingtemplate.cfm");
+ $abort();
+ </cfscript>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/events/onrequest.cfm b/src/main/webapp/wheels/events/onrequest.cfm new file mode 100755 index 0000000..db56b10 --- /dev/null +++ b/src/main/webapp/wheels/events/onrequest.cfm @@ -0,0 +1 @@ +<cffunction name="onRequest" returntype="void" access="public" output="true"><cfargument name="targetpage" type="any" required="true"><cflock name="wheelsReloadLock" type="readOnly" timeout="180"><cfinclude template="#arguments.targetpage#"></cflock></cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/events/onrequestend.cfm b/src/main/webapp/wheels/events/onrequestend.cfm new file mode 100755 index 0000000..58c535f --- /dev/null +++ b/src/main/webapp/wheels/events/onrequestend.cfm @@ -0,0 +1,21 @@ +<cffunction name="onRequestEnd" returntype="void" access="public" output="true">
+ <cfargument name="targetpage" type="any" required="true">
+ <cfscript>
+ $simpleLock(execute="$runOnRequestEnd", executeArgs=arguments, name="wheelsReloadLock", type="readOnly", timeout=180);
+ if (application.wheels.showDebugInformation && StructKeyExists(request.wheels, "showDebugInformation") && request.wheels.showDebugInformation)
+ {
+ $includeAndOutput(template="wheels/events/onrequestend/debug.cfm");
+ }
+ </cfscript>
+</cffunction>
+
+<cffunction name="$runOnRequestEnd" returntype="void" access="public" output="false">
+ <cfargument name="targetpage" type="any" required="true">
+ <cfscript>
+ if (application.wheels.showDebugInformation)
+ $debugPoint("requestEnd");
+ $include(template="#application.wheels.eventPath#/onrequestend.cfm");
+ if (application.wheels.showDebugInformation)
+ $debugPoint("requestEnd,total");
+ </cfscript>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/events/onrequestend/debug.cfm b/src/main/webapp/wheels/events/onrequestend/debug.cfm new file mode 100755 index 0000000..cd0ca84 --- /dev/null +++ b/src/main/webapp/wheels/events/onrequestend/debug.cfm @@ -0,0 +1,161 @@ +<cfset loc.baseReloadURL = cgi.script_name>
+<cfif cgi.path_info IS NOT cgi.script_name>
+ <cfset loc.baseReloadURL = loc.baseReloadURL & cgi.path_info>
+</cfif>
+<cfif Len(cgi.query_string)>
+ <cfset loc.baseReloadURL = loc.baseReloadURL & "?" & cgi.query_string>
+</cfif>
+<cfset loc.baseReloadURL = ReplaceNoCase(loc.baseReloadURL, "/" & application.wheels.rewriteFile, "")>
+<cfloop list="design,development,testing,maintenance,production,true" index="loc.i">
+ <cfset loc.baseReloadURL = ReplaceNoCase(ReplaceNoCase(loc.baseReloadURL, "?reload=" & loc.i, ""), "&reload=" & loc.i, "")>
+</cfloop>
+<cfif loc.baseReloadURL Contains "?">
+ <cfset loc.baseReloadURL = loc.baseReloadURL & "&">
+<cfelse>
+ <cfset loc.baseReloadURL = loc.baseReloadURL & "?">
+</cfif>
+<cfset loc.baseReloadURL = loc.baseReloadURL & "reload=">
+<cfset loc.hasFrameworkTests = StructKeyExists(this, "mappings") && StructKeyExists(this.mappings, "/wheelsMapping") && DirectoryExists(expandPath("/wheelsMapping/tests"))>
+<cfset loc.hasAppTests = DirectoryExists(expandPath("#get('webPath')#/tests"))>
+
+<cfoutput>
+
+<style type="text/css">
+##wheels-debug-area
+{
+ clear: both;
+ margin: 100px 0;
+ text-align: left;
+ background: ##ececec;
+ padding: 10px;
+ border-top: 3px solid ##999;
+ border-bottom: 3px solid ##999;
+}
+
+##wheels-debug-area td
+{
+ font: 12px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
+ line-height: 1.5em;
+ color: ##333;
+}
+
+##wheels-debug-area a
+{
+ color: ##333;
+ text-decoration: underline;
+ padding: 0 1px;
+}
+
+##wheels-debug-area a:hover
+{
+ color: ##fff;
+ background: ##333;
+ text-decoration: none;
+}
+</style>
+
+<div id="wheels-debug-area">
+ <table cellspacing="0" cellpadding="0">
+ <cfif Len(application.wheels.incompatiblePlugins) OR Len(application.wheels.dependantPlugins) OR NOT ArrayIsEmpty(request.wheels.deprecation)>
+ <tr>
+ <td valign="top"><strong><span style="color:red;">Warnings:</span></strong></td>
+ <td>
+ <span style="color:red;">
+ <cfif Len(application.wheels.incompatiblePlugins)>
+ <cfloop list="#application.wheels.incompatiblePlugins#" index="loc.i">The #loc.i# plugin may be incompatible with this version of Wheels, please look for a compatible version of the plugin<br /></cfloop>
+ </cfif>
+ <cfif Len(application.wheels.dependantPlugins)>
+ <cfloop list="#application.wheels.dependantPlugins#" index="loc.i"><cfset needs = ListLast(loc.i, "|")>The #ListFirst(loc.i, "|")# plugin needs the following plugin<cfif ListLen(needs) GT 1>s</cfif> to work properly: #needs#<br /></cfloop>
+ </cfif>
+ <cfif NOT ArrayIsEmpty(request.wheels.deprecation)>
+ <cfloop array="#request.wheels.deprecation#" index="i">#i.message# (line #i.line# in #i.template#)<br /></cfloop>
+ </cfif>
+ </span>
+ </td>
+ </tr>
+ </cfif>
+ <tr>
+ <td valign="top" style="width:125px;"><strong>Application:</strong></td>
+ <td>#application.applicationName#<cfif NOT Len(get("reloadPassword")) OR loc.hasAppTests> [<cfif NOT Len(get("reloadPassword"))><a href="#loc.baseReloadURL#true">Reload</a></cfif><cfif NOT Len(get("reloadPassword")) AND loc.hasAppTests>, </cfif><cfif loc.hasAppTests><a href="#get('webPath')##ListLast(request.cgi.script_name, '/')#?controller=wheels&action=wheels&view=tests&type=app&reload=true">Run Tests</a></cfif>]</cfif></td>
+ </tr>
+ <tr>
+ <td valign="top"><strong>Framework:</strong></td>
+ <td>Wheels #get("version")#<cfif loc.hasFrameworkTests> [<a href="#get('webPath')##ListLast(request.cgi.script_name, '/')#?controller=wheels&action=wheels&view=tests&type=core&reload=true">Run Tests</a>]</cfif></td>
+ </tr>
+ <tr>
+ <td valign="top"><strong>CFML Engine:</strong></td>
+ <td>#get("serverName")# #get("serverVersion")#</td>
+ </tr>
+ <tr>
+ <td valign="top"><strong>Default Data Source:</strong></td>
+ <td>#get("dataSourceName")#</td>
+ </tr>
+ <tr>
+ <td valign="top"><strong>Active Environment:</strong></td>
+ <td>#capitalize(get("environment"))#<cfif NOT Len(get("reloadPassword"))><cfset loc.environments = "design,development,testing,maintenance,production"> [<cfset loc.pos = 0><cfloop list="#loc.environments#" index="loc.i"><cfset loc.pos = loc.pos + 1><cfif get("environment") IS NOT loc.i><a href="#loc.baseReloadURL##loc.i#">#capitalize(loc.i)#</a><cfif ListLen(loc.environments) GT loc.pos>, </cfif></cfif></cfloop>]</cfif></td>
+ </tr>
+ <tr>
+ <td valign="top"><strong>URL Rewriting:</strong></td>
+ <td>#get("URLRewriting")#</td>
+ </tr>
+ <tr>
+ <td valign="top"><strong>URL Obfuscation:</strong></td>
+ <td><cfif get("obfuscateUrls")>On<cfelse>Off</cfif></td>
+ </tr>
+ <tr>
+ <td valign="top"><strong>Plugins:</strong></td>
+ <td><cfif StructCount(get("plugins")) IS NOT 0><cfset loc.count = 0><cfloop collection="#get('plugins')#" item="loc.i"><cfset loc.count = loc.count + 1><a href="#get('webPath')##ListLast(request.cgi.script_name, '/')#?controller=wheels&action=wheels&view=plugins&name=#LCase(loc.i)#">#loc.i#</a><cfif DirectoryExists(expandPath("#get('webPath')#/plugins/#LCase(loc.i)#/tests"))> [<a href="#get('webPath')##ListLast(request.cgi.script_name, '/')#?controller=wheels&action=wheels&view=tests&type=#LCase(loc.i)#&reload=true">Run Tests</a>]</cfif><cfif StructCount(get("plugins")) GT loc.count><br/></cfif></cfloop><cfelse>None</cfif></td>
+ </tr>
+ <cfif StructKeyExists(request.wheels.params, "route")>
+ <tr>
+ <td valign="top"><strong>Route:</strong></td>
+ <td>#request.wheels.params.route#</td>
+ </tr>
+ </cfif>
+ <tr>
+ <td valign="top"><strong>Controller:</strong></td>
+ <td>#request.wheels.params.controller#</td>
+ </tr>
+ <tr>
+ <td valign="top"><strong>Action:</strong></td>
+ <td>#request.wheels.params.action#</td>
+ </tr>
+ <cfif StructKeyExists(request.wheels.params, "key")>
+ <tr>
+ <td valign="top"><strong>Key(s):</strong></td>
+ <td>#request.wheels.params.key#</td>
+ </tr>
+ </cfif>
+ <tr>
+ <td valign="top"><strong>Additional Params:</strong></td>
+ <td>
+ <cfset loc.additionalParamsExists = false>
+ <cfloop collection="#request.wheels.params#" item="loc.i">
+ <cfif loc.i IS NOT "fieldnames" AND loc.i IS NOT "route" AND loc.i IS NOT "controller" AND loc.i IS NOT "action" AND loc.i IS NOT "key">
+ <cfset loc.additionalParamsExists = true>
+ <cfif isStruct(request.wheels.params[loc.i])>
+ #lCase(loc.i)# = #SerializeJSON(request.wheels.params[loc.i])#<br />
+ <cfelseif IsArray(request.wheels.params[loc.i])>
+ #lCase(loc.i)# = #SerializeJSON(request.wheels.params[loc.i])#<br />
+ <cfelseif IsSimpleValue(request.wheels.params[loc.i])>
+ #lCase(loc.i)# = #request.wheels.params[loc.i]#<br />
+ </cfif>
+ </cfif>
+ </cfloop>
+ <cfif NOT loc.additionalParamsExists>
+ None
+ </cfif>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top"><strong>Caching Stats:</strong></td>
+ <td><cfset loc.keys = StructSort(request.wheels.cacheCounts, "textnocase")><cfloop from="1" to="#arrayLen(loc.keys)#" index="loc.i"><cfset loc.key = loc.keys[loc.i]>#LCase(loc.key)#: #request.wheels.cacheCounts[loc.key]#<cfif loc.i lt ArrayLen(loc.keys)>,</cfif> </cfloop></td>
+ </tr>
+ <tr>
+ <td valign="top"><strong>Execution Time:</strong></td>
+ <td>#request.wheels.execution.total#ms<cfif request.wheels.execution.total GT 0> (<cfset loc.keys = StructSort(request.wheels.execution, "numeric", "desc")><cfset loc.firstDone = false><cfloop from="1" to="#arrayLen(loc.keys)#" index="loc.i"><cfset loc.key = loc.keys[loc.i]><cfif loc.key IS NOT "total" AND request.wheels.execution[loc.key] GT 0><cfif loc.firstDone>, </cfif>#LCase(loc.key)# ~#request.wheels.execution[loc.key]#ms<cfset loc.firstDone = true></cfif></cfloop>)</cfif></td>
+ </tr>
+ </table>
+</div>
+
+</cfoutput>
\ No newline at end of file diff --git a/src/main/webapp/wheels/events/onrequeststart.cfm b/src/main/webapp/wheels/events/onrequeststart.cfm new file mode 100755 index 0000000..b5c1973 --- /dev/null +++ b/src/main/webapp/wheels/events/onrequeststart.cfm @@ -0,0 +1,84 @@ +<cffunction name="onRequestStart" returntype="void" access="public" output="false">
+ <cfargument name="targetPage" type="any" required="true">
+ <cfscript>
+ // abort if called from incorrect file
+ $abortInvalidRequest();
+
+ if(!StructKeyExists(application, "wheels"))
+ {
+ $simpleLock(execute="onApplicationStart", name="wheelsReloadLock", type="exclusive", timeout=180);
+ }
+
+ // need to setup the wheels struct up here since it's used to store debugging info below if this is a reload request
+ $initializeRequestScope();
+
+ // reload application by calling onApplicationStart if requested
+ if (StructKeyExists(URL, "reload") && (!StructKeyExists(application, "wheels") || !StructKeyExists(application.wheels, "reloadPassword") || !Len(application.wheels.reloadPassword) || (StructKeyExists(URL, "password") && URL.password == application.wheels.reloadPassword)))
+ {
+ $debugPoint("total,reload");
+ $simpleLock(execute="onApplicationStart", name="wheelsReloadLock", type="exclusive", timeout=180);
+ }
+
+ // run the rest of the request start code
+ $simpleLock(execute="$runOnRequestStart", executeArgs=arguments, name="wheelsReloadLock", type="readOnly", timeout=180);
+ </cfscript>
+</cffunction>
+
+<cffunction name="$runOnRequestStart" returntype="void" access="public" output="false">
+ <cfargument name="targetPage" type="any" required="true">
+ <cfscript>
+ var loc = {};
+
+ if (application.wheels.showDebugInformation)
+ {
+ // if the first debug point has not already been set in a reload request we set it here
+ if (StructKeyExists(request.wheels, "execution"))
+ $debugPoint("reload");
+ else
+ $debugPoint("total");
+ $debugPoint("requestStart");
+ request.wheels.deprecation = [];
+ }
+
+ // copy over the cgi variables we need to the request scope unless it's already been done on application start
+ if (!StructKeyExists(request, "cgi"))
+ request.cgi = $cgiScope();
+
+ // reload the plugins on each request if cachePlugins is set to false
+ if (!application.wheels.cachePlugins)
+ $loadPlugins();
+
+ // inject methods from plugins directly to Application.cfc
+ if (!StructIsEmpty(application.wheels.mixins))
+ $include(template="wheels/plugins/injection.cfm");
+
+ if (application.wheels.environment == "maintenance")
+ {
+ if (StructKeyExists(URL, "except"))
+ application.wheels.ipExceptions = URL.except;
+ if (!Len(application.wheels.ipExceptions) || !ListFind(application.wheels.ipExceptions, request.cgi.remote_addr))
+ {
+ $includeAndOutput(template="#application.wheels.eventPath#/onmaintenance.cfm");
+ $abort();
+ }
+ }
+
+ if (Right(arguments.targetPage, 4) == ".cfc")
+ {
+ StructDelete(this, "onRequest");
+ StructDelete(variables, "onRequest");
+ }
+
+ if (!application.wheels.cacheModelInitialization)
+ $simpleLock(name="modelLock", execute="$clearModelInitializationCache", type="exclusive");
+ if (!application.wheels.cacheControllerInitialization)
+ $simpleLock(name="controllerLock", execute="$clearControllerInitializationCache", type="exclusive");
+ if (!application.wheels.cacheRoutes)
+ $loadRoutes();
+ if (!application.wheels.cacheDatabaseSchema)
+ $clearCache("sql");
+ $include(template="#application.wheels.eventPath#/onrequeststart.cfm");
+ if (application.wheels.showDebugInformation)
+ $debugPoint("requestStart");
+ </cfscript>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/events/onsessionend.cfm b/src/main/webapp/wheels/events/onsessionend.cfm new file mode 100755 index 0000000..f84d30d --- /dev/null +++ b/src/main/webapp/wheels/events/onsessionend.cfm @@ -0,0 +1,15 @@ +<cffunction name="onSessionEnd" returntype="void" access="public" output="false">
+ <cfargument name="sessionscope" type="any" required="true">
+ <cfargument name="applicationscope" type="any" required="true">
+ <cfscript>
+ $simpleLock(execute="$runOnSessionEnd", executeArgs=arguments, name="wheelsReloadLock", type="readOnly", timeout=180);
+ </cfscript>
+</cffunction>
+
+<cffunction name="$runOnSessionEnd" returntype="void" access="public" output="false">
+ <cfargument name="sessionscope" type="any" required="true">
+ <cfargument name="applicationscope" type="any" required="true">
+ <cfscript>
+ $include(template="#application.wheels.eventPath#/onsessionend.cfm");
+ </cfscript>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/events/onsessionstart.cfm b/src/main/webapp/wheels/events/onsessionstart.cfm new file mode 100755 index 0000000..37f04c0 --- /dev/null +++ b/src/main/webapp/wheels/events/onsessionstart.cfm @@ -0,0 +1,12 @@ +<cffunction name="onSessionStart" returntype="void" access="public" output="false">
+ <cfscript>
+ $simpleLock(execute="$runOnSessionStart", name="wheelsReloadLock", type="readOnly", timeout=180);
+ </cfscript>
+</cffunction>
+
+<cffunction name="$runOnSessionStart" returntype="void" access="public" output="false">
+ <cfscript>
+ $initializeRequestScope();
+ $include(template="#application.wheels.eventPath#/onsessionstart.cfm");
+ </cfscript>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/functions.cfm b/src/main/webapp/wheels/functions.cfm new file mode 100755 index 0000000..d3e9cb1 --- /dev/null +++ b/src/main/webapp/wheels/functions.cfm @@ -0,0 +1,30 @@ +<cfset this.name = Hash(GetDirectoryFromPath(GetBaseTemplatePath()))>
+<cfset this.mappings["/wheelsMapping"] = GetDirectoryFromPath(GetBaseTemplatePath()) & "wheels">
+<cfset this.sessionManagement = true>
+<cfif StructKeyExists(server, "railo")>
+ <cfinclude template="../config/app.cfm">
+ <cfinclude template="controller/appfunctions.cfm">
+ <cfinclude template="global/appfunctions.cfm">
+ <cfinclude template="events/onapplicationend.cfm">
+ <cfinclude template="events/onapplicationstart.cfm">
+ <cfinclude template="events/onerror.cfm">
+ <cfinclude template="events/onmissingtemplate.cfm">
+ <cfinclude template="events/onsessionend.cfm">
+ <cfinclude template="events/onsessionstart.cfm">
+ <cfinclude template="events/onrequest.cfm">
+ <cfinclude template="events/onrequestend.cfm">
+ <cfinclude template="events/onrequeststart.cfm">
+<cfelse>
+ <cfinclude template="config/app.cfm">
+ <cfinclude template="wheels/controller/appfunctions.cfm">
+ <cfinclude template="wheels/global/appfunctions.cfm">
+ <cfinclude template="wheels/events/onapplicationend.cfm">
+ <cfinclude template="wheels/events/onapplicationstart.cfm">
+ <cfinclude template="wheels/events/onerror.cfm">
+ <cfinclude template="wheels/events/onmissingtemplate.cfm">
+ <cfinclude template="wheels/events/onsessionend.cfm">
+ <cfinclude template="wheels/events/onsessionstart.cfm">
+ <cfinclude template="wheels/events/onrequest.cfm">
+ <cfinclude template="wheels/events/onrequestend.cfm">
+ <cfinclude template="wheels/events/onrequeststart.cfm">
+</cfif>
\ No newline at end of file diff --git a/src/main/webapp/wheels/global/appfunctions.cfm b/src/main/webapp/wheels/global/appfunctions.cfm new file mode 100755 index 0000000..1d0949f --- /dev/null +++ b/src/main/webapp/wheels/global/appfunctions.cfm @@ -0,0 +1,11 @@ +<cfif StructKeyExists(server, "railo")>
+ <cfinclude template="cfml.cfm">
+ <cfinclude template="internal.cfm">
+ <cfinclude template="public.cfm">
+ <cfinclude template="../../events/functions.cfm">
+<cfelse>
+ <cfinclude template="wheels/global/cfml.cfm">
+ <cfinclude template="wheels/global/internal.cfm">
+ <cfinclude template="wheels/global/public.cfm">
+ <cfinclude template="events/functions.cfm">
+</cfif>
\ No newline at end of file diff --git a/src/main/webapp/wheels/global/cfml.cfm b/src/main/webapp/wheels/global/cfml.cfm new file mode 100755 index 0000000..d0dd134 --- /dev/null +++ b/src/main/webapp/wheels/global/cfml.cfm @@ -0,0 +1,242 @@ +<cffunction name="$namedReadLock" returntype="any" access="public" output="false">
+ <cfargument name="name" type="string" required="true">
+ <cfargument name="object" type="any" required="true">
+ <cfargument name="method" type="string" required="true">
+ <cfargument name="args" type="struct" required="false" default="#StructNew()#">
+ <cfargument name="timeout" type="numeric" required="false" default="30">
+ <cfset var loc = {}>
+ <cflock name="#arguments.name#" type="readonly" timeout="#arguments.timeout#">
+ <cfset loc.returnValue = $invoke(componentReference=arguments.object, method=arguments.method, invokeArgs=arguments.args)>
+ </cflock>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$doubleCheckedLock" returntype="any" access="public" output="false">
+ <cfargument name="name" type="string" required="true">
+ <cfargument name="condition" type="string" required="true">
+ <cfargument name="execute" type="string" required="true">
+ <cfargument name="conditionArgs" type="struct" required="false" default="#StructNew()#">
+ <cfargument name="executeArgs" type="struct" required="false" default="#StructNew()#">
+ <cfargument name="timeout" type="numeric" required="false" default="30">
+ <cfset var loc = {}>
+ <cfset loc.returnValue = $invoke(method=arguments.condition, invokeArgs=arguments.conditionArgs)>
+ <cfif IsBoolean(loc.returnValue) AND NOT loc.returnValue>
+ <cflock name="#arguments.name#" timeout="#arguments.timeout#">
+ <cfset loc.returnValue = $invoke(method=arguments.condition, invokeArgs=arguments.conditionArgs)>
+ <cfif IsBoolean(loc.returnValue) AND NOT loc.returnValue>
+ <cfset loc.returnValue = $invoke(method=arguments.execute, invokeArgs=arguments.executeArgs)>
+ </cfif>
+ </cflock>
+ </cfif>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$simpleLock" returntype="any" access="public" output="false">
+ <cfargument name="execute" type="string" required="true">
+ <cfargument name="executeArgs" type="struct" required="false" default="#StructNew()#">
+ <cfargument name="timeout" type="numeric" required="false" default="30">
+ <cfset var loc = {}>
+ <cfset loc.lockArgs = Duplicate(arguments)>
+ <cfset StructDelete(loc.lockArgs, "execute")>
+ <cfset StructDelete(loc.lockArgs, "executeArgs")>
+ <cfset arguments.executeArgs.$locked = true>
+ <cflock attributeCollection="#loc.lockArgs#">
+ <cfinvoke method="#arguments.execute#" argumentCollection="#arguments.executeArgs#" returnvariable="loc.returnValue">
+ </cflock>
+ <cfif StructKeyExists(loc, "returnValue")>
+ <cfreturn loc.returnValue>
+ </cfif>
+</cffunction>
+
+<cffunction name="$setting" returntype="void" access="public" output="false">
+ <cfsetting attributeCollection="#arguments#">
+</cffunction>
+
+<cffunction name="$image" returntype="struct" access="public" output="false">
+ <cfset var returnValue = {}>
+ <cfset arguments.structName = "returnValue">
+ <cfimage attributeCollection="#arguments#">
+ <cfreturn returnValue>
+</cffunction>
+
+<cffunction name="$mail" returntype="void" access="public" output="false">
+ <cfset var loc = {}>
+ <cfif StructKeyExists(arguments, "mailparts")>
+ <cfset loc.mailparts = arguments.mailparts>
+ <cfset StructDelete(arguments, "mailparts")>
+ </cfif>
+ <cfif StructKeyExists(arguments, "mailparams")>
+ <cfset loc.mailparams = arguments.mailparams>
+ <cfset StructDelete(arguments, "mailparams")>
+ </cfif>
+ <cfif StructKeyExists(arguments, "tagContent")>
+ <cfset loc.tagContent = arguments.tagContent>
+ <cfset StructDelete(arguments, "tagContent")>
+ </cfif>
+ <cfmail attributeCollection="#arguments#">
+ <cfif StructKeyExists(loc, "mailparams")>
+ <cfloop array="#loc.mailparams#" index="loc.i">
+ <cfmailparam attributeCollection="#loc.i#">
+ </cfloop>
+ </cfif>
+ <cfif StructKeyExists(loc, "mailparts")>
+ <cfloop array="#loc.mailparts#" index="loc.i">
+ <cfset loc.innerTagContent = loc.i.tagContent>
+ <cfset StructDelete(loc.i, "tagContent")>
+ <cfmailpart attributeCollection="#loc.i#">
+ #loc.innerTagContent#
+ </cfmailpart>
+ </cfloop>
+ </cfif>
+ <cfif StructKeyExists(loc, "tagContent")>
+ #loc.tagContent#
+ </cfif>
+ </cfmail>
+</cffunction>
+
+<cffunction name="$zip" returntype="any" access="public" output="false">
+ <cfzip attributeCollection="#arguments#">
+ </cfzip>
+</cffunction>
+
+<cffunction name="$cache" returntype="any" access="public" output="false">
+ <cfcache attributeCollection="#arguments#">
+</cffunction>
+
+<cffunction name="$content" returntype="any" access="public" output="false">
+ <cfcontent attributeCollection="#arguments#">
+</cffunction>
+
+<cffunction name="$header" returntype="void" access="public" output="false">
+ <cfheader attributeCollection="#arguments#">
+</cffunction>
+
+<cffunction name="$abort" returntype="void" access="public" output="false">
+ <cfabort attributeCollection="#arguments#">
+</cffunction>
+
+<cffunction name="$include" returntype="void" access="public" output="false">
+ <cfargument name="template" type="string" required="true">
+ <cfset var loc = {}>
+ <cfinclude template="../../#LCase(arguments.template)#">
+</cffunction>
+
+<cffunction name="$includeAndOutput" returntype="void" access="public" output="true">
+ <cfargument name="template" type="string" required="true">
+ <cfset var loc = {}>
+ <cfinclude template="../../#LCase(arguments.template)#">
+</cffunction>
+
+<cffunction name="$includeAndReturnOutput" returntype="string" access="public" output="false">
+ <cfargument name="$template" type="string" required="true">
+ <cfset var loc = {}>
+ <cfif StructKeyExists(arguments, "$type") AND arguments.$type IS "partial">
+ <!--- make it so the developer can reference passed in arguments in the loc scope if they prefer --->
+ <cfset loc = arguments>
+ </cfif>
+ <!--- we prefix returnValue with "wheels" here to make sure the variable does not get overwritten in the included template --->
+ <cfsavecontent variable="loc.wheelsReturnValue"><cfinclude template="../../#LCase(arguments.$template)#"></cfsavecontent>
+ <cfreturn loc.wheelsReturnValue>
+</cffunction>
+
+<cffunction name="$directory" returntype="any" access="public" output="false">
+ <cfset var returnValue = "">
+ <cfset arguments.name = "returnValue">
+ <cfdirectory attributeCollection="#arguments#">
+ <cfreturn returnValue>
+</cffunction>
+
+<cffunction name="$file" returntype="any" access="public" output="false">
+ <cfset var returnValue = "">
+ <cfset arguments.variable = "returnValue">
+ <cffile attributeCollection="#arguments#">
+ <cfreturn returnValue>
+</cffunction>
+
+<cffunction name="$throw" returntype="void" access="public" output="false">
+ <cfthrow attributeCollection="#arguments#">
+</cffunction>
+
+<cffunction name="$invoke" returntype="any" access="public" output="false">
+ <cfset var loc = {}>
+ <cfset arguments.returnVariable = "loc.returnValue">
+ <cfif StructKeyExists(arguments, "componentReference")>
+ <cfset arguments.component = arguments.componentReference>
+ <cfset StructDelete(arguments, "componentReference")>
+ <cfelseif NOT StructKeyExists(variables, arguments.method)>
+ <!--- this is done so that we can call dynamic methods via "onMissingMethod" on the object (we need to pass in the object for this so it can call methods on the "this" scope instead) --->
+ <cfset arguments.component = this>
+ </cfif>
+ <cfif StructKeyExists(arguments, "invokeArgs")>
+ <cfset arguments.argumentCollection = arguments.invokeArgs>
+ <cfset StructDelete(arguments, "invokeArgs")>
+ </cfif>
+ <cfinvoke attributeCollection="#arguments#">
+ <cfif StructKeyExists(loc, "returnValue")>
+ <cfreturn loc.returnValue>
+ </cfif>
+</cffunction>
+
+<cffunction name="$location" returntype="void" access="public" output="false">
+ <cfargument name="delay" type="boolean" required="false" default="false">
+ <cfset StructDelete(arguments, "$args", false)>
+ <cfif NOT arguments.delay>
+ <cfset StructDelete(arguments, "delay", false)>
+ <cfif arguments.url Contains "?" AND arguments.url Contains "##">
+ <!--- fix for cflocation anchor bug --->
+ <cfset arguments.url = Replace(arguments.url, "##", "&##")>
+ </cfif>
+ <cflocation attributeCollection="#arguments#">
+ </cfif>
+</cffunction>
+
+<cffunction name="$htmlhead" returntype="void" access="public" output="false">
+ <cfhtmlhead attributeCollection="#arguments#">
+</cffunction>
+
+<cffunction name="$dbinfo" returntype="any" access="public" output="false">
+ <cfset var loc = {}>
+ <cfset arguments.name = "loc.returnValue">
+ <cfif NOT Len(arguments.username)>
+ <cfset StructDelete(arguments, "username")>
+ </cfif>
+ <cfif NOT Len(arguments.password)>
+ <cfset StructDelete(arguments, "password")>
+ </cfif>
+ <cfdbinfo attributeCollection="#arguments#">
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$dump" returntype="void" access="public" output="true">
+ <cfargument name="var" type="any" required="true">
+ <cfargument name="abort" type="boolean" required="false" default="true">
+ <cfdump var="#arguments.var#">
+ <cfif arguments.abort>
+ <cfabort>
+ </cfif>
+</cffunction>
+
+<cffunction name="$objectcache" returntype="void" access="public" output="false">
+ <cfobjectcache attributeCollection="#arguments#">
+</cffunction>
+
+<cffunction name="$wddx" returntype="any" access="public" output="false">
+ <cfargument name="input" type="any" required="true">
+ <cfargument name="action" type="string" required="false" default="cfml2wddx">
+ <cfargument name="useTimeZoneInfo" type="boolean" required="false" default="true">
+ <cfset var loc = {}>
+ <cfset arguments.output = "loc.output">
+ <cfwddx attributeCollection="#arguments#">
+ <cfif StructKeyExists(loc, "output")>
+ <cfreturn loc.output>
+ </cfif>
+</cffunction>
+
+<cffunction name="$structDelete" returntype="void" access="public" output="false">
+ <cfargument name="myStruct" type="struct" required="true">
+ <cfargument name="keys" type="string" required="true">
+ <cfset var loc = {}>
+ <cfloop list="#arguments.keys#" index="loc.i">
+ <cfset StructDelete(arguments.myStruct, loc.i, false)>
+ </cfloop>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/global/functions.cfm b/src/main/webapp/wheels/global/functions.cfm new file mode 100755 index 0000000..8b0da07 --- /dev/null +++ b/src/main/webapp/wheels/global/functions.cfm @@ -0,0 +1,4 @@ +<cfinclude template="cfml.cfm">
+<cfinclude template="internal.cfm">
+<cfinclude template="public.cfm">
+<cfinclude template="../../events/functions.cfm">
\ No newline at end of file diff --git a/src/main/webapp/wheels/global/internal.cfm b/src/main/webapp/wheels/global/internal.cfm new file mode 100755 index 0000000..d76fd10 --- /dev/null +++ b/src/main/webapp/wheels/global/internal.cfm @@ -0,0 +1,894 @@ +<cffunction name="$initializeRequestScope" returntype="void" access="public" output="false">
+ <cfscript>
+ if (!StructKeyExists(request, "wheels"))
+ {
+ request.wheels = {};
+ request.wheels.params = {};
+ request.wheels.cache = {};
+
+ // create a structure to track the transaction status for all adapters
+ request.wheels.transactions = {};
+
+ // store cache info for output in debug area
+ request.wheels.cacheCounts = {};
+ request.wheels.cacheCounts.hits = 0;
+ request.wheels.cacheCounts.misses = 0;
+ request.wheels.cacheCounts.culls = 0;
+ }
+ </cfscript>
+</cffunction>
+
+<cffunction name="$toXml" returntype="xml" access="public" output="false">
+ <cfargument name="data" type="any" required="true">
+ <cfscript>
+ // only instantiate the toXml object once per request
+ if (!StructKeyExists(request.wheels, "toXml"))
+ request.wheels.toXml = $createObjectFromRoot(path="#application.wheels.wheelsComponentPath#.vendor.toXml", fileName="toXML", method="init");
+ </cfscript>
+ <cfreturn request.wheels.toXml.toXml(arguments.data) />
+</cffunction>
+
+<cffunction name="$convertToString" returntype="string" access="public" output="false">
+ <cfargument name="value" type="Any" required="true">
+ <cfargument name="type" type="string" required="false" default="">
+ <cfscript>
+ var loc = {};
+
+ if (!len(arguments.type))
+ {
+ if (IsArray(arguments.value))
+ {
+ arguments.type = "array";
+ }
+ else if (IsStruct(arguments.value))
+ {
+ arguments.type = "struct";
+ }
+ else if (IsBinary(arguments.value))
+ {
+ arguments.type = "binary";
+ }
+ else if (IsNumeric(arguments.value))
+ {
+ arguments.type = "integer";
+ }
+ else if (IsDate(arguments.value))
+ {
+ arguments.type = "datetime";
+ }
+ }
+
+ switch (arguments.type)
+ {
+ case "array":
+ arguments.value = ArrayToList(arguments.value);
+ break;
+ case "struct":
+ loc.str = "";
+ loc.keyList = ListSort(StructKeyList(arguments.value), "textnocase", "asc");
+ loc.iEnd = ListLen(loc.keyList);
+ for (loc.i = 1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.key = ListGetAt(loc.keyList, loc.i);
+ loc.str = ListAppend(loc.str, loc.key & "=" & arguments.value[loc.key]);
+ }
+ arguments.value = loc.str;
+ break;
+ case "binary":
+ arguments.value = ToString(arguments.value);
+ break;
+ case "float": case "integer":
+ arguments.value = Val(arguments.value);
+ break;
+ case "boolean":
+ arguments.value = ( arguments.value IS true );
+ break;
+ case "datetime":
+ // createdatetime will throw an error
+ if(IsDate(arguments.value))
+ {
+ arguments.value = CreateDateTime(year(arguments.value), month(arguments.value), day(arguments.value), hour(arguments.value), minute(arguments.value), second(arguments.value));
+ }
+ break;
+ }
+ </cfscript>
+ <cfreturn arguments.value>
+</cffunction>
+
+<cffunction name="$listClean" returntype="any" access="public" output="false" hint="removes whitespace between list elements. optional argument to return the list as an array.">
+ <cfargument name="list" type="string" required="true">
+ <cfargument name="delim" type="string" required="false" default=",">
+ <cfargument name="returnAs" type="string" required="false" default="string">
+ <cfscript>
+ var loc = {};
+ loc.list = ListToArray(arguments.list, arguments.delim);
+ for (loc.i = 1; loc.i lte ArrayLen(loc.list); loc.i++)
+ loc.list[loc.i] = Trim(loc.list[loc.i]);
+ if (arguments.returnAs == "array")
+ return loc.list;
+ </cfscript>
+ <cfreturn ArrayToList(loc.list, arguments.delim)>
+</cffunction>
+
+<cffunction name="$hashedKey" returntype="string" access="public" output="false" hint="Creates a unique string based on any arguments passed in (used as a key for caching mostly).">
+ <cfscript>
+ var loc = {};
+ loc.returnValue = "";
+
+ // we need to make sure we are looping through the passed in arguments in the same order everytime
+ loc.values = [];
+ loc.keyList = ListSort(StructKeyList(arguments), "textnocase", "asc");
+ loc.iEnd = ListLen(loc.keyList);
+ for (loc.i = 1; loc.i <= loc.iEnd; loc.i++)
+ ArrayAppend(loc.values, arguments[ListGetAt(loc.keyList, loc.i)]);
+
+ if (!ArrayIsEmpty(loc.values))
+ {
+ // this might fail if a query contains binary data so in those rare cases we fall back on using cfwddx (which is a little bit slower which is why we don't use it all the time)
+ try
+ {
+ loc.returnValue = SerializeJSON(loc.values);
+ // remove the characters that indicate array or struct so that we can sort it as a list below
+ loc.returnValue = ReplaceList(loc.returnValue, "{,},[,]", ",,,");
+ loc.returnValue = ListSort(loc.returnValue, "text");
+ }
+ catch (Any e)
+ {
+ loc.returnValue = $wddx(input=loc.values);
+ }
+ }
+ return Hash(loc.returnValue);
+ </cfscript>
+</cffunction>
+
+<cffunction name="$timeSpanForCache" returntype="any" access="public" output="false">
+ <cfargument name="cache" type="any" required="true">
+ <cfargument name="defaultCacheTime" type="numeric" required="false" default="#application.wheels.defaultCacheTime#">
+ <cfargument name="cacheDatePart" type="string" required="false" default="#application.wheels.cacheDatePart#">
+ <cfscript>
+ var loc = {};
+ loc.cache = arguments.defaultCacheTime;
+ if (IsNumeric(arguments.cache))
+ loc.cache = arguments.cache;
+ loc.list = "0,0,0,0";
+ loc.dateParts = "d,h,n,s";
+ loc.iEnd = ListLen(loc.dateParts);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ if (arguments.cacheDatePart == ListGetAt(loc.dateParts, loc.i))
+ loc.list = ListSetAt(loc.list, loc.i, loc.cache);
+ return CreateTimeSpan(ListGetAt(loc.list, 1),ListGetAt(loc.list, 2),ListGetAt(loc.list, 3),ListGetAt(loc.list, 4));
+ </cfscript>
+</cffunction>
+
+<cffunction name="$combineArguments" returntype="void" access="public" output="false">
+ <cfargument name="args" type="struct" required="true">
+ <cfargument name="combine" type="string" required="true">
+ <cfargument name="required" type="boolean" required="false" default="false">
+ <cfargument name="extendedInfo" type="string" required="false" default="">
+ <cfscript>
+ var loc = {};
+ loc.first = ListGetAt(arguments.combine, 1);
+ loc.second = ListGetAt(arguments.combine, 2);
+ if (StructKeyExists(arguments.args, loc.second))
+ {
+ arguments.args[loc.first] = arguments.args[loc.second];
+ StructDelete(arguments.args, loc.second);
+ }
+ if (arguments.required && application.wheels.showErrorInformation)
+ {
+ if (!StructKeyExists(arguments.args, loc.first) || !Len(arguments.args[loc.first]))
+ {
+ $throw(type="Wheels.IncorrectArguments", message="The `#loc.second#` or `#loc.first#` argument is required but was not passed in.", extendedInfo="#arguments.extendedInfo#");
+ }
+ }
+ </cfscript>
+</cffunction>
+
+<!--- helper method to recursively map a structure to build mapping paths and retrieve its values so you can have your way with a deeply nested structure --->
+<cffunction name="$mapStruct" returntype="void" access="public" output="false" mixin="dispatch">
+ <cfargument name="map" type="struct" required="true" />
+ <cfargument name="struct" type="struct" required="true" />
+ <cfargument name="path" type="string" required="false" default="" />
+ <cfscript>
+ var loc = {};
+ for (loc.item in arguments.struct)
+ {
+ if (IsStruct(arguments.struct[loc.item])) // go further down the rabit hole
+ {
+ $mapStruct(map=arguments.map, struct=arguments.struct[loc.item], path="#arguments.path#[#loc.item#]");
+ }
+ else // map our position and value
+ {
+ arguments.map["#arguments.path#[#loc.item#]"] = {};
+ arguments.map["#arguments.path#[#loc.item#]"].value = arguments.struct[loc.item];
+ }
+ }
+ </cfscript>
+</cffunction>
+
+<cffunction name="$structKeysExist" returntype="boolean" access="public" output="false" hint="Check to see if all keys in the list exist for the structure and have length.">
+ <cfargument name="struct" type="struct" required="true" />
+ <cfargument name="keys" type="string" required="false" default="" />
+ <cfscript>
+ var loc = {};
+ loc.returnValue = true;
+ loc.iEnd = ListLen(arguments.keys);
+ for (loc.i = 1; loc.i lte loc.iEnd; loc.i++)
+ {
+ if (!StructKeyExists(arguments.struct, ListGetAt(arguments.keys, loc.i)) || (IsSimpleValue(arguments.struct[ListGetAt(arguments.keys, loc.i)]) && !Len(arguments.struct[ListGetAt(arguments.keys, loc.i)])))
+ {
+ loc.returnValue = false;
+ break;
+ }
+ }
+ </cfscript>
+ <cfreturn loc.returnValue />
+</cffunction>
+
+<cffunction name="$cgiScope" returntype="struct" access="public" output="false" hint="This copies all the variables Wheels needs from the CGI scope to the request scope.">
+ <cfargument name="keys" type="string" required="false" default="request_method,http_x_requested_with,http_referer,server_name,path_info,script_name,query_string,remote_addr,server_port,server_port_secure,server_protocol,http_host,http_accept,content_type">
+ <cfscript>
+ var loc = {};
+ loc.returnValue = {};
+ loc.iEnd = ListLen(arguments.keys);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ loc.returnValue[ListGetAt(arguments.keys, loc.i)] = cgi[ListGetAt(arguments.keys, loc.i)];
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$dollarify" returntype="struct" access="public" output="false">
+ <cfargument name="input" type="struct" required="true">
+ <cfargument name="on" type="string" required="true">
+ <cfscript>
+ var loc = {};
+ for (loc.key in arguments.input)
+ {
+ if (ListFindNoCase(arguments.on, loc.key))
+ {
+ arguments.input["$"&loc.key] = arguments.input[loc.key];
+ StructDelete(arguments.input, loc.key);
+ }
+ }
+ </cfscript>
+ <cfreturn arguments.input>
+</cffunction>
+
+<cffunction name="$abortInvalidRequest" returntype="void" access="public" output="false">
+ <cfscript>
+ var applicationPath = Replace(GetCurrentTemplatePath(), "\", "/", "all");
+ var callingPath = Replace(GetBaseTemplatePath(), "\", "/", "all");
+ if (ListLen(callingPath, "/") GT ListLen(applicationPath, "/") || GetFileFromPath(callingPath) == "root.cfm")
+ {
+ $header(statusCode="404", statusText="Not Found");
+ $includeAndOutput(template="#application.wheels.eventPath#/onmissingtemplate.cfm");
+ $abort();
+ }
+ </cfscript>
+</cffunction>
+
+<cffunction name="$URLEncode" returntype="string" access="public" output="false">
+ <cfargument name="param" type="string" required="false" default="">
+ <cfscript>
+ var returnValue = "";
+ returnValue = URLEncodedFormat(arguments.param);
+ returnValue = ReplaceList(returnValue, "%24,%2D,%5F,%2E,%2B,%21,%2A,%27,%28,%29", "$,-,_,.,+,!,*,',(,)"); // these characters are safe so set them back to their original values.
+ </cfscript>
+ <cfreturn returnValue>
+</cffunction>
+
+<cffunction name="$routeVariables" returntype="string" access="public" output="false">
+ <cfscript>
+ var loc = {};
+ loc.route = $findRoute(argumentCollection=arguments);
+ loc.returnValue = loc.route.variables;
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$findRoute" returntype="struct" access="public" output="false">
+ <cfscript>
+ var loc = {};
+
+ // throw an error if a route with this name has not been set by developer in the config/routes.cfm file
+ if (application.wheels.showErrorInformation && !StructKeyExists(application.wheels.namedRoutePositions, arguments.route))
+ $throw(type="Wheels.RouteNotFound", message="Could not find the `#arguments.route#` route.", extendedInfo="Create a new route in `config/routes.cfm` with the name `#arguments.route#`.");
+
+ loc.routePos = application.wheels.namedRoutePositions[arguments.route];
+ if (loc.routePos Contains ",")
+ {
+ // there are several routes with this name so we need to figure out which one to use by checking the passed in arguments
+ loc.iEnd = ListLen(loc.routePos);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.returnValue = application.wheels.routes[ListGetAt(loc.routePos, loc.i)];
+ loc.foundRoute = true;
+ loc.jEnd = ListLen(loc.returnValue.variables);
+ for (loc.j=1; loc.j <= loc.jEnd; loc.j++)
+ {
+ loc.variable = ListGetAt(loc.returnValue.variables, loc.j);
+ if (!StructKeyExists(arguments, loc.variable) || !Len(arguments[loc.variable]))
+ loc.foundRoute = false;
+ }
+ if (loc.foundRoute)
+ break;
+ }
+ }
+ else
+ {
+ loc.returnValue = application.wheels.routes[loc.routePos];
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$cachedModelClassExists" returntype="any" access="public" output="false">
+ <cfargument name="name" type="string" required="true">
+ <cfscript>
+ var returnValue = false;
+ if (StructKeyExists(application.wheels.models, arguments.name))
+ returnValue = application.wheels.models[arguments.name];
+ </cfscript>
+ <cfreturn returnValue>
+</cffunction>
+
+<cffunction name="$constructParams" returntype="string" access="public" output="false">
+ <cfargument name="params" type="string" required="true">
+ <cfargument name="$URLRewriting" type="string" required="false" default="#application.wheels.URLRewriting#">
+ <cfscript>
+ var loc = {};
+ arguments.params = Replace(arguments.params, "&", "&", "all"); // change to using ampersand so we can use it as a list delim below and so we don't "double replace" the ampersand below
+ // when rewriting is off we will already have "?controller=" etc in the url so we have to continue with an ampersand
+ if (arguments.$URLRewriting == "Off")
+ loc.delim = "&";
+ else
+ loc.delim = "?";
+ loc.returnValue = "";
+ loc.iEnd = ListLen(arguments.params, "&");
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.temp = listToArray(ListGetAt(arguments.params, loc.i, "&"), "=");
+ loc.returnValue = loc.returnValue & loc.delim & loc.temp[1] & "=";
+ loc.delim = "&";
+ if (ArrayLen(loc.temp) == 2)
+ {
+ loc.param = $URLEncode(loc.temp[2]);
+ if (application.wheels.obfuscateUrls && !ListFindNoCase("cfid,cftoken", loc.temp[1]))
+ loc.param = obfuscateParam(loc.param);
+ loc.returnValue = loc.returnValue & loc.param;
+ }
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$args" returntype="void" access="public" output="false">
+ <cfargument name="args" type="struct" required="true">
+ <cfargument name="name" type="string" required="true">
+ <cfargument name="reserved" type="string" required="false" default="">
+ <cfargument name="combine" type="string" required="false" default="">
+ <cfargument name="required" type="string" required="false" default="">
+ <cfscript>
+ var loc = {};
+ if (Len(arguments.combine))
+ {
+ loc.iEnd = ListLen(arguments.combine);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.item = ListGetAt(arguments.combine, loc.i);
+ loc.first = ListGetAt(loc.item, 1, "/");
+ loc.second = ListGetAt(loc.item, 2, "/");
+ loc.required = false;
+ if (ListLen(loc.item, "/") > 2 || ListFindNoCase(loc.first, arguments.required))
+ {
+ loc.required = true;
+ }
+ $combineArguments(args=arguments.args, combine="#loc.first#,#loc.second#", required=loc.required);
+ }
+ }
+ if (application.wheels.showErrorInformation)
+ {
+ if (ListLen(arguments.reserved))
+ {
+ loc.iEnd = ListLen(arguments.reserved);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.item = ListGetAt(arguments.reserved, loc.i);
+ if (StructKeyExists(arguments.args, loc.item))
+ $throw(type="Wheels.IncorrectArguments", message="The `#loc.item#` argument cannot be passed in since it will be set automatically by Wheels.");
+ }
+ }
+ }
+ if (StructKeyExists(application.wheels.functions, arguments.name))
+ StructAppend(arguments.args, application.wheels.functions[arguments.name], false);
+
+ // make sure that the arguments marked as required exist
+ if (Len(arguments.required))
+ {
+ loc.iEnd = ListLen(arguments.required);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.arg = ListGetAt(arguments.required, loc.i);
+ if(!StructKeyExists(arguments.args, loc.arg))
+ {
+ $throw(type="Wheels.IncorrectArguments", message="The `#loc.arg#` argument is required but not passed in.");
+ }
+ }
+ }
+ </cfscript>
+</cffunction>
+
+<cffunction name="$createObjectFromRoot" returntype="any" access="public" output="false">
+ <cfargument name="path" type="string" required="true">
+ <cfargument name="fileName" type="string" required="true">
+ <cfargument name="method" type="string" required="true">
+ <cfscript>
+ var returnValue = "";
+ arguments.returnVariable = "returnValue";
+ arguments.component = ListChangeDelims(arguments.path, ".", "/") & "." & ListChangeDelims(arguments.fileName, ".", "/");
+ arguments.argumentCollection = Duplicate(arguments);
+ StructDelete(arguments, "path");
+ StructDelete(arguments, "fileName");
+ </cfscript>
+ <cfinclude template="../../root.cfm">
+ <cfreturn returnValue>
+</cffunction>
+
+<cffunction name="$debugPoint" returntype="void" access="public" output="false">
+ <cfargument name="name" type="string" required="true">
+ <cfscript>
+ var loc = {};
+ if (!StructKeyExists(request.wheels, "execution"))
+ request.wheels.execution = {};
+ loc.iEnd = ListLen(arguments.name);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.item = ListGetAt(arguments.name, loc.i);
+ if (StructKeyExists(request.wheels.execution, loc.item))
+ request.wheels.execution[loc.item] = GetTickCount() - request.wheels.execution[loc.item];
+ else
+ request.wheels.execution[loc.item] = GetTickCount();
+ }
+ </cfscript>
+</cffunction>
+
+<cffunction name="$cachedControllerClassExists" returntype="any" access="public" output="false">
+ <cfargument name="name" type="string" required="true">
+ <cfscript>
+ var returnValue = false;
+ if (StructKeyExists(application.wheels.controllers, arguments.name))
+ returnValue = application.wheels.controllers[arguments.name];
+ </cfscript>
+ <cfreturn returnValue>
+</cffunction>
+
+<cffunction name="$fileExistsNoCase" returntype="boolean" access="public" output="false">
+ <cfargument name="absolutePath" type="string" required="true">
+ <cfscript>
+ var loc = {};
+
+ // break up the full path string in the path name only and the file name only
+ loc.path = GetDirectoryFromPath(arguments.absolutePath);
+ loc.file = Replace(arguments.absolutePath, loc.path, "");
+
+ // get all existing files in the directory and place them in a list
+ loc.dirInfo = $directory(directory=loc.path);
+ loc.fileList = ValueList(loc.dirInfo.name);
+
+ // loop through the file list and return true if the file exists regardless of case (the == operator is case insensitive)
+ loc.iEnd = ListLen(loc.fileList);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ if (ListGetAt(loc.fileList, loc.i) == loc.file)
+ return true;
+
+ // the file wasn't found in the directory so we return false
+ return false;
+ </cfscript>
+</cffunction>
+
+<cffunction name="$objectFileName" returntype="string" access="public" output="false">
+ <cfargument name="name" type="string" required="true">
+ <cfargument name="objectPath" type="string" required="true">
+ <cfargument name="type" type="string" required="true" hint="Can be either `controller` or `model`." />
+ <cfscript>
+ var loc = {};
+ loc.objectFileExists = false;
+
+ // if the name contains the delimiter let's capitalize the last element and append it back to the list
+ if (ListLen(arguments.name, "/") gt 1)
+ arguments.name = ListInsertAt(arguments.name, ListLen(arguments.name, "/"), capitalize(ListLast(arguments.name, "/")), "/");
+ else
+ arguments.name = capitalize(arguments.name);
+
+ // we are going to store the full controller path in the existing / non-existing lists so we can have controllers in multiple places
+ loc.fullObjectPath = arguments.objectPath & "/" & arguments.name;
+
+ if (!ListFindNoCase(application.wheels.existingObjectFiles, loc.fullObjectPath) && !ListFindNoCase(application.wheels.nonExistingObjectFiles, loc.fullObjectPath))
+ {
+ if (FileExists(ExpandPath("#loc.fullObjectPath#.cfc")))
+ loc.objectFileExists = true;
+ if (application.wheels.cacheFileChecking)
+ {
+ if (loc.objectFileExists)
+ application.wheels.existingObjectFiles = ListAppend(application.wheels.existingObjectFiles, loc.fullObjectPath);
+ else
+ application.wheels.nonExistingObjectFiles = ListAppend(application.wheels.nonExistingObjectFiles, loc.fullObjectPath);
+ }
+ }
+ if (ListFindNoCase(application.wheels.existingObjectFiles, loc.fullObjectPath) || loc.objectFileExists)
+ loc.returnValue = arguments.name;
+ else
+ loc.returnValue = capitalize(arguments.type);
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$createControllerClass" returntype="any" access="public" output="false">
+ <cfargument name="name" type="string" required="true">
+ <cfargument name="controllerPaths" type="string" required="false" default="#application.wheels.controllerPath#">
+ <cfargument name="type" type="string" required="false" default="controller" />
+ <cfscript>
+ var loc = {};
+
+ // let's allow for multiple controller paths so that plugins can contain controllers
+ // the last path is the one we will instantiate the base controller on if the controller is not found on any of the paths
+ for (loc.i = 1; loc.i lte ListLen(arguments.controllerPaths); loc.i++)
+ {
+ loc.controllerPath = ListGetAt(arguments.controllerPaths, loc.i);
+ loc.fileName = $objectFileName(name=arguments.name, objectPath=loc.controllerPath, type=arguments.type);
+
+ if (loc.fileName != "Controller" || loc.i == ListLen(arguments.controllerPaths))
+ {
+ application.wheels.controllers[arguments.name] = $createObjectFromRoot(path=loc.controllerPath, fileName=loc.fileName, method="$initControllerClass", name=arguments.name);
+ loc.returnValue = application.wheels.controllers[arguments.name];
+ break;
+ }
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$addToCache" returntype="void" access="public" output="false">
+ <cfargument name="key" type="string" required="true">
+ <cfargument name="value" type="any" required="true">
+ <cfargument name="time" type="numeric" required="false" default="#application.wheels.defaultCacheTime#">
+ <cfargument name="category" type="string" required="false" default="main">
+ <cfscript>
+ var loc = {};
+ if (application.wheels.cacheCullPercentage > 0 && application.wheels.cacheLastCulledAt < DateAdd("n", -application.wheels.cacheCullInterval, Now()) && $cacheCount() >= application.wheels.maximumItemsToCache)
+ {
+ // cache is full so flush out expired items from this cache to make more room if possible
+ loc.deletedItems = 0;
+ loc.cacheCount = $cacheCount();
+ for (loc.key in application.wheels.cache[arguments.category])
+ {
+ if (Now() > application.wheels.cache[arguments.category][loc.key].expiresAt)
+ {
+ $removeFromCache(key=loc.key, category=arguments.category);
+ if (application.wheels.cacheCullPercentage < 100)
+ {
+ loc.deletedItems++;
+ loc.percentageDeleted = (loc.deletedItems / loc.cacheCount) * 100;
+ if (loc.percentageDeleted >= application.wheels.cacheCullPercentage)
+ break;
+ }
+ }
+ }
+ application.wheels.cacheLastCulledAt = Now();
+ }
+ if ($cacheCount() < application.wheels.maximumItemsToCache)
+ {
+ application.wheels.cache[arguments.category][arguments.key] = {};
+ application.wheels.cache[arguments.category][arguments.key].expiresAt = DateAdd(application.wheels.cacheDatePart, arguments.time, Now());
+ if (IsSimpleValue(arguments.value))
+ application.wheels.cache[arguments.category][arguments.key].value = arguments.value;
+ else
+ application.wheels.cache[arguments.category][arguments.key].value = duplicate(arguments.value);
+ }
+ </cfscript>
+</cffunction>
+
+<cffunction name="$getFromCache" returntype="any" access="public" output="false">
+ <cfargument name="key" type="string" required="true">
+ <cfargument name="category" type="string" required="false" default="main">
+ <cfscript>
+ var loc = {};
+ loc.returnValue = false;
+ if (StructKeyExists(application.wheels.cache[arguments.category], arguments.key))
+ {
+ if (Now() > application.wheels.cache[arguments.category][arguments.key].expiresAt)
+ {
+ if (application.wheels.showDebugInformation)
+ request.wheels.cacheCounts.culls = request.wheels.cacheCounts.culls + 1;
+ $removeFromCache(key=arguments.key, category=arguments.category);
+ }
+ else
+ {
+ if (application.wheels.showDebugInformation)
+ request.wheels.cacheCounts.hits = request.wheels.cacheCounts.hits + 1;
+ if (IsSimpleValue(application.wheels.cache[arguments.category][arguments.key].value))
+ loc.returnValue = application.wheels.cache[arguments.category][arguments.key].value;
+ else
+ loc.returnValue = Duplicate(application.wheels.cache[arguments.category][arguments.key].value);
+ }
+ }
+
+ if (application.wheels.showDebugInformation && IsBoolean(loc.returnValue) && !loc.returnValue)
+ request.wheels.cacheCounts.misses = request.wheels.cacheCounts.misses + 1;
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$removeFromCache" returntype="void" access="public" output="false">
+ <cfargument name="key" type="string" required="true">
+ <cfargument name="category" type="string" required="false" default="main">
+ <cfset StructDelete(application.wheels.cache[arguments.category], arguments.key)>
+</cffunction>
+
+<cffunction name="$cacheCount" returntype="numeric" access="public" output="false">
+ <cfargument name="category" type="string" required="false" default="">
+ <cfscript>
+ var loc = {};
+ if (Len(arguments.category))
+ {
+ loc.returnValue = StructCount(application.wheels.cache[arguments.category]);
+ }
+ else
+ {
+ loc.returnValue = 0;
+ for (loc.key in application.wheels.cache)
+ loc.returnValue = loc.returnValue + StructCount(application.wheels.cache[loc.key]);
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$clearCache" returntype="void" access="public" output="false">
+ <cfargument name="category" type="string" required="false" default="">
+ <cfscript>
+ var loc = {};
+ if (Len(arguments.category))
+ {
+ StructClear(application.wheels.cache[arguments.category]);
+ }
+ else
+ {
+ StructClear(application.wheels.cache);
+ }
+ </cfscript>
+</cffunction>
+
+<cffunction name="$createModelClass" returntype="any" access="public" output="false">
+ <cfargument name="name" type="string" required="true">
+ <cfargument name="modelPaths" type="string" required="false" default="#application.wheels.modelPath#">
+ <cfargument name="type" type="string" required="false" default="model" />
+ <cfscript>
+ var loc = {};
+ // let's allow for multiple controller paths so that plugins can contain controllers
+ // the last path is the one we will instantiate the base controller on if the controller is not found on any of the paths
+ for (loc.i = 1; loc.i lte ListLen(arguments.modelPaths); loc.i++)
+ {
+ loc.modelPath = ListGetAt(arguments.modelPaths, loc.i);
+ loc.fileName = $objectFileName(name=arguments.name, objectPath=loc.modelPath, type=arguments.type);
+
+ if (loc.fileName != arguments.type || loc.i == ListLen(arguments.modelPaths))
+ {
+ application.wheels.models[arguments.name] = $createObjectFromRoot(path=loc.modelPath, fileName=loc.fileName, method="$initModelClass", name=arguments.name);
+ loc.returnValue = application.wheels.models[arguments.name];
+ break;
+ }
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<!---
+Used to announce to the developer that a feature they are using will be removed at some point.
+DOES NOT work in production mode.
+
+To use call $deprecated() from within the method you want to deprecate. You may pass an optional
+custom message if desired. The method will return a structure containing the message and information
+about where the deprecation occurrs like the called method, line number, template name and shows the
+code that called the deprcated method.
+
+Example:
+
+Original foo()
+<cffunction name="foo" returntype="any" access="public" output="false">
+ <cfargument name="baz" type="numeric" required="true">
+ <cfreturn baz++>
+</cffunction>
+
+Should now call bar() instead and marking foo() as deprecated
+<cffunction name="foo" returntype="any" access="public" output="false">
+ <cfargument name="baz" type="numeric" required="true">
+ <cfset $deprecated("Calling foo is now deprecated, use bar() instead.")>
+ <cfreturn bar(argumentscollection=arguments)>
+</cffunction>
+
+<cffunction name="bar" returntype="any" access="public" output="false">
+ <cfargument name="baz" type="numeric" required="true">
+ <cfreturn ++baz>
+</cffunction>
+ --->
+<cffunction name="$deprecated" returntype="struct" access="public" output="false">
+ <!--- a message to display instead of the default one. --->
+ <cfargument name="message" type="string" required="false" default="You are using deprecated behavior which will be removed from the next major or minor release.">
+ <!--- should you announce the deprecation. only used when writing tests. --->
+ <cfargument name="announce" type="boolean" required="false" default="true">
+ <cfset var loc = {}>
+ <cfset loc.ret = {}>
+ <cfset loc.tagcontext = []>
+ <cfif not application.wheels.showDebugInformation>
+ <cfreturn loc.ret>
+ </cfif>
+ <!--- set return value --->
+ <cfset loc.data = []>
+ <cfset loc.ret = {message=arguments.message, line="", method="", template="", data=loc.data}>
+ <!---
+ create an exception so we can get the TagContext and display what file and line number the
+ deprecated method is being called in
+ --->
+ <cftry>
+ <cfthrow type="Expression">
+ <cfcatch type="any">
+ <cfset loc.exception = cfcatch>
+ </cfcatch>
+ </cftry>
+ <cfif StructKeyExists(loc.exception, "tagcontext")>
+ <cfset loc.tagcontext = loc.exception.tagcontext>
+ </cfif>
+ <!---
+ TagContext is an array. The first element of the array will always be the context for this
+ method announcing the deprecation. The second element will be the deprecated function that
+ is being called. We need to look at the third element of the array to get the method that
+ is calling the method marked for deprecation.
+ --->
+ <cfif isArray(loc.tagcontext) and arraylen(loc.tagcontext) gte 3 and isStruct(loc.tagcontext[3])>
+ <!--- grab and parse the information from the tagcontext. --->
+ <cfset loc.context = loc.tagcontext[3]>
+ <!--- the line number --->
+ <cfset loc.ret.line = loc.context.line>
+ <!--- the deprecated method that was called --->
+ <cfif StructKeyExists(server, "railo")>
+ <cfset loc.ret.method = rereplacenocase(loc.context.codePrintPlain, '.*\<cffunction name="([^"]*)">.*', "\1")>
+ <cfelse>
+ <cfset loc.ret.method = rereplacenocase(loc.context.raw_trace, ".*\$func([^\.]*)\..*", "\1")>
+ </cfif>
+ <!--- the user template where the method called occurred --->
+ <cfset loc.ret.template = loc.context.template>
+ <!--- try to get the code --->
+ <cfif len(loc.ret.template) and FileExists(loc.ret.template)>
+ <!--- grab a one line radius from where the deprecation occurred. --->
+ <cfset loc.startAt = loc.ret.line - 1>
+ <cfif loc.startAt lte 0>
+ <cfset loc.startAt = loc.ret.line>
+ </cfif>
+ <cfset loc.stopAt = loc.ret.line + 1>
+ <cfset loc.counter = 1>
+ <cfloop file="#loc.ret.template#" index="loc.i">
+ <cfif loc.counter gte loc.startAt and loc.counter lte loc.stopAt>
+ <cfset arrayappend(loc.ret.data, loc.i)>
+ </cfif>
+ <cfif loc.counter gt loc.stopAt>
+ <cfbreak>
+ </cfif>
+ <cfset loc.counter++>
+ </cfloop>
+ </cfif>
+ <!--- change template name from full to relative path. --->
+ <cfset loc.ret.template = listchangedelims(removechars(loc.ret.template, 1, len(expandpath(application.wheels.webpath))), "/", "\/")>
+ </cfif>
+ <!--- append --->
+ <cfif arguments.announce>
+ <cfset arrayappend(request.wheels.deprecation, loc.ret)>
+ </cfif>
+ <cfreturn loc.ret>
+</cffunction>
+
+<cffunction name="$loadRoutes" returntype="void" access="public" output="false">
+ <cfscript>
+ // clear out the route info
+ ArrayClear(application.wheels.routes);
+ StructClear(application.wheels.namedRoutePositions);
+
+ // load developer routes first
+ $include(template="#application.wheels.configPath#/routes.cfm");
+
+ // add the wheels default routes at the end if requested
+ if (application.wheels.loadDefaultRoutes)
+ addDefaultRoutes();
+
+ // set lookup info for the named routes
+ $setNamedRoutePositions();
+ </cfscript>
+</cffunction>
+
+<cffunction name="$setNamedRoutePositions" returntype="void" access="public" output="false">
+ <cfscript>
+ var loc = {};
+ loc.iEnd = ArrayLen(application.wheels.routes);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.route = application.wheels.routes[loc.i];
+ if (StructKeyExists(loc.route, "name") && len(loc.route.name))
+ {
+ if (!StructKeyExists(application.wheels.namedRoutePositions, loc.route.name))
+ application.wheels.namedRoutePositions[loc.route.name] = "";
+ application.wheels.namedRoutePositions[loc.route.name] = ListAppend(application.wheels.namedRoutePositions[loc.route.name], loc.i);
+ }
+ }
+ </cfscript>
+</cffunction>
+
+<cffunction name="$clearModelInitializationCache">
+ <cfset StructClear(application.wheels.models)>
+</cffunction>
+
+<cffunction name="$clearControllerInitializationCache">
+ <cfset StructClear(application.wheels.controllers)>
+</cffunction>
+
+<cffunction name="$checkMinimumVersion" access="public" returntype="boolean" output="false">
+ <cfargument name="version" type="string" required="true">
+ <cfargument name="minversion" type="string" required="true">
+ <cfscript>
+ var loc = {};
+
+ arguments.version = ListChangeDelims(arguments.version, ".", ".,");
+ arguments.minversion = ListChangeDelims(arguments.minversion, ".", ".,");
+
+ arguments.version = ListToArray(arguments.version, ".");
+ arguments.minversion = ListToArray(arguments.minversion, ".");
+
+ // make version and minversion the same length pad zeros to the end
+ loc.minSize = max(ArrayLen(arguments.version), ArrayLen(arguments.minversion));
+
+ ArrayResize(arguments.version, loc.minSize);
+ ArrayResize(arguments.minversion, loc.minSize);
+
+ for(loc.i=1; loc.i LTE loc.minSize; loc.i++)
+ {
+ loc.version = 0;
+ if(ArrayIsDefined(arguments.version, loc.i))
+ {
+ loc.version = val(arguments.version[loc.i]);
+ }
+
+ loc.minversion = 0;
+ if(ArrayIsDefined(arguments.minversion, loc.i))
+ {
+ loc.minversion = val(arguments.minversion[loc.i]);
+ }
+
+ if(loc.version gt loc.minversion)
+ {
+ return true;
+ }
+
+ if(loc.version lt loc.minversion)
+ {
+ return false;
+ }
+ }
+
+ return true;
+ </cfscript>
+ <cfreturn >
+</cffunction>
+
+<cffunction name="$loadPlugins" returntype="void" access="public" output="false">
+ <cfscript>
+ application.wheels.PluginObj = $createObjectFromRoot(
+ path="wheels"
+ ,fileName="Plugins"
+ ,method="init"
+ ,pluginPath="#application.wheels.webPath & application.wheels.pluginPath#"
+ );
+
+ application.wheels.plugins = application.wheels.PluginObj.getPlugins();
+ application.wheels.incompatiblePlugins = application.wheels.PluginObj.getIncompatiblePlugins();
+ application.wheels.dependantPlugins = application.wheels.PluginObj.getDependantPlugins();
+ application.wheels.mixins = application.wheels.PluginObj.getMixins();
+ </cfscript>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/global/public.cfm b/src/main/webapp/wheels/global/public.cfm new file mode 100755 index 0000000..a0ad61f --- /dev/null +++ b/src/main/webapp/wheels/global/public.cfm @@ -0,0 +1,615 @@ +<!--- PUBLIC CONFIGURATION FUNCTIONS --->
+
+<cffunction name="addFormat" returntype="void" access="public" output="false" hint="Adds a new MIME format to your Wheels application for use with responding to multiple formats."
+ examples='
+ <!--- Add the `js` format --->
+ <cfset addFormat(extension="js", mimeType="text/javascript")>
+
+ <!--- Add the `ppt` and `pptx` formats --->
+ <cfset addFormat(extension="ppt", mimeType="application/vnd.ms-powerpoint")>
+ <cfset addFormat(extension="pptx", mimeType="application/vnd.ms-powerpoint")>
+ '
+ categories="configuration" chapters="responding-with-multiple-formats" functions="provides,renderWith">
+ <cfargument name="extension" type="string" required="true" hint="File extension to add." />
+ <cfargument name="mimeType" type="string" required="true" hint="Matching MIME type to associate with the file extension." />
+ <cfset application.wheels.formats[arguments.extension] = arguments.mimeType />
+</cffunction>
+
+<cffunction name="addRoute" returntype="void" access="public" output="false" hint="Adds a new route to your application."
+ examples=
+ '
+ <!--- Example 1: Adds a route which will invoke the `profile` action on the `user` controller with `params.userName` set when the URL matches the `pattern` argument --->
+ <cfset addRoute(name="userProfile", pattern="user/[username]", controller="user", action="profile")>
+
+ <!--- Example 2: Category/product URLs. Note the order of precedence is such that the more specific route should be defined first so Wheels will fall back to the less-specific version if it''s not found --->
+ <cfset addRoute(name="product", pattern="products/[categorySlug]/[productSlug]", controller="products", action="product")>
+ <cfset addRoute(name="productCategory", pattern="products/[categorySlug]", controller="products", action="category")>
+ <cfset addRoute(name="products", pattern="products", controller="products", action="index")>
+
+ <!--- Example 3: Change the `home` route. This should be listed last because it is least specific --->
+ <cfset addRoute(name="home", pattern="", controller="main", action="index")>
+ '
+ categories="configuration" chapters="using-routes" functions="">
+ <cfargument name="name" type="string" required="false" default="" hint="Name for the route. This is referenced as the `name` argument in functions based on @URLFor like @linkTo, @startFormTag, etc.">
+ <cfargument name="pattern" type="string" required="true" hint="The URL pattern that the route will match.">
+ <cfargument name="controller" type="string" required="false" default="" hint="Controller to call when route matches (unless the controller name exists in the pattern).">
+ <cfargument name="action" type="string" required="false" default="" hint="Action to call when route matches (unless the action name exists in the pattern).">
+ <cfscript>
+ var loc = {};
+
+ // throw errors when controller or action is not passed in as arguments and not included in the pattern
+ if (!Len(arguments.controller) && arguments.pattern Does Not Contain "[controller]")
+ $throw(type="Wheels.IncorrectArguments", message="The `controller` argument is not passed in or included in the pattern.", extendedInfo="Either pass in the `controller` argument to specifically tell Wheels which controller to call or include it in the pattern to tell Wheels to determine it dynamically on each request based on the incoming URL.");
+ if (!Len(arguments.action) && arguments.pattern Does Not Contain "[action]")
+ $throw(type="Wheels.IncorrectArguments", message="The `action` argument is not passed in or included in the pattern.", extendedInfo="Either pass in the `action` argument to specifically tell Wheels which action to call or include it in the pattern to tell Wheels to determine it dynamically on each request based on the incoming URL.");
+
+ loc.thisRoute = Duplicate(arguments);
+ loc.thisRoute.variables = "";
+ if (Find(".", loc.thisRoute.pattern))
+ {
+ loc.thisRoute.format = ListLast(loc.thisRoute.pattern, ".");
+ loc.thisRoute.formatVariable = ReplaceList(loc.thisRoute.format, "[,]", "");
+ loc.thisRoute.pattern = ListFirst(loc.thisRoute.pattern, ".");
+ }
+ loc.iEnd = ListLen(loc.thisRoute.pattern, "/");
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.item = ListGetAt(loc.thisRoute.pattern, loc.i, "/");
+
+ if (REFind("^\[", loc.item))
+ loc.thisRoute.variables = ListAppend(loc.thisRoute.variables, ReplaceList(loc.item, "[,]", ""));
+ }
+ ArrayAppend(application.wheels.routes, loc.thisRoute);
+ </cfscript>
+</cffunction>
+
+<cffunction name="addDefaultRoutes" returntype="void" access="public" output="false" hint="Adds the default Wheels routes (for example, `[controller]/[action]/[key]`, etc.) to your application. Only use this method if you have set `loadDefaultRoutes` to `false` and want to control exactly where in the route order you want to place the default routes."
+ examples=
+ '
+ <!--- Adds the default routes to your application (done in `config/routes.cfm`) --->
+ <cfset addDefaultRoutes()>
+ '
+ categories="configuration" chapters="using-routes" functions="">
+ <cfscript>
+ addRoute(pattern="[controller]/[action]/[key]");
+ addRoute(pattern="[controller]/[action]");
+ addRoute(pattern="[controller]", action="index");
+ </cfscript>
+</cffunction>
+
+<cffunction name="set" returntype="void" access="public" output="false" hint="Use to configure a global setting or set a default for a function."
+ examples=
+ '
+ <!--- Example 1: Set the `URLRewriting` setting to `Partial` --->
+ <cfset set(URLRewriting="Partial")>
+
+ <!--- Example 2: Set default values for the arguments in the `buttonTo` view helper. This works for the majority of Wheels functions/arguments. --->
+ <cfset set(functionName="buttonTo", onlyPath=true, host="", protocol="", port=0, text="", confirm="", image="", disable="")>
+
+ <!--- Example 3: Set the default values for a form helper to get the form marked up to your preferences --->
+ <cfset set(functionName="textField", labelPlacement="before", prependToLabel="<div>", append="</div>", appendToLabel="<br />")>
+ '
+ categories="configuration" chapters="configuration-and-defaults" functions="get">
+ <cfscript>
+ var loc = {};
+ if (ArrayLen(arguments) > 1)
+ {
+ for (loc.key in arguments)
+ {
+ if (loc.key != "functionName")
+ for (loc.i = 1; loc.i lte listlen(arguments.functionName); loc.i = loc.i + 1) {
+ application.wheels.functions[Trim(ListGetAt(arguments.functionName, loc.i))][loc.key] = arguments[loc.key];
+ }
+ }
+ }
+ else
+ {
+ application.wheels[StructKeyList(arguments)] = arguments[1];
+ }
+ </cfscript>
+</cffunction>
+
+<!--- PUBLIC GLOBAL FUNCTIONS --->
+
+<!--- miscellaneous --->
+
+<cffunction name="controller" returntype="any" access="public" output="false" hint="Creates and returns a controller object with your own custom `name` and `params`. Used primarily for testing purposes."
+ examples='
+ <cfset testController = controller("users", params)>
+ '
+ categories="global,miscellaneous" chapters="" functions="">
+ <cfargument name="name" type="string" required="true" hint="Name of the controller to create.">
+ <cfargument name="params" type="struct" required="false" default="#StructNew()#" hint="The params struct (combination of `form` and `URL` variables).">
+ <cfscript>
+ var loc = {};
+ loc.args = {};
+ loc.args.name = arguments.name;
+ loc.returnValue = $doubleCheckedLock(name="controllerLock", condition="$cachedControllerClassExists", execute="$createControllerClass", conditionArgs=loc.args, executeArgs=loc.args);
+ if (!StructIsEmpty(arguments.params))
+ loc.returnValue = loc.returnValue.$createControllerObject(arguments.params);
+ return loc.returnValue;
+ </cfscript>
+</cffunction>
+
+<cffunction name="deobfuscateParam" returntype="string" access="public" output="false" hint="Deobfuscates a value."
+ examples=
+ '
+ <!--- Get the original value from an obfuscated one --->
+ <cfset originalValue = deobfuscateParam("b7ab9a50")>
+ '
+ categories="global,miscellaneous" chapters="obfuscating-urls" functions="obfuscateParam">
+ <cfargument name="param" type="string" required="true" hint="Value to deobfuscate.">
+ <cfscript>
+ var loc = {};
+ if (Val(SpanIncluding(arguments.param, "0,1,2,3,4,5,6,7,8,9")) != arguments.param)
+ {
+ try
+ {
+ loc.checksum = Left(arguments.param, 2);
+ loc.returnValue = Right(arguments.param, (Len(arguments.param)-2));
+ loc.z = BitXor(InputBasen(loc.returnValue,16),461);
+ loc.returnValue = "";
+ loc.iEnd = Len(loc.z)-1;
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ loc.returnValue = loc.returnValue & Left(Right(loc.z, loc.i),1);
+ loc.checksumtest = "0";
+ loc.iEnd = Len(loc.returnValue);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ loc.checksumtest = (loc.checksumtest + Left(Right(loc.returnValue, loc.i),1));
+ loc.c1 = ToString(FormatBaseN((loc.checksumtest+154),10));
+ loc.c2 = InputBasen(loc.checksum, 16);
+ if (loc.c1 != loc.c2)
+ loc.returnValue = arguments.param;
+ }
+ catch(Any e)
+ {
+ loc.returnValue = arguments.param;
+ }
+ }
+ else
+ {
+ loc.returnValue = arguments.param;
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="get" returntype="any" access="public" output="false" hint="Returns the current setting for the supplied Wheels setting or the current default for the supplied Wheels function argument."
+ examples=
+ '
+ <!--- Get the current value for the `tableNamePrefix` Wheels setting --->
+ <cfset setting = get("tableNamePrefix")>
+
+ <!--- Get the default for the `message` argument of the `validatesConfirmationOf` method --->
+ <cfset setting = get(functionName="validatesConfirmationOf", name="message")>
+ '
+ categories="global,miscellaneous" chapters="configuration-and-defaults" functions="set">
+ <cfargument name="name" type="string" required="true" hint="Variable name to get setting for.">
+ <cfargument name="functionName" type="string" required="false" default="" hint="Function name to get setting for.">
+ <cfscript>
+ var loc = {};
+ if (Len(arguments.functionName))
+ loc.returnValue = application.wheels.functions[arguments.functionName][arguments.name];
+ else
+ loc.returnValue = application.wheels[arguments.name];
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="model" returntype="any" access="public" output="false" hint="Returns a reference to the requested model so that class level methods can be called on it."
+ examples=
+ '
+ <!--- The `model("author")` part of the code below gets a reference to the model from the application scope, and then the `findByKey` class level method is called on it --->
+ <cfset authorObject = model("author").findByKey(1)>
+ '
+ categories="global,miscellaneous" chapters="object-relational-mapping" functions="">
+ <cfargument name="name" type="string" required="true" hint="Name of the model to get a reference to.">
+ <cfreturn $doubleCheckedLock(name="modelLock", condition="$cachedModelClassExists", execute="$createModelClass", conditionArgs=arguments, executeArgs=arguments)>
+</cffunction>
+
+<cffunction name="obfuscateParam" returntype="string" access="public" output="false" hint="Obfuscates a value. Typically used for hiding primary key values when passed along in the URL."
+ examples=
+ '
+ <!--- Obfuscate the primary key value `99` --->
+ <cfset newValue = obfuscateParam(99)>
+ '
+ categories="global,miscellaneous" chapters="obfuscating-urls" functions="deobfuscateParam">
+ <cfargument name="param" type="any" required="true" hint="Value to obfuscate.">
+ <cfscript>
+ var loc = {};
+ if (IsValid("integer", arguments.param) && IsNumeric(arguments.param) && arguments.param > 0)
+ {
+ // railo strips leading zeros from integers so do this for both engines
+ arguments.param = Val(SpanIncluding(arguments.param, "0,1,2,3,4,5,6,7,8,9"));
+ loc.iEnd = Len(arguments.param);
+ loc.a = (10^loc.iEnd) + Reverse(arguments.param);
+ loc.b = "0";
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ loc.b = (loc.b + Left(Right(arguments.param, loc.i), 1));
+ loc.returnValue = FormatBaseN((loc.b+154),16) & FormatBaseN(BitXor(loc.a,461),16);
+ }
+ else
+ {
+ loc.returnValue = arguments.param;
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="pluginNames" returntype="string" access="public" output="false" hint="Returns a list of all installed plugins' names."
+ examples=
+ '
+ <!--- Check if the Scaffold plugin is installed --->
+ <cfif ListFindNoCase("scaffold", pluginNames())>
+ <!--- do something cool --->
+ </cfif>
+ '
+ categories="global,miscellaneous" chapters="using-and-creating-plugins" functions="">
+ <cfreturn StructKeyList(application.wheels.plugins)>
+</cffunction>
+
+<cffunction name="URLFor" returntype="string" access="public" output="false" hint="Creates an internal URL based on supplied arguments."
+ examples=
+ '
+ <!--- Create the URL for the `logOut` action on the `account` controller, typically resulting in `/account/log-out` --->
+ ##URLFor(controller="account", action="logOut")##
+
+ <!--- Create a URL with an anchor set on it --->
+ ##URLFor(action="comments", anchor="comment10")##
+
+ <!--- Create a URL based on a route called `products`, which expects params for `categorySlug` and `productSlug` --->
+ ##URLFor(route="product", categorySlug="accessories", productSlug="battery-charger")##
+ '
+ categories="global,miscellaneous" chapters="request-handling,linking-pages" functions="redirectTo,linkTo,startFormTag">
+ <cfargument name="route" type="string" required="false" default="" hint="Name of a route that you have configured in `config/routes.cfm`.">
+ <cfargument name="controller" type="string" required="false" default="" hint="Name of the controller to include in the URL.">
+ <cfargument name="action" type="string" required="false" default="" hint="Name of the action to include in the URL.">
+ <cfargument name="key" type="any" required="false" default="" hint="Key(s) to include in the URL.">
+ <cfargument name="params" type="string" required="false" default="" hint="Any additional params to be set in the query string.">
+ <cfargument name="anchor" type="string" required="false" default="" hint="Sets an anchor name to be appended to the path.">
+ <cfargument name="onlyPath" type="boolean" required="false" hint="If `true`, returns only the relative URL (no protocol, host name or port).">
+ <cfargument name="host" type="string" required="false" hint="Set this to override the current host.">
+ <cfargument name="protocol" type="string" required="false" hint="Set this to override the current protocol.">
+ <cfargument name="port" type="numeric" required="false" hint="Set this to override the current port number.">
+ <cfargument name="$URLRewriting" type="string" required="false" default="#application.wheels.URLRewriting#">
+ <cfscript>
+ var loc = {};
+ $args(name="URLFor", args=arguments);
+ loc.params = {};
+ if (StructKeyExists(variables, "params"))
+ StructAppend(loc.params, variables.params, true);
+ if (application.wheels.showErrorInformation)
+ {
+ if (arguments.onlyPath && (Len(arguments.host) || Len(arguments.protocol)))
+ $throw(type="Wheels.IncorrectArguments", message="Can't use the `host` or `protocol` arguments when `onlyPath` is `true`.", extendedInfo="Set `onlyPath` to `false` so that `linkTo` will create absolute URLs and thus allowing you to set the `host` and `protocol` on the link.");
+ }
+
+ // get primary key values if an object was passed in
+ if (IsObject(arguments.key))
+ {
+ arguments.key = arguments.key.key();
+ }
+
+ // build the link
+ loc.returnValue = application.wheels.webPath & ListLast(request.cgi.script_name, "/");
+ if (Len(arguments.route))
+ {
+ // link for a named route
+ loc.route = $findRoute(argumentCollection=arguments);
+ if (arguments.$URLRewriting == "Off")
+ {
+ loc.returnValue = loc.returnValue & "?controller=";
+ if (Len(arguments.controller))
+ loc.returnValue = loc.returnValue & hyphenize(arguments.controller);
+ else
+ loc.returnValue = loc.returnValue & hyphenize(loc.route.controller);
+ loc.returnValue = loc.returnValue & "&action=";
+ if (Len(arguments.action))
+ loc.returnValue = loc.returnValue & hyphenize(arguments.action);
+ else
+ loc.returnValue = loc.returnValue & hyphenize(loc.route.action);
+ // add it the format if it exists
+ if (StructKeyExists(loc.route, "formatVariable") && StructKeyExists(arguments, loc.route.formatVariable))
+ loc.returnValue = loc.returnValue & "&#loc.route.formatVariable#=#arguments[loc.route.formatVariable]#";
+ loc.iEnd = ListLen(loc.route.variables);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.property = ListGetAt(loc.route.variables, loc.i);
+ if (loc.property != "controller" && loc.property != "action")
+ loc.returnValue = loc.returnValue & "&" & loc.property & "=" & $URLEncode(arguments[loc.property]);
+ }
+ }
+ else
+ {
+ loc.iEnd = ListLen(loc.route.pattern, "/");
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.property = ListGetAt(loc.route.pattern, loc.i, "/");
+ if (loc.property Contains "[")
+ {
+ loc.property = Mid(loc.property, 2, Len(loc.property)-2);
+ if (application.wheels.showErrorInformation && !StructKeyExists(arguments, loc.property))
+ $throw(type="Wheels", message="Incorrect Arguments", extendedInfo="The route chosen by Wheels `#loc.route.name#` requires the argument `#loc.property#`. Pass the argument `#loc.property#` or change your routes to reflect the proper variables needed.");
+ loc.param = $URLEncode(arguments[loc.property]);
+ if (loc.property == "controller" || loc.property == "action")
+ loc.param = hyphenize(loc.param);
+ else if (application.wheels.obfuscateUrls)
+ loc.param = obfuscateParam(loc.param);
+ loc.returnValue = loc.returnValue & "/" & loc.param; // get param from arguments
+ }
+ else
+ {
+ loc.returnValue = loc.returnValue & "/" & loc.property; // add hard coded param from route
+ }
+ }
+ // add it the format if it exists
+ if (StructKeyExists(loc.route, "formatVariable") && StructKeyExists(arguments, loc.route.formatVariable))
+ loc.returnValue = loc.returnValue & ".#arguments[loc.route.formatVariable]#";
+ }
+ }
+ else // link based on controller/action/key
+ {
+ // when no controller or action was passed in we link to the current page (controller/action only, not query string etc) by default
+ if (!Len(arguments.controller) && !Len(arguments.action) && StructKeyExists(loc.params, "action"))
+ arguments.action = loc.params.action;
+ if (!Len(arguments.controller) && StructKeyExists(loc.params, "controller"))
+ arguments.controller = loc.params.controller;
+ if (Len(arguments.key) && !Len(arguments.action) && StructKeyExists(loc.params, "action"))
+ arguments.action = loc.params.action;
+ loc.returnValue = loc.returnValue & "?controller=" & hyphenize(arguments.controller);
+ if (Len(arguments.action))
+ loc.returnValue = loc.returnValue & "&action=" & hyphenize(arguments.action);
+ if (Len(arguments.key))
+ {
+ loc.param = $URLEncode(arguments.key);
+ if (application.wheels.obfuscateUrls)
+ loc.param = obfuscateParam(loc.param);
+ loc.returnValue = loc.returnValue & "&key=" & loc.param;
+ }
+ }
+
+ if (arguments.$URLRewriting != "Off")
+ {
+ loc.returnValue = Replace(loc.returnValue, "?controller=", "/");
+ loc.returnValue = Replace(loc.returnValue, "&action=", "/");
+ loc.returnValue = Replace(loc.returnValue, "&key=", "/");
+ }
+ if (arguments.$URLRewriting == "On")
+ {
+ loc.returnValue = Replace(loc.returnValue, application.wheels.rewriteFile, "");
+ loc.returnValue = Replace(loc.returnValue, "//", "/");
+ }
+
+ if (Len(arguments.params))
+ loc.returnValue = loc.returnValue & $constructParams(params=arguments.params, $URLRewriting=arguments.$URLRewriting);
+ if (Len(arguments.anchor))
+ loc.returnValue = loc.returnValue & "##" & arguments.anchor;
+
+ if (!arguments.onlyPath)
+ {
+ if (arguments.port != 0)
+ loc.returnValue = ":" & arguments.port & loc.returnValue; // use the port that was passed in by the developer
+ else if (request.cgi.server_port != 80 && request.cgi.server_port != 443)
+ loc.returnValue = ":" & request.cgi.server_port & loc.returnValue; // if the port currently in use is not 80 or 443 we set it explicitly in the URL
+ if (Len(arguments.host))
+ loc.returnValue = arguments.host & loc.returnValue;
+ else
+ loc.returnValue = request.cgi.server_name & loc.returnValue;
+ if (Len(arguments.protocol))
+ {
+ loc.returnValue = arguments.protocol & "://" & loc.returnValue;
+ }
+ else if (request.cgi.server_port_secure)
+ {
+ loc.returnValue = "https://" & loc.returnValue;
+ }
+ else
+ {
+ loc.returnValue = "http://" & loc.returnValue;
+ }
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<!--- string helpers --->
+
+<cffunction name="capitalize" returntype="string" access="public" output="false" hint="Returns the text with the first character converted to uppercase."
+ examples=
+ '
+ <!--- Capitalize a sentence, will result in "Wheels is a framework" --->
+ ##capitalize("wheels is a framework")##
+ '
+ categories="global,string" chapters="miscellaneous-helpers" functions="humanize,pluralize,singularize">
+ <cfargument name="text" type="string" required="true" hint="Text to capitalize.">
+ <cfif !Len(arguments.text)>
+ <cfreturn arguments.text />
+ </cfif>
+ <cfreturn UCase(Left(arguments.text, 1)) & Mid(arguments.text, 2, Len(arguments.text)-1)>
+</cffunction>
+
+<cffunction name="humanize" returntype="string" access="public" output="false" hint="Returns readable text by capitalizing and converting camel casing to multiple words."
+ examples=
+ '
+ <!--- Humanize a string, will result in "Wheels Is A Framework" --->
+ ##humanize("wheelsIsAFramework")##
+
+ <!--- Humanize a string, force wheels to replace "Cfml" with "CFML" --->
+ ##humanize("wheelsIsACFMLFramework", "CFML")##
+ '
+ categories="global,string" chapters="miscellaneous-helpers" functions="capitalize,pluralize,singularize">
+ <cfargument name="text" type="string" required="true" hint="Text to humanize.">
+ <cfargument name="except" type="string" required="false" default="" hint="a list of strings (space separated) to replace within the output.">
+ <cfscript>
+ var loc = {};
+ loc.returnValue = REReplace(arguments.text, "([[:upper:]])", " \1", "all"); // adds a space before every capitalized word
+ loc.returnValue = REReplace(loc.returnValue, "([[:upper:]]) ([[:upper:]])(?:\s|\b)", "\1\2", "all"); // fixes abbreviations so they form a word again (example: aURLVariable)
+ if (Len(arguments.except))
+ {
+ loc.iEnd = ListLen(arguments.except, " ");
+ for (loc.i = 1; loc.i lte loc.iEnd; loc.i++)
+ {
+ loc.a = ListGetAt(arguments.except, loc.i);
+ loc.returnValue = ReReplaceNoCase(loc.returnValue, "#loc.a#(?:\b)", "#loc.a#", "all");
+ }
+ }
+ loc.returnValue = Trim(capitalize(loc.returnValue)); // capitalize the first letter and trim final result (which removes the leading space that happens if the string starts with an upper case character)
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="pluralize" returntype="string" access="public" output="false" hint="Returns the plural form of the passed in word. Can also pluralize a word based on a value passed to the `count` argument."
+ examples=
+ '
+ <!--- Pluralize a word, will result in "people" --->
+ ##pluralize("person")##
+
+ <!--- Pluralize based on the count passed in --->
+ Your search returned ##pluralize(word="person", count=users.RecordCount)##
+ '
+ categories="global,string" chapters="miscellaneous-helpers" functions="capitalize,humanize,singularize">
+ <cfargument name="word" type="string" required="true" hint="The word to pluralize.">
+ <cfargument name="count" type="numeric" required="false" default="-1" hint="Pluralization will occur when this value is not `1`.">
+ <cfargument name="returnCount" type="boolean" required="false" default="true" hint="Will return `count` prepended to the pluralization when `true` and `count` is not `-1`.">
+ <cfreturn $singularizeOrPluralize(text=arguments.word, which="pluralize", count=arguments.count, returnCount=arguments.returnCount)>
+</cffunction>
+
+<cffunction name="singularize" returntype="string" access="public" output="false" hint="Returns the singular form of the passed in word."
+ examples=
+ '
+ <!--- Singularize a word, will result in "language" --->
+ ##singularize("languages")##
+ '
+ categories="global,string" chapters="miscellaneous-helpers" functions="capitalize,humanize,pluralize">
+ <cfargument name="word" type="string" required="true" hint="String to singularize.">
+ <cfreturn $singularizeOrPluralize(text=arguments.word, which="singularize")>
+</cffunction>
+
+<cffunction name="toXHTML" returntype="string" access="public" output="false" hint="Returns an XHTML-compliant string."
+ examples=
+ '
+ <!--- Outputs `productId=5&categoryId=12&returningCustomer=1` --->
+ <cfoutput>
+ ##toXHTML("productId=5&categoryId=12&returningCustomer=1")##
+ </cfoutput>
+ '
+ categories="global,string" chapters="" functions="">
+ <cfargument name="text" type="string" required="true" hint="String to make XHTML-compliant.">
+ <cfset arguments.text = Replace(arguments.text, "&", "&", "all")>
+ <cfreturn arguments.text>
+</cffunction>
+
+<cffunction name="mimeTypes" returntype="string" access="public" output="false" hint="Returns an associated MIME type based on a file extension."
+ examples=
+ '
+ <!--- Get the internally-stored MIME type for `xls` --->
+ <cfset mimeType = mimeTypes("xls")>
+
+ <!--- Get the internally-stored MIME type for a dynamic value. Fall back to a MIME type of `text/plain` if it''s not found --->
+ <cfset mimeType = mimeTypes(extension=params.type, fallback="text/plain")>
+ '
+ categories="global,miscellaneous" chapters="" functions="">
+ <cfargument name="extension" required="true" type="string" hint="The extension to get the MIME type for.">
+ <cfargument name="fallback" required="false" type="string" default="application/octet-stream" hint="the fallback MIME type to return.">
+ <cfif StructKeyExists(application.wheels.mimetypes, arguments.extension)>
+ <cfset arguments.fallback = application.wheels.mimetypes[arguments.extension]>
+ </cfif>
+ <cfreturn arguments.fallback>
+</cffunction>
+
+<cffunction name="hyphenize" returntype="string" access="public" output="false" hint="Converts camelCase strings to lowercase strings with hyphens as word delimiters instead. Example: `myVariable` becomes `my-variable`."
+ examples=
+ '
+ <!--- Outputs "my-blog-post" --->
+ <cfoutput>
+ ##hyphenize("myBlogPost")##
+ </cfoutput>
+ '
+ categories="global,string" chapters="" functions="">
+ <cfargument name="string" type="string" required="true" hint="The string to hyphenize.">
+ <cfset arguments.string = REReplace(arguments.string, "([A-Z][a-z])", "-\l\1", "all")>
+ <cfset arguments.string = REReplace(arguments.string, "([a-z])([A-Z])", "\1-\l\2", "all")>
+ <cfset arguments.string = REReplace(arguments.string, "^-", "", "one")>
+ <cfreturn LCase(arguments.string)>
+</cffunction>
+
+<!--- PRIVATE FUNCTIONS --->
+
+<cffunction name="$singularizeOrPluralize" returntype="string" access="public" output="false" hint="Called by singularize and pluralize to perform the conversion.">
+ <cfargument name="text" type="string" required="true">
+ <cfargument name="which" type="string" required="true">
+ <cfargument name="count" type="numeric" required="false" default="-1">
+ <cfargument name="returnCount" type="boolean" required="false" default="true">
+ <cfscript>
+ var loc = {};
+
+ // by default we pluralize/singularize the entire string
+ loc.text = arguments.text;
+
+ // when count is 1 we don't need to pluralize at all so just set the return value to the input string
+ loc.returnValue = loc.text;
+
+ if (arguments.count != 1)
+ {
+
+ if (REFind("[A-Z]", loc.text))
+ {
+ // only pluralize/singularize the last part of a camelCased variable (e.g. in "websiteStatusUpdate" we only change the "update" part)
+ // also set a variable with the unchanged part of the string (to be prepended before returning final result)
+ loc.upperCasePos = REFind("[A-Z]", Reverse(loc.text));
+ loc.prepend = Mid(loc.text, 1, Len(loc.text)-loc.upperCasePos);
+ loc.text = Reverse(Mid(Reverse(loc.text), 1, loc.upperCasePos));
+ }
+ loc.uncountables = "advice,air,blood,deer,equipment,fish,food,furniture,garbage,graffiti,grass,homework,housework,information,knowledge,luggage,mathematics,meat,milk,money,music,pollution,research,rice,sand,series,sheep,soap,software,species,sugar,traffic,transportation,travel,trash,water,feedback";
+ loc.irregulars = "child,children,foot,feet,man,men,move,moves,person,people,sex,sexes,tooth,teeth,woman,women";
+ if (ListFindNoCase(loc.uncountables, loc.text))
+ loc.returnValue = loc.text;
+ else if (ListFindNoCase(loc.irregulars, loc.text))
+ {
+ loc.pos = ListFindNoCase(loc.irregulars, loc.text);
+ if (arguments.which == "singularize" && loc.pos MOD 2 == 0)
+ loc.returnValue = ListGetAt(loc.irregulars, loc.pos-1);
+ else if (arguments.which == "pluralize" && loc.pos MOD 2 != 0)
+ loc.returnValue = ListGetAt(loc.irregulars, loc.pos+1);
+ else
+ loc.returnValue = loc.text;
+ }
+ else
+ {
+ if (arguments.which == "pluralize")
+ loc.ruleList = "(quiz)$,\1zes,^(ox)$,\1en,([m|l])ouse$,\1ice,(matr|vert|ind)ix|ex$,\1ices,(x|ch|ss|sh)$,\1es,([^aeiouy]|qu)y$,\1ies,(hive)$,\1s,(?:([^f])fe|([lr])f)$,\1\2ves,sis$,ses,([ti])um$,\1a,(buffal|tomat|potat|volcan|her)o$,\1oes,(bu)s$,\1ses,(alias|status)$,\1es,(octop|vir)us$,\1i,(ax|test)is$,\1es,s$,s,$,s";
+ else if (arguments.which == "singularize")
+ loc.ruleList = "(quiz)zes$,\1,(matr)ices$,\1ix,(vert|ind)ices$,\1ex,^(ox)en,\1,(alias|status)es$,\1,([octop|vir])i$,\1us,(cris|ax|test)es$,\1is,(shoe)s$,\1,(o)es$,\1,(bus)es$,\1,([m|l])ice$,\1ouse,(x|ch|ss|sh)es$,\1,(m)ovies$,\1ovie,(s)eries$,\1eries,([^aeiouy]|qu)ies$,\1y,([lr])ves$,\1f,(tive)s$,\1,(hive)s$,\1,([^f])ves$,\1fe,(^analy)ses$,\1sis,((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$,\1\2sis,([ti])a$,\1um,(n)ews$,\1ews,(.*)?ss$,\1ss,s$,#Chr(7)#";
+ loc.rules = ArrayNew(2);
+ loc.count = 1;
+ loc.iEnd = ListLen(loc.ruleList);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i=loc.i+2)
+ {
+ loc.rules[loc.count][1] = ListGetAt(loc.ruleList, loc.i);
+ loc.rules[loc.count][2] = ListGetAt(loc.ruleList, loc.i+1);
+ loc.count = loc.count + 1;
+ }
+ loc.iEnd = ArrayLen(loc.rules);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ if(REFindNoCase(loc.rules[loc.i][1], loc.text))
+ {
+ loc.returnValue = REReplaceNoCase(loc.text, loc.rules[loc.i][1], loc.rules[loc.i][2]);
+ break;
+ }
+ }
+ loc.returnValue = Replace(loc.returnValue, Chr(7), "", "all");
+ }
+
+ // this was a camelCased string and we need to prepend the unchanged part to the result
+ if (StructKeyExists(loc, "prepend"))
+ loc.returnValue = loc.prepend & loc.returnValue;
+
+ }
+
+ // return the count number in the string (e.g. "5 sites" instead of just "sites")
+ if (arguments.returnCount && arguments.count != -1)
+ loc.returnValue = LSNumberFormat(arguments.count) & " " & loc.returnValue;
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction> diff --git a/src/main/webapp/wheels/index.cfm b/src/main/webapp/wheels/index.cfm new file mode 100755 index 0000000..2b2b13f --- /dev/null +++ b/src/main/webapp/wheels/index.cfm @@ -0,0 +1 @@ +<cfoutput>#application.wheels.dispatch.$request()#</cfoutput>
\ No newline at end of file diff --git a/src/main/webapp/wheels/license.txt b/src/main/webapp/wheels/license.txt new file mode 100755 index 0000000..4947287 --- /dev/null +++ b/src/main/webapp/wheels/license.txt @@ -0,0 +1,177 @@ + + 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
\ No newline at end of file diff --git a/src/main/webapp/wheels/model.cfm b/src/main/webapp/wheels/model.cfm new file mode 100755 index 0000000..a14a373 --- /dev/null +++ b/src/main/webapp/wheels/model.cfm @@ -0,0 +1,3 @@ +<cfinclude template="global/functions.cfm">
+<cfinclude template="model/functions.cfm">
+<cfinclude template="plugins/injection.cfm">
\ No newline at end of file diff --git a/src/main/webapp/wheels/model/adapters/Base.cfc b/src/main/webapp/wheels/model/adapters/Base.cfc new file mode 100755 index 0000000..0e2eca3 --- /dev/null +++ b/src/main/webapp/wheels/model/adapters/Base.cfc @@ -0,0 +1,296 @@ +<cfcomponent output="false"> + <cfinclude template="../../global/cfml.cfm"> + + <cffunction name="init" access="public" returntype="any" output="false"> + <cfargument name="datasource" type="string" required="true"> + <cfargument name="username" type="string" required="true"> + <cfargument name="password" type="string" required="true"> + <cfset variables.instance.connection = arguments> + <cfreturn this> + </cffunction> + + <cffunction name="$tableName" returntype="string" access="public" output="false"> + <cfargument name="list" type="string" required="true"> + <cfargument name="action" type="string" required="true"> + <cfscript> + var loc = {}; + loc.returnValue = ""; + loc.iEnd = ListLen(arguments.list); + for (loc.i=1; loc.i <= loc.iEnd; loc.i++) + { + loc.iItem = ListGetAt(arguments.list, loc.i); + if (arguments.action == "remove") + loc.iItem = ListRest(loc.iItem, "."); // removes table names + loc.returnValue = ListAppend(loc.returnValue, loc.iItem); + } + </cfscript> + <cfreturn loc.returnValue> + </cffunction> + + <cffunction name="$columnAlias" returntype="string" access="public" output="false"> + <cfargument name="list" type="string" required="true"> + <cfargument name="action" type="string" required="true"> + <cfscript> + var loc = {}; + loc.returnValue = ""; + loc.iEnd = ListLen(arguments.list); + for (loc.i=1; loc.i <= loc.iEnd; loc.i++) + { + loc.iItem = ListGetAt(arguments.list, loc.i); + if (Find(" AS ", loc.iItem)) + { + loc.sort = ""; + if (Right(loc.iItem, 4) == " ASC" || Right(loc.iItem, 5) == " DESC") + { + loc.sort = " " & Reverse(SpanExcluding(Reverse(loc.iItem), " ")); + loc.iItem = Mid(loc.iItem, 1, Len(loc.iItem)-Len(loc.sort)); + } + loc.alias = Reverse(SpanExcluding(Reverse(loc.iItem), " ")); + if (arguments.action == "keep") + loc.iItem = loc.alias; // keeps the alias only + else if (arguments.action == "remove") + loc.iItem = Replace(loc.iItem, " AS " & loc.alias, ""); // removes the alias + loc.iItem = loc.iItem & loc.sort; + } + loc.returnValue = ListAppend(loc.returnValue, loc.iItem); + } + </cfscript> + <cfreturn loc.returnValue> + </cffunction> + + <cffunction name="$removeColumnAliasesInOrderClause" returntype="array" access="public" output="false"> + <cfargument name="sql" type="array" required="true"> + <cfscript> + var loc = {}; + loc.returnValue = arguments.sql; + if (IsSimpleValue(loc.returnValue[ArrayLen(loc.returnValue)]) && Left(loc.returnValue[ArrayLen(loc.returnValue)], 9) == "ORDER BY ") + { + // remove the column aliases from the order by clause (this is passed in so that we can handle sub queries with calculated properties) + loc.pos = ArrayLen(loc.returnValue); + loc.orderByClause = ReplaceNoCase(loc.returnValue[loc.pos], "ORDER BY ", ""); + loc.returnValue[loc.pos] = "ORDER BY " & $columnAlias(list=loc.orderByClause, action="remove"); + } + </cfscript> + <cfreturn loc.returnValue> + </cffunction> + + <cffunction name="$addColumnsToSelectAndGroupBy" returntype="array" access="public" output="false"> + <cfargument name="sql" type="array" required="true"> + <cfscript> + var loc = {}; + loc.returnValue = arguments.sql; + if (IsSimpleValue(loc.returnValue[ArrayLen(loc.returnValue)]) && Left(loc.returnValue[ArrayLen(loc.returnValue)], 8) IS "ORDER BY" && IsSimpleValue(loc.returnValue[ArrayLen(loc.returnValue)-1]) && Left(loc.returnValue[ArrayLen(loc.returnValue)-1], 8) IS "GROUP BY") + { + loc.iEnd = ListLen(loc.returnValue[ArrayLen(loc.returnValue)]); + for (loc.i=1; loc.i <= loc.iEnd; loc.i++) + { + loc.item = Trim(ReplaceNoCase(ReplaceNoCase(ReplaceNoCase(ListGetAt(loc.returnValue[ArrayLen(loc.returnValue)], loc.i), "ORDER BY ", ""), " ASC", ""), " DESC", "")); + if (!ListFindNoCase(ReplaceNoCase(loc.returnValue[ArrayLen(loc.returnValue)-1], "GROUP BY ", ""), loc.item)) + loc.returnValue[ArrayLen(loc.returnValue)-1] = ListAppend(loc.returnValue[ArrayLen(loc.returnValue)-1], loc.item); + if (!ListFindNoCase(ReplaceNoCase(loc.returnValue[1], "SELECT ", ""), loc.item)) + loc.returnValue[1] = ListAppend(loc.returnValue[1], loc.item); + } + } + </cfscript> + <cfreturn loc.returnValue> + </cffunction> + + <cffunction name="$getColumns" returntype="query" access="public" output="false" hint="retrieves all the column information from a table"> + <cfargument name="tableName" type="string" required="true" hint="the table to retrieve column information for"> + <cfscript> + var loc = {}; + loc.args = duplicate(variables.instance.connection); + loc.args.table = arguments.tableName; + if (application.wheels.showErrorInformation) + { + try + { + loc.columns = $getColumnInfo(argumentCollection=loc.args); + } + catch (Any e) + { + $throw(type="Wheels.TableNotFound", message="The `#arguments.tableName#` table could not be found in the database.", extendedInfo="Add a table named `#arguments.tableName#` to your database or tell Wheels to use a different table for this model. For example you can tell a `user` model to use a table called `tbl_users` by creating a `User.cfc` file in the `models` folder, creating an `init` method inside it and then calling `table(""tbl_users"")` from within it."); + } + } + else + { + loc.columns = $getColumnInfo(argumentCollection=loc.args); + } + </cfscript> + <cfreturn loc.columns> + </cffunction> + + <cffunction name="$getValidationType" returntype="string" access="public" output="false"> + <cfargument name="type" type="string" required="true"> + <cfswitch expression="#arguments.type#"> + <cfcase value="CF_SQL_DECIMAL,CF_SQL_DOUBLE,CF_SQL_FLOAT,CF_SQL_MONEY,CF_SQL_MONEY4,CF_SQL_NUMERIC,CF_SQL_REAL" delimiters=","> + <cfreturn "float"> + </cfcase> + <cfcase value="CF_SQL_INTEGER,CF_SQL_BIGINT,CF_SQL_SMALLINT,CF_SQL_TINYINT" delimiters=","> + <cfreturn "integer"> + </cfcase> + <cfcase value="CF_SQL_BINARY,CF_SQL_VARBINARY,CF_SQL_LONGVARBINARY,CF_SQL_BLOB,CF_SQL_CLOB" delimiters=","> + <cfreturn "binary"> + </cfcase> + <cfcase value="CF_SQL_DATE,CF_SQL_TIME,CF_SQL_TIMESTAMP" delimiters=","> + <cfreturn "datetime"> + </cfcase> + <cfcase value="CF_SQL_BIT" delimiters=","> + <cfreturn "boolean"> + </cfcase> + <cfcase value="CF_SQL_ARRAY" delimiters=","> + <cfreturn "array"> + </cfcase> + <cfcase value="CF_SQL_STRUCT" delimiters=","> + <cfreturn "struct"> + </cfcase> + <cfdefaultcase> + <cfreturn "string"> + </cfdefaultcase> + </cfswitch> + </cffunction> +
+ <cffunction name="$cleanInStatmentValue" returntype="string" access="public" output="false">
+ <cfargument name="statement" type="string" required="true">
+ <cfscript>
+ var loc = {};
+ loc.delim = ",";
+ if (Find("'", arguments.statement))
+ {
+ loc.delim = "','";
+ arguments.statement = RemoveChars(arguments.statement, 1, 1);
+ arguments.statement = reverse(RemoveChars(reverse(arguments.statement), 1, 1));
+ arguments.statement = Replace(arguments.statement, "''", "'", "all");
+ }
+ arguments.statement = ReplaceNoCase(arguments.statement, loc.delim, chr(7), "all");
+ </cfscript>
+ <cfreturn arguments.statement>
+ </cffunction>
+
+ <cffunction name="$CFQueryParameters" returntype="struct" access="public" output="false">
+ <cfargument name="settings" type="struct" required="true">
+ <cfscript> + var loc = {}; + + if(!StructKeyExists(arguments.settings, "value")) + { + $throw(type="Wheels.QueryParamValue", message="The value for cfqueryparam cannot be determined", extendedInfo="This is usually caused by a syantax error in the WHERE statement such as forgetting to quote strings."); + } +
+ loc.params = {};
+ loc.params.cfsqltype = arguments.settings.type;
+ loc.params.value = arguments.settings.value;
+ if (StructKeyExists(arguments.settings, "null"))
+ {
+ loc.params.null = arguments.settings.null;
+ }
+ if (StructKeyExists(arguments.settings, "scale") AND arguments.settings.scale GT 0)
+ {
+ loc.params.scale = arguments.settings.scale;
+ }
+ if (StructKeyExists(arguments.settings, "list") AND arguments.settings.list)
+ {
+ loc.params.list = arguments.settings.list;
+ loc.params.separator = chr(7);
+ loc.params.value = $cleanInStatmentValue(loc.params.value);
+ }
+ if (!IsBinary(loc.params.value) && loc.params.value eq "null")
+ {
+ loc.params.useNull = true;
+ }
+ </cfscript>
+ <cfreturn loc.params>
+ </cffunction>
+
+ <cffunction name="$performQuery" returntype="struct" access="public" output="false">
+ <cfargument name="sql" type="array" required="true">
+ <cfargument name="parameterize" type="boolean" required="true">
+ <cfargument name="limit" type="numeric" required="false" default="0">
+ <cfargument name="offset" type="numeric" required="false" default="0"> + <cfargument name="connection" type="struct" required="false" default="#variables.instance.connection#">
+ <cfargument name="$primaryKey" type="string" required="false" default="">
+ <cfscript>
+ var loc = {};
+ var query = {};
+
+ loc.returnValue = {};
+ loc.args = duplicate(arguments.connection);
+ loc.args.result = "loc.result";
+ loc.args.name = "query.name";
+ if (StructKeyExists(loc.args, "username") && !Len(loc.args.username)) + {
+ StructDelete(loc.args, "username", false); + } + if (StructKeyExists(loc.args, "password") && !Len(loc.args.password)) + { + StructDelete(loc.args, "password", false); + } + // set queries in Railo to not preserve single quotes on the entire + // cfquery block (we'll handle this individually in the SQL statement instead) + if (application.wheels.serverName == "Railo") + loc.args.psq = false; + + // overloaded arguments are settings for the query + loc.orgArgs = duplicate(arguments); + StructDelete(loc.orgArgs, "sql", false); + StructDelete(loc.orgArgs, "parameterize", false); + StructDelete(loc.orgArgs, "limit", false); + StructDelete(loc.orgArgs, "offset", false); + StructDelete(loc.orgArgs, "$primaryKey", false); + StructAppend(loc.args, loc.orgArgs, true); + </cfscript> + + <cfquery attributeCollection="#loc.args#"><cfloop array="#arguments.sql#" index="loc.i"><cfif IsStruct(loc.i)><cfset loc.queryParamAttributes = $CFQueryParameters(loc.i)><cfif StructKeyExists(loc.queryParamAttributes, "useNull")>NULL<cfelseif StructKeyExists(loc.queryParamAttributes, "list")><cfif arguments.parameterize>(<cfqueryparam attributeCollection="#loc.queryParamAttributes#">)<cfelse>(#PreserveSingleQuotes(loc.i.value)#)</cfif><cfelse><cfif arguments.parameterize><cfqueryparam attributeCollection="#loc.queryParamAttributes#"><cfelse>#$quoteValue(str=loc.i.value, sqlType=loc.i.type)#</cfif></cfif><cfelse><cfset loc.i = Replace(PreserveSingleQuotes(loc.i), "[[comma]]", ",", "all")>#PreserveSingleQuotes(loc.i)#</cfif>#chr(13)##chr(10)#</cfloop><cfif arguments.limit>LIMIT #arguments.limit#<cfif arguments.offset>#chr(13)##chr(10)#OFFSET #arguments.offset#</cfif></cfif></cfquery> + + <cfscript> + if (StructKeyExists(query, "name")) + loc.returnValue.query = query.name; + + // get/set the primary key value if necessary + // will be done on insert statement involving auto-incremented primary keys when Railo/ACF cannot retrieve it for us + // this happens on non-supported databases (example: H2) and drivers (example: jTDS) + loc.$id = $identitySelect(queryAttributes=loc.args, result=loc.result, primaryKey=arguments.$primaryKey); + if (StructKeyExists(loc, "$id")) + StructAppend(loc.result, loc.$id); + + loc.returnValue.result = loc.result; + </cfscript> + <cfreturn loc.returnValue> + </cffunction> + + <cffunction name="$getColumnInfo" returntype="query" access="public" output="false"> + <cfargument name="table" type="string" required="true"> + <cfargument name="datasource" type="string" required="true"> + <cfargument name="username" type="string" required="true"> + <cfargument name="password" type="string" required="true"> + <cfset arguments.type = "columns"> + <cfreturn $dbinfo(argumentCollection=arguments)> + </cffunction> + + <cffunction name="$quoteValue" returntype="string" access="public" output="false"> + <cfargument name="str" type="string" required="true" hint="string to quote"> + <cfargument name="sqlType" type="string" default="CF_SQL_VARCHAR" hint="sql column type for data"> + <cfargument name="type" type="string" required="false" hint="validation type for data"> + <cfscript> + if (NOT StructKeyExists(arguments, "type")) + arguments.type = $getValidationType(arguments.sqlType); + if (NOT ListFindNoCase("integer,float,boolean", arguments.type) OR arguments.str EQ "") + arguments.str = "'#arguments.str#'"; + return arguments.str; + </cfscript> + </cffunction> + + <cffunction name="$convertMaxRowsToLimit" returntype="struct" access="public" output="false"> + <cfargument name="argScope" type="struct" required="true"> + <cfscript> + if (StructKeyExists(arguments.argScope, "maxrows") AND arguments.argScope.maxrows gt 0){ + if (arguments.argScope.maxrows gt 0){ + arguments.argScope.limit = arguments.argScope.maxrows; + } + StructDelete(arguments.argScope, "maxrows"); + } + return arguments.argScope; + </cfscript> + </cffunction> + +</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/wheels/model/adapters/H2.cfc b/src/main/webapp/wheels/model/adapters/H2.cfc new file mode 100755 index 0000000..6c52cd1 --- /dev/null +++ b/src/main/webapp/wheels/model/adapters/H2.cfc @@ -0,0 +1,103 @@ +<cfcomponent extends="Base" output="false">
+
+ <cffunction name="$generatedKey" returntype="string" access="public" output="false">
+ <cfreturn "generated_key">
+ </cffunction>
+
+ <cffunction name="$randomOrder" returntype="string" access="public" output="false">
+ <cfreturn "RAND()">
+ </cffunction>
+
+ <cffunction name="$getType" returntype="string" access="public" output="false">
+ <cfargument name="type" type="string" required="true">
+ <cfscript>
+ var loc = {};
+ switch(arguments.type)
+ {
+ case "bigint": case "int8": {loc.returnValue = "cf_sql_bigint"; break;}
+ case "binary": case "bytea": case "raw": {loc.returnValue = "cf_sql_binary"; break;}
+ case "bit": case "bool": case "boolean": {loc.returnValue = "cf_sql_bit"; break;}
+ case "blob": case "tinyblob": case "mediumblob": case "longblob": case "image": case "oid": {loc.returnValue = "cf_sql_blob"; break;}
+ case "char": case "character": case "nchar": {loc.returnValue = "cf_sql_char"; break;}
+ case "date": {loc.returnValue = "cf_sql_date"; break;}
+ case "dec": case "decimal": case "number": case "numeric": {loc.returnValue = "cf_sql_decimal"; break;}
+ case "double": {loc.returnValue = "cf_sql_double"; break;}
+ case "float": case "float4": case "float8": case "real": {loc.returnValue = "cf_sql_float"; break;}
+ case "int": case "int4": case "integer": case "mediumint": case "signed": {loc.returnValue = "cf_sql_integer"; break;}
+ case "int2": case "smallint": case "year": {loc.returnValue = "cf_sql_smallint"; break;}
+ case "time": {loc.returnValue = "cf_sql_time"; break;}
+ case "datetime": case "smalldatetime": case "timestamp": {loc.returnValue = "cf_sql_timestamp"; break;}
+ case "tinyint": {loc.returnValue = "cf_sql_tinyint"; break;}
+ case "varbinary": case "longvarbinary": {loc.returnValue = "cf_sql_varbinary"; break;}
+ case "varchar": case "varchar2": case "longvarchar": case "varchar_ignorecase": case "nvarchar": case "nvarchar2": case "clob": case "nclob": case "text": case "tinytext": case "mediumtext": case "longtext": case "ntext": {loc.returnValue = "cf_sql_varchar"; break;}
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+ </cffunction>
+
+ <cffunction name="$query" returntype="struct" access="public" output="false">
+ <cfargument name="sql" type="array" required="true">
+ <cfargument name="limit" type="numeric" required="false" default=0>
+ <cfargument name="offset" type="numeric" required="false" default=0>
+ <cfargument name="parameterize" type="boolean" required="true">
+ <cfargument name="$primaryKey" type="string" required="false" default="">
+ <cfscript>
+ var loc = {};
+ arguments = $convertMaxRowsToLimit(arguments);
+ arguments.sql = $removeColumnAliasesInOrderClause(arguments.sql);
+ arguments.sql = $addColumnsToSelectAndGroupBy(arguments.sql);
+ loc.returnValue = $performQuery(argumentCollection=arguments);
+ </cfscript>
+ <cfreturn loc.returnValue>
+ </cffunction>
+
+ <cffunction name="$identitySelect" returntype="any" access="public" output="false">
+ <cfargument name="queryAttributes" type="struct" required="true">
+ <cfargument name="result" type="struct" required="true">
+ <cfargument name="primaryKey" type="string" required="true">
+ <cfset var loc = {}>
+ <cfset var query = {}>
+ <cfset loc.sql = Trim(arguments.result.sql)>
+ <cfif Left(loc.sql, 11) IS "INSERT INTO" AND NOT StructKeyExists(arguments.result, $generatedKey())>
+ <cfset loc.startPar = Find("(", loc.sql) + 1>
+ <cfset loc.endPar = Find(")", loc.sql)>
+ <cfset loc.columnList = ReplaceList(Mid(loc.sql, loc.startPar, (loc.endPar-loc.startPar)), "#Chr(10)#,#Chr(13)#, ", ",,")>
+ <cfif NOT ListFindNoCase(loc.columnList, ListFirst(arguments.primaryKey))>
+ <cfset loc.returnValue = {}>
+ <cfquery attributeCollection="#arguments.queryAttributes#">SELECT LAST_INSERT_ID() AS lastId</cfquery>
+ <cfset loc.returnValue[$generatedKey()] = query.name.lastId>
+ <cfreturn loc.returnValue>
+ </cfif>
+ </cfif>
+ </cffunction>
+
+ <cffunction name="$getColumns" returntype="query" access="public" output="false">
+ <cfscript>
+ var loc = {};
+
+ // get column details using cfdbinfo in the base adapter
+ loc.columns = super.$getColumns(argumentCollection=arguments);
+
+ // since cfdbinfo incorrectly returns information_schema tables we need to create a new query result that excludes these tables
+ loc.returnValue = QueryNew(loc.columns.columnList);
+ loc.iEnd = loc.columns.recordCount;
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ if (loc.columns["table_schem"][loc.i] != "information_schema")
+ {
+ QueryAddRow(loc.returnValue);
+ loc.jEnd = ListLen(loc.columns.columnList);
+ for (loc.j=1; loc.j <= loc.jEnd; loc.j++)
+ {
+ loc.columnName = ListGetAt(loc.columns.columnList, loc.j);
+ QuerySetCell(loc.returnValue, loc.columnName, loc.columns[loc.columnName][loc.i]);
+ }
+ }
+ }
+ return loc.returnValue;
+ </cfscript>
+ </cffunction>
+
+ <cfinclude template="../../plugins/injection.cfm">
+
+</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/wheels/model/adapters/MicrosoftSQLServer.cfc b/src/main/webapp/wheels/model/adapters/MicrosoftSQLServer.cfc new file mode 100755 index 0000000..9dad873 --- /dev/null +++ b/src/main/webapp/wheels/model/adapters/MicrosoftSQLServer.cfc @@ -0,0 +1,172 @@ +<cfcomponent extends="Base" output="false">
+
+ <cffunction name="$generatedKey" returntype="string" access="public" output="false">
+ <cfreturn "identitycol">
+ </cffunction>
+
+ <cffunction name="$randomOrder" returntype="string" access="public" output="false">
+ <cfreturn "NEWID()">
+ </cffunction>
+
+ <cffunction name="$getType" returntype="string" access="public" output="false">
+ <cfargument name="type" type="string" required="true">
+ <cfscript>
+ var loc = {};
+ switch(arguments.type)
+ {
+ case "bigint": {loc.returnValue = "cf_sql_bigint"; break;}
+ case "binary": case "timestamp": {loc.returnValue = "cf_sql_binary"; break;}
+ case "bit": {loc.returnValue = "cf_sql_bit"; break;}
+ case "char": case "nchar": case "uniqueidentifier": {loc.returnValue = "cf_sql_char"; break;}
+ case "date": {loc.returnValue = "cf_sql_date"; break;}
+ case "datetime": case "datetime2": case "smalldatetime": {loc.returnValue = "cf_sql_timestamp"; break;}
+ case "decimal": case "money": case "smallmoney": {loc.returnValue = "cf_sql_decimal"; break;}
+ case "float": {loc.returnValue = "cf_sql_float"; break;}
+ case "int": {loc.returnValue = "cf_sql_integer"; break;}
+ case "image": {loc.returnValue = "cf_sql_longvarbinary"; break;}
+ case "text": case "ntext": case "xml": {loc.returnValue = "cf_sql_longvarchar"; break;}
+ case "numeric": {loc.returnValue = "cf_sql_numeric"; break;}
+ case "real": {loc.returnValue = "cf_sql_real"; break;}
+ case "smallint": {loc.returnValue = "cf_sql_smallint"; break;}
+ case "time": {loc.returnValue = "cf_sql_time"; break;}
+ case "tinyint": {loc.returnValue = "cf_sql_tinyint"; break;}
+ case "varbinary": {loc.returnValue = "cf_sql_varbinary"; break;}
+ case "varchar": case "nvarchar": {loc.returnValue = "cf_sql_varchar"; break;}
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+ </cffunction>
+
+ <cffunction name="$query" returntype="struct" access="public" output="false">
+ <cfargument name="sql" type="array" required="true">
+ <cfargument name="limit" type="numeric" required="false" default=0>
+ <cfargument name="offset" type="numeric" required="false" default=0>
+ <cfargument name="parameterize" type="boolean" required="true">
+ <cfargument name="$primaryKey" type="string" required="false" default="">
+ <cfscript>
+ var loc = {};
+ if (StructKeyExists(arguments, "maxrows") AND arguments.maxrows gt 0){
+ if (arguments.maxrows gt 0){
+ arguments.sql [1] = ReplaceNoCase(arguments.sql[1], "select ", "select top #arguments.maxrows# ", "one");
+ }
+ StructDelete(arguments, "maxrows");
+ }
+ else if (arguments.limit + arguments.offset gt 0)
+ {
+ loc.containsGroup = false;
+ loc.afterWhere = "";
+
+ if (IsSimpleValue(arguments.sql[ArrayLen(arguments.sql) - 1]) and FindNoCase("GROUP BY", arguments.sql[ArrayLen(arguments.sql) - 1]))
+ loc.containsGroup = true;
+ if (arguments.sql[ArrayLen(arguments.sql)] Contains ",")
+ {
+ // fix for pagination issue when ordering multiple columns with same name
+ loc.order = arguments.sql[ArrayLen(arguments.sql)];
+ loc.newOrder = "";
+ loc.doneColumns = "";
+ loc.done = 0;
+ loc.iEnd = ListLen(loc.order);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.item = ListGetAt(loc.order, loc.i);
+ loc.column = SpanExcluding(Reverse(SpanExcluding(Reverse(loc.item), ".")), " ");
+ if (ListFind(loc.doneColumns, loc.column))
+ {
+ loc.done++;
+ loc.item = loc.item & " AS tmp" & loc.done;
+ }
+ loc.doneColumns = ListAppend(loc.doneColumns, loc.column);
+ loc.newOrder = ListAppend(loc.newOrder, loc.item);
+ }
+ arguments.sql[ArrayLen(arguments.sql)] = loc.newOrder;
+ }
+
+ // select clause always comes first in the array, the order by clause last, remove the leading keywords leaving only the columns and set to the ones used in the inner most sub query
+ loc.thirdSelect = ReplaceNoCase(ReplaceNoCase(arguments.sql[1], "SELECT DISTINCT ", ""), "SELECT ", "");
+ loc.thirdOrder = ReplaceNoCase(arguments.sql[ArrayLen(arguments.sql)], "ORDER BY ", "");
+ if (loc.containsGroup)
+ loc.thirdGroup = ReplaceNoCase(arguments.sql[ArrayLen(arguments.sql) - 1], "GROUP BY ", "");
+
+ // the first select is the outer most in the query and need to contain columns without table names and using aliases when they exist
+ loc.firstSelect = $columnAlias(list=$tableName(list=loc.thirdSelect, action="remove"), action="keep");
+
+ // we need to add columns from the inner order clause to the select clauses in the inner two queries
+ loc.iEnd = ListLen(loc.thirdOrder);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.iItem = ReReplace(ReReplace(ListGetAt(loc.thirdOrder, loc.i), " ASC\b", ""), " DESC\b", "");
+ if (!ListFindNoCase(loc.thirdSelect, loc.iItem))
+ loc.thirdSelect = ListAppend(loc.thirdSelect, loc.iItem);
+ if (loc.containsGroup) {
+ loc.iItem = REReplace(loc.iItem, "[[:space:]]AS[[:space:]][A-Za-z1-9]+", "", "all");
+ if (!ListFindNoCase(loc.thirdGroup, loc.iItem))
+ loc.thirdGroup = ListAppend(loc.thirdGroup, loc.iItem);
+ }
+ }
+
+ // the second select also needs to contain columns without table names and using aliases when they exist (but now including the columns added above)
+ loc.secondSelect = $columnAlias(list=$tableName(list=loc.thirdSelect, action="remove"), action="keep");
+
+ // first order also needs the table names removed, the column aliases can be kept since they are removed before running the query anyway
+ loc.firstOrder = $tableName(list=loc.thirdOrder, action="remove");
+
+ // second order clause is the same as the first but with the ordering reversed
+ loc.secondOrder = Replace(ReReplace(ReReplace(loc.firstOrder, " DESC\b", chr(7), "all"), " ASC\b", " DESC", "all"), chr(7), " ASC", "all");
+
+ // fix column aliases from order by clauses
+ loc.thirdOrder = $columnAlias(list=loc.thirdOrder, action="remove");
+ loc.secondOrder = $columnAlias(list=loc.secondOrder, action="keep");
+ loc.firstOrder = $columnAlias(list=loc.firstOrder, action="keep");
+
+ // build new sql string and replace the old one with it
+ loc.beforeWhere = "SELECT " & loc.firstSelect & " FROM (SELECT TOP " & arguments.limit & " " & loc.secondSelect & " FROM (SELECT ";
+ if (ListRest(arguments.sql[2], " ") Contains " ")
+ loc.beforeWhere = loc.beforeWhere & "DISTINCT ";
+ loc.beforeWhere = loc.beforeWhere & "TOP " & arguments.limit+arguments.offset & " " & loc.thirdSelect & " " & arguments.sql[2];
+ if (loc.containsGroup)
+ loc.afterWhere = "GROUP BY " & loc.thirdGroup & " ";
+ loc.afterWhere = "ORDER BY " & loc.thirdOrder & ") AS tmp1 ORDER BY " & loc.secondOrder & ") AS tmp2 ORDER BY " & loc.firstOrder;
+ ArrayDeleteAt(arguments.sql, 1);
+ ArrayDeleteAt(arguments.sql, 1);
+ ArrayDeleteAt(arguments.sql, ArrayLen(arguments.sql));
+ if (loc.containsGroup)
+ ArrayDeleteAt(arguments.sql, ArrayLen(arguments.sql));
+ ArrayPrepend(arguments.sql, loc.beforeWhere);
+ ArrayAppend(arguments.sql, loc.afterWhere);
+
+ }
+ else
+ {
+ arguments.sql = $removeColumnAliasesInOrderClause(arguments.sql);
+ }
+ // sql server doesn't support limit and offset in sql
+ StructDelete(arguments, "limit", false);
+ StructDelete(arguments, "offset", false);
+ loc.returnValue = $performQuery(argumentCollection=arguments);
+ </cfscript>
+ <cfreturn loc.returnValue>
+ </cffunction>
+
+ <cffunction name="$identitySelect" returntype="any" access="public" output="false">
+ <cfargument name="queryAttributes" type="struct" required="true">
+ <cfargument name="result" type="struct" required="true">
+ <cfargument name="primaryKey" type="string" required="true">
+ <cfset var loc = {}>
+ <cfset var query = {}>
+ <cfset loc.sql = Trim(arguments.result.sql)>
+ <cfif Left(loc.sql, 11) IS "INSERT INTO" AND NOT StructKeyExists(arguments.result, $generatedKey())>
+ <cfset loc.startPar = Find("(", loc.sql) + 1>
+ <cfset loc.endPar = Find(")", loc.sql)>
+ <cfset loc.columnList = ReplaceList(Mid(loc.sql, loc.startPar, (loc.endPar-loc.startPar)), "#Chr(10)#,#Chr(13)#, ", ",,")>
+ <cfif NOT ListFindNoCase(loc.columnList, ListFirst(arguments.primaryKey))>
+ <cfset loc.returnValue = {}>
+ <cfquery attributeCollection="#arguments.queryAttributes#">SELECT SCOPE_IDENTITY() AS lastId</cfquery>
+ <cfset loc.returnValue[$generatedKey()] = query.name.lastId>
+ <cfreturn loc.returnValue>
+ </cfif>
+ </cfif>
+ </cffunction>
+
+ <cfinclude template="../../plugins/injection.cfm">
+
+</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/wheels/model/adapters/MySQL.cfc b/src/main/webapp/wheels/model/adapters/MySQL.cfc new file mode 100755 index 0000000..94e851e --- /dev/null +++ b/src/main/webapp/wheels/model/adapters/MySQL.cfc @@ -0,0 +1,75 @@ +<cfcomponent extends="Base" output="false">
+
+ <cffunction name="$generatedKey" returntype="string" access="public" output="false">
+ <cfreturn "generated_key">
+ </cffunction>
+
+ <cffunction name="$randomOrder" returntype="string" access="public" output="false">
+ <cfreturn "RAND()">
+ </cffunction>
+
+ <cffunction name="$getType" returntype="string" access="public" output="false">
+ <cfargument name="type" type="string" required="true">
+ <cfscript>
+ var loc = {};
+ switch(arguments.type)
+ {
+ case "bigint": {loc.returnValue = "cf_sql_bigint"; break;}
+ case "binary": {loc.returnValue = "cf_sql_binary"; break;}
+ case "bit": case "bool": {loc.returnValue = "cf_sql_bit"; break;}
+ case "blob": case "tinyblob": case "mediumblob": case "longblob": {loc.returnValue = "cf_sql_blob"; break;}
+ case "char": {loc.returnValue = "cf_sql_char"; break;}
+ case "date": {loc.returnValue = "cf_sql_date"; break;}
+ case "decimal": {loc.returnValue = "cf_sql_decimal"; break;}
+ case "double": {loc.returnValue = "cf_sql_double"; break;}
+ case "float": {loc.returnValue = "cf_sql_float"; break;}
+ case "int": case "mediumint": {loc.returnValue = "cf_sql_integer"; break;}
+ case "smallint": case "year": {loc.returnValue = "cf_sql_smallint"; break;}
+ case "time": {loc.returnValue = "cf_sql_time"; break;}
+ case "datetime": case "timestamp": {loc.returnValue = "cf_sql_timestamp"; break;}
+ case "tinyint": {loc.returnValue = "cf_sql_tinyint"; break;}
+ case "varbinary": {loc.returnValue = "cf_sql_varbinary"; break;}
+ case "varchar": case "text": case "mediumtext": case "longtext": case "tinytext": case "enum": case "set": {loc.returnValue = "cf_sql_varchar"; break;}
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+ </cffunction>
+
+ <cffunction name="$query" returntype="struct" access="public" output="false">
+ <cfargument name="sql" type="array" required="true">
+ <cfargument name="limit" type="numeric" required="false" default=0>
+ <cfargument name="offset" type="numeric" required="false" default=0>
+ <cfargument name="parameterize" type="boolean" required="true">
+ <cfargument name="$primaryKey" type="string" required="false" default="">
+ <cfscript>
+ var loc = {};
+ arguments = $convertMaxRowsToLimit(arguments);
+ arguments.sql = $removeColumnAliasesInOrderClause(arguments.sql);
+ loc.returnValue = $performQuery(argumentCollection=arguments);
+ </cfscript>
+ <cfreturn loc.returnValue>
+ </cffunction>
+
+ <cffunction name="$identitySelect" returntype="any" access="public" output="false">
+ <cfargument name="queryAttributes" type="struct" required="true">
+ <cfargument name="result" type="struct" required="true">
+ <cfargument name="primaryKey" type="string" required="true">
+ <cfset var loc = {}>
+ <cfset var query = {}>
+ <cfset loc.sql = Trim(arguments.result.sql)>
+ <cfif Left(loc.sql, 11) IS "INSERT INTO" AND NOT StructKeyExists(arguments.result, $generatedKey())>
+ <cfset loc.startPar = Find("(", loc.sql) + 1>
+ <cfset loc.endPar = Find(")", loc.sql)>
+ <cfset loc.columnList = ReplaceList(Mid(loc.sql, loc.startPar, (loc.endPar-loc.startPar)), "#Chr(10)#,#Chr(13)#, ", ",,")>
+ <cfif NOT ListFindNoCase(loc.columnList, ListFirst(arguments.primaryKey))>
+ <cfset loc.returnValue = {}>
+ <cfquery attributeCollection="#arguments.queryAttributes#">SELECT LAST_INSERT_ID() AS lastId</cfquery>
+ <cfset loc.returnValue[$generatedKey()] = query.name.lastId>
+ <cfreturn loc.returnValue>
+ </cfif>
+ </cfif>
+ </cffunction>
+
+ <cfinclude template="../../plugins/injection.cfm">
+
+</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/wheels/model/adapters/Oracle.cfc b/src/main/webapp/wheels/model/adapters/Oracle.cfc new file mode 100755 index 0000000..f5e81ae --- /dev/null +++ b/src/main/webapp/wheels/model/adapters/Oracle.cfc @@ -0,0 +1,232 @@ +<cfcomponent extends="Base" output="false">
+
+ <cffunction name="$generatedKey" returntype="string" access="public" output="false">
+ <cfreturn "rowid">
+ </cffunction>
+
+ <cffunction name="$randomOrder" returntype="string" access="public" output="false">
+ <cfreturn "dbms_random.value()">
+ </cffunction>
+
+ <cffunction name="$getType" returntype="string" access="public" output="false">
+ <cfargument name="type" type="string" required="true">
+ <cfargument name="scale" type="string" required="true">
+ <cfscript>
+ var loc = {};
+ switch(arguments.type)
+ {
+ case "blob": case "bfile": {loc.returnValue = "cf_sql_blob"; break;}
+ case "char": case "nchar": {loc.returnValue = "cf_sql_char"; break;}
+ case "clob": case "nclob": {loc.returnValue = "cf_sql_clob"; break;}
+ case "date": case "timestamp": {loc.returnValue = "cf_sql_timestamp"; break;}
+ case "binary_double": {loc.returnValue = "cf_sql_double"; break;}
+ case "number": case "float": case "binary_float":
+ {
+ // integer datatypes are represented by number(38,0)
+ if (val(arguments.scale) == 0)
+ {
+ loc.returnValue = "cf_sql_integer";
+ }
+ else
+ {
+ loc.returnValue = "cf_sql_float";
+ }
+ break;
+ }
+ case "long": {loc.returnValue = "cf_sql_longvarchar"; break;}
+ case "raw": {loc.returnValue = "cf_sql_varbinary"; break;}
+ case "varchar2": case "nvarchar2": {loc.returnValue = "cf_sql_varchar"; break;}
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+ </cffunction>
+
+ <cffunction name="$query" returntype="struct" access="public" output="false">
+ <cfargument name="sql" type="array" required="true">
+ <cfargument name="limit" type="numeric" required="false" default=0>
+ <cfargument name="offset" type="numeric" required="false" default=0>
+ <cfargument name="parameterize" type="boolean" required="true">
+ <cfargument name="$primaryKey" type="string" required="false" default="">
+ <cfscript>
+ var loc = {};
+ arguments = $convertMaxRowsToLimit(arguments);
+ arguments.sql = $removeColumnAliasesInOrderClause(arguments.sql);
+ arguments.sql = $addColumnsToSelectAndGroupBy(arguments.sql);
+ if (arguments.limit > 0)
+ {
+ loc.beforeWhere = "SELECT #arguments.$primaryKey# FROM (SELECT tmp.#arguments.$primaryKey#, rownum rnum FROM (";
+ loc.afterWhere = ") tmp WHERE rownum <=" & arguments.limit+arguments.offset & ")" & " WHERE rnum >" & arguments.offset;
+ ArrayPrepend(arguments.sql, loc.beforeWhere);
+ ArrayAppend(arguments.sql, loc.afterWhere);
+ }
+
+ // oracle doesn't support limit and offset in sql
+ StructDelete(arguments, "limit", false);
+ StructDelete(arguments, "offset", false);
+ loc.returnValue = $performQuery(argumentCollection=arguments);
+ loc.returnValue = $handleTimestampObject(loc.returnValue);
+ </cfscript>
+ <cfreturn loc.returnValue>
+ </cffunction>
+
+ <cffunction name="$identitySelect" returntype="any" access="public" output="false">
+ <cfargument name="queryAttributes" type="struct" required="true">
+ <cfargument name="result" type="struct" required="true">
+ <cfargument name="primaryKey" type="string" required="true">
+ <cfset var loc = {}>
+ <cfset var query = {}>
+ <cfset loc.sql = Trim(arguments.result.sql)>
+ <cfif Left(loc.sql, 11) IS "INSERT INTO">
+ <cfset loc.startPar = Find("(", loc.sql) + 1>
+ <cfset loc.endPar = Find(")", loc.sql)>
+ <cfset loc.columnList = ReplaceList(Mid(loc.sql, loc.startPar, (loc.endPar-loc.startPar)), "#Chr(10)#,#Chr(13)#, ", ",,")>
+ <cfif NOT ListFindNoCase(loc.columnList, ListFirst(arguments.primaryKey))>
+ <cfset loc.returnValue = {}>
+ <cfset loc.tbl = SpanExcluding(Right(loc.sql, Len(loc.sql)-12), " ")>
+ <cfif !StructKeyExists(arguments.result, $generatedKey()) || application.wheels.serverName IS NOT "Adobe ColdFusion">
+ <!---
+ there isn't a way in oracle to tell what (if any) sequences exists
+ on a table. hence we'll just have to perform a guess for now.
+ TODO: in 1.2 we need to look at letting the developer specify the sequence
+ name through a setting in the model
+ --->
+ <cftry>
+ <cfquery attributeCollection="#arguments.queryAttributes#">SELECT #loc.tbl#_seq.currval AS lastId FROM dual</cfquery>
+ <cfcatch type="any">
+ <!--- in case the sequence doesn't exists return a blank string for the expected value --->
+ <cfset query.name.lastId = "">
+ </cfcatch>
+ </cftry>
+ <cfelse>
+ <cfquery attributeCollection="#arguments.queryAttributes#">SELECT #arguments.primaryKey# AS lastId FROM #loc.tbl# WHERE ROWID = '#arguments.result[$generatedKey()]#'</cfquery>
+ </cfif>
+ <cfset loc.lastId = Trim(query.name.lastId)>
+ <cfif len(query.name.lastId)>
+ <cfset loc.returnValue[$generatedKey()] = Trim(loc.lastid)>
+ <cfreturn loc.returnValue>
+ </cfif>
+ <cfelse>
+ <!--- since Oracle always returns rowid we need to delete it in those cases where we have manually inserted the primary key, if we don't do this we'll end up setting the rowid value to the object --->
+ <cfif StructKeyExists(arguments.result, "rowid")>
+ <cfset StructDelete(arguments.result, "rowid")>
+ </cfif>
+ <cfif StructKeyExists(arguments.result, "generatedkey")>
+ <cfset StructDelete(arguments.result, "generatedkey")>
+ </cfif>
+ </cfif>
+ </cfif>
+ </cffunction>
+
+ <cffunction name="$getColumnInfo" returntype="query" access="public" output="false">
+ <cfargument name="table" type="string" required="true">
+ <cfargument name="datasource" type="string" required="true">
+ <cfargument name="username" type="string" required="true">
+ <cfargument name="password" type="string" required="true">
+ <cfscript>
+ var loc = {};
+ loc.args = duplicate(arguments);
+ StructDelete(loc.args, "table");
+ if (!Len(loc.args.username))
+ {
+ StructDelete(loc.args, "username");
+ }
+ if (!Len(loc.args.password))
+ {
+ StructDelete(loc.args, "password");
+ }
+ loc.args.name = "loc.returnValue";
+ </cfscript>
+ <cfquery attributeCollection="#loc.args#">
+ SELECT
+ TC.COLUMN_NAME
+ ,TC.DATA_TYPE AS TYPE_NAME
+ ,TC.NULLABLE AS IS_NULLABLE
+ ,CASE WHEN PKC.COLUMN_NAME IS NULL THEN 0 ELSE 1 END AS IS_PRIMARYKEY
+ ,0 AS IS_FOREIGNKEY
+ ,'' AS REFERENCED_PRIMARYKEY
+ ,'' AS REFERENCED_PRIMARYKEY_TABLE
+ ,NVL(TC.DATA_PRECISION, TC.DATA_LENGTH) AS COLUMN_SIZE
+ ,TC.DATA_SCALE AS DECIMAL_DIGITS
+ ,TC.DATA_DEFAULT AS COLUMN_DEFAULT_VALUE
+ ,TC.DATA_LENGTH AS CHAR_OCTET_LENGTH
+ ,TC.COLUMN_ID AS ORDINAL_POSITION
+ ,'' AS REMARKS
+ FROM
+ ALL_TAB_COLUMNS TC
+ LEFT JOIN ALL_CONSTRAINTS PK
+ ON (PK.CONSTRAINT_TYPE = 'P'
+ AND PK.TABLE_NAME = TC.TABLE_NAME
+ AND TC.OWNER = PK.OWNER)
+ LEFT JOIN ALL_CONS_COLUMNS PKC
+ ON (PK.CONSTRAINT_NAME = PKC.CONSTRAINT_NAME
+ AND TC.COLUMN_NAME = PKC.COLUMN_NAME
+ AND TC.OWNER = PKC.OWNER)
+ WHERE
+ TC.TABLE_NAME = '#UCase(arguments.table)#'
+ ORDER BY
+ TC.COLUMN_ID
+ </cfquery>
+ <!---
+ wheels catches the error and raises a Wheels.TableNotFound error
+ to mimic this we will throw an error if the query result is empty
+ --->
+ <cfif !loc.returnValue.RecordCount>
+ <cfthrow/>
+ </cfif>
+ <cfreturn loc.returnValue>
+ </cffunction>
+
+ <cffunction name="$handleTimestampObject" hint="Oracle will return timestamp as an object. you need to call timestampValue() to get the string representation">
+ <cfargument name="results" type="struct" required="true">
+ <cfscript>
+ var loc = {};
+ // depending on the driver and engine used with oracle, timestamps can be returned as
+ // objects instead of strings.
+ if (StructKeyExists(arguments.results, "query"))
+ {
+ // look for all timestamp columns
+ loc.query = arguments.results.query;
+ loc.rows = loc.query.RecordCount;
+ if (loc.rows gt 0)
+ {
+ loc.metadata = GetMetaData(loc.query);
+ loc.columns = [];
+ loc.iEnd = ArrayLen(loc.metadata);
+ for (loc.i = 1; loc.i lte loc.iEnd; loc.i++)
+ {
+ loc.column = loc.metadata[loc.i];
+ if (loc.column.typename eq "timestamp")
+ {
+ ArrayAppend(loc.columns, loc.column.name);
+ }
+ }
+ // if we have any timestamp columns
+ if (!ArrayIsEmpty(loc.columns))
+ {
+ loc.iEnd = ArrayLen(loc.columns);
+ for (loc.i = 1; loc.i lte loc.iEnd; loc.i++)
+ {
+ loc.column = loc.columns[loc.i];
+ for (loc.row = 1; loc.row lte loc.rows; loc.row++)
+ {
+ if (IsObject(loc.query[loc.column][loc.row]))
+ {// call timestampValue() on objects to convert to string
+ loc.query[loc.column][loc.row] = loc.query[loc.column][loc.row].timestampValue();
+ }
+ else if (IsSimpleValue(loc.query[loc.column][loc.row]) && Len(loc.query[loc.column][loc.row]))
+ {// if the driver does the conversion automatically, there is no need to continue
+ break;
+ }
+ }
+ }
+ }
+ arguments.results.query = loc.query;
+ }
+ }
+ return arguments.results;
+ </cfscript>
+ </cffunction>
+
+ <cfinclude template="../../plugins/injection.cfm">
+
+</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/wheels/model/adapters/PostgreSQL.cfc b/src/main/webapp/wheels/model/adapters/PostgreSQL.cfc new file mode 100755 index 0000000..b12c506 --- /dev/null +++ b/src/main/webapp/wheels/model/adapters/PostgreSQL.cfc @@ -0,0 +1,76 @@ +<cfcomponent extends="Base" output="false">
+
+ <cffunction name="$generatedKey" returntype="string" access="public" output="false">
+ <cfreturn "lastId">
+ </cffunction>
+
+ <cffunction name="$randomOrder" returntype="string" access="public" output="false">
+ <cfreturn "random()">
+ </cffunction>
+
+ <cffunction name="$getType" returntype="string" access="public" output="false">
+ <cfargument name="type" type="string" required="true">
+ <cfscript>
+ var loc = {};
+ switch(arguments.type)
+ {
+ case "bigint": case "int8": case "bigserial": case "serial8": {loc.returnValue = "cf_sql_bigint"; break;}
+ case "bit": case "varbit": {loc.returnValue = "cf_sql_bit"; break;}
+ case "bool": case "boolean": {loc.returnValue = "cf_sql_varchar"; break;}
+ case "bytea": {loc.returnValue = "cf_sql_binary"; break;}
+ case "char": case "character": {loc.returnValue = "cf_sql_char"; break;}
+ case "date": case "timestamp": case "timestamptz": {loc.returnValue = "cf_sql_timestamp"; break;}
+ case "decimal": case "double": case "precision": case "float": case "float4": case "float8": {loc.returnValue = "cf_sql_decimal"; break;}
+ case "integer": case "int": case "int4": case "serial": case "oid": {loc.returnValue = "cf_sql_integer"; break;} // oid cols should probably be avoided - placed here for completeness
+ case "numeric": case "smallmoney": case "money": {loc.returnValue = "cf_sql_numeric"; break;} // postgres has deprecated the money type: http://www.postgresql.org/docs/8.1/static/datatype-money.html
+ case "real": {loc.returnValue = "cf_sql_real"; break;}
+ case "smallint": case "int2": {loc.returnValue = "cf_sql_smallint"; break;}
+ case "text": {loc.returnValue = "cf_sql_longvarchar"; break;}
+ case "time": case "timetz": {loc.returnValue = "cf_sql_time"; break;}
+ case "varchar": case "varying": case "bpchar": case "uuid": {loc.returnValue = "cf_sql_varchar"; break;}
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+ </cffunction>
+
+ <cffunction name="$query" returntype="struct" access="public" output="false">
+ <cfargument name="sql" type="array" required="true">
+ <cfargument name="limit" type="numeric" required="false" default=0>
+ <cfargument name="offset" type="numeric" required="false" default=0>
+ <cfargument name="parameterize" type="boolean" required="true">
+ <cfargument name="$primaryKey" type="string" required="false" default="">
+ <cfscript>
+ var loc = {};
+ arguments = $convertMaxRowsToLimit(arguments);
+ arguments.sql = $removeColumnAliasesInOrderClause(arguments.sql);
+ arguments.sql = $addColumnsToSelectAndGroupBy(arguments.sql);
+ loc.returnValue = $performQuery(argumentCollection=arguments);
+ </cfscript>
+ <cfreturn loc.returnValue>
+ </cffunction>
+
+ <cffunction name="$identitySelect" returntype="any" access="public" output="false">
+ <cfargument name="queryAttributes" type="struct" required="true">
+ <cfargument name="result" type="struct" required="true">
+ <cfargument name="primaryKey" type="string" required="true">
+ <cfset var loc = {}>
+ <cfset var query = {}>
+ <cfset loc.sql = Trim(arguments.result.sql)>
+ <cfif Left(loc.sql, 11) IS "INSERT INTO" AND NOT StructKeyExists(arguments.result, $generatedKey())>
+ <cfset loc.startPar = Find("(", loc.sql) + 1>
+ <cfset loc.endPar = Find(")", loc.sql)>
+ <cfset loc.columnList = ReplaceList(Mid(loc.sql, loc.startPar, (loc.endPar-loc.startPar)), "#Chr(10)#,#Chr(13)#, ", ",,")>
+ <cfif NOT ListFindNoCase(loc.columnList, ListFirst(arguments.primaryKey))>
+ <!--- Railo/ACF doesn't support PostgreSQL natively when it comes to returning the primary key value of the last inserted record so we have to do it manually by using the sequence --->
+ <cfset loc.returnValue = {}>
+ <cfset loc.tbl = SpanExcluding(Right(loc.sql, Len(loc.sql)-12), " ")>
+ <cfquery attributeCollection="#arguments.queryAttributes#">SELECT currval(pg_get_serial_sequence('#loc.tbl#', '#arguments.primaryKey#')) AS lastId</cfquery>
+ <cfset loc.returnValue[$generatedKey()] = query.name.lastId>
+ <cfreturn loc.returnValue>
+ </cfif>
+ </cfif>
+ </cffunction>
+
+ <cfinclude template="../../plugins/injection.cfm">
+
+</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/wheels/model/associations.cfm b/src/main/webapp/wheels/model/associations.cfm new file mode 100755 index 0000000..ab3a201 --- /dev/null +++ b/src/main/webapp/wheels/model/associations.cfm @@ -0,0 +1,204 @@ +<!--- PUBLIC MODEL INITIALIZATION METHODS ---> + +<cffunction name="belongsTo" returntype="void" access="public" output="false" hint="Sets up a `belongsTo` association between this model and the specified one. Use this association when this model contains a foreign key referencing another model." + examples= + ' + <!--- Specify that instances of this model belong to an author. (The table for this model should have a foreign key set on it, typically named `authorid`.) ---> + <cfset belongsTo("author")> + + <!--- Same as above, but because we have broken away from the foreign key naming convention, we need to set `modelName` and `foreignKey` ---> + <cfset belongsTo(name="bookWriter", modelName="author", foreignKey="authorId")> + ' + categories="model-initialization,associations" chapters="associations" functions="hasOne,hasMany"> + <cfargument name="name" type="string" required="true" hint="Gives the association a name that you refer to when working with the association (in the `include` argument to @findAll, to name one example)."> + <cfargument name="modelName" type="string" required="false" default="" hint="Name of associated model (usually not needed if you follow Wheels conventions because the model name will be deduced from the `name` argument)."> + <cfargument name="foreignKey" type="string" required="false" default="" hint="Foreign key property name (usually not needed if you follow Wheels conventions since the foreign key name will be deduced from the `name` argument)."> + <cfargument name="joinKey" type="string" required="false" default="" hint="Column name to join to if not the primary key (usually not needed if you follow wheels conventions since the join key will be the tables primary key/keys)."> + <cfargument name="joinType" type="string" required="false" hint="Use to set the join type when joining associated tables. Possible values are `inner` (for `INNER JOIN`) and `outer` (for `LEFT OUTER JOIN`)."> + <cfscript> + $args(name="belongsTo", args=arguments); + // deprecate the class argument (change of name only) + if (StructKeyExists(arguments, "class")) + { + $deprecated("The `class` argument will be deprecated in a future version of Wheels, please use the `modelName` argument instead"); + arguments.modelName = arguments.class; + StructDelete(arguments, "class"); + } + + arguments.type = "belongsTo"; + arguments.methods = "#arguments.name#,has#capitalize(arguments.name)#"; + $registerAssociation(argumentCollection=arguments); + </cfscript> +</cffunction> + +<cffunction name="hasMany" returntype="void" access="public" output="false" hint="Sets up a `hasMany` association between this model and the specified one." + examples= + ' + <!--- + Example1: Specify that instances of this model has many comments. + (The table for the associated model, not the current, should have the foreign key set on it.) + ---> + <cfset hasMany("comments")> + + <!--- + Example 2: Specify that this model (let''s call it `reader` in this case) has many subscriptions and setup a shortcut to the `publication` model. + (Useful when dealing with many-to-many relationships.) + ---> + <cfset hasMany(name="subscriptions", shortcut="publications")> + + <!--- Example 3: Automatically delete all associated `comments` whenever this object is deleted ---> + <cfset hasMany(name="comments", dependent="deleteAll")> + + <!--- + Example 4: When not following Wheels naming conventions for associations, it can get complex to define how a `shortcut` works. + In this example, we are naming our `shortcut` differently than the actual model''s name. + ---> + <!--- In the models/Customer.cfc `init()` method ---> + <cfset hasMany(name="subscriptions", shortcut="magazines", through="publication,subscriptions")> + + <!--- In the models/Subscriptions.cfc `init()` method ---> + <cfset belongsTo("customer")> + <cfset belongsTo("publication")> + + <!--- In the models/Publication `init()` method ---> + <cfset hasMany("subscriptions")> + ' + categories="model-initialization,associations" chapters="associations" functions="belongsTo,hasOne"> + <cfargument name="name" type="string" required="true" hint="See documentation for @belongsTo."> + <cfargument name="modelName" type="string" required="false" default="" hint="See documentation for @belongsTo."> + <cfargument name="foreignKey" type="string" required="false" default="" hint="See documentation for @belongsTo."> + <cfargument name="joinKey" type="string" required="false" default="" hint="See documentation for @belongsTo."> + <cfargument name="joinType" type="string" required="false" hint="See documentation for @belongsTo."> + <cfargument name="dependent" type="string" required="false" hint="Defines how to handle dependent models when you delete a record from this model. Set to `delete` to instantiate associated models and call their @delete method, `deleteAll` to delete without instantiating, `removeAll` to remove the foreign key, or `false` to do nothing."> + <cfargument name="shortcut" type="string" required="false" default="" hint="Set this argument to create an additional dynamic method that gets the object(s) from the other side of a many-to-many association."> + <cfargument name="through" type="string" required="false" default="#singularize(arguments.shortcut)#,#arguments.name#" hint="Set this argument if you need to override Wheels conventions when using the `shortcut` argument. Accepts a list of two association names representing the chain from the opposite side of the many-to-many relationship to this model."> + <cfscript> + var singularizeName = capitalize(singularize(arguments.name)); + var capitalizeName = capitalize(arguments.name); + $args(name="hasMany", args=arguments); + // deprecate the class argument (change of name only) + if (StructKeyExists(arguments, "class")) + { + $deprecated("The `class` argument will be deprecated in a future version of Wheels, please use the `modelName` argument instead"); + arguments.modelName = arguments.class; + StructDelete(arguments, "class"); + } + + arguments.type = "hasMany"; + arguments.methods = "#arguments.name#,#singularizeName#Count,add#singularizeName#,create#singularizeName#,delete#singularizeName#,deleteAll#capitalizeName#,findOne#singularizeName#,has#capitalizeName#,new#singularizeName#,remove#singularizeName#,removeAll#capitalizeName#"; + $registerAssociation(argumentCollection=arguments); + </cfscript> +</cffunction> + +<cffunction name="hasOne" returntype="void" access="public" output="false" hint="Sets up a `hasOne` association between this model and the specified one." + examples= + ' + <!--- Specify that instances of this model has one profile. (The table for the associated model, not the current, should have the foreign key set on it.) ---> + <cfset hasOne("profile")> + + <!--- Same as above but setting the `joinType` to `inner`, which basically means this model should always have a record in the `profiles` table ---> + <cfset hasOne(name="profile", joinType="inner")> + + <!--- Automatically delete the associated `profile` whenever this object is deleted ---> + <cfset hasMany(name="comments", dependent="delete")> + ' + categories="model-initialization,associations" chapters="associations" functions="belongsTo,hasMany"> + <cfargument name="name" type="string" required="true" hint="See documentation for @belongsTo."> + <cfargument name="modelName" type="string" required="false" default="" hint="See documentation for @belongsTo."> + <cfargument name="foreignKey" type="string" required="false" default="" hint="See documentation for @belongsTo."> + <cfargument name="joinKey" type="string" required="false" default="" hint="See documentation for @belongsTo."> + <cfargument name="joinType" type="string" required="false" hint="See documentation for @belongsTo."> + <cfargument name="dependent" type="string" required="false" hint="See documentation for @hasMany."> + <cfscript> + var capitalizeName = capitalize(arguments.name); + $args(name="hasOne", args=arguments); + // deprecate the class argument (change of name only) + if (StructKeyExists(arguments, "class")) + { + $deprecated("The `class` argument will be deprecated in a future version of Wheels, please use the `modelName` argument instead"); + arguments.modelName = arguments.class; + StructDelete(arguments, "class"); + } + + arguments.type = "hasOne"; + arguments.methods = "#arguments.name#,create#capitalizeName#,delete#capitalizeName#,has#capitalizeName#,new#capitalizeName#,remove#capitalizeName#,set#capitalizeName#"; + $registerAssociation(argumentCollection=arguments); + </cfscript> +</cffunction> + +<!--- PRIVATE MODEL INITIALIZATION METHODS ---> + +<cffunction name="$registerAssociation" returntype="void" access="public" output="false" hint="Called from the association methods above to save the data to the class struct of the model."> + <cfscript> + // assign the name for the association + var associationName = arguments.name; + + // default our nesting to false and set other nesting properties + arguments.nested = {}; + arguments.nested.allow = false; + arguments.nested.delete = false; + arguments.nested.autosave = false; + arguments.nested.sortProperty = ""; + arguments.nested.rejectIfBlank = ""; + // remove the name argument from the arguments struct + structDelete(arguments, "name", false); + // infer model name and foreign key from association name unless developer specified it already + if (!Len(arguments.modelName)) + { + if (arguments.type == "hasMany") + arguments.modelName = singularize(associationName); + else + arguments.modelName = associationName; + } + // store all the settings for the association in the class struct (one struct per association with the name of the association as the key) + variables.wheels.class.associations[associationName] = arguments; + </cfscript> +</cffunction> + + +<cffunction name="$deleteDependents" returntype="void" access="public" output="false"> + <cfscript> + var loc = {}; + for (loc.key in variables.wheels.class.associations) + { + if (ListFindNoCase("hasMany,hasOne", variables.wheels.class.associations[loc.key].type) && variables.wheels.class.associations[loc.key].dependent != false) + { + loc.all = ""; + if (variables.wheels.class.associations[loc.key].type == "hasMany") + loc.all = "All"; + + switch(variables.wheels.class.associations[loc.key].dependent) + { + case "delete": + { + loc.invokeArgs = {}; + loc.invokeArgs.instantiate = true; + $invoke(componentReference=this, method="delete#loc.all##loc.key#", invokeArgs=loc.invokeArgs); + break; + } + case "remove": + { + loc.invokeArgs = {}; + loc.invokeArgs.instantiate = true; + $invoke(componentReference=this, method="remove#loc.all##loc.key#", invokeArgs=loc.invokeArgs); + break; + } + case "deleteAll": + { + $invoke(componentReference=this, method="delete#loc.all##loc.key#"); + break; + } + case "removeAll": + { + $invoke(componentReference=this, method="remove#loc.all##loc.key#"); + break; + } + default: + { + $throw(type="Wheels.InvalidArgument", message="'#variables.wheels.class.associations[loc.key].dependent#' is not a valid dependency.", extendedInfo="Use `delete`, `deleteAll`, `removeAll` or false."); + } + } + } + } + </cfscript> +</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/model/calculations.cfm b/src/main/webapp/wheels/model/calculations.cfm new file mode 100755 index 0000000..1eb016e --- /dev/null +++ b/src/main/webapp/wheels/model/calculations.cfm @@ -0,0 +1,222 @@ +<!--- PUBLIC MODEL CLASS METHODS --->
+
+<cffunction name="average" returntype="any" access="public" output="false" hint="Calculates the average value for a given property. Uses the SQL function `AVG`. If no records can be found to perform the calculation on you can use the `ifNull` argument to decide what should be returned."
+ examples=
+ '
+ <!--- Get the average salary for all employees --->
+ <cfset avgSalary = model("employee").average("salary")>
+
+ <!--- Get the average salary for employees in a given department --->
+ <cfset avgSalary = model("employee").average(property="salary", where="departmentId=##params.key##")>
+
+ <!--- Make sure a numeric value is always returned if no records are calculated --->
+ <cfset avgSalary = model("employee").average(property="salary", where="salary BETWEEN ##params.min## AND ##params.max##", ifNull=0>
+ '
+ categories="model-class,statistics" chapters="column-statistics" functions="count,maximum,minimum,sum">
+ <cfargument name="property" type="string" required="true" hint="Name of the property to calculate the average for.">
+ <cfargument name="where" type="string" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="include" type="string" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="distinct" type="boolean" required="false" hint="When `true`, `AVG` will be performed only on each unique instance of a value, regardless of how many times the value occurs.">
+ <cfargument name="parameterize" type="any" required="false" hint="See documentation for @findAll.">
+ <cfargument name="ifNull" type="any" required="false" hint="The value returned if no records are found. Common usage is to set this to `0` to make sure a numeric value is always returned instead of a blank string.">
+ <cfargument name="includeSoftDeletes" type="boolean" required="false" default="false" hint="See documentation for @findAll.">
+ <cfscript>
+ var loc = {};
+ $args(name="average", args=arguments);
+ if (ListFindNoCase("cf_sql_integer,cf_sql_bigint,cf_sql_smallint,cf_sql_tinyint", variables.wheels.class.properties[arguments.property].type))
+ {
+ // this is an integer column so we get all the values from the database and do the calculation in ColdFusion since we can't run a query to get the average value without type casting it
+ loc.values = findAll(select=arguments.property, where=arguments.where, include=arguments.include, parameterize=arguments.parameterize, includeSoftDeletes=arguments.includeSoftDeletes);
+ loc.values = ListToArray(Evaluate("ValueList(loc.values.#arguments.property#)"));
+ loc.returnValue = arguments.ifNull;
+ if (!ArrayIsEmpty(loc.values))
+ {
+ if (arguments.distinct)
+ {
+ loc.tempValues = {};
+ loc.iEnd = ArrayLen(loc.values);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ StructInsert(loc.tempValues, loc.values[loc.i], loc.values[loc.i], true);
+ loc.values = ListToArray(StructKeyList(loc.tempValues));
+ }
+ loc.returnValue = ArrayAvg(loc.values);
+ }
+ }
+ else
+ {
+ // if the column's type is a float or similar we can run an AVG type query since it will always return a value of the same type as the column
+ arguments.type = "AVG";
+ loc.returnValue = $calculate(argumentCollection=arguments);
+ // we convert the result to a string so that it is the same as what would happen if you calculate an average in ColdFusion code (like we do for integers in this function for example)
+ loc.returnValue = JavaCast("string", loc.returnValue);
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="count" returntype="numeric" access="public" output="false" hint="Returns the number of rows that match the arguments (or all rows if no arguments are passed in). Uses the SQL function `COUNT`. If no records can be found to perform the calculation on, `0` is returned."
+ examples=
+ '
+ <!--- Count how many authors there are in the table --->
+ <cfset authorCount = model("author").count()>
+
+ <!--- Count how many authors that have a last name starting with an "A" --->
+ <cfset authorOnACount = model("author").count(where="lastName LIKE ''A%''")>
+
+ <!--- Count how many authors that have written books starting with an "A" --->
+ <cfset authorWithBooksOnACount = model("author").count(include="books", where="booktitle LIKE ''A%''")>
+
+ <!--- Count the number of comments on a specific post (a `hasMany` association from `post` to `comment` is required) --->
+ <!--- The `commentCount` method will call `model("comment").count(where="postId=##post.id##")` internally --->
+ <cfset aPost = model("post").findByKey(params.postId)>
+ <cfset amount = aPost.commentCount()>
+ '
+ categories="model-class,statistics" chapters="column-statistics,associations" functions="average,hasMany,maximum,minimum,sum">
+ <cfargument name="where" type="string" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="include" type="string" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="parameterize" type="any" required="false" hint="See documentation for @findAll.">
+ <cfargument name="includeSoftDeletes" type="boolean" required="false" default="false" hint="See documentation for @findAll.">
+ <cfscript>
+ var returnValue = "";
+ $args(name="count", args=arguments);
+ arguments.type = "COUNT";
+ arguments.property = ListFirst(primaryKey());
+ if (Len(arguments.include))
+ arguments.distinct = true;
+ else
+ arguments.distinct = false;
+ returnValue = $calculate(argumentCollection=arguments);
+ if (IsNumeric(returnValue))
+ return returnValue;
+ else
+ return 0;
+ </cfscript>
+</cffunction>
+
+<cffunction name="maximum" returntype="any" access="public" output="false" hint="Calculates the maximum value for a given property. Uses the SQL function `MAX`. If no records can be found to perform the calculation on you can use the `ifNull` argument to decide what should be returned."
+ examples=
+ '
+ <!--- Get the amount of the highest salary for all employees --->
+ <cfset highestSalary = model("employee").maximum("salary")>
+
+ <!--- Get the amount of the highest salary for employees in a given department --->
+ <cfset highestSalary = model("employee").maximum(property="salary", where="departmentId=##params.key##")>
+
+ <!--- Make sure a numeric value is always returned, even if no records are found to calculate the maximum for --->
+ <cfset highestSalary = model("employee").maximum(property="salary", where="salary > ##params.minSalary##", ifNull=0)>
+ '
+ categories="model-class,statistics" chapters="column-statistics" functions="average,count,minimum,sum">
+ <cfargument name="property" type="string" required="true" hint="Name of the property to get the highest value for (must be a property of a numeric data type).">
+ <cfargument name="where" type="string" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="include" type="string" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="parameterize" type="any" required="false" hint="See documentation for @findAll.">
+ <cfargument name="ifNull" type="any" required="false" hint="See documentation for @average.">
+ <cfargument name="includeSoftDeletes" type="boolean" required="false" default="false" hint="See documentation for @findAll.">
+ <cfscript>
+ $args(name="maximum", args=arguments);
+ arguments.type = "MAX";
+ </cfscript>
+ <cfreturn $calculate(argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="minimum" returntype="any" access="public" output="false" hint="Calculates the minimum value for a given property. Uses the SQL function `MIN`. If no records can be found to perform the calculation on you can use the `ifNull` argument to decide what should be returned."
+ examples=
+ '
+ <!--- Get the amount of the lowest salary for all employees --->
+ <cfset lowestSalary = model("employee").minimum("salary")>
+
+ <!--- Get the amount of the lowest salary for employees in a given department --->
+ <cfset lowestSalary = model("employee").minimum(property="salary", where="departmentId=##params.key##")>
+
+ <!--- Make sure a numeric amount is always returned, even when there were no records analyzed by the query --->
+ <cfset lowestSalary = model("employee").minimum(property="salary", where="salary BETWEEN ##params.min## AND ##params.max##", ifNull=0)>
+ '
+ categories="model-class,statistics" chapters="column-statistics" functions="average,count,maximum,sum">
+ <cfargument name="property" type="string" required="true" hint="Name of the property to get the lowest value for (must be a property of a numeric data type).">
+ <cfargument name="where" type="string" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="include" type="string" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="parameterize" type="any" required="false" hint="See documentation for @findAll.">
+ <cfargument name="ifNull" type="any" required="false" hint="See documentation for @average.">
+ <cfargument name="includeSoftDeletes" type="boolean" required="false" default="false" hint="See documentation for @findAll.">
+ <cfscript>
+ $args(name="minimum", args=arguments);
+ arguments.type = "MIN";
+ </cfscript>
+ <cfreturn $calculate(argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="sum" returntype="any" access="public" output="false" hint="Calculates the sum of values for a given property. Uses the SQL function `SUM`. If no records can be found to perform the calculation on you can use the `ifNull` argument to decide what should be returned."
+ examples=
+ '
+ <!--- Get the sum of all salaries --->
+ <cfset allSalaries = model("employee").sum("salary")>
+
+ <!--- Get the sum of all salaries for employees in a given country --->
+ <cfset allAustralianSalaries = model("employee").sum(property="salary", include="country", where="countryname=''Australia''")>
+
+ <!--- Make sure a numeric value is always returned, even if there are no records analyzed by the query --->
+ <cfset salarySum = model("employee").sum(property="salary", where="salary BETWEEN ##params.min## AND ##params.max##", ifNull=0)>
+ '
+ categories="model-class,statistics" chapters="column-statistics" functions="average,count,maximum,minimum">
+ <cfargument name="property" type="string" required="true" hint="Name of the property to get the sum for (must be a property of a numeric data type).">
+ <cfargument name="where" type="string" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="include" type="string" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="distinct" type="boolean" required="false" hint="When `true`, `SUM` returns the sum of unique values only.">
+ <cfargument name="parameterize" type="any" required="false" hint="See documentation for @findAll.">
+ <cfargument name="ifNull" type="any" required="false" hint="See documentation for @average.">
+ <cfargument name="includeSoftDeletes" type="boolean" required="false" default="false" hint="See documentation for @findAll.">
+ <cfscript>
+ $args(name="sum", args=arguments);
+ arguments.type = "SUM";
+ </cfscript>
+ <cfreturn $calculate(argumentCollection=arguments)>
+</cffunction>
+
+<!--- PRIVATE MODEL CLASS METHODS --->
+
+<cffunction name="$calculate" returntype="any" access="public" output="false" hint="Creates the query that needs to be run for all of the above methods.">
+ <cfargument name="type" type="string" required="true">
+ <cfargument name="property" type="string" required="true">
+ <cfargument name="where" type="string" required="true">
+ <cfargument name="include" type="string" required="true">
+ <cfargument name="parameterize" type="any" required="true">
+ <cfargument name="distinct" type="boolean" required="false" default="false">
+ <cfargument name="ifNull" type="any" required="false" default="">
+ <cfargument name="includeSoftDeletes" type="boolean" required="true">
+ <cfscript>
+ var loc = {};
+
+ // start the select string with the type (`SUM`, `COUNT` etc)
+ arguments.select = "#arguments.type#(";
+
+ // add the DISTINCT keyword if necessary (generally used for `COUNT` operations when associated tables are joined in the query, means we'll only count the unique primary keys on the current model)
+ if (arguments.distinct)
+ arguments.select = arguments.select & "DISTINCT ";
+
+ // create a list of columns for the `SELECT` clause either from regular properties on the model or calculated ones
+ loc.properties = "";
+ loc.iEnd = ListLen(arguments.property);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.iItem = Trim(ListGetAt(arguments.property, loc.i));
+ if (ListFindNoCase(variables.wheels.class.propertyList, loc.iItem))
+ loc.properties = ListAppend(loc.properties, tableName() & "." & variables.wheels.class.properties[loc.iItem].column);
+ else if (ListFindNoCase(variables.wheels.class.calculatedPropertyList, loc.iItem))
+ loc.properties = ListAppend(loc.properties, variables.wheels.class.calculatedProperties[loc.iItem].sql);
+ }
+ arguments.select = arguments.select & loc.properties;
+
+ // alias the result with `AS`, this means that Wheels will not try and change the string (which is why we have to add the table name above since it won't be done automatically)
+ arguments.select = arguments.select & ") AS wheelsqueryresult";
+
+ // call `findAll` with `select`, `where`, `parameterize` and `include` but delete all other arguments
+ StructDelete(arguments, "type");
+ StructDelete(arguments, "property");
+ StructDelete(arguments, "distinct");
+
+ loc.returnValue = findAll(argumentCollection=arguments).wheelsqueryresult;
+ if (!Len(loc.returnValue) && Len(arguments.ifNull))
+ loc.returnValue = arguments.ifNull;
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/model/callbacks.cfm b/src/main/webapp/wheels/model/callbacks.cfm new file mode 100755 index 0000000..48b0260 --- /dev/null +++ b/src/main/webapp/wheels/model/callbacks.cfm @@ -0,0 +1,367 @@ +<!--- PUBLIC MODEL INITIALIZATION METHODS --->
+
+<cffunction name="afterNew" returntype="void" access="public" output="false" hint="Registers method(s) that should be called after a new object has been initialized (which is usually done with the @new method)."
+ examples=
+ '
+ <!--- Instruct Wheels to call the `fixObj` method --->
+ <cfset afterNew("fixObj")>
+ '
+ categories="model-initialization,callbacks" chapters="object-callbacks" functions="afterCreate,afterDelete,afterFind,afterInitialization,afterSave,afterUpdate,afterValidation,afterValidationOnCreate,afterValidationOnUpdate,beforeCreate,beforeDelete,beforeSave,beforeUpdate,beforeValidation,beforeValidationOnCreate,beforeValidationOnUpdate">
+ <cfargument name="methods" type="string" required="false" default="" hint="Method name or list of method names that should be called when this callback event occurs in an object's life cycle (can also be called with the `method` argument).">
+ <cfset $registerCallback(type="afterNew", argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="afterFind" returntype="void" access="public" output="false" hint="Registers method(s) that should be called after an existing object has been initialized (which is usually done with the @findByKey or @findOne method)."
+ examples=
+ '
+ <!--- Instruct Wheels to call the `setTime` method after getting objects or records with one of the finder methods --->
+ <cffunction name="init">
+ <cfset afterFind("setTime")>
+ </cffunction>
+
+ <cffunction name="setTime">
+ <cfset arguments.fetchedAt = Now()>
+ <cfreturn arguments>
+ </cffunction>
+ '
+ categories="model-initialization,callbacks" chapters="object-callbacks" functions="afterCreate,afterDelete,afterInitialization,afterNew,afterSave,afterUpdate,afterValidation,afterValidationOnCreate,afterValidationOnUpdate,beforeCreate,beforeDelete,beforeSave,beforeUpdate,beforeValidation,beforeValidationOnCreate,beforeValidationOnUpdate">
+ <cfargument name="methods" type="string" required="false" default="" hint="See documentation for @afterNew.">
+ <cfset $registerCallback(type="afterFind", argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="afterInitialization" returntype="void" access="public" output="false" hint="Registers method(s) that should be called after an object has been initialized."
+ examples=
+ '
+ <!--- Instruct Wheels to call the `fixObj` method --->
+ <cfset afterInitialization("fixObj")>
+ '
+ categories="model-initialization,callbacks" chapters="object-callbacks" functions="afterCreate,afterDelete,afterFind,afterNew,afterSave,afterUpdate,afterValidation,afterValidationOnCreate,afterValidationOnUpdate,beforeCreate,beforeDelete,beforeSave,beforeUpdate,beforeValidation,beforeValidationOnCreate,beforeValidationOnUpdate">
+ <cfargument name="methods" type="string" required="false" default="" hint="See documentation for @afterNew.">
+ <cfset $registerCallback(type="afterInitialization", argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="beforeValidation" returntype="void" access="public" output="false" hint="Registers method(s) that should be called before an object is validated."
+ examples=
+ '
+ <!--- Instruct Wheels to call the `fixObj` method --->
+ <cfset beforeValidation("fixObj")>
+ '
+ categories="model-initialization,callbacks" chapters="object-callbacks" functions="afterCreate,afterDelete,afterFind,afterInitialization,afterNew,afterSave,afterUpdate,afterValidation,afterValidationOnCreate,afterValidationOnUpdate,beforeCreate,beforeDelete,beforeSave,beforeUpdate,beforeValidationOnCreate,beforeValidationOnUpdate">
+ <cfargument name="methods" type="string" required="false" default="" hint="See documentation for @afterNew.">
+ <cfset $registerCallback(type="beforeValidation", argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="beforeValidationOnCreate" returntype="void" access="public" output="false" hint="Registers method(s) that should be called before a new object is validated."
+ examples=
+ '
+ <!--- Instruct Wheels to call the `fixObj` method --->
+ <cfset beforeValidationOnCreate("fixObj")>
+ '
+ categories="model-initialization,callbacks" chapters="object-callbacks" functions="afterCreate,afterDelete,afterFind,afterInitialization,afterNew,afterSave,afterUpdate,afterValidation,afterValidationOnCreate,afterValidationOnUpdate,beforeCreate,beforeDelete,beforeSave,beforeUpdate,beforeValidation,beforeValidationOnUpdate">
+ <cfargument name="methods" type="string" required="false" default="" hint="See documentation for @afterNew.">
+ <cfset $registerCallback(type="beforeValidationOnCreate", argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="beforeValidationOnUpdate" returntype="void" access="public" output="false" hint="Registers method(s) that should be called before an existing object is validated."
+ examples=
+ '
+ <!--- Instruct Wheels to call the `fixObj` method --->
+ <cfset beforeValidationOnUpdate("fixObj")>
+ '
+ categories="model-initialization,callbacks" chapters="object-callbacks" functions="afterCreate,afterDelete,afterFind,afterInitialization,afterNew,afterSave,afterUpdate,afterValidation,afterValidationOnCreate,afterValidationOnUpdate,beforeCreate,beforeDelete,beforeSave,beforeUpdate,beforeValidation,beforeValidationOnCreate">
+ <cfargument name="methods" type="string" required="false" default="" hint="See documentation for @afterNew.">
+ <cfset $registerCallback(type="beforeValidationOnUpdate", argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="afterValidation" returntype="void" access="public" output="false" hint="Registers method(s) that should be called after an object is validated."
+ examples=
+ '
+ <!--- Instruct Wheels to call the `fixObj` method --->
+ <cfset afterValidation("fixObj")>
+ '
+ categories="model-initialization,callbacks" chapters="object-callbacks" functions="afterCreate,afterDelete,afterFind,afterInitialization,afterNew,afterSave,afterUpdate,afterValidationOnCreate,afterValidationOnUpdate,beforeCreate,beforeDelete,beforeSave,beforeUpdate,beforeValidation,beforeValidationOnCreate,beforeValidationOnUpdate">
+ <cfargument name="methods" type="string" required="false" default="" hint="See documentation for @afterNew.">
+ <cfset $registerCallback(type="afterValidation", argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="afterValidationOnCreate" returntype="void" access="public" output="false" hint="Registers method(s) that should be called after a new object is validated."
+ examples=
+ '
+ <!--- Instruct Wheels to call the `fixObj` method --->
+ <cfset afterValidationOnCreate("fixObj")>
+ '
+ categories="model-initialization,callbacks" chapters="object-callbacks" functions="afterCreate,afterDelete,afterFind,afterInitialization,afterNew,afterSave,afterUpdate,afterValidation,afterValidationOnUpdate,beforeCreate,beforeDelete,beforeSave,beforeUpdate,beforeValidation,beforeValidationOnCreate,beforeValidationOnUpdate">
+ <cfargument name="methods" type="string" required="false" default="" hint="See documentation for @afterNew.">
+ <cfset $registerCallback(type="afterValidationOnCreate", argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="afterValidationOnUpdate" returntype="void" access="public" output="false" hint="Registers method(s) that should be called after an existing object is validated."
+ examples=
+ '
+ <!--- Instruct Wheels to call the `fixObj` method --->
+ <cfset afterValidationOnUpdate("fixObj")>
+ '
+ categories="model-initialization,callbacks" chapters="object-callbacks" functions="afterCreate,afterDelete,afterFind,afterInitialization,afterNew,afterSave,afterUpdate,afterValidation,afterValidationOnCreate,beforeCreate,beforeDelete,beforeSave,beforeUpdate,beforeValidation,beforeValidationOnCreate,beforeValidationOnUpdate">
+ <cfargument name="methods" type="string" required="false" default="" hint="See documentation for @afterNew.">
+ <cfset $registerCallback(type="afterValidationOnUpdate", argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="beforeSave" returntype="void" access="public" output="false" hint="Registers method(s) that should be called before an object is saved."
+ examples=
+ '
+ <!--- Instruct Wheels to call the `fixObj` method --->
+ <cfset beforeSave("fixObj")>
+ '
+ categories="model-initialization,callbacks" chapters="object-callbacks" functions="afterCreate,afterDelete,afterFind,afterInitialization,afterNew,afterSave,afterUpdate,afterValidation,afterValidationOnCreate,afterValidationOnUpdate,beforeCreate,beforeDelete,beforeUpdate,beforeValidation,beforeValidationOnCreate,beforeValidationOnUpdate">
+ <cfargument name="methods" type="string" required="false" default="" hint="See documentation for @afterNew.">
+ <cfset $registerCallback(type="beforeSave", argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="beforeCreate" returntype="void" access="public" output="false" hint="Registers method(s) that should be called before a new object is created."
+ examples=
+ '
+ <!--- Instruct Wheels to call the `fixObj` method --->
+ <cfset beforeCreate("fixObj")>
+ '
+ categories="model-initialization,callbacks" chapters="object-callbacks" functions="afterCreate,afterDelete,afterFind,afterInitialization,afterNew,afterSave,afterUpdate,afterValidation,afterValidationOnCreate,afterValidationOnUpdate,beforeDelete,beforeSave,beforeUpdate,beforeValidation,beforeValidationOnCreate,beforeValidationOnUpdate">
+ <cfargument name="methods" type="string" required="false" default="" hint="See documentation for @afterNew.">
+ <cfset $registerCallback(type="beforeCreate", argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="beforeUpdate" returntype="void" access="public" output="false" hint="Registers method(s) that should be called before an existing object is updated."
+ examples=
+ '
+ <!--- Instruct Wheels to call the `fixObj` method --->
+ <cfset beforeUpdate("fixObj")>
+ '
+ categories="model-initialization,callbacks" chapters="object-callbacks" functions="afterCreate,afterDelete,afterFind,afterInitialization,afterNew,afterSave,afterUpdate,afterValidation,afterValidationOnCreate,afterValidationOnUpdate,beforeCreate,beforeDelete,beforeSave,beforeValidation,beforeValidationOnCreate,beforeValidationOnUpdate">
+ <cfargument name="methods" type="string" required="false" default="" hint="See documentation for @afterNew.">
+ <cfset $registerCallback(type="beforeUpdate", argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="afterCreate" returntype="void" access="public" output="false" hint="Registers method(s) that should be called after a new object is created."
+ examples=
+ '
+ <!--- Instruct Wheels to call the `fixObj` method --->
+ <cfset afterCreate("fixObj")>
+ '
+ categories="model-initialization,callbacks" chapters="object-callbacks" functions="afterDelete,afterFind,afterInitialization,afterNew,afterSave,afterUpdate,afterValidation,afterValidationOnCreate,afterValidationOnUpdate,beforeCreate,beforeDelete,beforeSave,beforeUpdate,beforeValidation,beforeValidationOnCreate,beforeValidationOnUpdate">
+ <cfargument name="methods" type="string" required="false" default="" hint="See documentation for @afterNew.">
+ <cfset $registerCallback(type="afterCreate", argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="afterUpdate" returntype="void" access="public" output="false" hint="Registers method(s) that should be called after an existing object is updated."
+ examples=
+ '
+ <!--- Instruct Wheels to call the `fixObj` method --->
+ <cfset afterUpdate("fixObj")>
+ '
+ categories="model-initialization,callbacks" chapters="object-callbacks" functions="afterCreate,afterDelete,afterFind,afterInitialization,afterNew,afterSave,afterValidation,afterValidationOnCreate,afterValidationOnUpdate,beforeCreate,beforeDelete,beforeSave,beforeUpdate,beforeValidation,beforeValidationOnCreate,beforeValidationOnUpdate">
+ <cfargument name="methods" type="string" required="false" default="" hint="See documentation for @afterNew.">
+ <cfset $registerCallback(type="afterUpdate", argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="afterSave" returntype="void" access="public" output="false" hint="Registers method(s) that should be called after an object is saved."
+ examples=
+ '
+ <!--- Instruct Wheels to call the `fixObj` method --->
+ <cfset afterSave("fixObj")>
+ '
+ categories="model-initialization,callbacks" chapters="object-callbacks" functions="afterCreate,afterDelete,afterFind,afterInitialization,afterNew,afterUpdate,afterValidation,afterValidationOnCreate,afterValidationOnUpdate,beforeCreate,beforeDelete,beforeSave,beforeUpdate,beforeValidation,beforeValidationOnCreate,beforeValidationOnUpdate">
+ <cfargument name="methods" type="string" required="false" default="" hint="See documentation for @afterNew.">
+ <cfset $registerCallback(type="afterSave", argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="beforeDelete" returntype="void" access="public" output="false" hint="Registers method(s) that should be called before an object is deleted."
+ examples=
+ '
+ <!--- Instruct Wheels to call the `fixObj` method --->
+ <cfset beforeDelete("fixObj")>
+ '
+ categories="model-initialization,callbacks" chapters="object-callbacks" functions="afterCreate,afterDelete,afterFind,afterInitialization,afterNew,afterSave,afterUpdate,afterValidation,afterValidationOnCreate,afterValidationOnUpdate,beforeCreate,beforeSave,beforeUpdate,beforeValidation,beforeValidationOnCreate,beforeValidationOnUpdate">
+ <cfargument name="methods" type="string" required="false" default="" hint="See documentation for @afterNew.">
+ <cfset $registerCallback(type="beforeDelete", argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="afterDelete" returntype="void" access="public" output="false" hint="Registers method(s) that should be called after an object is deleted."
+ examples=
+ '
+ <!--- Instruct Wheels to call the `fixObj` method --->
+ <cfset afterDelete("fixObj")>
+ '
+ categories="model-initialization,callbacks" chapters="object-callbacks" functions="afterCreate,afterFind,afterInitialization,afterNew,afterSave,afterUpdate,afterValidation,afterValidationOnCreate,afterValidationOnUpdate,beforeCreate,beforeDelete,beforeSave,beforeUpdate,beforeValidation,beforeValidationOnCreate,beforeValidationOnUpdate">
+ <cfargument name="methods" type="string" required="false" default="" hint="See documentation for @afterNew.">
+ <cfset $registerCallback(type="afterDelete", argumentCollection=arguments)>
+</cffunction>
+
+<!--- PRIVATE MODEL INITIALIZATION METHODS --->
+
+<cffunction name="$registerCallback" returntype="void" access="public" output="false">
+ <cfargument name="type" type="string" required="true">
+ <cfargument name="methods" type="string" required="true">
+ <cfscript>
+ var loc = {};
+ // create this type in the array if it doesn't already exist
+ if (not StructKeyExists(variables.wheels.class.callbacks,arguments.type))
+ variables.wheels.class.callbacks[arguments.type] = ArrayNew(1);
+ loc.existingCallbacks = ArrayToList(variables.wheels.class.callbacks[arguments.type]);
+ if (StructKeyExists(arguments, "method"))
+ arguments.methods = arguments.method;
+ arguments.methods = $listClean(arguments.methods);
+ loc.iEnd = ListLen(arguments.methods);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ if (!ListFindNoCase(loc.existingCallbacks, ListGetAt(arguments.methods, loc.i)))
+ ArrayAppend(variables.wheels.class.callbacks[arguments.type], ListGetAt(arguments.methods, loc.i));
+ </cfscript>
+</cffunction>
+
+<cffunction name="$clearCallbacks" returntype="void" access="public" output="false" hint="Removes all callbacks registered for this model. Pass in the `type` argument to only remove callbacks for that specific type.">
+ <cfargument name="type" type="string" required="false" default="" hint="Type of callback (`beforeSave` etc).">
+ <cfscript>
+ var loc = {};
+ // clean up the list of types passed in
+ arguments.type = $listClean(list="#arguments.type#", returnAs="array");
+ // no type(s) was passed in. get all the callback types registered
+ if (ArrayIsEmpty(arguments.type))
+ {
+ arguments.type = ListToArray(StructKeyList(variables.wheels.class.callbacks));
+ }
+ // loop through each callback type and clear it
+ loc.iEnd = ArrayLen(arguments.type);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ variables.wheels.class.callbacks[arguments.type[loc.i]] = [];
+ }
+ </cfscript>
+</cffunction>
+
+<cffunction name="$callbacks" returntype="any" access="public" output="false" hint="Returns all registered callbacks for this model (as a struct). Pass in the `type` argument to only return callbacks for that specific type (as an array).">
+ <cfargument name="type" type="string" required="false" default="" hint="See documentation for @$clearCallbacks.">
+ <cfscript>
+ if (Len(arguments.type))
+ {
+ if (StructKeyExists(variables.wheels.class.callbacks,arguments.type))
+ return variables.wheels.class.callbacks[arguments.type];
+ return ArrayNew(1);
+ }
+ return variables.wheels.class.callbacks;
+ </cfscript>
+</cffunction>
+
+
+<!--- PRIVATE MODEL OBJECT METHODS --->
+
+<cffunction name="$callback" returntype="boolean" access="public" output="false" hint="Executes all callback methods for a specific type. Will stop execution on the first callback that returns `false`.">
+ <cfargument name="type" type="string" required="true" hint="See documentation for @$clearCallbacks.">
+ <cfargument name="execute" type="boolean" required="true" hint="A query is passed in here for `afterFind` callbacks.">
+ <cfargument name="collection" type="any" required="false" default="" hint="A query is passed in here for `afterFind` callbacks.">
+ <cfscript>
+ var loc = {};
+
+ if (!arguments.execute)
+ return true;
+
+ // get all callbacks for the type and loop through them all until the end or one of them returns false
+ loc.callbacks = $callbacks(arguments.type);
+ loc.iEnd = ArrayLen(loc.callbacks);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.method = loc.callbacks[loc.i];
+ if (arguments.type == "afterFind")
+ {
+ // since this is an afterFind callback we need to handle it differently
+ if (IsQuery(arguments.collection))
+ {
+ loc.returnValue = $queryCallback(method=loc.method, collection=arguments.collection);
+ }
+ else
+ {
+ loc.invokeArgs = properties();
+ loc.returnValue = $invoke(method=loc.method, invokeArgs=loc.invokeArgs);
+ if (StructKeyExists(loc, "returnValue") && IsStruct(loc.returnValue))
+ {
+ setProperties(loc.returnValue);
+ StructDelete(loc, "returnValue");
+ }
+ }
+ }
+ else
+ {
+ // this is a regular callback so just call the method
+ loc.returnValue = $invoke(method=loc.method);
+ }
+
+ // break the loop if the callback returned false
+ if (StructKeyExists(loc, "returnValue") && IsBoolean(loc.returnValue) && !loc.returnValue)
+ break;
+ }
+
+ // return true by default (happens when no callbacks are set or none of the callbacks returned a result)
+ if (!StructKeyExists(loc, "returnValue"))
+ loc.returnValue = true;
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$queryCallback" returntype="boolean" access="public" output="false" hint="Loops over the passed in query, calls the callback method for each row and changes the query based on the arguments struct that is passed back.">
+ <cfargument name="method" type="string" required="true" hint="The method to call.">
+ <cfargument name="collection" type="query" required="true" hint="See documentation for @$callback.">
+ <cfscript>
+ var loc = {};
+
+ // we return true by default
+ // will be overridden only if the callback method returns false on one of the iterations
+ loc.returnValue = true;
+
+ // loop over all query rows and execute the callback method for each
+ loc.jEnd = arguments.collection.recordCount;
+ for (loc.j=1; loc.j <= loc.jEnd; loc.j++)
+ {
+ // get the values in the current query row so that we can pass them in as arguments to the callback method
+ loc.invokeArgs = {};
+ loc.kEnd = ListLen(arguments.collection.columnList);
+ for (loc.k=1; loc.k <= loc.kEnd; loc.k++)
+ {
+ loc.kItem = ListGetAt(arguments.collection.columnList, loc.k);
+ try // coldfusion has a problem with empty strings in queries for bit types
+ {
+ loc.invokeArgs[loc.kItem] = arguments.collection[loc.kItem][loc.j];
+ }
+ catch (Any e)
+ {
+ loc.invokeArgs[loc.kItem] = "";
+ }
+ }
+
+ // execute the callback method
+ loc.result = $invoke(method=arguments.method, invokeArgs=loc.invokeArgs);
+
+ if (StructKeyExists(loc, "result"))
+ {
+ if (IsStruct(loc.result))
+ {
+ // the arguments struct was returned so we need to add the changed values to the query row
+ for (loc.key in loc.result)
+ {
+ // add a new column to the query if a value was passed back for a column that did not exist originally
+ if (!ListFindNoCase(arguments.collection.columnList, loc.key))
+ QueryAddColumn(arguments.collection, loc.key, ArrayNew(1));
+ arguments.collection[loc.key][loc.j] = loc.result[loc.key];
+ }
+ }
+ else if (IsBoolean(loc.result) && !loc.result)
+ {
+ // break the loop and return false if the callback returned false
+ loc.returnValue = false;
+ break;
+ }
+ }
+ }
+
+ // update the request with a hash of the query if it changed so that we can find it with pagination
+ loc.querykey = $hashedKey(arguments.collection);
+ if (!StructKeyExists(request.wheels, loc.querykey))
+ request.wheels[loc.querykey] = variables.wheels.class.modelName;
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/model/crud.cfm b/src/main/webapp/wheels/model/crud.cfm new file mode 100755 index 0000000..cfb0664 --- /dev/null +++ b/src/main/webapp/wheels/model/crud.cfm @@ -0,0 +1,1070 @@ +<!--- PUBLIC MODEL CLASS METHODS --->
+
+<!--- create --->
+
+<cffunction name="create" returntype="any" access="public" output="false" hint="Creates a new object, saves it to the database (if the validation permits it), and returns it. If the validation fails, the unsaved object (with errors added to it) is still returned. Property names and values can be passed in either using named arguments or as a struct to the `properties` argument."
+ examples=
+ '
+ <!--- Create a new author and save it to the database --->
+ <cfset newAuthor = model("author").create(params.author)>
+
+ <!--- Same as above using named arguments --->
+ <cfset newAuthor = model("author").create(firstName="John", lastName="Doe")>
+
+ <!--- Same as above using both named arguments and a struct --->
+ <cfset newAuthor = model("author").create(active=1, properties=params.author)>
+
+ <!--- If you have a `hasOne` or `hasMany` association setup from `customer` to `order`, you can do a scoped call. (The `createOrder` method below will call `model("order").create(customerId=aCustomer.id, shipping=params.shipping)` internally.) --->
+ <cfset aCustomer = model("customer").findByKey(params.customerId)>
+ <cfset anOrder = aCustomer.createOrder(shipping=params.shipping)>
+ '
+ categories="model-class,create" chapters="creating-records,associations" functions="hasOne,hasMany,new">
+ <cfargument name="properties" type="struct" required="false" default="#StructNew()#" hint="See documentation for @new.">
+ <cfargument name="parameterize" type="any" required="false" hint="See documentation for @findAll.">
+ <cfargument name="reload" type="boolean" required="false" hint="See documentation for @save.">
+ <cfargument name="transaction" type="string" required="false" default="#application.wheels.transactionMode#" hint="See documentation for @save.">
+ <cfargument name="callbacks" type="boolean" required="false" default="true" hint="See documentation for @save.">
+ <cfscript>
+ var loc = {};
+ $args(name="create", args=arguments);
+ loc.parameterize = arguments.parameterize;
+ StructDelete(arguments, "parameterize");
+ loc.returnValue = new(argumentCollection=arguments);
+ loc.returnValue.save(parameterize=loc.parameterize, reload=arguments.reload, transaction=arguments.transaction, callbacks=arguments.callbacks);
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="new" returntype="any" access="public" output="false" hint="Creates a new object based on supplied properties and returns it. The object is not saved to the database; it only exists in memory. Property names and values can be passed in either using named arguments or as a struct to the `properties` argument."
+ examples=
+ '
+ <!--- Create a new author in memory (not saved to the database) --->
+ <cfset newAuthor = model("author").new()>
+
+ <!--- Create a new author based on properties in a struct --->
+ <cfset newAuthor = model("author").new(params.authorStruct)>
+
+ <!--- Create a new author by passing in named arguments --->
+ <cfset newAuthor = model("author").new(firstName="John", lastName="Doe")>
+
+ <!--- If you have a `hasOne` or `hasMany` association setup from `customer` to `order`, you can do a scoped call. (The `newOrder` method below will call `model("order").new(customerId=aCustomer.id)` internally.) --->
+ <cfset aCustomer = model("customer").findByKey(params.customerId)>
+ <cfset anOrder = aCustomer.newOrder(shipping=params.shipping)>
+ '
+ categories="model-class,create" chapters="creating-records,associations" functions="create,hasMany,hasOne">
+ <cfargument name="properties" type="struct" required="false" default="#StructNew()#" hint="The properties you want to set on the object (can also be passed in as named arguments).">
+ <cfargument name="callbacks" type="boolean" required="false" default="true" hint="See documentation for @save.">
+ <cfscript>
+ var loc = {};
+ arguments.properties = $setProperties(argumentCollection=arguments, filterList="properties,reload,transaction,callbacks", setOnModel=false);
+ loc.returnValue = $createInstance(properties=arguments.properties, persisted=false, callbacks=arguments.callbacks);
+ loc.returnValue.$setDefaultValues();
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<!--- read --->
+
+<cffunction name="findAll" returntype="any" access="public" output="false" hint="Returns records from the database table mapped to this model according to the arguments passed in. (Use the `where` argument to decide which records to get, use the `order` argument to set in what order those records should be returned, and so on). The records will be returned as either a `cfquery` result set or an array of objects (depending on what the `returnAs` argument is set to). Instead of using the `where` argument, you can create cleaner code by making use of a concept called dynamic finders."
+ examples=
+ '
+ <!--- Getting only 5 users and ordering them randomly --->
+ <cfset fiveRandomUsers = model("user").findAll(maxRows=5, order="random")>
+
+ <!--- Including an association (which in this case needs to be setup as a `belongsTo` association to `author` on the `article` model first) --->
+ <cfset articles = model("article").findAll(where="published=1", order="createdAt DESC", include="author")>
+
+ <!--- Similar to the above but using the association in the opposite direction (which needs to be setup as a `hasMany` association to `article` on the `author` model) --->
+ <cfset bobsArticles = model("author").findAll(where="firstName=''Bob''", include="articles")>
+
+ <!--- Using pagination (getting records 26-50 in this case) and a more complex way to include associations (a song `belongsTo` an album, which in turn `belongsTo` an artist) --->
+ <cfset songs = model("song").findAll(include="album(artist)", page=2, perPage=25)>
+
+ <!--- Using a dynamic finder to get all books released a certain year. Same as calling model("book").findOne(where="releaseYear=##params.year##") --->
+ <cfset books = model("book").findAllByReleaseYear(params.year)>
+
+ <!--- Getting all books of a certain type from a specific year by using a dynamic finder. Same as calling model("book").findAll(where="releaseYear=##params.year## AND type=''##params.type##''") --->
+ <cfset books = model("book").findAllByReleaseYearAndType("##params.year##,##params.type##")>
+
+ <!--- If you have a `hasMany` association setup from `post` to `comment`, you can do a scoped call. (The `comments` method below will call `model("comment").findAll(where="postId=##post.id##")` internally) --->
+ <cfset post = model("post").findByKey(params.postId)>
+ <cfset comments = post.comments()>
+ '
+ categories="model-class,read" chapters="reading-records,associations" functions="findByKey,findOne,hasMany">
+ <cfargument name="where" type="string" required="false" default="" hint="This argument maps to the `WHERE` clause of the query. The following operators are supported: `=`, `!=`, `<>`, `<`, `<=`, `>`, `>=`, `LIKE`, `NOT LIKE`, `IN`, `NOT IN`, `IS NULL`, `IS NOT NULL`, `AND`, and `OR`. (Note that the key words need to be written in upper case.) You can also use parentheses to group statements. You do not need to specify the table name(s); Wheels will do that for you.">
+ <cfargument name="order" type="string" required="false" hint="Maps to the `ORDER BY` clause of the query. You do not need to specify the table name(s); Wheels will do that for you.">
+ <cfargument name="group" type="string" required="false" hint="Maps to the `GROUP BY` clause of the query. You do not need to specify the table name(s); Wheels will do that for you.">
+ <cfargument name="select" type="string" required="false" default="" hint="Determines how the `SELECT` clause for the query used to return data will look. You can pass in a list of the properties (which map to columns) that you want returned from your table(s). If you don't set this argument at all, Wheels will select all properties from your table(s). If you specify a table name (e.g. `users.email`) or alias a column (e.g. `fn AS firstName`) in the list, then the entire list will be passed through unchanged and used in the `SELECT` clause of the query. By default, all column names in tables `JOIN`ed via the `include` argument will be prepended with the singular version of the included table name.">
+ <cfargument name="distinct" type="boolean" required="false" default="false" hint="Whether to add the `DISTINCT` keyword to your `SELECT` clause. Wheels will, when necessary, add this automatically (when using pagination and a `hasMany` association is used in the `include` argument, to name one example).">
+ <cfargument name="include" type="string" required="false" default="" hint="Associations that should be included in the query using `INNER` or `LEFT OUTER` joins (which join type that is used depends on how the association has been set up in your model). If all included associations are set on the current model, you can specify them in a list (e.g. `department,addresses,emails`). You can build more complex `include` strings by using parentheses when the association is set on an included model, like `album(artist(genre))`, for example. These complex `include` strings only work when `returnAs` is set to `query` though.">
+ <cfargument name="maxRows" type="numeric" required="false" default="-1" hint="Maximum number of records to retrieve. Passed on to the `maxRows` `cfquery` attribute. The default, `-1`, means that all records will be retrieved.">
+ <cfargument name="page" type="numeric" required="false" default=0 hint="If you want to paginate records, you can do so by specifying a page number here. For example, getting records 11-20 would be page number 2 when `perPage` is kept at the default setting (10 records per page). The default, `0`, means that records won't be paginated and that the `perPage`, `count`, and `handle` arguments will be ignored.">
+ <cfargument name="perPage" type="numeric" required="false" hint="When using pagination, you can specify how many records you want to fetch per page here. This argument is only used when the `page` argument has been passed in.">
+ <cfargument name="count" type="numeric" required="false" default=0 hint="When using pagination and you know in advance how many records you want to paginate through, you can pass in that value here. Doing so will prevent Wheels from running a `COUNT` query to get this value. This argument is only used when the `page` argument has been passed in.">
+ <cfargument name="handle" type="string" required="false" default="query" hint="Handle to use for the query in pagination. This is useful when you're paginating multiple queries and need to reference them in the @paginationLinks function, for example. This argument is only used when the `page` argument has been passed in.">
+ <cfargument name="cache" type="any" required="false" default="" hint="If you want to cache the query, you can do so by specifying the number of minutes you want to cache the query for here. If you set it to `true`, the default cache time will be used (60 minutes).">
+ <cfargument name="reload" type="boolean" required="false" hint="Set to `true` to force Wheels to query the database even though an identical query may have been run in the same request. (The default in Wheels is to get the second query from the request-level cache.)">
+ <cfargument name="parameterize" type="any" required="false" hint="Set to `true` to use `cfqueryparam` on all columns, or pass in a list of property names to use `cfqueryparam` on those only.">
+ <cfargument name="returnAs" type="string" required="false" hint="Set this to `objects` to return an array of objects. Set this to `query` to return a query result set.">
+ <cfargument name="returnIncluded" type="boolean" required="false" hint="When `returnAs` is set to `objects`, you can set this argument to `false` to prevent returning objects fetched from associations specified in the `include` argument. This is useful when you only need to include associations for use in the `WHERE` clause only and want to avoid the performance hit that comes with object creation.">
+ <cfargument name="callbacks" type="boolean" required="false" default="true" hint="You can set this argument to `false` to prevent running the execution of callbacks for a method call.">
+ <cfargument name="includeSoftDeletes" type="boolean" required="false" default="false" hint="You can set this argument to `true` to include soft-deleted records in the results.">
+ <cfargument name="$limit" type="numeric" required="false" default=0>
+ <cfargument name="$offset" type="numeric" required="false" default=0>
+ <cfscript>
+ var loc = {};
+ $args(name="findAll", args=arguments);
+
+ // we only allow direct associations to be loaded when returning objects
+ if (application.wheels.showErrorInformation && Len(arguments.returnAs) && arguments.returnAs != "query" && Find("(", arguments.include) && arguments.returnIncluded)
+ $throw(type="Wheels", message="Incorrect Arguments", extendedInfo="You may only include direct associations to this object when returning an array of objects.");
+
+ // count records and get primary keys for pagination
+ if (arguments.page)
+ {
+ if (application.wheels.showErrorInformation && arguments.perPage lte 0)
+ $throw(type="Wheels", message="Incorrect Argument", extendedInfo="The perPage argument should be a positive numeric value.");
+
+ if (Len(arguments.order))
+ {
+ // insert primary keys to order clause unless they are already there, this guarantees that the ordering is unique which is required to make pagination work properly
+ loc.compareList = $listClean(ReplaceNoCase(ReplaceNoCase(arguments.order, " ASC", "", "all"), " DESC", "", "all"));
+ loc.iEnd = ListLen(primaryKeys());
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.iItem = primaryKeys(loc.i);
+ if (!ListFindNoCase(loc.compareList, loc.iItem) && !ListFindNoCase(loc.compareList, tableName() & "." & loc.iItem))
+ arguments.order = ListAppend(arguments.order, loc.iItem);
+ }
+ }
+ else
+ {
+ // we can't paginate without any order so we default to ascending ordering by the primary key column(s)
+ arguments.order = primaryKey();
+ }
+ if (Len(arguments.include))
+ loc.distinct = true;
+ else
+ loc.distinct = false;
+ if (arguments.count gt 0)
+ loc.totalRecords = arguments.count;
+ else
+ loc.totalRecords = this.count(where=arguments.where, include=arguments.include, reload=arguments.reload, cache=arguments.cache, distinct=loc.distinct, parameterize=arguments.parameterize, includeSoftDeletes=arguments.includeSoftDeletes);
+ loc.currentPage = arguments.page;
+ if (loc.totalRecords == 0)
+ {
+ loc.totalPages = 0;
+ loc.returnValue = "";
+ }
+ else
+ {
+ loc.totalPages = Ceiling(loc.totalRecords/arguments.perPage);
+ loc.limit = arguments.perPage;
+ loc.offset = (arguments.perPage * arguments.page) - arguments.perPage;
+
+ // if the full range of records is not requested we correct the limit to get the exact amount instead
+ // for example if totalRecords is 57, limit is 10 and offset 50 (i.e. requesting records 51-60) we change the limit to 7
+ if ((loc.limit + loc.offset) gt loc.totalRecords)
+ loc.limit = loc.totalRecords - loc.offset;
+
+ if (loc.limit < 1)
+ {
+ // if limit is 0 or less it means that a page that has no records was asked for so we return an empty query
+ loc.returnValue = "";
+ }
+ else
+ {
+ loc.values = findAll($limit=loc.limit, $offset=loc.offset, select=primaryKeys(), where=arguments.where, order=arguments.order, include=arguments.include, reload=arguments.reload, cache=arguments.cache, distinct=loc.distinct, parameterize=arguments.parameterize, includeSoftDeletes=arguments.includeSoftDeletes);
+ if (loc.values.RecordCount)
+ {
+ loc.paginationWhere = "";
+ for (loc.k=1; loc.k <= loc.values.RecordCount; loc.k++)
+ {
+ loc.keyComboValues = [];
+ loc.iEnd = ListLen(primaryKeys());
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.property = primaryKeys(loc.i);
+ ArrayAppend(loc.keyComboValues, "#tableName()#.#loc.property# = #variables.wheels.class.adapter.$quoteValue(str=loc.values[loc.property][loc.k], type=validationTypeForProperty(loc.property))#");
+ }
+ loc.paginationWhere = ListAppend(loc.paginationWhere, "(" & ArrayToList(loc.keyComboValues, " AND ") & ")", Chr(7));
+ }
+ loc.paginationWhere = Replace(loc.paginationWhere, Chr(7), " OR ", "all");
+ if (Len(arguments.where) && Len(arguments.include)) // this can be improved to also check if the where clause checks on a joined table, if not we can use the simple where clause with just the ids
+ arguments.where = "(#arguments.where#) AND (#loc.paginationWhere#)";
+ else
+ {
+ arguments.where = loc.paginationWhere;
+ }
+ }
+ }
+ }
+ // store pagination info in the request scope so all pagination methods can access it
+ setPagination(loc.totalRecords, loc.currentPage, arguments.perPage, arguments.handle);
+ }
+
+ if (StructKeyExists(loc, "returnValue") && !Len(loc.returnValue))
+ {
+ if (arguments.returnAs == "query")
+ loc.returnValue = QueryNew("");
+ else if (singularize(arguments.returnAs) == arguments.returnAs)
+ loc.returnValue = false;
+ else
+ loc.returnValue = ArrayNew(1);
+ }
+ else if (!StructKeyExists(loc, "returnValue"))
+ {
+ // make the where clause generic for use in caching
+ loc.originalWhere = arguments.where;
+ arguments.where = REReplace(arguments.where, variables.wheels.class.RESQLWhere, "\1?\8" , "all");
+
+ // get info from cache when available, otherwise create the generic select, from, where and order by clause
+ loc.queryShellKey = $hashedKey(variables.wheels.class.modelName, arguments);
+ loc.sql = $getFromCache(loc.queryShellKey, "sql");
+ if (!IsArray(loc.sql))
+ {
+ loc.sql = [];
+ ArrayAppend(loc.sql, $selectClause(select=arguments.select, include=arguments.include, returnAs=arguments.returnAs));
+ ArrayAppend(loc.sql, $fromClause(include=arguments.include, includeSoftDeletes=arguments.includeSoftDeletes));
+ loc.sql = $addWhereClause(sql=loc.sql, where=loc.originalWhere, include=arguments.include, includeSoftDeletes=arguments.includeSoftDeletes);
+ loc.groupBy = $groupByClause(select=arguments.select, group=arguments.group, include=arguments.include, distinct=arguments.distinct, returnAs=arguments.returnAs);
+ if (Len(loc.groupBy))
+ ArrayAppend(loc.sql, loc.groupBy);
+ loc.orderBy = $orderByClause(order=arguments.order, include=arguments.include);
+ if (Len(loc.orderBy))
+ ArrayAppend(loc.sql, loc.orderBy);
+ $addToCache(key=loc.queryShellKey, value=loc.sql, category="sql");
+ }
+
+ // add where clause parameters to the generic sql info
+ loc.sql = $addWhereClauseParameters(sql=loc.sql, where=loc.originalWhere);
+
+ // return existing query result if it has been run already in current request, otherwise pass off the sql array to the query
+ loc.queryKey = $hashedKey(variables.wheels.class.modelName, arguments, loc.originalWhere);
+ if (application.wheels.cacheQueriesDuringRequest && !arguments.reload && StructKeyExists(request.wheels, loc.queryKey))
+ {
+ loc.findAll = request.wheels[loc.queryKey];
+ }
+ else
+ {
+ loc.finderArgs = {};
+ loc.finderArgs.sql = loc.sql;
+ loc.finderArgs.maxRows = arguments.maxRows;
+ loc.finderArgs.parameterize = arguments.parameterize;
+ loc.finderArgs.limit = arguments.$limit;
+ loc.finderArgs.offset = arguments.$offset;
+ loc.finderArgs.$primaryKey = primaryKeys();
+ if (application.wheels.cacheQueries && (IsNumeric(arguments.cache) || (IsBoolean(arguments.cache) && arguments.cache)))
+ loc.finderArgs.cachedWithin = $timeSpanForCache(arguments.cache);
+ loc.findAll = variables.wheels.class.adapter.$query(argumentCollection=loc.finderArgs);
+ request.wheels[loc.queryKey] = loc.findAll; // <- store in request cache so we never run the exact same query twice in the same request
+ }
+ request.wheels[$hashedKey(loc.findAll.query)] = variables.wheels.class.modelName; // place an identifer in request scope so we can reference this query when passed in to view functions
+
+ switch (arguments.returnAs)
+ {
+ case "query":
+ {
+ loc.returnValue = loc.findAll.query;
+ // execute callbacks unless we're currently running the count or primary key pagination queries (we only want the callback to run when we have the actual data)
+ if (loc.returnValue.columnList != "wheelsqueryresult" && !arguments.$limit && !arguments.$offset)
+ $callback("afterFind", arguments.callbacks, loc.returnValue);
+ break;
+ }
+ case "struct": case "structs":
+ {
+ loc.returnValue = $serializeQueryToStructs(query=loc.findAll.query, argumentCollection=arguments);
+ break;
+ }
+ case "object": case "objects":
+ {
+ loc.returnValue = $serializeQueryToObjects(query=loc.findAll.query, argumentCollection=arguments);
+ break;
+ }
+ default:
+ {
+ if (application.wheels.showErrorInformation)
+ $throw(type="Wheels.IncorrectArgumentValue", message="Incorrect Arguments", extendedInfo="The `returnAs` may be either `query`, `struct(s)` or `object(s)`");
+ break;
+ }
+ }
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="findByKey" returntype="any" access="public" output="false" hint="Fetches the requested record by primary key and returns it as an object. Returns `false` if no record is found. You can override this behavior to return a `cfquery` result set instead, similar to what's described in the documentation for @findOne."
+ examples=
+ '
+ <!--- Getting the author with the primary key value `99` as an object --->
+ <cfset auth = model("author").findByKey(99)>
+
+ <!--- Getting an author based on a form/URL value and then checking if it was found --->
+ <cfset auth = model("author").findByKey(params.key)>
+ <cfif NOT IsObject(auth)>
+ <cfset flashInsert(message="Author ##params.key## was not found")>
+ <cfset redirectTo(back=true)>
+ </cfif>
+
+ <!--- If you have a `belongsTo` association setup from `comment` to `post`, you can do a scoped call. (The `post` method below will call `model("post").findByKey(comment.postId)` internally) --->
+ <cfset comment = model("comment").findByKey(params.commentId)>
+ <cfset post = comment.post()>
+ '
+ categories="model-class,read" chapters="reading-records,associations" functions="belongsTo,findAll,findOne">
+ <cfargument name="key" type="any" required="true" hint="Primary key value(s) of the record to fetch. Separate with comma if passing in multiple primary key values. Accepts a string, list, or a numeric value.">
+ <cfargument name="select" type="string" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="include" type="string" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="cache" type="any" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="reload" type="boolean" required="false" hint="See documentation for @findAll.">
+ <cfargument name="parameterize" type="any" required="false" hint="See documentation for @findAll.">
+ <cfargument name="returnAs" type="string" required="false" hint="See documentation for @findOne.">
+ <cfargument name="callbacks" type="boolean" required="false" default="true" hint="See documentation for @save.">
+ <cfargument name="includeSoftDeletes" type="boolean" required="false" default="false" hint="See documentation for @findAll.">
+ <cfscript>
+ var returnValue = "";
+ $args(name="findByKey", args=arguments);
+ if (Len(arguments.key))
+ {
+ $keyLengthCheck(arguments.key);
+ }
+ // convert primary key column name(s) / value(s) to a WHERE clause that is then used in the findOne call
+ arguments.where = $keyWhereString(values=arguments.key);
+ StructDelete(arguments, "key");
+ returnValue = findOne(argumentCollection=arguments);
+ </cfscript>
+ <cfreturn returnValue>
+</cffunction>
+
+<cffunction name="findOne" returntype="any" access="public" output="false" hint="Fetches the first record found based on the `WHERE` and `ORDER BY` clauses. With the default settings (i.e. the `returnAs` argument set to `object`), a model object will be returned if the record is found and the boolean value `false` if not. Instead of using the `where` argument, you can create cleaner code by making use of a concept called dynamic finders."
+ examples=
+ '
+ <!--- Getting the most recent order as an object from the database --->
+ <cfset order = model("order").findOne(order="datePurchased DESC")>
+
+ <!--- Using a dynamic finder to get the first person with the last name `Smith`. Same as calling `model("user").findOne(where"lastName=''Smith''")` --->
+ <cfset person = model("user").findOneByLastName("Smith")>
+
+ <!--- Getting a specific user using a dynamic finder. Same as calling `model("user").findOne(where"email=''someone@somewhere.com'' AND password=''mypass''")` --->
+ <cfset user = model("user").findOneByEmailAndPassword("someone@somewhere.com,mypass")>
+
+ <!--- If you have a `hasOne` association setup from `user` to `profile`, you can do a scoped call. (The `profile` method below will call `model("profile").findOne(where="userId=##user.id##")` internally) --->
+ <cfset user = model("user").findByKey(params.userId)>
+ <cfset profile = user.profile()>
+
+ <!--- If you have a `hasMany` association setup from `post` to `comment`, you can do a scoped call. (The `findOneComment` method below will call `model("comment").findOne(where="postId=##post.id##")` internally) --->
+ <cfset post = model("post").findByKey(params.postId)>
+ <cfset comment = post.findOneComment(where="text=''I Love Wheels!''")>
+ '
+ categories="model-class,read" chapters="reading-records,associations" functions="findAll,findByKey,hasMany,hasOne">
+ <cfargument name="where" type="string" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="order" type="string" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="select" type="string" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="include" type="string" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="cache" type="any" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="reload" type="boolean" required="false" hint="See documentation for @findAll.">
+ <cfargument name="parameterize" type="any" required="false" hint="See documentation for @findAll.">
+ <cfargument name="returnAs" type="string" required="false" hint="Set this to `query` to return as a single-row query result set. Set this to `object` to return as an object.">
+ <cfargument name="includeSoftDeletes" type="boolean" required="false" default="false" hint="See documentation for @findAll.">
+ <cfscript>
+ var returnValue = "";
+ $args(name="findOne", args=arguments);
+ if (!Len(arguments.include) || (StructKeyExists(variables.wheels.class.associations, arguments.include) && variables.wheels.class.associations[arguments.include].type != "hasMany"))
+ {
+ // no joins will be done or the join will be done to a single record so we can safely get just one record from the database
+ // note that the check above can be improved to go through the entire include string and check if all associations are "single" (i.e. hasOne or belongsTo)
+ arguments.maxRows = 1;
+ }
+ else
+ {
+ // since we're joining with associated tables (and not to just one record) we could potentially get duplicate records for one object and we work around this by using the pagination code which has this functionality built in
+ arguments.page = 1;
+ arguments.perPage = 1;
+ arguments.count = 1;
+ }
+ returnValue = findAll(argumentCollection=arguments);
+ if (IsArray(returnValue))
+ {
+ if (ArrayLen(returnValue))
+ returnValue = returnValue[1];
+ else
+ returnValue = false;
+ }
+ </cfscript>
+ <cfreturn returnValue>
+</cffunction>
+
+<!--- update --->
+
+<cffunction name="updateAll" returntype="numeric" access="public" output="false" hint="Updates all properties for the records that match the `where` argument. Property names and values can be passed in either using named arguments or as a struct to the `properties` argument. By default, objects will not be instantiated and therefore callbacks and validations are not invoked. You can change this behavior by passing in `instantiate=true`. This method returns the number of records that were updated."
+ examples=
+ '
+ <!--- Update the `published` and `publishedAt` properties for all records that have `published=0` --->
+ <cfset recordsUpdated = model("post").updateAll(published=1, publishedAt=Now(), where="published=0")>
+
+ <!--- If you have a `hasMany` association setup from `post` to `comment`, you can do a scoped call. (The `removeAllComments` method below will call `model("comment").updateAll(postid="", where="postId=##post.id##")` internally.) --->
+ <cfset aPost = model("post").findByKey(params.postId)>
+ <cfset removedSuccessfully = aPost.removeAllComments()>
+ '
+ categories="model-class,update" chapters="updating-records,associations" functions="hasMany,update,updateByKey,updateOne">
+ <cfargument name="where" type="string" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="include" type="string" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="properties" type="struct" required="false" default="#StructNew()#" hint="See documentation for @new.">
+ <cfargument name="reload" type="boolean" required="false" hint="See documentation for @findAll.">
+ <cfargument name="parameterize" type="any" required="false" hint="See documentation for @findAll.">
+ <cfargument name="instantiate" type="boolean" required="false" hint="Whether or not to instantiate the object(s) first. When objects are not instantiated, any callbacks and validations set on them will be skipped.">
+ <cfargument name="validate" type="boolean" required="false" default="true" hint="See documentation for @save.">
+ <cfargument name="transaction" type="string" required="false" default="#application.wheels.transactionMode#" hint="See documentation for @save.">
+ <cfargument name="callbacks" type="boolean" required="false" default="true" hint="See documentation for @save.">
+ <cfargument name="includeSoftDeletes" type="boolean" required="false" default="false" hint="See documentation for @findAll.">
+ <cfscript>
+ var loc = {};
+ $args(name="updateAll", args=arguments);
+ arguments.properties = $setProperties(argumentCollection=arguments, filterList="where,include,properties,reload,parameterize,instantiate,validate,transaction,callbacks,includeSoftDeletes", setOnModel=false);
+
+ if (arguments.instantiate) // find and instantiate each object and call its update function
+ {
+ loc.returnValue = 0;
+ loc.objects = findAll(select=propertyNames(), where=arguments.where, include=arguments.include, reload=arguments.reload, parameterize=arguments.parameterize, callbacks=arguments.callbacks, includeSoftDeletes=arguments.includeSoftDeletes, returnIncluded=false, returnAs="objects");
+ for (loc.i=1; loc.i lte ArrayLen(loc.objects); loc.i++)
+ {
+ if (loc.objects[loc.i].update(properties=arguments.properties, parameterize=arguments.parameterize, transaction=arguments.transaction, callbacks=arguments.callbacks))
+ loc.returnValue = loc.returnValue + 1;
+ }
+ }
+ else
+ {
+ arguments.sql = [];
+ ArrayAppend(arguments.sql, "UPDATE #tableName()# SET");
+ loc.pos = 0;
+ for (loc.key in arguments.properties)
+ {
+ loc.pos = loc.pos + 1;
+ ArrayAppend(arguments.sql, "#variables.wheels.class.properties[loc.key].column# = ");
+
+ loc.param = {value=arguments.properties[loc.key], type=variables.wheels.class.properties[loc.key].type, dataType=variables.wheels.class.properties[loc.key].dataType, scale=variables.wheels.class.properties[loc.key].scale, null=!len(arguments.properties[loc.key])};
+ ArrayAppend(arguments.sql, loc.param);
+ if (StructCount(arguments.properties) gt loc.pos)
+ ArrayAppend(arguments.sql, ",");
+ }
+ arguments.sql = $addWhereClause(sql=arguments.sql, where=arguments.where, include=arguments.include, includeSoftDeletes=arguments.includeSoftDeletes);
+ arguments.sql = $addWhereClauseParameters(sql=arguments.sql, where=arguments.where);
+ loc.returnValue = invokeWithTransaction(method="$updateAll", argumentCollection=arguments);
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$updateAll" returntype="numeric" access="public" output="false">
+ <cfset var update = variables.wheels.class.adapter.$query(sql=arguments.sql, parameterize=arguments.parameterize)>
+ <cfreturn update.result.recordCount>
+</cffunction>
+
+<cffunction name="updateByKey" returntype="boolean" access="public" output="false" hint="Finds the object with the supplied key and saves it (if validation permits it) with the supplied properties and/or named arguments. Property names and values can be passed in either using named arguments or as a struct to the `properties` argument. Returns `true` if the object was found and updated successfully, `false` otherwise."
+ examples=
+ '
+ <!--- Updates the object with `33` as the primary key value with values passed in through the URL/form --->
+ <cfset result = model("post").updateByKey(33, params.post)>
+
+ <!--- Updates the object with `33` as the primary key using named arguments --->
+ <cfset result = model("post").updateByKey(key=33, title="New version of Wheels just released", published=1)>
+ '
+ categories="model-class,update" chapters="updating-records,associations" functions="hasOne,hasMany,update,updateAll,updateOne">
+ <cfargument name="key" type="any" required="true" hint="See documentation for @findByKey.">
+ <cfargument name="properties" type="struct" required="false" default="#StructNew()#" hint="See documentation for @new.">
+ <cfargument name="reload" type="boolean" required="false" hint="See documentation for @findAll.">
+ <cfargument name="validate" type="boolean" required="false" default="true" hint="See documentation for @save.">
+ <cfargument name="transaction" type="string" required="false" default="#application.wheels.transactionMode#" hint="See documentation for @save.">
+ <cfargument name="callbacks" type="boolean" required="false" default="true" hint="See documentation for @save.">
+ <cfargument name="includeSoftDeletes" type="boolean" required="false" default="false" hint="See documentation for @findAll.">
+ <cfscript>
+ var returnValue = "";
+ $args(name="updateByKey", args=arguments);
+ $keyLengthCheck(arguments.key);
+ arguments.where = $keyWhereString(values=arguments.key);
+ StructDelete(arguments, "key");
+ returnValue = updateOne(argumentCollection=arguments);
+ </cfscript>
+ <cfreturn returnValue>
+</cffunction>
+
+<cffunction name="updateOne" returntype="boolean" access="public" output="false" hint="Gets an object based on the arguments used and updates it with the supplied properties. Returns `true` if an object was found and updated successfully, `false` otherwise."
+ examples=
+ '
+ <!--- Sets the `new` property to `1` on the most recently released product --->
+ <cfset result = model("product").updateOne(order="releaseDate DESC", new=1)>
+
+ <!--- If you have a `hasOne` association setup from `user` to `profile`, you can do a scoped call. (The `removeProfile` method below will call `model("profile").updateOne(where="userId=##aUser.id##", userId="")` internally.) --->
+ <cfset aUser = model("user").findByKey(params.userId)>
+ <cfset aUser.removeProfile()>
+ '
+ categories="model-class,update" chapters="updating-records,associations" functions="hasOne,update,updateAll,updateByKey">
+ <cfargument name="where" type="string" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="order" type="string" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="properties" type="struct" required="false" default="#StructNew()#" hint="See documentation for @new.">
+ <cfargument name="reload" type="boolean" required="false" hint="See documentation for @findAll.">
+ <cfargument name="validate" type="boolean" required="false" default="true" hint="See documentation for @save.">
+ <cfargument name="transaction" type="string" required="false" default="#application.wheels.transactionMode#" hint="See documentation for @save.">
+ <cfargument name="callbacks" type="boolean" required="false" default="true" hint="See documentation for @save.">
+ <cfargument name="includeSoftDeletes" type="boolean" required="false" default="false" hint="See documentation for @findAll.">
+ <cfscript>
+ var loc = {};
+ $args(name="updateOne", args=arguments);
+ loc.object = findOne(where=arguments.where, order=arguments.order, reload=arguments.reload, includeSoftDeletes=arguments.includeSoftDeletes);
+ StructDelete(arguments, "where");
+ StructDelete(arguments, "order");
+ if (IsObject(loc.object))
+ loc.returnValue = loc.object.update(argumentCollection=arguments);
+ else
+ loc.returnValue = false;
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="updateProperty" returntype="boolean" access="public" output="false" hint="Updates a single property and saves the record without going through the normal validation procedure. This is especially useful for boolean flags on existing records."
+ examples=
+ '
+ <!--- Sets the `new` property to `1` through updateProperty() --->
+ <cfset product = model("product").findByKey(56)>
+ <cfset product.updateProperty("new", 1)>
+ '
+ categories="model-class,update" chapters="updating-records,associations" functions="hasOne,update,updateAll,updateByKey,updateProperties">
+ <cfargument name="property" type="string" required="true" hint="Name of the property to update the value for globally.">
+ <cfargument name="value" type="any" required="true" hint="Value to set on the given property globally.">
+ <cfargument name="parameterize" type="any" required="false" hint="See documentation for @findAll.">
+ <cfargument name="transaction" type="string" required="false" default="#application.wheels.transactionMode#" hint="See documentation for @save.">
+ <cfargument name="callbacks" type="boolean" required="false" default="true" hint="See documentation for @save.">
+ <cfscript>
+ $args(name="updateProperty", args=arguments);
+ arguments.validate = false;
+ this[arguments.property] = arguments.value;
+ </cfscript>
+ <cfreturn save(parameterize=arguments.parameterize, reload=false, validate=arguments.validate, transaction=arguments.transaction, callbacks=arguments.callbacks) />
+</cffunction>
+
+<cffunction name="updateProperties" returntype="boolean" access="public" output="false" hint="Updates all the properties from the `properties` argument or other named arguments. If the object is invalid, the save will fail and `false` will be returned."
+ examples=
+ '
+ <!--- Sets the `new` property to `1` through `updateProperties()` --->
+ <cfset product = model("product").findByKey(56)>
+ <cfset product.updateProperties(new=1)>
+ '
+ categories="model-class,update" chapters="updating-records,associations" functions="hasOne,update,updateAll,updateByKey,updateProperties">
+ <cfargument name="properties" type="struct" required="false" default="#StructNew()#" hint="Struct containing key/value pairs with properties and associated values that need to be updated globally.">
+ <cfargument name="parameterize" type="any" required="false" hint="See documentation for @findAll.">
+ <cfargument name="validate" type="boolean" required="false" default="true" hint="See documentation for @save.">
+ <cfargument name="transaction" type="string" required="false" default="#application.wheels.transactionMode#" hint="See documentation for @save.">
+ <cfargument name="callbacks" type="boolean" required="false" default="true" hint="See documentation for @save.">
+ <cfscript>
+ $args(name="updateProperties", args=arguments);
+ $setProperties(argumentCollection=arguments, filterList="properties,parameterize,validate,transaction,callbacks");
+ </cfscript>
+ <cfreturn save(parameterize=arguments.parameterize, reload=false, validate=arguments.validate, transaction=arguments.transaction, callbacks=arguments.callbacks) />
+</cffunction>
+
+
+<!--- delete --->
+
+<cffunction name="deleteAll" returntype="numeric" access="public" output="false" hint="Deletes all records that match the `where` argument. By default, objects will not be instantiated and therefore callbacks and validations are not invoked. You can change this behavior by passing in `instantiate=true`. Returns the number of records that were deleted."
+ examples=
+ '
+ <!--- Delete all inactive users without instantiating them (will skip validation and callbacks) --->
+ <cfset recordsDeleted = model("user").deleteAll(where="inactive=1", instantiate=false)>
+
+ <!--- If you have a `hasMany` association setup from `post` to `comment`, you can do a scoped call. (The `deleteAllComments` method below will call `model("comment").deleteAll(where="postId=##post.id##")` internally.) --->
+ <cfset post = model("post").findByKey(params.postId)>
+ <cfset howManyDeleted = post.deleteAllComments()>
+ '
+ categories="model-class,delete" chapters="deleting-records,associations" functions="delete,deleteByKey,deleteOne,hasMany">
+ <cfargument name="where" type="string" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="include" type="string" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="reload" type="boolean" required="false" hint="See documentation for @findAll.">
+ <cfargument name="parameterize" type="any" required="false" hint="See documentation for @findAll.">
+ <cfargument name="instantiate" type="boolean" required="false" hint="See documentation for @updateAll.">
+ <cfargument name="transaction" type="string" required="false" default="#application.wheels.transactionMode#" hint="See documentation for @save.">
+ <cfargument name="callbacks" type="boolean" required="false" default="true" hint="See documentation for @save.">
+ <cfargument name="includeSoftDeletes" type="boolean" required="false" default="false" hint="See documentation for @findAll.">
+ <cfargument name="softDelete" type="boolean" required="false" default="true" hint="See documentation for @delete.">
+ <cfscript>
+ var loc = {};
+ $args(name="deleteAll", args=arguments);
+
+ if (arguments.instantiate)
+ {
+ loc.returnValue = 0;
+ loc.objects = findAll(select=propertyNames(), where=arguments.where, include=arguments.include, reload=arguments.reload, parameterize=arguments.parameterize, includeSoftDeletes=arguments.includeSoftDeletes, returnIncluded=false, returnAs="objects");
+ for (loc.i=1; loc.i lte ArrayLen(loc.objects); loc.i++)
+ {
+ if (loc.objects[loc.i].delete(parameterize=arguments.parameterize, transaction=arguments.transaction, callbacks=arguments.callbacks, softDelete=arguments.softDelete))
+ loc.returnValue++;
+ }
+ }
+ else
+ {
+ arguments.sql = [];
+ arguments.sql = $addDeleteClause(sql=arguments.sql, softDelete=arguments.softDelete);
+ arguments.sql = $addWhereClause(sql=arguments.sql, where=arguments.where, include=arguments.include, includeSoftDeletes=arguments.includeSoftDeletes);
+ arguments.sql = $addWhereClauseParameters(sql=arguments.sql, where=arguments.where);
+ loc.returnValue = invokeWithTransaction(method="$deleteAll", argumentCollection=arguments);
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$deleteAll" returntype="numeric" access="public" output="false">
+ <cfset var delete = variables.wheels.class.adapter.$query(sql=arguments.sql, parameterize=arguments.parameterize)>
+ <cfreturn delete.result.recordCount>
+</cffunction>
+
+<cffunction name="deleteByKey" returntype="boolean" access="public" output="false" hint="Finds the record with the supplied key and deletes it. Returns `true` on successful deletion of the row, `false` otherwise."
+ examples=
+ '
+ <!--- Delete the user with the primary key value of `1` --->
+ <cfset result = model("user").deleteByKey(1)>
+ '
+ categories="model-class,delete" chapters="deleting-records" functions="delete,deleteAll,deleteOne">
+ <cfargument name="key" type="any" required="true" hint="See documentation for @findByKey.">
+ <cfargument name="reload" type="boolean" required="false" hint="See documentation for @findAll.">
+ <cfargument name="transaction" type="string" required="false" default="#application.wheels.transactionMode#" hint="See documentation for @save.">
+ <cfargument name="callbacks" type="boolean" required="false" default="true" hint="See documentation for @save.">
+ <cfargument name="includeSoftDeletes" type="boolean" required="false" default="false" hint="See documentation for @findAll.">
+ <cfargument name="softDelete" type="boolean" required="false" default="true" hint="See documentation for @delete.">
+ <cfscript>
+ var loc = {};
+ $args(name="deleteByKey", args=arguments);
+ $keyLengthCheck(arguments.key);
+ loc.where = $keyWhereString(values=arguments.key);
+ loc.returnValue = deleteOne(where=loc.where, reload=arguments.reload, transaction=arguments.transaction, callbacks=arguments.callbacks, includeSoftDeletes=arguments.includeSoftDeletes, softDelete=arguments.softDelete);
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="deleteOne" returntype="boolean" access="public" output="false" hint="Gets an object based on conditions and deletes it."
+ examples=
+ '
+ <!--- Delete the user that signed up last --->
+ <cfset result = model("user").deleteOne(order="signupDate DESC")>
+
+ <!--- If you have a `hasOne` association setup from `user` to `profile` you can do a scoped call (the `deleteProfile` method below will call `model("profile").deleteOne(where="userId=##aUser.id##")` internally) --->
+ <cfset aUser = model("user").findByKey(params.userId)>
+ <cfset aUser.deleteProfile()>
+ '
+ categories="model-class,delete" chapters="deleting-records,associations" functions="delete,deleteAll,deleteOne,hasOne">
+ <cfargument name="where" type="string" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="order" type="string" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="reload" type="boolean" required="false" hint="See documentation for @findAll.">
+ <cfargument name="transaction" type="string" required="false" default="#application.wheels.transactionMode#" hint="See documentation for @save.">
+ <cfargument name="callbacks" type="boolean" required="false" default="true" hint="See documentation for @save.">
+ <cfargument name="includeSoftDeletes" type="boolean" required="false" default="false" hint="See documentation for @findAll.">
+ <cfargument name="softDelete" type="boolean" required="false" default="true" hint="See documentation for @delete.">
+ <cfscript>
+ var loc = {};
+ $args(name="deleteOne", args=arguments);
+ loc.object = findOne(where=arguments.where, order=arguments.order, reload=arguments.reload, includeSoftDeletes=arguments.includeSoftDeletes);
+ if (IsObject(loc.object))
+ loc.returnValue = loc.object.delete(transaction=arguments.transaction, callbacks=arguments.callbacks, softDelete=arguments.softDelete);
+ else
+ loc.returnValue = false;
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<!--- other --->
+
+<cffunction name="exists" returntype="boolean" access="public" output="false" hint="Checks if a record exists in the table. You can pass in either a primary key value to the `key` argument or a string to the `where` argument."
+ examples=
+ '
+ <!--- Checking if Joe exists in the database --->
+ <cfset result = model("user").exists(where="firstName=''Joe''")>
+
+ <!--- Checking if a specific user exists based on a primary key valued passed in through the URL/form in an if statement --->
+ <cfif model("user").exists(keyparams.key)>
+ <!--- Do something... --->
+ </cfif>
+
+ <!--- If you have a `belongsTo` association setup from `comment` to `post`, you can do a scoped call. (The `hasPost` method below will call `model("post").exists(comment.postId)` internally.) --->
+ <cfset comment = model("comment").findByKey(params.commentId)>
+ <cfset commentHasAPost = comment.hasPost()>
+
+ <!--- If you have a `hasOne` association setup from `user` to `profile`, you can do a scoped call. (The `hasProfile` method below will call `model("profile").exists(where="userId=##user.id##")` internally.) --->
+ <cfset user = model("user").findByKey(params.userId)>
+ <cfset userHasProfile = user.hasProfile()>
+
+ <!--- If you have a `hasMany` association setup from `post` to `comment`, you can do a scoped call. (The `hasComments` method below will call `model("comment").exists(where="postid=##post.id##")` internally.) --->
+ <cfset post = model("post").findByKey(params.postId)>
+ <cfset postHasComments = post.hasComments()>
+ '
+ categories="model-class,miscellaneous" chapters="reading-records,associations" functions="belongsTo,hasMany,hasOne">
+ <cfargument name="key" type="any" required="false" default="" hint="See documentation for @findByKey.">
+ <cfargument name="where" type="string" required="false" default="" hint="See documentation for @findAll.">
+ <cfargument name="reload" type="boolean" required="false" hint="See documentation for @findAll.">
+ <cfargument name="parameterize" type="any" required="false" hint="See documentation for @findAll.">
+ <cfscript>
+ var loc = {};
+ $args(name="exists", args=arguments);
+ if (application.wheels.showErrorInformation)
+ if (Len(arguments.key) && Len(arguments.where))
+ $throw(type="Wheels.IncorrectArguments", message="You cannot pass in both `key` and `where`.");
+ if (Len(arguments.where))
+ loc.returnValue = findOne(select=primaryKey(), where=arguments.where, reload=arguments.reload, returnAs="query").RecordCount gte 1;
+ else if (Len(arguments.key))
+ loc.returnValue = findByKey(key=arguments.key, select=primaryKey(), reload=arguments.reload, returnAs="query").RecordCount == 1;
+ else
+ loc.returnValue = false;
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<!--- PUBLIC MODEL OBJECT METHODS --->
+
+<!--- crud --->
+
+<cffunction name="delete" returntype="boolean" access="public" output="false" hint="Deletes the object, which means the row is deleted from the database (unless prevented by a `beforeDelete` callback). Returns `true` on successful deletion of the row, `false` otherwise."
+ examples=
+ '
+ <!--- Get a post object and then delete it from the database --->
+ <cfset post = model("post").findByKey(33)>
+ <cfset post.delete()>
+
+ <!--- If you have a `hasMany` association setup from `post` to `comment`, you can do a scoped call. (The `deleteComment` method below will call `comment.delete()` internally.) --->
+ <cfset post = model("post").findByKey(params.postId)>
+ <cfset comment = model("comment").findByKey(params.commentId)>
+ <cfset post.deleteComment(comment)>
+ '
+ categories="model-object,crud" chapters="deleting-records,associations" functions="deleteAll,deleteByKey,deleteOne,hasMany">
+ <cfargument name="parameterize" type="any" required="false" hint="See documentation for @findAll.">
+ <cfargument name="transaction" type="string" required="false" default="#application.wheels.transactionMode#" hint="See documentation for @save.">
+ <cfargument name="callbacks" type="boolean" required="false" default="true" hint="See documentation for @save.">
+ <cfargument name="includeSoftDeletes" type="boolean" required="false" default="false" hint="See documentation for @findAll.">
+ <cfargument name="softDelete" type="boolean" required="false" default="true" hint="Set to `false` to permanently delete a record, even if it has a soft delete column.">
+ <cfscript>
+ $args(name="delete", args=arguments);
+ arguments.sql = [];
+ arguments.sql = $addDeleteClause(sql=arguments.sql, softDelete=arguments.softDelete);
+ arguments.sql = $addKeyWhereClause(sql=arguments.sql, includeSoftDeletes=arguments.includeSoftDeletes);
+ </cfscript>
+ <cfreturn invokeWithTransaction(method="$delete", argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="$delete" returntype="boolean" access="public" output="false">
+ <cfscript>
+ var loc = {};
+ loc.ret = false;
+ if ($callback("beforeDelete", arguments.callbacks))
+ {
+ $deleteDependents(); // delete dependents before the main record in case of foreign key constraints
+ loc.del = variables.wheels.class.adapter.$query(sql=arguments.sql, parameterize=arguments.parameterize);
+ if (loc.del.result.recordCount eq 1 and $callback("afterDelete", arguments.callbacks))
+ loc.ret = true;
+ }
+ return loc.ret;
+ </cfscript>
+</cffunction>
+
+<cffunction name="reload" returntype="void" access="public" output="false" hint="Reloads the property values of this object from the database."
+ examples=
+ '
+ <!--- Get an object, call a method on it that could potentially change values, and then reload the values from the database --->
+ <cfset employee = model("employee").findByKey(params.key)>
+ <cfset employee.someCallThatChangesValuesInTheDatabase()>
+ <cfset employee.reload()>
+ '
+ categories="model-object,miscellaneous" chapters="reading-records" functions="">
+ <cfscript>
+ var loc = {};
+ loc.query = findByKey(key=key(), reload=true, returnAs="query");
+ loc.properties = propertyNames();
+ loc.iEnd = ListLen(loc.properties);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ // coldfusion has a problem with blank boolean values in the query
+ try
+ {
+ loc.property = ListGetAt(loc.properties, loc.i);
+ this[loc.property] = loc.query[loc.property][1];
+ }
+ catch (Any e)
+ {
+ this[loc.property] = "";
+ }
+ }
+ </cfscript>
+</cffunction>
+
+<cffunction name="save" returntype="boolean" access="public" output="false" hint="Saves the object if it passes validation and callbacks. Returns `true` if the object was saved successfully to the database, `false` if not."
+ examples=
+ '
+ <!--- Save the user object to the database (will automatically do an `INSERT` or `UPDATE` statement depending on if the record is new or already exists --->
+ <cfset user.save()>
+
+ <!--- Save the user object directly in an if statement without using `cfqueryparam` and take appropriate action based on the result --->
+ <cfif user.save(parameterize=false)>
+ <cfset flashInsert(notice="The user was saved!")>
+ <cfset redirectTo(action="edit")>
+ <cfelse>
+ <cfset flashInsert(alert="Error, please correct!")>
+ <cfset renderPage(action="edit")>
+ </cfif>
+ '
+ categories="model-object,crud" chapters="creating-records" functions="">
+ <cfargument name="parameterize" type="any" required="false" hint="See documentation for @findAll.">
+ <cfargument name="reload" type="boolean" required="false" hint="Set to `true` to reload the object from the database once an insert/update has completed.">
+ <cfargument name="validate" type="boolean" required="false" default="true" hint="Set to `false` to skip validations for this operation.">
+ <cfargument name="transaction" type="string" required="false" default="#application.wheels.transactionMode#" hint="Set this to `commit` to update the database when the save has completed, `rollback` to run all the database queries but not commit them, or `none` to skip transaction handling altogether.">
+ <cfargument name="callbacks" type="boolean" required="false" default="true" hint="Set to `false` to disable callbacks for this operation.">
+ <cfset $args(name="save", args=arguments)>
+ <cfset clearErrors()>
+ <cfreturn invokeWithTransaction(method="$save", argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="$save" returntype="boolean" access="public" output="false">
+ <cfargument name="parameterize" type="any" required="true" />
+ <cfargument name="reload" type="boolean" required="true" />
+ <cfargument name="validate" type="boolean" required="true" />
+ <cfargument name="callbacks" type="boolean" required="true" />
+ <cfscript>
+ var loc = {};
+ loc.ret = false;
+ // make sure all of our associations are set properly before saving
+ $setAssociations();
+
+ if ($callback("beforeValidation", arguments.callbacks))
+ {
+ if (isNew())
+ {
+ if ($validateAssociations() && $callback("beforeValidationOnCreate", arguments.callbacks) && $validate("onSave,onCreate", arguments.validate) && $callback("afterValidation", arguments.callbacks) && $callback("afterValidationOnCreate", arguments.callbacks) && $callback("beforeSave", arguments.callbacks) && $callback("beforeCreate", arguments.callbacks))
+ {
+ $create(parameterize=arguments.parameterize, reload=arguments.reload);
+ if ($saveAssociations(argumentCollection=arguments) && $callback("afterCreate", arguments.callbacks) && $callback("afterSave", arguments.callbacks))
+ {
+ $updatePersistedProperties();
+ loc.ret = true;
+ }
+ }
+ }
+ else
+ {
+ if ($callback("beforeValidationOnUpdate", arguments.callbacks) && $validate("onSave,onUpdate", arguments.validate) && $callback("afterValidation", arguments.callbacks) && $callback("afterValidationOnUpdate", arguments.callbacks) && $saveAssociations(argumentCollection=arguments) && $callback("beforeSave", arguments.callbacks) && $callback("beforeUpdate", arguments.callbacks))
+ {
+ $update(parameterize=arguments.parameterize, reload=arguments.reload);
+ if ($callback("afterUpdate", arguments.callbacks) && $callback("afterSave", arguments.callbacks))
+ {
+ $updatePersistedProperties();
+ loc.ret = true;
+ }
+ }
+ }
+ }
+ </cfscript>
+ <cfreturn loc.ret />
+</cffunction>
+
+<cffunction name="update" returntype="boolean" access="public" output="false" hint="Updates the object with the supplied properties and saves it to the database. Returns `true` if the object was saved successfully to the database and `false` otherwise."
+ examples=
+ '
+ <!--- Get a post object and then update its title in the database --->
+ <cfset post = model("post").findByKey(33)>
+ <cfset post.update(title="New version of Wheels just released")>
+
+ <!--- Get a post object and then update its title and other properties based on what is pased in from the URL/form --->
+ <cfset post = model("post").findByKey(params.key)>
+ <cfset post.update(title="New version of Wheels just released", properties=params.post)>
+
+ <!--- If you have a `hasOne` association setup from `author` to `bio`, you can do a scoped call. (The `setBio` method below will call `bio.update(authorId=anAuthor.id)` internally.) --->
+ <cfset author = model("author").findByKey(params.authorId)>
+ <cfset bio = model("bio").findByKey(params.bioId)>
+ <cfset author.setBio(bio)>
+
+ <!--- If you have a `hasMany` association setup from `owner` to `car`, you can do a scoped call. (The `addCar` method below will call `car.update(ownerId=anOwner.id)` internally.) --->
+ <cfset anOwner = model("owner").findByKey(params.ownerId)>
+ <cfset aCar = model("car").findByKey(params.carId)>
+ <cfset anOwner.addCar(aCar)>
+
+ <!--- If you have a `hasMany` association setup from `post` to `comment`, you can do a scoped call. (The `removeComment` method below will call `comment.update(postId="")` internally.) --->
+ <cfset aPost = model("post").findByKey(params.postId)>
+ <cfset aComment = model("comment").findByKey(params.commentId)>
+ <cfset aPost.removeComment(aComment)>
+ '
+ categories="model-object,crud" chapters="updating-records,associations" functions="hasMany,hasOne,updateAll,updateByKey,updateOne">
+ <cfargument name="properties" type="struct" required="false" default="#StructNew()#" hint="See documentation for @new.">
+ <cfargument name="parameterize" type="any" required="false" hint="See documentation for @findAll.">
+ <cfargument name="reload" type="boolean" required="false" hint="See documentation for @findAll.">
+ <cfargument name="validate" type="boolean" required="false" default="true" hint="See documentation for @save.">
+ <cfargument name="transaction" type="string" required="false" default="#application.wheels.transactionMode#" hint="See documentation for @save.">
+ <cfargument name="callbacks" type="boolean" required="false" default="true" hint="See documentation for @save.">
+ <cfset $args(name="update", args=arguments)>
+ <cfset $setProperties(argumentCollection=arguments, filterList="properties,parameterize,reload,validate,transaction,callbacks")>
+ <cfreturn save(parameterize=arguments.parameterize, reload=arguments.reload, validate=arguments.validate, transaction=arguments.transaction, callbacks=arguments.callbacks)>
+</cffunction>
+
+<!--- other --->
+
+<cffunction name="isNew" returntype="boolean" access="public" output="false" hint="Returns `true` if this object hasn't been saved yet. (In other words, no matching record exists in the database yet.) Returns `false` if a record exists."
+ examples=
+ '
+ <!--- Create a new object and then check if it is new (yes, this example is ridiculous. It makes more sense in the context of callbacks for example) --->
+ <cfset employee = model("employee").new()>
+ <cfif employee.isNew()>
+ <!--- Do something... --->
+ </cfif>
+ '
+ categories="model-object,miscellaneous" chapters="" functions="">
+ <cfscript>
+ // if no values have ever been saved to the database this object is new
+ if (!StructKeyExists(variables, "$persistedProperties"))
+ {
+ return true;
+ }
+ return false;
+ </cfscript>
+</cffunction>
+
+
+<!--- PRIVATE MODEL CLASS METHODS --->
+
+<!--- other --->
+
+<cffunction name="$createInstance" returntype="any" access="public" output="false">
+ <cfargument name="properties" type="struct" required="true">
+ <cfargument name="persisted" type="boolean" required="true">
+ <cfargument name="row" type="numeric" required="false" default="1">
+ <cfargument name="base" type="boolean" required="false" default="true">
+ <cfargument name="callbacks" type="boolean" required="false" default="true" hint="See documentation for @save.">
+ <cfscript>
+ var loc = {};
+ loc.fileName = $objectFileName(name=variables.wheels.class.modelName, objectPath=variables.wheels.class.path, type="model");
+ loc.returnValue = $createObjectFromRoot(path=variables.wheels.class.path, fileName=loc.fileName, method="$initModelObject", name=variables.wheels.class.modelName, properties=arguments.properties, persisted=arguments.persisted, row=arguments.row, base=arguments.base, useFilterLists=(!arguments.persisted));
+ // if the object should be persisted, call afterFind else call afterNew
+ if ((arguments.persisted && loc.returnValue.$callback("afterFind", arguments.callbacks)) || (!arguments.persisted && loc.returnValue.$callback("afterNew", arguments.callbacks)))
+ loc.returnValue.$callback("afterInitialization", arguments.callbacks);
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<!--- PRIVATE MODEL OBJECT METHODS --->
+
+<!--- crud --->
+
+<cffunction name="$create" returntype="boolean" access="public" output="false">
+ <cfargument name="parameterize" type="any" required="true">
+ <cfargument name="reload" type="boolean" required="true">
+ <cfscript>
+ var loc = {};
+ if (variables.wheels.class.timeStampingOnCreate)
+ $timestampProperty(property=variables.wheels.class.timeStampOnCreateProperty);
+ if (application.wheels.setUpdatedAtOnCreate && variables.wheels.class.timeStampingOnUpdate)
+ $timestampProperty(property=variables.wheels.class.timeStampOnUpdateProperty);
+ loc.sql = [];
+ loc.sql2 = [];
+ ArrayAppend(loc.sql, "INSERT INTO #tableName()# (");
+ ArrayAppend(loc.sql2, " VALUES (");
+ for (loc.key in variables.wheels.class.properties)
+ {
+ if (StructKeyExists(this, loc.key))
+ {
+ ArrayAppend(loc.sql, variables.wheels.class.properties[loc.key].column);
+ ArrayAppend(loc.sql, ",");
+ loc.param = $buildQueryParamValues(loc.key);
+ ArrayAppend(loc.sql2, loc.param);
+ ArrayAppend(loc.sql2, ",");
+ }
+ }
+ ArrayDeleteAt(loc.sql, ArrayLen(loc.sql));
+ ArrayDeleteAt(loc.sql2, ArrayLen(loc.sql2));
+ ArrayAppend(loc.sql, ")");
+ ArrayAppend(loc.sql2, ")");
+ loc.iEnd = ArrayLen(loc.sql);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ ArrayAppend(loc.sql, loc.sql2[loc.i]);
+
+ // map the primary keys down to the SQL columns before calling
+ loc.primaryKeys = ListToArray(primaryKeys());
+ loc.iEnd = ArrayLen(loc.primaryKeys);
+ for(loc.i = 1; loc.i LTE loc.iEnd; loc.i++)
+ loc.primaryKeys[loc.i] = variables.wheels.class.properties[loc.primaryKeys[loc.i]].column;
+
+ loc.ins = variables.wheels.class.adapter.$query(sql=loc.sql, parameterize=arguments.parameterize, $primaryKey=ArrayToList(loc.primaryKeys));
+ loc.generatedKey = variables.wheels.class.adapter.$generatedKey();
+ if (StructKeyExists(loc.ins.result, loc.generatedKey))
+ this[primaryKeys(1)] = loc.ins.result[loc.generatedKey];
+ if (arguments.reload)
+ this.reload();
+ </cfscript>
+ <cfreturn true>
+</cffunction>
+
+<cffunction name="$update" returntype="boolean" access="public" output="false">
+ <cfargument name="parameterize" type="any" required="true">
+ <cfargument name="reload" type="boolean" required="true">
+ <cfscript>
+ var loc = {};
+
+ // if no changes, no need to perform update
+ if(!hasChanged())
+ {
+ return true;
+ }
+
+ if (variables.wheels.class.timeStampingOnUpdate)
+ $timestampProperty(property=variables.wheels.class.timeStampOnUpdateProperty);
+ loc.sql = [];
+ ArrayAppend(loc.sql, "UPDATE #tableName()# SET ");
+ for (loc.key in variables.wheels.class.properties)
+ {
+ // include all changed non-key values in the update
+ if (StructKeyExists(this, loc.key) && !ListFindNoCase(primaryKeys(), loc.key) && hasChanged(loc.key))
+ {
+ ArrayAppend(loc.sql, "#variables.wheels.class.properties[loc.key].column# = ");
+ loc.param = $buildQueryParamValues(loc.key);
+ ArrayAppend(loc.sql, loc.param);
+ ArrayAppend(loc.sql, ",");
+ }
+ }
+
+ if (ArrayLen(loc.sql) gt 1) // only submit the update if we generated an sql set statement
+ {
+ ArrayDeleteAt(loc.sql, ArrayLen(loc.sql));
+ loc.sql = $addKeyWhereClause(sql=loc.sql);
+ loc.upd = variables.wheels.class.adapter.$query(sql=loc.sql, parameterize=arguments.parameterize);
+ if (arguments.reload)
+ this.reload();
+ }
+ </cfscript>
+ <cfreturn true>
+</cffunction>
+
+<!--- other --->
+
+<cffunction name="$buildQueryParamValues" returntype="struct" access="public" output="false">
+ <cfargument name="property" type="string" required="true">
+ <cfscript>
+ var ret = {};
+ ret.value = this[arguments.property];
+ ret.type = variables.wheels.class.properties[arguments.property].type;
+ ret.dataType = variables.wheels.class.properties[arguments.property].dataType;
+ ret.scale = variables.wheels.class.properties[arguments.property].scale;
+ ret.null = (!len(this[arguments.property]) && variables.wheels.class.properties[arguments.property].nullable);
+ return ret;
+ </cfscript>
+</cffunction>
+
+<cffunction name="$keyLengthCheck" returntype="void" access="public" output="false"
+ hint="Makes sure that the number of keys passed in is the same as the number of keys defined for the model. If not, an error is raised.">
+ <cfargument name="key" type="any" required="true">
+ <cfscript>
+ if (ListLen(primaryKeys()) != ListLen(arguments.key))
+ {
+ $throw(type="Wheels.InvalidArgumentValue", message="The `key` argument contains an invalid value.", extendedInfo="The `key` argument contains a list, however this table doesn't have a composite key. A list of values is allowed for the `key` argument, but this only applies in the case when the table contains a composite key.");
+ }
+ </cfscript>
+</cffunction>
+
+
+<!---
+ developers can now override this method for localizing dates if they prefer.
+--->
+<cffunction name="$timestampProperty" returntype="void" access="public" output="false">
+ <cfargument name="property" type="string" required="true" />
+ <cfscript>
+ this[arguments.property] = Now();
+ </cfscript>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/model/errors.cfm b/src/main/webapp/wheels/model/errors.cfm new file mode 100755 index 0000000..b0aace9 --- /dev/null +++ b/src/main/webapp/wheels/model/errors.cfm @@ -0,0 +1,148 @@ +<!--- PUBLIC MODEL OBJECT METHODS --->
+
+<cffunction name="addError" returntype="void" access="public" output="false" hint="Adds an error on a specific property."
+ examples=
+ '
+ <!--- Add an error to the `email` property --->
+ <cfset this.addError(property="email", message="Sorry, you are not allowed to use that email. Try again, please.")>
+ '
+ categories="model-object,errors" chapters="object-validation" functions="addErrorToBase,allErrors,clearErrors,errorCount,errorsOn,errorsOnBase,hasErrors">
+ <cfargument name="property" type="string" required="true" hint="The name of the property you want to add an error on.">
+ <cfargument name="message" type="string" required="true" hint="The error message (such as ""Please enter a correct name in the form field"" for example).">
+ <cfargument name="name" type="string" required="false" default="" hint="A name to identify the error by (useful when you need to distinguish one error from another one set on the same object and you don't want to use the error message itself for that).">
+ <cfscript>
+ ArrayAppend(variables.wheels.errors, arguments);
+ </cfscript>
+</cffunction>
+
+<cffunction name="addErrorToBase" returntype="void" access="public" output="false" hint="Adds an error on the object as a whole (not related to any specific property)."
+ examples=
+ '
+ <!--- Add an error on the object --->
+ <cfset this.addErrorToBase(message="Your email address must be the same as your domain name.")>
+ '
+ categories="model-object,errors" chapters="object-validation" functions="addError,allErrors,clearErrors,errorCount,errorsOn,errorsOnBase,hasErrors">
+ <cfargument name="message" type="string" required="true" hint="See documentation for @addError.">
+ <cfargument name="name" type="string" required="false" default="" hint="See documentation for @addError.">
+ <cfscript>
+ arguments.property = "";
+ addError(argumentCollection=arguments);
+ </cfscript>
+</cffunction>
+
+<cffunction name="allErrors" returntype="array" access="public" output="false" hint="Returns an array of all the errors on the object."
+ examples=
+ '
+ <!--- Get all the errors for the `user` object --->
+ <cfset errorInfo = user.allErrors()>
+ '
+ categories="model-object,errors" chapters="object-validation" functions="addError,addErrorToBase,clearErrors,errorCount,errorsOn,errorsOnBase,hasErrors">
+ <cfreturn variables.wheels.errors>
+</cffunction>
+
+<cffunction name="clearErrors" returntype="void" access="public" output="false" hint="Clears out all errors set on the object or only the ones set for a specific property or name."
+ examples=
+ '
+ <!--- Clear all errors on the object as a whole --->
+ <cfset this.clearErrors()>
+
+ <!--- Clear all errors on `firstName` --->
+ <cfset this.clearErrors("firstName")>
+ '
+ categories="model-object,errors" chapters="object-validation" functions="addError,addErrorToBase,allErrors,errorCount,errorsOn,errorsOnBase,hasErrors">
+ <cfargument name="property" type="string" required="false" default="" hint="Specify a property name here if you want to clear all errors set on that property.">
+ <cfargument name="name" type="string" required="false" default="" hint="Specify an error name here if you want to clear all errors set with that error name.">
+ <cfscript>
+ var loc = {};
+ if (!Len(arguments.property) && !Len(arguments.name))
+ {
+ ArrayClear(variables.wheels.errors);
+ }
+ else
+ {
+ loc.iEnd = ArrayLen(variables.wheels.errors);
+ for (loc.i=loc.iEnd; loc.i >= 1; loc.i--)
+ if (variables.wheels.errors[loc.i].property == arguments.property && (variables.wheels.errors[loc.i].name == arguments.name))
+ ArrayDeleteAt(variables.wheels.errors, loc.i);
+ }
+ </cfscript>
+</cffunction>
+
+<cffunction name="errorCount" returntype="numeric" access="public" output="false" hint="Returns the number of errors this object has associated with it. Specify `property` or `name` if you wish to count only specific errors."
+ examples=
+ '
+ <!--- Check how many errors are set on the object --->
+ <cfif author.errorCount() GTE 10>
+ <!--- Do something to deal with this very erroneous author here... --->
+ </cfif>
+
+ <!--- Check how many errors are associated with the `email` property --->
+ <cfif author.errorCount("email") gt 0>
+ <!--- Do something to deal with this erroneous author here... --->
+ </cfif>
+ '
+ categories="model-object,errors" chapters="object-validation" functions="addError,addErrorToBase,allErrors,clearErrors,errorsOn,errorsOnBase,hasErrors">
+ <cfargument name="property" type="string" required="false" default="" hint="Specify a property name here if you want to count only errors set on a specific property.">
+ <cfargument name="name" type="string" required="false" default="" hint="Specify an error name here if you want to count only errors set with a specific error name.">
+ <cfscript>
+ var returnValue = "";
+ if (!Len(arguments.property) && !Len(arguments.name))
+ returnValue = ArrayLen(variables.wheels.errors);
+ else
+ returnValue = ArrayLen(errorsOn(argumentCollection=arguments));
+ </cfscript>
+ <cfreturn returnValue>
+</cffunction>
+
+<cffunction name="errorsOn" returntype="array" access="public" output="false" hint="Returns an array of all errors associated with the supplied property (and error name if passed in)."
+ examples=
+ '
+ <!--- Get all errors related to the email address of the user object --->
+ <cfset errors = user.errorsOn("emailAddress")>
+ '
+ categories="model-object,errors" chapters="object-validation" functions="addError,addErrorToBase,allErrors,clearErrors,errorCount,errorsOnBase,hasErrors">
+ <cfargument name="property" type="string" required="true" hint="Specify the property name to return errors for here.">
+ <cfargument name="name" type="string" required="false" default="" hint="If you want to return only errors on the above property set with a specific error name you can specify it here.">
+ <cfscript>
+ var loc = {};
+ loc.returnValue = [];
+ loc.iEnd = ArrayLen(variables.wheels.errors);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ if (variables.wheels.errors[loc.i].property == arguments.property && (variables.wheels.errors[loc.i].name == arguments.name))
+ ArrayAppend(loc.returnValue, variables.wheels.errors[loc.i]);
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="errorsOnBase" returntype="array" access="public" output="false" hint="Returns an array of all errors associated with the object as a whole (not related to any specific property)."
+ examples=
+ '
+ <!--- Get all general type errors for the user object --->
+ <cfset errors = user.errorsOnBase()>
+ '
+ categories="model-object,errors" chapters="object-validation" functions="addError,addErrorToBase,allErrors,clearErrors,errorCount,errorsOn,hasErrors">
+ <cfargument name="name" type="string" required="false" default="" hint="Specify an error name here to only return errors for that error name.">
+ <cfscript>
+ arguments.property = "";
+ </cfscript>
+ <cfreturn errorsOn(argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="hasErrors" returntype="boolean" access="public" output="false" hint="Returns `true` if the object has any errors. You can also limit to only check a specific property or name for errors."
+ examples=
+ '
+ <!--- Check if the post object has any errors set on it --->
+ <cfif post.hasErrors()>
+ <!--- Send user to a form to correct the errors... --->
+ </cfif>
+ '
+ categories="model-object,errors" chapters="object-validation" functions="addError,addErrorToBase,allErrors,clearErrors,errorCount,errorsOn,errorsOnBase">
+ <cfargument name="property" type="string" required="false" default="" hint="Name of the property to check if there are any errors set on.">
+ <cfargument name="name" type="string" required="false" default="" hint="Error name to check if there are any errors set with.">
+ <cfscript>
+ var returnValue = false;
+ if (errorCount(argumentCollection=arguments) > 0)
+ returnValue = true;
+ </cfscript>
+ <cfreturn returnValue>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/model/functions.cfm b/src/main/webapp/wheels/model/functions.cfm new file mode 100755 index 0000000..bdc52af --- /dev/null +++ b/src/main/webapp/wheels/model/functions.cfm @@ -0,0 +1,14 @@ +<cfinclude template="associations.cfm">
+<cfinclude template="calculations.cfm">
+<cfinclude template="callbacks.cfm">
+<cfinclude template="crud.cfm">
+<cfinclude template="errors.cfm">
+<cfinclude template="initialization.cfm">
+<cfinclude template="miscellaneous.cfm">
+<cfinclude template="nestedproperties.cfm">
+<cfinclude template="onmissingmethod.cfm">
+<cfinclude template="properties.cfm">
+<cfinclude template="serialize.cfm">
+<cfinclude template="sql.cfm">
+<cfinclude template="transactions.cfm">
+<cfinclude template="validations.cfm">
\ No newline at end of file diff --git a/src/main/webapp/wheels/model/initialization.cfm b/src/main/webapp/wheels/model/initialization.cfm new file mode 100755 index 0000000..3755c2c --- /dev/null +++ b/src/main/webapp/wheels/model/initialization.cfm @@ -0,0 +1,229 @@ +<cffunction name="$initModelClass" returntype="any" access="public" output="false">
+ <cfargument name="name" type="string" required="true">
+ <cfargument name="path" type="string" required="true">
+ <cfscript>
+ var loc = {};
+ variables.wheels = {};
+ variables.wheels.errors = [];
+ variables.wheels.class = {};
+ variables.wheels.class.modelName = arguments.name;
+ variables.wheels.class.modelId = hash(GetMetaData(this).name);
+ variables.wheels.class.path = arguments.path;
+
+ // if our name has pathing in it, remove it and add it to the end of of the $class.path variable
+ if (Find("/", arguments.name))
+ {
+ variables.wheels.class.modelName = ListLast(arguments.name, "/");
+ variables.wheels.class.path = ListAppend(arguments.path, ListDeleteAt(arguments.name, ListLen(arguments.name, "/"), "/"), "/");
+ }
+
+ variables.wheels.class.RESQLAs = "[[:space:]]AS[[:space:]][A-Za-z1-9]+";
+ variables.wheels.class.RESQLOperators = "((?: (?:NOT )?LIKE)|(?: (?:NOT )?IN)|(?: IS(?: NOT)?)|(?:<>)|(?:<=)|(?:>=)|(?:!=)|(?:!<)|(?:!>)|=|<|>)";
+ variables.wheels.class.RESQLWhere = "(#variables.wheels.class.RESQLOperators# ?)(\('.+?'\)|\((-?[0-9\.],?)+\)|'.+?'()|''|(-?[0-9\.]+)()|NULL)(($|\)| (AND|OR)))";
+ variables.wheels.class.mapping = {};
+ variables.wheels.class.properties = {};
+ variables.wheels.class.accessibleProperties = {};
+ variables.wheels.class.calculatedProperties = {};
+ variables.wheels.class.associations = {};
+ variables.wheels.class.callbacks = {};
+ variables.wheels.class.keys = "";
+ variables.wheels.class.connection = {datasource=application.wheels.dataSourceName, username=application.wheels.dataSourceUserName, password=application.wheels.dataSourcePassword};
+ variables.wheels.class.automaticValidations = application.wheels.automaticValidations;
+
+ setTableNamePrefix(get("tableNamePrefix"));
+ table(LCase(pluralize(variables.wheels.class.modelName)));
+
+ loc.callbacks = "afterNew,afterFind,afterInitialization,beforeDelete,afterDelete,beforeSave,afterSave,beforeCreate,afterCreate,beforeUpdate,afterUpdate,beforeValidation,afterValidation,beforeValidationOnCreate,afterValidationOnCreate,beforeValidationOnUpdate,afterValidationOnUpdate";
+ loc.iEnd = ListLen(loc.callbacks);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ variables.wheels.class.callbacks[ListGetAt(loc.callbacks, loc.i)] = ArrayNew(1);
+ loc.validations = "onSave,onCreate,onUpdate";
+ loc.iEnd = ListLen(loc.validations);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ variables.wheels.class.validations[ListGetAt(loc.validations, loc.i)] = ArrayNew(1);
+
+ // run developer's init method if it exists
+ if (StructKeyExists(variables, "init"))
+ init();
+
+ // make sure that the tablename has the respected prefix
+ table(getTableNamePrefix() & tableName());
+
+ // load the database adapter
+ variables.wheels.class.adapter = $createObjectFromRoot(path="#application.wheels.wheelsComponentPath#", fileName="Connection", method="init", datasource="#variables.wheels.class.connection.datasource#", username="#variables.wheels.class.connection.username#", password="#variables.wheels.class.connection.password#");
+
+ // get columns for the table
+ loc.columns = variables.wheels.class.adapter.$getColumns(tableName());
+
+ variables.wheels.class.propertyList = "";
+ variables.wheels.class.columnList = "";
+ loc.processedColumns = "";
+ loc.iEnd = loc.columns.recordCount;
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ // set up properties and column mapping
+ if (!ListFind(loc.processedColumns, loc.columns["column_name"][loc.i]))
+ {
+ loc.property = loc.columns["column_name"][loc.i]; // default the column to map to a property with the same name
+ for (loc.key in variables.wheels.class.mapping)
+ {
+ if (StructKeyExists(variables.wheels.class.mapping[loc.key], "type") and variables.wheels.class.mapping[loc.key].type == "column" && variables.wheels.class.mapping[loc.key].value == loc.property)
+ {
+ // developer has chosen to map this column to a property with a different name so set that here
+ loc.property = loc.key;
+ break;
+ }
+ }
+ loc.type = SpanExcluding(loc.columns["type_name"][loc.i], "( ");
+
+ // set the info we need for each property
+ variables.wheels.class.properties[loc.property] = {};
+ variables.wheels.class.properties[loc.property].dataType = loc.type;
+ variables.wheels.class.properties[loc.property].type = variables.wheels.class.adapter.$getType(loc.type, loc.columns["decimal_digits"][loc.i]);
+ variables.wheels.class.properties[loc.property].column = loc.columns["column_name"][loc.i];
+ variables.wheels.class.properties[loc.property].scale = loc.columns["decimal_digits"][loc.i];
+
+ // get a boolean value for whether this column can be set to null or not
+ // if we don't get a boolean back we try to translate y/n to proper boolean values in cfml (yes/no)
+ variables.wheels.class.properties[loc.property].nullable = Trim(loc.columns["is_nullable"][loc.i]);
+ if (!IsBoolean(variables.wheels.class.properties[loc.property].nullable))
+ variables.wheels.class.properties[loc.property].nullable = ReplaceList(variables.wheels.class.properties[loc.property].nullable, "N,Y", "No,Yes");
+
+ variables.wheels.class.properties[loc.property].size = loc.columns["column_size"][loc.i];
+ variables.wheels.class.properties[loc.property].label = Humanize(loc.property);
+ variables.wheels.class.properties[loc.property].validationtype = variables.wheels.class.adapter.$getValidationType(variables.wheels.class.properties[loc.property].type);
+
+ if (StructKeyExists(variables.wheels.class.mapping, loc.property)) {
+ if (StructKeyExists(variables.wheels.class.mapping[loc.property], "label"))
+ variables.wheels.class.properties[loc.property].label = variables.wheels.class.mapping[loc.property].label;
+ if (StructKeyExists(variables.wheels.class.mapping[loc.property], "defaultValue"))
+ variables.wheels.class.properties[loc.property].defaultValue = variables.wheels.class.mapping[loc.property].defaultValue;
+ }
+
+ if (loc.columns["is_primarykey"][loc.i])
+ {
+ setPrimaryKey(loc.property);
+ }
+ else if (variables.wheels.class.automaticValidations and not ListFindNoCase("#application.wheels.timeStampOnCreateProperty#,#application.wheels.timeStampOnUpdateProperty#,#application.wheels.softDeleteProperty#", loc.property))
+ {
+ // set nullable validations if the developer has not
+ loc.defaultValidationsAllowBlank = variables.wheels.class.properties[loc.property].nullable;
+ if (!variables.wheels.class.properties[loc.property].nullable and !Len(loc.columns["column_default_value"][loc.i]) and !$validationExists(property=loc.property, validation="validatesPresenceOf"))
+ {
+ validatesPresenceOf(properties=loc.property);
+ }
+ // always allowblank if a database default or validatesPresenceOf() has been set
+ if (Len(loc.columns["column_default_value"][loc.i]) or $validationExists(property=loc.property, validation="validatesPresenceOf"))
+ loc.defaultValidationsAllowBlank = true;
+ // set length validations if the developer has not
+ if (variables.wheels.class.properties[loc.property].validationtype eq "string" and !$validationExists(property=loc.property, validation="validatesLengthOf"))
+ validatesLengthOf(properties=loc.property, allowBlank=loc.defaultValidationsAllowBlank, maximum=variables.wheels.class.properties[loc.property].size);
+ // set numericality validations if the developer has not
+ if (ListFindNoCase("integer,float", variables.wheels.class.properties[loc.property].validationtype) and !$validationExists(property=loc.property, validation="validatesNumericalityOf"))
+ validatesNumericalityOf(properties=loc.property, allowBlank=loc.defaultValidationsAllowBlank, onlyInteger=(variables.wheels.class.properties[loc.property].validationtype eq "integer"));
+ // set date validations if the developer has not (checks both dates or times as per the IsDate() function)
+ if (variables.wheels.class.properties[loc.property].validationtype eq "datetime" and !$validationExists(property=loc.property, validation="validatesFormatOf"))
+ validatesFormatOf(properties=loc.property, allowBlank=loc.defaultValidationsAllowBlank, type="date");
+ }
+
+ variables.wheels.class.propertyList = ListAppend(variables.wheels.class.propertyList, loc.property);
+ variables.wheels.class.columnList = ListAppend(variables.wheels.class.columnList, variables.wheels.class.properties[loc.property].column);
+ loc.processedColumns = ListAppend(loc.processedColumns, loc.columns["column_name"][loc.i]);
+ }
+ }
+
+ // raise error when no primary key has been defined for the table
+ if (!Len(primaryKeys()))
+ {
+ $throw(type="Wheels.NoPrimaryKey", message="No primary key exists on the `#tableName()#` table.", extendedInfo="Set an appropriate primary key on the `#tableName()#` table.");
+ }
+
+ // add calculated properties
+ variables.wheels.class.calculatedPropertyList = "";
+ for (loc.key in variables.wheels.class.mapping)
+ {
+ if (StructKeyExists(variables.wheels.class.mapping[loc.key], "type") and variables.wheels.class.mapping[loc.key].type != "column")
+ {
+ variables.wheels.class.calculatedPropertyList = ListAppend(variables.wheels.class.calculatedPropertyList, loc.key);
+ variables.wheels.class.calculatedProperties[loc.key] = {};
+ variables.wheels.class.calculatedProperties[loc.key][variables.wheels.class.mapping[loc.key].type] = variables.wheels.class.mapping[loc.key].value;
+ }
+ }
+
+ // set up soft deletion and time stamping if the necessary columns in the table exist
+ if (Len(application.wheels.softDeleteProperty) && StructKeyExists(variables.wheels.class.properties, application.wheels.softDeleteProperty))
+ {
+ variables.wheels.class.softDeletion = true;
+ variables.wheels.class.softDeleteColumn = variables.wheels.class.properties[application.wheels.softDeleteProperty].column;
+ }
+ else
+ {
+ variables.wheels.class.softDeletion = false;
+ }
+
+ if (Len(application.wheels.timeStampOnCreateProperty) && StructKeyExists(variables.wheels.class.properties, application.wheels.timeStampOnCreateProperty))
+ {
+ variables.wheels.class.timeStampingOnCreate = true;
+ variables.wheels.class.timeStampOnCreateProperty = application.wheels.timeStampOnCreateProperty;
+ }
+ else
+ {
+ variables.wheels.class.timeStampingOnCreate = false;
+ }
+
+ if (Len(application.wheels.timeStampOnUpdateProperty) && StructKeyExists(variables.wheels.class.properties, application.wheels.timeStampOnUpdateProperty))
+ {
+ variables.wheels.class.timeStampingOnUpdate = true;
+ variables.wheels.class.timeStampOnUpdateProperty = application.wheels.timeStampOnUpdateProperty;
+ }
+ else
+ {
+ variables.wheels.class.timeStampingOnUpdate = false;
+ }
+ </cfscript>
+ <cfreturn this>
+</cffunction>
+
+<cffunction name="$initModelObject" returntype="any" access="public" output="false">
+ <cfargument name="name" type="string" required="true">
+ <cfargument name="properties" type="any" required="true">
+ <cfargument name="persisted" type="boolean" required="true">
+ <cfargument name="row" type="numeric" required="false" default="1">
+ <cfargument name="base" type="boolean" required="false" default="true">
+ <cfargument name="useFilterLists" type="boolean" required="false" default="true">
+ <cfscript>
+ var loc = {};
+
+ variables.wheels = {};
+ variables.wheels.instance = {};
+ variables.wheels.errors = [];
+ // keep a unique identifier for each model created in case we need it for nested properties
+ variables.wheels.tickCountId = GetTickCount().toString(); // make sure we have it in milliseconds
+
+ // copy class variables from the object in the application scope
+ if (!StructKeyExists(variables.wheels, "class"))
+ variables.wheels.class = $namedReadLock(name="classLock", object=application.wheels.models[arguments.name], method="$classData");
+ // setup object properties in the this scope
+ if (IsQuery(arguments.properties) && arguments.properties.recordCount != 0)
+ arguments.properties = $queryRowToStruct(argumentCollection=arguments);
+
+ if (IsStruct(arguments.properties) && !StructIsEmpty(arguments.properties))
+ $setProperties(properties=arguments.properties, setOnModel=true, $useFilterLists=arguments.useFilterLists);
+
+ if (arguments.persisted)
+ $updatePersistedProperties();
+ </cfscript>
+ <cfreturn this>
+</cffunction>
+
+<cffunction name="$classData" returntype="struct" access="public" output="false">
+ <cfreturn variables.wheels.class>
+</cffunction>
+
+<cffunction name="$softDeletion" returntype="boolean" access="public" output="false">
+ <cfreturn variables.wheels.class.softDeletion>
+</cffunction>
+
+<cffunction name="$softDeleteColumn" returntype="string" access="public" output="false">
+ <cfreturn variables.wheels.class.softDeleteColumn>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/model/miscellaneous.cfm b/src/main/webapp/wheels/model/miscellaneous.cfm new file mode 100755 index 0000000..3cd8d6c --- /dev/null +++ b/src/main/webapp/wheels/model/miscellaneous.cfm @@ -0,0 +1,381 @@ +<!--- PUBLIC MODEL INITIALIZATION METHODS --->
+
+<cffunction name="dataSource" returntype="void" access="public" output="false" hint="Use this method to override the data source connection information for this model."
+ examples=
+ '
+ <!--- In models/User.cfc --->
+ <cffunction name="init">
+ <!--- Tell Wheels to use the data source named `users_source` instead of the default one whenever this model makes SQL calls --->
+ <cfset dataSource("users_source")>
+ </cffunction>
+ '
+ categories="model-initialization,miscellaneous" chapters="using-multiple-data-sources" functions="">
+ <cfargument name="datasource" type="string" required="true" hint="The data source name to connect to.">
+ <cfargument name="username" type="string" required="false" default="" hint="The username for the data source.">
+ <cfargument name="password" type="string" required="false" default="" hint="The password for the data source.">
+ <cfscript>
+ StructAppend(variables.wheels.class.connection, arguments, true);
+ </cfscript>
+</cffunction>
+
+<cffunction name="table" returntype="void" access="public" output="false" hint="Use this method to tell Wheels what database table to connect to for this model. You only need to use this method when your table naming does not follow the standard Wheels convention of a singular object name mapping to a plural table name."
+ examples=
+ '
+ <!--- In models/User.cfc --->
+ <cffunction name="init">
+ <!--- Tell Wheels to use the `tbl_USERS` table in the database for the `user` model instead of the default (which would be `users`) --->
+ <cfset table("tbl_USERS")>
+ </cffunction>
+ '
+ categories="model-initialization,miscellaneous" chapters="object-relational-mapping" functions="columnNames,dataSource,property,propertyNames,tableName">
+ <cfargument name="name" type="string" required="true" hint="Name of the table to map this model to.">
+ <cfset variables.wheels.class.tableName = arguments.name>
+</cffunction>
+
+<cffunction name="setTableNamePrefix" returntype="void" access="public" output="false" hint="Sets a prefix to prepend to the table name when this model runs SQL queries."
+ examples='
+ <!--- In `models/User.cfc`, add a prefix to the default table name of `tbl` --->
+ <cffunction name="init">
+ <cfset setTableNamePrefix("tbl")>
+ </cffunction>
+ '
+ categories="model-initialization,miscellaneous" chapters="object-relational-mapping" functions="columnNames,dataSource,property,propertyNames,table">
+ <cfargument name="prefix" type="string" required="true" hint="A prefix to prepend to the table name.">
+ <cfset variables.wheels.class.tableNamePrefix = arguments.prefix>
+</cffunction>
+
+<cffunction name="setPrimaryKey" returntype="void" access="public" output="false" hint="Allows you to pass in the name(s) of the property(s) that should be used as the primary key(s). Pass as a list if defining a composite primary key. Also aliased as `setPrimaryKeys()`."
+ examples='
+ <!--- In `models/User.cfc`, define the primary key as a column called `userID` --->
+ <cffunction name="init">
+ <cfset setPrimaryKey("userID")>
+ </cffunction>
+ '
+ categories="model-initialization,miscellaneous" chapters="object-relational-mapping" functions="columnNames,dataSource,property,propertyNames,table">
+ <cfargument name="property" type="string" required="true" hint="Property (or list of properties) to set as the primary key.">
+ <cfset var loc = {}>
+ <cfloop list="#arguments.property#" index="loc.i">
+ <cfset variables.wheels.class.keys = ListAppend(variables.wheels.class.keys, loc.i)>
+ </cfloop>
+</cffunction>
+
+<cffunction name="setPrimaryKeys" returntype="void" access="public" output="false" hint="Alias for @setPrimaryKey. Use this for better readability when you're setting multiple properties as the primary key."
+ examples='
+ <!--- In `models/Subscription.cfc`, define the primary key as composite of the columns `customerId` and `publicationId` --->
+ <cffunction name="init">
+ <cfset setPrimaryKeys("customerId,publicationId")>
+ </cffunction>
+ '
+ categories="model-initialization,miscellaneous" chapters="object-relational-mapping" functions="columnNames,dataSource,property,propertyNames,table">
+ <cfargument name="property" type="string" required="true" hint="Property (or list of properties) to set as the primary key.">
+ <cfset setPrimaryKey(argumentCollection=arguments)>
+</cffunction>
+
+<!--- PUBLIC MODEL CLASS METHODS --->
+
+<cffunction name="columnNames" returntype="string" access="public" output="false" hint="Returns a list of column names in the table mapped to this model. The list is ordered according to the columns' ordinal positions in the database table."
+ examples=
+ '
+ <!--- Get a list of all the column names in the table mapped to the `author` model --->
+ <cfset columns = model("author").columnNames()>
+ '
+ categories="model-class,miscellaneous" chapters="object-relational-mapping" functions="dataSource,property,propertyNames,table,tableName">
+ <cfreturn variables.wheels.class.columnList>
+</cffunction>
+
+<cffunction name="primaryKey" returntype="string" access="public" output="false" hint="Returns the name of the primary key for this model's table. This is determined through database introspection. If composite primary keys have been used, they will both be returned in a list. This function is also aliased as `primaryKeys()`."
+ examples=
+ '
+ <!--- Get the name of the primary key of the table mapped to the `employee` model (which is the `employees` table by default) --->
+ <cfset keyName = model("employee").primaryKey()>
+ '
+ categories="model-class,miscellaneous" chapters="object-relational-mapping" functions="primaryKeys">
+ <cfargument name="position" type="numeric" required="false" default="0" hint="If you are accessing a composite primary key, pass the position of a single key to fetch.">
+ <cfif arguments.position gt 0>
+ <cfreturn ListGetAt(variables.wheels.class.keys, arguments.position)>
+ </cfif>
+ <cfreturn variables.wheels.class.keys>
+</cffunction>
+
+<cffunction name="primaryKeys" returntype="string" access="public" output="false" hint="Alias for @primaryKey. Use this for better readability when you're accessing multiple primary keys."
+ examples=
+ '
+ <!--- Get a list of the names of the primary keys in the table mapped to the `employee` model (which is the `employees` table by default) --->
+ <cfset keyNames = model("employee").primaryKeys()>
+ '
+ categories="model-class,miscellaneous" chapters="object-relational-mapping" functions="primaryKey"
+>
+ <cfargument name="position" type="numeric" required="false" default="0" hint="See documentation for @primaryKey.">
+ <cfreturn primaryKey(argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="tableName" returntype="string" access="public" output="false" hint="Returns the name of the database table that this model is mapped to."
+ examples=
+ '
+ <!--- Check what table the user model uses --->
+ <cfset whatAmIMappedTo = model("user").tableName()>
+ '
+ categories="model-class,miscellaneous" chapters="object-relational-mapping" functions="columnNames,dataSource,property,propertyNames,table">
+ <cfreturn variables.wheels.class.tableName>
+</cffunction>
+
+<cffunction name="getTableNamePrefix" returntype="string" access="public" output="false" hint="Returns the table name prefix set for the table."
+ examples='
+ <!--- Get the table name prefix for this user when running a custom query --->
+ <cffunction name="getDisabledUsers" returntype="query">
+ <cfset var loc = {}>
+ <cfquery datasource="##get(''dataSourceName'')##" name="loc.disabledUsers">
+ SELECT
+ *
+ FROM
+ ##this.getTableNamePrefix()##users
+ WHERE
+ disabled = 1
+ </cfquery>
+ <cfreturn loc.disabledUsers>
+ </cffunction>
+ '
+ categories="model-class,miscellaneous" chapters="object-relational-mapping" functions="columnNames,dataSource,property,propertyNames,table">
+ <cfreturn variables.wheels.class.tableNamePrefix>
+</cffunction>
+
+<!--- PUBLIC MODEL OBJECT METHODS --->
+
+<cffunction name="compareTo" access="public" output="false" returntype="boolean" hint="Pass in another Wheels model object to see if the two objects are the same."
+ examples='
+ <!--- Load a user requested in the URL/form and restrict access if it doesn''t match the user stored in the session --->
+ <cfset user = model("user").findByKey(params.key)>
+ <cfif not user.compareTo(session.user)>
+ <cfset renderPage(action="accessDenied")>
+ </cfif>
+ '
+ categories="model-object,miscellaneous" chapters="" functions="">
+ <cfargument name="object" type="component" required="true">
+ <cfreturn Compare(this.$objectId(), arguments.object.$objectId()) eq 0 />
+</cffunction>
+
+<cffunction name="$objectId" access="public" output="false" returntype="string">
+ <cfreturn variables.wheels.tickCountId />
+</cffunction>
+
+<cffunction name="isInstance" returntype="boolean" access="public" output="false" hint="Use this method to check whether you are currently in an instance object."
+ examples='
+ <!--- Use the passed in `id` when we''re not already in an instance --->
+ <cffunction name="memberIsAdmin">
+ <cfif isInstance()>
+ <cfreturn this.admin>
+ <cfelse>
+ <cfreturn this.findByKey(arguments.id).admin>
+ </cfif>
+ </cffunction>
+ '
+ categories="model-initialization,miscellaneous" chapters="object-relational-mapping" functions="isClass">
+ <cfreturn StructKeyExists(variables.wheels, "instance")>
+</cffunction>
+
+<cffunction name="isClass" returntype="boolean" access="public" output="false" hint="Use this method within a model's method to check whether you are currently in a class-level object."
+ examples='
+ <!--- Use the passed in `id` when we''re already in an instance --->
+ <cffunction name="memberIsAdmin">
+ <cfif isClass()>
+ <cfreturn this.findByKey(arguments.id).admin>
+ <cfelse>
+ <cfreturn this.admin>
+ </cfif>
+ </cffunction>
+ '
+ categories="model-initialization,miscellaneous" chapters="object-relational-mapping" functions="isInstance">
+ <cfreturn !isInstance(argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="setPagination" access="public" output="false" returntype="void" hint="Allows you to set a pagination handle for a custom query so you can perform pagination on it in your view with `paginationLinks()`."
+ examples=
+ '
+ <!---
+ Note that there are two ways to do pagination yourself using
+ a custom query.
+
+ 1) Do a query that grabs everything that matches and then use
+ the `cfouput` or `cfloop` tag to page through the results.
+
+ 2) Use your database to make 2 queries. The first query
+ basically does a count of the total number of records that match
+ the criteria and the second query actually selects the page of
+ records for retrieval.
+
+ In the example below, we will show how to write a custom query
+ using both of these methods. Note that the syntax where your
+ database performs the pagination will differ depending on the
+ database engine you are using. Plese consult your database
+ engine''s documentation for the correct syntax.
+
+ Also note that the view code will differ depending on the method
+ used.
+ --->
+
+ <!---
+ First method: Handle the pagination through your CFML engine
+ --->
+
+ <!--- Model code --->
+ <!--- In your model (ie. User.cfc), create a custom method for your custom query --->
+ <cffunction name="myCustomQuery">
+ <cfargument name="page" type="numeric">
+ <cfargument name="perPage" type="numeric" required="false" default="25">
+
+ <cfquery name="local.customQuery" datasource="##get(''dataSourceName'')##">
+ SELECT * FROM users
+ </cfquery>
+
+ <cfset setPagination(totalRecords=local.customQuery.RecordCount, currentPage=arguments.page, perPage=arguments.perPage, handle="myCustomQueryHandle")>
+ <cfreturn customQuery>
+ </cffunction>
+
+ <!--- Controller code --->
+ <cffunction name="list">
+ <cfparam name="params.page" default="1">
+ <cfparam name="params.perPage" default="25">
+
+ <cfset allUsers = model("user").myCustomQuery(page=params.page, perPage=params.perPage)>
+ <!---
+ Because we''re going to let `cfoutput`/`cfloop` handle the pagination,
+ we''re going to need to get some addition information about the
+ pagination.
+ --->
+ <cfset paginationData = pagination("myCustomQueryHandle")>
+ </cffunction>
+
+ <!--- View code (using `cfloop`) --->
+ <!--- Use the information from `paginationData` to page through the records --->
+ <cfoutput>
+ <ul>
+ <cfloop query="allUsers" startrow="##paginationData.startrow##" endrow="##paginationData.endrow##">
+ <li>##allUsers.firstName## ##allUsers.lastName##</li>
+ </cfloop>
+ </ul>
+ ##paginationLinks(handle="myCustomQueryHandle")##
+ </cfoutput>
+
+ <!--- View code (using `cfoutput`) --->
+ <!--- Use the information from `paginationData` to page through the records --->
+ <ul>
+ <cfoutput query="allUsers" startrow="##paginationData.startrow##" maxrows="##paginationData.maxrows##">
+ <li>##allUsers.firstName## ##allUsers.lastName##</li>
+ </cfoutput>
+ </ul>
+ <cfoutput>##paginationLinks(handle="myCustomQueryHandle")##</cfoutput>
+
+
+ <!---
+ Second method: Handle the pagination through the database
+ --->
+
+ <!--- Model code --->
+ <!--- In your model (ie. `User.cfc`), create a custom method for your custom query --->
+ <cffunction name="myCustomQuery">
+ <cfargument name="page" type="numeric">
+ <cfargument name="perPage" type="numeric" required="false" default="25">
+
+ <cfquery name="local.customQueryCount" datasource="##get(''dataSouceName'')##">
+ SELECT COUNT(*) AS theCount FROM users
+ </cfquery>
+
+ <cfquery name="local.customQuery" datasource="##get(''dataSourceName'')##">
+ SELECT * FROM users
+ LIMIT ##arguments.page## OFFSET ##arguments.perPage##
+ </cfquery>
+
+ <!--- Notice the we use the value from the first query for `totalRecords` --->
+ <cfset setPagination(totalRecords=local.customQueryCount.theCount, currentPage=arguments.page, perPage=arguments.perPage, handle="myCustomQueryHandle")>
+ <!--- We return the second query --->
+ <cfreturn customQuery>
+ </cffunction>
+
+ <!--- Controller code --->
+ <cffunction name="list">
+ <cfparam name="params.page" default="1">
+ <cfparam name="params.perPage" default="25">
+ <cfset allUsers = model("user").myCustomQuery(page=params.page, perPage=params.perPage)>
+ </cffunction>
+
+ <!--- View code (using `cfloop`) --->
+ <cfoutput>
+ <ul>
+ <cfloop query="allUsers">
+ <li>##allUsers.firstName## ##allUsers.lastName##</li>
+ </cfloop>
+ </ul>
+ ##paginationLinks(handle="myCustomQueryHandle")##
+ </cfoutput>
+
+ <!--- View code (using `cfoutput`) --->
+ <ul>
+ <cfoutput query="allUsers">
+ <li>##allUsers.firstName## ##allUsers.lastName##</li>
+ </cfoutput>
+ </ul>
+ <cfoutput>##paginationLinks(handle="myCustomQueryHandle")##</cfoutput>
+ '
+ categories="model-class,miscellaneous" chapters="getting-paginated-data" functions="findAll,paginationLinks">
+ <cfargument name="totalRecords" type="numeric" required="true" hint="Total count of records that should be represented by the paginated links.">
+ <cfargument name="currentPage" type="numeric" required="false" default="1" hint="Page number that should be represented by the data being fetched and the paginated links.">
+ <cfargument name="perPage" type="numeric" required="false" default="25" hint="Number of records that should be represented on each page of data.">
+ <cfargument name="handle" type="string" required="false" default="query" hint="Name of handle to reference in @paginationLinks.">
+ <cfscript>
+ var loc = {};
+
+ // all numeric values must be integers
+ arguments.totalRecords = fix(arguments.totalRecords);
+ arguments.currentPage = fix(arguments.currentPage);
+ arguments.perPage = fix(arguments.perPage);
+
+ // totalRecords cannot be negative
+ if (arguments.totalRecords lt 0)
+ {
+ arguments.totalRecords = 0;
+ }
+
+ // perPage less then zero
+ if (arguments.perPage lte 0)
+ {
+ arguments.perPage = 25;
+ }
+
+ // calculate the total pages the query will have
+ arguments.totalPages = Ceiling(arguments.totalRecords/arguments.perPage);
+
+ // currentPage shouldn't be less then 1 or greater then the number of pages
+ if (arguments.currentPage gte arguments.totalPages)
+ {
+ arguments.currentPage = arguments.totalPages;
+ }
+ if (arguments.currentPage lt 1)
+ {
+ arguments.currentPage = 1;
+ }
+
+ // as a convinence for cfquery and cfloop when doing oldschool type pagination
+ // startrow for cfquery and cfloop
+ arguments.startRow = (arguments.currentPage * arguments.perPage) - arguments.perPage + 1;
+
+ // maxrows for cfquery
+ arguments.maxRows = arguments.perPage;
+
+ // endrow for cfloop
+ arguments.endRow = (arguments.startRow - 1) + arguments.perPage;
+
+ // endRow shouldn't be greater then the totalRecords or less than startRow
+ if (arguments.endRow gte arguments.totalRecords)
+ {
+ arguments.endRow = arguments.totalRecords;
+ }
+ if (arguments.endRow lt arguments.startRow)
+ {
+ arguments.endRow = arguments.startRow;
+ }
+
+ loc.args = duplicate(arguments);
+ structDelete(loc.args, "handle", false);
+ request.wheels[arguments.handle] = loc.args;
+ </cfscript>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/model/nestedproperties.cfm b/src/main/webapp/wheels/model/nestedproperties.cfm new file mode 100755 index 0000000..61638ed --- /dev/null +++ b/src/main/webapp/wheels/model/nestedproperties.cfm @@ -0,0 +1,305 @@ +<!--- class methods --->
+<cffunction name="nestedProperties" output="false" access="public" returntype="void" hint="Allows for nested objects, structs, and arrays to be set from params and other generated data."
+ examples='
+ <!--- In `models/User.cfc`, allow for `groupEntitlements` to be saved and deleted through the `user` object --->
+ <cffunction name="init">
+ <cfset hasMany("groupEntitlements")>
+ <cfset nestedProperties(association="groupEntitlements", allowDelete=true)>
+ </cffunction>
+ '
+ categories="model-initialization,nested-properties" chapters="nested-properties" functions="belongsTo,hasOne,hasMany,hasManyCheckBox,hasManyRadioButton,includedInObject">
+ <cfargument name="association" type="string" required="false" default="" hint="The association (or list of associations) you want to allow to be set through the params. This argument is also aliased as `associations`." />
+ <cfargument name="autoSave" type="boolean" required="false" hint="Whether to save the association(s) when the parent object is saved." />
+ <cfargument name="allowDelete" type="boolean" required="false" hint="Set `allowDelete` to `true` to tell Wheels to look for the property `_delete` in your model. If present and set to a value that evaluates to `true`, the model will be deleted when saving the parent." />
+ <cfargument name="sortProperty" type="string" required="false" hint="Set `sortProperty` to a property on the object that you would like to sort by. The property should be numeric, should start with 1, and should be consecutive. Only valid with `hasMany` associations." />
+ <cfargument name="rejectIfBlank" type="string" required="false" hint="A list of properties that should not be blank. If any of the properties are blank, any CRUD operations will be rejected." />
+ <cfscript>
+ var loc = {};
+ $args(args=arguments, name="nestedProperties", combine="association/associations");
+ arguments.association = $listClean(arguments.association);
+ loc.iEnd = ListLen(arguments.association);
+ for (loc.i = 1; loc.i lte loc.iEnd; loc.i++)
+ {
+ loc.association = ListGetAt(arguments.association, loc.i);
+ if (StructKeyExists(variables.wheels.class.associations, loc.association))
+ {
+ variables.wheels.class.associations[loc.association].nested.allow = true;
+ variables.wheels.class.associations[loc.association].nested.delete = arguments.allowDelete;
+ variables.wheels.class.associations[loc.association].nested.autoSave = arguments.autoSave;
+ variables.wheels.class.associations[loc.association].nested.sortProperty = arguments.sortProperty;
+ variables.wheels.class.associations[loc.association].nested.rejectIfBlank = $listClean(arguments.rejectIfBlank);
+ // add to the white list if it exists
+ if (StructKeyExists(variables.wheels.class.accessibleProperties, "whiteList"))
+ variables.wheels.class.accessibleProperties.whiteList = ListAppend(variables.wheels.class.accessibleProperties.whiteList, loc.association, ",");
+ }
+ else if (application.wheels.showErrorInformation)
+ {
+ $throw(type="Wheels.AssociationNotFound", message="The `#loc.association#` assocation was not found on the #variables.wheels.class.modelName# model.", extendedInfo="Make sure you have called `hasMany()`, `hasOne()`, or `belongsTo()` before calling the `nestedProperties()` method.");
+ }
+ }
+ </cfscript>
+</cffunction>
+
+<cffunction name="$validateAssociations" returntype="boolean" access="public" output="false">
+ <cfscript>
+ var loc = {};
+ loc.associations = variables.wheels.class.associations;
+ for (loc.association in loc.associations)
+ {
+ if (loc.associations[loc.association].nested.allow && loc.associations[loc.association].nested.autoSave && StructKeyExists(this, loc.association))
+ {
+ loc.array = this[loc.association];
+
+ if (IsObject(this[loc.association]))
+ loc.array = [ this[loc.association] ];
+
+ if (IsArray(loc.array))
+ for (loc.i = 1; loc.i lte ArrayLen(loc.array); loc.i++)
+ $invoke(componentReference=loc.array[loc.i], method="valid");
+ }
+ }
+ </cfscript>
+ <cfreturn true />
+</cffunction>
+
+<cffunction name="$saveAssociations" returntype="boolean" access="public" output="false">
+ <cfargument name="parameterize" type="any" required="true" />
+ <cfargument name="reload" type="boolean" required="true" />
+ <cfargument name="validate" type="boolean" required="true" />
+ <cfargument name="callbacks" type="boolean" required="true" />
+ <cfscript>
+ var loc = {};
+ loc.returnValue = true;
+ loc.associations = variables.wheels.class.associations;
+ for (loc.association in loc.associations)
+ {
+ if (loc.associations[loc.association].nested.allow && loc.associations[loc.association].nested.autoSave && StructKeyExists(this, loc.association))
+ {
+ loc.array = this[loc.association];
+
+ if (IsObject(this[loc.association]))
+ loc.array = [ this[loc.association] ];
+
+ if (IsArray(loc.array))
+ {
+ // get our expanded information for this association
+ loc.info = $expandedAssociations(include=loc.association);
+ loc.info = loc.info[1];
+
+ for (loc.i = 1; loc.i lte ArrayLen(loc.array); loc.i++)
+ {
+ if (ListFindNoCase("hasMany,hasOne", loc.associations[loc.association].type))
+ $setForeignKeyValues(missingMethodArguments=loc.array[loc.i], keys=loc.info.foreignKey);
+ loc.saveResult = $invoke(componentReference=loc.array[loc.i], method="save", invokeArgs=arguments);
+ if (loc.returnValue) // don't change the return value if we have already received a false
+ loc.returnValue = loc.saveResult;
+ }
+ }
+ }
+ }
+ </cfscript>
+ <cfreturn loc.returnValue />
+</cffunction>
+
+<cffunction name="$setAssociations" returntype="boolean" access="public" output="false">
+ <cfscript>
+ var loc = {};
+ loc.associations = variables.wheels.class.associations;
+ for (loc.item in loc.associations)
+ {
+ loc.association = loc.associations[loc.item];
+ if (loc.association.nested.allow && loc.association.nested.autoSave && StructKeyExists(this, loc.item))
+ {
+ if (ListFindNoCase("belongsTo,hasOne", loc.association.type) && IsStruct(this[loc.item]))
+ $setOneToOneAssociationProperty(property=loc.item, value=this[loc.item], association=loc.association, delete=true);
+ else if (loc.association.type == "hasMany" && IsArray(this[loc.item]) && ArrayLen(this[loc.item]))
+ $setCollectionAssociationProperty(property=loc.item, value=this[loc.item], association=loc.association, delete=true);
+ }
+ }
+ </cfscript>
+ <cfreturn true />
+</cffunction>
+
+<cffunction name="$setOneToOneAssociationProperty" returntype="void" access="public" output="false">
+ <cfargument name="property" type="string" required="true" />
+ <cfargument name="value" type="struct" required="true" />
+ <cfargument name="association" type="struct" required="true" />
+ <cfargument name="delete" type="boolean" required="false" default="false" />
+ <cfscript>
+ if (!StructKeyExists(this, arguments.property) || !IsObject(this[arguments.property]) || StructKeyExists(this[arguments.property], "_delete"))
+ this[arguments.property] = $getAssociationObject(argumentCollection=arguments);
+
+ if (IsObject(this[arguments.property]))
+ this[arguments.property].setProperties(properties=arguments.value);
+ else
+ StructDelete(this, arguments.property, false);
+ </cfscript>
+ <cfreturn />
+</cffunction>
+
+<cffunction name="$setCollectionAssociationProperty" returntype="void" access="public" output="false">
+ <cfargument name="property" type="string" required="true" />
+ <cfargument name="value" type="any" required="true" />
+ <cfargument name="association" type="struct" required="true" />
+ <cfargument name="delete" type="boolean" required="false" default="false" />
+ <cfscript>
+ var loc = {};
+ loc.model = model(arguments.association.modelName);
+
+ if (!StructKeyExists(this, arguments.property) || !IsArray(this[arguments.property]))
+ this[arguments.property] = [];
+
+ if (IsStruct(arguments.value))
+ {
+ for (loc.item in arguments.value)
+ {
+ // check to see if the id is a tickcount, if so the object is new
+ if (IsNumeric(loc.item) && Ceiling(GetTickCount() / 900000000) == Ceiling(loc.item / 900000000))
+ {
+ ArrayAppend(this[arguments.property], $getAssociationObject(property=arguments.property, value=arguments.value[loc.item], association=arguments.association, delete=arguments.delete));
+ $updateCollectionObject(property=arguments.property, value=arguments.value[loc.item]);
+ }
+ else
+ {
+ // get our primary keys
+ loc.keys = loc.model.primaryKey();
+ loc.itemArray = ListToArray(loc.item, ",", true);
+ loc.iEnd = ListLen(loc.keys);
+ for (loc.i = 1; loc.i lte loc.iEnd; loc.i++)
+ arguments.value[loc.item][ListGetAt(loc.keys, loc.i)] = loc.itemArray[loc.i];
+ ArrayAppend(this[arguments.property], $getAssociationObject(property=arguments.property, value=arguments.value[loc.item], association=arguments.association, delete=arguments.delete));
+ $updateCollectionObject(property=arguments.property, value=arguments.value[loc.item]);
+ }
+ }
+ }
+ else if (IsArray(arguments.value))
+ {
+ for (loc.i = 1; loc.i lte ArrayLen(arguments.value); loc.i++)
+ {
+ if (IsObject(arguments.value[loc.i]) && ArrayLen(this[arguments.property]) gte loc.i && IsObject(this[arguments.property][loc.i]) && this[arguments.property][loc.i].compareTo(arguments.value[loc.i]))
+ {
+ this[arguments.property][loc.i] = $getAssociationObject(property=arguments.property, value=arguments.value[loc.i], association=arguments.association, delete=arguments.delete);
+ if (!IsStruct(this[arguments.property][loc.i]) && !this[arguments.property][loc.i])
+ {
+ ArrayDeleteAt(this[arguments.property], loc.i);
+ loc.i--;
+ }
+ else
+ {
+ $updateCollectionObject(property=arguments.property, value=arguments.value[loc.i], position=loc.i);
+ }
+ }
+ else if (IsStruct(arguments.value[loc.i]) && ArrayLen(this[arguments.property]) gte loc.i && IsObject(this[arguments.property][loc.i]))
+ {
+ this[arguments.property][loc.i] = $getAssociationObject(property=arguments.property, value=arguments.value[loc.i], association=arguments.association, delete=arguments.delete);
+ if (!IsStruct(this[arguments.property][loc.i]) && !this[arguments.property][loc.i])
+ {
+ ArrayDeleteAt(this[arguments.property], loc.i);
+ loc.i--;
+ }
+ else
+ {
+ $updateCollectionObject(property=arguments.property, value=arguments.value[loc.i], position=loc.i);
+ }
+ }
+ else
+ {
+ ArrayAppend(this[arguments.property], $getAssociationObject(property=arguments.property, value=arguments.value[loc.i], association=arguments.association, delete=arguments.delete));
+ $updateCollectionObject(property=arguments.property, value=arguments.value[loc.i]);
+ }
+ }
+ }
+ // sort the order of the objects in the array if the property is set
+ if (Len(arguments.association.nested.sortProperty))
+ {
+ loc.sortedArray = [];
+ loc.iEnd = ArrayLen(this[arguments.property]);
+
+ for (loc.i = 1; loc.i lte loc.iEnd; loc.i++)
+ {
+ if (!IsNumeric(this[arguments.property][loc.i][arguments.association.nested.sortProperty]))
+ return;
+ loc.sortedArray[this[arguments.property][loc.i][arguments.association.nested.sortProperty]] = this[arguments.property][loc.i];
+ }
+
+ this[arguments.property] = loc.sortedArray;
+ }
+ </cfscript>
+ <cfreturn />
+</cffunction>
+
+<cffunction name="$updateCollectionObject" returntype="void" output="false" access="public">
+ <cfargument name="property" type="string" required="true" />
+ <cfargument name="value" type="struct" required="true" />
+ <cfargument name="position" type="numeric" required="false" default="0" />
+ <cfscript>
+ var loc = {};
+ if (!arguments.position)
+ arguments.position = ArrayLen(this[arguments.property]);
+ if (IsObject(this[arguments.property][arguments.position]))
+ this[arguments.property][arguments.position].setProperties(properties=arguments.value);
+ else
+ ArrayDeleteAt(this[arguments.property], arguments.position);
+ </cfscript>
+</cffunction>
+
+<cffunction name="$getAssociationObject" returntype="any" access="public" output="false">
+ <cfargument name="property" type="string" required="true" />
+ <cfargument name="value" type="struct" required="true" />
+ <cfargument name="association" type="struct" required="true" />
+ <cfargument name="delete" type="boolean" required="true" />
+ <cfscript>
+ var loc = {};
+ loc.method = "";
+ loc.object = false;
+ loc.delete = false;
+ loc.arguments = {};
+ loc.model = model(arguments.association.modelName);
+
+ // check to see if the struct has all of the keys we need from rejectIfBlank
+ if ($structKeysExist(struct=arguments.value, properties=arguments.association.nested.rejectIfBlank))
+ {
+ // get our primary keys, if they don't exist, then we create a new object
+ loc.arguments.key = $createPrimaryKeyList(params=arguments.value, keys=loc.model.primaryKey());
+
+ if (IsObject(arguments.value))
+ loc.object = arguments.value;
+ else if (Len(loc.arguments.key))
+ loc.object = loc.model.findByKey(argumentCollection=loc.arguments);
+
+ if (StructKeyExists(arguments.value, "_delete") && IsBoolean(arguments.value["_delete"]) && arguments.value["_delete"])
+ loc.delete = true;
+
+ if (!IsObject(loc.object) && !loc.delete)
+ {
+ StructDelete(loc.arguments, "key", false);
+ return $invoke(componentReference=loc.model, method="new", invokeArgs=loc.arguments);
+ }
+ else if (Len(loc.arguments.key) && loc.delete && arguments.association.nested.delete && arguments.delete)
+ {
+ $invoke(componentReference=loc.model, method="deleteByKey", invokeArgs=loc.arguments);
+ return false;
+ }
+ }
+ </cfscript>
+ <cfreturn loc.object />
+</cffunction>
+
+<cffunction name="$createPrimaryKeyList" returntype="string" access="public" output="false">
+ <cfargument name="params" type="struct" required="true" />
+ <cfargument name="keys" type="string" required="true" />
+ <cfscript>
+ var loc = {};
+ loc.returnValue = "";
+
+ loc.iEnd = ListLen(arguments.keys);
+ for (loc.i = 1; loc.i lte loc.iEnd; loc.i++)
+ {
+ loc.key = ListGetAt(arguments.keys, loc.i);
+ if (!StructKeyExists(arguments.params, loc.key) || !Len(arguments.params[loc.key]))
+ return "";
+ loc.returnValue = ListAppend(loc.returnValue, arguments.params[loc.key]);
+ }
+ </cfscript>
+ <cfreturn loc.returnValue />
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/model/onmissingmethod.cfm b/src/main/webapp/wheels/model/onmissingmethod.cfm new file mode 100755 index 0000000..701cae4 --- /dev/null +++ b/src/main/webapp/wheels/model/onmissingmethod.cfm @@ -0,0 +1,419 @@ +<cffunction name="onMissingMethod" returntype="any" access="public" output="false" hint="This method handles dynamic finders, properties, and association methods. It is not part of the public API.">
+ <cfargument name="missingMethodName" type="string" required="true" hint="Name of method attempted to load.">
+ <cfargument name="missingMethodArguments" type="struct" required="true" hint="Name/value pairs of arguments that were passed to the attempted method call.">
+ <cfscript>
+ var loc = {};
+ if (Right(arguments.missingMethodName, 10) == "hasChanged" && StructKeyExists(variables.wheels.class.properties,ReplaceNoCase(arguments.missingMethodName, "hasChanged", "")))
+ loc.returnValue = hasChanged(property=ReplaceNoCase(arguments.missingMethodName, "hasChanged", ""));
+ else if (Right(arguments.missingMethodName, 11) == "changedFrom" && StructKeyExists(variables.wheels.class.properties, ReplaceNoCase(arguments.missingMethodName, "changedFrom", "")))
+ loc.returnValue = changedFrom(property=ReplaceNoCase(arguments.missingMethodName, "changedFrom", ""));
+ else if (Right(arguments.missingMethodName, 9) == "IsPresent" && StructKeyExists(variables.wheels.class.properties, ReplaceNoCase(arguments.missingMethodName, "IsPresent", "")))
+ loc.returnValue = propertyIsPresent(property=ReplaceNoCase(arguments.missingMethodName, "IsPresent", ""));
+ else if (Left(arguments.missingMethodName, 9) == "columnFor" && StructKeyExists(variables.wheels.class.properties, ReplaceNoCase(arguments.missingMethodName, "columnFor", "")))
+ loc.returnValue = columnForProperty(property=ReplaceNoCase(arguments.missingMethodName, "columnFor", ""));
+ else if (Left(arguments.missingMethodName, 6) == "toggle" && StructKeyExists(variables.wheels.class.properties, ReplaceNoCase(arguments.missingMethodName, "toggle", "")))
+ loc.returnValue = toggle(property=ReplaceNoCase(arguments.missingMethodName, "toggle", ""), argumentCollection=arguments.missingMethodArguments);
+ else if (Left(arguments.missingMethodName, 3) == "has" && StructKeyExists(variables.wheels.class.properties, ReplaceNoCase(arguments.missingMethodName, "has", "")))
+ loc.returnValue = hasProperty(property=ReplaceNoCase(arguments.missingMethodName, "has", ""));
+ else if (Left(arguments.missingMethodName, 6) == "update" && StructKeyExists(variables.wheels.class.properties, ReplaceNoCase(arguments.missingMethodName, "update", "")))
+ {
+ if (!StructKeyExists(arguments.missingMethodArguments, "value"))
+ $throw(type="Wheels.IncorrectArguments", message="The `value` argument is required but was not passed in.", extendedInfo="Pass in a value to the dynamic updateProperty in the `value` argument.");
+ loc.returnValue = updateProperty(property=ReplaceNoCase(arguments.missingMethodName, "update", ""), value=arguments.missingMethodArguments.value);
+ }
+ else if (Left(arguments.missingMethodName, 9) == "findOneBy" || Left(arguments.missingMethodName, 9) == "findAllBy")
+ {
+ if (StructKeyExists(server, "railo"))
+ {
+ loc.finderProperties = ListToArray(LCase(ReplaceNoCase(ReplaceNoCase(ReplaceNoCase(arguments.missingMethodName, "And", "|", "all"), "findAllBy", "", "all"), "findOneBy", "", "all")), "|"); // since Railo passes in the method name in all upper case we have to do this here
+ }
+ else
+ {
+ loc.finderProperties = ListToArray(ReplaceNoCase(ReplaceNoCase(Replace(arguments.missingMethodName, "And", "|", "all"), "findAllBy", "", "all"), "findOneBy", "", "all"), "|");
+ }
+
+ // sometimes values will have commas in them, allow the developer to change the delimiter
+ loc.delimiter = ",";
+ if (StructKeyExists(arguments.missingMethodArguments, "delimiter"))
+ {
+ loc.delimiter = arguments.missingMethodArguments["delimiter"];
+ }
+
+ // split the values into an array for easier processing
+ loc.values = "";
+ if (StructKeyExists(arguments.missingMethodArguments, "value"))
+ {
+ loc.values = arguments.missingMethodArguments.value;
+ }
+ else if (StructKeyExists(arguments.missingMethodArguments, "values"))
+ {
+ loc.values = arguments.missingMethodArguments.values;
+ }
+ else
+ {
+ loc.values = arguments.missingMethodArguments[1];
+ }
+
+ if (!IsArray(loc.values))
+ {
+ if (ArrayLen(loc.finderProperties) eq 1)
+ {
+ // don't know why but this screws up in CF8
+ loc.temp = [];
+ arrayappend(loc.temp, loc.values);
+ loc.values = loc.temp;
+ }
+ else
+ {
+ loc.values = $listClean(list=loc.values, delim=loc.delimiter, returnAs="array");
+ }
+ }
+
+ // where clause
+ loc.addToWhere = [];
+
+ // loop through all the properties they want to query and assign values
+ loc.iEnd = ArrayLen(loc.finderProperties);
+ for (loc.i = 1; loc.i LTE loc.iEnd; loc.i++)
+ {
+ ArrayAppend(loc.addToWhere, "#loc.finderProperties[loc.i]# #$dynamicFinderOperator(loc.finderProperties[loc.i])# #variables.wheels.class.adapter.$quoteValue(str=loc.values[loc.i], type=validationTypeForProperty(loc.finderProperties[loc.i]))#");
+ }
+
+ // construct where clause
+ loc.addToWhere = ArrayToList(loc.addToWhere, " AND ");
+ arguments.missingMethodArguments.where = IIf(StructKeyExists(arguments.missingMethodArguments, "where"), "'(' & arguments.missingMethodArguments.where & ') AND (' & loc.addToWhere & ')'", "loc.addToWhere");
+
+ // remove uneeded arguments
+ StructDelete(arguments.missingMethodArguments, "delimiter");
+ StructDelete(arguments.missingMethodArguments, "1");
+ StructDelete(arguments.missingMethodArguments, "value");
+ StructDelete(arguments.missingMethodArguments, "values");
+
+ // call finder method
+ loc.returnValue = IIf(Left(arguments.missingMethodName, 9) == "findOneBy", "findOne(argumentCollection=arguments.missingMethodArguments)", "findAll(argumentCollection=arguments.missingMethodArguments)");
+ }
+ else
+ {
+ loc.returnValue = $associationMethod(argumentCollection=arguments);
+ }
+ if (!StructKeyExists(loc, "returnValue"))
+ $throw(type="Wheels.MethodNotFound", message="The method `#arguments.missingMethodName#` was not found in the `#variables.wheels.class.modelName#` model.", extendedInfo="Check your spelling or add the method to the model's CFC file.");
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$dynamicFinderOperator" returntype="string" access="public" output="false">
+ <cfargument name="property" type="string" required="true">
+ <cfscript>
+ if (StructKeyExists(variables.wheels.class.properties, arguments.property) && variables.wheels.class.properties[arguments.property].dataType == "text")
+ return "LIKE";
+ else
+ return "=";
+ </cfscript>
+</cffunction>
+
+<cffunction name="$associationMethod" returntype="any" access="public" output="false">
+ <cfscript>
+ var loc = {};
+ for (loc.key in variables.wheels.class.associations)
+ {
+ loc.method = "";
+ if (StructKeyExists(variables.wheels.class.associations[loc.key], "shortcut") && arguments.missingMethodName == variables.wheels.class.associations[loc.key].shortcut)
+ {
+ loc.method = "findAll";
+ loc.joinAssociation = $expandedAssociations(include=loc.key);
+ loc.joinAssociation = loc.joinAssociation[1];
+ loc.joinClass = loc.joinAssociation.modelName;
+ loc.info = model(loc.joinClass).$expandedAssociations(include=ListFirst(variables.wheels.class.associations[loc.key].through));
+ loc.info = loc.info[1];
+ loc.componentReference = model(loc.info.modelName);
+ loc.include = ListLast(variables.wheels.class.associations[loc.key].through);
+ if (StructKeyExists(arguments.missingMethodArguments, "include"))
+ loc.include = "#loc.include#(#arguments.missingMethodArguments.include#)";
+ arguments.missingMethodArguments.include = loc.include;
+ loc.where = $keyWhereString(properties=loc.joinAssociation.foreignKey, keys=loc.componentReference.primaryKeys());
+ if (StructKeyExists(arguments.missingMethodArguments, "where"))
+ loc.where = "(#loc.where#) AND (#arguments.missingMethodArguments.where#)";
+ arguments.missingMethodArguments.where = loc.where;
+ if (!StructKeyExists(arguments.missingMethodArguments, "returnIncluded"))
+ arguments.missingMethodArguments.returnIncluded = false;
+ }
+ else if (ListFindNoCase(variables.wheels.class.associations[loc.key].methods, arguments.missingMethodName))
+ {
+ loc.info = $expandedAssociations(include=loc.key);
+ loc.info = loc.info[1];
+ loc.componentReference = model(loc.info.modelName);
+ if (loc.info.type == "hasOne")
+ {
+ loc.where = $keyWhereString(properties=loc.info.foreignKey, keys=primaryKeys());
+ if (StructKeyExists(arguments.missingMethodArguments, "where"))
+ loc.where = "(#loc.where#) AND (#arguments.missingMethodArguments.where#)";
+ loc.name = ReplaceNoCase(arguments.missingMethodName, loc.key, "object"); // create a generic method name (example: "hasProfile" becomes "hasObject")
+ if (loc.name == "object")
+ {
+ loc.method = "findOne";
+ arguments.missingMethodArguments.where = loc.where;
+ }
+ else if (loc.name == "hasObject")
+ {
+ loc.method = "exists";
+ arguments.missingMethodArguments.where = loc.where;
+ }
+ else if (loc.name == "newObject")
+ {
+ loc.method = "new";
+ $setForeignKeyValues(missingMethodArguments=arguments.missingMethodArguments, keys=loc.info.foreignKey);
+ }
+ else if (loc.name == "createObject")
+ {
+ loc.method = "create";
+ $setForeignKeyValues(missingMethodArguments=arguments.missingMethodArguments, keys=loc.info.foreignKey);
+ }
+ else if (loc.name == "removeObject")
+ {
+ loc.method = "updateOne";
+ arguments.missingMethodArguments.where = loc.where;
+ $setForeignKeyValues(missingMethodArguments=arguments.missingMethodArguments, keys=loc.info.foreignKey, setToNull=true);
+ }
+ else if (loc.name == "deleteObject")
+ {
+ loc.method = "deleteOne";
+ arguments.missingMethodArguments.where = loc.where;
+ }
+ else if (loc.name == "setObject")
+ {
+ // single argument, must be either the key or the object
+ if (StructCount(arguments.missingMethodArguments) eq 1)
+ {
+ if (IsObject(arguments.missingMethodArguments[1]))
+ {
+ loc.componentReference = arguments.missingMethodArguments[1];
+ loc.method = "update";
+ }
+ else
+ {
+ arguments.missingMethodArguments.key = arguments.missingMethodArguments[1];
+ loc.method = "updateByKey";
+ }
+ StructDelete(arguments.missingMethodArguments, "1");
+ }
+ // multiple arguments so ensure that either 'key' or the association name exists (loc.key)
+ else
+ {
+ if (StructKeyExists(arguments.missingMethodArguments, loc.key) and IsObject(arguments.missingMethodArguments[loc.key]))
+ {
+ loc.componentReference = arguments.missingMethodArguments[loc.key];
+ loc.method = "update";
+ StructDelete(arguments.missingMethodArguments, loc.key);
+ }
+ else if (StructKeyExists(arguments.missingMethodArguments, "key"))
+ loc.method = "updateByKey";
+ else
+ $throw(type="Wheels.IncorrectArguments", message="The `#loc.key#` or `key` named argument is required.", extendedInfo="When using multiple arguments for #loc.name#() you must supply an object using the argument `#loc.key#` or a key using the argument `key`, e.g. #loc.name#(#loc.key#=post) or #loc.name#(key=post.id).");
+ }
+ $setForeignKeyValues(missingMethodArguments=arguments.missingMethodArguments, keys=loc.info.foreignKey);
+ }
+ }
+ else if (loc.info.type == "hasMany")
+ {
+ loc.where = $keyWhereString(properties=loc.info.foreignKey, keys=primaryKeys());
+ if (StructKeyExists(arguments.missingMethodArguments, "where"))
+ loc.where = "(#loc.where#) AND (#arguments.missingMethodArguments.where#)";
+ loc.singularKey = singularize(loc.key);
+ loc.name = ReplaceNoCase(ReplaceNoCase(arguments.missingMethodName, loc.key, "objects"), loc.singularKey, "object"); // create a generic method name (example: "hasComments" becomes "hasObjects")
+ if (loc.name == "objects")
+ {
+ loc.method = "findAll";
+ arguments.missingMethodArguments.where = loc.where;
+ }
+ else if (loc.name == "addObject")
+ {
+ // single argument, must be either the key or the object
+ if (StructCount(arguments.missingMethodArguments) eq 1)
+ {
+ if (IsObject(arguments.missingMethodArguments[1]))
+ {
+ loc.componentReference = arguments.missingMethodArguments[1];
+ loc.method = "update";
+ }
+ else
+ {
+ arguments.missingMethodArguments.key = arguments.missingMethodArguments[1];
+ loc.method = "updateByKey";
+ }
+ StructDelete(arguments.missingMethodArguments, "1");
+ }
+ // multiple arguments so ensure that either 'key' or the singularized association name exists (loc.singularKey)
+ else
+ {
+ if (StructKeyExists(arguments.missingMethodArguments, loc.singularKey) and IsObject(arguments.missingMethodArguments[loc.singularKey]))
+ {
+ loc.componentReference = arguments.missingMethodArguments[loc.singularKey];
+ loc.method = "update";
+ StructDelete(arguments.missingMethodArguments, loc.singularKey);
+ }
+ else if (StructKeyExists(arguments.missingMethodArguments, "key"))
+ loc.method = "updateByKey";
+ else
+ $throw(type="Wheels.IncorrectArguments", message="The `#loc.singularKey#` or `key` named argument is required.", extendedInfo="When using multiple arguments for #loc.name#() you must supply an object using the argument `#loc.singularKey#` or a key using the argument `key`, e.g. #loc.name#(#loc.singularKey#=post) or #loc.name#(key=post.id).");
+ }
+ $setForeignKeyValues(missingMethodArguments=arguments.missingMethodArguments, keys=loc.info.foreignKey);
+ }
+ else if (loc.name == "removeObject")
+ {
+ // single argument, must be either the key or the object
+ if (StructCount(arguments.missingMethodArguments) eq 1)
+ {
+ if (IsObject(arguments.missingMethodArguments[1]))
+ {
+ loc.componentReference = arguments.missingMethodArguments[1];
+ loc.method = "update";
+ }
+ else
+ {
+ arguments.missingMethodArguments.key = arguments.missingMethodArguments[1];
+ loc.method = "updateByKey";
+ }
+ StructDelete(arguments.missingMethodArguments, "1");
+ }
+ // multiple arguments so ensure that either 'key' or the singularized object name exists (loc.singularKey)
+ else
+ {
+ if (StructKeyExists(arguments.missingMethodArguments, loc.singularKey) and IsObject(arguments.missingMethodArguments[loc.singularKey]))
+ {
+ loc.componentReference = arguments.missingMethodArguments[loc.singularKey];
+ loc.method = "update";
+ StructDelete(arguments.missingMethodArguments, loc.singularKey);
+ }
+ else if (StructKeyExists(arguments.missingMethodArguments, "key"))
+ loc.method = "updateByKey";
+ else
+ $throw(type="Wheels.IncorrectArguments", message="The `#loc.singularKey#` or `key` named argument is required.", extendedInfo="When using multiple arguments for #loc.name#() you must supply an object using the argument `#loc.singularKey#` or a key using the argument `key`, e.g. #loc.name#(#loc.singularKey#=post) or #loc.name#(key=post.id).");
+ }
+ $setForeignKeyValues(missingMethodArguments=arguments.missingMethodArguments, keys=loc.info.foreignKey, setToNull=true);
+ }
+ else if (loc.name == "deleteObject")
+ {
+ // single argument, must be either the key or the object
+ if (StructCount(arguments.missingMethodArguments) eq 1)
+ {
+ if (IsObject(arguments.missingMethodArguments[1]))
+ {
+ loc.componentReference = arguments.missingMethodArguments[1];
+ loc.method = "delete";
+ }
+ else
+ {
+ arguments.missingMethodArguments.key = arguments.missingMethodArguments[1];
+ loc.method = "deleteByKey";
+ }
+ StructDelete(arguments.missingMethodArguments, "1");
+ }
+ // multiple arguments so ensure that either 'key' or the singularized object name exists (loc.singularKey)
+ else
+ {
+ if (StructKeyExists(arguments.missingMethodArguments, loc.singularKey) and IsObject(arguments.missingMethodArguments[loc.singularKey]))
+ {
+ loc.componentReference = arguments.missingMethodArguments[loc.singularKey];
+ loc.method = "delete";
+ StructDelete(arguments.missingMethodArguments, loc.singularKey);
+ }
+ else if (StructKeyExists(arguments.missingMethodArguments, "key"))
+ loc.method = "deleteByKey";
+ else
+ $throw(type="Wheels.IncorrectArguments", message="The `#loc.singularKey#` or `key` named argument is required.", extendedInfo="When using multiple arguments for #loc.name#() you must supply an object using the argument `#loc.singularKey#` or a key using the argument `key`, e.g. #loc.name#(#loc.singularKey#=post) or #loc.name#(key=post.id).");
+ }
+ $setForeignKeyValues(missingMethodArguments=arguments.missingMethodArguments, keys=loc.info.foreignKey);
+ }
+ else if (loc.name == "hasObjects")
+ {
+ loc.method = "exists";
+ arguments.missingMethodArguments.where = loc.where;
+ }
+ else if (loc.name == "newObject")
+ {
+ loc.method = "new";
+ $setForeignKeyValues(missingMethodArguments=arguments.missingMethodArguments, keys=loc.info.foreignKey);
+ }
+ else if (loc.name == "createObject")
+ {
+ loc.method = "create";
+ $setForeignKeyValues(missingMethodArguments=arguments.missingMethodArguments, keys=loc.info.foreignKey);
+ }
+ else if (loc.name == "objectCount")
+ {
+ loc.method = "count";
+ arguments.missingMethodArguments.where = loc.where;
+ }
+ else if (loc.name == "findOneObject")
+ {
+ loc.method = "findOne";
+ arguments.missingMethodArguments.where = loc.where;
+ }
+ else if (loc.name == "removeAllObjects")
+ {
+ loc.method = "updateAll";
+ arguments.missingMethodArguments.where = loc.where;
+ $setForeignKeyValues(missingMethodArguments=arguments.missingMethodArguments, keys=loc.info.foreignKey, setToNull=true);
+ }
+ else if (loc.name == "deleteAllObjects")
+ {
+ loc.method = "deleteAll";
+ arguments.missingMethodArguments.where = loc.where;
+ }
+ }
+ else if (loc.info.type == "belongsTo")
+ {
+ loc.where = $keyWhereString(keys=loc.info.foreignKey, properties=loc.componentReference.primaryKeys());
+ if (StructKeyExists(arguments.missingMethodArguments, "where"))
+ loc.where = "(#loc.where#) AND (#arguments.missingMethodArguments.where#)";
+ loc.name = ReplaceNoCase(arguments.missingMethodName, loc.key, "object"); // create a generic method name (example: "hasAuthor" becomes "hasObject")
+ if (loc.name == "object")
+ {
+ loc.method = "findByKey";
+ arguments.missingMethodArguments.key = $propertyValue(name=loc.info.foreignKey);
+ }
+ else if (loc.name == "hasObject")
+ {
+ loc.method = "exists";
+ arguments.missingMethodArguments.key = $propertyValue(name=loc.info.foreignKey);
+ }
+ }
+ }
+ if (Len(loc.method))
+ loc.returnValue = $invoke(componentReference=loc.componentReference, method=loc.method, invokeArgs=arguments.missingMethodArguments);
+ }
+ </cfscript>
+ <cfif StructKeyExists(loc, "returnValue")>
+ <cfreturn loc.returnValue>
+ </cfif>
+</cffunction>
+
+<cffunction name="$propertyValue" returntype="string" access="public" output="false" hint="Returns the object's value of the passed in property name. If you pass in a list of property names you will get the values back in a list as well.">
+ <cfargument name="name" type="string" required="true" hint="Name of property to get value for.">
+ <cfscript>
+ var loc = {};
+ loc.returnValue = "";
+ loc.iEnd = ListLen(arguments.name);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ loc.returnValue = ListAppend(loc.returnValue, this[ListGetAt(arguments.name, loc.i)]);
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$setForeignKeyValues" returntype="void" access="public" output="false">
+ <cfargument name="missingMethodArguments" type="struct" required="true">
+ <cfargument name="keys" type="string" required="true">
+ <cfargument name="setToNull" type="boolean" required="false" default="false">
+ <cfscript>
+ var loc = {};
+ loc.iEnd = ListLen(arguments.keys);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ if (arguments.setToNull)
+ arguments.missingMethodArguments[ListGetAt(arguments.keys, loc.i)] = "";
+ else
+ arguments.missingMethodArguments[ListGetAt(arguments.keys, loc.i)] = this[primaryKeys(loc.i)];
+ }
+ </cfscript>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/model/properties.cfm b/src/main/webapp/wheels/model/properties.cfm new file mode 100755 index 0000000..77e42c1 --- /dev/null +++ b/src/main/webapp/wheels/model/properties.cfm @@ -0,0 +1,561 @@ +<!--- PUBLIC MODEL INITIALIZATION METHODS ---> + +<cffunction name="accessibleProperties" returntype="void" access="public" output="false" hint="Use this method to specify which properties can be set through mass assignment." + examples=' + <!--- In `models/User.cfc`, only `isActive` can be set through mass assignment operations like `updateAll()` ---> + <cffunction name="init"> + <cfset accessibleProperties("isActive")> + </cffunction> + ' + categories="model-initialization,miscellaneous" chapters="object-relational-mapping" functions="protectedProperties"> + <cfargument name="properties" type="string" required="false" default="" hint="Property name (or list of property names) that are allowed to be altered through mass assignment." /> + <cfscript> + var loc = {}; + if (StructKeyExists(arguments, "property")) + arguments.properties = ListAppend(arguments.properties, arguments.property); + // see if any associations should be included in the white list + for (loc.association in variables.wheels.class.associations) + if (variables.wheels.class.associations[loc.association].nested.allow) + arguments.properties = ListAppend(arguments.properties, loc.association); + variables.wheels.class.accessibleProperties.whiteList = $listClean(arguments.properties); + </cfscript> +</cffunction> + +<cffunction name="protectedProperties" returntype="void" access="public" output="false" hint="Use this method to specify which properties cannot be set through mass assignment." + examples=' + <!--- In `models/User.cfc`, `firstName` and `lastName` cannot be changed through mass assignment operations like `updateAll()` ---> + <cffunction name="init"> + <cfset protectedProperties("firstName,lastName")> + </cffunction> + ' + categories="model-initialization,miscellaneous" chapters="object-relational-mapping" functions="accessibleProperties"> + <cfargument name="properties" type="string" required="false" default="" hint="Property name (or list of property names) that are not allowed to be altered through mass assignment." /> + <cfscript> + var loc = {}; + if (StructKeyExists(arguments, "property")) + arguments.properties = ListAppend(arguments.properties, arguments.property); + variables.wheels.class.accessibleProperties.blackList = $listClean(arguments.properties); + </cfscript> +</cffunction> + +<cffunction name="property" returntype="void" access="public" output="false" hint="Use this method to map an object property to either a table column with a different name than the property or to a SQL expression. You only need to use this method when you want to override the default object relational mapping that Wheels performs." + examples= + ' + <!--- Tell Wheels that when we are referring to `firstName` in the CFML code, it should translate to the `STR_USERS_FNAME` column when interacting with the database instead of the default (which would be the `firstname` column) ---> + <cfset property(name="firstName", column="STR_USERS_FNAME")> + + <!--- Tell Wheels that when we are referring to `fullName` in the CFML code, it should concatenate the `STR_USERS_FNAME` and `STR_USERS_LNAME` columns ---> + <cfset property(name="fullName", sql="STR_USERS_FNAME + '' '' + STR_USERS_LNAME")> + + <!--- Tell Wheels that when displaying error messages or labels for form fields, we want to use `First name(s)` as the label for the `STR_USERS_FNAME` column ---> + <cfset property(name="firstName", label="First name(s)")> + + <!--- Tell Wheels that when creating new objects, we want them to be auto-populated with a `firstName` property of value `Dave` ---> + <cfset property(name="firstName", defaultValue="Dave")> + ' + categories="model-initialization,miscellaneous" chapters="object-relational-mapping" functions="columnNames,dataSource,propertyNames,table,tableName"> + <cfargument name="name" type="string" required="true" hint="The name that you want to use for the column or SQL function result in the CFML code."> + <cfargument name="column" type="string" required="false" default="" hint="The name of the column in the database table to map the property to."> + <cfargument name="sql" type="string" required="false" default="" hint="A SQL expression to use to calculate the property value."> + <cfargument name="label" type="string" required="false" default="" hint="A custom label for this property to be referenced in the interface and error messages."> + <cfargument name="defaultValue" type="string" required="false" hint="A default value for this property."> + <cfscript> + // validate setup + if (Len(arguments.column) and Len(arguments.sql)) + $throw(type="Wheels", message="Incorrect Arguments", extendedInfo="You cannot specify both a column and a sql statement when setting up the mapping for this property."); + if (Len(arguments.sql) and StructKeyExists(arguments, "defaultValue")) + $throw(type="Wheels", message="Incorrect Arguments", extendedInfo="You cannot specify a default value for calculated properties."); + + // create the key + if (!StructKeyExists(variables.wheels.class.mapping, arguments.name)) + variables.wheels.class.mapping[arguments.name] = {}; + + if (Len(arguments.column)) + { + variables.wheels.class.mapping[arguments.name].type = "column"; + variables.wheels.class.mapping[arguments.name].value = arguments.column; + } + + if (Len(arguments.sql)) + { + variables.wheels.class.mapping[arguments.name].type = "sql"; + variables.wheels.class.mapping[arguments.name].value = arguments.sql; + } + + if (Len(arguments.label)) + variables.wheels.class.mapping[arguments.name].label = arguments.label; + + if (StructKeyExists(arguments, "defaultValue")) + variables.wheels.class.mapping[arguments.name].defaultValue = arguments.defaultValue; + </cfscript> +</cffunction> + +<!--- PUBLIC MODEL CLASS METHODS ---> + +<cffunction name="propertyNames" returntype="string" access="public" output="false" hint="Returns a list of property names ordered by their respective column's ordinal position in the database table. Also includes calculated property names that will be generated by the Wheels ORM." + examples= + ' + <!--- Get a list of the property names in use in the user model ---> + <cfset propNames = model("user").propertyNames()> + ' + categories="model-class,miscellaneous" chapters="object-relational-mapping" functions="columnNames,dataSource,property,table,tableName"> + <cfscript> + var loc = {}; + loc.returnValue = variables.wheels.class.propertyList; + if (ListLen(variables.wheels.class.calculatedPropertyList)) + loc.returnValue = ListAppend(loc.returnValue, variables.wheels.class.calculatedPropertyList); + </cfscript> + <cfreturn loc.returnValue> +</cffunction> + +<cffunction name="columns" returntype="array" access="public" output="false" hint="Returns an array of columns names for the table associated with this class. Does not include calculated properties that will be generated by the Wheels ORM." + examples= + ' + <!--- Get the columns names in the order they are in the database ---> + <cfset employee = model("employee").columns()> + ' + categories="model-class,miscellaneous" chapters="object-relational-mapping" functions=""> + <cfreturn ListToArray(variables.wheels.class.columnList) /> +</cffunction> + +<cffunction name="columnForProperty" returntype="any" access="public" output="false" hint="Returns the column name mapped for the named model property." + examples= + ' + <!--- Get an object, set a value and then see if the property exists ---> + <cfset employee = model("employee").new()> + <cfset employee.columnForProperty("firstName")><!--- returns column name, in this case "firstname" if the convention is used ---> + ' + categories="model-class,miscellaneous" chapters="object-relational-mapping" functions=""> + <cfargument name="property" type="string" required="true" hint="See documentation for @hasProperty." /> + <cfscript> + var columnName = false; + if (StructKeyExists(variables.wheels.class.properties, arguments.property)) + columnName = variables.wheels.class.properties[arguments.property].column; + </cfscript> + <cfreturn columnName /> +</cffunction> + +<cffunction name="columnDataForProperty" returntype="any" access="public" output="false" hint="Returns a struct with data for the named property." + examples= + ' + <!--- Get an object, set a value and then see if the property exists ---> + <cfset employee = model("employee").new()> + <cfset employee.columnDataForProperty("firstName")><!--- returns column struct ---> + ' + categories="model-class,miscellaneous" chapters="object-relational-mapping" functions=""> + <cfargument name="property" type="string" required="true" hint="Name of column to retrieve data for." /> + <cfscript> + var columnData = false; + if (StructKeyExists(variables.wheels.class.properties, arguments.property)) + columnData = variables.wheels.class.properties[arguments.property]; + </cfscript> + <cfreturn columnData /> +</cffunction> + +<cffunction name="validationTypeForProperty" returntype="any" access="public" output="false" hint="Returns the validation type for the property" + examples= + ' + <!--- first name is a varchar(50) column ---> + <cfset employee = model("employee").new()> + <!--- would output "string" ---> + <cfoutput>##employee.validationTypeForProperty("firstName")>##</cfoutput> + ' + categories="model-class,miscellaneous" chapters="object-relational-mapping" functions=""> + <cfargument name="property" type="string" required="true" hint="Name of column to retrieve data for." /> + <cfscript> + var columnData = "string"; + if (StructKeyExists(variables.wheels.class.properties, arguments.property)) + { + columnData = variables.wheels.class.properties[arguments.property].validationtype; + } + </cfscript> + <cfreturn columnData /> +</cffunction> + +<!--- PUBLIC MODEL OBJECT METHODS ---> + +<cffunction name="key" returntype="string" access="public" output="false" hint="Returns the value of the primary key for the object. If you have a single primary key named `id`, then `someObject.key()` is functionally equivalent to `someObject.id`. This method is more useful when you do dynamic programming and don't know the name of the primary key or when you use composite keys (in which case it's convenient to use this method to get a list of both key values returned)." + examples= + ' + <!--- Get an object and then get the primary key value(s) ---> + <cfset employee = model("employee").findByKey(params.key)> + <cfset val = employee.key()> + ' + categories="model-object,miscellaneous" chapters="" functions=""> + <cfargument name="$persisted" type="boolean" required="false" default="false"> + <cfargument name="$returnTickCountWhenNew" type="boolean" required="false" default="false"> + <cfscript> + var loc = {}; + loc.returnValue = ""; + loc.iEnd = ListLen(primaryKeys()); + for (loc.i=1; loc.i <= loc.iEnd; loc.i++) + { + loc.property = primaryKeys(loc.i); + if (StructKeyExists(this, loc.property)) + { + if (arguments.$persisted && hasChanged(loc.property)) + loc.returnValue = ListAppend(loc.returnValue, changedFrom(loc.property)); + else + loc.returnValue = ListAppend(loc.returnValue, this[loc.property]); + } + } + if (!Len(loc.returnValue) && arguments.$returnTickCountWhenNew) + loc.returnValue = variables.wheels.tickCountId; + </cfscript> + <cfreturn loc.returnValue> +</cffunction> + +<cffunction name="hasProperty" returntype="boolean" access="public" output="false" hint="Returns `true` if the specified property name exists on the model." + examples= + ' + <!--- Get an object, set a value and then see if the property exists ---> + <cfset employee = model("employee").new()> + <cfset employee.firstName = "dude"> + <cfset employee.hasProperty("firstName")><!--- returns true ---> + + <!--- This is also a dynamic method that you could do ---> + <cfset employee.hasFirstName()> + ' + categories="model-object,miscellaneous" chapters="" functions=""> + <cfargument name="property" type="string" required="true" hint="Name of property to inspect." /> + <cfscript> + var hasProperty = false; + if (StructKeyExists(this, arguments.property) && !IsCustomFunction(this[arguments.property])) + hasProperty = true; + </cfscript> + <cfreturn hasProperty /> +</cffunction> + +<cffunction name="propertyIsPresent" returntype="boolean" access="public" output="false" hint="Returns `true` if the specified property exists on the model and is not a blank string." + examples= + ' + <!--- Get an object, set a value and then see if the property exists ---> + <cfset employee = model("employee").new()> + <cfset employee.firstName = "dude"> + <cfreturn employee.propertyIsPresent("firstName")><!--- Returns true ---> + + <cfset employee.firstName = ""> + <cfreturn employee.propertyIsPresent("firstName")><!--- Returns false ---> + ' + categories="model-object,miscellaneous" chapters="" functions=""> + <cfargument name="property" type="string" required="true" hint="See documentation for @hasProperty." /> + <cfscript> + var isPresent = false; + if (StructKeyExists(this, arguments.property) && !IsCustomFunction(this[arguments.property]) && IsSimpleValue(this[arguments.property]) && Len(this[arguments.property])) + isPresent = true; + </cfscript> + <cfreturn isPresent /> +</cffunction> + +<cffunction name="toggle" returntype="any" access="public" output="false" hint="Assigns to the property specified the opposite of the property's current boolean value. Throws an error if the property cannot be converted to a boolean value. Returns this object if save called internally is `false`." + examples= + ' + <!--- Get an object, and toggle a boolean property ---> + <cfset user = model("user").findByKey(58)> + <cfset isSuccess = user.toggle("isActive")><!--- returns whether the object was saved properly ---> + <!--- You can also use a dynamic helper for this ---> + <cfset isSuccess = user.toggleIsActive()> + ' + categories="model-object,crud" chapters="updating-records" functions=""> + <cfargument name="property" type="string" required="true" /> + <cfargument name="save" type="boolean" required="false" hint="Argument to decide whether save the property after it has been toggled. Defaults to true." /> + <cfscript> + $args(name="toggle", args=arguments); + if (!StructKeyExists(this, arguments.property)) + $throw(type="Wheels.PropertyDoesNotExist", message="Property Does Not Exist", extendedInfo="You may only toggle a property that exists on this model."); + if (!IsBoolean(this[arguments.property])) + $throw(type="Wheels.PropertyIsIncorrectType", message="Incorrect Arguments", extendedInfo="You may only toggle a property that evaluates to the boolean value."); + this[arguments.property] = !this[arguments.property]; + if (arguments.save) + return updateProperty(property=arguments.property, value=this[arguments.property]); + </cfscript> + <cfreturn this /> +</cffunction> + +<cffunction name="properties" returntype="struct" access="public" output="false" hint="Returns a structure of all the properties with their names as keys and the values of the property as values." + examples= + ' + <!--- Get a structure of all the properties for an object ---> + <cfset user = model("user").findByKey(1)> + <cfset props = user.properties()> + ' + categories="model-object,miscellaneous" chapters="" functions="setProperties"> + <cfscript> + var loc = {}; + loc.returnValue = {}; + + // loop through all properties and functions in the this scope + for (loc.key in this) + { + // we return anything that is not a function + if (!IsCustomFunction(this[loc.key])) + { + // try to get the property name from the list set on the object, this is just to avoid returning everything in ugly upper case which Adobe ColdFusion does by default + if (ListFindNoCase(propertyNames(), loc.key)) + loc.key = ListGetAt(propertyNames(), ListFindNoCase(propertyNames(), loc.key)); + + // set property from the this scope in the struct that we will return + loc.returnValue[loc.key] = this[loc.key]; + } + } + </cfscript> + <cfreturn loc.returnValue> +</cffunction> + +<cffunction name="setProperties" returntype="void" access="public" output="false" hint="Allows you to set all the properties of an object at once by passing in a structure with keys matching the property names." + examples= + ' + <!--- Update the properties of the object with the params struct containing the values of a form post ---> + <cfset user = model("user").findByKey(1)> + <cfset user.setProperties(params.user)> + ' + categories="model-object,miscellaneous" chapters="" functions="properties"> + <cfargument name="properties" type="struct" required="false" default="#StructNew()#" hint="See documentation for @new."> + <cfset $setProperties(argumentCollection=arguments) /> +</cffunction> + +<!--- changes ---> + +<cffunction name="hasChanged" returntype="boolean" access="public" output="false" hint="Returns `true` if the specified property (or any if none was passed in) has been changed but not yet saved to the database. Will also return `true` if the object is new and no record for it exists in the database." + examples= + ' + <!--- Get a member object and change the `email` property on it ---> + <cfset member = model("member").findByKey(params.memberId)> + <cfset member.email = params.newEmail> + + <!--- Check if the `email` property has changed ---> + <cfif member.hasChanged("email")> + <!--- Do something... ---> + </cfif> + + <!--- The above can also be done using a dynamic function like this ---> + <cfif member.emailHasChanged()> + <!--- Do something... ---> + </cfif> + ' + categories="model-object,changes" chapters="dirty-records" functions="allChanges,changedFrom,changedProperties"> + <cfargument name="property" type="string" required="false" default="" hint="Name of property to check for change."> + <cfscript> + var loc = {}; + + // always return true if $persistedProperties does not exists + if (!StructKeyExists(variables, "$persistedProperties")) + return true; + + if (!Len(arguments.property)) + { + // they haven't specified a particular property so loop through + // them all + arguments.property = StructKeyList(variables.wheels.class.properties); + } + + arguments.property = ListToArray(arguments.property); + + loc.iEnd = ArrayLen(arguments.property); + for (loc.i=1; loc.i <= loc.iEnd; loc.i++) + { + loc.key = arguments.property[loc.i]; + if (StructKeyExists(this, loc.key)) + { + if (!StructKeyExists(variables.$persistedProperties, loc.key)) + { + return true; + } + else + { + // hehehehe... convert each datatype to a string + // for easier comparision + loc.type = validationTypeForProperty(loc.key); + loc.a = $convertToString(this[loc.key], loc.type); + loc.b = $convertToString(variables.$persistedProperties[loc.key], loc.type); + + if(Compare(loc.a, loc.b) neq 0) + { + return true; + } + } + } + } + // if we get here, it means that all of the properties that were checked had a value in + // $persistedProperties and it matched or some of the properties did not exist in the this scope + </cfscript> + <cfreturn false> +</cffunction> + +<cffunction name="changedProperties" returntype="string" access="public" output="false" hint="Returns a list of the object properties that have been changed but not yet saved to the database." + examples= + ' + <!--- Get an object, change it, and then ask for its changes (will return a list of the property names that have changed, not the values themselves) ---> + <cfset member = model("member").findByKey(params.memberId)> + <cfset member.firstName = params.newFirstName> + <cfset member.email = params.newEmail> + <cfset changedProperties = member.changedProperties()> + ' + categories="model-object,changes" chapters="dirty-records" functions="allChanges,changedFrom,hasChanged"> + <cfscript> + var loc = {}; + loc.returnValue = ""; + for (loc.key in variables.wheels.class.properties) + if (hasChanged(loc.key)) + loc.returnValue = ListAppend(loc.returnValue, loc.key); + </cfscript> + <cfreturn loc.returnValue> +</cffunction> + +<cffunction name="changedFrom" returntype="string" access="public" output="false" hint="Returns the previous value of a property that has changed. Returns an empty string if no previous value exists. Wheels will keep a note of the previous property value until the object is saved to the database." + examples= + ' + <!--- Get a member object and change the `email` property on it ---> + <cfset member = model("member").findByKey(params.memberId)> + <cfset member.email = params.newEmail> + + <!--- Get the previous value (what the `email` property was before it was changed)---> + <cfset oldValue = member.changedFrom("email")> + + <!--- The above can also be done using a dynamic function like this ---> + <cfset oldValue = member.emailChangedFrom()> + ' + categories="model-object,changes" chapters="dirty-records" functions="allChanges,changedProperties,hasChanged"> + <cfargument name="property" type="string" required="true" hint="Name of property to get the previous value for."> + <cfscript> + var returnValue = ""; + if (StructKeyExists(variables, "$persistedProperties") && StructKeyExists(variables.$persistedProperties, arguments.property)) + returnValue = variables.$persistedProperties[arguments.property]; + </cfscript> + <cfreturn returnValue> +</cffunction> + +<cffunction name="allChanges" returntype="struct" access="public" output="false" hint="Returns a struct detailing all changes that have been made on the object but not yet saved to the database." + examples= + ' + <!--- Get an object, change it, and then ask for its changes (will return a struct containing the changes, both property names and their values) ---> + <cfset member = model("member").findByKey(params.memberId)> + <cfset member.firstName = params.newFirstName> + <cfset member.email = params.newEmail> + <cfset allChanges = member.allChanges()> + ' + categories="model-object,changes" chapters="dirty-records" functions="changedFrom,changedProperties,hasChanged"> + <cfscript> + var loc = {}; + loc.returnValue = {}; + if (hasChanged()) + { + loc.changedProperties = changedProperties(); + loc.iEnd = ListLen(loc.changedProperties); + for (loc.i=1; loc.i <= loc.iEnd; loc.i++) + { + loc.item = ListGetAt(loc.changedProperties, loc.i); + loc.returnValue[loc.item] = {}; + loc.returnValue[loc.item].changedFrom = changedFrom(loc.item); + if (StructKeyExists(this, loc.item)) + loc.returnValue[loc.item].changedTo = this[loc.item]; + else + loc.returnValue[loc.item].changedTo = ""; + } + } + </cfscript> + <cfreturn loc.returnValue> +</cffunction> + +<!--- PRIVATE MODEL OBJECT METHODS ---> + +<cffunction name="$setProperties" returntype="any" access="public" output="false" hint="I am the behind the scenes method to turn arguments into the properties argument."> + <cfargument name="properties" type="struct" required="true" /> + <cfargument name="filterList" type="string" required="false" default="" /> + <cfargument name="setOnModel" type="boolean" required="false" default="true" /> + <cfargument name="$useFilterLists" type="boolean" required="false" default="true" /> + <cfscript> + var loc = {}; + + loc.allowedProperties = {}; + + arguments.filterList = ListAppend(arguments.filterList, "properties,filterList,setOnModel,$useFilterLists"); + + // add eventual named arguments to properties struct (named arguments will take precedence) + for (loc.key in arguments) + if (!ListFindNoCase(arguments.filterList, loc.key)) + arguments.properties[loc.key] = arguments[loc.key]; + + for (loc.key in arguments.properties) // loop throug the properties and see if they can be set based off of the accessible properties lists + { + loc.accessible = true; + if (arguments.$useFilterLists && StructKeyExists(variables.wheels.class.accessibleProperties, "whiteList") && !ListFindNoCase(variables.wheels.class.accessibleProperties.whiteList, loc.key)) + loc.accessible = false; + if (arguments.$useFilterLists && StructKeyExists(variables.wheels.class.accessibleProperties, "blackList") && ListFindNoCase(variables.wheels.class.accessibleProperties.blackList, loc.key)) + loc.accessible = false; + if (loc.accessible) + loc.allowedProperties[loc.key] = arguments.properties[loc.key]; + if (loc.accessible && arguments.setOnModel) + $setProperty(property=loc.key, value=loc.allowedProperties[loc.key]); + } + + if (arguments.setOnModel) + return; + </cfscript> + <cfreturn loc.allowedProperties /> +</cffunction> + +<cffunction name="$setProperty" returntype="void" access="public" output="false"> + <cfargument name="property" type="string" required="true" /> + <cfargument name="value" type="any" required="true" /> + <cfargument name="associations" type="struct" required="false" default="#variables.wheels.class.associations#" /> + <cfscript> + if (IsObject(arguments.value)) + this[arguments.property] = arguments.value; + else if (IsStruct(arguments.value) && StructKeyExists(arguments.associations, arguments.property) && arguments.associations[arguments.property].nested.allow && ListFindNoCase("belongsTo,hasOne", arguments.associations[arguments.property].type)) + $setOneToOneAssociationProperty(property=arguments.property, value=arguments.value, association=arguments.associations[arguments.property]); + else if (IsStruct(arguments.value) && StructKeyExists(arguments.associations, arguments.property) && arguments.associations[arguments.property].nested.allow && arguments.associations[arguments.property].type == "hasMany") + $setCollectionAssociationProperty(property=arguments.property, value=arguments.value, association=arguments.associations[arguments.property]); + else if (IsArray(arguments.value) && ArrayLen(arguments.value) && !IsObject(arguments.value[1]) && StructKeyExists(arguments.associations, arguments.property) && arguments.associations[arguments.property].nested.allow && arguments.associations[arguments.property].type == "hasMany") + $setCollectionAssociationProperty(property=arguments.property, value=arguments.value, association=arguments.associations[arguments.property]); + else + this[arguments.property] = arguments.value; + </cfscript> + <cfreturn /> +</cffunction> + +<cffunction name="$updatePersistedProperties" returntype="void" access="public" output="false"> + <cfscript> + var loc = {}; + variables.$persistedProperties = {}; + for (loc.key in variables.wheels.class.properties) + if (StructKeyExists(this, loc.key)) + variables.$persistedProperties[loc.key] = this[loc.key]; + </cfscript> +</cffunction> + +<cffunction name="$setDefaultValues" returntype="any" access="public" output="false"> + <cfscript> + var loc = {}; + for (loc.key in variables.wheels.class.properties) + { + if (StructKeyExists(variables.wheels.class.properties[loc.key], "defaultValue") && (!StructKeyExists(this, loc.key) || !Len(this[loc.key]))) + { + // set the default value unless it is blank or a value already exists for that property on the object + this[loc.key] = variables.wheels.class.properties[loc.key].defaultValue; + } + } + </cfscript> +</cffunction> + +<cffunction name="$propertyInfo" returntype="struct" access="public" output="false"> + <cfargument name="property" type="string" required="true"> + <cfscript> + var returnValue = {}; + if (StructKeyExists(variables.wheels.class.properties, arguments.property)) + returnValue = variables.wheels.class.properties[arguments.property]; + </cfscript> + <cfreturn returnValue /> +</cffunction> + +<cffunction name="$label" returntype="string" access="public" output="false"> + <cfargument name="property" type="string" required="true"> + <cfscript> + if (StructKeyExists(variables.wheels.class.properties, arguments.property) && StructKeyExists(variables.wheels.class.properties[arguments.property], "label")) + return variables.wheels.class.properties[arguments.property].label; + else if (StructKeyExists(variables.wheels.class.mapping, arguments.property) && StructKeyExists(variables.wheels.class.mapping[arguments.property], "label")) + return variables.wheels.class.mapping[arguments.property].label; + else + return Humanize(arguments.property); + </cfscript> +</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/model/serialize.cfm b/src/main/webapp/wheels/model/serialize.cfm new file mode 100755 index 0000000..f54ee01 --- /dev/null +++ b/src/main/webapp/wheels/model/serialize.cfm @@ -0,0 +1,176 @@ +<cffunction name="$serializeQueryToObjects" access="public" output="false" returntype="any">
+ <cfargument name="query" type="query" required="true" />
+ <cfargument name="include" type="string" required="false" default="" />
+ <cfargument name="callbacks" type="string" required="false" default="true" />
+ <cfargument name="returnIncluded" type="string" required="false" default="true" />
+ <cfscript>
+ var loc = {};
+ // grab our objects as structs first so we don't waste cpu creating objects we don't need
+ loc.returnValue = $serializeQueryToStructs(argumentCollection=arguments);
+ </cfscript>
+ <cfreturn $serializeStructsToObjects(structs=loc.returnValue, argumentCollection=arguments) />
+</cffunction>
+
+<cffunction name="$serializeStructsToObjects" access="public" output="false" returntype="any">
+ <cfargument name="structs" type="any" required="true" />
+ <cfargument name="include" type="string" required="true" />
+ <cfargument name="callbacks" type="string" required="true" />
+ <cfargument name="returnIncluded" type="string" required="true" />
+ <cfscript>
+ var loc = {};
+
+ if (IsStruct(arguments.structs))
+ loc.returnValue = [ arguments.structs ];
+ else if (IsArray(arguments.structs))
+ loc.returnValue = arguments.structs;
+
+ loc.iEnd = ArrayLen(loc.returnValue);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+
+ if (Len(arguments.include) && arguments.returnIncluded)
+ {
+ // create each object from the assocations before creating our root object
+ loc.xEnd = ListLen(arguments.include);
+ for (loc.x = 1; loc.x lte loc.xEnd; loc.x++)
+ {
+ loc.include = ListGetAt(arguments.include, loc.x);
+ loc.model = model(variables.wheels.class.associations[loc.include].modelName);
+ if (variables.wheels.class.associations[loc.include].type == "hasMany")
+ {
+ loc.jEnd = ArrayLen(loc.returnValue[loc.i][loc.include]);
+ for (loc.j=1; loc.j <= loc.jEnd; loc.j++)
+ loc.returnValue[loc.i][loc.include][loc.j] = loc.model.$createInstance(properties=loc.returnValue[loc.i][loc.include][loc.j], persisted=true, base=false, callbacks=arguments.callbacks);
+ }
+ else
+ {
+ // we have a hasOne or belongsTo assocation, so just add the object to the root object
+ loc.returnValue[loc.i][loc.include] = loc.model.$createInstance(properties=loc.returnValue[loc.i][loc.include], persisted=true, base=false, callbacks=arguments.callbacks);
+ }
+ }
+ }
+
+ // create an instance
+ loc.returnValue[loc.i] = $createInstance(properties=loc.returnValue[loc.i], persisted=true, callbacks=arguments.callbacks);
+ }
+ </cfscript>
+ <cfreturn loc.returnValue />
+</cffunction>
+
+<cffunction name="$serializeQueryToStructs" access="public" output="false" returntype="any">
+ <cfargument name="query" type="query" required="true" />
+ <cfargument name="include" type="string" required="true" />
+ <cfargument name="callbacks" type="string" required="true" />
+ <cfargument name="returnIncluded" type="string" required="true" />
+ <cfscript>
+ var loc = {};
+ loc.returnValue = [];
+ loc.doneStructs = "";
+
+ // loop through all of our records and create an object for each row in the query
+ for (loc.i=1; loc.i <= arguments.query.recordCount; loc.i++)
+ {
+ // create a new struct
+ loc.struct = $queryRowToStruct(properties=arguments.query, row=loc.i);
+ loc.structHash = $hashedKey(loc.struct);
+ if (!ListFind(loc.doneStructs, loc.structHash, Chr(7)))
+ {
+ if (Len(arguments.include) && arguments.returnIncluded)
+ {
+ // loop through our assocations to build nested objects attached to the main object
+ loc.xEnd = ListLen(arguments.include);
+ for (loc.x = 1; loc.x lte loc.xEnd; loc.x++)
+ {
+ loc.include = ListGetAt(arguments.include, loc.x);
+ if (variables.wheels.class.associations[loc.include].type == "hasMany")
+ {
+ // we have a hasMany assocation, so loop through all of the records again to find the ones that belong to our root object
+ loc.struct[loc.include] = [];
+ loc.hasManyDoneStructs = "";
+
+ // only get a reference to our model once per assocation
+ loc.model = model(variables.wheels.class.associations[loc.include].modelName);
+
+ for (loc.j=1; loc.j <= arguments.query.recordCount; loc.j++)
+ {
+ // is there anything we can do here to not instantiate an object if it is not going to be use or is already created
+ // this extra instantiation is really slowing things down
+ loc.hasManyStruct = loc.model.$queryRowToStruct(properties=arguments.query, row=loc.j, base=false);
+ loc.hasManyStructHash = $hashedKey(loc.hasManyStruct);
+
+ if (!ListFind(loc.hasManyDoneStructs, loc.hasManyStructHash, Chr(7)))
+ {
+ // create object instance from values in current query row if it belongs to the current object
+ loc.primaryKeyColumnValues = "";
+ loc.kEnd = ListLen(primaryKeys());
+
+ for (loc.k=1; loc.k <= loc.kEnd; loc.k++)
+ loc.primaryKeyColumnValues = ListAppend(loc.primaryKeyColumnValues, arguments.query[primaryKeys(loc.k)][loc.j]);
+
+ if (Len(loc.model.$keyFromStruct(loc.hasManyStruct)) && this.$keyFromStruct(loc.struct) == loc.primaryKeyColumnValues)
+ ArrayAppend(loc.struct[loc.include], loc.hasManyStruct);
+
+ loc.hasManyDoneStructs = ListAppend(loc.hasManyDoneStructs, loc.hasManyStructHash, Chr(7));
+ }
+ }
+ }
+ else
+ {
+ // we have a hasOne or belongsTo assocation, so just add the object to the root object
+ loc.struct[loc.include] = model(variables.wheels.class.associations[loc.include].modelName).$queryRowToStruct(properties=arguments.query, row=loc.i, base=false);
+ }
+ }
+ }
+ ArrayAppend(loc.returnValue, loc.struct);
+ loc.doneStructs = ListAppend(loc.doneStructs, loc.structHash, Chr(7));
+ }
+ }
+ </cfscript>
+ <cfreturn loc.returnValue />
+</cffunction>
+
+<cffunction name="$queryRowToStruct" access="public" output="false" returntype="struct">
+ <cfargument name="properties" type="any" required="true">
+ <cfargument name="name" type="string" required="false" default="#variables.wheels.class.modelName#">
+ <cfargument name="row" type="numeric" required="false" default="1">
+ <cfargument name="base" type="boolean" required="false" default="true">
+ <cfscript>
+ var loc = {};
+ loc.returnValue = {};
+
+ loc.allProperties = ListAppend(variables.wheels.class.propertyList, variables.wheels.class.calculatedPropertyList);
+ loc.iEnd = ListLen(loc.allProperties);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ try // coldfusion has a problem with empty strings in queries for bit types
+ {
+ loc.iItem = ListGetAt(loc.allProperties, loc.i);
+ if (!arguments.base && ListFindNoCase(arguments.properties.columnList, arguments.name & loc.iItem))
+ loc.returnValue[loc.iItem] = arguments.properties[arguments.name & loc.iItem][arguments.row];
+ else if (ListFindNoCase(arguments.properties.columnList, loc.iItem))
+ loc.returnValue[loc.iItem] = arguments.properties[loc.iItem][arguments.row];
+ }
+ catch (Any e)
+ {
+ loc.returnValue[loc.iItem] = "";
+ }
+ }
+ </cfscript>
+ <cfreturn loc.returnValue />
+</cffunction>
+
+<cffunction name="$keyFromStruct" access="public" output="false" returntype="string">
+ <cfargument name="struct" type="struct" required="true">
+ <cfscript>
+ var loc = {};
+ loc.returnValue = "";
+ loc.iEnd = ListLen(primaryKeys());
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.property = primaryKeys(loc.i);
+ if (StructKeyExists(arguments.struct, loc.property))
+ loc.returnValue = ListAppend(loc.returnValue, arguments.struct[loc.property]);
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
diff --git a/src/main/webapp/wheels/model/sql.cfm b/src/main/webapp/wheels/model/sql.cfm new file mode 100755 index 0000000..afb6da8 --- /dev/null +++ b/src/main/webapp/wheels/model/sql.cfm @@ -0,0 +1,697 @@ +<cffunction name="$addDeleteClause" returntype="array" access="public" output="false">
+ <cfargument name="sql" type="array" required="true">
+ <cfargument name="softDelete" type="boolean" required="true">
+ <cfscript>
+ var loc = {};
+ if (variables.wheels.class.softDeletion && arguments.softDelete)
+ {
+ ArrayAppend(arguments.sql, "UPDATE #tableName()# SET #variables.wheels.class.softDeleteColumn# = ");
+ loc.param = {value=Now(), type="cf_sql_timestamp"};
+ ArrayAppend(arguments.sql, loc.param);
+ }
+ else
+ {
+ ArrayAppend(arguments.sql, "DELETE FROM #tableName()#");
+ }
+ </cfscript>
+ <cfreturn arguments.sql>
+</cffunction>
+
+<cffunction name="$fromClause" returntype="string" access="public" output="false">
+ <cfargument name="include" type="string" required="true">
+ <cfargument name="includeSoftDeletes" type="boolean" required="false" default="false">
+ <cfscript>
+ var loc = {};
+
+ // start the from statement with the SQL keyword and the table name for the current model
+ loc.returnValue = "FROM " & tableName();
+
+ // add join statements if associations have been specified through the include argument
+ if (Len(arguments.include))
+ {
+ // get info for all associations
+ loc.associations = $expandedAssociations(include=arguments.include, includeSoftDeletes=arguments.includeSoftDeletes);
+
+ // add join statement for each include separated by space
+ loc.iEnd = ArrayLen(loc.associations);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ loc.returnValue = ListAppend(loc.returnValue, loc.associations[loc.i].join, " ");
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$addKeyWhereClause" returntype="array" access="public" output="false">
+ <cfargument name="sql" type="array" required="true">
+ <cfscript>
+ var loc = {};
+ ArrayAppend(arguments.sql, " WHERE ");
+ loc.iEnd = ListLen(primaryKeys());
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.key = primaryKeys(loc.i);
+ ArrayAppend(arguments.sql, "#variables.wheels.class.properties[loc.key].column# = ");
+ if (hasChanged(loc.key))
+ loc.value = changedFrom(loc.key);
+ else
+ loc.value = this[loc.key];
+ if (Len(loc.value))
+ loc.null = false;
+ else
+ loc.null = true;
+ loc.param = {value=loc.value, type=variables.wheels.class.properties[loc.key].type, dataType=variables.wheels.class.properties[loc.key].dataType, scale=variables.wheels.class.properties[loc.key].scale, null=loc.null};
+ ArrayAppend(arguments.sql, loc.param);
+ if (loc.i < loc.iEnd)
+ ArrayAppend(arguments.sql, " AND ");
+ }
+ </cfscript>
+ <cfreturn arguments.sql>
+</cffunction>
+
+<cffunction name="$orderByClause" returntype="string" access="public" output="false">
+ <cfargument name="order" type="string" required="true">
+ <cfargument name="include" type="string" required="true">
+ <cfscript>
+ var loc = {};
+ loc.returnValue = "";
+ if (Len(arguments.order))
+ {
+ if (arguments.order == "random")
+ {
+ loc.returnValue = variables.wheels.class.adapter.$randomOrder();
+ }
+ else if (arguments.order Contains "(")
+ {
+ loc.returnValue = arguments.order;
+ }
+ else
+ {
+ // setup an array containing class info for current class and all the ones that should be included
+ loc.classes = [];
+ if (Len(arguments.include))
+ loc.classes = $expandedAssociations(include=arguments.include);
+ ArrayPrepend(loc.classes, variables.wheels.class);
+
+ loc.returnValue = "";
+ loc.iEnd = ListLen(arguments.order);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.iItem = Trim(ListGetAt(arguments.order, loc.i));
+ if (!FindNoCase(" ASC", loc.iItem) && !FindNoCase(" DESC", loc.iItem))
+ loc.iItem = loc.iItem & " ASC";
+ if (loc.iItem Contains ".")
+ {
+ loc.returnValue = ListAppend(loc.returnValue, loc.iItem);
+ }
+ else
+ {
+ loc.property = ListLast(SpanExcluding(loc.iItem, " "), ".");
+ loc.jEnd = ArrayLen(loc.classes);
+ for (loc.j=1; loc.j <= loc.jEnd; loc.j++)
+ {
+ loc.toAdd = "";
+ loc.classData = loc.classes[loc.j];
+ if (ListFindNoCase(loc.classData.propertyList, loc.property))
+ loc.toAdd = loc.classData.tableName & "." & loc.classData.properties[loc.property].column;
+ else if (ListFindNoCase(loc.classData.calculatedPropertyList, loc.property))
+ loc.toAdd = Replace(loc.classData.calculatedProperties[loc.property].sql, ",", "[[comma]]", "all");
+ if (Len(loc.toAdd))
+ {
+ if (!ListFindNoCase(loc.classData.columnList, loc.property))
+ loc.toAdd = loc.toAdd & " AS " & loc.property;
+ loc.toAdd = loc.toAdd & " " & UCase(ListLast(loc.iItem, " "));
+ if (!ListFindNoCase(loc.returnValue, loc.toAdd))
+ {
+ loc.returnValue = ListAppend(loc.returnValue, loc.toAdd);
+ break;
+ }
+ }
+ }
+ if (application.wheels.showErrorInformation && !Len(loc.toAdd))
+ $throw(type="Wheels.ColumnNotFound", message="Wheels looked for the column mapped to the `#loc.property#` property but couldn't find it in the database table.", extendedInfo="Verify the `order` argument and/or your property to column mappings done with the `property` method inside the model's `init` method to make sure everything is correct.");
+ }
+ }
+ }
+ loc.returnValue = "ORDER BY " & loc.returnValue;
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$groupByClause" returntype="string" access="public" output="false">
+ <cfargument name="select" type="string" required="true">
+ <cfargument name="include" type="string" required="true">
+ <cfargument name="group" type="string" required="true">
+ <cfargument name="distinct" type="boolean" required="true">
+ <cfargument name="returnAs" type="string" required="true">
+ <cfscript>
+ var returnValue = "";
+ // if we want a distinct statement, we can do it grouping every field in the select
+ if (arguments.distinct)
+ returnValue = $createSQLFieldList(list=arguments.select, include=arguments.include, returnAs=arguments.returnAs, renameFields=false, addCalculatedProperties=false);
+ else if (Len(arguments.group))
+ returnValue = $createSQLFieldList(list=arguments.group, include=arguments.include, returnAs=arguments.returnAs, renameFields=false, addCalculatedProperties=false);
+ if (Len(returnValue))
+ returnValue = "GROUP BY " & returnValue;
+ </cfscript>
+ <cfreturn returnValue>
+</cffunction>
+
+<cffunction name="$selectClause" returntype="string" access="public" output="false">
+ <cfargument name="select" type="string" required="true">
+ <cfargument name="include" type="string" required="true">
+ <cfargument name="returnAs" type="string" required="true">
+ <cfscript>
+ var returnValue = "";
+ returnValue = $createSQLFieldList(list=arguments.select, include=arguments.include, returnAs=arguments.returnAs);
+ returnValue = "SELECT " & returnValue;
+ </cfscript>
+ <cfreturn returnValue>
+</cffunction>
+
+<cffunction name="$createSQLFieldList" returntype="string" access="public" output="false">
+ <cfargument name="list" type="string" required="true">
+ <cfargument name="include" type="string" required="true">
+ <cfargument name="returnAs" type="string" required="true">
+ <cfargument name="renameFields" type="boolean" required="false" default="true">
+ <cfargument name="addCalculatedProperties" type="boolean" required="false" default="true">
+ <cfargument name="useExpandedColumnAliases" type="boolean" required="false" default="#application.wheels.useExpandedColumnAliases#">
+ <cfscript>
+ var loc = {};
+ // setup an array containing class info for current class and all the ones that should be included
+ loc.classes = [];
+ if (Len(arguments.include))
+ loc.classes = $expandedAssociations(include=arguments.include);
+ ArrayPrepend(loc.classes, variables.wheels.class);
+
+ // if the develop passes in tablename.*, translate it into the list of fields for the developer
+ // this is so we don't get *'s in the group by
+ if (Find(".*", arguments.list))
+ arguments.list = $expandProperties(list=arguments.list, classes=loc.classes);
+
+ // add properties to select if the developer did not specify any
+ if (!Len(arguments.list))
+ {
+ loc.iEnd = ArrayLen(loc.classes);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.classData = loc.classes[loc.i];
+ arguments.list = ListAppend(arguments.list, loc.classData.propertyList);
+ if (Len(loc.classData.calculatedPropertyList))
+ arguments.list = ListAppend(arguments.list, loc.classData.calculatedPropertyList);
+ }
+ }
+
+ // go through the properties and map them to the database unless the developer passed in a table name or an alias in which case we assume they know what they're doing and leave the select clause as is
+ if (arguments.list Does Not Contain "." AND arguments.list Does Not Contain " AS ")
+ {
+ loc.list = "";
+ loc.addedProperties = "";
+ loc.addedPropertiesByModel = {};
+ loc.iEnd = ListLen(arguments.list);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.iItem = Trim(ListGetAt(arguments.list, loc.i));
+
+ // look for duplicates
+ loc.duplicateCount = ListValueCountNoCase(loc.addedProperties, loc.iItem);
+ loc.addedProperties = ListAppend(loc.addedProperties, loc.iItem);
+
+ // loop through all classes (current and all included ones)
+ loc.jEnd = ArrayLen(loc.classes);
+ for (loc.j=1; loc.j <= loc.jEnd; loc.j++)
+ {
+ loc.toAppend = "";
+ loc.classData = loc.classes[loc.j];
+
+ // create a struct for this model unless it already exists
+ if (!StructKeyExists(loc.addedPropertiesByModel, loc.classData.modelName))
+ loc.addedPropertiesByModel[loc.classData.modelName] = "";
+
+ // if we find the property in this model and it's not already added we go ahead and add it to the select clause
+ if ((ListFindNoCase(loc.classData.propertyList, loc.iItem) || ListFindNoCase(loc.classData.calculatedPropertyList, loc.iItem)) && !ListFindNoCase(loc.addedPropertiesByModel[loc.classData.modelName], loc.iItem))
+ {
+ // if expanded column aliases is enabled then mark all columns from included classes as duplicates in order to prepend them with their class name
+ loc.flagAsDuplicate = false;
+ if (arguments.renameFields)
+ {
+ if (loc.duplicateCount)
+ {
+ // always flag as a duplicate when a property with this name has already been added
+ loc.flagAsDuplicate = true;
+ }
+ else if (loc.j > 1)
+ {
+ if (arguments.useExpandedColumnAliases)
+ {
+ // when on included models and using the new setting we flag every property as a duplicate so that the model name always gets prepended
+ loc.flagAsDuplicate = true;
+ }
+ else if (!arguments.useExpandedColumnAliases && arguments.returnAs != "query")
+ {
+ // with the old setting we only do it when we're returning object(s) since when creating instances on none base models we need the model name prepended
+ loc.flagAsDuplicate = true;
+ }
+ }
+ }
+ if (loc.flagAsDuplicate )
+ loc.toAppend = loc.toAppend & "[[duplicate]]" & loc.j;
+ if (ListFindNoCase(loc.classData.propertyList, loc.iItem))
+ {
+ loc.toAppend = loc.toAppend & loc.classData.tableName & ".";
+ if (ListFindNoCase(loc.classData.columnList, loc.iItem))
+ {
+ loc.toAppend = loc.toAppend & loc.iItem;
+ }
+ else
+ {
+ loc.toAppend = loc.toAppend & loc.classData.properties[loc.iItem].column;
+ if (arguments.renameFields)
+ loc.toAppend = loc.toAppend & " AS " & loc.iItem;
+ }
+ }
+ else if (ListFindNoCase(loc.classData.calculatedPropertyList, loc.iItem) && arguments.addCalculatedProperties)
+ {
+ loc.toAppend = loc.toAppend & "(" & Replace(loc.classData.calculatedProperties[loc.iItem].sql, ",", "[[comma]]", "all") & ") AS " & loc.iItem;
+ }
+ loc.addedPropertiesByModel[loc.classData.modelName] = ListAppend(loc.addedPropertiesByModel[loc.classData.modelName], loc.iItem);
+ break;
+ }
+ }
+ if (Len(loc.toAppend))
+ loc.list = ListAppend(loc.list, loc.toAppend);
+ else if (application.wheels.showErrorInformation && (not arguments.addCalculatedProperties && not ListFindNoCase(loc.classData.calculatedPropertyList, loc.iItem)))
+ $throw(type="Wheels.ColumnNotFound", message="Wheels looked for the column mapped to the `#loc.iItem#` property but couldn't find it in the database table.", extendedInfo="Verify the `select` argument and/or your property to column mappings done with the `property` method inside the model's `init` method to make sure everything is correct.");
+ }
+
+ // let's replace eventual duplicates in the clause by prepending the class name
+ if (Len(arguments.include) && arguments.renameFields)
+ {
+ loc.newSelect = "";
+ loc.addedProperties = "";
+ loc.iEnd = ListLen(loc.list);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.iItem = ListGetAt(loc.list, loc.i);
+
+ // get the property part, done by taking everytyhing from the end of the string to a . or a space (which would be found when using " AS ")
+ loc.property = Reverse(SpanExcluding(Reverse(loc.iItem), ". "));
+
+ // check if this one has been flagged as a duplicate, we get the number of classes to skip and also remove the flagged info from the item
+ loc.duplicateCount = 0;
+ loc.matches = REFind("^\[\[duplicate\]\](\d+)(.+)$", loc.iItem, 1, true);
+ if (loc.matches.pos[1] gt 0)
+ {
+ loc.duplicateCount = Mid(loc.iItem, loc.matches.pos[2], loc.matches.len[2]);
+ loc.iItem = Mid(loc.iItem, loc.matches.pos[3], loc.matches.len[3]);
+ }
+
+ if (!loc.duplicateCount)
+ {
+ // this is not a duplicate so we can just insert it as is
+ loc.newItem = loc.iItem;
+ loc.newProperty = loc.property;
+ }
+ else
+ {
+ // this is a duplicate so we prepend the class name and then insert it unless a property with the resulting name already exist
+ loc.classData = loc.classes[loc.duplicateCount];
+
+ // prepend class name to the property
+ loc.newProperty = loc.classData.modelName & loc.property;
+
+ if (loc.iItem Contains " AS ")
+ loc.newItem = ReplaceNoCase(loc.iItem, " AS " & loc.property, " AS " & loc.newProperty);
+ else
+ loc.newItem = loc.iItem & " AS " & loc.newProperty;
+ }
+ if (!ListFindNoCase(loc.addedProperties, loc.newProperty))
+ {
+ loc.newSelect = ListAppend(loc.newSelect, loc.newItem);
+ loc.addedProperties = ListAppend(loc.addedProperties, loc.newProperty);
+ }
+ }
+ loc.list = loc.newSelect;
+ }
+ }
+ else
+ {
+ loc.list = arguments.list;
+ if (!arguments.renameFields && Find(" AS ", loc.list))
+ loc.list = REReplace(loc.list, variables.wheels.class.RESQLAs, "", "all");
+ }
+ </cfscript>
+ <cfreturn loc.list />
+</cffunction>
+
+<cffunction name="$addWhereClause" returntype="array" access="public" output="false">
+ <cfargument name="sql" type="array" required="true">
+ <cfargument name="where" type="string" required="true">
+ <cfargument name="include" type="string" required="true">
+ <cfargument name="includeSoftDeletes" type="boolean" required="true">
+ <cfscript>
+ var loc = {};
+ loc.whereClause = $whereClause(where=arguments.where, include=arguments.include, includeSoftDeletes=arguments.includeSoftDeletes);
+ loc.iEnd = ArrayLen(loc.whereClause);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ ArrayAppend(arguments.sql, loc.whereClause[loc.i]);
+ </cfscript>
+ <cfreturn arguments.sql>
+</cffunction>
+
+<cffunction name="$whereClause" returntype="array" access="public" output="false">
+ <cfargument name="where" type="string" required="true">
+ <cfargument name="include" type="string" required="false" default="">
+ <cfargument name="includeSoftDeletes" type="boolean" required="false" default="false">
+ <cfscript>
+ var loc = {};
+ loc.returnValue = [];
+ if (Len(arguments.where))
+ {
+ // setup an array containing class info for current class and all the ones that should be included
+ loc.classes = [];
+ if (Len(arguments.include))
+ loc.classes = $expandedAssociations(include=arguments.include);
+ ArrayPrepend(loc.classes, variables.wheels.class);
+ ArrayAppend(loc.returnValue, "WHERE");
+ loc.wherePos = ArrayLen(loc.returnValue) + 1;
+ loc.params = ArrayNew(1);
+ loc.where = ReplaceList(REReplace(arguments.where, variables.wheels.class.RESQLWhere, "\1?\8" , "all"), "AND,OR", "#chr(7)#AND,#chr(7)#OR");
+ for (loc.i=1; loc.i <= ListLen(loc.where, Chr(7)); loc.i++)
+ {
+ loc.param = {};
+ loc.element = Replace(ListGetAt(loc.where, loc.i, Chr(7)), Chr(7), "", "one");
+ if (Find("(", loc.element) && Find(")", loc.element))
+ loc.elementDataPart = SpanExcluding(Reverse(SpanExcluding(Reverse(loc.element), "(")), ")");
+ else if (Find("(", loc.element))
+ loc.elementDataPart = Reverse(SpanExcluding(Reverse(loc.element), "("));
+ else if (Find(")", loc.element))
+ loc.elementDataPart = SpanExcluding(loc.element, ")");
+ else
+ loc.elementDataPart = loc.element;
+ loc.elementDataPart = Trim(ReplaceList(loc.elementDataPart, "AND,OR", ""));
+ loc.temp = REFind("^([a-zA-Z0-9-_\.]*) ?#variables.wheels.class.RESQLOperators#", loc.elementDataPart, 1, true);
+ if (ArrayLen(loc.temp.len) gt 1)
+ {
+ loc.where = Replace(loc.where, loc.element, Replace(loc.element, loc.elementDataPart, "?", "one"));
+ loc.param.property = Mid(loc.elementDataPart, loc.temp.pos[2], loc.temp.len[2]);
+ loc.jEnd = ArrayLen(loc.classes);
+ for (loc.j=1; loc.j <= loc.jEnd; loc.j++)
+ {
+ // defaults for cfqueryparam, will be overridden and set appropriately when a column mapping is found below
+ loc.param.type = "CF_SQL_CHAR";
+ loc.param.dataType = "char";
+ loc.param.scale = 0;
+ loc.param.list = false;
+
+ loc.classData = loc.classes[loc.j];
+ if (loc.param.property Does Not Contain "." || ListFirst(loc.param.property, ".") == loc.classData.tableName)
+ {
+ if (ListFindNoCase(loc.classData.propertyList, ListLast(loc.param.property, ".")))
+ {
+ loc.param.type = loc.classData.properties[ListLast(loc.param.property, ".")].type;
+ loc.param.dataType = loc.classData.properties[ListLast(loc.param.property, ".")].dataType;
+ loc.param.scale = loc.classData.properties[ListLast(loc.param.property, ".")].scale;
+ loc.param.column = loc.classData.tableName & "." & loc.classData.properties[ListLast(loc.param.property, ".")].column;
+ break;
+ }
+ else if (ListFindNoCase(loc.classData.calculatedPropertyList, ListLast(loc.param.property, ".")))
+ {
+ loc.param.column = loc.classData.calculatedProperties[ListLast(loc.param.property, ".")].sql;
+ break;
+ }
+ }
+ }
+ if (application.wheels.showErrorInformation && !StructKeyExists(loc.param, "column"))
+ $throw(type="Wheels.ColumnNotFound", message="Wheels looked for the column mapped to the `#loc.param.property#` property but couldn't find it in the database table.", extendedInfo="Verify the `where` argument and/or your property to column mappings done with the `property` method inside the model's `init` method to make sure everything is correct.");
+ loc.temp = REFind("^[a-zA-Z0-9-_\.]* ?#variables.wheels.class.RESQLOperators#", loc.elementDataPart, 1, true);
+ loc.param.operator = Trim(Mid(loc.elementDataPart, loc.temp.pos[2], loc.temp.len[2]));
+ if (Right(loc.param.operator, 2) == "IN")
+ loc.param.list = true;
+ ArrayAppend(loc.params, loc.param);
+ }
+ }
+ loc.where = ReplaceList(loc.where, "#Chr(7)#AND,#Chr(7)#OR", "AND,OR");
+
+ // add to sql array
+ loc.where = " #loc.where# ";
+ loc.iEnd = ListLen(loc.where, "?");
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.item = ListGetAt(loc.where, loc.i, "?");
+ if (Len(Trim(loc.item)))
+ ArrayAppend(loc.returnValue, loc.item);
+ if (loc.i < ListLen(loc.where, "?"))
+ {
+ loc.column = loc.params[loc.i].column;
+ ArrayAppend(loc.returnValue, "#loc.column# #loc.params[loc.i].operator#");
+ loc.param = {type=loc.params[loc.i].type, dataType=loc.params[loc.i].dataType, scale=loc.params[loc.i].scale, list=loc.params[loc.i].list};
+ ArrayAppend(loc.returnValue, loc.param);
+ }
+ }
+ }
+
+ // add softdelete sql
+ if (!arguments.includeSoftDeletes)
+ {
+ loc.addToWhere = "";
+ if ($softDeletion())
+ loc.addToWhere = ListAppend(loc.addToWhere, tableName() & "." & this.$softDeleteColumn() & " IS NULL");
+ loc.addToWhere = Replace(loc.addToWhere, ",", " AND ", "all");
+ if (Len(loc.addToWhere))
+ {
+ if (Len(arguments.where))
+ {
+ ArrayInsertAt(loc.returnValue, loc.wherePos, " (");
+ ArrayAppend(loc.returnValue, ") AND (");
+ ArrayAppend(loc.returnValue, loc.addToWhere);
+ ArrayAppend(loc.returnValue, ")");
+ }
+ else
+ {
+ ArrayAppend(loc.returnValue, "WHERE ");
+ ArrayAppend(loc.returnValue, loc.addToWhere);
+ }
+ }
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$addWhereClauseParameters" returntype="array" access="public" output="false">
+ <cfargument name="sql" type="array" required="true">
+ <cfargument name="where" type="string" required="true">
+ <cfscript>
+ var loc = {};
+ if (Len(arguments.where))
+ {
+ loc.start = 1;
+ loc.originalValues = [];
+ while (!StructKeyExists(loc, "temp") || ArrayLen(loc.temp.len) gt 1)
+ {
+ loc.temp = REFind(variables.wheels.class.RESQLWhere, arguments.where, loc.start, true);
+ if (ArrayLen(loc.temp.len) gt 1)
+ {
+ loc.start = loc.temp.pos[4] + loc.temp.len[4];
+ ArrayAppend(loc.originalValues, ReplaceList(Chr(7) & Mid(arguments.where, loc.temp.pos[4], loc.temp.len[4]) & Chr(7), "#Chr(7)#(,)#Chr(7)#,#Chr(7)#','#Chr(7)#,#Chr(7)#"",""#Chr(7)#,#Chr(7)#", ",,,,,,"));
+ }
+ }
+
+ loc.pos = ArrayLen(loc.originalValues);
+ loc.iEnd = ArrayLen(arguments.sql);
+ for (loc.i=loc.iEnd; loc.i gt 0; loc.i--)
+ {
+ if (IsStruct(arguments.sql[loc.i]) && loc.pos gt 0)
+ {
+ arguments.sql[loc.i].value = loc.originalValues[loc.pos];
+ if (loc.originalValues[loc.pos] == "")
+ arguments.sql[loc.i].null = true;
+ loc.pos--;
+ }
+ }
+ }
+ </cfscript>
+ <cfreturn arguments.sql>
+</cffunction>
+
+<cffunction name="$expandProperties" returntype="string" access="public" output="false">
+ <cfargument name="list" type="string" required="true">
+ <cfargument name="classes" type="array" required="true">
+ <cfscript>
+ var loc = {};
+ loc.matches = REMatch("[A-Za-z1-9]+\.\*", arguments.list);
+ loc.iEnd = ArrayLen(loc.matches);
+ for (loc.i = 1; loc.i lte loc.iEnd; loc.i++)
+ {
+ loc.match = loc.matches[loc.i];
+ loc.fields = "";
+ loc.tableName = ListGetAt(loc.match, 1, ".");
+ loc.jEnd = ArrayLen(arguments.classes);
+ for (loc.j = 1; loc.j lte loc.jEnd; loc.j++)
+ {
+ loc.class = arguments.classes[loc.j];
+ if (loc.class.tableName == loc.tableName)
+ {
+ for (loc.item in loc.class.properties)
+ loc.fields = ListAppend(loc.fields, "#loc.class.tableName#.#loc.item#");
+ break;
+ }
+ }
+
+ if (Len(loc.fields))
+ arguments.list = Replace(arguments.list, loc.match, loc.fields, "all");
+ else if (application.wheels.showErrorInformation)
+ $throw(type="Wheels.ModelNotFound", message="Wheels looked for the model mapped to table name `#loc.tableName#` but couldn't find it.", extendedInfo="Verify the `select` argument and/or your model association mappings are correct.");
+ }
+ </cfscript>
+ <cfreturn arguments.list />
+</cffunction>
+
+<cffunction name="$expandedAssociations" returntype="array" access="public" output="false">
+ <cfargument name="include" type="string" required="true">
+ <cfargument name="includeSoftDeletes" type="boolean" default="false">
+ <cfscript>
+ var loc = {};
+ loc.returnValue = [];
+
+ // add the current class name so that the levels list start at the lowest level
+ loc.levels = variables.wheels.class.modelName;
+
+ // count the included associations
+ loc.iEnd = ListLen(Replace(arguments.include, "(", ",", "all"));
+
+ // clean up spaces in list and add a comma at the end to indicate end of string
+ loc.include = Replace(arguments.include, " ", "", "all") & ",";
+
+ loc.pos = 1;
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ // look for the next delimiter sequence in the string and set it (can be single delims or a chain, e.g ',' or ')),'
+ loc.delimFind = ReFind("[(\(|\)|,)]+", loc.include, loc.pos, true);
+ loc.delimSequence = Mid(loc.include, loc.delimFind.pos[1], loc.delimFind.len[1]);
+
+ // set current association name and set new position to start search in the next loop
+ loc.name = Mid(loc.include, loc.pos, loc.delimFind.pos[1]-loc.pos);
+ loc.pos = REFindNoCase("[a-z]", loc.include, loc.delimFind.pos[1]);
+
+ // create a reference to current class in include string and get its association info
+ loc.class = model(ListLast(loc.levels));
+ loc.classAssociations = loc.class.$classData().associations;
+
+ // throw an error if the association was not found
+ if (application.wheels.showErrorInformation && !StructKeyExists(loc.classAssociations, loc.name))
+ $throw(type="Wheels.AssociationNotFound", message="An association named `#loc.name#` could not be found on the `#ListLast(loc.levels)#` model.", extendedInfo="Setup an association in the `init` method of the `models/#capitalize(ListLast(loc.levels))#.cfc` file and name it `#loc.name#`. You can use the `belongsTo`, `hasOne` or `hasMany` method to set it up.");
+
+ // create a reference to the associated class
+ loc.associatedClass = model(loc.classAssociations[loc.name].modelName);
+
+ if (!Len(loc.classAssociations[loc.name].foreignKey))
+ {
+ if (loc.classAssociations[loc.name].type == "belongsTo")
+ {
+ loc.classAssociations[loc.name].foreignKey = loc.associatedClass.$classData().modelName & Replace(loc.associatedClass.$classData().keys, ",", ",#loc.associatedClass.$classData().modelName#", "all");
+ }
+ else
+ {
+ loc.classAssociations[loc.name].foreignKey = loc.class.$classData().modelName & Replace(loc.class.$classData().keys, ",", ",#loc.class.$classData().modelName#", "all");
+ }
+ }
+
+ if (!Len(loc.classAssociations[loc.name].joinKey))
+ {
+ if (loc.classAssociations[loc.name].type == "belongsTo")
+ {
+ loc.classAssociations[loc.name].joinKey = loc.associatedClass.$classData().keys;
+ }
+ else
+ {
+ loc.classAssociations[loc.name].joinKey = loc.class.$classData().keys;
+ }
+ }
+
+ loc.classAssociations[loc.name].tableName = loc.associatedClass.$classData().tableName;
+ loc.classAssociations[loc.name].columnList = loc.associatedClass.$classData().columnList;
+ loc.classAssociations[loc.name].properties = loc.associatedClass.$classData().properties;
+ loc.classAssociations[loc.name].propertyList = loc.associatedClass.$classData().propertyList;
+ loc.classAssociations[loc.name].calculatedProperties = loc.associatedClass.$classData().calculatedProperties;
+ loc.classAssociations[loc.name].calculatedPropertyList = loc.associatedClass.$classData().calculatedPropertyList;
+
+ // create the join string if it hasn't already been done (no need to lock this code since when multiple requests process it they will end up setting the same value (no intermediate value is ever set on the join variable in the application scoped model object)
+ if (!StructKeyExists(loc.classAssociations[loc.name], "join"))
+ {
+ loc.joinType = ReplaceNoCase(loc.classAssociations[loc.name].joinType, "outer", "left outer", "one");
+ loc.join = UCase(loc.joinType) & " JOIN #loc.classAssociations[loc.name].tableName# ON ";
+ loc.toAppend = "";
+ loc.jEnd = ListLen(loc.classAssociations[loc.name].foreignKey);
+ for (loc.j=1; loc.j <= loc.jEnd; loc.j++)
+ {
+ loc.key1 = ListGetAt(loc.classAssociations[loc.name].foreignKey, loc.j);
+ if (loc.classAssociations[loc.name].type == "belongsTo")
+ {
+ loc.key2 = ListFindNoCase(loc.classAssociations[loc.name].joinKey, loc.key1);
+ if (loc.key2)
+ loc.key2 = ListGetAt(loc.classAssociations[loc.name].joinKey, loc.key2);
+ else
+ loc.key2 = ListGetAt(loc.classAssociations[loc.name].joinKey, loc.j);
+ loc.first = loc.key1;
+ loc.second = loc.key2;
+ }
+ else
+ {
+ loc.key2 = ListFindNoCase(loc.classAssociations[loc.name].joinKey, loc.key1);
+ if (loc.key2)
+ loc.key2 = ListGetAt(loc.classAssociations[loc.name].joinKey, loc.key2);
+ else
+ loc.key2 = ListGetAt(loc.classAssociations[loc.name].joinKey, loc.j);
+ loc.first = loc.key2;
+ loc.second = loc.key1;
+ }
+ loc.toAppend = ListAppend(loc.toAppend, "#loc.class.$classData().tableName#.#loc.class.$classData().properties[loc.first].column# = #loc.classAssociations[loc.name].tableName#.#loc.associatedClass.$classData().properties[loc.second].column#");
+ if (!arguments.includeSoftDeletes and loc.associatedClass.$softDeletion())
+ loc.toAppend = ListAppend(loc.toAppend, "#loc.associatedClass.tableName()#.#loc.associatedClass.$softDeleteColumn()# IS NULL");
+ }
+ loc.classAssociations[loc.name].join = loc.join & Replace(loc.toAppend, ",", " AND ", "all");
+ }
+
+ // loop over each character in the delimiter sequence and move up/down the levels as appropriate
+ for (loc.x=1; loc.x lte Len(loc.delimSequence); loc.x++)
+ {
+ loc.delimChar = Mid(loc.delimSequence, loc.x, 1);
+ if (loc.delimChar == "(")
+ loc.levels = ListAppend(loc.levels, loc.classAssociations[loc.name].modelName);
+ else if (loc.delimChar == ")")
+ loc.levels = ListDeleteAt(loc.levels, ListLen(loc.levels));
+ }
+
+ // add info to the array that we will return
+ ArrayAppend(loc.returnValue, loc.classAssociations[loc.name]);
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$keyWhereString" returntype="string" access="public" output="false">
+ <cfargument name="properties" type="any" required="false" default="#primaryKeys()#">
+ <cfargument name="values" type="any" required="false" default="">
+ <cfargument name="keys" type="any" required="false" default="">
+ <cfscript>
+ var loc = {};
+ loc.returnValue = "";
+ loc.iEnd = ListLen(arguments.properties);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.key = Trim(ListGetAt(arguments.properties, loc.i));
+ if (Len(arguments.values))
+ loc.value = Trim(ListGetAt(arguments.values, loc.i));
+ else if (Len(arguments.keys))
+ loc.value = this[ListGetAt(arguments.keys, loc.i)];
+ else
+ loc.value = "";
+ loc.toAppend = loc.key & "=" & variables.wheels.class.adapter.$quoteValue(str=loc.value, type=validationTypeForProperty(loc.key));
+ loc.returnValue = ListAppend(loc.returnValue, loc.toAppend, " ");
+ if (loc.i < loc.iEnd)
+ loc.returnValue = ListAppend(loc.returnValue, "AND", " ");
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/model/transactions.cfm b/src/main/webapp/wheels/model/transactions.cfm new file mode 100755 index 0000000..75ecaca --- /dev/null +++ b/src/main/webapp/wheels/model/transactions.cfm @@ -0,0 +1,89 @@ +<cffunction name="invokeWithTransaction" returntype="any" access="public" output="false" hint="Runs the specified method within a single database transaction." + examples= + ' + <!--- This is the method to be run inside a transaction ---> + <cffunction name="tranferFunds" returntype="boolean" output="false"> + <cfargument name="personFrom"> + <cfargument name="personTo"> + <cfargument name="amount"> + <cfif arguments.personFrom.withdraw(arguments.amount) and arguments.personTo.deposit(arguments.amount)> + <cfreturn true> + <cfelse> + <cfreturn false> + </cfif> + </cffunction> + + <cfset david = model("Person").findOneByName("David")> + <cfset mary = model("Person").findOneByName("Mary")> + <cfset invokeWithTransaction(method="transferFunds", personFrom=david, personTo=mary, amount=100)> + ' + categories="model-class" chapters="transactions" functions="new,create,save,update,updateByKey,updateOne,updateAll,delete,deleteByKey,deleteOne,deleteAll"> + <cfargument name="method" type="string" required="true" hint="Model method to run."> + <cfargument name="transaction" type="string" default="commit" hint="See documentation for @save."> + <cfargument name="isolation" type="string" default="read_committed" hint="Isolation level to be passed through to the `cftransaction` tag. See your CFML engine's documentation for more details about `cftransaction`'s `isolation` attribute."> + + <cfset var loc = {} /> + + <cfset loc.methodArgs = $setProperties(properties=StructNew(), argumentCollection=arguments, filterList="method,transaction,isolation", setOnModel=false, $useFilterLists=false)> + <cfset loc.connectionArgs = this.$hashedConnectionArgs()> + <cfset loc.closeTransaction = true> + + <cfif not StructKeyExists(variables, arguments.method)> + <cfset $throw(type="Wheels", message="Model method not found!", extendedInfo="The method `#arguments.method#` does not exist in this model.")> + </cfif> + + <!--- create the marker for an open transaction if it doesn't already exist ---> + <cfif not StructKeyExists(request.wheels.transactions, loc.connectionArgs)> + <cfset request.wheels.transactions[loc.connectionArgs] = false> + </cfif> + + <!--- if a transaction is already marked as open, change the mode to 'alreadyopen', otherwise open one ---> + <cfif request.wheels.transactions[loc.connectionArgs]> + <cfset arguments.transaction = "alreadyopen"> + <cfset loc.closeTransaction = false> + <cfelse> + <cfset request.wheels.transactions[loc.connectionArgs] = true> + </cfif> + + <!--- run the method ---> + <cfswitch expression="#arguments.transaction#"> + <cfcase value="commit,rollback"> + <cftransaction action="begin" isolation="#arguments.isolation#"> + <cftry> + <cfset loc.returnValue = $invoke(method=arguments.method, componentReference=this, invokeArgs=loc.methodArgs)> + <cfif IsBoolean(loc.returnValue) and loc.returnValue> + <cftransaction action="#arguments.transaction#" /> + <cfelse> + <cftransaction action="rollback" /> + </cfif> + <cfcatch type="any"> + <cftransaction action="rollback" /> + <cfset request.wheels.transactions[loc.connectionArgs] = false> + <cfrethrow /> + </cfcatch> + </cftry> + </cftransaction> + </cfcase> + <cfcase value="none,alreadyopen"> + <cfset loc.returnValue = $invoke(method=arguments.method, componentReference=this, invokeArgs=loc.methodArgs)> + </cfcase> + <cfdefaultcase> + <cfset $throw(type="Wheels", message="Invalid transaction type", extendedInfo="The transaction type of `#arguments.transaction#` is invalid. Please use `commit`, `rollback` or `none`.")> + </cfdefaultcase> + </cfswitch> + + <cfif loc.closeTransaction> + <cfset request.wheels.transactions[loc.connectionArgs] = false> + </cfif> + + <!--- check the return type ---> + <cfif not IsBoolean(loc.returnValue)> + <cfset $throw(type="Wheels", message="Invalid return type", extendedInfo="Methods invoked using `invokeWithTransaction` must return a boolean value.")> + </cfif> + + <cfreturn loc.returnValue /> +</cffunction> + +<cffunction name="$hashedConnectionArgs" returntype="string" access="public" output="false"> + <cfreturn Hash(variables.wheels.class.connection.datasource & variables.wheels.class.connection.username & variables.wheels.class.connection.password)> +</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/model/validations.cfm b/src/main/webapp/wheels/model/validations.cfm new file mode 100755 index 0000000..da7e00f --- /dev/null +++ b/src/main/webapp/wheels/model/validations.cfm @@ -0,0 +1,645 @@ +<!--- PUBLIC MODEL INITIALIZATION METHODS ---> + +<!--- high level validation helpers ---> + +<cffunction name="validatesConfirmationOf" returntype="void" access="public" output="false" hint="Validates that the value of the specified property also has an identical confirmation value. (This is common when having a user type in their email address a second time to confirm, confirming a password by typing it a second time, etc.) The confirmation value only exists temporarily and never gets saved to the database. By convention, the confirmation property has to be named the same as the property with ""Confirmation"" appended at the end. Using the password example, to confirm our `password` property, we would create a property called `passwordConfirmation`." + examples= + ' + <!--- Make sure that the user has to confirm their password correctly the first time they register (usually done by typing it again in a second form field) ---> + <cfset validatesConfirmationOf(property="password", when="onCreate", message="Your password and its confirmation do not match. Please try again.")> + ' + categories="model-initialization,validations" chapters="object-validation" functions="validatesExclusionOf,validatesFormatOf,validatesInclusionOf,validatesLengthOf,validatesNumericalityOf,validatesPresenceOf,validatesUniquenessOf"> + <cfargument name="properties" type="string" required="false" default="" hint="Name of property or list of property names to validate against (can also be called with the `property` argument)."> + <cfargument name="message" type="string" required="false" hint="Supply a custom error message here to override the built-in one."> + <cfargument name="when" type="string" required="false" default="onSave" hint="Pass in `onCreate` or `onUpdate` to limit when this validation occurs (by default validation will occur on both create and update, i.e. `onSave`)."> + <cfargument name="condition" type="string" required="false" default="" hint="String expression to be evaluated that decides if validation will be run (if the expression returns `true` validation will run)."> + <cfargument name="unless" type="string" required="false" default="" hint="String expression to be evaluated that decides if validation will be run (if the expression returns `false` validation will run)."> + <cfif StructKeyExists(arguments, "if")> + <cfset arguments.condition = arguments.if> + <cfset StructDelete(arguments, "if")> + </cfif> + <cfset $args(name="validatesConfirmationOf", args=arguments)> + <cfset $registerValidation(methods="$validatesConfirmationOf", argumentCollection=arguments)> +</cffunction> + +<cffunction name="validatesExclusionOf" returntype="void" access="public" output="false" hint="Validates that the value of the specified property does not exist in the supplied list." + examples= + ' + <!--- Do not allow "PHP" or "Fortran" to be saved to the database as a cool language ---> + <cfset validatesExclusionOf(property="coolLanguage", list="php,fortran", message="Haha, you can not be serious. Try again, please.")> + ' + categories="model-initialization,validations" chapters="object-validation" functions="validatesConfirmationOf,validatesExclusionOf,validatesFormatOf,validatesInclusionOf,validatesLengthOf,validatesNumericalityOf,validatesPresenceOf,validatesUniquenessOf"> + <cfargument name="properties" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="list" type="string" required="true" hint="Single value or list of values that should not be allowed."> + <cfargument name="message" type="string" required="false" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="when" type="string" required="false" default="onSave" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="allowBlank" type="boolean" required="false" hint="If set to `true`, validation will be skipped if the property value is an empty string or doesn't exist at all. This is useful if you only want to run this validation after it passes the @validatesPresenceOf test, thus avoiding duplicate error messages if it doesn't."> + <cfargument name="condition" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="unless" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfif StructKeyExists(arguments, "if")> + <cfset arguments.condition = arguments.if> + <cfset StructDelete(arguments, "if")> + </cfif> + <cfscript> + $args(name="validatesExclusionOf", args=arguments); + arguments.list = $listClean(arguments.list); + $registerValidation(methods="$validatesExclusionOf", argumentCollection=arguments); + </cfscript> +</cffunction> + +<cffunction name="validatesFormatOf" returntype="void" access="public" output="false" hint="Validates that the value of the specified property is formatted correctly by matching it against a regular expression using the `regEx` argument and/or against a built-in CFML validation type using the `type` argument (`creditcard`, `date`, `email`, etc.)." + examples= + ' + <!--- Make sure that the user has entered a correct credit card ---> + <cfset validatesFormatOf(property="cc", type="creditcard")> + + <!--- Make sure that the user has entered an email address ending with the `.se` domain when the `ipCheck()` method returns `true`, and it''s not Sunday. Also supply a custom error message that overrides the Wheels default one ---> + <cfset validatesFormatOf(property="email", regEx="^.*@.*\.se$", condition="ipCheck()", unless="DayOfWeek() IS 1", message="Sorry, you must have a Swedish email address to use this website.")> + ' + categories="model-initialization,validations" chapters="object-validation" functions="validatesConfirmationOf,validatesExclusionOf,validatesInclusionOf,validatesLengthOf,validatesNumericalityOf,validatesPresenceOf,validatesUniquenessOf"> + <cfargument name="properties" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="regEx" type="string" required="false" default="" hint="Regular expression to verify against."> + <cfargument name="type" type="string" required="false" default="" hint="One of the following types to verify against: `creditcard`, `date`, `email`, `eurodate`, `guid`, `social_security_number`, `ssn`, `telephone`, `time`, `URL`, `USdate`, `UUID`, `variableName`, `zipcode` (will be passed through to your CFML engine's `IsValid()` function)."> + <cfargument name="message" type="string" required="false" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="when" type="string" required="false" default="onSave" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="allowBlank" type="boolean" required="false" hint="See documentation for @validatesExclusionOf."> + <cfargument name="condition" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="unless" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfif StructKeyExists(arguments, "if")> + <cfset arguments.condition = arguments.if> + <cfset StructDelete(arguments, "if")> + </cfif> + <cfscript> + $args(name="validatesFormatOf", args=arguments); + if (application.wheels.showErrorInformation) + { + if (Len(arguments.type) && !ListFindNoCase("creditcard,date,email,eurodate,guid,social_security_number,ssn,telephone,time,URL,USdate,UUID,variableName,zipcode,boolean", arguments.type)) + $throw(type="Wheels.IncorrectArguments", message="The `#arguments.type#` type is not supported.", extendedInfo="Use one of the supported types: `creditcard`, `date`, `email`, `eurodate`, `guid`, `social_security_number`, `ssn`, `telephone`, `time`, `URL`, `USdate`, `UUID`, `variableName`, `zipcode`, `boolean`"); + } + $registerValidation(methods="$validatesFormatOf", argumentCollection=arguments); + </cfscript> +</cffunction> + +<cffunction name="validatesInclusionOf" returntype="void" access="public" output="false" hint="Validates that the value of the specified property exists in the supplied list." + examples= + ' + <!--- Make sure that the user selects either "Wheels" or "Rails" as their framework ---> + <cfset validatesInclusionOf(property="frameworkOfChoice", list="wheels,rails", message="Please try again, and this time, select a decent framework!")> + ' + categories="model-initialization,validations" chapters="object-validation" functions="validatesConfirmationOf,validatesExclusionOf,validatesFormatOf,validatesLengthOf,validatesNumericalityOf,validatesPresenceOf,validatesUniquenessOf"> + <cfargument name="properties" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="list" type="string" required="true" hint="List of allowed values."> + <cfargument name="message" type="string" required="false" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="when" type="string" required="false" default="onSave" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="allowBlank" type="boolean" required="false" hint="See documentation for @validatesExclusionOf."> + <cfargument name="condition" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="unless" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfif StructKeyExists(arguments, "if")> + <cfset arguments.condition = arguments.if> + <cfset StructDelete(arguments, "if")> + </cfif> + <cfscript> + $args(name="validatesInclusionOf", args=arguments); + arguments.list = $listClean(arguments.list); + $registerValidation(methods="$validatesInclusionOf", argumentCollection=arguments); + </cfscript> +</cffunction> + +<cffunction name="validatesLengthOf" returntype="void" access="public" output="false" hint="Validates that the value of the specified property matches the length requirements supplied. Use the `exactly`, `maximum`, `minimum` and `within` arguments to specify the length requirements." + examples= + ' + <!--- Make sure that the `firstname` and `lastName` properties are not more than 50 characters and use square brackets to dynamically insert the property name when the error message is displayed to the user. (The `firstName` property will be displayed as "first name".) ---> + <cfset validatesLengthOf(properties="firstName,lastName", maximum=50, message="Please shorten your [property] please. 50 characters is the maximum length allowed.")> + + <!--- Make sure that the `password` property is between 4 and 15 characters ---> + <cfset validatesLengthOf(property="password", within="4,20", message="The password length must be between 4 and 20 characters.")> + ' + categories="model-initialization,validations" chapters="object-validation" functions="validatesConfirmationOf,validatesExclusionOf,validatesFormatOf,validatesInclusionOf,validatesNumericalityOf,validatesPresenceOf,validatesUniquenessOf"> + <cfargument name="properties" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="message" type="string" required="false" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="when" type="string" required="false" default="onSave" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="allowBlank" type="boolean" required="false" hint="See documentation for @validatesExclusionOf."> + <cfargument name="exactly" type="numeric" required="false" hint="The exact length that the property value must be."> + <cfargument name="maximum" type="numeric" required="false" hint="The maximum length that the property value can be."> + <cfargument name="minimum" type="numeric" required="false" hint="The minimum length that the property value can be."> + <cfargument name="within" type="string" required="false" hint="A list of two values (minimum and maximum) that the length of the property value must fall within."> + <cfargument name="condition" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="unless" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfif StructKeyExists(arguments, "if")> + <cfset arguments.condition = arguments.if> + <cfset StructDelete(arguments, "if")> + </cfif> + <cfscript> + $args(name="validatesLengthOf", args=arguments); + if (Len(arguments.within)) + arguments.within = $listClean(list=arguments.within, returnAs="array"); + $registerValidation(methods="$validatesLengthOf", argumentCollection=arguments); + </cfscript> +</cffunction> + +<cffunction name="validatesNumericalityOf" returntype="void" access="public" output="false" hint="Validates that the value of the specified property is numeric." + examples= + ' + <!--- Make sure that the score is a number with no decimals but only when a score is supplied. (Tetting `allowBlank` to `true` means that objects are allowed to be saved without scores, typically resulting in `NULL` values being inserted in the database table) ---> + <cfset validatesNumericalityOf(property="score", onlyInteger=true, allowBlank=true, message="Please enter a correct score.")> + ' + categories="model-initialization,validations" chapters="object-validation" functions="validatesConfirmationOf,validatesExclusionOf,validatesFormatOf,validatesInclusionOf,validatesLengthOf,validatesPresenceOf,validatesUniquenessOf"> + <cfargument name="properties" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="message" type="string" required="false" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="when" type="string" required="false" default="onSave" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="allowBlank" type="boolean" required="false" hint="See documentation for @validatesExclusionOf."> + <cfargument name="onlyInteger" type="boolean" required="false" hint="Specifies whether the property value must be an integer."> + <cfargument name="condition" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="unless" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="odd" type="boolean" required="false" hint="Specifies whether or not the value must be an odd number."> + <cfargument name="even" type="boolean" required="false" hint="Specifies whether or not the value must be an even number."> + <cfargument name="greaterThan" type="numeric" required="false" hint="Specifies whether or not the value must be greater than the supplied value."> + <cfargument name="greaterThanOrEqualTo" type="numeric" required="false" hint="Specifies whether or not the value must be greater than or equal the supplied value."> + <cfargument name="equalTo" type="numeric" required="false" hint="Specifies whether or not the value must be equal to the supplied value."> + <cfargument name="lessThan" type="numeric" required="false" hint="Specifies whether or not the value must be less than the supplied value."> + <cfargument name="lessThanOrEqualTo" type="numeric" required="false" hint="Specifies whether or not the value must be less than or equal the supplied value."> + <cfif StructKeyExists(arguments, "if")> + <cfset arguments.condition = arguments.if> + <cfset StructDelete(arguments, "if")> + </cfif> + <cfset $args(name="validatesNumericalityOf", args=arguments)> + <cfset $registerValidation(methods="$validatesNumericalityOf", argumentCollection=arguments)> +</cffunction> + +<cffunction name="validatesPresenceOf" returntype="void" access="public" output="false" hint="Validates that the specified property exists and that its value is not blank." + examples= + ' + <!--- Make sure that the user data can not be saved to the database without the `emailAddress` property. (It must exist and not be an empty string) ---> + <cfset validatesPresenceOf("emailAddress")> + ' + categories="model-initialization,validations" chapters="object-validation" functions="validatesConfirmationOf,validatesExclusionOf,validatesFormatOf,validatesInclusionOf,validatesLengthOf,validatesNumericalityOf,validatesUniquenessOf"> + <cfargument name="properties" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="message" type="string" required="false" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="when" type="string" required="false" default="onSave" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="condition" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="unless" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfif StructKeyExists(arguments, "if")> + <cfset arguments.condition = arguments.if> + <cfset StructDelete(arguments, "if")> + </cfif> + <cfset $args(name="validatesPresenceOf", args=arguments)> + <cfset $registerValidation(methods="$validatesPresenceOf", argumentCollection=arguments)> +</cffunction> + +<cffunction name="validatesUniquenessOf" returntype="void" access="public" output="false" hint="Validates that the value of the specified property is unique in the database table. Useful for ensuring that two users can't sign up to a website with identical screen names for example. When a new record is created, a check is made to make sure that no record already exists in the database with the given value for the specified property. When the record is updated, the same check is made but disregarding the record itself." + examples= + ' + <!--- Make sure that two users with the same screen name won''t ever exist in the database (although to be 100% safe, you should consider using database locking as well) ---> + <cfset validatesUniquenessOf(property="username", message="Sorry, that username is already taken.")> + + <!--- Same as above but allow identical user names as long as they belong to a different account ---> + <cfset validatesUniquenessOf(property="username", scope="accountId")> + ' + categories="model-initialization,validations" chapters="object-validation" functions="validatesConfirmationOf,validatesExclusionOf,validatesFormatOf,validatesInclusionOf,validatesLengthOf,validatesNumericalityOf,validatesPresenceOf"> + <cfargument name="properties" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="message" type="string" required="false" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="when" type="string" required="false" default="onSave" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="allowBlank" type="boolean" required="false" hint="See documentation for @validatesExclusionOf."> + <cfargument name="scope" type="string" required="false" default="" hint="One or more properties by which to limit the scope of the uniqueness constraint."> + <cfargument name="condition" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="unless" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="includeSoftDeletes" type="boolean" required="false" default="true" hint="whether to take softDeletes into account when performing uniqueness check"> + <cfif StructKeyExists(arguments, "if")> + <cfset arguments.condition = arguments.if> + <cfset StructDelete(arguments, "if")> + </cfif> + <cfscript> + $args(name="validatesUniquenessOf", args=arguments); + arguments.scope = $listClean(arguments.scope); + $registerValidation(methods="$validatesUniquenessOf", argumentCollection=arguments); + </cfscript> +</cffunction> + +<!--- low level validation ---> + +<cffunction name="validate" returntype="void" access="public" output="false" hint="Registers method(s) that should be called to validate objects before they are saved." + examples= + ' + <cffunction name="init"> + <!--- Register the `checkPhoneNumber` method below to be called to validate objects before they are saved ---> + <cfset validate("checkPhoneNumber")> + </cffunction> + + <cffunction name="checkPhoneNumber"> + <!--- Make sure area code is `614` ---> + <cfreturn Left(this.phoneNumber, 3) is "614"> + </cffunction> + ' + categories="model-initialization,validations" chapters="object-validation" functions="validateOnCreate,validateOnUpdate"> + <cfargument name="methods" type="string" required="false" default="" hint="Method name or list of method names to call. (Can also be called with the `method` argument.)"> + <cfargument name="condition" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="unless" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="when" type="string" required="false" default="onSave" hint="See documentation for @validatesConfirmationOf."> + <cfif StructKeyExists(arguments, "if")> + <cfset arguments.condition = arguments.if> + <cfset StructDelete(arguments, "if")> + </cfif> + <cfset $registerValidation(argumentCollection=arguments)> +</cffunction> + +<cffunction name="validateOnCreate" returntype="void" access="public" output="false" hint="Registers method(s) that should be called to validate new objects before they are inserted." + examples= + ' + <cffunction name="init"> + <!--- Register the `checkPhoneNumber` method below to be called to validate new objects before they are inserted ---> + <cfset validateOnCreate("checkPhoneNumber")> + </cffunction> + + <cffunction name="checkPhoneNumber"> + <!--- Make sure area code is `614` ---> + <cfreturn Left(this.phoneNumber, 3) is "614"> + </cffunction> + ' + categories="model-initialization,validations" chapters="object-validation" functions="validate,validateOnUpdate"> + <cfargument name="methods" type="string" required="false" default="" hint="See documentation for @validate."> + <cfargument name="condition" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="unless" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfif StructKeyExists(arguments, "if")> + <cfset arguments.condition = arguments.if> + <cfset StructDelete(arguments, "if")> + </cfif> + <cfset $registerValidation(when="onCreate", argumentCollection=arguments)> +</cffunction> + +<cffunction name="validateOnUpdate" returntype="void" access="public" output="false" hint="Registers method(s) that should be called to validate existing objects before they are updated." + examples= + ' + <cffunction name="init"> + <!--- Register the `check` method below to be called to validate existing objects before they are updated ---> + <cfset validateOnUpdate("checkPhoneNumber")> + </cffunction> + + <cffunction name="checkPhoneNumber"> + <!--- Make sure area code is `614` ---> + <cfreturn Left(this.phoneNumber, 3) is "614"> + </cffunction> + ' + categories="model-initialization,validations" chapters="object-validation" functions="validate,validateOnCreate"> + <cfargument name="methods" type="string" required="false" default="" hint="See documentation for @validate."> + <cfargument name="condition" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfargument name="unless" type="string" required="false" default="" hint="See documentation for @validatesConfirmationOf."> + <cfif StructKeyExists(arguments, "if")> + <cfset arguments.condition = arguments.if> + <cfset StructDelete(arguments, "if")> + </cfif> + <cfset $registerValidation(when="onUpdate", argumentCollection=arguments)> +</cffunction> + +<!--- PUBLIC MODEL OBJECT METHODS ---> + +<cffunction name="valid" returntype="boolean" access="public" output="false" hint="Runs the validation on the object and returns `true` if it passes it. Wheels will run the validation process automatically whenever an object is saved to the database, but sometimes it's useful to be able to run this method to see if the object is valid without saving it to the database." + examples= + ' + <!--- Check if a user is valid before proceeding with execution ---> + <cfset user = model("user").new(params.user)> + <cfif user.valid()> + <!--- Do something here ---> + </cfif> + ' + categories="model-object,errors" chapters="object-validation" functions=""> + <cfargument name="callbacks" type="boolean" required="false" default="true" hint="See documentation for @save."> + <cfscript> + var loc = {}; + loc.returnValue = false; + clearErrors(); + if ($callback("beforeValidation", arguments.callbacks)) + { + if (isNew()) + { + if ($callback("beforeValidationOnCreate", arguments.callbacks) && $validate("onSave,onCreate") && $callback("afterValidation", arguments.callbacks) && $callback("afterValidationOnCreate", arguments.callbacks)) + loc.returnValue = true; + } + else + { + if ($callback("beforeValidationOnUpdate", arguments.callbacks) && $validate("onSave,onUpdate") && $callback("afterValidation", arguments.callbacks) && $callback("afterValidationOnUpdate", arguments.callbacks)) + loc.returnValue = true; + } + } + </cfscript> + <cfreturn loc.returnValue> +</cffunction> + +<cffunction name="automaticValidations" returntype="void" access="public" output="false" hint="Whether or not to enable default validations for this model." + examples=' + <!--- In `models/User.cfc`, disable automatic validations. In this case, automatic validations are probably enabled globally, but we want to disable just for this model ---> + <cffunction name="init"> + <cfset automaticValidations(false)> + </cffunction> + ' + categories="model-initialization,validations" chapters="object-validation" functions=""> + <cfargument name="value" type="boolean" required="true"> + <cfset variables.wheels.class.automaticValidations = arguments.value> +</cffunction> + +<!--- PRIVATE MODEL INITIALIZATION METHODS ---> + +<cffunction name="$registerValidation" returntype="void" access="public" output="false" hint="Called from the high level validation helpers to register the validation in the class struct of the model."> + <cfargument name="when" type="string" required="true"> + <cfscript> + var loc = {}; + + // combine `method`/`methods` and `property`/`properties` into one variables for easier processing below + $combineArguments(args=arguments, combine="methods,method", required=true); + // `validate`, `validateOnCreate` and `validateOnUpdate` do not take the properties argument + // however other validations do. + $combineArguments(args=arguments, combine="properties,property", required=false); + + if (application.wheels.showErrorInformation) + { + if (StructKeyExists(arguments, "properties")) + { + if (!Len(arguments.properties)) + $throw(type="Wheels.IncorrectArguments", message="The `property` or `properties` argument is required but was not passed in.", extendedInfo="Please pass in the names of the properties you want to validate. Use either the `property` argument (for a single property) or the `properties` argument (for a list of properties) to do this."); + } + } + + // loop through all methods and properties and add info for each to the `class` struct + loc.iEnd = ListLen(arguments.methods); + for (loc.i=1; loc.i <= loc.iEnd; loc.i++) + { + // only loop once by default (will be used on the lower level validation helpers that do not take arguments: `validate`, `validateOnCreate` and `validateOnUpdate`) + loc.jEnd = 1; + if (StructKeyExists(arguments, "properties")) + loc.jEnd = ListLen(arguments.properties); + + for (loc.j=1; loc.j <= loc.jEnd; loc.j++) + { + loc.validation = {}; + loc.validation.method = Trim(ListGetAt(arguments.methods, loc.i)); + loc.validation.args = Duplicate(arguments); + if (StructKeyExists(arguments, "properties")) + { + loc.validation.args.property = Trim(ListGetAt(loc.validation.args.properties, loc.j)); + //loc.validation.args.message = $validationErrorMessage(message=loc.validation.args.message, property=loc.validation.args.property); + } + StructDelete(loc.validation.args, "when"); + StructDelete(loc.validation.args, "methods"); + StructDelete(loc.validation.args, "properties"); + ArrayAppend(variables.wheels.class.validations[arguments.when], loc.validation); + } + } + </cfscript> +</cffunction> + +<cffunction name="$validationErrorMessage" returntype="string" access="public" output="false" hint="Creates nicer looking error text by humanizing the property name and capitalizing it when appropriate."> + <cfargument name="property" type="string" required="true"> + <cfargument name="message" type="string" required="true"> + <cfscript> + var loc = {}; + loc.returnValue = arguments.message; + // loop through each argument and replace bracketed occurance with + // argument value + for (loc.i in arguments) + { + loc.i = LCase(loc.i); + loc.value = arguments[loc.i]; + if (StructKeyExists(loc, "value") AND IsSimpleValue(loc.value) AND len(loc.value)) + { + if (loc.i eq "property") + { + loc.value = this.$label(loc.value); + } + loc.returnValue = Replace(loc.returnValue, "[[#loc.i#]]", "{{#chr(7)#}}", "all"); + loc.returnValue = Replace(loc.returnValue, "[#loc.i#]", LCase(loc.value), "all"); + loc.returnValue = Replace(loc.returnValue, "{{#chr(7)#}}", "[#loc.i#]", "all"); + } + } + // capitalize the first word in the property name if it comes first in the sentence + if (Left(arguments.message, 10) == "[property]") + loc.returnValue = capitalize(loc.returnValue); + </cfscript> + <cfreturn loc.returnValue> +</cffunction> + +<!--- PRIVATE MODEL OBJECT METHODS ---> + +<cffunction name="$validate" returntype="boolean" access="public" output="false" hint="Runs all the validation methods setup on the object and adds errors as it finds them. Returns `true` if no errors were added, `false` otherwise."> + <cfargument name="type" type="string" required="true"> + <cfargument name="execute" type="boolean" required="false" default="true"> + <cfscript> + var loc = {}; + + // don't run any validations when we want to skip + if (!arguments.execute) + return true; + + // loop over the passed in types + for (loc.typeIndex=1; loc.typeIndex <= ListLen(arguments.type); loc.typeIndex++) + { + loc.type = ListGetAt(arguments.type, loc.typeIndex); + // loop through all validations for passed in type (`onSave`, `onCreate` etc) that has been set on this model object + loc.iEnd = ArrayLen(variables.wheels.class.validations[loc.type]); + for (loc.i=1; loc.i <= loc.iEnd; loc.i++) + { + loc.thisValidation = variables.wheels.class.validations[loc.type][loc.i]; + if ($evaluateCondition(argumentCollection=loc.thisValidation.args)) + { + if (loc.thisValidation.method == "$validatesPresenceOf") + { + // if the property does not exist or if it's blank we add an error on the object (for all other validation types we call corresponding methods below instead) + if (!StructKeyExists(this, loc.thisValidation.args.property) or (IsSimpleValue(this[loc.thisValidation.args.property]) and !Len(Trim(this[loc.thisValidation.args.property]))) or (IsStruct(this[loc.thisValidation.args.property]) and !StructCount(this[loc.thisValidation.args.property]))) + addError(property=loc.thisValidation.args.property, message=$validationErrorMessage(loc.thisValidation.args.property, loc.thisValidation.args.message)); + } + else + { + // if the validation set does not allow blank values we can set an error right away, otherwise we call a method to run the actual check + if (StructKeyExists(loc.thisValidation.args, "property") && StructKeyExists(loc.thisValidation.args, "allowBlank") && !loc.thisValidation.args.allowBlank && (!StructKeyExists(this, loc.thisValidation.args.property) || !Len(this[loc.thisValidation.args.property]))) + addError(property=loc.thisValidation.args.property, message=$validationErrorMessage(loc.thisValidation.args.property, loc.thisValidation.args.message)); + else if (!StructKeyExists(loc.thisValidation.args, "property") || (StructKeyExists(this, loc.thisValidation.args.property) && Len(this[loc.thisValidation.args.property]))) + $invoke(method=loc.thisValidation.method, invokeArgs=loc.thisValidation.args); + } + } + } + } + // now that we have run all the validation checks we can return `true` if no errors exist on the object, `false` otherwise + loc.returnValue = !hasErrors(); + </cfscript> + <cfreturn loc.returnValue> +</cffunction> + +<cffunction name="$evaluateCondition" returntype="boolean" access="public" output="false" hint="Evaluates the condition to determine if the validation should be executed."> + <cfscript> + var returnValue = false; + // proceed with validation when `condition` has been supplied and it evaluates to `true` or when `unless` has been supplied and it evaluates to `false` + // if both `condition` and `unless` have been supplied though, they both need to be evaluated correctly (`true`/`false` that is) for validation to proceed + if ( + (!StructKeyExists(arguments, "condition") || !Len(arguments.condition) || Evaluate(arguments.condition)) + && (!StructKeyExists(arguments, "unless") || !Len(arguments.unless) || !Evaluate(arguments.unless)) + ){ + returnValue = true; + } + </cfscript> + <cfreturn returnValue> +</cffunction> + +<cffunction name="$validatesConfirmationOf" returntype="void" access="public" output="false" hint="Adds an error if the object property fail to pass the validation setup in the @validatesConfirmationOf method."> + <cfscript> + var virtualConfirmProperty = arguments.property & "Confirmation"; + if (StructKeyExists(this, virtualConfirmProperty) && this[arguments.property] != this[virtualConfirmProperty]) + { + addError(property=virtualConfirmProperty, message=$validationErrorMessage(argumentCollection=arguments)); + } + </cfscript> +</cffunction> + +<cffunction name="$validatesExclusionOf" returntype="void" access="public" output="false" hint="Adds an error if the object property fail to pass the validation setup in the @validatesExclusionOf method."> + <cfscript> + if (ListFindNoCase(arguments.list, this[arguments.property])) + { + addError(property=arguments.property, message=$validationErrorMessage(argumentCollection=arguments)); + } + </cfscript> +</cffunction> + +<cffunction name="$validatesFormatOf" returntype="void" access="public" output="false" hint="Adds an error if the object property fail to pass the validation setup in the @validatesFormatOf method."> + <cfscript> + if ( + (Len(arguments.regEx) && !REFindNoCase(arguments.regEx, this[arguments.property])) + || (Len(arguments.type) && !IsValid(arguments.type, this[arguments.property])) + ){ + addError(property=arguments.property, message=$validationErrorMessage(argumentCollection=arguments)); + } + </cfscript> +</cffunction> + +<cffunction name="$validatesInclusionOf" returntype="void" access="public" output="false" hint="Adds an error if the object property fail to pass the validation setup in the @validatesInclusionOf method."> + <cfscript> + if (!ListFindNoCase(arguments.list, this[arguments.property])) + { + addError(property=arguments.property, message=$validationErrorMessage(argumentCollection=arguments)); + } + </cfscript> +</cffunction> + +<cffunction name="$validatesPresenceOf" returntype="void" access="public" output="false" hint="Adds an error if the object property fail to pass the validation setup in the @validatesPresenceOf method."> + <cfargument name="property" type="string" required="true"> + <cfargument name="message" type="string" required="true"> + <cfargument name="properties" type="struct" required="false" default="#this.properties()#"> + <cfscript> + // if the property does not exist or if it's blank we add an error on the object + if ( + !StructKeyExists(arguments.properties, arguments.property) + || (IsSimpleValue(arguments.properties[arguments.property]) && !Len(Trim(arguments.properties[arguments.property]))) + || (IsStruct(arguments.properties[arguments.property]) && !StructCount(arguments.properties[arguments.property])) + ){ + addError(property=arguments.property, message=$validationErrorMessage(argumentCollection=arguments)); + } + </cfscript> +</cffunction> + +<cffunction name="$validatesLengthOf" returntype="void" access="public" output="false" hint="Adds an error if the object property fail to pass the validation setup in the @validatesLengthOf method."> + <cfargument name="property" type="string" required="true"> + <cfargument name="message" type="string" required="true"> + <cfargument name="exactly" type="numeric" required="true"> + <cfargument name="maximum" type="numeric" required="true"> + <cfargument name="minimum" type="numeric" required="true"> + <cfargument name="within" type="any" required="true"> + <cfargument name="properties" type="struct" required="false" default="#this.properties()#"> + <cfscript> + var _lenValue = Len(arguments.properties[arguments.property]); + + // for within, just create minimum/maximum values + if (IsArray(arguments.within) && ArrayLen(arguments.within) eq 2) + { + arguments.minimum = arguments.within[1]; + arguments.maximum = arguments.within[2]; + } + + if( + (arguments.maximum && _lenValue gt arguments.maximum) + || (arguments.minimum && _lenValue lt arguments.minimum) + || (arguments.exactly && _lenValue != arguments.exactly) + ){ + addError(property=arguments.property, message=$validationErrorMessage(argumentCollection=arguments)); + } + </cfscript> +</cffunction> + +<cffunction name="$validatesNumericalityOf" returntype="void" access="public" output="false" hint="Adds an error if the object property fail to pass the validation setup in the @validatesNumericalityOf method."> + <cfscript> + if ( + !IsNumeric(this[arguments.property]) + || (arguments.onlyInteger && Round(this[arguments.property]) != this[arguments.property]) + || (IsNumeric(arguments.greaterThan) && this[arguments.property] lte arguments.greaterThan) + || (IsNumeric(arguments.greaterThanOrEqualTo) && this[arguments.property] lt arguments.greaterThanOrEqualTo) + || (IsNumeric(arguments.equalTo) && this[arguments.property] neq arguments.equalTo) + || (IsNumeric(arguments.lessThan) && this[arguments.property] gte arguments.lessThan) + || (IsNumeric(arguments.lessThanOrEqualTo) && this[arguments.property] gt arguments.lessThanOrEqualTo) + || (IsBoolean(arguments.odd) && arguments.odd && !BitAnd(this[arguments.property], 1)) + || (IsBoolean(arguments.even) && arguments.even && BitAnd(this[arguments.property], 1)) + ){ + addError(property=arguments.property, message=$validationErrorMessage(argumentCollection=arguments)); + } + </cfscript> +</cffunction> + +<cffunction name="$validatesUniquenessOf" returntype="void" access="public" output="false" hint="Adds an error if the object property fail to pass the validation setup in the @validatesUniquenessOf method."> + <cfargument name="property" type="string" required="true"> + <cfargument name="message" type="string" required="true"> + <cfargument name="scope" type="string" required="false" default=""> + <cfargument name="properties" type="struct" required="false" default="#this.properties()#"> + <cfargument name="includeSoftDeletes" type="boolean" required="false" default="true"> + <cfscript> + var loc = {}; + loc.where = []; + + // create the WHERE clause to be used in the query that checks if an identical value already exists + // wrap value in single quotes unless it's numeric + // example: "userName='Joe'" + ArrayAppend(loc.where, "#arguments.property#=#variables.wheels.class.adapter.$quoteValue(str=this[arguments.property], type=validationTypeForProperty(arguments.property))#"); + + // add scopes to the WHERE clause if passed in, this means that checks for other properties are done in the WHERE clause as well + // example: "userName='Joe'" becomes "userName='Joe' AND account=1" if scope is "account" for example + arguments.scope = $listClean(arguments.scope); + if (Len(arguments.scope)) + { + loc.iEnd = ListLen(arguments.scope); + for (loc.i=1; loc.i <= loc.iEnd; loc.i++) + { + loc.property = ListGetAt(arguments.scope, loc.i); + ArrayAppend(loc.where, "#loc.property#=#variables.wheels.class.adapter.$quoteValue(str=this[loc.property], type=validationTypeForProperty(loc.property))#"); + } + } + + // try to fetch existing object from the database + loc.existingObject = findOne(select=primaryKey(),where=ArrayToList(loc.where, " AND "), reload=true, includeSoftDeletes=arguments.includeSoftDeletes); + + // we add an error if an object was found in the database and the current object is either not saved yet or not the same as the one in the database + if (IsObject(loc.existingObject) && (isNew() || loc.existingObject.key() != key($persisted=true))) + { + addError(property=arguments.property, message=$validationErrorMessage(argumentCollection=arguments)); + } + </cfscript> +</cffunction> + +<cffunction name="$validationExists" returntype="boolean" access="public" output="false" hint="Checks to see if a validation has been created for a property."> + <cfargument name="property" type="string" required="true"> + <cfargument name="validation" type="string" required="true"> + <cfscript> + var loc = {}; + loc.returnValue = false; + + for (loc.when in variables.wheels.class.validations) + { + if (StructKeyExists(variables.wheels.class.validations, loc.when)) + { + loc.eventArray = variables.wheels.class.validations[loc.when]; + loc.iEnd = ArrayLen(loc.eventArray); + for (loc.i = 1; loc.i lte loc.iEnd; loc.i++) + { + if (StructKeyExists(loc.eventArray[loc.i].args, "property") && loc.eventArray[loc.i].args.property == arguments.property and loc.eventArray[loc.i].method == "$#arguments.validation#") + { + loc.returnValue = true; + break; + } + } + } + } + </cfscript> + <cfreturn loc.returnValue /> +</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/plugins/injection.cfm b/src/main/webapp/wheels/plugins/injection.cfm new file mode 100755 index 0000000..ac8da09 --- /dev/null +++ b/src/main/webapp/wheels/plugins/injection.cfm @@ -0,0 +1,33 @@ +<cfscript>
+ // we use $wheels here since these variables get placed in the variables scope of all objects and we need
+ // to make sure they don't clash with other wheels variables or any variables the develoepr may set
+ if (!StructIsEmpty(application.wheels.mixins))
+ {
+ $wheels.metaData = GetMetaData(this);
+ if (StructKeyExists($wheels.metaData, "displayName"))
+ $wheels.className = $wheels.metaData.displayName;
+ else
+ $wheels.className = Reverse(SpanExcluding(Reverse($wheels.metaData.name), "."));
+ if (StructKeyExists(application.wheels.mixins, $wheels.className))
+ {
+ if (!StructKeyExists(variables, "core"))
+ {
+ if (application.wheels.serverName eq "Railo")
+ {
+ // this is to work around the railo bug
+ // https://jira.jboss.org/browse/RAILO-936
+ variables.core = duplicate(variables);
+ }
+ else
+ {
+ variables.core = {};
+ StructAppend(variables.core, variables);
+ StructDelete(variables.core, "$wheels", false);
+ }
+ }
+ StructAppend(variables, application.wheels.mixins[$wheels.className], true);
+ }
+ // get rid of any extra data created in the variables scope
+ StructDelete(variables, "$wheels", false);
+ }
+</cfscript>
\ No newline at end of file diff --git a/src/main/webapp/wheels/public/congratulations.cfm b/src/main/webapp/wheels/public/congratulations.cfm new file mode 100755 index 0000000..657c132 --- /dev/null +++ b/src/main/webapp/wheels/public/congratulations.cfm @@ -0,0 +1,34 @@ +<h1>Congratulations!</h1>
+
+<p><strong>You have successfully installed version <cfoutput>#application.wheels.version#</cfoutput> of Wheels.</strong><br />
+Welcome to the wonderful world of Wheels. We hope you will enjoy it!</p>
+
+<h2>Now What?</h2>
+<p>Now that you have a working installation of Wheels, you may be wondering what to do next. Here are some suggestions...</p>
+
+<ul>
+ <li><a href="http://cfwheels.org/docs/1-1/chapter/hello-world">View and code along with our "Hello World" tutorial.</a></li>
+ <li><a href="http://cfwheels.org/docs/1-1">Have a look at the rest of our documentation.</a></li>
+ <li><a href="http://groups.google.com/group/cfwheels">Say "Hello!" to everyone in the Google Group.</a></li>
+ <li>Build the next killer website on the World Wide Web...</li>
+</ul>
+
+<p><strong>Good Luck!</strong></p>
+
+<h2>How to Make this Message Go Away</h2>
+<p>Want to have another page load when your application loads this <abbr title="Uniform Resource Locator">URL</abbr>? You can configure your own <em>home route</em>.</p>
+<ol>
+ <li>
+ <p>Open the routes configuration file at <tt>config/routes.cfm</tt>.</p>
+ </li>
+ <li>
+ <p>You will see a line similar to this for a route named <tt>home</tt>:</p>
+ <pre><cfset addRoute(name="home", pattern="", controller="wheels", action="wheels")></pre>
+ </li>
+ <li>
+ <p>Simply change the <tt>controller</tt> and <tt>action</tt> arguments to a controller and action of your choosing.</p>
+ </li>
+ <li>
+ <p>Reload your Wheels application.</p>
+ </li>
+</ol>
\ No newline at end of file diff --git a/src/main/webapp/wheels/public/layout.cfm b/src/main/webapp/wheels/public/layout.cfm new file mode 100755 index 0000000..5b26373 --- /dev/null +++ b/src/main/webapp/wheels/public/layout.cfm @@ -0,0 +1,3 @@ +<cfinclude template="../styles/header.cfm">
+<cfoutput>#includeContent()#</cfoutput>
+<cfinclude template="../styles/footer.cfm">
\ No newline at end of file diff --git a/src/main/webapp/wheels/public/plugins.cfm b/src/main/webapp/wheels/public/plugins.cfm new file mode 100755 index 0000000..3eeb4f2 --- /dev/null +++ b/src/main/webapp/wheels/public/plugins.cfm @@ -0,0 +1,2 @@ +<cfset variables[params.name] = application.wheels.plugins[params.name]>
+<cfinclude template="../../plugins/#LCase(params.name)#/index.cfm">
\ No newline at end of file diff --git a/src/main/webapp/wheels/public/tests.cfm b/src/main/webapp/wheels/public/tests.cfm new file mode 100755 index 0000000..f1d1fab --- /dev/null +++ b/src/main/webapp/wheels/public/tests.cfm @@ -0,0 +1,71 @@ +<cfsetting requesttimeout="10000" showdebugoutput="false">
+<cfparam name="params.type" default="core">
+<cfif params.type NEQ "app">
+ <cfset testresults = $createObjectFromRoot(path=application.wheels.wheelsComponentPath, fileName="Test", method="$WheelsRunner", options=params)>
+<cfelse>
+ <cfset testresults = $createObjectFromRoot(path="tests", fileName="Test", method="$WheelsRunner", options=params)>
+</cfif>
+<h1>Test Results</h1>
+<cfif !isStruct(testresults)>
+ <cfoutput><p style="margin-bottom:50px;">Sorry, no tests were found.</p></cfoutput>
+<cfelse>
+<cfset linkParams = "?controller=wheels&action=wheels&view=tests&type=#params.type#">
+<style>
+#content a {text-decoration:none; font-weight:bold;}
+.failed {color:red;font-weight:bold}
+.success {color:green;font-weight:bold}
+table.testing {border:0;margin-bottom:15px;}
+table.testing td, table.testing th {padding:2px 20px 2px 2px;text-align:left;vertical-align:top;font-size:14px;}
+table.testing td.n {text-align:right;}
+table.testing tr.errRow {background-color:#FFDFDF;}
+</style>
+<cfoutput>
+<p><a href="#linkParams#">Run All Tests</a> | <a href="#linkParams#&reload=true">Reload Test Data</a></p>
+<table class="testing" id="stats">
+ <tr><th class="<cfif testresults.ok>success<cfelse>failed</cfif>">Status</th><td class="numeric<cfif testresults.ok> success<cfelse> failed</cfif>"><cfif testresults.ok>Passed<cfelse>Failed</cfif></td></tr>
+ <tr><th>Path</th><td class="n">#listChangeDelims(testresults.path, "/", ".")#</td></tr>
+ <tr><th>Duration</th><td class="n">#timeFormat(testresults.end - testresults.begin, "HH:mm:ss")#</td></tr>
+ <tr><th>Packages</th><td class="n">#testresults.numCases#</td></tr>
+ <tr><th>Tests</th><td class="n">#testresults.numTests#</td></tr>
+ <tr><th<cfif testresults.numFailures neq 0> class="failed"</cfif>>Failures</th><td class="n<cfif testresults.numFailures neq 0> failed</cfif>">#testresults.numFailures#</td></tr>
+ <tr><th<cfif testresults.numErrors neq 0> class="failed"</cfif>>Errors</th><td class="n<cfif testresults.numErrors neq 0> failed</cfif>">#testresults.numErrors#</td></tr>
+</table>
+<table class="testing" id="summary">
+<tr><th>Package</th></th><th>Tests</th><th>Failures</th><th>Errors</th></tr>
+<cfloop from="1" to="#arrayLen(testresults.summary)#" index="testIndex">
+ <cfset summary = testresults.summary[testIndex]>
+ <tr class="<cfif summary.numFailures + summary.numErrors gt 0>errRow<cfelse>sRow</cfif>">
+ <td>
+ <cfset a = ListToArray(summary.packageName, ".")>
+ <cfset b = createObject("java", "java.util.ArrayList").Init(a)>
+ <cfset c = arraylen(a)>
+ <cfloop from="1" to="#c#" index="i"><a href="#linkParams#&package=#ArrayToList(b.subList(JavaCast('int', 0), JavaCast('int', i)), '.')#">#a[i]#</a><cfif i neq c>.</cfif></cfloop>
+ </td>
+ <td class="n">#summary.numTests#</td>
+ <td class="n<cfif summary.numFailures neq 0> failed</cfif>">#summary.numFailures#</td>
+ <td class="n<cfif summary.numErrors neq 0> failed</cfif>">#summary.numErrors#</td>
+ </tr>
+</cfloop>
+</table>
+<table class="testing" id="results">
+<tr><th>Package</th><th>Test Name</th><th>Time</th><th>Status</th></tr>
+<cfloop from="1" to="#arrayLen(testresults.results)#" index="testIndex">
+ <cfset result = testresults.results[testIndex]>
+ <tr class="<cfif result.status neq 'Success'>errRow<cfelse>sRow</cfif>">
+ <td><a href="#linkParams#&package=#result.packageName#">#result.cleanTestCase#</a></td>
+ <td><a href="#linkParams#&package=#result.packageName#&test=#result.testName#">#result.cleanTestName#</a></td>
+ <td class="n">#result.time#</td>
+ <td class="<cfif result.status eq 'Success'>success<cfelse>failed</cfif>">#result.status#</td>
+ </tr>
+ <cfif result.status neq "Success">
+ <tr class="errRow"><td colspan="4" class="failed">#replace(result.message, chr(10), "<br/>", "ALL")#</td></tr>
+ </cfif>
+ <cfif StructKeyExists(request, "TESTING_FRAMEWORK_DEBUGGING") && StructKeyExists(request["TESTING_FRAMEWORK_DEBUGGING"], result.testName)>
+ <cfloop array="#request['TESTING_FRAMEWORK_DEBUGGING'][result.testName]#" index="i">
+ <tr class="<cfif result.status neq 'Success'>errRow<cfelse>sRow</cfif>"><td colspan="4">#i#</tr>
+ </cfloop>
+ </cfif>
+</cfloop>
+</table>
+</cfoutput>
+</cfif>
\ No newline at end of file diff --git a/src/main/webapp/wheels/public/wheels.cfm b/src/main/webapp/wheels/public/wheels.cfm new file mode 100755 index 0000000..37967cc --- /dev/null +++ b/src/main/webapp/wheels/public/wheels.cfm @@ -0,0 +1,9 @@ +<cfif StructKeyExists(params, "view")>
+ <cfif application.wheels.environment IS "production">
+ <cfabort>
+ <cfelse>
+ <cfinclude template="#params.view#.cfm">
+ </cfif>
+<cfelse> + <cfinclude template="congratulations.cfm">
+</cfif>
\ No newline at end of file diff --git a/src/main/webapp/wheels/styles/footer.cfm b/src/main/webapp/wheels/styles/footer.cfm new file mode 100755 index 0000000..fa3fe73 --- /dev/null +++ b/src/main/webapp/wheels/styles/footer.cfm @@ -0,0 +1,4 @@ + </div>
+ </div>
+</body>
+</html>
\ No newline at end of file diff --git a/src/main/webapp/wheels/styles/header.cfm b/src/main/webapp/wheels/styles/header.cfm new file mode 100755 index 0000000..3f7b30f --- /dev/null +++ b/src/main/webapp/wheels/styles/header.cfm @@ -0,0 +1,162 @@ +<!DOCTYPE html> +<html> +<head> + <title>ColdFusion on Wheels</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <meta name="robots" content="noindex,nofollow" /> + <style> + body + { + padding: 0; + margin: 0; + background: #ddd; + } + + #wrapper + { + margin: auto; + text-align: left; + width: 960px; + background: #fff; + border-left: 3px solid #999; + border-right: 3px solid #999; + border-bottom: 3px solid #999; + } + + #content + { + background: #fff; + padding: 15px; + font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; + line-height: 1.5em; + font-size: 14px; + color: #333; + } + + #content h1 + { + font-size: 24px; + font-weight: bold; + color: #B00701; + margin: 10px 0 5px 0; + } + + #content h2 + { + font-size: 16px; + font-weight: bold; + color: #B00701; + } + + #content p + { + margin-bottom: 15px; + } + + #content p.small + { + font-size: 11px; + } + + #content a + { + color: #B00701; + text-decoration: underline; + padding: 0 1px; + } + + #content a:hover + { + color: #fff; + background: #B00701; + text-decoration: none; + } + + #content ul, #content ol + { + margin: 10px 0 15px 25px; + padding: 0; + } + + #content ul li, #content ol li + { + padding-bottom: 0; + + } + + #content img + { + border: none; + } + + #content pre + { + border: 1px solid #a6a2a2; + overflow-x: auto; + width: 95%; + padding: 15px; + margin-bottom: 15px; + background: #ffffe0; + } + + #content code + { + color: #000; + font-family: Courier; + } + + #content tt + { + font-family: Courier; + font-size: 12px; + color: #666; + background: #f7f7f7; + padding: 1px 3px; + border: 1px solid #ededed; + } + + #logo + { + float: right; + font-weight: bold; + margin: 0 0 20px 20px; + text-transform: uppercase; + width: 75px; + } + + #logo a + { + color: #fff; + display: block; + text-decoration: none; + } + + #logo #cf a:first-letter, #logo #wheels a:first-letter + { + font-size: 125%; + } + + #logo #cf a + { + background: #900; + font-size: 35px; + line-height: 35px; + padding: 18px 0 16px 0; + text-align: center; + } + + #logo #wheels a + { + background: #333; + padding: 3px 0; + text-align: center; + } + </style> +</head> +<body> + <div id="wrapper"> + <div id="content"> + <div id="logo"> + <div id="cf"><a href="http://cfwheels.org/">CF</a></div> + <div id="wheels"><a href="http://cfwheels.org/">Wheels</a></div> + </div>
\ No newline at end of file diff --git a/src/main/webapp/wheels/test.cfm b/src/main/webapp/wheels/test.cfm new file mode 100755 index 0000000..8368783 --- /dev/null +++ b/src/main/webapp/wheels/test.cfm @@ -0,0 +1,612 @@ +<!---
+ Base component for rapidly writing/running test cases.
+
+ Terminology
+ -----------
+ - A Test Package is a collection of Test Cases that tests the functionality
+ of an application/service/whatever.
+
+ - A Test Case is a collection of Tests to apply to a particular CF component,
+ tag or include file.
+
+ - A Test is a sequence of calls to the code being tested and Assertions about
+ the results we get from the code.
+
+ - An Assertion is a statement we make about the results we get that should
+ evaluate to true if the tested code is working properly.
+
+ How are these things represented in test code using this file?
+ --------------------------------------------------------------
+ - A Test Package is a directory that can be referred to by a CF mapping, and
+ ideally outside the web root for security.
+
+ - A Test Case is a CF component in that directory that extends this component.
+
+ - A Test is a method in one of these components. The method name should start with
+ the word "test", it should require no arguments and return void. Any setup or
+ clearup code common to all test functions can be added to optional setup() and
+ teardown() methods, which again take no arguments and return void.
+
+ Tests in each Test Case are run in alphabetical order. If you want your tests
+ to run in a particular order you could name them test01xxx, test02yyy, etc.
+
+ - An Assertion is a call to the assert() method (inherited from this component) inside
+ a test method. assert() takes a string argument, an expression (see ColdFusion
+ evaluate() documentation) that evaluates to true or false. If false, a "failure"
+ is recorded for the test case and the test case fails. assert() tries to include
+ the value of any variables it finds in the expression.
+
+ If there are specific variable values you would like included in the failure message,
+ pass them as additional string arguments to assert(). Multiple variables can be
+ listed in a single space-delimited string if this is convenient.
+
+ For more complicated assertions you may call the fail() method directly, which takes
+ a single message string as an argument.
+
+ - If an uncaught exception is thrown an "error" is recorded for the Test Case and the
+ Test Case fails.
+
+ Running tests
+ -------------
+ Assuming this file is under a com.rocketboots.rocketunit cf mapping, you have some test cases
+ under a com.myco.myapp.sometestpackage cf mapping, and a test case SomeTestCase.cfc in that
+ mapping...
+
+ To run a test package:
+
+ <cfset test = createObject("component", "com.rocketboots.rocketunit.Test")>
+ <cfset test.runTestPackage("test.com.myco.myapp.sometestpackage")>
+
+
+ To run a specific test case:
+
+ <cfset test = createObject("component", "test.com.myco.myapp.sometestpackage.SomeTestCase")>
+ <cfset test.runTest()>
+
+ To see human readable output after running a test:
+
+ <cfoutput>#test.HTMLFormatTestResults()#</cfoutput>
+
+ The test results are available in the request.test structure. If you would like to
+ use a different key in request (as we do for the rocketunit self-tests) for the results
+ you can pass the key name as a second argument to the run method.
+
+ You can call run() multiple times and the test results will be combined.
+
+ If you wish to reset the test results before calling run() again, call resetTestResults().
+
+
+ Copyright 2007 RocketBoots Pty Limited - http://www.rocketboots.com.au
+
+ This file is part of RocketUnit.
+
+ RocketUnit 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 2 of the License, or
+ (at your option) any later version.
+
+ RocketUnit 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 RocketUnit; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ @version $Id: Test.cfc 167 2007-04-12 07:50:15Z robin $
+--->
+
+<!--- include main wheels functions in tests by default --->
+<cfinclude template="global/functions.cfm">
+
+<!--- variables that are used by the testing framework itself --->
+<cfset TESTING_FRAMEWORK_VARS = {}>
+<cfset TESTING_FRAMEWORK_VARS.WHEELS_TESTS_BASE_COMPONENT_PATH = "">
+<cfset TESTING_FRAMEWORK_VARS.ROOT_TEST_PATH = "">
+<cfset TESTING_FRAMEWORK_VARS.RUNNING_TEST = "">
+
+<!--- used to hold debug information for display --->
+<cfif !StructKeyExists(request, "TESTING_FRAMEWORK_DEBUGGING")>
+ <cfset request["TESTING_FRAMEWORK_DEBUGGING"] = {}>
+</cfif>
+
+<!---
+ Called from a test function. If expression evaluates to false,
+ record a failure against the test.
+
+ @param expression String containing CFML expression to evaluate
+ @param 2..n Optional. String(s) containing space-delimited list
+ of variables to evaluate and include in the
+ failure message to help determine cause of failed
+ assertion.
+--->
+<cffunction name="assert" returntype="void" output="false" hint="evaluates an expression">
+ <cfargument type="string" name="expression" required=true>
+
+ <cfset var token = "">
+ <cfset var tokenValue = "">
+ <cfset var message = "assert failed: #expression#">
+ <cfset var newline = chr(10) & chr(13)>
+ <cfset var i = "">
+ <cfset var evaluatedTokens = "">
+
+ <cfif not evaluate(expression)>
+
+ <cfloop from="1" to="#arrayLen(arguments)#" index="i">
+
+ <cfset expression = arguments[i]>
+ <cfset evaluatedTokens = structNew()>
+
+ <!---
+ Double pass of expressions with different delimiters so that for expression "a(b) or c[d]",
+ "a(b)", "c[d]", "b" and "d" are evaluated. Do not evaluate any expression more than once.
+ --->
+ <cfloop list="#expression# #reReplace(expression, "[([\])]", " ")#" delimiters=" +=-*/%##" index="token">
+
+ <cfif not structKeyExists(evaluatedTokens, token)>
+
+ <cfset evaluatedTokens[token] = true>
+ <cfset tokenValue = "__INVALID__">
+
+ <cfif not (isNumeric(token) or isBoolean(token))>
+
+ <cftry>
+ <cfset tokenValue = evaluate(token)>
+ <cfcatch type="expression"/>
+ </cftry>
+
+ </cfif>
+
+ <!---
+ Format token value according to type
+ --->
+ <cfif (not isSimpleValue(tokenValue)) or (tokenValue neq "__INVALID__")>
+
+ <cfif isSimpleValue(tokenValue)>
+ <cfif not (isNumeric(tokenValue) or isBoolean(tokenValue))>
+ <cfset tokenValue ="'#tokenValue#'">
+ </cfif>
+ <cfelse>
+ <cfif isArray(tokenValue)>
+ <cfset tokenValue = "array of #arrayLen(tokenValue)# items">
+ <cfelseif isStruct(tokenValue)>
+ <cfset tokenValue = "struct with #structCount(tokenValue)# members">
+ <cfelseif IsCustomFunction(tokenValue)>
+ <cfset tokenValue = "UDF">
+ </cfif>
+ </cfif>
+
+ <cfset message = message & newline & token & " = " & tokenValue>
+
+ </cfif>
+
+ </cfif>
+
+ </cfloop>
+
+ </cfloop>
+
+ <cfset fail(message)>
+
+ </cfif>
+
+</cffunction>
+
+<!---
+ Called from a test function to cause the test to fail.
+
+ @param message Message to record in test results against failure.
+--->
+<cffunction name="fail" returntype="void" hint="will throw an exception resulting in a test failure along with an option message.">
+ <cfargument type="string" name="message" required="false" default="">
+
+ <!---
+ run() interprets exception with this errorcode as a "Failure".
+ All other errorcodes cause are interpreted as an "Error".
+ --->
+ <cfthrow errorcode="__FAIL__" message="#HTMLEditFormat(message)#">
+
+</cffunction>
+
+<cffunction name="debug" returntype="Any" output="false" hint="used to examine an expression. any overloaded arguments get passed to cfdump's attributeCollection">
+ <cfargument name="expression" type="string" required="true" hint="the expression to examine.">
+ <cfargument name="display" type="boolean" required="false" default="true" hint="whether to display the debug call. false returns without outputting anything into the buffer. good when you want to leave the debug command in the test for later purposes, but don't want it to display">
+ <cfset var attributeArgs = {}>
+ <cfset var dump = "">
+
+ <cfif !arguments.display>
+ <cfreturn>
+ </cfif>
+
+ <cfset attributeArgs["var"] = "#evaluate(arguments.expression)#">
+
+ <cfset structdelete(arguments, "expression")>
+ <cfset structdelete(arguments, "display")>
+ <cfset structappend(attributeArgs, arguments, true)>
+
+ <cfsavecontent variable="dump">
+ <cfdump attributeCollection="#attributeArgs#">
+ </cfsavecontent>
+
+ <cfif !StructKeyExists(request["TESTING_FRAMEWORK_DEBUGGING"], TESTING_FRAMEWORK_VARS.RUNNING_TEST)>
+ <cfset request["TESTING_FRAMEWORK_DEBUGGING"][TESTING_FRAMEWORK_VARS.RUNNING_TEST] = []>
+ </cfif>
+ <cfset arrayAppend(request["TESTING_FRAMEWORK_DEBUGGING"][TESTING_FRAMEWORK_VARS.RUNNING_TEST], dump)>
+</cffunction>
+
+<cffunction name="raised" returntype="string" output="false" hint="catches an raised error and returns the error type. great if you want to test that a certain exception will be raised.">
+ <cfargument type="string" name="expression" required="true">
+ <cftry>
+ <cfset evaluate(arguments.expression)>
+ <cfcatch type="any">
+ <cfreturn trim(cfcatch.type)>
+ </cfcatch>
+ </cftry>
+ <cfreturn "">
+</cffunction>
+
+<!---
+ Instanciate all components in specified package and call their $runTest()
+ method.
+
+ @param testPackage Package containing test components
+ @param resultKey Key to store distinct test result sets under in
+ request scope, defaults to "test"
+ @returns true if no failures or errors detected.
+--->
+<cffunction name="$runTestPackage" returntype="boolean" output="true">
+ <cfargument name="testPackage" type="string" required="true">
+ <cfargument name="resultKey" type="string" required="false" default="test">
+
+ <cfset var packageDir = "">
+ <cfset var qPackage = "">
+ <cfset var instance = "">
+ <cfset var result = 0>
+ <cfset var metadata = "">
+
+ <!--
+ Called with a testPackage argument. List package directory contents, instanciate
+ any components we find and call their run() method.
+ --->
+ <cfset packageDir = "/" & replace(testpackage, ".", "/", "ALL")>
+ <cfdirectory action="list" directory="#expandPath(packageDir)#" name="qPackage" filter="*.cfc">
+ <cfloop query="qPackage">
+ <cfset instance = testPackage & "." & listFirst(qPackage.name, ".")>
+ <cfif $isValidTest(instance)>
+ <cfset instance = createObject("component", instance)>
+ <cfset result = result + instance.$runTest(resultKey)>
+ </cfif>
+ </cfloop>
+
+ <cfreturn result eq 0>
+
+</cffunction>
+
+<!---
+ Run all the tests in a component.
+
+ @param resultKey Key to store distinct test result sets under in
+ request scope, defaults to "test"
+ @returns true if no errors
+--->
+<cffunction name="$runTest" returntype="boolean" output="true">
+ <cfargument name="resultKey" type="string" required="false" default="test">
+ <cfargument name="testname" type="string" required="false" default="">
+
+ <cfset var key = "">
+ <cfset var keyList = "">
+ <cfset var time = "">
+ <cfset var testCase = "">
+ <cfset var status = "">
+ <cfset var result = "">
+ <cfset var message = "">
+ <cfset var numTests = 0>
+ <cfset var numTestFailures = 0>
+ <cfset var numTestErrors = 0>
+ <cfset var newline = chr(10) & chr(13)>
+
+ <!---
+ Check for and if necessary set up the structure to store test results
+ --->
+ <cfif !StructKeyExists(request, resultKey)>
+ <cfset $resetTestResults(resultKey)>
+ </cfif>
+
+ <cfset testCase = getMetadata(this).name>
+
+ <!---
+ Iterate through the members of the this scope in alphabetical order,
+ invoking methods starting in "test". Wrap with calls to setup()
+ and teardown() if provided.
+ --->
+ <cfset keyList = listSort(structKeyList(this), "textnocase", "asc")>
+
+ <cfloop list="#keyList#" index="key">
+
+ <!--- keep track of the test name so we can display debug information --->
+ <cfset TESTING_FRAMEWORK_VARS.RUNNING_TEST = key>
+
+ <cfif (left(key, 4) eq "test" and isCustomFunction(this[key])) and (!len(arguments.testname) or (len(arguments.testname) and arguments.testname eq key))>
+
+ <cfset time = getTickCount()>
+
+ <cfif structKeyExists(this, "setup")>
+ <cfset setup()>
+ </cfif>
+
+ <cftry>
+
+ <cfset message = "">
+ <cfinvoke method="#key#">
+ <cfset status = "Success">
+ <cfset request[resultkey].numSuccesses = request[resultkey].numSuccesses + 1>
+
+ <cfcatch type="any">
+
+ <cfset message = cfcatch.message>
+
+ <cfif cfcatch.ErrorCode eq "__FAIL__">
+
+ <!---
+ fail() throws __FAIL__ exception
+ --->
+ <cfset status = "Failure">
+ <cfset request[resultkey].ok = false>
+ <cfset request[resultkey].numFailures = request[resultkey].numFailures + 1>
+ <cfset numTestFailures = numTestFailures + 1>
+
+ <cfelse>
+
+ <!---
+ another exception thrown
+ --->
+ <cfset status = "Error">
+ <cfset message = message & newline & listLast(cfcatch.tagContext[1].template, "/") & " line " & cfcatch.tagContext[1].line & newline & newline & cfcatch.detail>
+ <cfset request[resultkey].ok = false>
+ <cfset request[resultkey].numErrors = request[resultkey].numErrors + 1>
+ <cfset numTestErrors = numTestErrors + 1>
+
+ </cfif>
+
+ </cfcatch>
+ </cftry>
+
+ <cfif structKeyExists(this, "teardown")>
+ <cfset teardown()>
+ </cfif>
+
+ <cfset time = getTickCount() - time>
+
+ <!---
+ Record test results
+ --->
+ <cfset result = structNew()>
+ <cfset result.testCase = testCase>
+ <cfset result.testName = key>
+ <cfset result.time = time>
+ <cfset result.status = status>
+ <cfset result.message = message>
+ <cfset arrayAppend(request[resultkey].results, result)>
+
+ <cfset request[resultkey].numTests = request[resultkey].numTests + 1>
+ <cfset numTests = numTests + 1>
+
+ </cfif>
+
+ </cfloop>
+
+ <cfset result = structNew()>
+ <cfset result.testCase = testCase>
+ <cfset result.numTests = numTests>
+ <cfset result.numFailures = numTestFailures>
+ <cfset result.numErrors = numTestErrors>
+ <cfset arrayAppend(request[resultkey].summary, result)>
+
+ <cfset request[resultkey].numCases = request[resultkey].numCases + 1>
+ <cfset request[resultkey]["end"] = now()>
+
+ <cfreturn numTestErrors eq 0>
+
+</cffunction>
+
+<!---
+ Clear results.
+
+ @param resultKey Key to store distinct test result sets under in
+ request scope, defaults to "test"
+--->
+<cffunction name="$resetTestResults" returntype="void" output="false">
+ <cfargument name="resultKey" type="string" required="false" default="test">
+ <cfscript>
+ request[resultkey] = {};
+ request[resultkey].begin = now();
+ request[resultkey].ok = true;
+ request[resultkey].numCases = 0;
+ request[resultkey].numTests = 0;
+ request[resultkey].numSuccesses = 0;
+ request[resultkey].numFailures = 0;
+ request[resultkey].numErrors = 0;
+ request[resultkey].summary = [];
+ request[resultkey].results = [];
+ </cfscript>
+</cffunction>
+
+<!---
+ Report test results at overall, test case and test level, highlighting
+ failures and errors.
+
+ @param resultKey Key to retrive distinct test result sets from in
+ request scope, defaults to "test"
+ @returns HTML formatted test results
+--->
+<cffunction name="$results" returntype="any" output="false">
+ <cfargument name="resultKey" type="string" required="false" default="test">
+ <cfset var loc = {}>
+ <cfset loc.ret = false>
+ <cfif structkeyexists(request, resultkey)>
+ <cfset request[resultkey].path = TESTING_FRAMEWORK_VARS.WHEELS_TESTS_BASE_COMPONENT_PATH>
+ <cfset loc.a = ArrayLen(request[resultkey].summary)>
+ <cfset loc.b = ArrayLen(request[resultkey].results)>
+ <cfloop from="1" to="#loc.a#" index="loc.i">
+ <cfset request[resultkey].summary[loc.i].cleanTestCase = $cleanTestCase(request[resultkey].summary[loc.i].testCase)>
+ <cfset request[resultkey].summary[loc.i].packageName = $cleanTestPath(request[resultkey].summary[loc.i].testCase)>
+ </cfloop>
+ <cfloop from="1" to="#loc.b#" index="loc.i">
+ <cfset request[resultkey].results[loc.i].cleanTestCase = $cleanTestCase(request[resultkey].results[loc.i].testCase)>
+ <cfset request[resultkey].results[loc.i].cleanTestName = $cleanTestName(request[resultkey].results[loc.i].testName)>
+ <cfset request[resultkey].results[loc.i].packageName = $cleanTestPath(request[resultkey].results[loc.i].testCase)>
+ </cfloop>
+ <cfset loc.ret = request[resultkey]>
+ </cfif>
+ <cfreturn loc.ret>
+</cffunction>
+
+<!--- WheelsRunner --->
+<cffunction name="$WheelsRunner" returntype="any" output="false">
+ <cfargument name="options" type="struct" required="false" default="#structnew()#">
+ <cfset var loc = {}>
+ <cfset var q = "">
+
+ <!--- the key in the request scope that will contain the test results --->
+ <cfset loc.resultKey = "WheelsTests">
+
+ <!--- save the original environment for overloaded --->
+ <cfset loc.savedenv = duplicate(application)>
+
+ <!--- by default we run all packages, however they can specify to run a specific package of tests --->
+ <cfset loc.package = "">
+
+ <!--- not only can we specify the package, but also the test we want to run --->
+ <cfset loc.test = "">
+
+ <!--- default test type --->
+ <cfset loc.type = "core">
+
+ <!--- if they specified a package we should only run that --->
+ <cfif structkeyexists(arguments.options, "package") and len(arguments.options.package)>
+ <cfset loc.package = arguments.options.package>
+ <cfif structkeyexists(arguments.options, "test") and len(arguments.options.test)>
+ <cfset loc.test = arguments.options.test>
+ </cfif>
+ </cfif>
+
+ <!--- overwrite the default test type if passed --->
+ <cfif structkeyexists(arguments.options, "type") and len(arguments.options.type)>
+ <cfset loc.type = arguments.options.type>
+ </cfif>
+
+ <!--- which tests to run --->
+ <cfif loc.type eq "core">
+ <!--- core tests --->
+ <cfset TESTING_FRAMEWORK_VARS.ROOT_TEST_PATH = application.wheels.wheelsComponentPath>
+ <cfelseif loc.type eq "app">
+ <!--- app tests --->
+ <cfset TESTING_FRAMEWORK_VARS.ROOT_TEST_PATH = application.wheels.rootComponentPath>
+ <cfelse>
+ <!--- specific plugin tests --->
+ <cfset TESTING_FRAMEWORK_VARS.ROOT_TEST_PATH = application.wheels.rootComponentPath>
+ <cfset TESTING_FRAMEWORK_VARS.ROOT_TEST_PATH = ListAppend(TESTING_FRAMEWORK_VARS.ROOT_TEST_PATH, "#application.wheels.pluginComponentPath#.#loc.type#", ".")>
+ </cfif>
+
+ <cfset TESTING_FRAMEWORK_VARS.ROOT_TEST_PATH = ListAppend(TESTING_FRAMEWORK_VARS.ROOT_TEST_PATH, "tests", ".")>
+
+ <!--- add the package if specified --->
+ <cfset loc.test_path = listappend("#TESTING_FRAMEWORK_VARS.ROOT_TEST_PATH#", loc.package, ".")>
+
+ <!--- clean up testpath --->
+ <cfset loc.test_path = listchangedelims(loc.test_path, ".", "./\")>
+
+ <!--- convert to regular path --->
+ <cfset loc.relative_root_test_path = "/" & listchangedelims(TESTING_FRAMEWORK_VARS.ROOT_TEST_PATH, "/", ".")>
+ <cfset loc.full_root_test_path = expandpath(loc.relative_root_test_path)>
+ <cfset loc.releative_test_path = "/" & listchangedelims(loc.test_path, "/", ".")>
+ <cfset loc.full_test_path = expandPath(loc.releative_test_path)>
+ <cfset loc.test_filter = "*">
+
+ <cfif not DirectoryExists(loc.full_test_path)>
+ <cfif FileExists(loc.full_test_path & ".cfc")>
+ <cfset loc.test_filter = reverse(listfirst(reverse(loc.test_path), "."))>
+ <cfset loc.test_path = reverse(listrest(reverse(loc.test_path), "."))>
+ <cfset loc.releative_test_path = "/" & listchangedelims(loc.test_path, "/", ".")>
+ <cfset loc.full_test_path = expandPath(loc.releative_test_path)>
+ <cfelse>
+ <!--- swap back the enviroment --->
+ <cfset application = loc.savedenv>
+ <cfthrow
+ type="Wheels.Testing"
+ message="Cannot find test package or single test"
+ detail="In order to run test you must supply a valid test package or single test file to run">
+ </cfif>
+ </cfif>
+
+ <cfdirectory directory="#loc.full_test_path#" action="list" recurse="true" name="q" filter="#loc.test_filter#.cfc" />
+
+ <!--- for test results display --->
+ <cfset TESTING_FRAMEWORK_VARS.WHEELS_TESTS_BASE_COMPONENT_PATH = loc.test_path>
+
+ <!---
+ if env.cfm files exists, call to override enviroment settings so tests can run.
+ when overriding, save the original env so we can put it back later.
+ --->
+ <cfif FileExists(loc.full_root_test_path & "/env.cfm")>
+ <cfinclude template="#loc.relative_root_test_path & '/env.cfm'#">
+ </cfif>
+
+ <!--- populate the test database only on reload --->
+ <cfif structkeyexists(arguments.options, "reload") && arguments.options.reload eq true && FileExists(loc.full_root_test_path & "/populate.cfm")>
+ <cfinclude template="#loc.relative_root_test_path & '/populate.cfm'#">
+ </cfif>
+
+ <!--- run tests --->
+ <cfloop query="q">
+ <cfset loc.testname = listchangedelims(removechars(directory, 1, len(loc.full_test_path)), ".", "\/")>
+ <!--- directories that begin with an underscore are ignored --->
+ <cfif not refindnocase("(^|\.)_", loc.testname)>
+ <cfset loc.testname = listprepend(loc.testname, loc.test_path, ".")>
+ <cfset loc.testname = listappend(loc.testname, listfirst(name, "."), ".")>
+ <!--- ignore invalid tests and test that begin with underscores --->
+ <cfif left(name, 1) neq "_" and $isValidTest(loc.testname)>
+ <cfset loc.instance = createObject("component", loc.testname)>
+ <cfset loc.instance.$runTest(loc.resultKey, loc.test)>
+ </cfif>
+ </cfif>
+ </cfloop>
+
+ <!--- swap back the enviroment --->
+ <cfset structappend(application, loc.savedenv, true)>
+
+ <!--- return the results --->
+ <cfreturn $results(loc.resultKey)>
+
+</cffunction>
+
+<cffunction name="$isValidTest" returntype="boolean" output="false">
+ <cfargument name="component" type="string" required="true" hint="path to the component you want to check as a valid test">
+ <cfargument name="shouldExtend" type="string" required="false" default="Test" hint="if the component should extend a base component to be a valid test">
+ <cfset var loc = {}>
+ <cfif len(arguments.shouldExtend)>
+ <cfset loc.metadata = GetComponentMetaData(arguments.component)>
+ <cfif not structkeyexists(loc.metadata, "extends") or loc.metadata.extends.fullname does not contain arguments.shouldExtend>
+ <cfreturn false>
+ </cfif>
+ </cfif>
+ <cfreturn true>
+</cffunction>
+
+<cffunction name="$cleanTestCase" returntype="string" output="false" hint="removes the base test directory from the test name to make them prettier and more readable">
+ <cfargument name="str" type="string" required="true" hint="test case name to clean up">
+ <cfreturn listchangedelims(replace(arguments.str, TESTING_FRAMEWORK_VARS.WHEELS_TESTS_BASE_COMPONENT_PATH, ""), ".", ".")>
+</cffunction>
+
+<cffunction name="$cleanTestName" returntype="string" output="false" hint="cleans up the test name so they are more readable">
+ <cfargument name="str" type="string" required="true" hint="test name to clean up">
+ <cfreturn trim(rereplacenocase(removechars(arguments.str, 1, 4), "_|-", " ", "all"))>
+</cffunction>
+
+<cffunction name="$cleanTestPath" returntype="string" output="false" hint="cleans up the test name so they are more readable">
+ <cfargument name="str" type="string" required="true" hint="test name to clean up">
+ <cfreturn listchangedelims(replace(arguments.str, TESTING_FRAMEWORK_VARS.ROOT_TEST_PATH, ""), ".", ".")>
+</cffunction>
+
+<cfinclude template="plugins/injection.cfm">
diff --git a/src/main/webapp/wheels/vendor/toXml/toXML.cfc b/src/main/webapp/wheels/vendor/toXml/toXML.cfc new file mode 100755 index 0000000..da0c023 --- /dev/null +++ b/src/main/webapp/wheels/vendor/toXml/toXML.cfc @@ -0,0 +1,168 @@ +<cfcomponent displayname="toXML" hint="Set of utility functions to generate XML" output="false">
+<!---
+ Based on the toXML component by Raymond Camden: http://www.coldfusionjedi.com/index.cfm/2006/7/2/ToXML-CFC--Converting-data-types-to-XML
+
+ toXML function made by Paul Klinkenberg, 25-feb-2009
+ http://www.coldfusiondeveloper.nl/post.cfm/toxml-function-for-coldfusion
+
+ Version 1.1, March 8, 2010
+ Now using <cfsavecontent> while generating the xml output in the functions, since it increases process speed
+ Thanks to Brian Meloche (http://www.brianmeloche.com/blog/) for pointing it out
+
+ Version 1.2, September 1, 2010
+ - Cleaned up variables to reference the arguments scope so CF doesn't have to search the different scopes
+ - Cleaned up methods to only use var once per method call
+ - Created a new method $simpleValueToXml()
+ - Add tests outside of component
+
+--->
+
+ <cffunction name="init" returntype="any" access="public" output="false" hint="I return the toXml Object">
+ <cfreturn this />
+ </cffunction>
+
+ <cffunction name="toXML" returntype="string" access="public" output="no" hint="Recursively converts any kind of data to xml">
+ <cfargument name="data" type="any" required="yes" />
+ <cfargument name="rootelement" type="string" required="false" default="data" />
+ <cfargument name="elementattributes" type="string" required="false" default="" hint="Optional string like 'order=2', which will be added into the starting rootElement tag." />
+ <cfargument name="addXMLHeader" type="boolean" required="no" default="true" hint="Whether or not to add the <?xml?> tag" />
+ <cfset var returnValue = "" />
+ <cfif Len(arguments.elementattributes)>
+ <cfset arguments.elementattributes = " " & Trim(arguments.elementattributes) />
+ </cfif>
+ <cfsavecontent variable="returnValue"><!---
+ ---><cfoutput><!---
+ ---><cfif arguments.addXMLHeader><!---
+ ---><?xml version="1.0" encoding="UTF-8"?><!---
+ ---></cfif><!---
+ ---><cfif IsSimpleValue(arguments.data)><!---
+ --->#$simpleValueToXml(argumentCollection=arguments)#<!---
+ ---><cfelseif IsQuery(arguments.data)><!---
+ --->#$queryToXML(argumentCollection=arguments)#<!---
+ ---><cfelseif IsArray(arguments.data)><!---
+ --->#$arrayToXML(argumentCollection=arguments)#<!---
+ ---><cfelseif IsObject(arguments.data)><!---
+ --->#$objectToXML(argumentCollection=arguments)#<!---
+ ---><cfelseif IsStruct(arguments.data)><!---
+ --->#$structToXML(argumentCollection=arguments)#<!---
+ ---><cfelseif REFindNoCase("^coldfusion\..*Exception$", arguments.data.getClass().getName())><!---
+ --->#$structToXML(argumentCollection=arguments)#<!---
+ ---><cfelse><!---
+ --->#$simpleValueToXml(data="Unknown object of type #arguments.data.getClass().getName()#", rootelement=arguments.rootelement, elementattributes=arguments.elementattributes)#<!---
+ ---></cfif><!---
+ ---></cfoutput><!---
+ ---></cfsavecontent>
+ <cfreturn returnValue />
+ </cffunction>
+
+ <cffunction name="$simpleValueToXml" access="public" output="false" returntype="string">
+ <cfargument name="data" type="string" required="true" />
+ <cfargument name="rootelement" type="string" required="false" default="data" />
+ <cfargument name="elementattributes" type="string" required="false" default="" />
+ <cfset var returnValue = "" />
+ <cfset arguments.data = XmlFormat(arguments.data) />
+ <cfsavecontent variable="returnValue"><!---
+ ---><cfoutput><!---
+ ---><cfif IsNumeric(arguments.data)><!---
+ ---><#arguments.rootelement# type="numeric"#arguments.elementattributes#>#arguments.data#</#arguments.rootelement#><!---
+ ---><cfelseif IsBoolean(arguments.data)><!---
+ ---><#arguments.rootelement# type="boolean"#arguments.elementattributes#><cfif arguments.data>1<cfelse>0</cfif></#arguments.rootelement#><!---
+ ---><cfelseif not Len(arguments.data)><!---
+ ---><#arguments.rootelement# type="string"#arguments.elementattributes#/><!---
+ ---><cfelse><!---
+ ---><#arguments.rootelement# type="string"#arguments.elementattributes#>#arguments.data#</#arguments.rootelement#><!---
+ ---></cfif><!---
+ ---></cfoutput><!---
+ ---></cfsavecontent>
+ <cfreturn returnValue />
+ </cffunction>
+
+ <cffunction name="$arrayToXML" access="public" output="false" returntype="string" hint="Converts an array into XML">
+ <cfargument name="data" type="array" required="true" />
+ <cfargument name="rootelement" type="string" required="false" default="data" />
+ <cfargument name="elementattributes" type="string" required="false" default="" />
+ <cfargument name="itemelement" type="string" required="false" default="item" />
+ <cfset var loc = {} />
+
+ <cfsavecontent variable="loc.returnValue"><!---
+ ---><cfoutput><!---
+ ---><#arguments.rootelement# type="array"#elementattributes#><!---
+ ---><cfloop from="1" to="#ArrayLen(arguments.data)#" index="loc.x"><!---
+ --->#toXML(data=arguments.data[loc.x], rootelement=arguments.itemelement, elementattributes="order=""#loc.x#""", addXMLHeader=false)#<!---
+ ---></cfloop><!---
+ ---></#arguments.rootelement#><!---
+ ---></cfoutput><!---
+ ---></cfsavecontent>
+
+ <cfreturn loc.returnValue />
+ </cffunction>
+
+ <cffunction name="$queryToXML" access="public" output="false" returntype="string" hint="Converts a query to XML">
+ <cfargument name="data" type="query" required="true" />
+ <cfargument name="rootelement" type="string" required="false" default="data" />
+ <cfargument name="elementattributes" type="string" required="false" default="" />
+ <cfargument name="itemelement" type="string" required="false" default="row" />
+ <cfset var loc = {} />
+ <cfset loc.columns = arguments.data.columnList />
+
+ <cfsavecontent variable="loc.returnValue"><!---
+ ---><cfoutput><!---
+ ---><#arguments.rootelement# type="query"#arguments.elementattributes#><!---
+ ---><cfloop query="arguments.data"><!---
+ ---><#arguments.itemelement# order="#arguments.data.currentrow#"><!---
+ ---><cfloop list="#loc.columns#" index="loc.col"><!---
+ --->#toXML(data=arguments.data[loc.col][arguments.data.currentRow], rootElement=loc.col, addXMLHeader=false)#<!---
+ ---></cfloop><!---
+ ---></#arguments.itemelement#><!---
+ ---></cfloop><!---
+ ---></#arguments.rootelement#><!---
+ ---></cfoutput><!---
+ ---></cfsavecontent>
+
+ <cfreturn loc.returnValue />
+ </cffunction>
+
+ <cffunction name="$structToXML" access="public" output="false" returntype="string" hint="Converts a struct into XML.">
+ <cfargument name="data" type="any" required="true" hint="It should be a struct, but can also be an 'exception' type." />
+ <cfargument name="rootelement" type="string" required="false" default="data" />
+ <cfargument name="elementattributes" type="string" required="false" default="" />
+ <cfset var loc = {} />
+ <cfset loc.keys = StructKeyList(arguments.data) />
+
+ <cfsavecontent variable="loc.returnValue"><!---
+ ---><cfoutput><!---
+ ---><#arguments.rootelement# type="struct"#arguments.elementattributes#><!---
+ ---><cfloop list="#loc.keys#" index="loc.key"><!---
+ --->#toXML(data=arguments.data[loc.key], rootelement=loc.key, addXMLHeader=false)#<!---
+ ---></cfloop><!---
+ ---></#arguments.rootelement#><!---
+ ---></cfoutput><!---
+ ---></cfsavecontent>
+
+ <cfreturn loc.returnValue />
+ </cffunction>
+
+ <cffunction name="$objectToXML" access="public" output="false" returntype="string" hint="Converts a struct into XML.">
+ <cfargument name="data" type="component" required="true" hint="It should be a struct, but can also be an 'exception' type." />
+ <cfargument name="rootelement" type="string" required="false" default="data" />
+ <cfargument name="elementattributes" type="string" required="false" default="" />
+ <cfset var loc = {} />
+ <cfset loc.keys = ListSort(StructKeyList(arguments.data), "textnocase", "asc") />
+ <cfset loc.name = GetMetaData(arguments.data).name/>
+
+ <cfsavecontent variable="loc.returnValue"><!---
+ ---><cfoutput><!---
+ ---><#arguments.rootelement# type="component" name="#loc.name#"#arguments.elementattributes#><!---
+ ---><cfloop list="#loc.keys#" index="loc.key"><!---
+ ---><cfif !IsCustomFunction(arguments.data[loc.key])><!---
+ --->#toXML(data=arguments.data[loc.key], rootelement=loc.key, addXMLHeader=false)#<!---
+ ---></cfif><!---
+ ---></cfloop><!---
+ ---></#arguments.rootelement#><!---
+ ---></cfoutput><!---
+ ---></cfsavecontent>
+
+ <cfreturn loc.returnValue />
+ </cffunction>
+
+</cfcomponent>
\ No newline at end of file diff --git a/src/main/webapp/wheels/view/assets.cfm b/src/main/webapp/wheels/view/assets.cfm new file mode 100755 index 0000000..9a6772f --- /dev/null +++ b/src/main/webapp/wheels/view/assets.cfm @@ -0,0 +1,275 @@ +<cffunction name="styleSheetLinkTag" returntype="string" access="public" output="false" hint="Returns a `link` tag for a stylesheet (or several) based on the supplied arguments."
+ examples=
+ '
+ <!--- view code --->
+ <head>
+ <!--- Includes `stylesheets/styles.css` --->
+ ##styleSheetLinkTag("styles")##
+ <!--- Includes `stylesheets/blog.css` and `stylesheets/comments.css` --->
+ ##styleSheetLinkTag("blog,comments")##
+ <!--- Includes printer style sheet --->
+ ##styleSheetLinkTag(source="print", media="print")##
+ </head>
+
+ <body>
+ <!--- This will still appear in the `head` --->
+ ##styleSheetLinkTag(source="tabs", head=true)##
+ </body>
+ '
+ categories="view-helper,assets" chapters="miscellaneous-helpers" functions="javaScriptIncludeTag,imageTag">
+ <cfargument name="sources" type="string" required="false" default="" hint="The name of one or many CSS files in the `stylesheets` folder, minus the `.css` extension. (Can also be called with the `source` argument.)">
+ <cfargument name="type" type="string" required="false" hint="The `type` attribute for the `link` tag.">
+ <cfargument name="media" type="string" required="false" hint="The `media` attribute for the `link` tag.">
+ <cfargument name="head" type="string" required="false" hint="Set to `true` to place the output in the `head` area of the HTML page instead of the default behavior, which is to place the output where the function is called from."> + <cfargument name="delim" type="string" required="false" default="," hint="the delimiter to use for the list of stylesheets">
+ <cfscript>
+ var loc = {}; + $args(name="styleSheetLinkTag", args=arguments, combine="sources/source/!", reserved="href,rel");
+ arguments.rel = "stylesheet";
+ loc.returnValue = "";
+ arguments.sources = $listClean(list=arguments.sources, returnAs="array", delim=arguments.delim);
+ loc.iEnd = ArrayLen(arguments.sources); + for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.item = arguments.sources[loc.i];
+ if (ReFindNoCase("^https?:\/\/", loc.item))
+ {
+ arguments.href = arguments.sources[loc.i];
+ }
+ else
+ {
+ arguments.href = application.wheels.webPath & application.wheels.stylesheetPath & "/" & loc.item;
+ if (!ListFindNoCase("css,cfm", ListLast(loc.item, ".")))
+ arguments.href = arguments.href & ".css";
+ arguments.href = $assetDomain(arguments.href) & $appendQueryString();
+ }
+ loc.returnValue = loc.returnValue & $tag(name="link", skip="sources,head,delim", close=true, attributes=arguments) & chr(10);
+ }
+ if (arguments.head)
+ {
+ $htmlhead(text=loc.returnValue);
+ loc.returnValue = "";
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="javaScriptIncludeTag" returntype="string" access="public" output="false" hint="Returns a `script` tag for a JavaScript file (or several) based on the supplied arguments."
+ examples=
+ '
+ <!--- view code --->
+ <head>
+ <!--- Includes `javascripts/main.js` --->
+ ##javaScriptIncludeTag("main")##
+ <!--- Includes `javascripts/blog.js` and `javascripts/accordion.js` --->
+ ##javaScriptIncludeTag("blog,accordion")##
+ </head>
+
+ <body>
+ <!--- Will still appear in the `head` --->
+ ##javaScriptIncludeTag(source="tabs", head=true)##
+ </body>
+ '
+ categories="view-helper,assets" chapters="miscellaneous-helpers" functions="styleSheetLinkTag,imageTag">
+ <cfargument name="sources" type="string" required="false" default="" hint="The name of one or many JavaScript files in the `javascripts` folder, minus the `.js` extension. (Can also be called with the `source` argument.)">
+ <cfargument name="type" type="string" required="false" hint="The `type` attribute for the `script` tag.">
+ <cfargument name="head" type="string" required="false" hint="See documentation for @styleSheetLinkTag."> + <cfargument name="delim" type="string" required="false" default="," hint="the delimiter to use for the list of stylesheets">
+ <cfscript>
+ var loc = {};
+ $args(name="javaScriptIncludeTag", args=arguments, combine="sources/source/!", reserved="src");
+ loc.returnValue = "";
+ arguments.sources = $listClean(list=arguments.sources, returnAs="array", delim=arguments.delim);
+ loc.iEnd = ArrayLen(arguments.sources);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.item = arguments.sources[loc.i];
+ if (ReFindNoCase("^https?:\/\/", loc.item))
+ {
+ arguments.src = arguments.sources[loc.i];
+ }
+ else
+ {
+ arguments.src = application.wheels.webPath & application.wheels.javascriptPath & "/" & loc.item;
+ if (!ListFindNoCase("js,cfm", ListLast(loc.item, ".")))
+ arguments.src = arguments.src & ".js";
+ arguments.src = $assetDomain(arguments.src) & $appendQueryString();
+ }
+ loc.returnValue = loc.returnValue & $element(name="script", skip="sources,head,delim", attributes=arguments) & chr(10);
+ }
+ if (arguments.head)
+ {
+ $htmlhead(text=loc.returnValue);
+ loc.returnValue = "";
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="imageTag" returntype="string" access="public" output="false" hint="Returns an `img` tag. If the image is stored in the local `images` folder, the tag will also set the `width`, `height`, and `alt` attributes for you. Note: Pass any additional arguments like `class`, `rel`, and `id`, and the generated tag will also include those values as HTML attributes."
+ examples=
+ '
+ <!--- Outputs an `img` tag for `images/logo.png` --->
+ ##imageTag("logo.png")##
+
+ <!--- Outputs an `img` tag for `http://cfwheels.org/images/logo.png` --->
+ ##imageTag("http://cfwheels.org/images/logo.png", alt="ColdFusion on Wheels")##
+
+ <!--- Outputs an `img` tag with the `class` attribute set --->
+ ##imageTag(source="logo.png", class="logo")##
+ '
+ categories="view-helper,assets" chapters="miscellaneous-helpers" functions="javaScriptIncludeTag,styleSheetLinkTag">
+ <cfargument name="source" type="string" required="true" hint="The file name of the image if it's availabe in the local file system (i.e. ColdFusion will be able to access it). Provide the full URL if the image is on a remote server.">
+ <cfscript>
+ var loc = {};
+ $args(name="imageTag", reserved="src", args=arguments);
+ // ugly fix due to the fact that id can't be passed along to cfinvoke
+ if (StructKeyExists(arguments, "id"))
+ {
+ arguments.wheelsId = arguments.id;
+ StructDelete(arguments, "id");
+ }
+ if (application.wheels.cacheImages)
+ {
+ loc.category = "image";
+ loc.key = $hashedKey(arguments);
+ loc.lockName = loc.category & loc.key;
+ loc.conditionArgs = {};
+ loc.conditionArgs.category = loc.category;
+ loc.conditionArgs.key = loc.key;
+ loc.executeArgs = arguments;
+ loc.executeArgs.category = loc.category;
+ loc.executeArgs.key = loc.key;
+ loc.returnValue = $doubleCheckedLock(name=loc.lockName, condition="$getFromCache", execute="$addImageTagToCache", conditionArgs=loc.conditionArgs, executeArgs=loc.executeArgs);
+ }
+ else
+ {
+ loc.returnValue = $imageTag(argumentCollection=arguments);
+ }
+ // ugly fix continued
+ if (StructKeyExists(arguments, "wheelsId"))
+ loc.returnValue = ReplaceNoCase(loc.returnValue, "wheelsId", "id");
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$addImageTagToCache" returntype="string" access="public" output="false">
+ <cfscript>
+ var returnValue = "";
+ returnValue = $imageTag(argumentCollection=arguments);
+ $addToCache(key=arguments.key, value=returnValue, category=arguments.category);
+ </cfscript>
+ <cfreturn returnValue>
+</cffunction>
+
+<cffunction name="$imageTag" returntype="string" access="public" output="false">
+ <cfscript>
+ var loc = {};
+ loc.localFile = true;
+
+ if(Left(arguments.source, 7) == "http://" || Left(arguments.source, 8) == "https://")
+ loc.localFile = false;
+
+ if (!loc.localFile)
+ {
+ arguments.src = arguments.source;
+ }
+ else
+ {
+ arguments.src = application.wheels.webPath & application.wheels.imagePath & "/" & arguments.source;
+ if (application.wheels.showErrorInformation)
+ {
+ if (loc.localFile && !FileExists(ExpandPath(arguments.src)))
+ $throw(type="Wheels.ImageFileNotFound", message="Wheels could not find `#expandPath('#arguments.src#')#` on the local file system.", extendedInfo="Pass in a correct relative path from the `images` folder to an image.");
+ else if (!IsImageFile(ExpandPath(arguments.src)))
+ $throw(type="Wheels.ImageFormatNotSupported", message="Wheels can't read image files with that format.", extendedInfo="Use one of these image types instead: #GetReadableImageFormats()#.");
+ }
+ // height and/or width arguments are missing so use cfimage to get them
+ if (!StructKeyExists(arguments, "width") or !StructKeyExists(arguments, "height"))
+ {
+ loc.image = $image(action="info", source=ExpandPath(arguments.src));
+ if (!StructKeyExists(arguments, "width") and loc.image.width gt 0)
+ arguments.width = loc.image.width;
+ if (!StructKeyExists(arguments, "height") and loc.image.height gt 0)
+ arguments.height = loc.image.height;
+ } else {
+ // remove height and width attributes if false
+ if (arguments.width EQ false) {
+ StructDelete(arguments, "width");
+ }
+ if (arguments.height EQ false) {
+ StructDelete(arguments,"height");
+ }
+ }
+ // only append a query string if the file is local
+ arguments.src = $assetDomain(arguments.src) & $appendQueryString();
+ }
+ if (!StructKeyExists(arguments, "alt"))
+ arguments.alt = capitalize(ReplaceList(SpanExcluding(Reverse(SpanExcluding(Reverse(arguments.src), "/")), "."), "-,_", " , "));
+ loc.returnValue = $tag(name="img", skip="source,key,category", close=true, attributes=arguments);
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$appendQueryString" returntype="string" access="public" output="false">
+ <cfscript>
+ var returnValue = "";
+ // if assetQueryString is a boolean value, it means we just reloaded, so create a new query string based off of now
+ // the only problem with this is if the app doesn't get used a lot and the application is left alone for a period longer than the application scope is allowed to exist
+ if (IsBoolean(application.wheels.assetQueryString) and YesNoFormat(application.wheels.assetQueryString) == "no")
+ return returnValue;
+
+ if (!IsNumeric(application.wheels.assetQueryString) and IsBoolean(application.wheels.assetQueryString))
+ application.wheels.assetQueryString = Hash(DateFormat(Now(), "yyyymmdd") & TimeFormat(Now(), "HHmmss"));
+ returnValue = returnValue & "?" & application.wheels.assetQueryString;
+ </cfscript>
+ <cfreturn returnValue />
+</cffunction>
+
+<cffunction name="$assetDomain" returntype="string" access="public" output="false">
+ <cfargument name="pathToAsset" type="string" required="true">
+ <cfscript>
+ var loc = {};
+ loc.returnValue = arguments.pathToAsset;
+ if (application.wheels.showErrorInformation)
+ {
+ if (!IsStruct(application.wheels.assetPaths) && !IsBoolean(application.wheels.assetPaths))
+ $throw(type="Wheels.IncorrectConfiguration", message="The setting `assetsPaths` must be false or a struct.");
+ if (IsStruct(application.wheels.assetPaths) && !ListFindNoCase(StructKeyList(application.wheels.assetPaths), "http"))
+ $throw(type="Wheels.IncorrectConfiguration", message="The `assetPaths` setting struct must contain the key `http`");
+ }
+
+ // return nothing if assetPaths is not a struct
+ if (!IsStruct(application.wheels.assetPaths))
+ return loc.returnValue;
+
+ loc.protocol = "http://";
+ loc.domainList = application.wheels.assetPaths.http;
+
+ if (isSecure())
+ {
+ loc.protocol = "https://";
+ if (StructKeyExists(application.wheels.assetPaths, "https"))
+ loc.domainList = application.wheels.assetPaths.https;
+ }
+
+ loc.domainLen = ListLen(loc.domainList);
+
+ if (loc.domainLen gt 1)
+ {
+ // now comes the interesting part, lets take the pathToAsset argument, hash it and create a number from it
+ // so that we can do mod based off the length of the domain list
+ // this is an easy way to apply the same sub-domain to each asset, so we do not create more work for the server
+ // at the same time we are getting a very random hash value to rotate the domains over the assets evenly
+ loc.pathNumber = Right(REReplace(Hash(arguments.pathToAsset), "[A-Za-z]", "", "all"), 5);
+
+ loc.position = (loc.pathNumber mod (loc.domainLen)) + 1;
+ }
+ else
+ {
+ loc.position = loc.domainLen;
+ }
+ loc.returnValue = loc.protocol & Trim(ListGetAt(loc.domainList, loc.position)) & arguments.pathToAsset;
+ </cfscript>
+ <cfreturn loc.returnValue />
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/view/dates.cfm b/src/main/webapp/wheels/view/dates.cfm new file mode 100755 index 0000000..6b1067e --- /dev/null +++ b/src/main/webapp/wheels/view/dates.cfm @@ -0,0 +1,113 @@ +<cffunction name="distanceOfTimeInWords" returntype="string" access="public" output="false" hint="Pass in two dates to this method, and it will return a string describing the difference between them."
+ examples='
+ <cfset aWhileAgo = Now() - 30>
+ <cfset rightNow = Now()>
+ <cfoutput>##distanceOfTimeInWords(aWhileAgo, rightNow)##</cfoutput>
+ '
+ categories="view-helper,dates" chapters="miscellaneous-helpers" functions="timeAgoInWords,timeUntilInWords">
+ <cfargument name="fromTime" type="date" required="true" hint="Date to compare from.">
+ <cfargument name="toTime" type="date" required="true" hint="Date to compare to.">
+ <cfargument name="includeSeconds" type="boolean" required="false" hint="Whether or not to include the number of seconds in the returned string.">
+ <cfscript>
+ var loc = {};
+ $args(name="distanceOfTimeInWords", args=arguments);
+ loc.minuteDiff = DateDiff("n", arguments.fromTime, arguments.toTime);
+ loc.secondDiff = DateDiff("s", arguments.fromTime, arguments.toTime);
+ loc.hours = 0;
+ loc.days = 0;
+ loc.returnValue = "";
+ if (loc.minuteDiff <= 1)
+ {
+ if (loc.secondDiff < 60)
+ loc.returnValue = "less than a minute";
+ else
+ loc.returnValue = "1 minute";
+ if (arguments.includeSeconds)
+ {
+ if (loc.secondDiff < 5)
+ loc.returnValue = "less than 5 seconds";
+ else if (loc.secondDiff < 10)
+ loc.returnValue = "less than 10 seconds";
+ else if (loc.secondDiff < 20)
+ loc.returnValue = "less than 20 seconds";
+ else if (loc.secondDiff < 40)
+ loc.returnValue = "half a minute";
+ }
+ }
+ else if (loc.minuteDiff < 45)
+ {
+ loc.returnValue = loc.minuteDiff & " minutes";
+ }
+ else if (loc.minuteDiff < 90)
+ {
+ loc.returnValue = "about 1 hour";
+ }
+ else if (loc.minuteDiff < 1440)
+ {
+ loc.hours = Ceiling(loc.minuteDiff/60);
+ loc.returnValue = "about " & loc.hours & " hours";
+ }
+ else if (loc.minuteDiff < 2880)
+ {
+ loc.returnValue = "1 day";
+ }
+ else if (loc.minuteDiff < 43200)
+ {
+ loc.days = Int(loc.minuteDiff/1440);
+ loc.returnValue = loc.days & " days";
+ }
+ else if (loc.minuteDiff < 86400)
+ {
+ loc.returnValue = "about 1 month";
+ }
+ else if (loc.minuteDiff < 525600)
+ {
+ loc.months = Int(loc.minuteDiff/43200);
+ loc.returnValue = loc.months & " months";
+ }
+ else if (loc.minuteDiff < 657000)
+ {
+ loc.returnValue = "about 1 year";
+ }
+ else if (loc.minuteDiff < 919800)
+ {
+ loc.returnValue = "over 1 year";
+ }
+ else if (loc.minuteDiff < 1051200)
+ {
+ loc.returnValue = "almost 2 years";
+ }
+ else if (loc.minuteDiff >= 1051200) + {
+ loc.years = Int(loc.minuteDiff/525600);
+ loc.returnValue = "over " & loc.years & " years";
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="timeAgoInWords" returntype="string" access="public" output="false" hint="Pass in a date to this method, and it will return a string describing the approximate time difference between that date and the current date."
+ examples='
+ <cfset aWhileAgo = Now() - 30>
+ <cfoutput>##timeAgoInWords(aWhileAgo)##</cfoutput>
+ '
+ categories="view-helper,dates" chapters="miscellaneous-helpers" functions="distanceOfTimeInWords,timeUntilInWords">
+ <cfargument name="fromTime" type="date" required="true" hint="See documentation for @distanceOfTimeInWords.">
+ <cfargument name="includeSeconds" type="boolean" required="false" hint="See documentation for @distanceOfTimeInWords.">
+ <cfargument name="toTime" type="date" required="false" default="#now()#" hint="See documentation for @distanceOfTimeInWords.">
+ <cfset $args(name="timeAgoInWords", args=arguments)>
+ <cfreturn distanceOfTimeInWords(argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="timeUntilInWords" returntype="string" access="public" output="false" hint="Pass in a date to this method, and it will return a string describing the approximate time difference between the current date and that date."
+ examples='
+ <cfset aLittleAhead = Now() + 30>
+ <cfoutput>##timeUntilInWords(aLittleAhead)##</cfoutput>
+ '
+ categories="view-helper,dates" chapters="miscellaneous-helpers" functions="timeAgoInWords,distanceOfTimeInWords">
+ <cfargument name="toTime" type="date" required="true" hint="See documentation for @distanceOfTimeInWords.">
+ <cfargument name="includeSeconds" type="boolean" required="false" hint="See documentation for @distanceOfTimeInWords.">
+ <cfargument name="fromTime" type="date" required="false" default="#now()#" hint="See documentation for @distanceOfTimeInWords.">
+ <cfset $args(name="timeUntilInWords", args=arguments)>
+ <cfreturn distanceOfTimeInWords(argumentCollection=arguments)>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/view/errors.cfm b/src/main/webapp/wheels/view/errors.cfm new file mode 100755 index 0000000..35b1525 --- /dev/null +++ b/src/main/webapp/wheels/view/errors.cfm @@ -0,0 +1,78 @@ +<cffunction name="errorMessagesFor" returntype="string" access="public" output="false" hint="Builds and returns a list (`ul` tag with a default class of `errorMessages`) containing all the error messages for all the properties of the object (if any). Returns an empty string otherwise."
+ examples=
+ '
+ <!--- view code --->
+ <cfoutput>
+ ##errorMessagesFor(objectName="user")##
+ </cfoutput>
+ '
+ categories="view-helper,errors" chapters="form-helpers-and-showing-errors" functions="errorMessagesOn">
+ <cfargument name="objectName" type="string" required="true" hint="The variable name of the object to display error messages for.">
+ <cfargument name="class" type="string" required="false" hint="CSS class to set on the `ul` element.">
+ <cfargument name="showDuplicates" type="boolean" required="false" hint="Whether or not to show duplicate error messages.">
+ <cfscript>
+ var loc = {};
+ $args(name="errorMessagesFor", args=arguments);
+ loc.object = $getObject(arguments.objectName);
+ if (application.wheels.showErrorInformation && !IsObject(loc.object))
+ $throw(type="Wheels.IncorrectArguments", message="The `#arguments.objectName#` variable is not an object.");
+ loc.errors = loc.object.allErrors();
+ loc.returnValue = "";
+ if (!ArrayIsEmpty(loc.errors))
+ {
+ loc.used = "";
+ loc.listItems = "";
+ loc.iEnd = ArrayLen(loc.errors);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.msg = loc.errors[loc.i].message;
+ if(arguments.showDuplicates)
+ {
+ loc.listItems = loc.listItems & $element(name="li", content=loc.msg);
+ }
+ else
+ {
+ if(!ListFind(loc.used, loc.msg, Chr(7)))
+ {
+ loc.listItems = loc.listItems & $element(name="li", content=loc.msg);
+ loc.used = ListAppend(loc.used, loc.msg, Chr(7));
+ }
+ }
+ }
+ loc.returnValue = $element(name="ul", skip="objectName,showDuplicates", content=loc.listItems, attributes=arguments);
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="errorMessageOn" returntype="string" access="public" output="false" hint="Returns the error message, if one exists, on the object's property. If multiple error messages exist, the first one is returned."
+ examples=
+ '
+ <!--- view code --->
+ <cfoutput>
+ ##errorMessageOn(objectName="user", property="email")##
+ </cfoutput>
+ '
+ categories="view-helper,errors" chapters="form-helpers-and-showing-errors" functions="errorMessagesOn">
+ <cfargument name="objectName" type="string" required="true" hint="The variable name of the object to display the error message for.">
+ <cfargument name="property" type="string" required="true" hint="The name of the property to display the error message for.">
+ <cfargument name="prependText" type="string" required="false" hint="String to prepend to the error message.">
+ <cfargument name="appendText" type="string" required="false" hint="String to append to the error message.">
+ <cfargument name="wrapperElement" type="string" required="false" hint="HTML element to wrap the error message in.">
+ <cfargument name="class" type="string" required="false" hint="CSS class to set on the wrapper element.">
+ <cfscript>
+ var loc = {};
+ $args(name="errorMessageOn", args=arguments);
+ loc.object = $getObject(arguments.objectName);
+ if (application.wheels.showErrorInformation && !IsObject(loc.object))
+ $throw(type="Wheels.IncorrectArguments", message="The `#arguments.objectName#` variable is not an object.");
+ loc.error = loc.object.errorsOn(arguments.property);
+ loc.returnValue = "";
+ if (!ArrayIsEmpty(loc.error))
+ {
+ loc.content = arguments.prependText & loc.error[1].message & arguments.appendText;
+ loc.returnValue = $element(name=arguments.wrapperElement, skip="objectName,property,prependText,appendText,wrapperElement", content=loc.content, attributes=arguments);
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/view/forms.cfm b/src/main/webapp/wheels/view/forms.cfm new file mode 100755 index 0000000..4425b5c --- /dev/null +++ b/src/main/webapp/wheels/view/forms.cfm @@ -0,0 +1,352 @@ +<cffunction name="endFormTag" returntype="string" access="public" output="false" hint="Builds and returns a string containing the closing `form` tag." + examples= + ' + <!--- view code ---> + <cfoutput> + ##startFormTag(action="create")## + <!--- your form controls ---> + ##endFormTag()## + </cfoutput> + ' + categories="view-helper,forms-general" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,submitTag,textField,radioButton,checkBox,passwordField,hiddenField,textArea,fileField,select,dateTimeSelect,dateSelect,timeSelect"> + <cfscript> + if (StructKeyExists(request.wheels, "currentFormMethod")) + StructDelete(request.wheels, "currentFormMethod"); + </cfscript> + <cfreturn "</form>"> +</cffunction> + +<cffunction name="startFormTag" returntype="string" access="public" output="false" hint="Builds and returns a string containing the opening form tag. The form's action will be built according to the same rules as `URLFor`. Note: Pass any additional arguments like `class`, `rel`, and `id`, and the generated tag will also include those values as HTML attributes." + examples= + ' + <!--- view code ---> + <cfoutput> + ##startFormTag(action="create", spamProtection=true)## + <!--- your form controls ---> + ##endFormTag()## + </cfoutput> + ' + categories="view-helper,forms-general" chapters="form-helpers-and-showing-errors" functions="URLFor,endFormTag,submitTag,textField,radioButton,checkBox,passwordField,hiddenField,textArea,fileField,select,dateTimeSelect,dateSelect,timeSelect"> + <cfargument name="method" type="string" required="false" hint="The type of method to use in the form tag. `get` and `post` are the options."> + <cfargument name="multipart" type="boolean" required="false" hint="Set to `true` if the form should be able to upload files."> + <cfargument name="spamProtection" type="boolean" required="false" hint="Set to `true` to protect the form against spammers (done with JavaScript)."> + <cfargument name="route" type="string" required="false" default="" hint="See documentation for @URLFor."> + <cfargument name="controller" type="string" required="false" default="" hint="See documentation for @URLFor."> + <cfargument name="action" type="string" required="false" default="" hint="See documentation for @URLFor."> + <cfargument name="key" type="any" required="false" default="" hint="See documentation for @URLFor."> + <cfargument name="params" type="string" required="false" default="" hint="See documentation for @URLFor."> + <cfargument name="anchor" type="string" required="false" default="" hint="See documentation for @URLFor."> + <cfargument name="onlyPath" type="boolean" required="false" hint="See documentation for @URLFor."> + <cfargument name="host" type="string" required="false" hint="See documentation for @URLFor."> + <cfargument name="protocol" type="string" required="false" hint="See documentation for @URLFor."> + <cfargument name="port" type="numeric" required="false" hint="See documentation for @URLFor."> + <cfscript> + var loc = {}; + $args(name="startFormTag", args=arguments); + + // sets a flag to indicate whether we use get or post on this form, used when obfuscating params + request.wheels.currentFormMethod = arguments.method; + + // set the form's action attribute to the URL that we want to send to + if (!ReFindNoCase("^https?:\/\/", arguments.action)) + arguments.action = URLFor(argumentCollection=arguments); + + // make sure we return XHMTL compliant code + arguments.action = toXHTML(arguments.action); + + // deletes the action attribute and instead adds some tricky javascript spam protection to the onsubmit attribute + if (arguments.spamProtection) + { + loc.onsubmit = "this.action='#Left(arguments.action, int((Len(arguments.action)/2)))#'+'#Right(arguments.action, ceiling((Len(arguments.action)/2)))#';"; + arguments.onsubmit = $addToJavaScriptAttribute(name="onsubmit", content=loc.onsubmit, attributes=arguments); + StructDelete(arguments, "action"); + } + + // set the form to be able to handle file uploads + if (!StructKeyExists(arguments, "enctype") && arguments.multipart) + arguments.enctype = "multipart/form-data"; + + loc.skip = "multipart,spamProtection,route,controller,key,params,anchor,onlyPath,host,protocol,port"; + if (Len(arguments.route)) + loc.skip = ListAppend(loc.skip, $routeVariables(argumentCollection=arguments)); // variables passed in as route arguments should not be added to the html element + if (ListFind(loc.skip, "action")) + loc.skip = ListDeleteAt(loc.skip, ListFind(loc.skip, "action")); // need to re-add action here even if it was removed due to being a route variable above + + loc.returnValue = $tag(name="form", skip=loc.skip, attributes=arguments); + </cfscript> + <cfreturn loc.returnValue> +</cffunction> + +<cffunction name="submitTag" returntype="string" access="public" output="false" hint="Builds and returns a string containing a submit button `form` control. Note: Pass any additional arguments like `class`, `rel`, and `id`, and the generated tag will also include those values as HTML attributes." + examples= + ' + !--- view code ---> + <cfoutput> + ##startFormTag(action="something")## + <!--- form controls go here ---> + ##submitTag()## + ##endFormTag()## + </cfoutput> + ' + categories="view-helper,forms-general" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,textField,radioButton,checkBox,passwordField,hiddenField,textArea,fileField,select,dateTimeSelect,dateSelect,timeSelect"> + <cfargument name="value" type="string" required="false" hint="Message to display in the button form control."> + <cfargument name="image" type="string" required="false" hint="File name of the image file to use in the button form control."> + <cfargument name="disable" type="any" required="false" hint="Whether or not to disable the button upon clicking. (prevents double-clicking.)"> + <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField"> + <cfargument name="append" type="string" required="false" hint="See documentation for @textField"> + <cfscript> + var loc = {}; + $args(name="submitTag", reserved="type,src", args=arguments); + loc.returnValue = arguments.prepend; + loc.append = arguments.append; + if (Len(arguments.disable)) + { + loc.onclick = "this.disabled=true;"; + if (!Len(arguments.image) && !IsBoolean(arguments.disable)) + loc.onclick = loc.onclick & "this.value='#JSStringFormat(arguments.disable)#';"; + loc.onclick = loc.onclick & "this.form.submit();"; + arguments.onclick = $addToJavaScriptAttribute(name="onclick", content=loc.onclick, attributes=arguments); + } + if (Len(arguments.image)) + { + // create an img tag and then just replace "img" with "input" + arguments.type = "image"; + arguments.source = arguments.image; + StructDelete(arguments, "value"); + StructDelete(arguments, "image"); + StructDelete(arguments, "disable"); + StructDelete(arguments, "append"); + StructDelete(arguments, "prepend"); + loc.returnValue &= imageTag(argumentCollection=arguments); + loc.returnValue = Replace(loc.returnValue, "<img", "<input"); + } + else + { + arguments.type = "submit"; + loc.returnValue &= $tag(name="input", close=true, skip="image,disable,append,prepend", attributes=arguments); + } + loc.returnValue &= loc.append; + </cfscript> + <cfreturn loc.returnValue> +</cffunction> + +<cffunction name="buttonTag" returntype="string" access="public" output="false" hint="Builds and returns a string containing a button `form` control." + examples= + ' + <!--- view code ---> + <cfoutput> + ##startFormTag(action="something")## + <!--- form controls go here ---> + ##buttonTag(content="Submit this form", value="save")## + ##endFormTag()## + </cfoutput> + ' + categories="view-helper,forms-general" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,textField,radioButton,checkBox,passwordField,hiddenField,textArea,fileField,select,dateTimeSelect,dateSelect,timeSelect"> + <cfargument name="content" type="string" required="false" hint="Content to display inside the button."> + <cfargument name="type" type="string" required="false" hint="The type for the button: `button`, `reset`, or `submit`."> + <cfargument name="image" type="string" required="false" hint="File name of the image file to use in the button form control."> + <cfargument name="value" type="string" required="false" hint="The value of the button when submitted."> + <cfargument name="disable" type="any" required="false" hint="Whether or not to disable the button upon clicking. (Prevents double-clicking.)"> + <cfscript> + var loc = {}; + $args(name="buttonTag", args=arguments); + + if (Len(arguments.disable)) + { + loc.onclick = "this.disabled=true;"; + if (!Len(arguments.image) && !IsBoolean(arguments.disable)) + loc.onclick = loc.onclick & "this.value='#JSStringFormat(arguments.disable)#';"; + loc.onclick = loc.onclick & "this.form.submit();"; + arguments.onclick = $addToJavaScriptAttribute(name="onclick", content=loc.onclick, attributes=arguments); + } + + if (Len(arguments.image)) + { + // if image is specified then use that as the content + loc.args = {}; + loc.args.type = "image"; + loc.args.source = arguments.image; + arguments.content = imageTag(argumentCollection=loc.args); + } + + // save content and delete argument + loc.content = arguments.content; + StructDelete(arguments, "content", false); + // remove image argument + StructDelete(arguments, "image"); + // remove disabled argument + StructDelete(arguments, "disable"); + // create the buttom + loc.returnValue = $element(name="button", content="#loc.content#", attributes="#arguments#"); + </cfscript> + <cfreturn loc.returnValue> +</cffunction> + +<cffunction name="$formValue" returntype="string" access="public" output="false"> + <cfargument name="objectName" type="any" required="true"> + <cfargument name="property" type="string" required="true"> + <cfargument name="applyHtmlEditFormat" type="boolean" required="false" default="true" /> + <cfscript> + var loc = {}; + if (IsStruct(arguments.objectName)) + { + loc.returnValue = arguments.objectName[arguments.property]; + } + else + { + loc.object = $getObject(arguments.objectName); + if (application.wheels.showErrorInformation && !IsObject(loc.object)) + $throw(type="Wheels.IncorrectArguments", message="The `#arguments.objectName#` variable is not an object."); + if (StructKeyExists(loc.object, arguments.property)) + loc.returnValue = loc.object[arguments.property]; + else + loc.returnValue = ""; + } + if (arguments.applyHtmlEditFormat) + loc.returnValue = HTMLEditFormat(loc.returnValue); + </cfscript> + <cfreturn loc.returnValue> +</cffunction> + +<cffunction name="$maxLength" returntype="any" access="public"> + <cfargument name="objectName" type="any" required="true"> + <cfargument name="property" type="string" required="true"> + <cfscript> + var loc = {}; + + // if the developer passed in a maxlength value, use it + if (StructKeyExists(arguments, "maxlength")) + return arguments.maxlength; + + // explicity return void so the property does not get set + if (IsStruct(arguments.objectName)) + return; + + loc.object = $getObject(arguments.objectName); + + // if objectName does not represent an object, explicity return void so the property does not get set + if (not IsObject(loc.object)) + return; + + loc.propertyInfo = loc.object.$propertyInfo(arguments.property); + if (StructCount(loc.propertyInfo) and ListFindNoCase("cf_sql_char,cf_sql_varchar", loc.propertyInfo.type)) + return loc.propertyInfo.size; + </cfscript> + <cfreturn /> +</cffunction> + +<cffunction name="$formHasError" returntype="boolean" access="public" output="false"> + <cfargument name="objectName" type="any" required="true"> + <cfargument name="property" type="string" required="true"> + <cfscript> + var loc = {}; + loc.returnValue = false; + if (!IsStruct(arguments.objectName)) + { + loc.object = $getObject(arguments.objectName); + if (application.wheels.showErrorInformation && !IsObject(loc.object)) + $throw(type="Wheels.IncorrectArguments", message="The `#arguments.objectName#` variable is not an object."); + if (ArrayLen(loc.object.errorsOn(arguments.property))) + loc.returnValue = true; + } + </cfscript> + <cfreturn loc.returnValue> +</cffunction> + +<cffunction name="$createLabel" returntype="string" access="public" output="false"> + <cfargument name="objectName" type="any" required="true"> + <cfargument name="property" type="string" required="true"> + <cfargument name="label" type="string" required="true"> + <cfargument name="prependToLabel" type="string" required="true"> + <cfscript> + var loc = {}; + loc.returnValue = arguments.prependToLabel; + loc.attributes = {}; + for (loc.key in arguments) + if (CompareNoCase(Left(loc.key, 5), "label") eq 0 && Len(loc.key) gt 5 && loc.key != "labelPlacement") + loc.attributes[ReplaceNoCase(loc.key, "label", "")] = arguments[loc.key]; + if (StructKeyExists(arguments, "id")) + loc.attributes.for = arguments.id; + loc.returnValue = loc.returnValue & $tag(name="label", attributes=loc.attributes); + loc.returnValue = loc.returnValue & arguments.label; + loc.returnValue = loc.returnValue & "</label>"; + </cfscript> + <cfreturn loc.returnValue> +</cffunction> + +<cffunction name="$formBeforeElement" returntype="string" access="public" output="false"> + <cfargument name="objectName" type="any" required="true"> + <cfargument name="property" type="string" required="true"> + <cfargument name="label" type="any" required="true"> + <cfargument name="labelPlacement" type="string" required="true"> + <cfargument name="prepend" type="string" required="true"> + <cfargument name="append" type="string" required="true"> + <cfargument name="prependToLabel" type="string" required="true"> + <cfargument name="appendToLabel" type="string" required="true"> + <cfargument name="errorElement" type="string" required="true"> + <cfargument name="errorClass" type="string" required="true"> + <cfscript> + var loc = {}; + loc.returnValue = ""; + if ($formHasError(argumentCollection=arguments) and Len(arguments.errorElement)) + loc.returnValue = loc.returnValue & $tag(name=arguments.errorElement, class=arguments.errorClass); + arguments.label = $getFieldLabel(argumentCollection=arguments); + if (Len(arguments.label) && arguments.labelPlacement != "after") + { + loc.returnValue = loc.returnValue & $createLabel(argumentCollection=arguments); + if (arguments.labelPlacement == "around") + loc.returnValue = Replace(loc.returnValue, "</label>", ""); + else + loc.returnValue = loc.returnValue & arguments.appendToLabel; + + } + loc.returnValue = loc.returnValue & arguments.prepend; + </cfscript> + <cfreturn loc.returnValue> +</cffunction> + +<cffunction name="$formAfterElement" returntype="string" access="public" output="false"> + <cfargument name="objectName" type="any" required="true"> + <cfargument name="property" type="string" required="true"> + <cfargument name="label" type="string" required="true"> + <cfargument name="labelPlacement" type="string" required="true"> + <cfargument name="prepend" type="string" required="true"> + <cfargument name="append" type="string" required="true"> + <cfargument name="prependToLabel" type="string" required="true"> + <cfargument name="appendToLabel" type="string" required="true"> + <cfargument name="errorElement" type="string" required="true"> + <cfscript> + var loc = {}; + loc.returnValue = arguments.append; + arguments.label = $getFieldLabel(argumentCollection=arguments); + if (Len(arguments.label) && arguments.labelPlacement != "before") + { + if (arguments.labelPlacement == "after") + loc.returnValue = loc.returnValue & $createLabel(argumentCollection=arguments); + else if (arguments.labelPlacement == "around") + loc.returnValue = loc.returnValue & "</label>"; + loc.returnValue = loc.returnValue & arguments.appendToLabel; + } + if ($formHasError(argumentCollection=arguments) and Len(arguments.errorElement)) + loc.returnValue = loc.returnValue & "</" & arguments.errorElement & ">"; + </cfscript> + <cfreturn loc.returnValue> +</cffunction> + +<cffunction name="$getFieldLabel" returntype="string" access="public" output="false"> + <cfargument name="objectName" type="any" required="true"> + <cfargument name="property" type="string" required="true"> + <cfargument name="label" type="string" required="true"> + <cfscript> + var object = false; + if (Compare("false", arguments.label) == 0) + return ""; + if (arguments.label == "useDefaultLabel" && !IsStruct(arguments.objectName)) + { + object = $getObject(arguments.objectName); + if (IsObject(object)) + return object.$label(arguments.property); + } + </cfscript> + <cfreturn arguments.label /> +</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/view/formsassociation.cfm b/src/main/webapp/wheels/view/formsassociation.cfm new file mode 100755 index 0000000..bc24748 --- /dev/null +++ b/src/main/webapp/wheels/view/formsassociation.cfm @@ -0,0 +1,161 @@ +<cffunction name="hasManyRadioButton" returntype="string" access="public" output="false" hint="Used as a shortcut to output the proper form elements for an association. Note: Pass any additional arguments like `class`, `rel`, and `id`, and the generated tag will also include those values as HTML attributes."
+ examples='
+ <!--- Show radio buttons for associating a default address with the current author --->
+ <cfloop query="addresses">
+ ##hasManyRadioButton(
+ label=addresses.title,
+ objectName="author",
+ association="authorsDefaultAddresses",
+ keys="##author.key()##,##addresses.id##"
+ )##
+ </cfloop>
+ '
+ categories="view-helper,forms-association" chapters="nested-properties" functions="hasMany,hasManyCheckBox,includedInObject,nestedProperties">
+ <cfargument name="objectName" type="string" required="true" hint="Name of the variable containing the parent object to represent with this form field." />
+ <cfargument name="association" type="string" required="true" hint="Name of the association set in the parent object to represent with this form field." />
+ <cfargument name="property" type="string" required="true" hint="Name of the property in the child object to represent with this form field." />
+ <cfargument name="keys" type="string" required="true" hint="Primary keys associated with this form field." />
+ <cfargument name="tagValue" type="string" required="true" hint="The value of the radio button when `selected`." />
+ <cfargument name="checkIfBlank" type="boolean" required="false" default="false" hint="Whether or not to check this form field as a default if there is a blank value set for the property." />
+ <cfargument name="label" type="string" required="false" hint="See documentation for @textField.">
+ <cfscript>
+ var loc = {};
+ $args(name="hasManyRadioButton", args=arguments);
+ loc.checked = false;
+ loc.returnValue = "";
+ loc.value = $hasManyFormValue(argumentCollection=arguments);
+ loc.included = includedInObject(argumentCollection=arguments);
+
+ if (!loc.included)
+ {
+ loc.included = "";
+ }
+
+ if (loc.value == arguments.tagValue || (arguments.checkIfBlank && loc.value != arguments.tagValue))
+ loc.checked = true;
+
+ loc.tagId = "#arguments.objectName#-#arguments.association#-#Replace(arguments.keys, ",", "-", "all")#-#arguments.property#-#arguments.tagValue#";
+ loc.tagName = "#arguments.objectName#[#arguments.association#][#arguments.keys#][#arguments.property#]";
+ loc.returnValue = radioButtonTag(name=loc.tagName, id=loc.tagId, value=arguments.tagValue, checked=loc.checked, label=arguments.label);
+ </cfscript>
+ <cfreturn loc.returnValue />
+</cffunction>
+
+<cffunction name="hasManyCheckBox" returntype="string" access="public" output="false" hint="Used as a shortcut to output the proper form elements for an association. Note: Pass any additional arguments like `class`, `rel`, and `id`, and the generated tag will also include those values as HTML attributes."
+ examples='
+ <!--- Show check boxes for associating authors with the current book --->
+ <cfloop query="authors">
+ ##hasManyCheckBox(
+ label=authors.fullName,
+ objectName="book",
+ association="bookAuthors",
+ keys="##book.key()##,##authors.id##"
+ )##
+ </cfloop>
+ '
+ categories="view-helper,forms-association" chapters="nested-properties" functions="hasMany,hasManyRadioButton,includedInObject,nestedProperties">
+ <cfargument name="objectName" type="string" required="true" hint="See documentation for @hasManyRadioButton." />
+ <cfargument name="association" type="string" required="true" hint="See documentation for @hasManyRadioButton." />
+ <cfargument name="keys" type="string" required="true" hint="See documentation for @hasManyRadioButton." />
+ <cfargument name="label" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="errorElement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="errorClass" type="string" required="false" hint="See documentation for @textField.">
+ <cfscript>
+ var loc = {};
+ $args(name="hasManyCheckBox", args=arguments);
+ loc.checked = true;
+ loc.returnValue = "";
+ loc.included = includedInObject(argumentCollection=arguments);
+
+ if (!loc.included)
+ {
+ loc.included = "";
+ loc.checked = false;
+ }
+
+ loc.tagId = "#arguments.objectName#-#arguments.association#-#Replace(arguments.keys, ",", "-", "all")#-_delete";
+ loc.tagName = "#arguments.objectName#[#arguments.association#][#arguments.keys#][_delete]";
+
+ StructDelete(arguments, "keys", false);
+ StructDelete(arguments, "objectName", false);
+ StructDelete(arguments, "association", false);
+
+ loc.returnValue = checkBoxTag(name=loc.tagName, id=loc.tagId, value=0, checked=loc.checked, uncheckedValue=1, argumentCollection=arguments);
+ </cfscript>
+ <cfreturn loc.returnValue />
+</cffunction>
+
+<cffunction name="includedInObject" returntype="boolean" access="public" output="false" hint="Used as a shortcut to check if the specified IDs are a part of the main form object. This method should only be used for `hasMany` associations."
+ examples=
+ '
+ <!--- Check to see if the customer is subscribed to the Swimsuit Edition. Note that the order of the `keys` argument should match the order of the `customerid` and `publicationid` columns in the `subscriptions` join table --->
+ <cfif not includedInObject(objectName="customer", association="subscriptions", keys="##customer.key()##,##swimsuitEdition.id##")>
+ <cfset assignSalesman(customer)>
+ </cfif>
+ '
+ categories="view-helper,forms-association" chapters="nested-properties" functions="hasMany,hasManyCheckBox,hasManyRadioButton,nestedProperties">
+ <cfargument name="objectName" type="string" required="true" hint="See documentation for @hasManyRadioButton." />
+ <cfargument name="association" type="string" required="true" hint="See documentation for @hasManyRadioButton." />
+ <cfargument name="keys" type="string" required="true" hint="See documentation for @hasManyRadioButton." />
+ <cfscript>
+ var loc = {};
+ loc.returnValue = false;
+ loc.object = $getObject(arguments.objectName);
+
+ // clean up our key argument if there is a comma on the beginning or end
+ arguments.keys = REReplace(arguments.keys, "^,|,$", "", "all");
+
+ if (!StructKeyExists(loc.object, arguments.association) || !IsArray(loc.object[arguments.association]))
+ return loc.returnValue;
+
+ if (!Len(arguments.keys))
+ return loc.returnValue;
+
+ loc.iEnd = ArrayLen(loc.object[arguments.association]);
+ for (loc.i = 1; loc.i lte loc.iEnd; loc.i++)
+ {
+ loc.assoc = loc.object[arguments.association][loc.i];
+ if (IsObject(loc.assoc) && loc.assoc.key() == arguments.keys)
+ {
+ loc.returnValue = loc.i;
+ break;
+ }
+ }
+ </cfscript>
+ <cfreturn loc.returnValue />
+</cffunction>
+
+<cffunction name="$hasManyFormValue" returntype="string" access="public" output="false">
+ <cfargument name="objectName" type="string" required="true" />
+ <cfargument name="association" type="string" required="true" />
+ <cfargument name="property" type="string" required="true" />
+ <cfargument name="keys" type="string" required="true" />
+ <cfscript>
+ var loc = {};
+ loc.returnValue = "";
+ loc.object = $getObject(arguments.objectName);
+
+ if (!StructKeyExists(loc.object, arguments.association) || !IsArray(loc.object[arguments.association]))
+ return loc.returnValue;
+
+ if (!Len(arguments.keys))
+ return loc.returnValue;
+
+ loc.iEnd = ArrayLen(loc.object[arguments.association]);
+ for (loc.i = 1; loc.i lte loc.iEnd; loc.i++)
+ {
+ loc.assoc = loc.object[arguments.association][loc.i];
+ if (isObject(loc.assoc) && loc.assoc.key() == arguments.keys && StructKeyExists(loc.assoc, arguments.property))
+ {
+ loc.returnValue = loc.assoc[arguments.property];
+ break;
+ }
+ }
+ </cfscript>
+ <cfreturn loc.returnValue />
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/view/formsdate.cfm b/src/main/webapp/wheels/view/formsdate.cfm new file mode 100755 index 0000000..a2b52cc --- /dev/null +++ b/src/main/webapp/wheels/view/formsdate.cfm @@ -0,0 +1,281 @@ +<cffunction name="$yearSelectTag" returntype="string" access="public" output="false">
+ <cfargument name="startYear" type="numeric" required="true">
+ <cfargument name="endYear" type="numeric" required="true">
+ <cfscript>
+ if (Structkeyexists(arguments, "value") && Val(arguments.value))
+ {
+ if (arguments.value < arguments.startYear && arguments.endYear > arguments.startYear)
+ arguments.startYear = arguments.value;
+ else if(arguments.value < arguments.endYear && arguments.endYear < arguments.startYear)
+ arguments.endYear = arguments.value;
+ }
+ arguments.$loopFrom = arguments.startYear;
+ arguments.$loopTo = arguments.endYear;
+ arguments.$type = "year";
+ arguments.$step = 1;
+ StructDelete(arguments, "startYear");
+ StructDelete(arguments, "endYear");
+ </cfscript>
+ <cfreturn $yearMonthHourMinuteSecondSelectTag(argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="$monthSelectTag" returntype="string" access="public" output="false">
+ <cfargument name="monthDisplay" type="string" required="true">
+ <cfscript>
+ arguments.$loopFrom = 1;
+ arguments.$loopTo = 12;
+ arguments.$type = "month";
+ arguments.$step = 1;
+ if (arguments.monthDisplay == "abbreviations")
+ arguments.$optionNames = "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec";
+ else if (arguments.monthDisplay == "names")
+ arguments.$optionNames = "January,February,March,April,May,June,July,August,September,October,November,December";
+ StructDelete(arguments, "monthDisplay");
+ </cfscript>
+ <cfreturn $yearMonthHourMinuteSecondSelectTag(argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="$daySelectTag" returntype="string" access="public" output="false">
+ <cfscript>
+ arguments.$loopFrom = 1;
+ arguments.$loopTo = 31;
+ arguments.$type = "day";
+ arguments.$step = 1;
+ </cfscript>
+ <cfreturn $yearMonthHourMinuteSecondSelectTag(argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="$hourSelectTag" returntype="string" access="public" output="false">
+ <cfscript>
+ arguments.$loopFrom = 0;
+ arguments.$loopTo = 23;
+ arguments.$type = "hour";
+ arguments.$step = 1;
+ if (arguments.twelveHour)
+ {
+ arguments.$loopFrom = 1;
+ arguments.$loopTo = 12;
+ }
+ </cfscript>
+ <cfreturn $yearMonthHourMinuteSecondSelectTag(argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="$minuteSelectTag" returntype="string" access="public" output="false">
+ <cfargument name="minuteStep" type="numeric" required="true">
+ <cfscript>
+ arguments.$loopFrom = 0;
+ arguments.$loopTo = 59;
+ arguments.$type = "minute";
+ arguments.$step = arguments.minuteStep;
+ StructDelete(arguments, "minuteStep");
+ </cfscript>
+ <cfreturn $yearMonthHourMinuteSecondSelectTag(argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="$secondSelectTag" returntype="string" access="public" output="false">
+ <cfargument name="secondStep" type="numeric" required="true">
+ <cfscript>
+ arguments.$loopFrom = 0;
+ arguments.$loopTo = 59;
+ arguments.$type = "second";
+ arguments.$step = arguments.secondStep;
+ StructDelete(arguments, "secondStep");
+ </cfscript>
+ <cfreturn $yearMonthHourMinuteSecondSelectTag(argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="$dateOrTimeSelect" returntype="string" access="public" output="false">
+ <cfargument name="objectName" type="any" required="true">
+ <cfargument name="property" type="string" required="true">
+ <cfargument name="$functionName" type="string" required="true">
+ <cfargument name="combine" type="boolean" required="false" default="true">
+ <cfargument name="twelveHour" type="boolean" required="false" default="false">
+ <cfscript>
+ var loc = {};
+ loc.combine = arguments.combine;
+ StructDelete(arguments, "combine", false);
+ loc.name = $tagName(arguments.objectName, arguments.property);
+ arguments.$id = $tagId(arguments.objectName, arguments.property);
+
+ // in order to support 12-hour format, we have to enforce some rules
+ // if arguments.twelveHour is true, then order MUST contain ampm
+ // if the order contains ampm, then arguments.twelveHour MUST be true
+ if (ListFindNoCase(arguments.order, "hour") && arguments.twelveHour && !ListFindNoCase(arguments.order, "ampm"))
+ {
+ arguments.twelveHour = true;
+ if (!ListFindNoCase(arguments.order, "ampm"))
+ {
+ arguments.order = ListAppend(arguments.order, "ampm");
+ }
+ }
+
+ loc.value = $formValue(argumentCollection=arguments);
+ loc.returnValue = "";
+ loc.firstDone = false;
+ loc.iEnd = ListLen(arguments.order);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.item = ListGetAt(arguments.order, loc.i);
+ loc.marker = "($" & loc.item & ")";
+ if(!loc.combine)
+ {
+ loc.name = $tagName(arguments.objectName, "#arguments.property#-#loc.item#");
+ loc.marker = "";
+ }
+ arguments.name = loc.name & loc.marker;
+ arguments.value = loc.value;
+ if (Isdate(loc.value))
+ {
+ if (arguments.twelveHour)
+ {
+ if (loc.item IS "hour")
+ {
+ arguments.value = TimeFormat(loc.value, 'h');
+ }
+ else if (loc.item IS "ampm")
+ {
+ arguments.value = TimeFormat(loc.value, 'tt');
+ }
+ }
+ else
+ {
+ arguments.value = Evaluate("#loc.item#(loc.value)");
+ }
+ }
+
+ if (loc.firstDone)
+ loc.returnValue = loc.returnValue & arguments.separator;
+ loc.returnValue = loc.returnValue & Evaluate("$#loc.item#SelectTag(argumentCollection=arguments)");
+ loc.firstDone = true;
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$yearMonthHourMinuteSecondSelectTag" returntype="string" access="public" output="false">
+ <cfargument name="name" type="string" required="true">
+ <cfargument name="value" type="string" required="true">
+ <cfargument name="includeBlank" type="any" required="true">
+ <cfargument name="label" type="string" required="true">
+ <cfargument name="labelPlacement" type="string" required="true">
+ <cfargument name="prepend" type="string" required="true">
+ <cfargument name="append" type="string" required="true">
+ <cfargument name="prependToLabel" type="string" required="true">
+ <cfargument name="appendToLabel" type="string" required="true">
+ <cfargument name="errorElement" type="string" required="false" default="">
+ <cfargument name="errorClass" type="string" required="false" default="">
+ <cfargument name="$type" type="string" required="true">
+ <cfargument name="$loopFrom" type="numeric" required="true">
+ <cfargument name="$loopTo" type="numeric" required="true">
+ <cfargument name="$id" type="string" required="true">
+ <cfargument name="$step" type="numeric" required="true">
+ <cfargument name="$optionNames" type="string" required="false" default="">
+ <cfargument name="twelveHour" type="boolean" required="false" default="false">
+ <cfargument name="$now" type="date" required="false" default="#now()#">
+ <cfscript>
+ var loc = {};
+ loc.optionContent = "";
+ // only set the default value if the value is blank and includeBlank is false
+ if (!Len(arguments.value) && (IsBoolean(arguments.includeBlank) && !arguments.includeBlank))
+ if (arguments.twelveHour && arguments.$type IS "hour")
+ arguments.value = TimeFormat(arguments.$now, 'h');
+ else
+ arguments.value = Evaluate("#arguments.$type#(arguments.$now)");
+ if (StructKeyExists(arguments, "order") && ListLen(arguments.order) > 1 && ListLen(arguments.label) > 1)
+ arguments.label = ListGetAt(arguments.label, ListFindNoCase(arguments.order, arguments.$type));
+
+ if (StructKeyExists(arguments, "order") && ListLen(arguments.order) > 1 && StructKeyExists(arguments, "labelClass") && ListLen(arguments.labelClass) > 1)
+ {
+ arguments.labelClass = ListGetAt(arguments.labelClass, ListFindNoCase(arguments.order, arguments.$type));
+ }
+
+ if (!StructKeyExists(arguments, "id"))
+ arguments.id = arguments.$id & "-" & arguments.$type;
+ loc.before = $formBeforeElement(argumentCollection=arguments);
+ loc.after = $formAfterElement(argumentCollection=arguments);
+ loc.content = "";
+ if (!IsBoolean(arguments.includeBlank) || arguments.includeBlank)
+ {
+ loc.args = {};
+ loc.args.value = "";
+ if(!Len(arguments.value))
+ loc.args.selected = "selected";
+ if (!IsBoolean(arguments.includeBlank))
+ loc.optionContent = arguments.includeBlank;
+ loc.content = loc.content & $element(name="option", content=loc.optionContent, attributes=loc.args);
+ }
+
+ if(arguments.$loopFrom < arguments.$loopTo)
+ {
+ for (loc.i=arguments.$loopFrom; loc.i <= arguments.$loopTo; loc.i=loc.i+arguments.$step)
+ {
+ loc.args = Duplicate(arguments);
+ loc.args.counter = loc.i;
+ loc.args.optionContent = loc.optionContent;
+ loc.content = loc.content & $yearMonthHourMinuteSecondSelectTagContent(argumentCollection=loc.args);
+ }
+ }
+ else
+ {
+ for (loc.i=arguments.$loopFrom; loc.i >= arguments.$loopTo; loc.i=loc.i-arguments.$step)
+ {
+ loc.args = Duplicate(arguments);
+ loc.args.counter = loc.i;
+ loc.args.optionContent = loc.optionContent;
+ loc.content = loc.content & $yearMonthHourMinuteSecondSelectTagContent(argumentCollection=loc.args);
+ }
+ }
+ loc.returnValue = loc.before & $element(name="select", skip="objectName,property,label,labelPlacement,prepend,append,prependToLabel,appendToLabel,errorElement,errorClass,value,includeBlank,order,separator,startYear,endYear,monthDisplay,dateSeparator,dateOrder,timeSeparator,timeOrder,minuteStep,secondStep,association,position,twelveHour", skipStartingWith="label", content=loc.content, attributes=arguments) & loc.after;
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$yearMonthHourMinuteSecondSelectTagContent">
+ <cfscript>
+ var loc = {};
+ loc.args = {};
+ loc.args.value = arguments.counter;
+ if (arguments.value == arguments.counter)
+ loc.args.selected = "selected";
+ if (Len(arguments.$optionNames))
+ arguments.optionContent = ListGetAt(arguments.$optionNames, arguments.counter);
+ else
+ arguments.optionContent = arguments.counter;
+ if (arguments.$type == "minute" || arguments.$type == "second")
+ arguments.optionContent = NumberFormat(arguments.optionContent, "09");
+ </cfscript>
+ <cfreturn $element(name="option", content=arguments.optionContent, attributes=loc.args)>
+</cffunction>
+
+<cffunction name="$ampmSelectTag" returntype="string" access="public" output="false">
+ <cfargument name="name" type="string" required="true">
+ <cfargument name="value" type="string" required="true">
+ <cfargument name="$id" type="string" required="true">
+ <cfargument name="$now" type="date" required="false" default="#now()#">
+ <cfscript>
+ var loc = {};
+ loc.options = "AM,PM";
+ loc.optionContent = "";
+ if (!Len(arguments.value))
+ arguments.value = TimeFormat(arguments.$now, 'tt');
+ if (!StructKeyExists(arguments, "id"))
+ arguments.id = arguments.$id & "-ampm";
+ loc.content = "";
+
+ loc.iEnd = ListLen(loc.options);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.option = ListGetAt(loc.options, loc.i);
+
+ loc.args = {};
+ loc.args.value = loc.option;
+ if (arguments.value IS loc.option)
+ loc.args.selected = "selected";
+
+ loc.content = loc.content & $element(name="option", content=loc.option, attributes=loc.args);
+ }
+
+ loc.returnValue = $element(name="select", skip="objectName,property,label,labelPlacement,prepend,append,prependToLabel,appendToLabel,errorElement,errorClass,value,includeBlank,order,separator,startYear,endYear,monthDisplay,dateSeparator,dateOrder,timeSeparator,timeOrder,minuteStep,secondStep,association,position,twelveHour", skipStartingWith="label", content=loc.content, attributes=arguments);
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/view/formsdateobject.cfm b/src/main/webapp/wheels/view/formsdateobject.cfm new file mode 100755 index 0000000..137e371 --- /dev/null +++ b/src/main/webapp/wheels/view/formsdateobject.cfm @@ -0,0 +1,134 @@ +<cffunction name="dateSelect" returntype="string" access="public" output="false" hint="Builds and returns a string containing three select form controls for month, day, and year based on the supplied `objectName` and `property`."
+ examples=
+ '
+ <!--- View code --->
+ <cfoutput>
+ ##dateSelect(objectName="user", property="dateOfBirth")##
+ </cfoutput>
+
+ <!--- Show fields to select month and year --->
+ <cfoutput>
+ ##dateSelect(objectName="order", property="expirationDate", order="month,year")##
+ </cfoutput>
+ '
+ categories="view-helper,forms-object" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,textField,submitTag,radioButton,checkBox,passwordField,hiddenField,textArea,fileField,select,dateTimeSelect,timeSelect">
+ <cfargument name="objectName" type="any" required="false" default="" hint="See documentation for @textField.">
+ <cfargument name="property" type="string" required="false" default="" hint="See documentation for @textField.">
+ <cfargument name="association" type="string" required="false" hint="See documentation for @textfield.">
+ <cfargument name="position" type="string" required="false" hint="See documentation for @textfield.">
+ <cfargument name="order" type="string" required="false" hint="Use to change the order of or exclude date select tags.">
+ <cfargument name="separator" type="string" required="false" hint="Use to change the character that is displayed between the date select tags.">
+ <cfargument name="startYear" type="numeric" required="false" hint="First year in select list.">
+ <cfargument name="endYear" type="numeric" required="false" hint="Last year in select list.">
+ <cfargument name="monthDisplay" type="string" required="false" hint="Pass in `names`, `numbers`, or `abbreviations` to control display.">
+ <cfargument name="includeBlank" type="any" required="false" hint="See documentation for @select.">
+ <cfargument name="label" type="string" required="false" hint="The label text to use in the form control. The label will be applied to all `select` tags, but you can pass in a list to cutomize each one individually.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="errorElement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="errorClass" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="combine" type="boolean" required="false" hint="Set to `false` to not combine the select parts into a single `DateTime` object.">
+ <cfscript>
+ $args(name="dateSelect", args=arguments);
+ arguments.objectName = $objectName(argumentCollection=arguments);
+ arguments.$functionName = "dateSelect";
+ </cfscript>
+ <cfreturn $dateOrTimeSelect(argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="timeSelect" returntype="string" access="public" output="false" hint="Builds and returns a string containing three select form controls for hour, minute, and second based on the supplied `objectName` and `property`."
+ examples=
+ '
+ <!--- View code --->
+ <cfoutput>
+ ##timeSelect(objectName="business", property="openUntil")##
+ </cfoutput>
+
+ <!--- Show fields for hour and minute --->
+ <cfoutput>
+ ##timeSelect(objectName="business", property="openUntil", order="hour,minute")##
+ </cfoutput>
+
+ <!--- Only show 15-minute intervals --->
+ <cfoutput>
+ ##timeSelect(objectName="appointment", property="dateTimeStart", minuteStep=15)##
+ </cfoutput>
+ '
+ categories="view-helper,forms-object" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,submitTag,textField,radioButton,checkBox,passwordField,hiddenField,textArea,fileField,select,dateTimeSelect,dateSelect">
+ <cfargument name="objectName" type="any" required="false" default="" hint="See documentation for @textField.">
+ <cfargument name="property" type="string" required="false" default="" hint="See documentation for @textField.">
+ <cfargument name="association" type="string" required="false" hint="See documentation for @textfield.">
+ <cfargument name="position" type="string" required="false" hint="See documentation for @textfield.">
+ <cfargument name="order" type="string" required="false" hint="Use to change the order of or exclude time select tags.">
+ <cfargument name="separator" type="string" required="false" hint="Use to change the character that is displayed between the time select tags.">
+ <cfargument name="minuteStep" type="numeric" required="false" hint="Pass in `10` to only show minute 10, 20, 30, etc.">
+ <cfargument name="secondStep" type="numeric" required="false" hint="Pass in `10` to only show seconds 10, 20, 30, etc.">
+ <cfargument name="includeBlank" type="any" required="false" hint="See documentation for @select.">
+ <cfargument name="label" type="string" required="false" hint="See documentation for @dateSelect.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="errorElement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="errorClass" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="combine" type="boolean" required="false" hint="See documentation for @dateSelect.">
+ <cfargument name="twelveHour" type="boolean" required="false" default="false" hint="whether to display the hours in 24 or 12 hour format. 12 hour format has AM/PM drop downs">
+ <cfscript>
+ $args(name="timeSelect", args=arguments);
+ arguments.objectName = $objectName(argumentCollection=arguments);
+ arguments.$functionName = "timeSelect";
+ </cfscript>
+ <cfreturn $dateOrTimeSelect(argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="dateTimeSelect" returntype="string" access="public" output="false" hint="Builds and returns a string containing six select form controls (three for date selection and the remaining three for time selection) based on the supplied `objectName` and `property`."
+ examples=
+ '
+ <!--- View code --->
+ <cfoutput>
+ ##dateTimeSelect(objectName="article", property="publishedAt")##
+ </cfoutput>
+
+ <!--- Show fields for month, day, hour, and minute --->
+ <cfoutput>
+ ##dateTimeSelect(objectName="appointment", property="dateTimeStart", dateOrder="month,day", timeOrder="hour,minute")##
+ </cfoutput>
+ '
+ categories="view-helper,forms-object" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,submitTag,textField,radioButton,checkBox,passwordField,hiddenField,textArea,fileField,select,dateSelect,timeSelect">
+ <cfargument name="objectName" type="string" required="true" hint="See documentation for @textField.">
+ <cfargument name="property" type="string" required="true" hint="See documentation for @textField.">
+ <cfargument name="association" type="string" required="false" hint="See documentation for @textfield.">
+ <cfargument name="position" type="string" required="false" hint="See documentation for @textfield.">
+ <cfargument name="dateOrder" type="string" required="false" hint="Use to change the order of or exclude date select tags.">
+ <cfargument name="dateSeparator" type="string" required="false" hint="Use to change the character that is displayed between the date select tags.">
+ <cfargument name="startYear" type="numeric" required="false" hint="See documentation for @dateSelect.">
+ <cfargument name="endYear" type="numeric" required="false" hint="See documentation for @dateSelect.">
+ <cfargument name="monthDisplay" type="string" required="false" hint="See documentation for @dateSelect.">
+ <cfargument name="timeOrder" type="string" required="false" hint="Use to change the order of or exclude time select tags.">
+ <cfargument name="timeSeparator" type="string" required="false" hint="Use to change the character that is displayed between the time select tags.">
+ <cfargument name="minuteStep" type="numeric" required="false" hint="See documentation for @timeSelect.">
+ <cfargument name="secondStep" type="numeric" required="false" hint="See documentation for @timeSelect.">
+ <cfargument name="separator" type="string" required="false" hint="Use to change the character that is displayed between the first and second set of select tags.">
+ <cfargument name="includeBlank" type="any" required="false" hint="See documentation for @select.">
+ <cfargument name="label" type="string" required="false" hint="See documentation for @dateSelect.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="errorElement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="errorClass" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="combine" type="boolean" required="false" hint="See documentation for @dateSelect.">
+ <cfargument name="twelveHour" type="boolean" required="false" default="false" hint="See documentation for @timeSelect.">
+ <cfscript>
+ $args(name="dateTimeSelect", reserved="name", args=arguments);
+ arguments.objectName = $objectName(argumentCollection=arguments);
+ arguments.name = $tagName(arguments.objectName, arguments.property);
+ arguments.$functionName = "dateTimeSelect";
+ </cfscript>
+ <cfreturn dateTimeSelectTags(argumentCollection=arguments)>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/view/formsdateplain.cfm b/src/main/webapp/wheels/view/formsdateplain.cfm new file mode 100755 index 0000000..81b99e7 --- /dev/null +++ b/src/main/webapp/wheels/view/formsdateplain.cfm @@ -0,0 +1,412 @@ +<cffunction name="dateSelectTags" returntype="string" access="public" output="false" hint="Builds and returns a string containing three select form controls (month, day, and year) based on a `name` and `value`."
+ examples=
+ '
+ <!--- This "Tag" version of function accepts `name` and `selected` instead of binding to a model object --->
+ <cfoutput>
+ ##dateSelectTags(name="dateStart", selected=params.dateStart)##
+ </cfoutput>
+
+ <!--- Show fields for month and year only --->
+ <cfoutput>
+ ##dateSelectTags(name="expiration", selected=params.expiration, order="month,year")##
+ </cfoutput>
+ '
+ categories="view-helper,forms-plain" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,textFieldTag,submitTag,radioButtonTag,checkBoxTag,passwordFieldTag,hiddenFieldTag,textAreaTag,fileFieldTag,selectTag,dateTimeSelectTags,timeSelectTags">
+ <cfargument name="name" type="string" required="true" hint="See documentation for @textFieldTag.">
+ <cfargument name="selected" type="string" required="false" default="" hint="See documentation for @selectTag.">
+ <cfargument name="order" type="string" required="false" hint="See documentation for @dateSelect.">
+ <cfargument name="separator" type="string" required="false" hint="See documentation for @dateSelect.">
+ <cfargument name="startYear" type="numeric" required="false" hint="See documentation for @dateSelect.">
+ <cfargument name="endYear" type="numeric" required="false" hint="See documentation for @dateSelect.">
+ <cfargument name="monthDisplay" type="string" required="false" hint="See documentation for @dateSelect.">
+ <cfargument name="includeBlank" type="any" required="false" hint="See documentation for @select.">
+ <cfargument name="label" type="string" required="false" hint="See documentation for @dateSelect.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="combine" type="boolean" required="false" hint="See documentation for @dateSelect.">
+ <cfargument name="$now" type="date" required="false" default="#now()#">
+ <cfscript>
+ $args(name="dateSelectTags", args=arguments);
+ arguments.property = arguments.name;
+ arguments.objectName = {};
+ arguments.objectName[arguments.name] = arguments.selected;
+ StructDelete(arguments, "name");
+ StructDelete(arguments, "selected");
+ arguments.$functionName = "dateSelectTag";
+ </cfscript>
+ <cfreturn $dateOrTimeSelect(argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="timeSelectTags" returntype="string" access="public" output="false" hint="Builds and returns a string containing three select form controls for hour, minute, and second based on `name`."
+ examples=
+ '
+ <!--- This "Tag" version of function accepts `name` and `selected` instead of binding to a model object --->
+ <cfoutput>
+ ##timeSelectTags(name="timeOfMeeting" selected=params.timeOfMeeting)##
+ </cfoutput>
+
+ <!--- Show fields for `hour` and `minute` only --->
+ <cfoutput>
+ ##timeSelectTags(name="timeOfMeeting", selected=params.timeOfMeeting, order="hour,minute")##
+ </cfoutput>
+ '
+ categories="view-helper,forms-plain" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,submitTag,textFieldTag,radioButtonTag,checkBoxTag,passwordFieldTag,hiddenFieldTag,textAreaTag,fileFieldTag,selectTag,dateTimeSelectTags,dateSelectTags">
+ <cfargument name="name" type="string" required="true" hint="See documentation for @textFieldTag.">
+ <cfargument name="selected" type="string" required="false" default="" hint="See documentation for @selectTag.">
+ <cfargument name="order" type="string" required="false" hint="See documentation for @timeSelect.">
+ <cfargument name="separator" type="string" required="false" hint="See documentation for @timeSelect.">
+ <cfargument name="minuteStep" type="numeric" required="false" hint="See documentation for @timeSelect.">
+ <cfargument name="secondStep" type="numeric" required="false" hint="See documentation for @timeSelect.">
+ <cfargument name="includeBlank" type="any" required="false" hint="See documentation for @select.">
+ <cfargument name="label" type="string" required="false" hint="See documentation for @dateSelect.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="combine" type="boolean" required="false" hint="See documentation for @dateSelect.">
+ <cfargument name="twelveHour" type="boolean" required="false" default="false" hint="See documentation for @timeSelect.">
+ <cfscript>
+ $args(name="timeSelectTags", args=arguments);
+ arguments.property = arguments.name;
+ arguments.objectName = {};
+ arguments.objectName[arguments.name] = arguments.selected;
+ StructDelete(arguments, "name");
+ StructDelete(arguments, "selected");
+ arguments.$functionName = "timeSelectTag";
+ </cfscript>
+ <cfreturn $dateOrTimeSelect(argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="dateTimeSelectTags" returntype="string" access="public" output="false" hint="Builds and returns a string containing six select form controls (three for date selection and the remaining three for time selection) based on a `name`."
+ examples=
+ '
+ <!--- This "Tag" version of the function accepts a `name` and `selected` instead of binding to a model object --->
+ <cfoutput>
+ ##dateTimeSelectTags(name="dateTimeStart", selected=params.dateTimeStart)##
+ </cfoutput>
+
+ <!--- Show fields for month, day, hour, and minute --->
+ <cfoutput>
+ ##dateTimeSelectTags(name="dateTimeStart", selected=params.dateTimeStart, dateOrder="month,day", timeOrder="hour,minute")##
+ </cfoutput>
+ '
+ categories="view-helper,forms-plain" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,submitTag,textFieldTag,radioButtonTag,checkBoxTag,passwordFieldTag,hiddenFieldTag,textAreaTag,fileFieldTag,selectTag,dateSelectTags,timeSelectTags">
+ <cfargument name="name" type="string" required="true" hint="See documentation for @textFieldTag.">
+ <cfargument name="selected" type="string" required="false" default="" hint="See documentation for @selectTag.">
+ <cfargument name="dateOrder" type="string" required="false" hint="See documentation for @dateTimeSelect.">
+ <cfargument name="dateSeparator" type="string" required="false" hint="See documentation for @dateTimeSelect.">
+ <cfargument name="startYear" type="numeric" required="false" hint="See documentation for @dateSelect.">
+ <cfargument name="endYear" type="numeric" required="false" hint="See documentation for @dateSelect.">
+ <cfargument name="monthDisplay" type="string" required="false" hint="See documentation for @dateSelect.">
+ <cfargument name="timeOrder" type="string" required="false" hint="See documentation for @dateTimeSelect.">
+ <cfargument name="timeSeparator" type="string" required="false" hint="See documentation for @dateTimeSelect.">
+ <cfargument name="minuteStep" type="numeric" required="false" hint="See documentation for @timeSelect.">
+ <cfargument name="secondStep" type="numeric" required="false" hint="See documentation for @timeSelect.">
+ <cfargument name="separator" type="string" required="false" hint="See documentation for @dateTimeSelect.">
+ <cfargument name="includeBlank" type="any" required="false" hint="See documentation for @select.">
+ <cfargument name="label" type="string" required="false" hint="See documentation for @dateSelect.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="combine" type="boolean" required="false" hint="See documentation for @dateSelect.">
+ <cfargument name="twelveHour" type="boolean" required="false" default="false" hint="See documentation for @timeSelect.">
+ <cfscript>
+ var loc = {};
+ $args(name="dateTimeSelectTags", args=arguments);
+ loc.returnValue = "";
+ loc.separator = arguments.separator;
+ loc.label = arguments.label;
+
+ // create date portion
+ arguments.order = arguments.dateOrder;
+ arguments.separator = arguments.dateSeparator;
+ // when a list of 6 elements has been passed in as labels we assume the first 3 are meant to be placed on the date related tags
+ if (ListLen(loc.label) == 6)
+ arguments.label = ListGetAt(loc.label, 1) & "," & ListGetAt(loc.label, 2) & "," & ListGetAt(loc.label, 3);
+ if (StructKeyExists(arguments, "$functionName") && arguments.$functionName == "dateTimeSelect")
+ loc.returnValue = loc.returnValue & dateSelect(argumentCollection=arguments);
+ else
+ loc.returnValue = loc.returnValue & dateSelectTags(argumentCollection=arguments);
+
+ // separate date and time with a string ("-" by default)
+ loc.returnValue = loc.returnValue & loc.separator;
+
+ // create time portion
+ arguments.order = arguments.timeOrder;
+ arguments.separator = arguments.timeSeparator;
+ // when a list of 6 elements has been passed in as labels we assume the last 3 are meant to be placed on the time related tags
+ if (ListLen(loc.label) == 6)
+ arguments.label = ListGetAt(loc.label, 4) & "," & ListGetAt(loc.label, 5) & "," & ListGetAt(loc.label, 6);
+ if (StructKeyExists(arguments, "$functionName") && arguments.$functionName == "dateTimeSelect")
+ loc.returnValue = loc.returnValue & timeSelect(argumentCollection=arguments);
+ else
+ loc.returnValue = loc.returnValue & timeSelectTags(argumentCollection=arguments);
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="yearSelectTag" returntype="string" access="public" output="false" hint="Builds and returns a string containing a select form control for a range of years based on the supplied `name`."
+ examples=
+ '
+ <!--- View code --->
+ <cfoutput>
+ ##yearSelectTag(name="yearOfBirthday", selected=params.yearOfBirthday)##
+ </cfoutput>
+
+ <!--- Only allow selection of year to be for the past 50 years, minimum being 18 years ago --->
+ <cfset fiftyYearsAgo = Now() - 50>
+ <cfset eighteenYearsAgo = Now() - 18>
+ <cfoutput>
+ ##yearSelectTag(name="yearOfBirthday", selected=params.yearOfBirthday, startYear=fiftyYearsAgo, endYear=eighteenYearsAgo)##
+ </cfoutput>
+ '
+ categories="view-helper,forms-plain" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,submitTag,textFieldTag,radioButtonTag,checkBoxTag,passwordFieldTag,hiddenFieldTag,textAreaTag,fileFieldTag,selectTag,dateTimeSelectTags,dateSelectTags,timeSelectTags">
+ <cfargument name="name" type="string" required="true" hint="See documentation for @textFieldTag.">
+ <cfargument name="selected" type="string" required="false" default="" hint="The year that should be selected initially.">
+ <cfargument name="startYear" type="numeric" required="false" hint="See documentation for @dateSelect.">
+ <cfargument name="endYear" type="numeric" required="false" hint="See documentation for @dateSelect.">
+ <cfargument name="includeBlank" type="any" required="false" hint="See documentation for @select.">
+ <cfargument name="label" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="$now" type="date" required="false" default="#now()#">
+ <cfscript>
+ $args(name="yearSelectTag", args=arguments);
+ if (IsNumeric(arguments.selected))
+ {
+ arguments.selected = $dateForSelectTags("year", arguments.selected, arguments.$now);
+ }
+ arguments.order = "year";
+ </cfscript>
+ <cfreturn dateSelectTags(argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="monthSelectTag" returntype="string" access="public" output="false" hint="Builds and returns a string containing a select form control for the months of the year based on the supplied `name`."
+ examples=
+ '
+ <!--- This "Tag" version of the function accepts a `name` and `selected` instead of binding to a model object --->
+ <cfoutput>
+ ##monthSelectTag(name="monthOfBirthday", selected=params.monthOfBirthday)##
+ </cfoutput>
+ '
+ categories="view-helper,forms-plain" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,submitTag,textFieldTag,radioButtonTag,checkBoxTag,passwordFieldTag,hiddenFieldTag,textAreaTag,fileFieldTag,selectTag,dateTimeSelectTags,dateSelectTags,timeSelectTags">
+ <cfargument name="name" type="string" required="true" hint="See documentation for @textFieldTag.">
+ <cfargument name="selected" type="string" required="false" default="" hint="The month that should be selected initially.">
+ <cfargument name="monthDisplay" type="string" required="false" hint="See documentation for @dateSelect.">
+ <cfargument name="includeBlank" type="any" required="false" hint="See documentation for @select.">
+ <cfargument name="label" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="$now" type="date" required="false" default="#now()#">
+ <cfscript>
+ var loc = {};
+ $args(name="monthSelectTag", args=arguments);
+ if (IsNumeric(arguments.selected) and IsValid("range", arguments.selected, 0, 12))
+ {
+ arguments.selected = $dateForSelectTags("month", arguments.selected, arguments.$now);
+ }
+ arguments.order = "month";
+ </cfscript>
+ <cfreturn dateSelectTags(argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="daySelectTag" returntype="string" access="public" output="false" hint="Builds and returns a string containing a select form control for the days of the week based on the supplied `name`."
+ examples=
+ '
+ <!--- This "Tag" version of the function accepts a `name` and `selected` instead of binding to a model object --->
+ <cfoutput>
+ ##daySelectTag(name="dayOfWeek", selected=params.dayOfWeek)##
+ </cfoutput>
+ '
+ categories="view-helper,forms-plain" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,submitTag,textFieldTag,radioButtonTag,checkBoxTag,passwordFieldTag,hiddenFieldTag,textAreaTag,fileFieldTag,selectTag,dateTimeSelectTags,dateSelectTags,timeSelectTags">
+ <cfargument name="name" type="string" required="true" hint="See documentation for @textFieldTag.">
+ <cfargument name="selected" type="string" required="false" default="" hint="The day that should be selected initially.">
+ <cfargument name="includeBlank" type="any" required="false" hint="See documentation for @select.">
+ <cfargument name="label" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="$now" type="date" required="false" default="#now()#">
+ <cfscript>
+ $args(name="daySelectTag", args=arguments);
+ if (IsNumeric(arguments.selected) and IsValid("range", arguments.selected, 0, 31))
+ {
+ arguments.selected = $dateForSelectTags("day", arguments.selected, arguments.$now);
+ }
+ arguments.order = "day";
+ </cfscript>
+ <cfreturn dateSelectTags(argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="hourSelectTag" returntype="string" access="public" output="false" hint="Builds and returns a string containing one select form control for the hours of the day based on the supplied `name`."
+ examples=
+ '
+ <!--- This "Tag" version of the function accepts a `name` and `selected` instead of binding to a model object --->
+ <cfoutput>
+ ##hourSelectTag(name="hourOfMeeting", selected=params.hourOfMeeting)##
+ </cfoutput>
+
+ <!--- Show 12 hours instead of 24 --->
+ <cfoutput>
+ ##hourSelectTag(name="hourOfMeeting", selected=params.hourOfMeeting, twelveHour=true)##
+ </cfoutput>
+ '
+ categories="view-helper,forms-plain" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,submitTag,textFieldTag,radioButtonTag,checkBoxTag,passwordFieldTag,hiddenFieldTag,textAreaTag,fileFieldTag,selectTag,dateTimeSelectTags,dateSelectTags,timeSelectTags">
+ <cfargument name="name" type="string" required="true" hint="See documentation for @textFieldTag.">
+ <cfargument name="selected" type="string" required="false" default="" hint="The hour that should be selected initially.">
+ <cfargument name="includeBlank" type="any" required="false" hint="See documentation for @select.">
+ <cfargument name="label" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="twelveHour" type="boolean" required="false" default="false" hint="See documentation for @timeSelect.">
+ <cfargument name="$now" type="date" required="false" default="#now()#">
+ <cfscript>
+ $args(name="hourSelectTag", args=arguments);
+ if (IsNumeric(arguments.selected) and arguments.selected gte 0 and arguments.selected lt 60)
+ arguments.selected = createTime(arguments.selected, Minute(arguments.$now), Second(arguments.$now));
+ arguments.order = "hour";
+ </cfscript>
+ <cfreturn timeSelectTags(argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="minuteSelectTag" returntype="string" access="public" output="false" hint="Builds and returns a string containing one select form control for the minutes of an hour based on the supplied `name`."
+ examples=
+ '
+ <!--- This "Tag" version of the function accepts a `name` and `selected` instead of binding to a model object --->
+ <cfoutput>
+ ##minuteSelectTag(name="minuteOfMeeting", value=params.minuteOfMeeting)##
+ </cfoutput>
+
+ <!--- Only show 15-minute intervals --->
+ <cfoutput>
+ ##minuteSelectTag(name="minuteOfMeeting", value=params.minuteOfMeeting, minuteStep=15)##
+ </cfoutput>
+ '
+ categories="view-helper,forms-plain" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,submitTag,textFieldTag,radioButtonTag,checkBoxTag,passwordFieldTag,hiddenFieldTag,textAreaTag,fileFieldTag,selectTag,dateTimeSelectTags,dateSelectTags,timeSelectTags">
+ <cfargument name="name" type="string" required="true" hint="See documentation for @textFieldTag.">
+ <cfargument name="selected" type="string" required="false" default="" hint="The minute that should be selected initially.">
+ <cfargument name="minuteStep" type="numeric" required="false" hint="See documentation for @timeSelect.">
+ <cfargument name="includeBlank" type="any" required="false" hint="See documentation for @select.">
+ <cfargument name="label" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="$now" type="date" required="false" default="#now()#">
+ <cfscript>
+ $args(name="minuteSelectTag", args=arguments);
+ if (IsNumeric(arguments.selected) and arguments.selected gte 0 and arguments.selected lt 60)
+ {
+ arguments.selected = createTime(Hour(arguments.$now), arguments.selected, Second(arguments.$now));
+ }
+ arguments.order = "minute";
+ </cfscript>
+ <cfreturn timeSelectTags(argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="secondSelectTag" returntype="string" access="public" output="false" hint="Builds and returns a string containing one select form control for the seconds of a minute based on the supplied `name`."
+ examples=
+ '
+ <!--- This "Tag" version of the function accepts a `name` and `selected` instead of binding to a model object --->
+ <cfoutput>
+ ##secondSelectTag(name="secondsToLaunch", selected=params.secondsToLaunch)##
+ </cfoutput>
+
+ <!--- Only show 15-second intervals --->
+ <cfoutput>
+ ##secondSelectTag(name="secondsToLaunch", value=params.secondsToLaunch, secondStep=15)##
+ </cfoutput>
+ '
+ categories="view-helper,forms-plain" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,submitTag,textFieldTag,radioButtonTag,checkBoxTag,passwordFieldTag,hiddenFieldTag,textAreaTag,fileFieldTag,selectTag,dateTimeSelectTags,dateSelectTags,timeSelectTags">
+ <cfargument name="name" type="string" required="true" hint="See documentation for @textFieldTag.">
+ <cfargument name="selected" type="string" required="false" default="" hint="The second that should be selected initially.">
+ <cfargument name="secondStep" type="numeric" required="false" hint="See documentation for @timeSelect.">
+ <cfargument name="includeBlank" type="any" required="false" hint="See documentation for @select.">
+ <cfargument name="label" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="$now" type="date" required="false" default="#now()#">
+ <cfscript>
+ $args(name="secondSelectTag", args=arguments);
+ if (IsNumeric(arguments.selected) and arguments.selected gte 0 and arguments.selected lt 60)
+ arguments.selected = createTime(Hour(arguments.$now), Minute(arguments.$now), arguments.selected);
+ arguments.order = "second";
+ </cfscript>
+ <cfreturn timeSelectTags(argumentCollection=arguments)>
+</cffunction>
+
+<cffunction name="$dateForSelectTags" returntype="date" access="public" output="false">
+ <cfargument name="part" type="string" required="true">
+ <cfargument name="value" type="numeric" required="true">
+ <cfargument name="$now" type="date" required="true">
+ <cfscript>
+ var loc = {};
+ loc._year = year(arguments.$now);
+ loc._month = month(arguments.$now);
+ loc._day = day(arguments.$now);
+ loc.ret = arguments.$now;
+
+ switch(arguments.part)
+ {
+ case "year":
+ {
+ loc._year = arguments.value;
+ break;
+ }
+ case "month":
+ {
+ loc._month = arguments.value;
+ break;
+ }
+ case "day":
+ {
+ loc._day = arguments.value;
+ break;
+ }
+ }
+
+ // handle febuary
+ if (loc._month eq 2 && ((!IsLeapYear(loc._year) && loc._day gt 29) || (IsLeapYear(loc._year) && loc._day gt 28)))
+ {
+ if (IsLeapYear(loc._year))
+ {
+ loc._day = 29;
+ }
+ else
+ {
+ loc._day = 28;
+ }
+ }
+
+ try
+ {
+ loc.ret = createDate(loc._year, loc._month, loc._day);
+ }
+ catch (Any e)
+ {
+ loc.ret = arguments.$now;
+ }
+ </cfscript>
+ <cfreturn loc.ret>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/view/formsobject.cfm b/src/main/webapp/wheels/view/formsobject.cfm new file mode 100755 index 0000000..5a8afdc --- /dev/null +++ b/src/main/webapp/wheels/view/formsobject.cfm @@ -0,0 +1,584 @@ +<cffunction name="textField" returntype="string" access="public" output="false" hint="Builds and returns a string containing a text field form control based on the supplied `objectName` and `property`. Note: Pass any additional arguments like `class`, `rel`, and `id`, and the generated tag will also include those values as HTML attributes."
+ examples=
+ '
+ <!--- Provide a `label` and the required `objectName` and `property` --->
+ <cfoutput>
+ ##textField(label="First Name", objectName="user", property="firstName")##
+ </cfoutput>
+
+ <!--- Display fields for phone numbers provided by the `phoneNumbers` association and nested properties --->
+ <fieldset>
+ <legend>Phone Numbers</legend>
+ <cfloop from="1" to="##ArrayLen(contact.phoneNumbers)##" index="i">
+ ##textField(label="Phone ####i##", objectName="contact", association="phoneNumbers", position=i, property="phoneNumber")##
+ </cfloop>
+ </fieldset>
+ '
+ categories="view-helper,forms-object" chapters="form-helpers-and-showing-errors,nested-properties" functions="URLFor,startFormTag,endFormTag,submitTag,radioButton,checkBox,passwordField,hiddenField,textArea,fileField,select,dateTimeSelect,dateSelect,timeSelect">
+ <cfargument name="objectName" type="any" required="true" hint="The variable name of the object to build the form control for.">
+ <cfargument name="property" type="string" required="true" hint="The name of the property to use in the form control.">
+ <cfargument name="association" type="string" required="false" hint="The name of the association that the property is located on. Used for building nested forms that work with nested properties. If you are building a form with deep nesting, simply pass in a list to the nested object, and Wheels will figure it out.">
+ <cfargument name="position" type="string" required="false" hint="The position used when referencing a `hasMany` relationship in the `association` argument. Used for building nested forms that work with nested properties. If you are building a form with deep nestings, simply pass in a list of positions, and Wheels will figure it out.">
+ <cfargument name="label" type="string" required="false" hint="The label text to use in the form control.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="Whether to place the label `before`, `after`, or wrapped `around` the form control.">
+ <cfargument name="prepend" type="string" required="false" hint="String to prepend to the form control. Useful to wrap the form control with HTML tags.">
+ <cfargument name="append" type="string" required="false" hint="String to append to the form control. Useful to wrap the form control with HTML tags.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="String to prepend to the form control's `label`. Useful to wrap the form control with HTML tags.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="String to append to the form control's `label`. Useful to wrap the form control with HTML tags.">
+ <cfargument name="errorElement" type="string" required="false" hint="HTML tag to wrap the form control with when the object contains errors.">
+ <cfargument name="errorClass" type="string" required="false" hint="The class name of the HTML tag that wraps the form control when there are errors.">
+ <cfscript>
+ var loc = {};
+ $args(name="textField", reserved="type,name,value", args=arguments);
+ arguments.objectName = $objectName(argumentCollection=arguments);
+ if (!StructKeyExists(arguments, "id"))
+ arguments.id = $tagId(arguments.objectName, arguments.property);
+ loc.before = $formBeforeElement(argumentCollection=arguments);
+ loc.after = $formAfterElement(argumentCollection=arguments);
+ arguments.type = "text";
+ arguments.name = $tagName(arguments.objectName, arguments.property);
+ loc.maxlength = $maxLength(argumentCollection=arguments);
+ if (StructKeyExists(loc, "maxlength"))
+ arguments.maxlength = loc.maxlength;
+ arguments.value = $formValue(argumentCollection=arguments);
+ loc.returnValue = loc.before & $tag(name="input", close=true, skip="objectName,property,label,labelPlacement,prepend,append,prependToLabel,appendToLabel,errorElement,errorClass,association,position", skipStartingWith="label", attributes=arguments) & loc.after;
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="passwordField" returntype="string" access="public" output="false" hint="Builds and returns a string containing a password field form control based on the supplied `objectName` and `property`. Note: Pass any additional arguments like `class`, `rel`, and `id`, and the generated tag will also include those values as HTML attributes."
+ examples=
+ '
+ <!--- Provide a `label` and the required `objectName` and `property` --->
+ <cfoutput>
+ ##passwordField(label="Password", objectName="user", property="password")##
+ </cfoutput>
+
+ <!--- Display fields for passwords provided by the `passwords` association and nested properties --->
+ <fieldset>
+ <legend>Passwords</legend>
+ <cfloop from="1" to="##ArrayLen(user.passwords)##" index="i">
+ ##passwordField(label="Password ####i##", objectName="user", association="passwords", position=i, property="password")##
+ </cfloop>
+ </fieldset>
+ '
+ categories="view-helper,forms-object" chapter="form-helpers-and-showing-errors,nested-properties" functions="URLFor,startFormTag,endFormTag,submitTag,textField,radioButton,checkBox,hiddenField,textArea,fileField,select,dateTimeSelect,dateSelect,timeSelect">
+ <cfargument name="objectName" type="any" required="true" hint="See documentation for @textField.">
+ <cfargument name="property" type="string" required="true" hint="See documentation for @textField.">
+ <cfargument name="association" type="string" required="false" hint="See documentation for @textfield.">
+ <cfargument name="position" type="string" required="false" hint="See documentation for @textfield.">
+ <cfargument name="label" type="string" required="false" hint="See documentation for @textField">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="errorElement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="errorClass" type="string" required="false" hint="See documentation for @textField.">
+ <cfscript>
+ var loc = {};
+ $args(name="passwordField", reserved="type,name,value", args=arguments);
+ arguments.objectName = $objectName(argumentCollection=arguments);
+ if (!StructKeyExists(arguments, "id"))
+ arguments.id = $tagId(arguments.objectName, arguments.property);
+ loc.before = $formBeforeElement(argumentCollection=arguments);
+ loc.after = $formAfterElement(argumentCollection=arguments);
+ arguments.type = "password";
+ arguments.name = $tagName(arguments.objectName, arguments.property);
+ loc.maxlength = $maxLength(argumentCollection=arguments);
+ if (StructKeyExists(loc, "maxlength"))
+ arguments.maxlength = loc.maxlength;
+ arguments.value = $formValue(argumentCollection=arguments);
+ loc.returnValue = loc.before & $tag(name="input", close=true, skip="objectName,property,label,labelPlacement,prepend,append,prependToLabel,appendToLabel,errorElement,errorClass,association,position", skipStartingWith="label", attributes=arguments) & loc.after;
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="hiddenField" returntype="string" access="public" output="false" hint="Builds and returns a string containing a hidden field form control based on the supplied `objectName` and `property`. Note: Pass any additional arguments like `class`, `rel`, and `id`, and the generated tag will also include those values as HTML attributes."
+ examples=
+ '
+ <!--- Provide an `objectName` and `property` --->
+ <cfoutput>
+ ##hiddenField(objectName="user", property="id")##
+ </cfoutput>
+ '
+ categories="view-helper,forms-object" chapters="form-helpers-and-showing-errors,nested-properties" functions="URLFor,startFormTag,endFormTag,submitTag,textField,radioButton,checkBox,passwordField,textArea,fileField,select,dateTimeSelect,dateSelect,timeSelect">
+ <cfargument name="objectName" type="any" required="true" hint="See documentation for @textField.">
+ <cfargument name="property" type="string" required="true" hint="See documentation for @textField.">
+ <cfargument name="association" type="string" required="false" hint="See documentation for @textfield.">
+ <cfargument name="position" type="string" required="false" hint="See documentation for @textfield.">
+ <cfscript>
+ var loc = {};
+ $args(name="hiddenField", reserved="type,name,value", args=arguments);
+ arguments.objectName = $objectName(argumentCollection=arguments);
+ arguments.type = "hidden";
+ arguments.name = $tagName(arguments.objectName, arguments.property);
+ if (!StructKeyExists(arguments, "id"))
+ arguments.id = $tagId(arguments.objectName, arguments.property);
+ arguments.value = $formValue(argumentCollection=arguments);
+ if (application.wheels.obfuscateUrls && StructKeyExists(request.wheels, "currentFormMethod") && request.wheels.currentFormMethod == "get")
+ arguments.value = obfuscateParam(arguments.value);
+ loc.returnValue = $tag(name="input", close=true, skip="objectName,property,association,position", attributes=arguments);
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="fileField" returntype="string" access="public" output="false" hint="Builds and returns a string containing a file field form control based on the supplied `objectName` and `property`. Note: Pass any additional arguments like `class`, `rel`, and `id`, and the generated tag will also include those values as HTML attributes."
+ examples=
+ '
+ <!--- Provide a `label` and the required `objectName` and `property` --->
+ <cfoutput>
+ ##fileField(label="Photo", objectName="photo", property="imageFile")##
+ </cfoutput>
+
+ <!--- Display fields for photos provided by the `screenshots` association and nested properties --->
+ <fieldset>
+ <legend>Screenshots</legend>
+ <cfloop from="1" to="##ArrayLen(site.screenshots)##" index="i">
+ ##fileField(label="File ####i##", objectName="site", association="screenshots", position=i, property="file")##
+ ##textField(label="Caption ####i##", objectName="site", association="screenshots", position=i, property="caption")##
+ </cfloop>
+ </fieldset>
+ '
+ categories="view-helper,forms-object" chapters="form-helpers-and-showing-errors,nested-properties" functions="URLFor,startFormTag,endFormTag,submitTag,textField,radioButton,checkBox,passwordField,hiddenField,textArea,select,dateTimeSelect,dateSelect,timeSelect">
+ <cfargument name="objectName" type="any" required="true" hint="See documentation for @textField.">
+ <cfargument name="property" type="string" required="true" hint="See documentation for @textField.">
+ <cfargument name="association" type="string" required="false" hint="See documentation for @textfield.">
+ <cfargument name="position" type="string" required="false" hint="See documentation for @textfield.">
+ <cfargument name="label" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="errorElement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="errorClass" type="string" required="false" hint="See documentation for @textField.">
+ <cfscript>
+ var loc = {};
+ $args(name="fileField", reserved="type,name", args=arguments);
+ arguments.objectName = $objectName(argumentCollection=arguments);
+ if (!StructKeyExists(arguments, "id"))
+ arguments.id = $tagId(arguments.objectName, arguments.property);
+ loc.before = $formBeforeElement(argumentCollection=arguments);
+ loc.after = $formAfterElement(argumentCollection=arguments);
+ arguments.type = "file";
+ arguments.name = $tagName(arguments.objectName, arguments.property);
+ loc.returnValue = loc.before & $tag(name="input", close=true, skip="objectName,property,label,labelPlacement,prepend,append,prependToLabel,appendToLabel,errorElement,errorClass,association,position", skipStartingWith="label", attributes=arguments) & loc.after;
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="textArea" returntype="string" access="public" output="false" hint="Builds and returns a string containing a text area field form control based on the supplied `objectName` and `property`. Note: Pass any additional arguments like `class`, `rel`, and `id`, and the generated tag will also include those values as HTML attributes."
+ examples=
+ '
+ <!--- Provide `label` and required `objectName` and `property` --->
+ <cfoutput>
+ ##textArea(label="Overview", objectName="article", property="overview")##
+ </cfoutput>
+
+ <!--- Display fields for photos provided by the `screenshots` association and nested properties --->
+ <fieldset>
+ <legend>Screenshots</legend>
+ <cfloop from="1" to="##ArrayLen(site.screenshots)##" index="i">
+ ##fileField(label="File ####i##", objectName="site", association="screenshots", position=i, property="file")##
+ ##textArea(label="Caption ####i##", objectName="site", association="screenshots", position=i, property="caption")##
+ </cfloop>
+ </fieldset>
+ '
+ categories="view-helper,forms-object" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,submitTag,textField,radioButton,checkBox,passwordField,hiddenField,fileField,select,dateTimeSelect,dateSelect,timeSelect">
+ <cfargument name="objectName" type="any" required="true" hint="See documentation for @textField.">
+ <cfargument name="property" type="string" required="true" hint="See documentation for @textField.">
+ <cfargument name="association" type="string" required="false" hint="See documentation for @textfield.">
+ <cfargument name="position" type="string" required="false" hint="See documentation for @textfield.">
+ <cfargument name="label" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="errorElement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="errorClass" type="string" required="false" hint="See documentation for @textField.">
+ <cfscript>
+ var loc = {};
+ $args(name="textArea", reserved="name", args=arguments);
+ arguments.objectName = $objectName(argumentCollection=arguments);
+ if (!StructKeyExists(arguments, "id"))
+ arguments.id = $tagId(arguments.objectName, arguments.property);
+ loc.before = $formBeforeElement(argumentCollection=arguments);
+ loc.after = $formAfterElement(argumentCollection=arguments);
+ arguments.name = $tagName(arguments.objectName, arguments.property);
+ loc.content = $formValue(argumentCollection=arguments);
+ loc.returnValue = loc.before & $element(name="textarea", skip="objectName,property,label,labelPlacement,prepend,append,prependToLabel,appendToLabel,errorElement,errorClass,association,position", skipStartingWith="label", content=loc.content, attributes=arguments) & loc.after;
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="radioButton" returntype="string" access="public" output="false" hint="Builds and returns a string containing a radio button form control based on the supplied `objectName` and `property`. Note: Pass any additional arguments like `class`, `rel`, and `id`, and the generated tag will also include those values as HTML attributes."
+ examples=
+ '
+ <!--- Basic example view code --->
+ <cfoutput>
+ <fieldset>
+ <legend>Gender</legend>
+ ##radioButton(objectName="user", property="gender", tagValue="m", label="Male")##<br />
+ ##radioButton(objectName="user", property="gender", tagValue="f", label="Female")##
+ </fieldset>
+ </cfoutput>
+
+ <!--- Shows radio buttons for selecting the genders for all committee members provided by the `members` association and nested properties --->
+ <cfoutput>
+ <cfloop from="1" to="##ArrayLen(committee.members)##" index="i">
+ <div>
+ <h3>##committee.members[i].fullName##:</h3>
+ <div>
+ ##radioButton(objectName="committee", association="members", position=i, property="gender", tagValue="m", label="Male")##<br />
+ ##radioButton(objectName="committee", association="members", position=i, property="gender", tagValue="f", label="Female")##
+ </div>
+ </div>
+ </cfloop>
+ </cfoutput>
+ '
+ categories="view-helper,forms-object" chapters="form-helpers-and-showing-errors,nested-properties" functions="URLFor,startFormTag,endFormTag,textField,submitTag,checkBox,passwordField,hiddenField,textArea,fileField,select,dateTimeSelect,dateSelect,timeSelect">
+ <cfargument name="objectName" type="any" required="true" hint="See documentation for @textField.">
+ <cfargument name="property" type="string" required="true" hint="See documentation for @textField.">
+ <cfargument name="association" type="string" required="false" hint="See documentation for @textfield.">
+ <cfargument name="position" type="string" required="false" hint="See documentation for @textfield.">
+ <cfargument name="tagValue" type="string" required="true" hint="The value of the radio button when `selected`.">
+ <cfargument name="label" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="errorElement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="errorClass" type="string" required="false" hint="See documentation for @textField.">
+ <cfscript>
+ var loc = {};
+ $args(name="radioButton", reserved="type,name,value,checked", args=arguments);
+ arguments.objectName = $objectName(argumentCollection=arguments);
+ loc.valueToAppend = LCase(Replace(ReReplaceNoCase(arguments.tagValue, "[^a-z0-9- ]", "", "all"), " ", "-", "all"));
+ if (!StructKeyExists(arguments, "id"))
+ {
+ arguments.id = $tagId(arguments.objectName, arguments.property);
+ if (len(loc.valueToAppend))
+ arguments.id = arguments.id & "-" & loc.valueToAppend;
+ }
+ loc.before = $formBeforeElement(argumentCollection=arguments);
+ loc.after = $formAfterElement(argumentCollection=arguments);
+ arguments.type = "radio";
+ arguments.name = $tagName(arguments.objectName, arguments.property);
+ arguments.value = arguments.tagValue;
+ if (arguments.tagValue == $formValue(argumentCollection=arguments))
+ arguments.checked = "checked";
+ loc.returnValue = loc.before & $tag(name="input", close=true, skip="objectName,property,tagValue,label,labelPlacement,prepend,append,prependToLabel,appendToLabel,errorElement,errorClass,association,position", skipStartingWith="label", attributes=arguments) & loc.after;
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="checkBox" returntype="string" access="public" output="false" hint="Builds and returns a string containing a check box form control based on the supplied `objectName` and `property`. In most cases, this function generates a form field that should represent a `boolean` style field in your data. Use @checkBoxTag or @hasManyCheckBox to generate check boxes for selecting multiple values. Note: Pass any additional arguments like `class`, `rel`, and `id`, and the generated tag will also include those values as HTML attributes."
+ examples=
+ '
+ <!--- Basic example of a check box for a boolean field --->
+ <cfoutput>
+ ##checkBox(objectName="photo", property="isPublic", label="Display this photo publicly.")##
+ </cfoutput>
+
+ <!--- Shows check boxes for selecting public access for all photos provided by the `photos` association and nested properties --->
+ <cfoutput>
+ <cfloop from="1" to="##ArrayLen(user.photos)##" index="i">
+ <div>
+ <h3>##user.photos[i].title##:</h3>
+ <div>
+ ##checkBox(objectName="user", association="photos", position=i, property="isPublic", label="Display this photo publicly.")##
+ </div>
+ </div>
+ </cfloop>
+ </cfoutput>
+ '
+ categories="view-helper,forms-object" chapters="form-helpers-and-showing-errors,nested-properties" functions="URLFor,startFormTag,endFormTag,submitTag,textField,radioButton,passwordField,hiddenField,textArea,fileField,select,dateTimeSelect,dateSelect,timeSelect">
+ <cfargument name="objectName" type="any" required="true" hint="See documentation for @textField.">
+ <cfargument name="property" type="string" required="true" hint="See documentation for @textField.">
+ <cfargument name="association" type="string" required="false" hint="See documentation for @textfield.">
+ <cfargument name="position" type="string" required="false" hint="See documentation for @textfield.">
+ <cfargument name="checkedValue" type="string" required="false" hint="The value of the check box when it's in the `checked` state.">
+ <cfargument name="uncheckedValue" type="string" required="false" hint="The value of the check box when it's in the `unchecked` state.">
+ <cfargument name="label" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="errorElement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="errorClass" type="string" required="false" hint="See documentation for @textField.">
+ <cfscript>
+ var loc = {};
+ $args(name="checkBox", reserved="type,name,value,checked", args=arguments);
+ arguments.objectName = $objectName(argumentCollection=arguments);
+ if (!StructKeyExists(arguments, "id"))
+ arguments.id = $tagId(arguments.objectName, arguments.property);
+ loc.before = $formBeforeElement(argumentCollection=arguments);
+ loc.after = $formAfterElement(argumentCollection=arguments);
+ arguments.type = "checkbox";
+ arguments.name = $tagName(arguments.objectName, arguments.property);
+ arguments.value = arguments.checkedValue;
+ loc.value = $formValue(argumentCollection=arguments);
+ if (loc.value == arguments.value || IsNumeric(loc.value) && loc.value == 1 || !IsNumeric(loc.value) && IsBoolean(loc.value) && loc.value)
+ arguments.checked = "checked";
+ loc.returnValue = loc.before & $tag(name="input", close=true, skip="objectName,property,checkedValue,uncheckedValue,label,labelPlacement,prepend,append,prependToLabel,appendToLabel,errorElement,errorClass,association,position", skipStartingWith="label", attributes=arguments);
+ if (Len(arguments.uncheckedValue))
+ {
+ loc.hiddenAttributes = {};
+ loc.hiddenAttributes.type = "hidden";
+ loc.hiddenAttributes.id = arguments.id & "-checkbox";
+ loc.hiddenAttributes.name = arguments.name & "($checkbox)";
+ loc.hiddenAttributes.value = arguments.uncheckedValue;
+ loc.returnValue = loc.returnValue & $tag(name="input", close=true, attributes=loc.hiddenAttributes);
+ }
+ loc.returnValue = loc.returnValue & loc.after;
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="select" returntype="string" access="public" output="false" hint="Builds and returns a string containing a `select` form control based on the supplied `objectName` and `property`. Note: Pass any additional arguments like `class`, `rel`, and `id`, and the generated tag will also include those values as HTML attributes."
+ examples=
+ '
+ <!--- Example 1: Basic `select` field with `label` and required `objectName` and `property` arguments --->
+ <!--- - Controller code --->
+ <cfset authors = model("author").findAll()>
+
+ <!--- - View code --->
+ <cfoutput>
+ <p>##select(objectName="book", property="authorId", options=authors)##</p>
+ </cfoutput>
+
+ <!--- Example 2: Shows `select` fields for selecting order statuses for all shipments provided by the `orders` association and nested properties --->
+ <!--- - Controller code --->
+ <cfset shipment = model("shipment").findByKey(key=params.key, where="shipments.statusId=##application.NEW_STATUS_ID##", include="order")>
+ <cfset statuses = model("status").findAll(order="name")>
+
+ <!--- - View code --->
+ <cfoutput>
+ <cfloop from="1" to="##ArrayLen(shipments.orders)##" index="i">
+ ##select(label="Order ####shipments.orders[i].orderNum##", objectName="shipment", association="orders", position=i, property="statusId", options=statuses)##
+ </cfloop>
+ </cfoutput>
+ '
+ categories="view-helper,forms-object" chapters="form-helpers-and-showing-errors,nested-properties" functions="URLFor,startFormTag,endFormTag,submitTag,textField,radioButton,checkBox,passwordField,hiddenField,textArea,fileField,dateTimeSelect,dateSelect,timeSelect">
+ <cfargument name="objectName" type="any" required="true" hint="See documentation for @textField.">
+ <cfargument name="property" type="string" required="true" hint="See documentation for @textField.">
+ <cfargument name="association" type="string" required="false" hint="See documentation for @textfield.">
+ <cfargument name="position" type="string" required="false" hint="See documentation for @textfield.">
+ <cfargument name="options" type="any" required="true" hint="A collection to populate the select form control with. Can be a query recordset or an array of objects.">
+ <cfargument name="includeBlank" type="any" required="false" hint="Whether to include a blank option in the select form control. Pass `true` to include a blank line or a string that should represent what display text should appear for the empty value (for example, ""- Select One -"").">
+ <cfargument name="valueField" type="string" required="false" hint="The column or property to use for the value of each list element. Used only when a query or array of objects has been supplied in the `options` argument.">
+ <cfargument name="textField" type="string" required="false" hint="The column or property to use for the value of each list element that the end user will see. Used only when a query or array of objects has been supplied in the `options` argument.">
+ <cfargument name="label" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="errorElement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="errorClass" type="string" required="false" hint="See documentation for @textField.">
+ <cfscript>
+ var loc = {};
+ $args(name="select", reserved="name", args=arguments);
+ arguments.objectName = $objectName(argumentCollection=arguments);
+ if (!StructKeyExists(arguments, "id"))
+ arguments.id = $tagId(arguments.objectName, arguments.property);
+ loc.before = $formBeforeElement(argumentCollection=arguments);
+ loc.after = $formAfterElement(argumentCollection=arguments);
+ arguments.name = $tagName(arguments.objectName, arguments.property);
+ if (StructKeyExists(arguments, "multiple") and IsBoolean(arguments.multiple))
+ {
+ if (arguments.multiple)
+ arguments.multiple = "multiple";
+ else
+ StructDelete(arguments, "multiple");
+ }
+ loc.content = $optionsForSelect(argumentCollection=arguments);
+ if (!IsBoolean(arguments.includeBlank) || arguments.includeBlank)
+ {
+ if (!IsBoolean(arguments.includeBlank))
+ loc.blankOptionText = arguments.includeBlank;
+ else
+ loc.blankOptionText = "";
+ loc.blankOptionAttributes = {value=""};
+ loc.content = $element(name="option", content=loc.blankOptionText, attributes=loc.blankOptionAttributes) & loc.content;
+ }
+ loc.returnValue = loc.before & $element(name="select", skip="objectName,property,options,includeBlank,valueField,textField,label,labelPlacement,prepend,append,prependToLabel,appendToLabel,errorElement,errorClass,association,position", skipStartingWith="label", content=loc.content, attributes=arguments) & loc.after;
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$optionsForSelect" returntype="string" access="public" output="false">
+ <cfargument name="options" type="any" required="true">
+ <cfargument name="valueField" type="string" required="true">
+ <cfargument name="textField" type="string" required="true">
+ <cfscript>
+ var loc = {};
+ loc.value = $formValue(argumentCollection=arguments);
+ loc.returnValue = "";
+ if (IsQuery(arguments.options))
+ {
+ if (!Len(arguments.valueField) || !Len(arguments.textField))
+ {
+ // order the columns according to their ordinal position in the database table
+ loc.info = GetMetaData(arguments.options);
+ loc.iEnd = ArrayLen(loc.info);
+ loc.columns = "";
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ loc.columns = ListAppend(loc.columns, loc.info[loc.i].name);
+ if (!Len(loc.columns))
+ {
+ arguments.valueField = "";
+ arguments.textField = "";
+ }
+ else if (ListLen(loc.columns) == 1)
+ {
+ arguments.valueField = ListGetAt(loc.columns, 1);
+ arguments.textField = ListGetAt(loc.columns, 1);
+ }
+ else
+ {
+ // take the first numeric field in the query as the value field and the first non numeric as the text field
+ loc.iEnd = arguments.options.RecordCount;
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.jEnd = ListLen(loc.columns);
+ for (loc.j=1; loc.j <= loc.jEnd; loc.j++)
+ {
+ if (!Len(arguments.valueField) && IsNumeric(arguments.options[ListGetAt(loc.columns, loc.j)][loc.i]))
+ arguments.valueField = ListGetAt(loc.columns, loc.j);
+ if (!Len(arguments.textField) && !IsNumeric(arguments.options[ListGetAt(loc.columns, loc.j)][loc.i]))
+ arguments.textField = ListGetAt(loc.columns, loc.j);
+ }
+ }
+ if (!Len(arguments.valueField) || !Len(arguments.textField))
+ {
+ // the query does not contain both a numeric and a text column so we'll just use the first and second column instead
+ arguments.valueField = ListGetAt(loc.columns, 1);
+ arguments.textField = ListGetAt(loc.columns, 2);
+ }
+ }
+ }
+ loc.iEnd = arguments.options.RecordCount;
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.returnValue = loc.returnValue & $option(objectValue=loc.value, optionValue=arguments.options[arguments.valueField][loc.i], optionText=arguments.options[arguments.textField][loc.i]);
+ }
+ }
+ else if (IsStruct(arguments.options))
+ {
+ loc.sortedKeys = ListSort(StructKeyList(arguments.options), "textnocase"); // sort struct keys alphabetically
+ loc.iEnd = ListLen(loc.sortedKeys);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.key = ListGetAt(loc.sortedKeys, loc.i);
+ loc.returnValue = loc.returnValue & $option(objectValue=loc.value, optionValue=LCase(loc.key), optionText=arguments.options[loc.key]);
+ }
+ }
+ else
+ {
+ // convert the options to an array so we don't duplicate logic
+ if (IsSimpleValue(arguments.options))
+ arguments.options = ListToArray(arguments.options);
+
+ // loop through the array
+ loc.iEnd = ArrayLen(arguments.options);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.optionValue = "";
+ loc.optionText = "";
+ // see if the value in the array cell is an array, which means the programmer is using multidimensional arrays. if it is, use the first dimension for the key and the second for the value if it exists.
+ if (IsSimpleValue(arguments.options[loc.i]))
+ {
+ loc.optionValue = arguments.options[loc.i];
+ loc.optionText = humanize(arguments.options[loc.i]);
+ }
+ else if (IsArray(arguments.options[loc.i]) && ArrayLen(arguments.options[loc.i]) >= 2)
+ {
+ loc.optionValue = arguments.options[loc.i][1];
+ loc.optionText = arguments.options[loc.i][2];
+ }
+ else if (IsStruct(arguments.options[loc.i]) && StructKeyExists(arguments.options[loc.i], "value") && StructKeyExists(arguments.options[loc.i], "text"))
+ {
+ loc.optionValue = arguments.options[loc.i]["value"];
+ loc.optionText = arguments.options[loc.i]["text"];
+ }
+ else if (IsObject(arguments.options[loc.i]))
+ {
+ loc.object = arguments.options[loc.i];
+ if (!Len(arguments.valueField) || !Len(arguments.textField))
+ {
+ loc.propertyNames = loc.object.propertyNames();
+ loc.jEnd = ListLen(loc.propertyNames);
+ for (loc.j=1; loc.j <= loc.jEnd; loc.j++)
+ {
+ loc.propertyName = ListGetAt(loc.propertyNames, loc.j);
+ if (StructKeyExists(loc.object, loc.propertyName))
+ {
+ loc.propertyValue = loc.object[loc.propertyName];
+ if (!Len(arguments.valueField) && IsNumeric(loc.propertyValue))
+ arguments.valueField = loc.propertyName;
+ if (!Len(arguments.textField) && !IsNumeric(loc.propertyValue))
+ arguments.textField = loc.propertyName;
+ }
+ }
+
+ }
+ if (StructKeyExists(loc.object, arguments.valueField))
+ loc.optionValue = loc.object[arguments.valueField];
+ if (StructKeyExists(loc.object, arguments.textField))
+ loc.optionText = loc.object[arguments.textField];
+ }
+ else if (IsStruct(arguments.options[loc.i]))
+ {
+ loc.object = arguments.options[loc.i];
+ // if the struct only has one elment then use the key/value pair
+ if(StructCount(loc.object) eq 1)
+ {
+ loc.key = StructKeyList(loc.object);
+ loc.optionValue = loc.object[loc.key];
+ loc.optionText = LCase(loc.key);
+ }
+ else
+ {
+ if (StructKeyExists(loc.object, arguments.valueField))
+ {
+ loc.optionValue = loc.object[arguments.valueField];
+ }
+ if (StructKeyExists(loc.object, arguments.textField))
+ {
+ loc.optionText = loc.object[arguments.textField];
+ }
+ }
+ }
+ loc.returnValue = loc.returnValue & $option(objectValue=loc.value, optionValue=loc.optionValue, optionText=loc.optionText);
+ }
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$option" returntype="string" access="public" output="false">
+ <cfargument name="objectValue" type="string" required="true">
+ <cfargument name="optionValue" type="string" required="true">
+ <cfargument name="optionText" type="string" required="true">
+ <cfargument name="applyHtmlEditFormat" type="boolean" required="false" default="true" />
+ <cfscript>
+ var loc = {};
+ if (arguments.applyHtmlEditFormat)
+ {
+ arguments.optionValue = h(arguments.optionValue);
+ arguments.optionText = h(arguments.optionText);
+ }
+ loc.optionAttributes = {value=arguments.optionValue};
+ if (arguments.optionValue == arguments.objectValue || ListFindNoCase(arguments.objectValue, arguments.optionValue))
+ loc.optionAttributes.selected = "selected";
+ if (application.wheels.obfuscateUrls && StructKeyExists(request.wheels, "currentFormMethod") && request.wheels.currentFormMethod == "get")
+ loc.optionAttributes.value = obfuscateParam(loc.optionAttributes.value);
+ loc.returnValue = $element(name="option", content=arguments.optionText, attributes=loc.optionAttributes);
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/view/formsplain.cfm b/src/main/webapp/wheels/view/formsplain.cfm new file mode 100755 index 0000000..06fd279 --- /dev/null +++ b/src/main/webapp/wheels/view/formsplain.cfm @@ -0,0 +1,281 @@ +<cffunction name="textFieldTag" returntype="string" access="public" output="false" hint="Builds and returns a string containing a text field form control based on the supplied `name`. Note: Pass any additional arguments like `class`, `rel`, and `id`, and the generated tag will also include those values as HTML attributes."
+ examples=
+ '
+ <!--- Basic usage usually involves a `label`, `name`, and `value` --->
+ <cfoutput>
+ ##textFieldTag(label="Search", name="q", value=params.q)##
+ </cfoutput>
+ '
+ categories="view-helper,forms-plain" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,submitTag,radioButtonTag,checkBoxTag,passwordFieldTag,hiddenFieldTag,textAreaTag,fileFieldTag,selectTag,dateTimeSelectTags,dateSelectTags,timeSelectTags">
+ <cfargument name="name" type="string" required="true" hint="Name to populate in tag's `name` attribute.">
+ <cfargument name="value" type="string" required="false" default="" hint="Value to populate in tag's `value` attribute.">
+ <cfargument name="label" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfscript>
+ var loc = {};
+ $args(name="textFieldTag", args=arguments);
+ arguments.property = arguments.name;
+ arguments.objectName = {};
+ arguments.objectName[arguments.name] = arguments.value;
+ StructDelete(arguments, "name");
+ StructDelete(arguments, "value");
+ loc.returnValue = textField(argumentCollection=arguments);
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="passwordFieldTag" returntype="string" access="public" output="false" hint="Builds and returns a string containing a password field form control based on the supplied `name`. Note: Pass any additional arguments like `class`, `rel`, and `id`, and the generated tag will also include those values as HTML attributes."
+ examples=
+ '
+ <!--- Basic usage usually involves a `label`, `name`, and `value` --->
+ <cfoutput>
+ ##passwordFieldTag(label="Password", name="password", value=params.password)##
+ </cfoutput>
+ '
+ categories="view-helper,forms-plain" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,submitTag,textFieldTag,radioButtonTag,checkBoxTag,hiddenFieldTag,textAreaTag,fileFieldTag,selectTag,dateTimeSelectTags,dateSelectTags,timeSelectTags">
+ <cfargument name="name" type="string" required="true" hint="See documentation for @textFieldTag.">
+ <cfargument name="value" type="string" required="false" default="" hint="See documentation for @textFieldTag.">
+ <cfargument name="label" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfscript>
+ var loc = {};
+ $args(name="passwordFieldTag", args=arguments);
+ arguments.property = arguments.name;
+ arguments.objectName = {};
+ arguments.objectName[arguments.name] = arguments.value;
+ StructDelete(arguments, "name");
+ StructDelete(arguments, "value");
+ loc.returnValue = passwordField(argumentCollection=arguments);
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="hiddenFieldTag" returntype="string" access="public" output="false" hint="Builds and returns a string containing a hidden field form control based on the supplied `name`. Note: Pass any additional arguments like `class`, `rel`, and `id`, and the generated tag will also include those values as HTML attributes."
+ examples=
+ '
+ <!--- Basic usage usually involves a `name` and `value` --->
+ <cfoutput>
+ ##hiddenFieldTag(name="userId", value=user.id)##
+ </cfoutput>
+ '
+ categories="view-helper,forms-plain" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,submitTag,textFieldTag,radioButtonTag,checkBoxTag,passwordFieldTag,textAreaTag,fileFieldTag,selectTag,dateTimeSelectTags,dateSelectTags,timeSelectTags">
+ <cfargument name="name" type="string" required="true" hint="See documentation for @textFieldTag.">
+ <cfargument name="value" type="string" required="false" default="" hint="See documentation for @textFieldTag.">
+ <cfscript>
+ var loc = {};
+ arguments.property = arguments.name;
+ arguments.objectName = {};
+ arguments.objectName[arguments.name] = arguments.value;
+ StructDelete(arguments, "name");
+ StructDelete(arguments, "value");
+ loc.returnValue = hiddenField(argumentCollection=arguments);
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="fileFieldTag" returntype="string" access="public" output="false" hint="Builds and returns a string containing a file form control based on the supplied `name`. Note: Pass any additional arguments like `class`, `rel`, and `id`, and the generated tag will also include those values as HTML attributes."
+ examples=
+ '
+ <!--- Basic usage usually involves a `label`, `name`, and `value` --->
+ <cfoutput>
+ ##fileFieldTag(label="Photo", name="photo", value=params.photo)##
+ </cfoutput>
+ '
+ categories="view-helper,forms-plain" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,submitTag,textFieldTag,radioButtonTag,checkBoxTag,passwordFieldTag,hiddenFieldTag,textAreaTag,selectTag,dateTimeSelectTags,dateSelectTags,timeSelectTags">
+ <cfargument name="name" type="string" required="true" hint="See documentation for @textFieldTag.">
+ <cfargument name="label" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfscript>
+ var loc = {};
+ $args(name="fileFieldTag", args=arguments);
+ arguments.property = arguments.name;
+ arguments.objectName = {};
+ arguments.objectName[arguments.name] = "";
+ StructDelete(arguments, "name");
+ loc.returnValue = fileField(argumentCollection=arguments);
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="textAreaTag" returntype="string" access="public" output="false" hint="Builds and returns a string containing a text area form control based on the supplied `name`. Note: Pass any additional arguments like `class`, `rel`, and `id`, and the generated tag will also include those values as HTML attributes."
+ examples=
+ '
+ <!--- Basic usage usually involves a `label`, `name`, and `password` --->
+ <cfoutput>
+ ##textAreaTag(label="Description", name="description", value=params.description)##
+ </cfoutput>
+ '
+ categories="view-helper,forms-plain" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,submitTag,textFieldTag,radioButtonTag,checkBoxTag,passwordFieldTag,hiddenFieldTag,fileFieldTag,selectTag,dateTimeSelectTags,dateSelectTags,timeSelectTags">
+ <cfargument name="name" type="string" required="true" hint="See documentation for @textFieldTag.">
+ <cfargument name="content" type="string" required="false" default="" hint="Content to display in `textarea` on page load.">
+ <cfargument name="label" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfscript>
+ var loc = {};
+ $args(name="textAreaTag", args=arguments);
+ arguments.property = arguments.name;
+ arguments.objectName = {};
+ arguments.objectName[arguments.name] = arguments.content;
+ StructDelete(arguments, "name");
+ StructDelete(arguments, "content");
+ loc.returnValue = textArea(argumentCollection=arguments);
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="radioButtonTag" returntype="string" access="public" output="false" hint="Builds and returns a string containing a radio button form control based on the supplied `name`. Note: Pass any additional arguments like `class`, `rel`, and `id`, and the generated tag will also include those values as HTML attributes."
+ examples=
+ '
+ <!--- Basic usage usually involves a `label`, `name`, `value`, and `checked` value --->
+ <cfoutput>
+ <fieldset>
+ <legend>Gender</legend>
+ ##radioButtonTag(name="gender", value="m", label="Male", checked=true)##<br />
+ ##radioButtonTag(name="gender", value="f", label="Female")##
+ </fieldset>
+ </cfoutput>
+ '
+ categories="view-helper,forms-plain" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,submitTag,textFieldTag,checkBoxTag,passwordFieldTag,hiddenFieldTag,textAreaTag,fileFieldTag,selectTag,dateTimeSelectTags,dateSelectTags,timeSelectTags">
+ <cfargument name="name" type="string" required="true" hint="See documentation for @textFieldTag.">
+ <cfargument name="value" type="string" required="true" hint="See documentation for @textFieldTag.">
+ <cfargument name="checked" type="boolean" required="false" default="false" hint="Whether or not to check the radio button by default.">
+ <cfargument name="label" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfscript>
+ var loc = {};
+ $args(name="radioButtonTag", args=arguments);
+ arguments.property = arguments.name;
+ arguments.objectName = {};
+ arguments.tagValue = arguments.value;
+ if (arguments.checked)
+ arguments.objectName[arguments.name] = arguments.value;
+ else
+ arguments.objectName[arguments.name] = " "; // space added to allow a blank value while still not having the form control checked
+ StructDelete(arguments, "name");
+ StructDelete(arguments, "value");
+ StructDelete(arguments, "checked");
+ loc.returnValue = radioButton(argumentCollection=arguments);
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="checkBoxTag" returntype="string" access="public" output="false" hint="Builds and returns a string containing a check box form control based on the supplied `name`. Note: Pass any additional arguments like `class`, `rel`, and `id`, and the generated tag will also include those values as HTML attributes."
+ examples=
+ '
+ <!--- Example 1: Basic usage involves a `label`, `name`, and `value` --->
+ <cfoutput>
+ ##checkBoxTag(name="subscribe", value="true", label="Subscribe to our newsletter", checked=false)##
+ </cfoutput>
+
+ <!--- Example 2: Loop over a query to display choices and whether or not they are checked --->
+ <!--- - Controller code --->
+ <cfset pizza = model("pizza").findByKey(session.pizzaId)>
+ <cfset selectedToppings = pizza.toppings()>
+ <cfset toppings = model("topping").findAll(order="name")>
+
+ <!--- View code --->
+ <fieldset>
+ <legend>Toppings</legend>
+ <cfoutput query="toppings">
+ ##checkBoxTag(name="toppings", value="true", label=toppings.name, checked=YesNoFormat(ListFind(ValueList(selectedToppings.id), toppings.id))##
+ </cfoutput>
+ </fieldset>
+ '
+ categories="view-helper,forms-plain" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,submitTag,textFieldTag,radioButtonTag,passwordFieldTag,hiddenFieldTag,textAreaTag,fileFieldTag,selectTag,dateTimeSelectTag,dateSelectTag,timeSelectTag">
+ <cfargument name="name" type="string" required="true" hint="See documentation for @textFieldTag.">
+ <cfargument name="checked" type="boolean" required="false" default="false" hint="Whether or not the check box should be checked by default.">
+ <cfargument name="value" type="string" required="false" hint="Value of check box in its `checked` state.">
+ <cfargument name="uncheckedValue" type="string" required="false" default="" hint="The value of the check box when it's on the `unchecked` state.">
+ <cfargument name="label" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfscript>
+ var loc = {};
+ $args(name="checkBoxTag", args=arguments);
+ arguments.checkedValue = arguments.value;
+ arguments.property = arguments.name;
+ arguments.objectName = {};
+ if (arguments.checked)
+ arguments.objectName[arguments.name] = arguments.value;
+ else
+ arguments.objectName[arguments.name] = " "; // space added to allow a blank value while still not having the form control checked
+ if (!StructKeyExists(arguments, "id"))
+ {
+ loc.valueToAppend = LCase(Replace(ReReplaceNoCase(arguments.checkedValue, "[^a-z0-9- ]", "", "all"), " ", "-", "all"));
+ arguments.id = $tagId(arguments.objectName, arguments.property);
+ if (len(loc.valueToAppend))
+ arguments.id = arguments.id & "-" & loc.valueToAppend;
+ }
+ StructDelete(arguments, "name");
+ StructDelete(arguments, "value");
+ StructDelete(arguments, "checked");
+ loc.returnValue = checkBox(argumentCollection=arguments);
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="selectTag" returntype="string" access="public" output="false" hint="Builds and returns a string containing a select form control based on the supplied `name` and `options`. Note: Pass any additional arguments like `class`, `rel`, and `id`, and the generated tag will also include those values as HTML attributes."
+ examples=
+ '
+ <!--- Controller code --->
+ <cfset cities = model("city").findAll()>
+
+ <!--- View code --->
+ <cfoutput>
+ ##selectTag(name="cityId", options=cities)##
+ </cfoutput>
+
+ <!--- Do this when Wheels isn''t grabbing the correct values for the `option`s'' values and display texts --->
+ <cfoutput>
+ ##selectTag(name="cityId", options=cities, valueField="id", textField="name")##
+ </cfoutput>
+ '
+ categories="view-helper,forms-plain" chapters="form-helpers-and-showing-errors" functions="URLFor,startFormTag,endFormTag,submitTag,textFieldTag,radioButtonTag,checkBoxTag,passwordFieldTag,hiddenFieldTag,textAreaTag,fileFieldTag,dateTimeSelectTags,dateSelectTags,timeSelectTags">
+ <cfargument name="name" type="string" required="true" hint="See documentation for @textFieldTag.">
+ <cfargument name="options" type="any" required="true" hint="See documentation for @select.">
+ <cfargument name="selected" type="string" required="false" default="" hint="Value of option that should be selected by default.">
+ <cfargument name="includeBlank" type="any" required="false" hint="See documentation for @select.">
+ <cfargument name="multiple" type="boolean" required="false" hint="Whether to allow multiple selection of options in the select form control.">
+ <cfargument name="valueField" type="string" required="false" hint="See documentation for @select.">
+ <cfargument name="textField" type="string" required="false" hint="See documentation for @select.">
+ <cfargument name="label" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="labelPlacement" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prepend" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="append" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="prependToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfargument name="appendToLabel" type="string" required="false" hint="See documentation for @textField.">
+ <cfscript>
+ var loc = {};
+ $args(name="selectTag", args=arguments);
+ arguments.property = arguments.name;
+ arguments.objectName = {};
+ arguments.objectName[arguments.name] = arguments.selected;
+ StructDelete(arguments, "name");
+ StructDelete(arguments, "selected");
+ loc.returnValue = select(argumentCollection=arguments);
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/view/functions.cfm b/src/main/webapp/wheels/view/functions.cfm new file mode 100755 index 0000000..d056187 --- /dev/null +++ b/src/main/webapp/wheels/view/functions.cfm @@ -0,0 +1,14 @@ +<cfinclude template="assets.cfm">
+<cfinclude template="dates.cfm">
+<cfinclude template="errors.cfm">
+<cfinclude template="forms.cfm">
+<cfinclude template="formsassociation.cfm">
+<cfinclude template="formsdate.cfm">
+<cfinclude template="formsdateobject.cfm">
+<cfinclude template="formsdateplain.cfm">
+<cfinclude template="formsobject.cfm">
+<cfinclude template="formsplain.cfm">
+<cfinclude template="links.cfm">
+<cfinclude template="miscellaneous.cfm">
+<cfinclude template="sanitize.cfm">
+<cfinclude template="text.cfm">
\ No newline at end of file diff --git a/src/main/webapp/wheels/view/links.cfm b/src/main/webapp/wheels/view/links.cfm new file mode 100755 index 0000000..e1ce632 --- /dev/null +++ b/src/main/webapp/wheels/view/links.cfm @@ -0,0 +1,327 @@ +<cffunction name="linkTo" returntype="string" access="public" output="false" hint="Creates a link to another page in your application. Pass in the name of a `route` to use your configured routes or a `controller`/`action`/`key` combination. Note: Pass any additional arguments like `class`, `rel`, and `id`, and the generated tag will also include those values as HTML attributes."
+ examples=
+ '
+ ##linkTo(text="Log Out", controller="account", action="logout")##
+ -> <a href="/account/logout">Log Out</a>
+
+ <!--- if you''re already in the `account` controller, Wheels will assume that''s where you want the link to point --->
+ ##linkTo(text="Log Out", action="logout")##
+ -> <a href="/account/logout">Log Out</a>
+
+ ##linkTo(text="View Post", controller="blog", action="post", key=99)##
+ -> <a href="/blog/post/99">View Post</a>
+
+ ##linkTo(text="View Settings", action="settings", params="show=all&sort=asc")##
+ -> <a href="/account/settings?show=all&sort=asc">View Settings</a>
+
+ <!--- Given that a `userProfile` route has been configured in `config/routes.cfm` --->
+ ##linkTo(text="Joe''s Profile", route="userProfile", userName="joe")##
+ -> <a href="/user/joe">Joe''s Profile</a>
+
+ <!--- Link to an external website --->
+ ##linkTo(text="ColdFusion Framework", href="http://cfwheels.org/")##
+ -> <a href="http://cfwheels.org/">ColdFusion Framework</a>
+
+ <!--- Give the link `class` and `id` attributes --->
+ ##linkTo(text="Delete Post", action="delete", key=99, class="delete", id="delete-99")##
+ -> <a class="delete" href="/blog/delete/99" id="delete-99">Delete Post</a>
+ '
+ categories="view-helper,links" chapters="linking-pages" functions="URLFor,buttonTo,mailTo">
+ <cfargument name="text" type="string" required="false" default="" hint="The text content of the link.">
+ <cfargument name="confirm" type="string" required="false" default="" hint="Pass a message here to cause a JavaScript confirmation dialog box to pop up containing the message.">
+ <cfargument name="route" type="string" required="false" default="" hint="See documentation for @URLFor.">
+ <cfargument name="controller" type="string" required="false" default="" hint="See documentation for @URLFor.">
+ <cfargument name="action" type="string" required="false" default="" hint="See documentation for @URLFor.">
+ <cfargument name="key" type="any" required="false" default="" hint="See documentation for @URLFor.">
+ <cfargument name="params" type="string" required="false" default="" hint="See documentation for @URLFor.">
+ <cfargument name="anchor" type="string" required="false" default="" hint="See documentation for @URLFor.">
+ <cfargument name="onlyPath" type="boolean" required="false" hint="See documentation for @URLFor.">
+ <cfargument name="host" type="string" required="false" hint="See documentation for @URLFor.">
+ <cfargument name="protocol" type="string" required="false" hint="See documentation for @URLFor.">
+ <cfargument name="port" type="numeric" required="false" hint="See documentation for @URLFor.">
+ <cfargument name="href" type="string" required="false" hint="Pass a link to an external site here if you want to bypass the Wheels routing system altogether and link to an external URL.">
+ <cfscript>
+ var loc = {};
+ $args(name="linkTo", args=arguments);
+ if (Len(arguments.confirm))
+ {
+ loc.onclick = "return confirm('#JSStringFormat(arguments.confirm)#');";
+ arguments.onclick = $addToJavaScriptAttribute(name="onclick", content=loc.onclick, attributes=arguments);
+ }
+ if (!StructKeyExists(arguments, "href"))
+ arguments.href = URLFor(argumentCollection=arguments);
+ arguments.href = toXHTML(arguments.href);
+ if (!Len(arguments.text))
+ arguments.text = arguments.href;
+ loc.skip = "text,confirm,route,controller,action,key,params,anchor,onlyPath,host,protocol,port";
+ if (Len(arguments.route))
+ loc.skip = ListAppend(loc.skip, $routeVariables(argumentCollection=arguments)); // variables passed in as route arguments should not be added to the html element
+ loc.returnValue = $element(name="a", skip=loc.skip, content=arguments.text, attributes=arguments);
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="buttonTo" returntype="string" access="public" output="false" hint="Creates a form containing a single button that submits to the URL. The URL is built the same way as the @linkTo function."
+ examples=
+ '
+ ##buttonTo(text="Delete Account", action="perFormDelete", disable="Wait...")##
+ '
+ categories="view-helper,links" functions="URLFor,linkTo,mailTo">
+ <cfargument name="text" type="string" required="false" hint="The text content of the button.">
+ <cfargument name="confirm" type="string" required="false" hint="See documentation for @linkTo.">
+ <cfargument name="image" type="string" required="false" hint="If you want to use an image for the button pass in the link to it here (relative from the `images` folder).">
+ <cfargument name="disable" type="any" required="false" hint="Pass in `true` if you want the button to be disabled when clicked (can help prevent multiple clicks), or pass in a string if you want the button disabled and the text on the button updated (to ""please wait..."", for example).">
+ <cfargument name="route" type="string" required="false" default="" hint="See documentation for @URLFor.">
+ <cfargument name="controller" type="string" required="false" default="" hint="See documentation for @URLFor.">
+ <cfargument name="action" type="string" required="false" default="" hint="See documentation for @URLFor.">
+ <cfargument name="key" type="any" required="false" default="" hint="See documentation for @URLFor.">
+ <cfargument name="params" type="string" required="false" default="" hint="See documentation for @URLFor.">
+ <cfargument name="anchor" type="string" required="false" default="" hint="See documentation for @URLFor.">
+ <cfargument name="onlyPath" type="boolean" required="false" hint="See documentation for @URLFor.">
+ <cfargument name="host" type="string" required="false" hint="See documentation for @URLFor.">
+ <cfargument name="protocol" type="string" required="false" hint="See documentation for @URLFor.">
+ <cfargument name="port" type="numeric" required="false" hint="See documentation for @URLFor.">
+ <cfscript>
+ var loc = {};
+ $args(name="buttonTo", reserved="method", args=arguments);
+ arguments.action = URLFor(argumentCollection=arguments);
+ arguments.action = toXHTML(arguments.action);
+ arguments.method = "post";
+ if (Len(arguments.confirm))
+ {
+ loc.onsubmit = "return confirm('#JSStringFormat(arguments.confirm)#');";
+ arguments.onsubmit = $addToJavaScriptAttribute(name="onsubmit", content=loc.onsubmit, attributes=arguments);
+ }
+ loc.content = submitTag(value=arguments.text, image=arguments.image, disable=arguments.disable);
+ loc.skip = "disable,image,text,confirm,route,controller,key,params,anchor,onlyPath,host,protocol,port";
+ if (Len(arguments.route))
+ loc.skip = ListAppend(loc.skip, $routeVariables(argumentCollection=arguments)); // variables passed in as route arguments should not be added to the html element
+ loc.returnValue = $element(name="form", skip=loc.skip, content=loc.content, attributes=arguments);
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="mailTo" returntype="string" access="public" output="false" hint="Creates a `mailto` link tag to the specified email address, which is also used as the name of the link unless name is specified."
+ examples=
+ '
+ ##mailTo(emailAddress="webmaster@yourdomain.com", name="Contact our Webmaster")##
+ -> <a href="mailto:webmaster@yourdomain.com">Contact our Webmaster</a>
+ '
+ categories="view-helper,links" functions="URLFor,linkTo,buttonTo">
+ <cfargument name="emailAddress" type="string" required="true" hint="The email address to link to.">
+ <cfargument name="name" type="string" required="false" default="" hint='A string to use as the link text ("Joe" or "Support Department", for example).'>
+ <cfargument name="encode" type="boolean" required="false" hint="Pass `true` here to encode the email address, making it harder for bots to harvest it for example.">
+ <cfscript>
+ var loc = {};
+ $args(name="mailTo", reserved="href", args=arguments);
+ arguments.href = "mailto:#arguments.emailAddress#";
+ if (Len(arguments.name))
+ loc.content = arguments.name;
+ else
+ loc.content = arguments.emailAddress;
+ loc.returnValue = $element(name="a", skip="emailAddress,name,encode", content=loc.content, attributes=arguments);
+ if (arguments.encode)
+ {
+ loc.js = "document.write('#Trim(loc.returnValue)#');";
+ loc.encoded = "";
+ loc.iEnd = Len(loc.js);
+ for (loc.i=1; loc.i LTE loc.iEnd; loc.i=loc.i+1)
+ {
+ loc.encoded = loc.encoded & "%" & Right("0" & FormatBaseN(Asc(Mid(loc.js,loc.i,1)),16),2);
+ }
+ loc.content = "eval(unescape('#loc.encoded#'))";
+ loc.returnValue = $element(name="script", content=loc.content, type="text/javascript");
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="paginationLinks" returntype="string" access="public" output="false" hint="Builds and returns a string containing links to pages based on a paginated query. Uses @linkTo internally to build the link, so you need to pass in a `route` name or a `controller`/`action`/`key` combination. All other @linkTo arguments can be supplied as well, in which case they are passed through directly to @linkTo. If you have paginated more than one query in the controller, you can use the `handle` argument to reference them. (Don't forget to pass in a `handle` to the @findAll function in your controller first.)"
+ examples=
+ '
+ <!--- Example 1: List authors page by page, 25 at a time --->
+ <!--- Controller code --->
+ <cfparam name="params.page" default="1">
+ <cfset allAuthors = model("author").findAll(page=params.page, perPage=25, order="lastName")>
+
+ <!--- View code --->
+ <ul>
+ <cfoutput query="allAuthors">
+ <li>##firstName## ##lastName##</li>
+ </cfoutput>
+ </ul>
+ <cfoutput>##paginationLinks(action="listAuthors")##</cfoutput>
+
+ <!--- Example 2: Using the same model call above, show all authors with a window size of 5 --->
+ <!--- View code --->
+ <cfoutput>##paginationLinks(action="listAuthors", windowSize=5)##</cfoutput>
+
+ <!--- Example 3: If more than one paginated query is being run, then you need to reference the correct `handle` in the view --->
+ <!--- Controller code --->
+ <cfset allAuthors = model("author").findAll(handle="authQuery", page=5, order="id")>
+
+ <!--- View code --->
+ <ul>
+ <cfoutput>##paginationLinks(action="listAuthors", handle="authQuery", prependToLink="<li>", appendToLink="</li>")##</cfoutput>
+ </ul>
+
+ <!--- Example 4: Call to `paginationLinks` using routes --->
+ <!--- Route setup in config/routes.cfm --->
+ <cfset addRoute(name="paginatedCommentListing", pattern="blog/[year]/[month]/[day]/[page]", controller="theBlog", action="stats")>
+ <cfset addRoute(name="commentListing", pattern="blog/[year]/[month]/[day]", controller="theBlog", action="stats")>
+
+ <!--- Ccontroller code --->
+ <cfparam name="params.page" default="1">
+ <cfset comments = model("comment").findAll(page=params.page, order="createdAt")>
+
+ <!--- View code --->
+ <ul>
+ <cfoutput>##paginationLinks(route="paginatedCommentListing", year=2009, month="feb", day=10)##</cfoutput>
+ </ul>
+ '
+ categories="view-helper,links" chapters="getting-paginated-data,displaying-links-for-pagination" functions="pagination,setPagination,linkTo,findAll">
+ <cfargument name="windowSize" type="numeric" required="false" hint="The number of page links to show around the current page.">
+ <cfargument name="alwaysShowAnchors" type="boolean" required="false" hint="Whether or not links to the first and last page should always be displayed.">
+ <cfargument name="anchorDivider" type="string" required="false" hint="String to place next to the anchors on either side of the list.">
+ <cfargument name="linkToCurrentPage" type="boolean" required="false" hint="Whether or not the current page should be linked to.">
+ <cfargument name="prepend" type="string" required="false" hint="String or HTML to be prepended before result.">
+ <cfargument name="append" type="string" required="false" hint="String or HTML to be appended after result.">
+ <cfargument name="prependToPage" type="string" required="false" hint="String or HTML to be prepended before each page number.">
+ <cfargument name="prependOnFirst" type="boolean" required="false" hint="Whether or not to prepend the `prependToPage` string on the first page in the list.">
+ <cfargument name="prependOnAnchor" type="boolean" required="false" hint="Whether or not to prepend the `prependToPage` string on the anchors.">
+ <cfargument name="appendToPage" type="string" required="false" hint="String or HTML to be appended after each page number.">
+ <cfargument name="appendOnLast" type="boolean" required="false" hint="Whether or not to append the `appendToPage` string on the last page in the list.">
+ <cfargument name="appendOnAnchor" type="boolean" required="false" hint="Whether or not to append the `appendToPage` string on the anchors.">
+ <cfargument name="classForCurrent" type="string" required="false" hint="Class name for the current page number (if `linkToCurrentPage` is `true`, the class name will go on the `a` element. If not, a `span` element will be used).">
+ <cfargument name="handle" type="string" required="false" default="query" hint="The handle given to the query that the pagination links should be displayed for.">
+ <cfargument name="name" type="string" required="false" hint="The name of the param that holds the current page number.">
+ <cfargument name="showSinglePage" type="boolean" required="false" hint="Will show a single page when set to `true`. (The default behavior is to return an empty string when there is only one page in the pagination).">
+ <cfargument name="pageNumberAsParam" type="boolean" required="false" hint="Decides whether to link the page number as a param or as part of a route. (The default behavior is `true`).">
+
+ <cfscript>
+ var loc = {};
+ $args(name="paginationLinks", args=arguments);
+ loc.skipArgs = "windowSize,alwaysShowAnchors,anchorDivider,linkToCurrentPage,prepend,append,prependToPage,prependOnFirst,prependOnAnchor,appendToPage,appendOnLast,appendOnAnchor,classForCurrent,handle,name,showSinglePage,pageNumberAsParam";
+ loc.linkToArguments = Duplicate(arguments);
+ loc.iEnd = ListLen(loc.skipArgs);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ StructDelete(loc.linkToArguments, ListGetAt(loc.skipArgs, loc.i));
+ loc.currentPage = pagination(arguments.handle).currentPage;
+ loc.totalPages = pagination(arguments.handle).totalPages;
+ loc.start = "";
+ loc.middle = "";
+ loc.end = "";
+
+ if (StructKeyExists(arguments, "route"))
+ {
+ // when a route name is specified and the name argument is part
+ // of the route variables specified, we need to force the
+ // arguments.pageNumberAsParam to be false
+ loc.routeConfig = $findRoute(argumentCollection=arguments);
+ if (ListFindNoCase(loc.routeConfig.variables, arguments.name))
+ {
+ arguments.pageNumberAsParam = false;
+ }
+ }
+ if (arguments.showSinglePage || loc.totalPages > 1)
+ {
+ if (Len(arguments.prepend))
+ loc.start = loc.start & arguments.prepend;
+ if (arguments.alwaysShowAnchors)
+ {
+ if ((loc.currentPage - arguments.windowSize) > 1)
+ {
+ loc.pageNumber = 1;
+ if (!arguments.pageNumberAsParam)
+ {
+ loc.linkToArguments[arguments.name] = loc.pageNumber;
+ }
+ else
+ {
+ loc.linkToArguments.params = arguments.name & "=" & loc.pageNumber;
+ if (StructKeyExists(arguments, "params"))
+ loc.linkToArguments.params = loc.linkToArguments.params & "&" & arguments.params;
+ }
+ loc.linkToArguments.text = loc.pageNumber;
+ if (Len(arguments.prependToPage) && arguments.prependOnAnchor)
+ loc.start = loc.start & arguments.prependToPage;
+ loc.start = loc.start & linkTo(argumentCollection=loc.linkToArguments);
+ if (Len(arguments.appendToPage) && arguments.appendOnAnchor)
+ loc.start = loc.start & arguments.appendToPage;
+ loc.start = loc.start & arguments.anchorDivider;
+ }
+ }
+ loc.middle = "";
+ for (loc.i=1; loc.i <= loc.totalPages; loc.i++)
+ {
+ if ((loc.i >= (loc.currentPage - arguments.windowSize) && loc.i <= loc.currentPage) || (loc.i <= (loc.currentPage + arguments.windowSize) && loc.i >= loc.currentPage))
+ {
+ if (!arguments.pageNumberAsParam)
+ {
+ loc.linkToArguments[arguments.name] = loc.i;
+ }
+ else
+ {
+ loc.linkToArguments.params = arguments.name & "=" & loc.i;
+ if (StructKeyExists(arguments, "params"))
+ loc.linkToArguments.params = loc.linkToArguments.params & "&" & arguments.params;
+ }
+ loc.linkToArguments.text = loc.i;
+ if (Len(arguments.classForCurrent) && loc.currentPage == loc.i)
+ loc.linkToArguments.class = arguments.classForCurrent;
+ else
+ StructDelete(loc.linkToArguments, "class");
+ if (Len(arguments.prependToPage))
+ loc.middle = loc.middle & arguments.prependToPage;
+ if (loc.currentPage != loc.i || arguments.linkToCurrentPage)
+ {
+ loc.middle = loc.middle & linkTo(argumentCollection=loc.linkToArguments);
+ }
+ else
+ {
+ if (Len(arguments.classForCurrent))
+ loc.middle = loc.middle & $element(name="span", content=loc.i, class=arguments.classForCurrent);
+ else
+ loc.middle = loc.middle & loc.i;
+ }
+ if (Len(arguments.appendToPage))
+ loc.middle = loc.middle & arguments.appendToPage;
+ }
+ }
+ if (arguments.alwaysShowAnchors)
+ {
+ if (loc.totalPages > (loc.currentPage + arguments.windowSize))
+ {
+ if (!arguments.pageNumberAsParam)
+ {
+ loc.linkToArguments[arguments.name] = loc.totalPages;
+ }
+ else
+ {
+ loc.linkToArguments.params = arguments.name & "=" & loc.totalPages;
+ if (StructKeyExists(arguments, "params"))
+ loc.linkToArguments.params = loc.linkToArguments.params & "&" & arguments.params;
+ }
+ loc.linkToArguments.text = loc.totalPages;
+ loc.end = loc.end & arguments.anchorDivider;
+ if (Len(arguments.prependToPage) && arguments.prependOnAnchor)
+ loc.end = loc.end & arguments.prependToPage;
+ loc.end = loc.end & linkTo(argumentCollection=loc.linkToArguments);
+ if (Len(arguments.appendToPage) && arguments.appendOnAnchor)
+ loc.end = loc.end & arguments.appendToPage;
+ }
+ }
+ if (Len(arguments.append))
+ loc.end = loc.end & arguments.append;
+ }
+ if (Len(loc.middle))
+ {
+ if (Len(arguments.prependToPage) && !arguments.prependOnFirst)
+ loc.middle = Mid(loc.middle, Len(arguments.prependToPage)+1, Len(loc.middle)-Len(arguments.prependToPage));
+ if (Len(arguments.appendToPage) && !arguments.appendOnLast)
+ loc.middle = Mid(loc.middle, 1, Len(loc.middle)-Len(arguments.appendToPage));
+ }
+ loc.returnValue = loc.start & loc.middle & loc.end;
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/view/miscellaneous.cfm b/src/main/webapp/wheels/view/miscellaneous.cfm new file mode 100755 index 0000000..01949e5 --- /dev/null +++ b/src/main/webapp/wheels/view/miscellaneous.cfm @@ -0,0 +1,471 @@ +<cffunction name="contentFor" returntype="void" access="public" output="false" hint="Used to store a section's output for rendering within a layout. This content store acts as a stack, so you can store multiple pieces of content for a given section."
+ examples=
+ '
+ <!--- In your view --->
+ <cfsavecontent variable="mySidebar">
+ <h1>My Sidebar Text</h1>
+ </cfsavecontent>
+ <cfset contentFor(sidebar=mySidebar)>
+
+ <!--- In your layout --->
+ <html>
+ <head>
+ <title>My Site</title>
+ </head>
+ <body>
+
+ <cfoutput>
+ ##includeContent("sidebar")##
+
+ ##includeContent()##
+ </cfoutput>
+
+ </body>
+ </html>
+ '
+ categories="view-helper,miscellaneous" chapters="">
+ <cfargument name="position" type="any" required="false" default="last" hint="The position in the section's stack where you want the content placed. Valid values are `first`, `last`, or the numeric position.">
+ <cfargument name="overwrite" type="any" required="false" default="false" hint="Whether or not to overwrite any of the content. Valid values are `false`, `true`, or `all`.">
+ <cfset var loc = {}>
+
+ <!--- position in the array for the content --->
+ <cfset loc.position = "last">
+ <!--- should we overwrite or insert into the array --->
+ <cfset loc.overwrite = "false">
+
+ <!--- extract optional arguments --->
+ <cfif StructKeyExists(arguments, "position")>
+ <cfset loc.position = arguments.position>
+ <cfset StructDelete(arguments, "position", false)>
+ </cfif>
+
+ <cfif StructKeyExists(arguments, "overwrite")>
+ <cfset loc.overwrite = arguments.overwrite>
+ <cfset StructDelete(arguments, "overwrite", false)>
+ </cfif>
+
+ <!--- if no other arguments exists, exit --->
+ <cfif StructIsEmpty(arguments)>
+ <cfreturn>
+ </cfif>
+
+ <!--- since we're not going to know the name of the section, we have to get it dynamically --->
+ <cfset loc.section = ListFirst(StructKeyList(arguments))>
+ <cfset loc.content = arguments[loc.section]>
+
+ <cfif !IsBoolean(loc.overwrite)>
+ <cfset loc.overwrite = "all">
+ </cfif>
+
+ <cfif !StructKeyExists(variables.$instance.contentFor, loc.section) OR loc.overwrite eq "all">
+ <!--- if the section doesn't exists, or they want to overwrite the whole thing --->
+ <cfset variables.$instance.contentFor[loc.section] = []>
+ <cfset ArrayAppend(variables.$instance.contentFor[loc.section], loc.content)>
+ <cfelse>
+ <cfset loc.size = ArrayLen(variables.$instance.contentFor[loc.section])>
+ <!--- they want to append, prepend or insert at a specific point in the array --->
+ <!--- make sure position is within range --->
+ <cfif !IsNumeric(loc.position) AND !ListFindNoCase("first,last", loc.position)>
+ <cfset loc.position = "last">
+ </cfif>
+ <cfif IsNumeric(loc.position)>
+ <cfif loc.position lte 1>
+ <cfset loc.position = "first">
+ <cfelseif loc.position gte loc.size>
+ <cfset loc.position = "last">
+ </cfif>
+ </cfif>
+
+ <cfif loc.overwrite>
+ <cfif loc.position is "last">
+ <cfset loc.position = loc.size>
+ <cfelseif loc.position is "first">
+ <cfset loc.position = 1>
+ </cfif>
+ <cfset variables.$instance.contentFor[loc.section][loc.position] = loc.content>
+ <cfelse>
+ <cfif loc.position is "last">
+ <cfset ArrayAppend(variables.$instance.contentFor[loc.section], loc.content)>
+ <cfelseif loc.position is "first">
+ <cfset ArrayPrepend(variables.$instance.contentFor[loc.section], loc.content)>
+ <cfelse>
+ <cfset ArrayInsertAt(variables.$instance.contentFor[loc.section], loc.position, loc.content)>
+ </cfif>
+ </cfif>
+ </cfif>
+</cffunction>
+
+<cffunction name="includeLayout" returntype="string" access="public" output="false" hint="Includes the contents of another layout file. This is usually used to include a parent layout from within a child layout."
+ examples=
+ '
+ <!--- Make sure that the `sidebar` value is provided for the parent layout --->
+ <cfsavecontent variable="categoriesSidebar">
+ <cfoutput>
+ <ul>
+ ##includePartial(categories)##
+ </ul>
+ </cfoutput>
+ </cfsavecontent>
+ <cfset contentFor(sidebar=categoriesSidebar)>
+
+ <!--- Include parent layout at `views/layout.cfm` --->
+ <cfoutput>
+ ##includeLayout("/layout.cfm")##
+ </cfoutput>
+ '
+ categories="view-helper,miscellaneous" chapters="using-layouts" functions="usesLayout,renderPage">
+ <cfargument name="name" type="string" required="false" default="layout" hint="Name of the layout file to include.">
+ <cfscript>
+ arguments.partial = arguments.name;
+ StructDelete(arguments, "name");
+ arguments.$prependWithUnderscore = false;
+ return includePartial(argumentCollection=arguments);
+ </cfscript>
+</cffunction>
+
+<cffunction name="includePartial" returntype="string" access="public" output="false" hint="Includes the specified partial file in the view. Similar to using `cfinclude` but with the ability to cache the result and use Wheels-specific file look-up. By default, Wheels will look for the file in the current controller's view folder. To include a file relative from the base `views` folder, you can start the path supplied to `name` with a forward slash."
+ examples=
+ '
+ <cfoutput>##includePartial("login")##</cfoutput>
+ -> If we''re in the "admin" controller, Wheels will include the file "views/admin/_login.cfm".
+
+ <cfoutput>##includePartial(partial="misc/doc", cache=30)##</cfoutput>
+ -> If we''re in the "admin" controller, Wheels will include the file "views/admin/misc/_doc.cfm" and cache it for 30 minutes.
+
+ <cfoutput>##includePartial(partial="/shared/button")##</cfoutput>
+ -> Wheels will include the file "views/shared/_button.cfm".
+ '
+ categories="view-helper,miscellaneous" chapters="pages,partials" functions="renderPartial">
+ <cfargument name="partial" type="any" required="true" hint="See documentation for @renderPartial.">
+ <cfargument name="group" type="string" required="false" default="" hint="If passing a query result set for the `partial` argument, use this to specify the field to group the query by. A new query will be passed into the partial template for you to iterate over.">
+ <cfargument name="cache" type="any" required="false" default="" hint="See documentation for @renderPage.">
+ <cfargument name="layout" type="string" required="false" hint="See documentation for @renderPage.">
+ <cfargument name="spacer" type="string" required="false" hint="HTML or string to place between partials when called using a query.">
+ <cfargument name="dataFunction" type="any" required="false" hint="Name of controller function to load data from.">
+ <cfargument name="$prependWithUnderscore" type="boolean" required="false" default="true">
+ <cfset $args(name="includePartial", args=arguments)>
+ <cfreturn $includeOrRenderPartial(argumentCollection=$dollarify(arguments, "partial,group,cache,layout,spacer,dataFunction"))>
+</cffunction>
+
+<cffunction name="cycle" returntype="string" access="public" output="false" hint="Cycles through list values every time it is called."
+ examples=
+ '
+ <!--- Alternating table row colors --->
+ <table>
+ <thead>
+ <tr>
+ <th>Name</th>
+ <th>Phone</th>
+ </tr>
+ </thead>
+ <tbody>
+ <cfoutput query="employees">
+ <tr class="##cycle("odd,even")##">
+ <td>##employees.name##</td>
+ <td>##employees.phone##</td>
+ </tr>
+ </cfoutput>
+ </tbody>
+ </table>
+
+ <!--- Alternating row colors and shrinking emphasis --->
+ <cfoutput query="employees" group="departmentId">
+ <div class="##cycle(values="even,odd", name="row")##">
+ <ul>
+ <cfoutput>
+ <cfset rank = cycle(values="president,vice-president,director,manager,specialist,intern", name="position")>
+ <li class="##rank##">##categories.categoryName##</li>
+ <cfset resetCycle("emphasis")>
+ </cfoutput>
+ </ul>
+ </div>
+ </cfoutput>
+ '
+ categories="view-helper,miscellaneous" functions="resetCycle">
+ <cfargument name="values" type="string" required="true" hint="List of values to cycle through.">
+ <cfargument name="name" type="string" required="false" default="default" hint="Name to give the cycle. Useful when you use multiple cycles on a page.">
+ <cfscript>
+ var loc = {};
+ if (!StructKeyExists(request.wheels, "cycle"))
+ request.wheels.cycle = {};
+ if (!StructKeyExists(request.wheels.cycle, arguments.name))
+ {
+ request.wheels.cycle[arguments.name] = ListGetAt(arguments.values, 1);
+ }
+ else
+ {
+ loc.foundAt = ListFindNoCase(arguments.values, request.wheels.cycle[arguments.name]);
+ if (loc.foundAt == ListLen(arguments.values))
+ loc.foundAt = 0;
+ request.wheels.cycle[arguments.name] = ListGetAt(arguments.values, loc.foundAt + 1);
+ }
+ loc.returnValue = request.wheels.cycle[arguments.name];
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="resetCycle" returntype="void" access="public" output="false" hint="Resets a cycle so that it starts from the first list value the next time it is called."
+ examples=
+ '
+ <!--- alternating row colors and shrinking emphasis --->
+ <cfoutput query="employees" group="departmentId">
+ <div class="##cycle(values="even,odd", name="row")##">
+ <ul>
+ <cfoutput>
+ <cfset rank = cycle(values="president,vice-president,director,manager,specialist,intern", name="position")>
+ <li class="##rank##">##categories.categoryName##</li>
+ <cfset resetCycle("emphasis")>
+ </cfoutput>
+ </ul>
+ </div>
+ </cfoutput>
+ '
+ categories="view-helper,miscellaneous" functions="cycle"
+ >
+ <cfargument name="name" type="string" required="false" default="default" hint="The name of the cycle to reset.">
+ <cfscript>
+ if (StructKeyExists(request.wheels, "cycle") && StructKeyExists(request.wheels.cycle, arguments.name))
+ StructDelete(request.wheels.cycle, arguments.name);
+ </cfscript>
+</cffunction>
+
+<cffunction name="$tag" returntype="string" access="public" output="false" hint="Creates a HTML tag with attributes.">
+ <cfargument name="name" type="string" required="true" hint="The name of the HTML tag.">
+ <cfargument name="attributes" type="struct" required="false" default="#StructNew()#" hint="The attributes and their values">
+ <cfargument name="close" type="boolean" required="false" default="false" hint="Whether or not to close the tag (self-close) or just end it with a bracket.">
+ <cfargument name="skip" type="string" required="false" default="" hint="List of attributes that should not be placed in the HTML tag.">
+ <cfargument name="skipStartingWith" type="string" required="false" default="" hint="If you want to skip attributes that start with a specific string you can specify it here.">
+ <cfscript>
+ var loc = {};
+
+ // start the HTML tag and give it its name
+ loc.returnValue = "<" & arguments.name;
+
+ // if named arguments are passed in we add these to the attributes argument instead so we can handle them all in the same code below
+ if (StructCount(arguments) gt 5)
+ {
+ for (loc.key in arguments)
+ {
+ if (!ListFindNoCase("name,attributes,close,skip,skipStartingWith", loc.key))
+ {
+ arguments.attributes[loc.key] = arguments[loc.key];
+ }
+ }
+ }
+
+ // add the names of the attributes and their values to the output string with a space in between (class="something" name="somethingelse" etc)
+ // since the order of a struct can differ we sort the attributes in alphabetical order before placing them in the HTML tag (we could just place them in random order in the HTML but that would complicate testing for example)
+ loc.sortedKeys = ListSort(StructKeyList(arguments.attributes), "textnocase");
+ loc.iEnd = ListLen(loc.sortedKeys);
+
+ for (loc.i=1; loc.i lte loc.iEnd; loc.i++)
+ {
+ loc.key = ListGetAt(loc.sortedKeys, loc.i);
+ // place the attribute name and value in the string unless it should be skipped according to the arguments or if it's an internal argument (starting with a "$" sign)
+ if (!ListFindNoCase(arguments.skip, loc.key) && (!Len(arguments.skipStartingWith) || Left(loc.key, Len(arguments.skipStartingWith)) != arguments.skipStartingWith) && Left(loc.key, 1) != "$")
+ {
+ // replace boolean arguments for the disabled and readonly attributs with the key (if true) or skip putting it in the output altogether (if false)
+ if (ListFindNoCase("disabled,readonly", loc.key) and IsBoolean(arguments.attributes[loc.key]))
+ {
+ if (arguments.attributes[loc.key])
+ {
+ loc.returnValue &= $tagAttribute(loc.key, LCase(loc.key));
+ }
+ }
+ else
+ {
+ loc.returnValue &= $tagAttribute(loc.key, arguments.attributes[loc.key]);
+ }
+ }
+ }
+
+ // close the tag (usually done on self-closing tags like "img" for example) or just end it (for tags like "div" for example)
+ if (arguments.close)
+ {
+ loc.returnValue &= " />";
+ }
+ else
+ {
+ loc.returnValue &= ">";
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$tagAttribute" returntype="string" access="public" output="false">
+ <cfargument name="name" type="string" required="true">
+ <cfargument name="value" type="string" required="true">
+ <cfreturn ' #LCase(arguments.name)#="#arguments.value#"'>
+</cffunction>
+
+<cffunction name="$element" returntype="string" access="public" output="false">
+ <cfargument name="name" type="string" required="true">
+ <cfargument name="attributes" type="struct" required="false" default="#StructNew()#">
+ <cfargument name="content" type="string" required="false" default="">
+ <cfargument name="skip" type="string" required="false" default="">
+ <cfargument name="skipStartingWith" type="string" required="false" default="">
+ <cfscript>
+ var returnValue = "";
+ returnValue = arguments.content;
+ StructDelete(arguments, "content");
+ returnValue = $tag(argumentCollection=arguments) & returnValue & "</" & arguments.name & ">";
+ </cfscript>
+ <cfreturn returnValue>
+</cffunction>
+
+<cffunction name="$objectName" returntype="any" access="public" output="false">
+ <cfargument name="objectName" type="any" required="true">
+ <cfargument name="association" type="string" required="false" default="">
+ <cfargument name="position" type="string" required="false" default="">
+ <cfscript>
+ var loc = {};
+ loc.currentModelObject = false;
+ loc.hasManyAssociationCount = 0;
+ // combine our arguments
+ $combineArguments(args=arguments, combine="positions,position");
+ $combineArguments(args=arguments, combine="associations,association");
+ // only try to create the object name if we have a simple value
+ if (IsSimpleValue(arguments.objectName) && ListLen(arguments.associations))
+ {
+ for (loc.i = 1; loc.i lte ListLen(arguments.associations); loc.i++)
+ {
+ loc.association = ListGetAt(arguments.associations, loc.i);
+ loc.currentModelObject = $getObject(arguments.objectName);
+ arguments.objectName = arguments.objectName & "['" & loc.association & "']";
+ loc.expanded = loc.currentModelObject.$expandedAssociations(include=loc.association);
+ loc.expanded = loc.expanded[1];
+ // is this assocication a hasMany?
+ if (loc.expanded.type == "hasMany")
+ {
+ loc.hasManyAssociationCount++;
+ if (loc.hasManyAssociationCount gt ListLen(arguments.positions) && application.wheels.showErrorInformation)
+ $throw(type="Wheels.InvalidArgument", message="You passed the hasMany association of `#loc.association#` but did not provide a corresponding position.");
+ arguments.objectName = arguments.objectName & "[" & ListGetAt(arguments.positions, loc.hasManyAssociationCount) & "]";
+ }
+ }
+ }
+ </cfscript>
+ <cfreturn arguments.objectName>
+</cffunction>
+
+<cffunction name="$tagId" returntype="string" access="public" output="false">
+ <cfargument name="objectName" type="any" required="true">
+ <cfargument name="property" type="string" required="true">
+ <cfargument name="valueToAppend" type="string" default="">
+ <cfscript>
+ var loc = {};
+ if (IsSimpleValue(arguments.objectName))
+ {
+ // form element for object(s)
+ loc.returnValue = ListLast(arguments.objectName, ".");
+ if (Find("[", loc.returnValue))
+ loc.returnValue = $swapArrayPositionsForIds(objectName=loc.returnValue);
+ if (Find("($", arguments.property))
+ arguments.property = ReplaceList(arguments.property, "($,)", "-,");
+ if (Find("[", arguments.property))
+ loc.returnValue = REReplace(REReplace(loc.returnValue & arguments.property, "[,\[]", "-", "all"), "[""'\]]", "", "all");
+ else
+ loc.returnValue = REReplace(REReplace(loc.returnValue & "-" & arguments.property, "[,\[]", "-", "all"), "[""'\]]", "", "all");
+ }
+ else
+ {
+ loc.returnValue = ReplaceList(arguments.property, "[,($,],',"",)", "-,-,");
+ }
+ if (Len(arguments.valueToAppend))
+ loc.returnValue = loc.returnValue & "-" & arguments.valueToAppend;
+ </cfscript>
+ <cfreturn REReplace(loc.returnValue, "-+", "-", "all")>
+</cffunction>
+
+<cffunction name="$tagName" returntype="string" access="public" output="false">
+ <cfargument name="objectName" type="any" required="true">
+ <cfargument name="property" type="string" required="true">
+ <cfscript>
+ var loc = {};
+ if (IsSimpleValue(arguments.objectName))
+ {
+ loc.returnValue = ListLast(arguments.objectName, ".");
+ if (Find("[", loc.returnValue))
+ loc.returnValue = $swapArrayPositionsForIds(objectName=loc.returnValue);
+ if (Find("[", arguments.property))
+ loc.returnValue = ReplaceList(loc.returnValue & arguments.property, "',""", "");
+ else
+ loc.returnValue = ReplaceList(loc.returnValue & "[" & arguments.property & "]", "',""", "");
+ }
+ else
+ {
+ loc.returnValue = arguments.property;
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$swapArrayPositionsForIds" returntype="string" access="public" output="false">
+ <cfargument name="objectName" type="any" required="true" />
+ <cfscript>
+ var loc = {};
+ loc.returnValue = arguments.objectName;
+
+ // we could have multiple nested arrays so we need to traverse the objectName to find where we have array positions and
+ // swap all of the out for object ids
+ loc.array = ListToArray(ReplaceList(loc.returnValue, "],'", ""), "[", true);
+ loc.iEnd = ArrayLen(loc.array);
+ for (loc.i = 1; loc.i lte loc.iEnd; loc.i++)
+ {
+ if (REFind("\d", loc.array[loc.i])) // if we find a digit, we need to replace it with an id
+ {
+ // build our object reference
+ loc.objectReference = "";
+ for (loc.j = 1; loc.j lte loc.i; loc.j++)
+ loc.objectReference = ListAppend(loc.objectReference, ListGetAt(arguments.objectName, loc.j, "["), "[");
+ loc.returnValue = ListSetAt(loc.returnValue, loc.i, $getObject(loc.objectReference).key($returnTickCountWhenNew=true) & "]", "[");
+ }
+ }
+ </cfscript>
+ <cfreturn loc.returnValue />
+</cffunction>
+
+<cffunction name="$addToJavaScriptAttribute" returntype="string" access="public" output="false">
+ <cfargument name="name" type="string" required="true">
+ <cfargument name="content" type="string" required="true">
+ <cfargument name="attributes" type="struct" required="true">
+ <cfscript>
+ var loc = {};
+ if (StructKeyExists(arguments.attributes, arguments.name))
+ {
+ loc.returnValue = arguments.attributes[arguments.name];
+ if (Right(loc.returnValue, 1) != ";")
+ loc.returnValue = loc.returnValue & ";";
+ loc.returnValue = loc.returnValue & arguments.content;
+ }
+ else
+ {
+ loc.returnValue = arguments.content;
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="$getObject" returntype="any" access="public" output="false" hint="Returns the object referenced by the variable name passed in. If the scope is included it gets it from there, otherwise it gets it from the variables scope.">
+ <cfargument name="objectName" type="string" required="true">
+ <cfscript>
+ var loc = {};
+ loc.returnValue = "";
+
+ try
+ {
+ if (Find(".", arguments.objectName) or Find("[", arguments.objectName)) // we can't directly invoke objects in structure or arrays of objects so we must evaluate
+ loc.returnValue = Evaluate(arguments.objectName);
+ else
+ loc.returnValue = variables[arguments.objectName];
+ }
+ catch (Any e)
+ {
+ if (application.wheels.showErrorInformation)
+ $throw(type="Wheels.ObjectNotFound", message="Wheels tried to find the model object `#arguments.objectName#` for the form helper, but it does not exist.");
+ else
+ $throw(argumentCollection=e);
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/view/sanitize.cfm b/src/main/webapp/wheels/view/sanitize.cfm new file mode 100755 index 0000000..5384805 --- /dev/null +++ b/src/main/webapp/wheels/view/sanitize.cfm @@ -0,0 +1,36 @@ +<cffunction name="stripLinks" returntype="string" access="public" output="false" hint="Removes all links from an HTML string, leaving just the link text."
+ examples=
+ '
+ ##stripLinks("<strong>Wheels</strong> is a framework for <a href="http://www.adobe.com/products/coldfusion/">ColdFusion</a>.")##
+ -> <strong>Wheels</strong> is a framework for ColdFusion.
+ '
+ categories="view-helper,sanitize" functions="stripTags,h">
+ <cfargument name="html" type="string" required="true" hint="The HTML to remove links from.">
+ <cfreturn REReplaceNoCase(arguments.html, "<a.*?>(.*?)</a>", "\1" , "all")>
+</cffunction>
+
+<cffunction name="stripTags" returntype="string" access="public" output="false" hint="Removes all HTML tags from a string."
+ examples=
+ '
+ ##stripTags("<strong>Wheels</strong> is a framework for <a href="http://www.adobe.com/products/coldfusion/">ColdFusion</a>.")##
+ -> Wheels is a framework for ColdFusion.
+ '
+ categories="view-helper,sanitize" functions="stripLinks,h">
+ <cfargument name="html" type="string" required="true" hint="The HTML to remove tag markup from.">
+ <cfset var returnValue = "">
+ <cfset returnValue = REReplaceNoCase(arguments.html, "<\ *[a-z].*?>", "", "all")>
+ <cfset returnValue = REReplaceNoCase(returnValue, "<\ */\ *[a-z].*?>", "", "all")>
+ <cfreturn returnValue>
+</cffunction>
+
+<cffunction name="h" returntype="string" access="public" output="false" hint="Escapes unsafe HTML. Alias for your CFML engine's `XMLFormat()` function."
+ examples=
+ '
+ ##h("<b>This "is" a test string & it should format properly</b>")##
+ -> <b>This "is" a test string & it should format properly</b>
+ '
+ categories="view-helper,sanitize" functions="stripLinks,stripTags">
+ <cfargument name="content" type="string" required="true">
+ <!--- you can't use argumentCollection --->
+ <cfreturn XMLFormat(arguments.content)>
+</cffunction>
\ No newline at end of file diff --git a/src/main/webapp/wheels/view/text.cfm b/src/main/webapp/wheels/view/text.cfm new file mode 100755 index 0000000..fb8dddf --- /dev/null +++ b/src/main/webapp/wheels/view/text.cfm @@ -0,0 +1,283 @@ +<cffunction name="autoLink" returntype="string" access="public" output="false" hint="Turns all URLs and email addresses into hyperlinks."
+ examples=
+ '
+ ##autoLink("Download Wheels from http://cfwheels.org/download")##
+ -> Download Wheels from <a href="http://cfwheels.org/download">http://cfwheels.org/download</a>
+
+ ##autoLink("Email us at info@cfwheels.org")##
+ -> Email us at <a href="mailto:info@cfwheels.org">info@cfwheels.org</a>
+ '
+ categories="view-helper,text" functions="excerpt,highlight,simpleFormat,titleize,truncate">
+ <cfargument name="text" type="string" required="true" hint="The text to create links in.">
+ <cfargument name="link" type="string" required="false" default="all" hint="Whether to link URLs, email addresses or both. Possible values are: `all` (default), `URLs` and `emailAddresses`.">
+ <cfargument name="relative" type="boolean" required="false" default="true" hint="Should we autolink relative urls">
+ <cfscript>
+ var loc = {};
+ if (arguments.link != "emailAddresses")
+ {
+ if(arguments.relative)
+ {
+ arguments.regex = "(?:(?:<a\s[^>]+)?(?:https?://|www\.|\/)[^\s\b]+)";
+ }
+ else
+ {
+ arguments.regex = "(?:(?:<a\s[^>]+)?(?:https?://|www\.)[^\s\b]+)";
+ }
+ arguments.text = $autoLinkLoop(argumentCollection=arguments);
+ }
+ if (arguments.link != "URLs")
+ {
+ arguments.regex = "(?:(?:<a\s[^>]+)?(?:[^@\s]+)@(?:(?:[-a-z0-9]+\.)+[a-z]{2,}))";
+ arguments.protocol = "mailto:";
+ arguments.text = $autoLinkLoop(argumentCollection=arguments);
+ }
+ </cfscript>
+ <cfreturn arguments.text>
+</cffunction>
+
+<cffunction name="$autoLinkLoop" access="public" returntype="string" output="false">
+ <cfargument name="text" type="string" required="true">
+ <cfargument name="regex" type="string" required="true">
+ <cfargument name="protocol" type="string" required="false" default="">
+ <cfscript>
+ var loc = {};
+ loc.PunctuationRegEx = "([^\w\/-]+)$";
+ loc.startPosition = 1;
+ loc.match = ReFindNoCase(arguments.regex, arguments.text, loc.startPosition, true);
+ while(loc.match.pos[1] gt 0)
+ {
+ loc.startPosition = loc.match.pos[1] + loc.match.len[1];
+ loc.str = Mid(arguments.text, loc.match.pos[1], loc.match.len[1]);
+ if (Left(loc.str, 2) neq "<a")
+ {
+ arguments.text = RemoveChars(arguments.text, loc.match.pos[1], loc.match.len[1]);
+ // remove any sort of trailing puncuation
+ loc.punctuation = ArrayToList(ReMatchNoCase(loc.PunctuationRegEx, loc.str));
+ loc.str = REReplaceNoCase(loc.str, loc.PunctuationRegEx, "", "all");
+ arguments.href = arguments.protocol & loc.str;
+ loc.element = $element("a", arguments, loc.str, "text,regex,link,domains,protocol,relative") & loc.punctuation;
+ arguments.text = Insert(loc.element, arguments.text, loc.match.pos[1]-1);
+ loc.startPosition = loc.match.pos[1] + len(loc.element);
+ }
+ loc.startPosition++;
+ loc.match = ReFindNoCase(arguments.regex, arguments.text, loc.startPosition, true);
+ }
+ </cfscript>
+ <cfreturn arguments.text>
+</cffunction>
+
+<cffunction name="excerpt" returntype="string" access="public" output="false" hint="Extracts an excerpt from text that matches the first instance of a given phrase."
+ examples=
+ '
+ ##excerpt(text="ColdFusion Wheels is a Rails-like MVC framework for Adobe ColdFusion and Railo", phrase="framework", radius=5)##
+ -> ... MVC framework for ...
+ '
+ categories="view-helper,text" functions="autoLink,highlight,simpleFormat,titleize,truncate">
+ <cfargument name="text" type="string" required="true" hint="The text to extract an excerpt from.">
+ <cfargument name="phrase" type="string" required="true" hint="The phrase to extract.">
+ <cfargument name="radius" type="numeric" required="false" default="100" hint="Number of characters to extract surrounding the phrase.">
+ <cfargument name="excerptString" type="string" required="false" default="..." hint="String to replace first and/or last characters with.">
+ <cfscript>
+ var loc = {};
+ loc.pos = FindNoCase(arguments.phrase, arguments.text, 1);
+ if (loc.pos != 0)
+ {
+ if ((loc.pos-arguments.radius) <= 1)
+ {
+ loc.startPos = 1;
+ loc.truncateStart = "";
+ }
+ else
+ {
+ loc.startPos = loc.pos - arguments.radius;
+ loc.truncateStart = arguments.excerptString;
+ }
+ if ((loc.pos+Len(arguments.phrase)+arguments.radius) > Len(arguments.text))
+ {
+ loc.endPos = Len(arguments.text);
+ loc.truncateEnd = "";
+ }
+ else
+ {
+ loc.endPos = loc.pos + arguments.radius;
+ loc.truncateEnd = arguments.excerptString;
+ }
+ loc.returnValue = loc.truncateStart & Mid(arguments.text, loc.startPos, ((loc.endPos+Len(arguments.phrase))-(loc.startPos))) & loc.truncateEnd;
+ }
+ else
+ {
+ loc.returnValue = "";
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="highlight" returntype="string" access="public" output="false" hint="Highlights the phrase(s) everywhere in the text if found by wrapping it in a `span` tag."
+ examples=
+ '
+ ##highlight(text="You searched for: Wheels", phrases="Wheels")##
+ -> You searched for: <span class="highlight">Wheels</span>
+ '
+ categories="view-helper,text" functions="autoLink,excerpt,simpleFormat,titleize,truncate">
+ <cfargument name="text" type="string" required="true" hint="Text to search.">
+ <cfargument name="phrases" type="string" required="true" hint="List of phrases to highlight.">
+ <cfargument name="delimiter" type="string" required="false" hint="Delimiter to use in `phrases` argument.">
+ <cfargument name="tag" type="string" required="false" hint="HTML tag to use to wrap the highlighted phrase(s).">
+ <cfargument name="class" type="string" required="false" hint="Class to use in the tags wrapping highlighted phrase(s).">
+ <cfscript>
+ var loc = {};
+ $args(name="highlight", args=arguments);
+ if (!Len(arguments.text) || !Len(arguments.phrases))
+ {
+ loc.returnValue = arguments.text;
+ }
+ else
+ {
+ loc.origText = arguments.text;
+ loc.iEnd = ListLen(arguments.phrases, arguments.delimiter);
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i=loc.i+1)
+ {
+ loc.newText = "";
+ loc.phrase = Trim(ListGetAt(arguments.phrases, loc.i, arguments.delimiter));
+ loc.pos = 1;
+ while (FindNoCase(loc.phrase, loc.origText, loc.pos))
+ {
+ loc.foundAt = FindNoCase(loc.phrase, loc.origText, loc.pos);
+ loc.prevText = Mid(loc.origText, loc.pos, loc.foundAt-loc.pos);
+ loc.newText = loc.newText & loc.prevText;
+ if (Find("<", loc.origText, loc.foundAt) < Find(">", loc.origText, loc.foundAt) || !Find(">", loc.origText, loc.foundAt))
+ loc.newText = loc.newText & "<" & arguments.tag & " class=""" & arguments.class & """>" & Mid(loc.origText, loc.foundAt, Len(loc.phrase)) & "</" & arguments.tag & ">";
+ else
+ loc.newText = loc.newText & Mid(loc.origText, loc.foundAt, Len(loc.phrase));
+ loc.pos = loc.foundAt + Len(loc.phrase);
+ }
+ loc.newText = loc.newText & Mid(loc.origText, loc.pos, Len(loc.origText) - loc.pos + 1);
+ loc.origText = loc.newText;
+ }
+ loc.returnValue = loc.newText;
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="simpleFormat" returntype="string" access="public" output="false" hint="Replaces single newline characters with HTML break tags and double newline characters with HTML paragraph tags (properly closed to comply with XHTML standards)."
+ examples=
+ '
+ <!--- How most of your calls will look --->
+ ##simpleFormat(post.comments)##
+
+ <!--- Demonstrates what output looks like with specific data --->
+ <cfsavecontent variable="comment">
+ I love this post!
+
+ Here''s why:
+ * Short
+ * Succinct
+ * Awesome
+ </cfsavecontent>
+ ##simpleFormat(comment)##
+ -> <p>I love this post!</p>
+ <p>
+ Here''s why:<br />
+ * Short<br />
+ * Succinct<br />
+ * Awesome
+ </p>
+ '
+ categories="view-helper,text" functions="autoLink,excerpt,highlight,titleize,truncate">
+ <cfargument name="text" type="string" required="true" hint="The text to format.">
+ <cfargument name="wrap" type="boolean" required="false" default="true" hint="Set to `true` to wrap the result in a paragraph.">
+ <cfscript>
+ var loc = {};
+ loc.returnValue = Trim(arguments.text);
+ loc.returnValue = Replace(loc.returnValue, "#Chr(13)#", "", "all");
+ loc.returnValue = Replace(loc.returnValue, "#Chr(10)##Chr(10)#", "</p><p>", "all");
+ loc.returnValue = Replace(loc.returnValue, "#Chr(10)#", "<br />", "all");
+
+ // add back in our returns so we can strip the tags and re-apply them without issue
+ // this is good to be edited the textarea text in it's original format (line returns)
+ loc.returnValue = Replace(loc.returnValue, "</p><p>", "</p>#Chr(10)##Chr(10)#<p>", "all");
+ loc.returnValue = Replace(loc.returnValue, "<br />", "<br />#Chr(10)#", "all");
+
+ if (arguments.wrap)
+ loc.returnValue = "<p>" & loc.returnValue & "</p>";
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="titleize" returntype="string" access="public" output="false" hint="Capitalizes all words in the text to create a nicer looking title."
+ examples=
+ '
+ ##titleize("Wheels is a framework for ColdFusion")##
+ -> Wheels Is A Framework For ColdFusion
+ '
+ categories="view-helper,text" functions="autoLink,excerpt,highlight,simpleFormat,truncate">
+ <cfargument name="word" type="string" required="true" hint="The text to turn into a title.">
+ <cfscript>
+ var loc = {};
+ loc.returnValue = "";
+ loc.iEnd = ListLen(arguments.word, " ");
+ for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
+ {
+ loc.returnValue = ListAppend(loc.returnValue, capitalize(ListGetAt(arguments.word, loc.i, " ")), " ");
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="truncate" returntype="string" access="public" output="false" hint="Truncates text to the specified length and replaces the last characters with the specified truncate string (which defaults to ""..."")."
+ examples=
+ '
+ ##truncate(text="Wheels is a framework for ColdFusion", length=20)##
+ -> Wheels is a frame...
+
+ ##truncate(text="Wheels is a framework for ColdFusion", truncateString=" (more)")##
+ -> Wheels is a framework f (more)
+ '
+ categories="view-helper,text" functions="autoLink,excerpt,highlight,simpleFormat,titleize">
+ <cfargument name="text" type="string" required="true" hint="The text to truncate.">
+ <cfargument name="length" type="numeric" required="false" hint="Length to truncate the text to.">
+ <cfargument name="truncateString" type="string" required="false" hint="String to replace the last characters with.">
+ <cfscript>
+ var loc = {};
+ $args(name="truncate", args=arguments);
+ if (Len(arguments.text) gt arguments.length)
+ loc.returnValue = Left(arguments.text, arguments.length-Len(arguments.truncateString)) & arguments.truncateString;
+ else
+ loc.returnValue = arguments.text;
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
+
+<cffunction name="wordTruncate" returntype="string" access="public" output="false" hint="Truncates text to the specified length of words and replaces the remaining characters with the specified truncate string (which defaults to ""..."")."
+ examples=
+ '
+ ##wordTruncate(text="Wheels is a framework for ColdFusion", length=4)##
+ -> Wheels is a framework...
+
+ ##truncate(text="Wheels is a framework for ColdFusion", truncateString=" (more)")##
+ -> Wheels is a framework for (more)
+ '
+ categories="view-helper,text" functions="autoLink,excerpt,highlight,simpleFormat,titleize">
+ <cfargument name="text" type="string" required="true" hint="The text to truncate.">
+ <cfargument name="length" type="numeric" required="false" default="5" hint="Number of words to truncate the text to.">
+ <cfargument name="truncateString" type="string" required="false" default="..." hint="String to replace the last characters with.">
+ <cfscript>
+ var loc = {};
+ loc.returnValue = "";
+ loc.wordArray = ListToArray(arguments.text, " ", false);
+ loc.wordLen = ArrayLen(loc.wordArray);
+
+ if (loc.wordLen gt arguments.length)
+ {
+ for (loc.i = 1; loc.i lte arguments.length; loc.i++)
+ loc.returnValue = ListAppend(loc.returnValue, loc.wordArray[loc.i], " ");
+ loc.returnValue = loc.returnValue & arguments.truncateString;
+ }
+ else
+ {
+ loc.returnValue = arguments.text;
+ }
+ </cfscript>
+ <cfreturn loc.returnValue>
+</cffunction>
\ No newline at end of file |